@icedevml/tinypki-client-side-cert-req 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +30 -0
- package/dist/index.js +44127 -0
- package/dist/index.js.map +1 -0
- package/dist/tinypki-client-side-cert-req-lib.js +33 -0
- package/dist/tinypki-client-side-cert-req-lib.js.map +1 -0
- package/dist/types/api/base64ToBuffer.d.ts +2 -0
- package/dist/types/api/exportKeyDERB64.d.ts +1 -0
- package/dist/types/api/generateCSR.d.ts +9 -0
- package/dist/types/api/generatePKCS12.d.ts +13 -0
- package/dist/types/api/generateSelfSignedCert.d.ts +5 -0
- package/dist/types/api/savePKCS12BufferAsFile.d.ts +10 -0
- package/dist/types/index.d.ts +19 -0
- package/dist/types/internal/pemChainToDERB64Array.d.ts +1 -0
- package/dist/types/internal/toPkcs12Asn1Generic.d.ts +9 -0
- package/package.json +38 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var TinyPKIClientSideCertReqLib=(function(Pr){"use strict";function cp(r){return String.fromCharCode.apply(null,new Uint8Array(r))}async function lp(r){const e=await window.crypto.subtle.exportKey("pkcs8",r),t=cp(e);return window.btoa(t)}var _s=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fp(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var e=r.default;if(typeof e=="function"){var t=function i(){var a=!1;try{a=this instanceof i}catch{}return a?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var a=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:function(){return r[i]}})}),t}var jc={};var Hc;function hp(){if(Hc)return jc;Hc=1;var r;return(function(e){(function(t){var i=typeof globalThis=="object"?globalThis:typeof _s=="object"?_s:typeof self=="object"?self:typeof this=="object"?this:p(),a=o(e);typeof i.Reflect<"u"&&(a=o(i.Reflect,a)),t(a,i),typeof i.Reflect>"u"&&(i.Reflect=e);function o(f,E){return function(I,B){Object.defineProperty(f,I,{configurable:!0,writable:!0,value:B}),E&&E(I,B)}}function s(){try{return Function("return this;")()}catch{}}function n(){try{return(0,eval)("(function() { return this; })()")}catch{}}function p(){return s()||n()}})(function(t,i){var a=Object.prototype.hasOwnProperty,o=typeof Symbol=="function",s=o&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",n=o&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",p=typeof Object.create=="function",f={__proto__:[]}instanceof Array,E=!p&&!f,I={create:p?function(){return W(Object.create(null))}:f?function(){return W({__proto__:null})}:function(){return W({})},has:E?function(V,H){return a.call(V,H)}:function(V,H){return H in V},get:E?function(V,H){return a.call(V,H)?V[H]:void 0}:function(V,H){return V[H]}},B=Object.getPrototypeOf(Function),l=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:v(),y=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:b(),S=typeof WeakMap=="function"?WeakMap:j(),x=o?Symbol.for("@reflect-metadata:registry"):void 0,c=Ze(),m=Qe(c);function A(V,H,Z,ne){if(Ee(Z)){if(!d(V))throw new TypeError;if(!$(H))throw new TypeError;return z(V,H)}else{if(!d(V))throw new TypeError;if(!ce(H))throw new TypeError;if(!ce(ne)&&!Ee(ne)&&!fe(ne))throw new TypeError;return fe(ne)&&(ne=void 0),Z=L(Z),J(V,H,Z,ne)}}t("decorate",A);function N(V,H){function Z(ne,de){if(!ce(ne))throw new TypeError;if(!Ee(de)&&!q(de))throw new TypeError;ge(V,H,ne,de)}return Z}t("metadata",N);function O(V,H,Z,ne){if(!ce(Z))throw new TypeError;return Ee(ne)||(ne=L(ne)),ge(V,H,Z,ne)}t("defineMetadata",O);function C(V,H,Z){if(!ce(H))throw new TypeError;return Ee(Z)||(Z=L(Z)),X(V,H,Z)}t("hasMetadata",C);function h(V,H,Z){if(!ce(H))throw new TypeError;return Ee(Z)||(Z=L(Z)),te(V,H,Z)}t("hasOwnMetadata",h);function u(V,H,Z){if(!ce(H))throw new TypeError;return Ee(Z)||(Z=L(Z)),ue(V,H,Z)}t("getMetadata",u);function _(V,H,Z){if(!ce(H))throw new TypeError;return Ee(Z)||(Z=L(Z)),pe(V,H,Z)}t("getOwnMetadata",_);function M(V,H){if(!ce(V))throw new TypeError;return Ee(H)||(H=L(H)),ke(V,H)}t("getMetadataKeys",M);function G(V,H){if(!ce(V))throw new TypeError;return Ee(H)||(H=L(H)),Ne(V,H)}t("getOwnMetadataKeys",G);function F(V,H,Z){if(!ce(H))throw new TypeError;if(Ee(Z)||(Z=L(Z)),!ce(H))throw new TypeError;Ee(Z)||(Z=L(Z));var ne=R(H,Z,!1);return Ee(ne)?!1:ne.OrdinaryDeleteMetadata(V,H,Z)}t("deleteMetadata",F);function z(V,H){for(var Z=V.length-1;Z>=0;--Z){var ne=V[Z],de=ne(H);if(!Ee(de)&&!fe(de)){if(!$(de))throw new TypeError;H=de}}return H}function J(V,H,Z,ne){for(var de=V.length-1;de>=0;--de){var Ue=V[de],_e=Ue(H,Z,ne);if(!Ee(_e)&&!fe(_e)){if(!ce(_e))throw new TypeError;ne=_e}}return ne}function X(V,H,Z){var ne=te(V,H,Z);if(ne)return!0;var de=Oe(H);return fe(de)?!1:X(V,de,Z)}function te(V,H,Z){var ne=R(H,Z,!1);return Ee(ne)?!1:g(ne.OrdinaryHasOwnMetadata(V,H,Z))}function ue(V,H,Z){var ne=te(V,H,Z);if(ne)return pe(V,H,Z);var de=Oe(H);if(!fe(de))return ue(V,de,Z)}function pe(V,H,Z){var ne=R(H,Z,!1);if(!Ee(ne))return ne.OrdinaryGetOwnMetadata(V,H,Z)}function ge(V,H,Z,ne){var de=R(Z,ne,!0);de.OrdinaryDefineOwnMetadata(V,H,Z,ne)}function ke(V,H){var Z=Ne(V,H),ne=Oe(V);if(ne===null)return Z;var de=ke(ne,H);if(de.length<=0)return Z;if(Z.length<=0)return de;for(var Ue=new y,_e=[],Pe=0,ve=Z;Pe<ve.length;Pe++){var xe=ve[Pe],be=Ue.has(xe);be||(Ue.add(xe),_e.push(xe))}for(var Te=0,He=de;Te<He.length;Te++){var xe=He[Te],be=Ue.has(xe);be||(Ue.add(xe),_e.push(xe))}return _e}function Ne(V,H){var Z=R(V,H,!1);return Z?Z.OrdinaryOwnMetadataKeys(V,H):[]}function Le(V){if(V===null)return 1;switch(typeof V){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return V===null?1:6;default:return 6}}function Ee(V){return V===void 0}function fe(V){return V===null}function Me(V){return typeof V=="symbol"}function ce(V){return typeof V=="object"?V!==null:typeof V=="function"}function st(V,H){switch(Le(V)){case 0:return V;case 1:return V;case 2:return V;case 3:return V;case 4:return V;case 5:return V}var Z="string",ne=me(V,s);if(ne!==void 0){var de=ne.call(V,Z);if(ce(de))throw new TypeError;return de}return Ve(V)}function Ve(V,H){var Z,ne;{var de=V.toString;if(k(de)){var ne=de.call(V);if(!ce(ne))return ne}var Z=V.valueOf;if(k(Z)){var ne=Z.call(V);if(!ce(ne))return ne}}throw new TypeError}function g(V){return!!V}function P(V){return""+V}function L(V){var H=st(V);return Me(H)?H:P(H)}function d(V){return Array.isArray?Array.isArray(V):V instanceof Object?V instanceof Array:Object.prototype.toString.call(V)==="[object Array]"}function k(V){return typeof V=="function"}function $(V){return typeof V=="function"}function q(V){switch(Le(V)){case 3:return!0;case 4:return!0;default:return!1}}function ae(V,H){return V===H||V!==V&&H!==H}function me(V,H){var Z=V[H];if(Z!=null){if(!k(Z))throw new TypeError;return Z}}function Ie(V){var H=me(V,n);if(!k(H))throw new TypeError;var Z=H.call(V);if(!ce(Z))throw new TypeError;return Z}function re(V){return V.value}function Ce(V){var H=V.next();return H.done?!1:H}function Re(V){var H=V.return;H&&H.call(V)}function Oe(V){var H=Object.getPrototypeOf(V);if(typeof V!="function"||V===B||H!==B)return H;var Z=V.prototype,ne=Z&&Object.getPrototypeOf(Z);if(ne==null||ne===Object.prototype)return H;var de=ne.constructor;return typeof de!="function"||de===V?H:de}function De(){var V;!Ee(x)&&typeof i.Reflect<"u"&&!(x in i.Reflect)&&typeof i.Reflect.defineMetadata=="function"&&(V=tt(i.Reflect));var H,Z,ne,de=new S,Ue={registerProvider:_e,getProvider:ve,setProvider:be};return Ue;function _e(Te){if(!Object.isExtensible(Ue))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case V===Te:break;case Ee(H):H=Te;break;case H===Te:break;case Ee(Z):Z=Te;break;case Z===Te:break;default:ne===void 0&&(ne=new y),ne.add(Te);break}}function Pe(Te,He){if(!Ee(H)){if(H.isProviderFor(Te,He))return H;if(!Ee(Z)){if(Z.isProviderFor(Te,He))return H;if(!Ee(ne))for(var Fe=Ie(ne);;){var qe=Ce(Fe);if(!qe)return;var Xe=re(qe);if(Xe.isProviderFor(Te,He))return Re(Fe),Xe}}}if(!Ee(V)&&V.isProviderFor(Te,He))return V}function ve(Te,He){var Fe=de.get(Te),qe;return Ee(Fe)||(qe=Fe.get(He)),Ee(qe)&&(qe=Pe(Te,He),Ee(qe)||(Ee(Fe)&&(Fe=new l,de.set(Te,Fe)),Fe.set(He,qe))),qe}function xe(Te){if(Ee(Te))throw new TypeError;return H===Te||Z===Te||!Ee(ne)&&ne.has(Te)}function be(Te,He,Fe){if(!xe(Fe))throw new Error("Metadata provider not registered.");var qe=ve(Te,He);if(qe!==Fe){if(!Ee(qe))return!1;var Xe=de.get(Te);Ee(Xe)&&(Xe=new l,de.set(Te,Xe)),Xe.set(He,Fe)}return!0}}function Ze(){var V;return!Ee(x)&&ce(i.Reflect)&&Object.isExtensible(i.Reflect)&&(V=i.Reflect[x]),Ee(V)&&(V=De()),!Ee(x)&&ce(i.Reflect)&&Object.isExtensible(i.Reflect)&&Object.defineProperty(i.Reflect,x,{enumerable:!1,configurable:!1,writable:!1,value:V}),V}function Qe(V){var H=new S,Z={isProviderFor:function(xe,be){var Te=H.get(xe);return Ee(Te)?!1:Te.has(be)},OrdinaryDefineOwnMetadata:_e,OrdinaryHasOwnMetadata:de,OrdinaryGetOwnMetadata:Ue,OrdinaryOwnMetadataKeys:Pe,OrdinaryDeleteMetadata:ve};return c.registerProvider(Z),Z;function ne(xe,be,Te){var He=H.get(xe),Fe=!1;if(Ee(He)){if(!Te)return;He=new l,H.set(xe,He),Fe=!0}var qe=He.get(be);if(Ee(qe)){if(!Te)return;if(qe=new l,He.set(be,qe),!V.setProvider(xe,be,Z))throw He.delete(be),Fe&&H.delete(xe),new Error("Wrong provider for target.")}return qe}function de(xe,be,Te){var He=ne(be,Te,!1);return Ee(He)?!1:g(He.has(xe))}function Ue(xe,be,Te){var He=ne(be,Te,!1);if(!Ee(He))return He.get(xe)}function _e(xe,be,Te,He){var Fe=ne(Te,He,!0);Fe.set(xe,be)}function Pe(xe,be){var Te=[],He=ne(xe,be,!1);if(Ee(He))return Te;for(var Fe=He.keys(),qe=Ie(Fe),Xe=0;;){var ot=Ce(qe);if(!ot)return Te.length=Xe,Te;var ut=re(ot);try{Te[Xe]=ut}catch(ct){try{Re(qe)}finally{throw ct}}Xe++}}function ve(xe,be,Te){var He=ne(be,Te,!1);if(Ee(He)||!He.delete(xe))return!1;if(He.size===0){var Fe=H.get(be);Ee(Fe)||(Fe.delete(Te),Fe.size===0&&H.delete(Fe))}return!0}}function tt(V){var H=V.defineMetadata,Z=V.hasOwnMetadata,ne=V.getOwnMetadata,de=V.getOwnMetadataKeys,Ue=V.deleteMetadata,_e=new S,Pe={isProviderFor:function(ve,xe){var be=_e.get(ve);return!Ee(be)&&be.has(xe)?!0:de(ve,xe).length?(Ee(be)&&(be=new y,_e.set(ve,be)),be.add(xe),!0):!1},OrdinaryDefineOwnMetadata:H,OrdinaryHasOwnMetadata:Z,OrdinaryGetOwnMetadata:ne,OrdinaryOwnMetadataKeys:de,OrdinaryDeleteMetadata:Ue};return Pe}function R(V,H,Z){var ne=c.getProvider(V,H);if(!Ee(ne))return ne;if(Z){if(c.setProvider(V,H,m))return m;throw new Error("Illegal state.")}}function v(){var V={},H=[],Z=(function(){function Pe(ve,xe,be){this._index=0,this._keys=ve,this._values=xe,this._selector=be}return Pe.prototype["@@iterator"]=function(){return this},Pe.prototype[n]=function(){return this},Pe.prototype.next=function(){var ve=this._index;if(ve>=0&&ve<this._keys.length){var xe=this._selector(this._keys[ve],this._values[ve]);return ve+1>=this._keys.length?(this._index=-1,this._keys=H,this._values=H):this._index++,{value:xe,done:!1}}return{value:void 0,done:!0}},Pe.prototype.throw=function(ve){throw this._index>=0&&(this._index=-1,this._keys=H,this._values=H),ve},Pe.prototype.return=function(ve){return this._index>=0&&(this._index=-1,this._keys=H,this._values=H),{value:ve,done:!0}},Pe})(),ne=(function(){function Pe(){this._keys=[],this._values=[],this._cacheKey=V,this._cacheIndex=-2}return Object.defineProperty(Pe.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),Pe.prototype.has=function(ve){return this._find(ve,!1)>=0},Pe.prototype.get=function(ve){var xe=this._find(ve,!1);return xe>=0?this._values[xe]:void 0},Pe.prototype.set=function(ve,xe){var be=this._find(ve,!0);return this._values[be]=xe,this},Pe.prototype.delete=function(ve){var xe=this._find(ve,!1);if(xe>=0){for(var be=this._keys.length,Te=xe+1;Te<be;Te++)this._keys[Te-1]=this._keys[Te],this._values[Te-1]=this._values[Te];return this._keys.length--,this._values.length--,ae(ve,this._cacheKey)&&(this._cacheKey=V,this._cacheIndex=-2),!0}return!1},Pe.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=V,this._cacheIndex=-2},Pe.prototype.keys=function(){return new Z(this._keys,this._values,de)},Pe.prototype.values=function(){return new Z(this._keys,this._values,Ue)},Pe.prototype.entries=function(){return new Z(this._keys,this._values,_e)},Pe.prototype["@@iterator"]=function(){return this.entries()},Pe.prototype[n]=function(){return this.entries()},Pe.prototype._find=function(ve,xe){if(!ae(this._cacheKey,ve)){this._cacheIndex=-1;for(var be=0;be<this._keys.length;be++)if(ae(this._keys[be],ve)){this._cacheIndex=be;break}}return this._cacheIndex<0&&xe&&(this._cacheIndex=this._keys.length,this._keys.push(ve),this._values.push(void 0)),this._cacheIndex},Pe})();return ne;function de(Pe,ve){return Pe}function Ue(Pe,ve){return ve}function _e(Pe,ve){return[Pe,ve]}}function b(){var V=(function(){function H(){this._map=new l}return Object.defineProperty(H.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),H.prototype.has=function(Z){return this._map.has(Z)},H.prototype.add=function(Z){return this._map.set(Z,Z),this},H.prototype.delete=function(Z){return this._map.delete(Z)},H.prototype.clear=function(){this._map.clear()},H.prototype.keys=function(){return this._map.keys()},H.prototype.values=function(){return this._map.keys()},H.prototype.entries=function(){return this._map.entries()},H.prototype["@@iterator"]=function(){return this.keys()},H.prototype[n]=function(){return this.keys()},H})();return V}function j(){var V=16,H=I.create(),Z=ne();return(function(){function ve(){this._key=ne()}return ve.prototype.has=function(xe){var be=de(xe,!1);return be!==void 0?I.has(be,this._key):!1},ve.prototype.get=function(xe){var be=de(xe,!1);return be!==void 0?I.get(be,this._key):void 0},ve.prototype.set=function(xe,be){var Te=de(xe,!0);return Te[this._key]=be,this},ve.prototype.delete=function(xe){var be=de(xe,!1);return be!==void 0?delete be[this._key]:!1},ve.prototype.clear=function(){this._key=ne()},ve})();function ne(){var ve;do ve="@@WeakMap@@"+Pe();while(I.has(H,ve));return H[ve]=!0,ve}function de(ve,xe){if(!a.call(ve,Z)){if(!xe)return;Object.defineProperty(ve,Z,{value:I.create()})}return ve[Z]}function Ue(ve,xe){for(var be=0;be<xe;++be)ve[be]=Math.random()*255|0;return ve}function _e(ve){if(typeof Uint8Array=="function"){var xe=new Uint8Array(ve);return typeof crypto<"u"?crypto.getRandomValues(xe):typeof msCrypto<"u"?msCrypto.getRandomValues(xe):Ue(xe,ve),xe}return Ue(new Array(ve),ve)}function Pe(){var ve=_e(V);ve[6]=ve[6]&79|64,ve[8]=ve[8]&191|128;for(var xe="",be=0;be<V;++be){var Te=ve[be];(be===4||be===6||be===8)&&(xe+="-"),Te<16&&(xe+="0"),xe+=Te.toString(16).toLowerCase()}return xe}}function W(V){return V.__=void 0,delete V.__,V}})})(r||(r={})),jc}hp();var Vr={};var qc;function pp(){if(qc)return Vr;qc=1;const r="[object ArrayBuffer]";class e{static isArrayBuffer(l){return Object.prototype.toString.call(l)===r}static toArrayBuffer(l){return this.isArrayBuffer(l)?l:l.byteLength===l.buffer.byteLength||l.byteOffset===0&&l.byteLength===l.buffer.byteLength?l.buffer:this.toUint8Array(l.buffer).slice(l.byteOffset,l.byteOffset+l.byteLength).buffer}static toUint8Array(l){return this.toView(l,Uint8Array)}static toView(l,y){if(l.constructor===y)return l;if(this.isArrayBuffer(l))return new y(l);if(this.isArrayBufferView(l))return new y(l.buffer,l.byteOffset,l.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(l){return this.isArrayBufferView(l)||this.isArrayBuffer(l)}static isArrayBufferView(l){return ArrayBuffer.isView(l)||l&&this.isArrayBuffer(l.buffer)}static isEqual(l,y){const S=e.toUint8Array(l),x=e.toUint8Array(y);if(S.length!==x.byteLength)return!1;for(let c=0;c<S.length;c++)if(S[c]!==x[c])return!1;return!0}static concat(...l){let y;Array.isArray(l[0])&&!(l[1]instanceof Function)||Array.isArray(l[0])&&l[1]instanceof Function?y=l[0]:l[l.length-1]instanceof Function?y=l.slice(0,l.length-1):y=l;let S=0;for(const m of y)S+=m.byteLength;const x=new Uint8Array(S);let c=0;for(const m of y){const A=this.toUint8Array(m);x.set(A,c),c+=A.length}return l[l.length-1]instanceof Function?this.toView(x,l[l.length-1]):x.buffer}}const t="string",i=/^[0-9a-f\s]+$/i,a=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,o=/^[a-zA-Z0-9-_]+$/;class s{static fromString(l){const y=unescape(encodeURIComponent(l)),S=new Uint8Array(y.length);for(let x=0;x<y.length;x++)S[x]=y.charCodeAt(x);return S.buffer}static toString(l){const y=e.toUint8Array(l);let S="";for(let c=0;c<y.length;c++)S+=String.fromCharCode(y[c]);return decodeURIComponent(escape(S))}}class n{static toString(l,y=!1){const S=e.toArrayBuffer(l),x=new DataView(S);let c="";for(let m=0;m<S.byteLength;m+=2){const A=x.getUint16(m,y);c+=String.fromCharCode(A)}return c}static fromString(l,y=!1){const S=new ArrayBuffer(l.length*2),x=new DataView(S);for(let c=0;c<l.length;c++)x.setUint16(c*2,l.charCodeAt(c),y);return S}}class p{static isHex(l){return typeof l===t&&i.test(l)}static isBase64(l){return typeof l===t&&a.test(l)}static isBase64Url(l){return typeof l===t&&o.test(l)}static ToString(l,y="utf8"){const S=e.toUint8Array(l);switch(y.toLowerCase()){case"utf8":return this.ToUtf8String(S);case"binary":return this.ToBinary(S);case"hex":return this.ToHex(S);case"base64":return this.ToBase64(S);case"base64url":return this.ToBase64Url(S);case"utf16le":return n.toString(S,!0);case"utf16":case"utf16be":return n.toString(S);default:throw new Error(`Unknown type of encoding '${y}'`)}}static FromString(l,y="utf8"){if(!l)return new ArrayBuffer(0);switch(y.toLowerCase()){case"utf8":return this.FromUtf8String(l);case"binary":return this.FromBinary(l);case"hex":return this.FromHex(l);case"base64":return this.FromBase64(l);case"base64url":return this.FromBase64Url(l);case"utf16le":return n.fromString(l,!0);case"utf16":case"utf16be":return n.fromString(l);default:throw new Error(`Unknown type of encoding '${y}'`)}}static ToBase64(l){const y=e.toUint8Array(l);if(typeof btoa<"u"){const S=this.ToString(y,"binary");return btoa(S)}else return Buffer.from(y).toString("base64")}static FromBase64(l){const y=this.formatString(l);if(!y)return new ArrayBuffer(0);if(!p.isBase64(y))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(y)):new Uint8Array(Buffer.from(y,"base64")).buffer}static FromBase64Url(l){const y=this.formatString(l);if(!y)return new ArrayBuffer(0);if(!p.isBase64Url(y))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(y.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(l){return this.ToBase64(l).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(l,y=p.DEFAULT_UTF8_ENCODING){switch(y){case"ascii":return this.FromBinary(l);case"utf8":return s.fromString(l);case"utf16":case"utf16be":return n.fromString(l);case"utf16le":case"usc2":return n.fromString(l,!0);default:throw new Error(`Unknown type of encoding '${y}'`)}}static ToUtf8String(l,y=p.DEFAULT_UTF8_ENCODING){switch(y){case"ascii":return this.ToBinary(l);case"utf8":return s.toString(l);case"utf16":case"utf16be":return n.toString(l);case"utf16le":case"usc2":return n.toString(l,!0);default:throw new Error(`Unknown type of encoding '${y}'`)}}static FromBinary(l){const y=l.length,S=new Uint8Array(y);for(let x=0;x<y;x++)S[x]=l.charCodeAt(x);return S.buffer}static ToBinary(l){const y=e.toUint8Array(l);let S="";for(let x=0;x<y.length;x++)S+=String.fromCharCode(y[x]);return S}static ToHex(l){const y=e.toUint8Array(l);let S="";const x=y.length;for(let c=0;c<x;c++){const m=y[c];m<16&&(S+="0"),S+=m.toString(16)}return S}static FromHex(l){let y=this.formatString(l);if(!y)return new ArrayBuffer(0);if(!p.isHex(y))throw new TypeError("Argument 'hexString' is not HEX encoded");y.length%2&&(y=`0${y}`);const S=new Uint8Array(y.length/2);for(let x=0;x<y.length;x=x+2){const c=y.slice(x,x+2);S[x/2]=parseInt(c,16)}return S.buffer}static ToUtf16String(l,y=!1){return n.toString(l,y)}static FromUtf16String(l,y=!1){return n.fromString(l,y)}static Base64Padding(l){const y=4-l.length%4;if(y<4)for(let S=0;S<y;S++)l+="=";return l}static formatString(l){return l?.replace(/[\n\r\t ]/g,"")||""}}p.DEFAULT_UTF8_ENCODING="utf8";function f(B,...l){const y=arguments[0];for(let S=1;S<arguments.length;S++){const x=arguments[S];for(const c in x)y[c]=x[c]}return y}function E(...B){const l=B.map(x=>x.byteLength).reduce((x,c)=>x+c),y=new Uint8Array(l);let S=0;return B.map(x=>new Uint8Array(x)).forEach(x=>{for(const c of x)y[S++]=c}),y.buffer}function I(B,l){if(!(B&&l)||B.byteLength!==l.byteLength)return!1;const y=new Uint8Array(B),S=new Uint8Array(l);for(let x=0;x<B.byteLength;x++)if(y[x]!==S[x])return!1;return!0}return Vr.BufferSourceConverter=e,Vr.Convert=p,Vr.assign=f,Vr.combine=E,Vr.isEqual=I,Vr}var ie=pp();function oi(r,e){let t=0;if(r.length===1)return r[0];for(let i=r.length-1;i>=0;i--)t+=r[r.length-1-i]*Math.pow(2,e*i);return t}function Mr(r,e,t=-1){const i=t;let a=r,o=0,s=Math.pow(2,e);for(let n=1;n<8;n++){if(r<s){let p;if(i<0)p=new ArrayBuffer(n),o=n;else{if(i<n)return new ArrayBuffer(0);p=new ArrayBuffer(i),o=i}const f=new Uint8Array(p);for(let E=n-1;E>=0;E--){const I=Math.pow(2,E*e);f[o-E-1]=Math.floor(a/I),a-=f[o-E-1]*I}return p}s*=Math.pow(2,e)}return new ArrayBuffer(0)}function Rs(...r){let e=0,t=0;for(const o of r)e+=o.length;const i=new ArrayBuffer(e),a=new Uint8Array(i);for(const o of r)a.set(o,t),t+=o.length;return a}function Gc(){const r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const n=r[0]===255&&r[1]&128,p=r[0]===0&&(r[1]&128)===0;(n||p)&&this.warnings.push("Needlessly long format")}const e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let n=0;n<this.valueHex.byteLength;n++)t[n]=0;t[0]=r[0]&128;const i=oi(t,8),a=new ArrayBuffer(this.valueHex.byteLength),o=new Uint8Array(a);for(let n=0;n<this.valueHex.byteLength;n++)o[n]=r[n];return o[0]&=127,oi(o,8)-i}function dp(r){const e=r<0?r*-1:r;let t=128;for(let i=1;i<8;i++){if(e<=t){if(r<0){const s=t-e,n=Mr(s,8,i),p=new Uint8Array(n);return p[0]|=128,n}let a=Mr(e,8,i),o=new Uint8Array(a);if(o[0]&128){const s=a.slice(0),n=new Uint8Array(s);a=new ArrayBuffer(a.byteLength+1),o=new Uint8Array(a);for(let p=0;p<s.byteLength;p++)o[p+1]=n[p];o[0]=0}return a}t*=Math.pow(2,8)}return new ArrayBuffer(0)}function yp(r,e){if(r.byteLength!==e.byteLength)return!1;const t=new Uint8Array(r),i=new Uint8Array(e);for(let a=0;a<t.length;a++)if(t[a]!==i[a])return!1;return!0}function Pt(r,e){const t=r.toString(10);if(e<t.length)return"";const i=e-t.length,a=new Array(i);for(let s=0;s<i;s++)a[s]="0";return a.join("").concat(t)}function Hn(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function Us(r){let e=0,t=0;for(let a=0;a<r.length;a++){const o=r[a];e+=o.byteLength}const i=new Uint8Array(e);for(let a=0;a<r.length;a++){const o=r[a];i.set(new Uint8Array(o),t),t+=o.byteLength}return i.buffer}function dr(r,e,t,i){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):i<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-i<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)}class qn{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return Us(this.items)}}const Fi=[new Uint8Array([1])],$c="0123456789",Ls="name",zc="valueHexView",vp="isHexOnly",gp="idBlock",mp="tagClass",Cp="tagNumber",xp="isConstructed",Sp="fromBER",Ep="toBER",bp="local",Rt="",or=new ArrayBuffer(0),Gn=new Uint8Array(0),Ki="EndOfContent",Wc="OCTET STRING",Qc="BIT STRING";function ur(r){var e;return e=class extends r{get valueHex(){return this.valueHexView.slice().buffer}set valueHex(i){this.valueHexView=new Uint8Array(i)}constructor(...i){var a;super(...i);const o=i[0]||{};this.isHexOnly=(a=o.isHexOnly)!==null&&a!==void 0?a:!1,this.valueHexView=o.valueHex?ie.BufferSourceConverter.toUint8Array(o.valueHex):Gn}fromBER(i,a,o){const s=i instanceof ArrayBuffer?new Uint8Array(i):i;if(!dr(this,s,a,o))return-1;const n=a+o;return this.valueHexView=s.subarray(a,n),this.valueHexView.length?(this.blockLength=o,n):(this.warnings.push("Zero buffer length"),a)}toBER(i=!1){return this.isHexOnly?i?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",or)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:ie.Convert.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}class Fr{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=Rt,warnings:i=[],valueBeforeDecode:a=Gn}={}){this.blockLength=e,this.error=t,this.warnings=i,this.valueBeforeDecodeView=ie.BufferSourceConverter.toUint8Array(a)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:ie.Convert.ToHex(this.valueBeforeDecodeView)}}}Fr.NAME="baseBlock";class Nt extends Fr{fromBER(e,t,i){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'")}}Nt.NAME="valueBlock";class Yc extends ur(Fr){constructor({idBlock:e={}}={}){var t,i,a,o;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?ie.BufferSourceConverter.toUint8Array(e.valueHex):Gn,this.tagClass=(i=e.tagClass)!==null&&i!==void 0?i:-1,this.tagNumber=(a=e.tagNumber)!==null&&a!==void 0?a:-1,this.isConstructed=(o=e.isConstructed)!==null&&o!==void 0?o:!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",or}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){const a=new Uint8Array(1);if(!e){let o=this.tagNumber;o&=31,t|=o,a[0]=t}return a.buffer}if(!this.isHexOnly){const a=Mr(this.tagNumber,7),o=new Uint8Array(a),s=a.byteLength,n=new Uint8Array(s+1);if(n[0]=t|31,!e){for(let p=0;p<s-1;p++)n[p+1]=o[p]|128;n[s]=o[s-1]}return n.buffer}const i=new Uint8Array(this.valueHexView.byteLength+1);if(i[0]=t|31,!e){const a=this.valueHexView;for(let o=0;o<a.length-1;o++)i[o+1]=a[o]|128;i[this.valueHexView.byteLength]=a[a.length-1]}return i.buffer}fromBER(e,t,i){const a=ie.BufferSourceConverter.toUint8Array(e);if(!dr(this,a,t,i))return-1;const o=a.subarray(t,t+i);if(o.length===0)return this.error="Zero buffer length",-1;switch(o[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=(o[0]&32)===32,this.isHexOnly=!1;const n=o[0]&31;if(n!==31)this.tagNumber=n,this.blockLength=1;else{let p=1,f=this.valueHexView=new Uint8Array(255),E=255;for(;o[p]&128;){if(f[p-1]=o[p]&127,p++,p>=o.length)return this.error="End of input reached before message was fully decoded",-1;if(p===E){E+=255;const B=new Uint8Array(E);for(let l=0;l<f.length;l++)B[l]=f[l];f=this.valueHexView=new Uint8Array(E)}}this.blockLength=p+1,f[p-1]=o[p]&127;const I=new Uint8Array(p);for(let B=0;B<p;B++)I[B]=f[B];f=this.valueHexView=new Uint8Array(p),f.set(I),this.blockLength<=9?this.tagNumber=oi(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}}}Yc.NAME="identificationBlock";class Xc extends Fr{constructor({lenBlock:e={}}={}){var t,i,a;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(i=e.longFormUsed)!==null&&i!==void 0?i:!1,this.length=(a=e.length)!==null&&a!==void 0?a:0}fromBER(e,t,i){const a=ie.BufferSourceConverter.toUint8Array(e);if(!dr(this,a,t,i))return-1;const o=a.subarray(t,t+i);if(o.length===0)return this.error="Zero buffer length",-1;if(o[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=o[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(o[0]&128),this.longFormUsed===!1)return this.length=o[0],this.blockLength=1,t+this.blockLength;const s=o[0]&127;if(s>8)return this.error="Too big integer",-1;if(s+1>o.length)return this.error="End of input reached before message was fully decoded",-1;const n=t+1,p=a.subarray(n,n+s);return p[s-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=oi(p,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=s+1,t+this.blockLength}toBER(e=!1){let t,i;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(t),i[0]=128),t;if(this.longFormUsed){const a=Mr(this.length,8);if(a.byteLength>127)return this.error="Too big length",or;if(t=new ArrayBuffer(a.byteLength+1),e)return t;const o=new Uint8Array(a);i=new Uint8Array(t),i[0]=a.byteLength|128;for(let s=0;s<a.byteLength;s++)i[s+1]=o[s];return t}return t=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(t),i[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}Xc.NAME="lengthBlock";const we={};class bt extends Fr{constructor({name:e=Rt,optional:t=!1,primitiveSchema:i,...a}={},o){super(a),this.name=e,this.optional=t,i&&(this.primitiveSchema=i),this.idBlock=new Yc(a),this.lenBlock=new Xc(a),this.valueBlock=o?new o(a):new Nt(a)}fromBER(e,t,i){const a=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return a===-1?(this.error=this.valueBlock.error,a):(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),a)}toBER(e,t){const i=t||new qn;t||Jc(this);const a=this.idBlock.toBER(e);if(i.write(a),this.lenBlock.isIndefiniteForm)i.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,i),i.write(new ArrayBuffer(2));else{const o=this.valueBlock.toBER(e);this.lenBlock.length=o.byteLength;const s=this.lenBlock.toBER(e);i.write(s),i.write(o)}return t?or:i.final()}toJSON(){const 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():ie.Convert.ToHex(this.toBER())}onAsciiEncoding(){const e=this.constructor.NAME,t=ie.Convert.ToHex(this.valueBlock.valueBeforeDecodeView);return`${e} : ${t}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;const t=this.toBER(),i=e.toBER();return yp(t,i)}}bt.NAME="BaseBlock";function Jc(r){var e;if(r instanceof we.Constructed)for(const t of r.valueBlock.value)Jc(t)&&(r.lenBlock.isIndefiniteForm=!0);return!!(!((e=r.lenBlock)===null||e===void 0)&&e.isIndefiniteForm)}class Os extends bt{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor({value:e=Rt,...t}={},i){super(t,i),e&&this.fromString(e)}fromBER(e,t,i){const a=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return a===-1?(this.error=this.valueBlock.error,a):(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),a)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}Os.NAME="BaseStringBlock";class Zc extends ur(Nt){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}}Zc.NAME="PrimitiveValueBlock";var el;class ji extends bt{constructor(e={}){super(e,Zc),this.idBlock.isConstructed=!1}}el=ji,we.Primitive=el,ji.NAME="PRIMITIVE";function Ap(r,e){if(r instanceof e)return r;const t=new e;return t.idBlock=r.idBlock,t.lenBlock=r.lenBlock,t.warnings=r.warnings,t.valueBeforeDecodeView=r.valueBeforeDecodeView,t}function ui(r,e=0,t=r.length){const i=e;let a=new bt({},Nt);const o=new Fr;if(!dr(o,r,e,t))return a.error=o.error,{offset:-1,result:a};if(!r.subarray(e,e+t).length)return a.error="Zero buffer length",{offset:-1,result:a};let n=a.idBlock.fromBER(r,e,t);if(a.idBlock.warnings.length&&a.warnings.concat(a.idBlock.warnings),n===-1)return a.error=a.idBlock.error,{offset:-1,result:a};if(e=n,t-=a.idBlock.blockLength,n=a.lenBlock.fromBER(r,e,t),a.lenBlock.warnings.length&&a.warnings.concat(a.lenBlock.warnings),n===-1)return a.error=a.lenBlock.error,{offset:-1,result:a};if(e=n,t-=a.lenBlock.blockLength,!a.idBlock.isConstructed&&a.lenBlock.isIndefiniteForm)return a.error="Indefinite length form used for primitive encoding form",{offset:-1,result:a};let p=bt;switch(a.idBlock.tagClass){case 1:if(a.idBlock.tagNumber>=37&&a.idBlock.isHexOnly===!1)return a.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:a};switch(a.idBlock.tagNumber){case 0:if(a.idBlock.isConstructed&&a.lenBlock.length>0)return a.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:a};p=we.EndOfContent;break;case 1:p=we.Boolean;break;case 2:p=we.Integer;break;case 3:p=we.BitString;break;case 4:p=we.OctetString;break;case 5:p=we.Null;break;case 6:p=we.ObjectIdentifier;break;case 10:p=we.Enumerated;break;case 12:p=we.Utf8String;break;case 13:p=we.RelativeObjectIdentifier;break;case 14:p=we.TIME;break;case 15:return a.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:a};case 16:p=we.Sequence;break;case 17:p=we.Set;break;case 18:p=we.NumericString;break;case 19:p=we.PrintableString;break;case 20:p=we.TeletexString;break;case 21:p=we.VideotexString;break;case 22:p=we.IA5String;break;case 23:p=we.UTCTime;break;case 24:p=we.GeneralizedTime;break;case 25:p=we.GraphicString;break;case 26:p=we.VisibleString;break;case 27:p=we.GeneralString;break;case 28:p=we.UniversalString;break;case 29:p=we.CharacterString;break;case 30:p=we.BmpString;break;case 31:p=we.DATE;break;case 32:p=we.TimeOfDay;break;case 33:p=we.DateTime;break;case 34:p=we.Duration;break;default:{const f=a.idBlock.isConstructed?new we.Constructed:new we.Primitive;f.idBlock=a.idBlock,f.lenBlock=a.lenBlock,f.warnings=a.warnings,a=f}}break;case 2:case 3:case 4:default:p=a.idBlock.isConstructed?we.Constructed:we.Primitive}return a=Ap(a,p),n=a.fromBER(r,e,a.lenBlock.isIndefiniteForm?t:a.lenBlock.length),a.valueBeforeDecodeView=r.subarray(i,i+a.blockLength),{offset:n,result:a}}function ci(r){if(!r.byteLength){const e=new bt({},Nt);return e.error="Input buffer has zero length",{offset:-1,result:e}}return ui(ie.BufferSourceConverter.toUint8Array(r).slice(),0,r.byteLength)}function Bp(r,e){return r?1:e}class wr extends Nt{constructor({value:e=[],isIndefiniteForm:t=!1,...i}={}){super(i),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,i){const a=ie.BufferSourceConverter.toUint8Array(e);if(!dr(this,a,t,i))return-1;if(this.valueBeforeDecodeView=a.subarray(t,t+i),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let o=t;for(;Bp(this.isIndefiniteForm,i)>0;){const s=ui(a,o,i);if(s.offset===-1)return this.error=s.result.error,this.warnings.concat(s.result.warnings),-1;if(o=s.offset,this.blockLength+=s.result.blockLength,i-=s.result.blockLength,this.value.push(s.result),this.isIndefiniteForm&&s.result.constructor.NAME===Ki)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===Ki?this.value.pop():this.warnings.push("No EndOfContent block encoded")),o}toBER(e,t){const i=t||new qn;for(let a=0;a<this.value.length;a++)this.value[a].toBER(e,i);return t?or:i.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const t of this.value)e.value.push(t.toJSON());return e}}wr.NAME="ConstructedValueBlock";var tl;class kt extends bt{constructor(e={}){super(e,wr),this.idBlock.isConstructed=!0}fromBER(e,t,i){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const a=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return a===-1?(this.error=this.valueBlock.error,a):(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),a)}onAsciiEncoding(){const e=[];for(const i of this.valueBlock.value)e.push(i.toString("ascii").split(`
|
|
2
|
+
`).map(a=>` ${a}`).join(`
|
|
3
|
+
`));const t=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :
|
|
4
|
+
${e.join(`
|
|
5
|
+
`)}`:`${t} :`}}tl=kt,we.Constructed=tl,kt.NAME="CONSTRUCTED";class rl extends Nt{fromBER(e,t,i){return t}toBER(e){return or}}rl.override="EndOfContentValueBlock";var il;class Ds extends bt{constructor(e={}){super(e,rl),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}il=Ds,we.EndOfContent=il,Ds.NAME=Ki;var nl;class Kr extends bt{constructor(e={}){super(e,Nt),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,i){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=i,t+i>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+i}toBER(e,t){const i=new ArrayBuffer(2);if(!e){const a=new Uint8Array(i);a[0]=5,a[1]=0}return t&&t.write(i),i}onAsciiEncoding(){return`${this.constructor.NAME}`}}nl=Kr,we.Null=nl,Kr.NAME="NULL";class al extends ur(Nt){get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}constructor({value:e,...t}={}){super(t),t.valueHex?this.valueHexView=ie.BufferSourceConverter.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}fromBER(e,t,i){const a=ie.BufferSourceConverter.toUint8Array(e);return dr(this,a,t,i)?(this.valueHexView=a.subarray(t,t+i),i>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,Gc.call(this),this.blockLength=i,t+i):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}al.NAME="BooleanValueBlock";var sl;class $n extends bt{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor(e={}){super(e,al),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}}sl=$n,we.Boolean=sl,$n.NAME="BOOLEAN";class ol extends ur(wr){constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,i){let a=0;if(this.isConstructed){if(this.isHexOnly=!1,a=wr.prototype.fromBER.call(this,e,t,i),a===-1)return a;for(let o=0;o<this.value.length;o++){const s=this.value[o].constructor.NAME;if(s===Ki){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(s!==Wc)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,a=super.fromBER(e,t,i),this.blockLength=i;return a}toBER(e,t){return this.isConstructed?wr.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}ol.NAME="OctetStringValueBlock";var Ps;let jr=class extends bt{constructor({idBlock:e={},lenBlock:t={},...i}={}){var a,o;(a=i.isConstructed)!==null&&a!==void 0||(i.isConstructed=!!(!((o=i.value)===null||o===void 0)&&o.length)),super({idBlock:{isConstructed:i.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!i.isIndefiniteForm},...i},ol),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,i){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,i===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){const o=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(t,t+i);try{if(o.byteLength){const s=ui(o,0,o.byteLength);s.offset!==-1&&s.offset===i&&(this.valueBlock.value=[s.result])}}catch{}}return super.fromBER(e,t,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return kt.prototype.onAsciiEncoding.call(this);const e=this.constructor.NAME,t=ie.Convert.ToHex(this.valueBlock.valueHexView);return`${e} : ${t}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const e=[];for(const t of this.valueBlock.value)t instanceof Ps&&e.push(t.valueBlock.valueHexView);return ie.BufferSourceConverter.concat(e)}};Ps=jr,we.OctetString=Ps,jr.NAME=Wc;class ul extends ur(wr){constructor({unusedBits:e=0,isConstructed:t=!1,...i}={}){super(i),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,i){if(!i)return t;let a=-1;if(this.isConstructed){if(a=wr.prototype.fromBER.call(this,e,t,i),a===-1)return a;for(const n of this.value){const p=n.constructor.NAME;if(p===Ki){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(p!==Qc)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const f=n.valueBlock;if(this.unusedBits>0&&f.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=f.unusedBits}return a}const o=ie.BufferSourceConverter.toUint8Array(e);if(!dr(this,o,t,i))return-1;const s=o.subarray(t,t+i);if(this.unusedBits=s[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const n=s.subarray(1);try{if(n.byteLength){const p=ui(n,0,n.byteLength);p.offset!==-1&&p.offset===i-1&&(this.value=[p.result])}}catch{}}return this.valueHexView=s.subarray(1),this.blockLength=s.length,t+i}toBER(e,t){if(this.isConstructed)return wr.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength){const a=new Uint8Array(1);return a[0]=0,a.buffer}const i=new Uint8Array(this.valueHexView.length+1);return i[0]=this.unusedBits,i.set(this.valueHexView,1),i.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}ul.NAME="BitStringValueBlock";var cl;let Hr=class extends bt{constructor({idBlock:e={},lenBlock:t={},...i}={}){var a,o;(a=i.isConstructed)!==null&&a!==void 0||(i.isConstructed=!!(!((o=i.value)===null||o===void 0)&&o.length)),super({idBlock:{isConstructed:i.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!i.isIndefiniteForm},...i},ul),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,i){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return kt.prototype.onAsciiEncoding.call(this);{const e=[],t=this.valueBlock.valueHexView;for(const s of t)e.push(s.toString(2).padStart(8,"0"));const i=e.join(""),a=this.constructor.NAME,o=i.substring(0,i.length-this.valueBlock.unusedBits);return`${a} : ${o}`}}};cl=Hr,we.BitString=cl,Hr.NAME=Qc;var ll;function wp(r,e){const t=new Uint8Array([0]),i=new Uint8Array(r),a=new Uint8Array(e);let o=i.slice(0);const s=o.length-1,n=a.slice(0),p=n.length-1;let f=0;const E=p<s?s:p;let I=0;for(let B=E;B>=0;B--,I++){switch(!0){case I<n.length:f=o[s-I]+n[p-I]+t[0];break;default:f=o[s-I]+t[0]}switch(t[0]=f/10,!0){case I>=o.length:o=Rs(new Uint8Array([f%10]),o);break;default:o[s-I]=f%10}}return t[0]>0&&(o=Rs(t,o)),o}function fl(r){if(r>=Fi.length)for(let e=Fi.length;e<=r;e++){const t=new Uint8Array([0]);let i=Fi[e-1].slice(0);for(let a=i.length-1;a>=0;a--){const o=new Uint8Array([(i[a]<<1)+t[0]]);t[0]=o[0]/10,i[a]=o[0]%10}t[0]>0&&(i=Rs(t,i)),Fi.push(i)}return Fi[r]}function Ip(r,e){let t=0;const i=new Uint8Array(r),a=new Uint8Array(e),o=i.slice(0),s=o.length-1,n=a.slice(0),p=n.length-1;let f,E=0;for(let I=p;I>=0;I--,E++)switch(f=o[s-E]-n[p-E]-t,!0){case f<0:t=1,o[s-E]=f+10;break;default:t=0,o[s-E]=f}if(t>0)for(let I=s-p+1;I>=0;I--,E++)if(f=o[s-E]-t,f<0)t=1,o[s-E]=f+10;else{t=0,o[s-E]=f;break}return o.slice()}class Vs extends ur(Nt){setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=Gc.call(this)))}constructor({value:e,...t}={}){super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(dp(e))}get valueDec(){return this._valueDec}fromDER(e,t,i,a=0){const o=this.fromBER(e,t,i);if(o===-1)return o;const s=this.valueHexView;return s[0]===0&&(s[1]&128)!==0?this.valueHexView=s.subarray(1):a!==0&&s.length<a&&(a-s.length>1&&(a=s.length+1),this.valueHexView=s.subarray(a-s.length)),o}toDER(e=!1){const t=this.valueHexView;switch(!0){case(t[0]&128)!==0:{const i=new Uint8Array(this.valueHexView.length+1);i[0]=0,i.set(t,1),this.valueHexView=i}break;case(t[0]===0&&(t[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,t,i){const a=super.fromBER(e,t,i);return a===-1||this.setValueHex(),a}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=this.valueHexView.length*8-1;let t=new Uint8Array(this.valueHexView.length*8/3),i=0,a;const o=this.valueHexView;let s="",n=!1;for(let p=o.byteLength-1;p>=0;p--){a=o[p];for(let f=0;f<8;f++){if((a&1)===1)switch(i){case e:t=Ip(fl(i),t),s="-";break;default:t=wp(t,fl(i))}i++,a>>=1}}for(let p=0;p<t.length;p++)t[p]&&(n=!0),n&&(s+=$c.charAt(t[p]));return n===!1&&(s+=$c.charAt(0)),s}}ll=Vs,Vs.NAME="IntegerValueBlock",Object.defineProperty(ll.prototype,"valueHex",{set:function(r){this.valueHexView=new Uint8Array(r),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var Hi;class li extends bt{constructor(e={}){super(e,Vs),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return Hn(),BigInt(this.valueBlock.toString())}static fromBigInt(e){Hn();const t=BigInt(e),i=new qn,a=t.toString(16).replace(/^-/,""),o=new Uint8Array(ie.Convert.FromHex(a));if(t<0){const n=new Uint8Array(o.length+(o[0]&128?1:0));n[0]|=128;const f=BigInt(`0x${ie.Convert.ToHex(n)}`)+t,E=ie.BufferSourceConverter.toUint8Array(ie.Convert.FromHex(f.toString(16)));E[0]|=128,i.write(E)}else o[0]&128&&i.write(new Uint8Array([0])),i.write(o);return new Hi({valueHex:i.final()})}convertToDER(){const e=new Hi({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new Hi({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}Hi=li,we.Integer=Hi,li.NAME="INTEGER";var hl;class zn extends li{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}hl=zn,we.Enumerated=hl,zn.NAME="ENUMERATED";class Ms extends ur(Nt){constructor({valueDec:e=-1,isFirstSid:t=!1,...i}={}){super(i),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,i){if(!i)return t;const a=ie.BufferSourceConverter.toUint8Array(e);if(!dr(this,a,t,i))return-1;const o=a.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let n=0;n<i&&(this.valueHexView[n]=o[n]&127,this.blockLength++,(o[n]&128)!==0);n++);const s=new Uint8Array(this.blockLength);for(let n=0;n<this.blockLength;n++)s[n]=this.valueHexView[n];return this.valueHexView=s,(o[this.blockLength-1]&128)!==0?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=oi(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){Hn();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;const i=new Uint8Array(t.length/7);for(let a=0;a<i.length;a++)i[a]=parseInt(t.slice(a*7,a*7+7),2)+(a+1<i.length?128:0);this.fromBER(i.buffer,0,i.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const a=this.valueHexView,o=new Uint8Array(this.blockLength);for(let s=0;s<this.blockLength-1;s++)o[s]=a[s]|128;return o[this.blockLength-1]=a[this.blockLength-1],o.buffer}const t=Mr(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",or;const i=new Uint8Array(t.byteLength);if(!e){const a=new Uint8Array(t),o=t.byteLength-1;for(let s=0;s<o;s++)i[s]=a[s]|128;i[o]=a[o]}return i}toString(){let e="";if(this.isHexOnly)e=ie.Convert.ToHex(this.valueHexView);else if(this.isFirstSid){let t=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",t-=40):(e="2.",t-=80),e+=t.toString()}else e=this.valueDec.toString();return e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}}Ms.NAME="sidBlock";class pl extends Nt{constructor({value:e=Rt,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let a=t;for(;i>0;){const o=new Ms;if(a=o.fromBER(e,a,i),a===-1)return this.blockLength=0,this.error=o.error,a;this.value.length===0&&(o.isFirstSid=!0),this.blockLength+=o.blockLength,i-=o.blockLength,this.value.push(o)}return a}toBER(e){const t=[];for(let i=0;i<this.value.length;i++){const a=this.value[i].toBER(e);if(a.byteLength===0)return this.error=this.value[i].error,or;t.push(a)}return Us(t)}fromString(e){this.value=[];let t=0,i=0,a="",o=!1;do if(i=e.indexOf(".",t),i===-1?a=e.substring(t):a=e.substring(t,i),t=i+1,o){const s=this.value[0];let n=0;switch(s.valueDec){case 0:break;case 1:n=40;break;case 2:n=80;break;default:this.value=[];return}const p=parseInt(a,10);if(isNaN(p))return;s.valueDec=p+n,o=!1}else{const s=new Ms;if(a>Number.MAX_SAFE_INTEGER){Hn();const n=BigInt(a);s.valueBigInt=n}else if(s.valueDec=parseInt(a,10),isNaN(s.valueDec))return;this.value.length||(s.isFirstSid=!0,o=!0),this.value.push(s)}while(i!==-1)}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let a=this.value[i].toString();i!==0&&(e=`${e}.`),t?(a=`{${a}}`,this.value[i].isFirstSid?e=`2.{${a} - 80}`:e+=a):e+=a}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}pl.NAME="ObjectIdentifierValueBlock";var dl;class Wn extends bt{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,pl),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}dl=Wn,we.ObjectIdentifier=dl,Wn.NAME="OBJECT IDENTIFIER";class Fs extends ur(Fr){constructor({valueDec:e=0,...t}={}){super(t),this.valueDec=e}fromBER(e,t,i){if(i===0)return t;const a=ie.BufferSourceConverter.toUint8Array(e);if(!dr(this,a,t,i))return-1;const o=a.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let n=0;n<i&&(this.valueHexView[n]=o[n]&127,this.blockLength++,(o[n]&128)!==0);n++);const s=new Uint8Array(this.blockLength);for(let n=0;n<this.blockLength;n++)s[n]=this.valueHexView[n];return this.valueHexView=s,(o[this.blockLength-1]&128)!==0?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=oi(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const a=this.valueHexView,o=new Uint8Array(this.blockLength);for(let s=0;s<this.blockLength-1;s++)o[s]=a[s]|128;return o[this.blockLength-1]=a[this.blockLength-1],o.buffer}const t=Mr(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",or;const i=new Uint8Array(t.byteLength);if(!e){const a=new Uint8Array(t),o=t.byteLength-1;for(let s=0;s<o;s++)i[s]=a[s]|128;i[o]=a[o]}return i.buffer}toString(){let e="";return this.isHexOnly?e=ie.Convert.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}Fs.NAME="relativeSidBlock";class yl extends Nt{constructor({value:e=Rt,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let a=t;for(;i>0;){const o=new Fs;if(a=o.fromBER(e,a,i),a===-1)return this.blockLength=0,this.error=o.error,a;this.blockLength+=o.blockLength,i-=o.blockLength,this.value.push(o)}return a}toBER(e,t){const i=[];for(let a=0;a<this.value.length;a++){const o=this.value[a].toBER(e);if(o.byteLength===0)return this.error=this.value[a].error,or;i.push(o)}return Us(i)}fromString(e){this.value=[];let t=0,i=0,a="";do{i=e.indexOf(".",t),i===-1?a=e.substring(t):a=e.substring(t,i),t=i+1;const o=new Fs;if(o.valueDec=parseInt(a,10),isNaN(o.valueDec))return!0;this.value.push(o)}while(i!==-1);return!0}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let a=this.value[i].toString();i!==0&&(e=`${e}.`),t&&(a=`{${a}}`),e+=a}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}yl.NAME="RelativeObjectIdentifierValueBlock";var vl;class Ks extends bt{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,yl),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}vl=Ks,we.RelativeObjectIdentifier=vl,Ks.NAME="RelativeObjectIdentifier";var gl;class Yt extends kt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}gl=Yt,we.Sequence=gl,Yt.NAME="SEQUENCE";var ml;let cr=class extends kt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};ml=cr,we.Set=ml,cr.NAME="SET";class Cl extends ur(Nt){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=Rt}toJSON(){return{...super.toJSON(),value:this.value}}}Cl.NAME="StringValueBlock";class xl extends Cl{}xl.NAME="SimpleStringValueBlock";class Vt extends Os{constructor({...e}={}){super(e,xl)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,ie.BufferSourceConverter.toUint8Array(e))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(t);for(let a=0;a<t;a++)i[a]=e.charCodeAt(a);this.valueBlock.value=e}}Vt.NAME="SIMPLE STRING";class Sl extends Vt{fromBuffer(e){this.valueBlock.valueHexView=ie.BufferSourceConverter.toUint8Array(e);try{this.valueBlock.value=ie.Convert.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=ie.Convert.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(ie.Convert.FromUtf8String(e)),this.valueBlock.value=e}}Sl.NAME="Utf8StringValueBlock";var El;class yr extends Sl{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}El=yr,we.Utf8String=El,yr.NAME="UTF8String";class bl extends Vt{fromBuffer(e){this.valueBlock.value=ie.Convert.ToUtf16String(e),this.valueBlock.valueHexView=ie.BufferSourceConverter.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(ie.Convert.FromUtf16String(e))}}bl.NAME="BmpStringValueBlock";var Al;class Qn extends bl{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}Al=Qn,we.BmpString=Al,Qn.NAME="BMPString";class Bl extends Vt{fromBuffer(e){const t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),i=new Uint8Array(t);for(let a=0;a<i.length;a+=4)i[a]=i[a+3],i[a+1]=i[a+2],i[a+2]=0,i[a+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(t*4);for(let a=0;a<t;a++){const o=Mr(e.charCodeAt(a),8),s=new Uint8Array(o);if(s.length>4)continue;const n=4-s.length;for(let p=s.length-1;p>=0;p--)i[a*4+p+n]=s[p]}this.valueBlock.value=e}}Bl.NAME="UniversalStringValueBlock";var wl;class Yn extends Bl{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}wl=Yn,we.UniversalString=wl,Yn.NAME="UniversalString";var Il;class Xn extends Vt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}Il=Xn,we.NumericString=Il,Xn.NAME="NumericString";var Tl;class Jn extends Vt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}Tl=Jn,we.PrintableString=Tl,Jn.NAME="PrintableString";var Nl;class Zn extends Vt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}Nl=Zn,we.TeletexString=Nl,Zn.NAME="TeletexString";var kl;class ea extends Vt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}kl=ea,we.VideotexString=kl,ea.NAME="VideotexString";var _l;class ta extends Vt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}_l=ta,we.IA5String=_l,ta.NAME="IA5String";var Rl;class ra extends Vt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}Rl=ra,we.GraphicString=Rl,ra.NAME="GraphicString";var Ul;class qi extends Vt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}Ul=qi,we.VisibleString=Ul,qi.NAME="VisibleString";var Ll;class ia extends Vt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}Ll=ia,we.GeneralString=Ll,ia.NAME="GeneralString";var Ol;class na extends Vt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}Ol=na,we.CharacterString=Ol,na.NAME="CharacterString";var Dl;class Gi extends qi{constructor({value:e,valueDate:t,...i}={}){if(super(i),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let a=0;a<e.length;a++)this.valueBlock.valueHexView[a]=e.charCodeAt(a)}t&&(this.fromDate(t),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,ie.BufferSourceConverter.toUint8Array(e)))}toBuffer(){const e=this.toString(),t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let a=0;a<e.length;a++)i[a]=e.charCodeAt(a);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){const i=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(i===null){this.error="Wrong input string for conversion";return}const a=parseInt(i[1],10);a>=50?this.year=1900+a:this.year=2e3+a,this.month=parseInt(i[2],10),this.day=parseInt(i[3],10),this.hour=parseInt(i[4],10),this.minute=parseInt(i[5],10),this.second=parseInt(i[6],10)}toString(e="iso"){if(e==="iso"){const t=new Array(7);return t[0]=Pt(this.year<2e3?this.year-1900:this.year-2e3,2),t[1]=Pt(this.month,2),t[2]=Pt(this.day,2),t[3]=Pt(this.hour,2),t[4]=Pt(this.minute,2),t[5]=Pt(this.second,2),t[6]="Z",t.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}Dl=Gi,we.UTCTime=Dl,Gi.NAME="UTCTime";var Pl;class aa extends Gi{constructor(e={}){var t;super(e),(t=this.millisecond)!==null&&t!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){const e=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond);return new Date(e)}fromString(e){let t=!1,i="",a="",o=0,s,n=0,p=0;if(e[e.length-1]==="Z")i=e.substring(0,e.length-1),t=!0;else{const I=new Number(e[e.length-1]);if(isNaN(I.valueOf()))throw new Error("Wrong input string for conversion");i=e}if(t){if(i.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(i.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let I=1,B=i.indexOf("+"),l="";if(B===-1&&(B=i.indexOf("-"),I=-1),B!==-1){if(l=i.substring(B+1),i=i.substring(0,B),l.length!==2&&l.length!==4)throw new Error("Wrong input string for conversion");let y=parseInt(l.substring(0,2),10);if(isNaN(y.valueOf()))throw new Error("Wrong input string for conversion");if(n=I*y,l.length===4){if(y=parseInt(l.substring(2,4),10),isNaN(y.valueOf()))throw new Error("Wrong input string for conversion");p=I*y}}}let f=i.indexOf(".");if(f===-1&&(f=i.indexOf(",")),f!==-1){const I=new Number(`0${i.substring(f)}`);if(isNaN(I.valueOf()))throw new Error("Wrong input string for conversion");o=I.valueOf(),a=i.substring(0,f)}else a=i;switch(!0){case a.length===8:if(s=/(\d{4})(\d{2})(\d{2})/ig,f!==-1)throw new Error("Wrong input string for conversion");break;case a.length===10:if(s=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,f!==-1){let I=60*o;this.minute=Math.floor(I),I=60*(I-this.minute),this.second=Math.floor(I),I=1e3*(I-this.second),this.millisecond=Math.floor(I)}break;case a.length===12:if(s=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,f!==-1){let I=60*o;this.second=Math.floor(I),I=1e3*(I-this.second),this.millisecond=Math.floor(I)}break;case a.length===14:if(s=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,f!==-1){const I=1e3*o;this.millisecond=Math.floor(I)}break;default:throw new Error("Wrong input string for conversion")}const E=s.exec(a);if(E===null)throw new Error("Wrong input string for conversion");for(let I=1;I<E.length;I++)switch(I){case 1:this.year=parseInt(E[I],10);break;case 2:this.month=parseInt(E[I],10);break;case 3:this.day=parseInt(E[I],10);break;case 4:this.hour=parseInt(E[I],10)+n;break;case 5:this.minute=parseInt(E[I],10)+p;break;case 6:this.second=parseInt(E[I],10);break;default:throw new Error("Wrong input string for conversion")}if(t===!1){const I=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=I.getUTCFullYear(),this.month=I.getUTCMonth(),this.day=I.getUTCDay(),this.hour=I.getUTCHours(),this.minute=I.getUTCMinutes(),this.second=I.getUTCSeconds(),this.millisecond=I.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){const t=[];return t.push(Pt(this.year,4)),t.push(Pt(this.month,2)),t.push(Pt(this.day,2)),t.push(Pt(this.hour,2)),t.push(Pt(this.minute,2)),t.push(Pt(this.second,2)),this.millisecond!==0&&(t.push("."),t.push(Pt(this.millisecond,3))),t.push("Z"),t.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}Pl=aa,we.GeneralizedTime=Pl,aa.NAME="GeneralizedTime";var Vl;class js extends yr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}Vl=js,we.DATE=Vl,js.NAME="DATE";var Ml;class Hs extends yr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}Ml=Hs,we.TimeOfDay=Ml,Hs.NAME="TimeOfDay";var Fl;class qs extends yr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}Fl=qs,we.DateTime=Fl,qs.NAME="DateTime";var Kl;class Gs extends yr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}Kl=Gs,we.Duration=Kl,Gs.NAME="Duration";var jl;class $s extends yr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}jl=$s,we.TIME=jl,$s.NAME="TIME";class qr{constructor({name:e=Rt,optional:t=!1}={}){this.name=e,this.optional=t}}class zs extends qr{constructor({value:e=[],...t}={}){super(t),this.value=e}}class sa extends qr{constructor({value:e=new qr,local:t=!1,...i}={}){super(i),this.value=e,this.local=t}}class Tp{get data(){return this.dataView.slice().buffer}set data(e){this.dataView=ie.BufferSourceConverter.toUint8Array(e)}constructor({data:e=Gn}={}){this.dataView=ie.BufferSourceConverter.toUint8Array(e)}fromBER(e,t,i){const a=t+i;return this.dataView=ie.BufferSourceConverter.toUint8Array(e).subarray(t,a),a}toBER(e){return this.dataView.slice().buffer}}function Ir(r,e,t){if(t instanceof zs){for(const o of t.value)if(Ir(r,e,o).verified)return{verified:!0,result:r};{const o={verified:!1,result:{error:"Wrong values for Choice type"}};return t.hasOwnProperty(Ls)&&(o.name=t.name),o}}if(t instanceof qr)return t.hasOwnProperty(Ls)&&(r[t.name]=e),{verified:!0,result:r};if(!(r instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(gp in t))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Sp in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Ep in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const i=t.idBlock.toBER(!1);if(i.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(t.idBlock.fromBER(i,0,i.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(t.idBlock.hasOwnProperty(mp)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(Cp)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(xp)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:r};if(!(vp in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:r};if(t.idBlock.isHexOnly){if(!(zc in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const o=t.idBlock.valueHexView,s=e.idBlock.valueHexView;if(o.length!==s.length)return{verified:!1,result:r};for(let n=0;n<o.length;n++)if(o[n]!==s[1])return{verified:!1,result:r}}if(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Rt),t.name&&(r[t.name]=e)),t instanceof we.Constructed){let o=0,s={verified:!1,result:{error:"Unknown error"}},n=t.valueBlock.value.length;if(n>0&&t.valueBlock.value[0]instanceof sa&&(n=e.valueBlock.value.length),n===0)return{verified:!0,result:r};if(e.valueBlock.value.length===0&&t.valueBlock.value.length!==0){let p=!0;for(let f=0;f<t.valueBlock.value.length;f++)p=p&&(t.valueBlock.value[f].optional||!1);return p?{verified:!0,result:r}:(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Rt),t.name&&delete r[t.name]),r.error="Inconsistent object length",{verified:!1,result:r})}for(let p=0;p<n;p++)if(p-o>=e.valueBlock.value.length){if(t.valueBlock.value[p].optional===!1){const f={verified:!1,result:r};return r.error="Inconsistent length between ASN.1 data and schema",t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Rt),t.name&&(delete r[t.name],f.name=t.name)),f}}else if(t.valueBlock.value[0]instanceof sa){if(s=Ir(r,e.valueBlock.value[p],t.valueBlock.value[0].value),s.verified===!1)if(t.valueBlock.value[0].optional)o++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Rt),t.name&&delete r[t.name]),s;if(Ls in t.valueBlock.value[0]&&t.valueBlock.value[0].name.length>0){let f={};bp in t.valueBlock.value[0]&&t.valueBlock.value[0].local?f=e:f=r,typeof f[t.valueBlock.value[0].name]>"u"&&(f[t.valueBlock.value[0].name]=[]),f[t.valueBlock.value[0].name].push(e.valueBlock.value[p])}}else if(s=Ir(r,e.valueBlock.value[p-o],t.valueBlock.value[p]),s.verified===!1)if(t.valueBlock.value[p].optional)o++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Rt),t.name&&delete r[t.name]),s;if(s.verified===!1){const p={verified:!1,result:r};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Rt),t.name&&(delete r[t.name],p.name=t.name)),p}return{verified:!0,result:r}}if(t.primitiveSchema&&zc in e.valueBlock){const o=ui(e.valueBlock.valueHexView);if(o.offset===-1){const s={verified:!1,result:o.result};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Rt),t.name&&(delete r[t.name],s.name=t.name)),s}return Ir(r,o.result,t.primitiveSchema)}return{verified:!0,result:r}}function Np(r,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const t=ui(ie.BufferSourceConverter.toUint8Array(r));return t.offset===-1?{verified:!1,result:t.result}:Ir(t.result,t.result,e)}var Hl=Object.freeze({__proto__:null,Any:qr,BaseBlock:bt,BaseStringBlock:Os,BitString:Hr,BmpString:Qn,Boolean:$n,CharacterString:na,Choice:zs,Constructed:kt,DATE:js,DateTime:qs,Duration:Gs,EndOfContent:Ds,Enumerated:zn,GeneralString:ia,GeneralizedTime:aa,GraphicString:ra,HexBlock:ur,IA5String:ta,Integer:li,Null:Kr,NumericString:Xn,ObjectIdentifier:Wn,OctetString:jr,Primitive:ji,PrintableString:Jn,RawData:Tp,RelativeObjectIdentifier:Ks,Repeated:sa,Sequence:Yt,Set:cr,TIME:$s,TeletexString:Zn,TimeOfDay:Hs,UTCTime:Gi,UniversalString:Yn,Utf8String:yr,ValueBlock:Nt,VideotexString:ea,ViewWriter:qn,VisibleString:qi,compareSchema:Ir,fromBER:ci,verifySchema:Np}),se;(function(r){r[r.Sequence=0]="Sequence",r[r.Set=1]="Set",r[r.Choice=2]="Choice"})(se||(se={}));var Q;(function(r){r[r.Any=1]="Any",r[r.Boolean=2]="Boolean",r[r.OctetString=3]="OctetString",r[r.BitString=4]="BitString",r[r.Integer=5]="Integer",r[r.Enumerated=6]="Enumerated",r[r.ObjectIdentifier=7]="ObjectIdentifier",r[r.Utf8String=8]="Utf8String",r[r.BmpString=9]="BmpString",r[r.UniversalString=10]="UniversalString",r[r.NumericString=11]="NumericString",r[r.PrintableString=12]="PrintableString",r[r.TeletexString=13]="TeletexString",r[r.VideotexString=14]="VideotexString",r[r.IA5String=15]="IA5String",r[r.GraphicString=16]="GraphicString",r[r.VisibleString=17]="VisibleString",r[r.GeneralString=18]="GeneralString",r[r.CharacterString=19]="CharacterString",r[r.UTCTime=20]="UTCTime",r[r.GeneralizedTime=21]="GeneralizedTime",r[r.DATE=22]="DATE",r[r.TimeOfDay=23]="TimeOfDay",r[r.DateTime=24]="DateTime",r[r.Duration=25]="Duration",r[r.TIME=26]="TIME",r[r.Null=27]="Null"})(Q||(Q={}));class oa{constructor(e,t=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(ie.BufferSourceConverter.isBufferSource(e))this.unusedBits=t,this.value=ie.BufferSourceConverter.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof Hr))throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=e.valueBlock.unusedBits,this.value=e.valueBlock.valueHex,this}toASN(){return new Hr({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new Hr({name:e})}toNumber(){let e="";const t=new Uint8Array(this.value);for(const i of t)e+=i.toString(2).padStart(8,"0");return e=e.split("").reverse().join(""),this.unusedBits&&(e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(e,2)}fromNumber(e){let t=e.toString(2);const i=t.length+7>>3;this.unusedBits=(i<<3)-t.length;const a=new Uint8Array(i);t=t.padStart(i<<3,"0").split("").reverse().join("");let o=0;for(;o<i;)a[o]=parseInt(t.slice(o<<3,(o<<3)+8),2),o++;this.value=a.buffer}}class $e{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):ie.BufferSourceConverter.isBufferSource(e)?this.buffer=ie.BufferSourceConverter.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof jr))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new jr({valueHex:this.buffer})}toSchema(e){return new jr({name:e})}}const kp={fromASN:r=>r instanceof Kr?null:r.valueBeforeDecodeView,toASN:r=>{if(r===null)return new Kr;const e=ci(r);if(e.result.error)throw new Error(e.result.error);return e.result}},_p={fromASN:r=>r.valueBlock.valueHexView.byteLength>=4?r.valueBlock.toString():r.valueBlock.valueDec,toASN:r=>new li({value:+r})},Rp={fromASN:r=>r.valueBlock.valueDec,toASN:r=>new zn({value:r})},et={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new li({valueHex:r})},Up={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new Hr({valueHex:r})},Lp={fromASN:r=>r.valueBlock.toString(),toASN:r=>new Wn({value:r})},Op={fromASN:r=>r.valueBlock.value,toASN:r=>new $n({value:r})},ua={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new jr({valueHex:r})},Dp={fromASN:r=>new $e(r.getValue()),toASN:r=>r.toASN()};function $t(r){return{fromASN:e=>e.valueBlock.value,toASN:e=>new r({value:e})}}const ql=$t(yr),Pp=$t(Qn),Vp=$t(Yn),Mp=$t(Xn),Fp=$t(Jn),Kp=$t(Zn),jp=$t(ea),Hp=$t(ta),qp=$t(ra),Gp=$t(qi),$p=$t(ia),zp=$t(na),Wp={fromASN:r=>r.toDate(),toASN:r=>new Gi({valueDate:r})},Qp={fromASN:r=>r.toDate(),toASN:r=>new aa({valueDate:r})},Yp={fromASN:()=>null,toASN:()=>new Kr};function $i(r){switch(r){case Q.Any:return kp;case Q.BitString:return Up;case Q.BmpString:return Pp;case Q.Boolean:return Op;case Q.CharacterString:return zp;case Q.Enumerated:return Rp;case Q.GeneralString:return $p;case Q.GeneralizedTime:return Qp;case Q.GraphicString:return qp;case Q.IA5String:return Hp;case Q.Integer:return _p;case Q.Null:return Yp;case Q.NumericString:return Mp;case Q.ObjectIdentifier:return Lp;case Q.OctetString:return ua;case Q.PrintableString:return Fp;case Q.TeletexString:return Kp;case Q.UTCTime:return Wp;case Q.UniversalString:return Vp;case Q.Utf8String:return ql;case Q.VideotexString:return jp;case Q.VisibleString:return Gp;default:return null}}function vr(r){return typeof r=="function"&&r.prototype?r.prototype.toASN&&r.prototype.fromASN?!0:vr(r.prototype):!!(r&&typeof r=="object"&&"toASN"in r&&"fromASN"in r)}function Gl(r){var e;if(r){const t=Object.getPrototypeOf(r);return((e=t?.prototype)===null||e===void 0?void 0:e.constructor)===Array?!0:Gl(t)}return!1}function Xp(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;const t=new Uint8Array(r),i=new Uint8Array(e);for(let a=0;a<r.byteLength;a++)if(t[a]!==i[a])return!1;return!0}class Jp{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e,t=!1){const i=this.items.get(e);if(!i)throw new Error(`Cannot get schema for '${e.prototype.constructor.name}' target`);if(t&&!i.schema)throw new Error(`Schema '${e.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return i}cache(e){const t=this.get(e);t.schema||(t.schema=this.create(e,!0))}createDefault(e){const t={type:se.Sequence,items:{}},i=this.findParentSchema(e);return i&&(Object.assign(t,i),t.items=Object.assign({},t.items,i.items)),t}create(e,t){const i=this.items.get(e)||this.createDefault(e),a=[];for(const o in i.items){const s=i.items[o],n=t?o:"";let p;if(typeof s.type=="number"){const E=Q[s.type],I=Hl[E];if(!I)throw new Error(`Cannot get ASN1 class by name '${E}'`);p=new I({name:n})}else vr(s.type)?p=new s.type().toSchema(n):s.optional?this.get(s.type).type===se.Choice?p=new qr({name:n}):(p=this.create(s.type,!1),p.name=n):p=new qr({name:n});const f=!!s.optional||s.defaultValue!==void 0;if(s.repeated){p.name="";const E=s.repeated==="set"?cr:Yt;p=new E({name:"",value:[new sa({name:n,value:p})]})}if(s.context!==null&&s.context!==void 0)if(s.implicit)if(typeof s.type=="number"||vr(s.type)){const E=s.repeated?kt:ji;a.push(new E({name:n,optional:f,idBlock:{tagClass:3,tagNumber:s.context}}))}else{this.cache(s.type);const E=!!s.repeated;let I=E?p:this.get(s.type,!0).schema;I="valueBlock"in I?I.valueBlock.value:I.value,a.push(new kt({name:E?"":n,optional:f,idBlock:{tagClass:3,tagNumber:s.context},value:I}))}else a.push(new kt({optional:f,idBlock:{tagClass:3,tagNumber:s.context},value:[p]}));else p.optional=f,a.push(p)}switch(i.type){case se.Sequence:return new Yt({value:a,name:""});case se.Set:return new cr({value:a,name:""});case se.Choice:return new zs({value:a,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(e,t){return this.items.set(e,t),this}findParentSchema(e){const t=Object.getPrototypeOf(e);return t?this.items.get(t)||this.findParentSchema(t):null}}const At=new Jp,he=r=>e=>{let t;At.has(e)?t=At.get(e):(t=At.createDefault(e),At.set(e,t)),Object.assign(t,r)},D=r=>(e,t)=>{let i;At.has(e.constructor)?i=At.get(e.constructor):(i=At.createDefault(e.constructor),At.set(e.constructor,i));const a=Object.assign({},r);if(typeof a.type=="number"&&!a.converter){const o=$i(r.type);if(!o)throw new Error(`Cannot get default converter for property '${t}' of ${e.constructor.name}`);a.converter=o}a.raw=r.raw,i.items[t]=a};class zi extends Error{constructor(){super(...arguments),this.schemas=[]}}class Zp{static parse(e,t){const i=ci(e);if(i.result.error)throw new Error(i.result.error);return this.fromASN(i.result,t)}static fromASN(e,t){try{if(vr(t))return new t().fromASN(e);const i=At.get(t);At.cache(t);let a=i.schema;const o=this.handleChoiceTypes(e,i,t,a);if(o?.result)return o.result;o?.targetSchema&&(a=o.targetSchema);const s=this.handleSequenceTypes(e,i,t,a),n=new t;return Gl(t)?this.handleArrayTypes(e,i,t):(this.processSchemaItems(i,s,n),n)}catch(i){throw i instanceof zi&&i.schemas.push(t.name),i}}static handleChoiceTypes(e,t,i,a){if(e.constructor===kt&&t.type===se.Choice&&e.idBlock.tagClass===3)for(const o in t.items){const s=t.items[o];if(s.context===e.idBlock.tagNumber&&s.implicit&&typeof s.type=="function"&&At.has(s.type)){const n=At.get(s.type);if(n&&n.type===se.Sequence){const p=new Yt;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in p.valueBlock){p.valueBlock.value=e.valueBlock.value;const f=this.fromASN(p,s.type),E=new i;return E[o]=f,{result:E}}}}}else if(e.constructor===kt&&t.type!==se.Choice){const o=new kt({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:t.schema.valueBlock.value});for(const s in t.items)delete e[s];return{targetSchema:o}}return null}static handleSequenceTypes(e,t,i,a){if(t.type===se.Sequence){const o=Ir({},e,a);if(!o.verified)throw new zi(`Data does not match to ${i.name} ASN1 schema.${o.result.error?` ${o.result.error}`:""}`);return o}else{const o=Ir({},e,a);if(!o.verified)throw new zi(`Data does not match to ${i.name} ASN1 schema.${o.result.error?` ${o.result.error}`:""}`);return o}}static processRepeatedField(e,t,i){let a=e.slice(t);if(a.length===1&&a[0].constructor.name==="Sequence"){const o=a[0];o.valueBlock&&o.valueBlock.value&&Array.isArray(o.valueBlock.value)&&(a=o.valueBlock.value)}if(typeof i.type=="number"){const o=$i(i.type);if(!o)throw new Error(`No converter for ASN.1 type ${i.type}`);return a.filter(s=>s&&s.valueBlock).map(s=>{try{return o.fromASN(s)}catch{return}}).filter(s=>s!==void 0)}else return a.filter(o=>o&&o.valueBlock).map(o=>{try{return this.fromASN(o,i.type)}catch{return}}).filter(o=>o!==void 0)}static processPrimitiveField(e,t){const i=$i(t.type);if(!i)throw new Error(`No converter for ASN.1 type ${t.type}`);return i.fromASN(e)}static isOptionalChoiceField(e){return e.optional&&typeof e.type=="function"&&At.has(e.type)&&At.get(e.type).type===se.Choice}static processOptionalChoiceField(e,t){try{return{processed:!0,value:this.fromASN(e,t.type)}}catch(i){if(i instanceof zi&&/Wrong values for Choice type/.test(i.message))return{processed:!1};throw i}}static handleArrayTypes(e,t,i){if(!("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const a=t.itemType;if(typeof a=="number"){const o=$i(a);if(!o)throw new Error(`Cannot get default converter for array item of ${i.name} ASN1 schema`);return i.from(e.valueBlock.value,s=>o.fromASN(s))}else return i.from(e.valueBlock.value,o=>this.fromASN(o,a))}static processSchemaItems(e,t,i){for(const a in e.items){const o=t.result[a];if(!o)continue;const s=e.items[a],n=s.type;let p;typeof n=="number"||vr(n)?p=this.processPrimitiveSchemaItem(o,s,n):p=this.processComplexSchemaItem(o,s,n),p&&typeof p=="object"&&"value"in p&&"raw"in p?(i[a]=p.value,i[`${a}Raw`]=p.raw):i[a]=p}}static processPrimitiveSchemaItem(e,t,i){var a;const o=(a=t.converter)!==null&&a!==void 0?a:vr(i)?new i:null;if(!o)throw new Error("Converter is empty");return t.repeated?this.processRepeatedPrimitiveItem(e,t,o):this.processSinglePrimitiveItem(e,t,i,o)}static processRepeatedPrimitiveItem(e,t,i){if(t.implicit){const a=t.repeated==="sequence"?Yt:cr,o=new a;o.valueBlock=e.valueBlock;const s=ci(o.toBER(!1));if(s.offset===-1)throw new Error(`Cannot parse the child item. ${s.result.error}`);if(!("value"in s.result.valueBlock&&Array.isArray(s.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const n=s.result.valueBlock.value;return Array.from(n,p=>i.fromASN(p))}else return Array.from(e,a=>i.fromASN(a))}static processSinglePrimitiveItem(e,t,i,a){let o=e;if(t.implicit){let s;if(vr(i))s=new i().toSchema("");else{const n=Q[i],p=Hl[n];if(!p)throw new Error(`Cannot get '${n}' class from asn1js module`);s=new p}s.valueBlock=o.valueBlock,o=ci(s.toBER(!1)).result}return a.fromASN(o)}static processComplexSchemaItem(e,t,i){if(t.repeated){if(!Array.isArray(e))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");return Array.from(e,a=>this.fromASN(a,i))}else{const a=this.handleImplicitTagging(e,t,i);if(this.isOptionalChoiceField(t))try{return this.fromASN(a,i)}catch(o){if(o instanceof zi&&/Wrong values for Choice type/.test(o.message))return;throw o}else{const o=this.fromASN(a,i);return t.raw?{value:o,raw:e.valueBeforeDecodeView}:o}}}static handleImplicitTagging(e,t,i){if(t.implicit&&typeof t.context=="number"){const a=At.get(i);if(a.type===se.Sequence){const o=new Yt;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in o.valueBlock)return o.valueBlock.value=e.valueBlock.value,o}else if(a.type===se.Set){const o=new cr;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in o.valueBlock)return o.valueBlock.value=e.valueBlock.value,o}}return e}}class Ws{static serialize(e){return e instanceof bt?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&vr(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const t=e.constructor,i=At.get(t);At.cache(t);let a=[];if(i.itemType){if(!Array.isArray(e))throw new TypeError("Parameter 1 should be type of Array.");if(typeof i.itemType=="number"){const s=$i(i.itemType);if(!s)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);a=e.map(n=>s.toASN(n))}else a=e.map(s=>this.toAsnItem({type:i.itemType},"[]",t,s))}else for(const s in i.items){const n=i.items[s],p=e[s];if(p===void 0||n.defaultValue===p||typeof n.defaultValue=="object"&&typeof p=="object"&&Xp(this.serialize(n.defaultValue),this.serialize(p)))continue;const f=Ws.toAsnItem(n,s,t,p);if(typeof n.context=="number")if(n.implicit)if(!n.repeated&&(typeof n.type=="number"||vr(n.type))){const E={};E.valueHex=f instanceof Kr?f.valueBeforeDecodeView:f.valueBlock.toBER(),a.push(new ji({optional:n.optional,idBlock:{tagClass:3,tagNumber:n.context},...E}))}else a.push(new kt({optional:n.optional,idBlock:{tagClass:3,tagNumber:n.context},value:f.valueBlock.value}));else a.push(new kt({optional:n.optional,idBlock:{tagClass:3,tagNumber:n.context},value:[f]}));else n.repeated?a=a.concat(f):a.push(f)}let o;switch(i.type){case se.Sequence:o=new Yt({value:a});break;case se.Set:o=new cr({value:a});break;case se.Choice:if(!a[0])throw new Error(`Schema '${t.name}' has wrong data. Choice cannot be empty.`);o=a[0];break}return o}static toAsnItem(e,t,i,a){let o;if(typeof e.type=="number"){const s=e.converter;if(!s)throw new Error(`Property '${t}' doesn't have converter for type ${Q[e.type]} in schema '${i.name}'`);if(e.repeated){if(!Array.isArray(a))throw new TypeError("Parameter 'objProp' should be type of Array.");const n=Array.from(a,f=>s.toASN(f)),p=e.repeated==="sequence"?Yt:cr;o=new p({value:n})}else o=s.toASN(a)}else if(e.repeated){if(!Array.isArray(a))throw new TypeError("Parameter 'objProp' should be type of Array.");const s=Array.from(a,p=>this.toASN(p)),n=e.repeated==="sequence"?Yt:cr;o=new n({value:s})}else o=this.toASN(a);return o}}class Ye extends Array{constructor(e=[]){if(typeof e=="number")super(e);else{super();for(const t of e)this.push(t)}}}class ye{static serialize(e){return Ws.serialize(e)}static parse(e,t){return Zp.parse(e,t)}static toString(e){const t=ie.BufferSourceConverter.isBufferSource(e)?ie.BufferSourceConverter.toArrayBuffer(e):ye.serialize(e),i=ci(t);if(i.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${i.result.error}`);return i.result.toString()}}var Qs=function(r,e){return Qs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(t[a]=i[a])},Qs(r,e)};function Ys(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Qs(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function w(r,e,t,i){var a=arguments.length,o=a<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,i);else for(var n=r.length-1;n>=0;n--)(s=r[n])&&(o=(a<3?s(o):a>3?s(e,t,o):s(e,t))||o);return a>3&&o&&Object.defineProperty(e,t,o),o}function ed(r,e,t,i){function a(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function n(E){try{f(i.next(E))}catch(I){s(I)}}function p(E){try{f(i.throw(E))}catch(I){s(I)}}function f(E){E.done?o(E.value):a(E.value).then(n,p)}f((i=i.apply(r,e||[])).next())})}function td(r,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,a,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=n(0),s.throw=n(1),s.return=n(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function n(f){return function(E){return p([f,E])}}function p(f){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,f[0]&&(t=0)),t;)try{if(i=1,a&&(o=f[0]&2?a.return:f[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,f[1])).done)return o;switch(a=0,o&&(f=[f[0]&2,o.value]),f[0]){case 0:case 1:o=f;break;case 4:return t.label++,{value:f[1],done:!1};case 5:t.label++,a=f[1],f=[0];continue;case 7:f=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(f[0]===6||f[0]===2)){t=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){t.label=f[1];break}if(f[0]===6&&t.label<o[1]){t.label=o[1],o=f;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(f);break}o[2]&&t.ops.pop(),t.trys.pop();continue}f=e.call(r,t)}catch(E){f=[6,E],a=0}finally{i=o=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function ca(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function la(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),a,o=[],s;try{for(;(e===void 0||e-- >0)&&!(a=i.next()).done;)o.push(a.value)}catch(n){s={error:n}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(s)throw s.error}}return o}function Gr(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(la(arguments[e]));return r}function je(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)}function rt(r,e,t,i,a){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!a:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?a.call(r,t):a?a.value=t:e.set(r,t),t}typeof SuppressedError=="function"&&SuppressedError;class $l{static isIPv4(e){return/^(\d{1,3}\.){3}\d{1,3}$/.test(e)}static parseIPv4(e){const t=e.split(".");if(t.length!==4)throw new Error("Invalid IPv4 address");return t.map(i=>{const a=parseInt(i,10);if(isNaN(a)||a<0||a>255)throw new Error("Invalid IPv4 address part");return a})}static parseIPv6(e){const i=this.expandIPv6(e).split(":");if(i.length!==8)throw new Error("Invalid IPv6 address");return i.reduce((a,o)=>{const s=parseInt(o,16);if(isNaN(s)||s<0||s>65535)throw new Error("Invalid IPv6 address part");return a.push(s>>8&255),a.push(s&255),a},[])}static expandIPv6(e){if(!e.includes("::"))return e;const t=e.split("::");if(t.length>2)throw new Error("Invalid IPv6 address");const i=t[0]?t[0].split(":"):[],a=t[1]?t[1].split(":"):[],o=8-(i.length+a.length);if(o<0)throw new Error("Invalid IPv6 address");return[...i,...Array(o).fill("0"),...a].join(":")}static formatIPv6(e){const t=[];for(let i=0;i<16;i+=2)t.push((e[i]<<8|e[i+1]).toString(16));return this.compressIPv6(t.join(":"))}static compressIPv6(e){const t=e.split(":");let i=-1,a=0,o=-1,s=0;for(let n=0;n<t.length;n++)t[n]==="0"?(o===-1&&(o=n),s++):(s>a&&(i=o,a=s),o=-1,s=0);if(s>a&&(i=o,a=s),a>1){const n=t.slice(0,i).join(":"),p=t.slice(i+a).join(":");return`${n}::${p}`}return e}static parseCIDR(e){const[t,i]=e.split("/"),a=parseInt(i,10);if(this.isIPv4(t)){if(a<0||a>32)throw new Error("Invalid IPv4 prefix length");return[this.parseIPv4(t),a]}else{if(a<0||a>128)throw new Error("Invalid IPv6 prefix length");return[this.parseIPv6(t),a]}}static decodeIP(e){if(e.length===64&&parseInt(e,16)===0)return"::/0";if(e.length!==16)return e;const t=parseInt(e.slice(8),16).toString(2).split("").reduce((a,o)=>a+ +o,0);let i=e.slice(0,8).replace(/(.{2})/g,a=>`${parseInt(a,16)}.`);return i=i.slice(0,-1),`${i}/${t}`}static toString(e){const t=new Uint8Array(e);if(t.length===4)return Array.from(t).join(".");if(t.length===16)return this.formatIPv6(t);if(t.length===8||t.length===32){const i=t.length/2,a=t.slice(0,i),o=t.slice(i);if(t.every(p=>p===0))return t.length===8?"0.0.0.0/0":"::/0";const n=o.reduce((p,f)=>p+(f.toString(2).match(/1/g)||[]).length,0);return t.length===8?`${Array.from(a).join(".")}/${n}`:`${this.formatIPv6(a)}/${n}`}return this.decodeIP(ie.Convert.ToHex(e))}static fromString(e){if(e.includes("/")){const[i,a]=this.parseCIDR(e),o=new Uint8Array(i.length);let s=a;for(let p=0;p<o.length;p++)s>=8?(o[p]=255,s-=8):s>0&&(o[p]=255<<8-s,s=0);const n=new Uint8Array(i.length*2);return n.set(i,0),n.set(o,i.length),n.buffer}const t=this.isIPv4(e)?this.parseIPv4(e):this.parseIPv6(e);return new Uint8Array(t).buffer}}var Xs,Js,Zs;let Bt=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};w([D({type:Q.TeletexString})],Bt.prototype,"teletexString",void 0),w([D({type:Q.PrintableString})],Bt.prototype,"printableString",void 0),w([D({type:Q.UniversalString})],Bt.prototype,"universalString",void 0),w([D({type:Q.Utf8String})],Bt.prototype,"utf8String",void 0),w([D({type:Q.BmpString})],Bt.prototype,"bmpString",void 0),Bt=w([he({type:se.Choice})],Bt);let fi=class extends Bt{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?ie.Convert.ToHex(this.anyValue):super.toString())}};w([D({type:Q.IA5String})],fi.prototype,"ia5String",void 0),w([D({type:Q.Any})],fi.prototype,"anyValue",void 0),fi=w([he({type:se.Choice})],fi);class fa{constructor(e={}){this.type="",this.value=new fi,Object.assign(this,e)}}w([D({type:Q.ObjectIdentifier})],fa.prototype,"type",void 0),w([D({type:fi})],fa.prototype,"value",void 0);let hi=Xs=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,Xs.prototype)}};hi=Xs=w([he({type:se.Set,itemType:fa})],hi);let eo=Js=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,Js.prototype)}};eo=Js=w([he({type:se.Sequence,itemType:hi})],eo);let nt=Zs=class extends eo{constructor(e){super(e),Object.setPrototypeOf(this,Zs.prototype)}};nt=Zs=w([he({type:se.Sequence})],nt);const rd={fromASN:r=>$l.toString(ua.fromASN(r)),toASN:r=>ua.toASN($l.fromString(r))};class Wi{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:Q.ObjectIdentifier})],Wi.prototype,"typeId",void 0),w([D({type:Q.Any,context:0})],Wi.prototype,"value",void 0);class to{constructor(e={}){this.partyName=new Bt,Object.assign(this,e)}}w([D({type:Bt,optional:!0,context:0,implicit:!0})],to.prototype,"nameAssigner",void 0),w([D({type:Bt,context:1,implicit:!0})],to.prototype,"partyName",void 0);let Ke=class{constructor(e={}){Object.assign(this,e)}};w([D({type:Wi,context:0,implicit:!0})],Ke.prototype,"otherName",void 0),w([D({type:Q.IA5String,context:1,implicit:!0})],Ke.prototype,"rfc822Name",void 0),w([D({type:Q.IA5String,context:2,implicit:!0})],Ke.prototype,"dNSName",void 0),w([D({type:Q.Any,context:3,implicit:!0})],Ke.prototype,"x400Address",void 0),w([D({type:nt,context:4,implicit:!1})],Ke.prototype,"directoryName",void 0),w([D({type:to,context:5})],Ke.prototype,"ediPartyName",void 0),w([D({type:Q.IA5String,context:6,implicit:!0})],Ke.prototype,"uniformResourceIdentifier",void 0),w([D({type:Q.OctetString,context:7,implicit:!0,converter:rd})],Ke.prototype,"iPAddress",void 0),w([D({type:Q.ObjectIdentifier,context:8,implicit:!0})],Ke.prototype,"registeredID",void 0),Ke=w([he({type:se.Choice})],Ke);const ro="1.3.6.1.5.5.7",id=`${ro}.1`,pi=`${ro}.3`,ha=`${ro}.48`,zl=`${ha}.1`,Wl=`${ha}.2`,Ql=`${ha}.3`,Yl=`${ha}.5`,gr="2.5.29";var io;const no=`${id}.1`;class Qi{constructor(e={}){this.accessMethod="",this.accessLocation=new Ke,Object.assign(this,e)}}w([D({type:Q.ObjectIdentifier})],Qi.prototype,"accessMethod",void 0),w([D({type:Ke})],Qi.prototype,"accessLocation",void 0);let di=io=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,io.prototype)}};di=io=w([he({type:se.Sequence,itemType:Qi})],di);const ao=`${gr}.35`;class so extends $e{}class $r{constructor(e={}){e&&Object.assign(this,e)}}w([D({type:so,context:0,optional:!0,implicit:!0})],$r.prototype,"keyIdentifier",void 0),w([D({type:Ke,context:1,optional:!0,implicit:!0,repeated:"sequence"})],$r.prototype,"authorityCertIssuer",void 0),w([D({type:Q.Integer,context:2,optional:!0,implicit:!0,converter:et})],$r.prototype,"authorityCertSerialNumber",void 0);const Xl=`${gr}.19`;class pa{constructor(e={}){this.cA=!1,Object.assign(this,e)}}w([D({type:Q.Boolean,defaultValue:!1})],pa.prototype,"cA",void 0),w([D({type:Q.Integer,optional:!0})],pa.prototype,"pathLenConstraint",void 0);var oo;let It=oo=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,oo.prototype)}};It=oo=w([he({type:se.Sequence,itemType:Ke})],It);var uo;let Jl=uo=class extends It{constructor(e){super(e),Object.setPrototypeOf(this,uo.prototype)}};Jl=uo=w([he({type:se.Sequence})],Jl);var co;const Zl=`${gr}.32`;let mr=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};w([D({type:Q.IA5String})],mr.prototype,"ia5String",void 0),w([D({type:Q.VisibleString})],mr.prototype,"visibleString",void 0),w([D({type:Q.BmpString})],mr.prototype,"bmpString",void 0),w([D({type:Q.Utf8String})],mr.prototype,"utf8String",void 0),mr=w([he({type:se.Choice})],mr);class lo{constructor(e={}){this.organization=new mr,this.noticeNumbers=[],Object.assign(this,e)}}w([D({type:mr})],lo.prototype,"organization",void 0),w([D({type:Q.Integer,repeated:"sequence"})],lo.prototype,"noticeNumbers",void 0);class fo{constructor(e={}){Object.assign(this,e)}}w([D({type:lo,optional:!0})],fo.prototype,"noticeRef",void 0),w([D({type:mr,optional:!0})],fo.prototype,"explicitText",void 0);let da=class{constructor(e={}){Object.assign(this,e)}};w([D({type:Q.IA5String})],da.prototype,"cPSuri",void 0),w([D({type:fo})],da.prototype,"userNotice",void 0),da=w([he({type:se.Choice})],da);class ho{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:Q.ObjectIdentifier})],ho.prototype,"policyQualifierId",void 0),w([D({type:Q.Any})],ho.prototype,"qualifier",void 0);class ya{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}w([D({type:Q.ObjectIdentifier})],ya.prototype,"policyIdentifier",void 0),w([D({type:ho,repeated:"sequence",optional:!0})],ya.prototype,"policyQualifiers",void 0);let va=co=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,co.prototype)}};va=co=w([he({type:se.Sequence,itemType:ya})],va);let ga=class{constructor(e=0){this.value=e}};w([D({type:Q.Integer})],ga.prototype,"value",void 0),ga=w([he({type:se.Choice})],ga);let ef=class extends ga{};ef=w([he({type:se.Choice})],ef);var po;const yo=`${gr}.31`;var Xt;(function(r){r[r.unused=1]="unused",r[r.keyCompromise=2]="keyCompromise",r[r.cACompromise=4]="cACompromise",r[r.affiliationChanged=8]="affiliationChanged",r[r.superseded=16]="superseded",r[r.cessationOfOperation=32]="cessationOfOperation",r[r.certificateHold=64]="certificateHold",r[r.privilegeWithdrawn=128]="privilegeWithdrawn",r[r.aACompromise=256]="aACompromise"})(Xt||(Xt={}));class tf extends oa{toJSON(){const e=[],t=this.toNumber();return t&Xt.aACompromise&&e.push("aACompromise"),t&Xt.affiliationChanged&&e.push("affiliationChanged"),t&Xt.cACompromise&&e.push("cACompromise"),t&Xt.certificateHold&&e.push("certificateHold"),t&Xt.cessationOfOperation&&e.push("cessationOfOperation"),t&Xt.keyCompromise&&e.push("keyCompromise"),t&Xt.privilegeWithdrawn&&e.push("privilegeWithdrawn"),t&Xt.superseded&&e.push("superseded"),t&Xt.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let zr=class{constructor(e={}){Object.assign(this,e)}};w([D({type:Ke,context:0,repeated:"sequence",implicit:!0})],zr.prototype,"fullName",void 0),w([D({type:hi,context:1,implicit:!0})],zr.prototype,"nameRelativeToCRLIssuer",void 0),zr=w([he({type:se.Choice})],zr);class yi{constructor(e={}){Object.assign(this,e)}}w([D({type:zr,context:0,optional:!0})],yi.prototype,"distributionPoint",void 0),w([D({type:tf,context:1,optional:!0,implicit:!0})],yi.prototype,"reasons",void 0),w([D({type:Ke,context:2,optional:!0,repeated:"sequence",implicit:!0})],yi.prototype,"cRLIssuer",void 0);let vi=po=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,po.prototype)}};vi=po=w([he({type:se.Sequence,itemType:yi})],vi);var vo;let rf=vo=class extends vi{constructor(e){super(e),Object.setPrototypeOf(this,vo.prototype)}};rf=vo=w([he({type:se.Sequence,itemType:yi})],rf);class Tt{constructor(e={}){this.onlyContainsUserCerts=Tt.ONLY,this.onlyContainsCACerts=Tt.ONLY,this.indirectCRL=Tt.ONLY,this.onlyContainsAttributeCerts=Tt.ONLY,Object.assign(this,e)}}Tt.ONLY=!1,w([D({type:zr,context:0,optional:!0})],Tt.prototype,"distributionPoint",void 0),w([D({type:Q.Boolean,context:1,defaultValue:Tt.ONLY,implicit:!0})],Tt.prototype,"onlyContainsUserCerts",void 0),w([D({type:Q.Boolean,context:2,defaultValue:Tt.ONLY,implicit:!0})],Tt.prototype,"onlyContainsCACerts",void 0),w([D({type:tf,context:3,optional:!0,implicit:!0})],Tt.prototype,"onlySomeReasons",void 0),w([D({type:Q.Boolean,context:4,defaultValue:Tt.ONLY,implicit:!0})],Tt.prototype,"indirectCRL",void 0),w([D({type:Q.Boolean,context:5,defaultValue:Tt.ONLY,implicit:!0})],Tt.prototype,"onlyContainsAttributeCerts",void 0);var Yi;(function(r){r[r.unspecified=0]="unspecified",r[r.keyCompromise=1]="keyCompromise",r[r.cACompromise=2]="cACompromise",r[r.affiliationChanged=3]="affiliationChanged",r[r.superseded=4]="superseded",r[r.cessationOfOperation=5]="cessationOfOperation",r[r.certificateHold=6]="certificateHold",r[r.removeFromCRL=8]="removeFromCRL",r[r.privilegeWithdrawn=9]="privilegeWithdrawn",r[r.aACompromise=10]="aACompromise"})(Yi||(Yi={}));let go=class{constructor(e=Yi.unspecified){this.reason=Yi.unspecified,this.reason=e}toJSON(){return Yi[this.reason]}toString(){return this.toJSON()}};w([D({type:Q.Enumerated})],go.prototype,"reason",void 0),go=w([he({type:se.Choice})],go);var mo;const nf=`${gr}.37`;let ma=mo=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,mo.prototype)}};ma=mo=w([he({type:se.Sequence,itemType:Q.ObjectIdentifier})],ma);const nd=`${pi}.1`,ad=`${pi}.2`,sd=`${pi}.3`,od=`${pi}.4`,ud=`${pi}.8`,cd=`${pi}.9`;let Co=class{constructor(e=new ArrayBuffer(0)){this.value=e}};w([D({type:Q.Integer,converter:et})],Co.prototype,"value",void 0),Co=w([he({type:se.Choice})],Co);let xo=class{constructor(e){this.value=new Date,e&&(this.value=e)}};w([D({type:Q.GeneralizedTime})],xo.prototype,"value",void 0),xo=w([he({type:se.Choice})],xo);var So;const af=`${gr}.18`;let sf=So=class extends It{constructor(e){super(e),Object.setPrototypeOf(this,So.prototype)}};sf=So=w([he({type:se.Sequence})],sf);const of=`${gr}.15`;var Jt;(function(r){r[r.digitalSignature=1]="digitalSignature",r[r.nonRepudiation=2]="nonRepudiation",r[r.keyEncipherment=4]="keyEncipherment",r[r.dataEncipherment=8]="dataEncipherment",r[r.keyAgreement=16]="keyAgreement",r[r.keyCertSign=32]="keyCertSign",r[r.cRLSign=64]="cRLSign",r[r.encipherOnly=128]="encipherOnly",r[r.decipherOnly=256]="decipherOnly"})(Jt||(Jt={}));class Eo extends oa{toJSON(){const e=this.toNumber(),t=[];return e&Jt.cRLSign&&t.push("crlSign"),e&Jt.dataEncipherment&&t.push("dataEncipherment"),e&Jt.decipherOnly&&t.push("decipherOnly"),e&Jt.digitalSignature&&t.push("digitalSignature"),e&Jt.encipherOnly&&t.push("encipherOnly"),e&Jt.keyAgreement&&t.push("keyAgreement"),e&Jt.keyCertSign&&t.push("keyCertSign"),e&Jt.keyEncipherment&&t.push("keyEncipherment"),e&Jt.nonRepudiation&&t.push("nonRepudiation"),t}toString(){return`[${this.toJSON().join(", ")}]`}}var bo;class Ca{constructor(e={}){this.base=new Ke,this.minimum=0,Object.assign(this,e)}}w([D({type:Ke})],Ca.prototype,"base",void 0),w([D({type:Q.Integer,context:0,defaultValue:0,implicit:!0})],Ca.prototype,"minimum",void 0),w([D({type:Q.Integer,context:1,optional:!0,implicit:!0})],Ca.prototype,"maximum",void 0);let xa=bo=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,bo.prototype)}};xa=bo=w([he({type:se.Sequence,itemType:Ca})],xa);class uf{constructor(e={}){Object.assign(this,e)}}w([D({type:xa,context:0,optional:!0,implicit:!0})],uf.prototype,"permittedSubtrees",void 0),w([D({type:xa,context:1,optional:!0,implicit:!0})],uf.prototype,"excludedSubtrees",void 0);class cf{constructor(e={}){Object.assign(this,e)}}w([D({type:Q.Integer,context:0,implicit:!0,optional:!0,converter:et})],cf.prototype,"requireExplicitPolicy",void 0),w([D({type:Q.Integer,context:1,implicit:!0,optional:!0,converter:et})],cf.prototype,"inhibitPolicyMapping",void 0);var Ao;class Bo{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}w([D({type:Q.ObjectIdentifier})],Bo.prototype,"issuerDomainPolicy",void 0),w([D({type:Q.ObjectIdentifier})],Bo.prototype,"subjectDomainPolicy",void 0);let lf=Ao=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,Ao.prototype)}};lf=Ao=w([he({type:se.Sequence,itemType:Bo})],lf);var wo;const ff=`${gr}.17`;let Io=wo=class extends It{constructor(e){super(e),Object.setPrototypeOf(this,wo.prototype)}};Io=wo=w([he({type:se.Sequence})],Io);let Zt=class{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};w([D({type:Q.ObjectIdentifier})],Zt.prototype,"type",void 0),w([D({type:Q.Any,repeated:"set"})],Zt.prototype,"values",void 0);var To;let hf=To=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,To.prototype)}};hf=To=w([he({type:se.Sequence,itemType:Zt})],hf);const pf=`${gr}.14`;class Tr extends so{}class df{constructor(e={}){Object.assign(this,e)}}w([D({type:Q.GeneralizedTime,context:0,implicit:!0,optional:!0})],df.prototype,"notBefore",void 0),w([D({type:Q.GeneralizedTime,context:1,implicit:!0,optional:!0})],df.prototype,"notAfter",void 0);var Xi;(function(r){r[r.keyUpdateAllowed=1]="keyUpdateAllowed",r[r.newExtensions=2]="newExtensions",r[r.pKIXCertificate=4]="pKIXCertificate"})(Xi||(Xi={}));class yf extends oa{toJSON(){const e=[],t=this.toNumber();return t&Xi.pKIXCertificate&&e.push("pKIXCertificate"),t&Xi.newExtensions&&e.push("newExtensions"),t&Xi.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class vf{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new yf,Object.assign(this,e)}}w([D({type:Q.GeneralString})],vf.prototype,"entrustVers",void 0),w([D({type:yf})],vf.prototype,"entrustInfoFlags",void 0);var No;let gf=No=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,No.prototype)}};gf=No=w([he({type:se.Sequence,itemType:Qi})],gf);class Ae{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof Ae&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&ie.isEqual(e.parameters,this.parameters)||e.parameters===this.parameters)}}w([D({type:Q.ObjectIdentifier})],Ae.prototype,"algorithm",void 0),w([D({type:Q.Any,optional:!0})],Ae.prototype,"parameters",void 0);class zt{constructor(e={}){this.algorithm=new Ae,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:Ae})],zt.prototype,"algorithm",void 0),w([D({type:Q.BitString})],zt.prototype,"subjectPublicKey",void 0);let wt=class{constructor(e){if(e)if(typeof e=="string"||typeof e=="number"||e instanceof Date){const t=new Date(e);t.setMilliseconds(0),t.getUTCFullYear()>2049?this.generalTime=t:this.utcTime=t}else Object.assign(this,e)}getTime(){const e=this.utcTime||this.generalTime;if(!e)throw new Error("Cannot get time from CHOICE object");return e}};w([D({type:Q.UTCTime})],wt.prototype,"utcTime",void 0),w([D({type:Q.GeneralizedTime})],wt.prototype,"generalTime",void 0),wt=w([he({type:se.Choice})],wt);class Ji{constructor(e){this.notBefore=new wt(new Date),this.notAfter=new wt(new Date),e&&(this.notBefore=new wt(e.notBefore),this.notAfter=new wt(e.notAfter))}}w([D({type:wt})],Ji.prototype,"notBefore",void 0),w([D({type:wt})],Ji.prototype,"notAfter",void 0);var ko;let Mt=class up{constructor(e={}){this.extnID="",this.critical=up.CRITICAL,this.extnValue=new $e,Object.assign(this,e)}};Mt.CRITICAL=!1,w([D({type:Q.ObjectIdentifier})],Mt.prototype,"extnID",void 0),w([D({type:Q.Boolean,defaultValue:Mt.CRITICAL})],Mt.prototype,"critical",void 0),w([D({type:$e})],Mt.prototype,"extnValue",void 0);let Cr=ko=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,ko.prototype)}};Cr=ko=w([he({type:se.Sequence,itemType:Mt})],Cr);var Wr;(function(r){r[r.v1=0]="v1",r[r.v2=1]="v2",r[r.v3=2]="v3"})(Wr||(Wr={}));class Ft{constructor(e={}){this.version=Wr.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new Ae,this.issuer=new nt,this.validity=new Ji,this.subject=new nt,this.subjectPublicKeyInfo=new zt,Object.assign(this,e)}}w([D({type:Q.Integer,context:0,defaultValue:Wr.v1})],Ft.prototype,"version",void 0),w([D({type:Q.Integer,converter:et})],Ft.prototype,"serialNumber",void 0),w([D({type:Ae})],Ft.prototype,"signature",void 0),w([D({type:nt})],Ft.prototype,"issuer",void 0),w([D({type:Ji})],Ft.prototype,"validity",void 0),w([D({type:nt})],Ft.prototype,"subject",void 0),w([D({type:zt})],Ft.prototype,"subjectPublicKeyInfo",void 0),w([D({type:Q.BitString,context:1,implicit:!0,optional:!0})],Ft.prototype,"issuerUniqueID",void 0),w([D({type:Q.BitString,context:2,implicit:!0,optional:!0})],Ft.prototype,"subjectUniqueID",void 0),w([D({type:Cr,context:3,optional:!0})],Ft.prototype,"extensions",void 0);class Qr{constructor(e={}){this.tbsCertificate=new Ft,this.signatureAlgorithm=new Ae,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:Ft,raw:!0})],Qr.prototype,"tbsCertificate",void 0),w([D({type:Ae})],Qr.prototype,"signatureAlgorithm",void 0),w([D({type:Q.BitString})],Qr.prototype,"signatureValue",void 0);class Sa{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new wt,Object.assign(this,e)}}w([D({type:Q.Integer,converter:et})],Sa.prototype,"userCertificate",void 0),w([D({type:wt})],Sa.prototype,"revocationDate",void 0),w([D({type:Mt,optional:!0,repeated:"sequence"})],Sa.prototype,"crlEntryExtensions",void 0);class xr{constructor(e={}){this.signature=new Ae,this.issuer=new nt,this.thisUpdate=new wt,Object.assign(this,e)}}w([D({type:Q.Integer,optional:!0})],xr.prototype,"version",void 0),w([D({type:Ae})],xr.prototype,"signature",void 0),w([D({type:nt})],xr.prototype,"issuer",void 0),w([D({type:wt})],xr.prototype,"thisUpdate",void 0),w([D({type:wt,optional:!0})],xr.prototype,"nextUpdate",void 0),w([D({type:Sa,repeated:"sequence",optional:!0})],xr.prototype,"revokedCertificates",void 0),w([D({type:Mt,optional:!0,context:0,repeated:"sequence"})],xr.prototype,"crlExtensions",void 0);class _o{constructor(e={}){this.tbsCertList=new xr,this.signatureAlgorithm=new Ae,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:xr,raw:!0})],_o.prototype,"tbsCertList",void 0),w([D({type:Ae})],_o.prototype,"signatureAlgorithm",void 0),w([D({type:Q.BitString})],_o.prototype,"signature",void 0);class gi{constructor(e={}){this.issuer=new nt,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:nt})],gi.prototype,"issuer",void 0),w([D({type:Q.Integer,converter:et})],gi.prototype,"serialNumber",void 0);let mi=class{constructor(e={}){Object.assign(this,e)}};w([D({type:Tr,context:0,implicit:!0})],mi.prototype,"subjectKeyIdentifier",void 0),w([D({type:gi})],mi.prototype,"issuerAndSerialNumber",void 0),mi=w([he({type:se.Choice})],mi);var Sr;(function(r){r[r.v0=0]="v0",r[r.v1=1]="v1",r[r.v2=2]="v2",r[r.v3=3]="v3",r[r.v4=4]="v4",r[r.v5=5]="v5"})(Sr||(Sr={}));let Zi=class extends Ae{};Zi=w([he({type:se.Sequence})],Zi);let Ea=class extends Ae{};Ea=w([he({type:se.Sequence})],Ea);let lr=class extends Ae{};lr=w([he({type:se.Sequence})],lr);let ba=class extends Ae{};ba=w([he({type:se.Sequence})],ba);let mf=class extends Ae{};mf=w([he({type:se.Sequence})],mf);let Ro=class extends Ae{};Ro=w([he({type:se.Sequence})],Ro);let Ci=class{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};w([D({type:Q.ObjectIdentifier})],Ci.prototype,"attrType",void 0),w([D({type:Q.Any,repeated:"set"})],Ci.prototype,"attrValues",void 0);var Uo;class fr{constructor(e={}){this.version=Sr.v0,this.sid=new mi,this.digestAlgorithm=new Zi,this.signatureAlgorithm=new Ea,this.signature=new $e,Object.assign(this,e)}}w([D({type:Q.Integer})],fr.prototype,"version",void 0),w([D({type:mi})],fr.prototype,"sid",void 0),w([D({type:Zi})],fr.prototype,"digestAlgorithm",void 0),w([D({type:Ci,repeated:"set",context:0,implicit:!0,optional:!0,raw:!0})],fr.prototype,"signedAttrs",void 0),w([D({type:Ea})],fr.prototype,"signatureAlgorithm",void 0),w([D({type:$e})],fr.prototype,"signature",void 0),w([D({type:Ci,repeated:"set",context:1,implicit:!0,optional:!0})],fr.prototype,"unsignedAttrs",void 0);let Aa=Uo=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,Uo.prototype)}};Aa=Uo=w([he({type:se.Set,itemType:fr})],Aa);let Cf=class extends fr{};Cf=w([he({type:se.Sequence})],Cf);let xf=class extends wt{};xf=w([he({type:se.Choice})],xf);class Lo{constructor(e={}){this.acIssuer=new Ke,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}w([D({type:Ke})],Lo.prototype,"acIssuer",void 0),w([D({type:Q.Integer})],Lo.prototype,"acSerial",void 0),w([D({type:Zt,repeated:"sequence"})],Lo.prototype,"attrs",void 0);var Oo;let Ba=Oo=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,Oo.prototype)}};Ba=Oo=w([he({type:se.Sequence,itemType:Q.ObjectIdentifier})],Ba);class wa{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}w([D({type:Q.Integer,optional:!0})],wa.prototype,"pathLenConstraint",void 0),w([D({type:Ba,implicit:!0,context:0,optional:!0})],wa.prototype,"permittedAttrs",void 0),w([D({type:Ba,implicit:!0,context:1,optional:!0})],wa.prototype,"excludedAttrs",void 0),w([D({type:Q.Boolean,defaultValue:!0})],wa.prototype,"permitUnSpecified",void 0);class Yr{constructor(e={}){this.issuer=new It,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:It})],Yr.prototype,"issuer",void 0),w([D({type:Q.Integer,converter:et})],Yr.prototype,"serial",void 0),w([D({type:Q.BitString,optional:!0})],Yr.prototype,"issuerUID",void 0);var Do;(function(r){r[r.publicKey=0]="publicKey",r[r.publicKeyCert=1]="publicKeyCert",r[r.otherObjectTypes=2]="otherObjectTypes"})(Do||(Do={}));class Xr{constructor(e={}){this.digestedObjectType=Do.publicKey,this.digestAlgorithm=new Ae,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:Q.Enumerated})],Xr.prototype,"digestedObjectType",void 0),w([D({type:Q.ObjectIdentifier,optional:!0})],Xr.prototype,"otherObjectTypeID",void 0),w([D({type:Ae})],Xr.prototype,"digestAlgorithm",void 0),w([D({type:Q.BitString})],Xr.prototype,"objectDigest",void 0);class Ia{constructor(e={}){Object.assign(this,e)}}w([D({type:It,optional:!0})],Ia.prototype,"issuerName",void 0),w([D({type:Yr,context:0,implicit:!0,optional:!0})],Ia.prototype,"baseCertificateID",void 0),w([D({type:Xr,context:1,implicit:!0,optional:!0})],Ia.prototype,"objectDigestInfo",void 0);let xi=class{constructor(e={}){Object.assign(this,e)}};w([D({type:Ke,repeated:"sequence"})],xi.prototype,"v1Form",void 0),w([D({type:Ia,context:0,implicit:!0})],xi.prototype,"v2Form",void 0),xi=w([he({type:se.Choice})],xi);class Ta{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}w([D({type:Q.GeneralizedTime})],Ta.prototype,"notBeforeTime",void 0),w([D({type:Q.GeneralizedTime})],Ta.prototype,"notAfterTime",void 0);class en{constructor(e={}){Object.assign(this,e)}}w([D({type:Yr,implicit:!0,context:0,optional:!0})],en.prototype,"baseCertificateID",void 0),w([D({type:It,implicit:!0,context:1,optional:!0})],en.prototype,"entityName",void 0),w([D({type:Xr,implicit:!0,context:2,optional:!0})],en.prototype,"objectDigestInfo",void 0);var Po;(function(r){r[r.v2=1]="v2"})(Po||(Po={}));class er{constructor(e={}){this.version=Po.v2,this.holder=new en,this.issuer=new xi,this.signature=new Ae,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new Ta,this.attributes=[],Object.assign(this,e)}}w([D({type:Q.Integer})],er.prototype,"version",void 0),w([D({type:en})],er.prototype,"holder",void 0),w([D({type:xi})],er.prototype,"issuer",void 0),w([D({type:Ae})],er.prototype,"signature",void 0),w([D({type:Q.Integer,converter:et})],er.prototype,"serialNumber",void 0),w([D({type:Ta})],er.prototype,"attrCertValidityPeriod",void 0),w([D({type:Zt,repeated:"sequence"})],er.prototype,"attributes",void 0),w([D({type:Q.BitString,optional:!0})],er.prototype,"issuerUniqueID",void 0),w([D({type:Cr,optional:!0})],er.prototype,"extensions",void 0);class Na{constructor(e={}){this.acinfo=new er,this.signatureAlgorithm=new Ae,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:er})],Na.prototype,"acinfo",void 0),w([D({type:Ae})],Na.prototype,"signatureAlgorithm",void 0),w([D({type:Q.BitString})],Na.prototype,"signatureValue",void 0);var ka;(function(r){r[r.unmarked=1]="unmarked",r[r.unclassified=2]="unclassified",r[r.restricted=4]="restricted",r[r.confidential=8]="confidential",r[r.secret=16]="secret",r[r.topSecret=32]="topSecret"})(ka||(ka={}));class Vo extends oa{}class Mo{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:Q.ObjectIdentifier,implicit:!0,context:0})],Mo.prototype,"type",void 0),w([D({type:Q.Any,implicit:!0,context:1})],Mo.prototype,"value",void 0);class Fo{constructor(e={}){this.policyId="",this.classList=new Vo(ka.unclassified),Object.assign(this,e)}}w([D({type:Q.ObjectIdentifier})],Fo.prototype,"policyId",void 0),w([D({type:Vo,defaultValue:new Vo(ka.unclassified)})],Fo.prototype,"classList",void 0),w([D({type:Mo,repeated:"set"})],Fo.prototype,"securityCategories",void 0);class _a{constructor(e={}){Object.assign(this,e)}}w([D({type:$e})],_a.prototype,"cotets",void 0),w([D({type:Q.ObjectIdentifier})],_a.prototype,"oid",void 0),w([D({type:Q.Utf8String})],_a.prototype,"string",void 0);class Sf{constructor(e={}){this.values=[],Object.assign(this,e)}}w([D({type:It,implicit:!0,context:0,optional:!0})],Sf.prototype,"policyAuthority",void 0),w([D({type:_a,repeated:"sequence"})],Sf.prototype,"values",void 0);var Ko;class Ra{constructor(e={}){this.targetCertificate=new Yr,Object.assign(this,e)}}w([D({type:Yr})],Ra.prototype,"targetCertificate",void 0),w([D({type:Ke,optional:!0})],Ra.prototype,"targetName",void 0),w([D({type:Xr,optional:!0})],Ra.prototype,"certDigestInfo",void 0);let Si=class{constructor(e={}){Object.assign(this,e)}};w([D({type:Ke,context:0,implicit:!0})],Si.prototype,"targetName",void 0),w([D({type:Ke,context:1,implicit:!0})],Si.prototype,"targetGroup",void 0),w([D({type:Ra,context:2,implicit:!0})],Si.prototype,"targetCert",void 0),Si=w([he({type:se.Choice})],Si);let jo=Ko=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,Ko.prototype)}};jo=Ko=w([he({type:se.Sequence,itemType:Si})],jo);var Ho;let Ef=Ho=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,Ho.prototype)}};Ef=Ho=w([he({type:se.Sequence,itemType:jo})],Ef);class bf{constructor(e={}){Object.assign(this,e)}}w([D({type:It,implicit:!0,context:0,optional:!0})],bf.prototype,"roleAuthority",void 0),w([D({type:Ke,implicit:!0,context:1})],bf.prototype,"roleName",void 0);class qo{constructor(e={}){this.service=new Ke,this.ident=new Ke,Object.assign(this,e)}}w([D({type:Ke})],qo.prototype,"service",void 0),w([D({type:Ke})],qo.prototype,"ident",void 0),w([D({type:$e,optional:!0})],qo.prototype,"authInfo",void 0);var Go;class $o{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:Q.ObjectIdentifier})],$o.prototype,"otherCertFormat",void 0),w([D({type:Q.Any})],$o.prototype,"otherCert",void 0);let Ei=class{constructor(e={}){Object.assign(this,e)}};w([D({type:Qr})],Ei.prototype,"certificate",void 0),w([D({type:Na,context:2,implicit:!0})],Ei.prototype,"v2AttrCert",void 0),w([D({type:$o,context:3,implicit:!0})],Ei.prototype,"other",void 0),Ei=w([he({type:se.Choice})],Ei);let Ua=Go=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,Go.prototype)}};Ua=Go=w([he({type:se.Set,itemType:Ei})],Ua);class bi{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:Q.ObjectIdentifier})],bi.prototype,"contentType",void 0),w([D({type:Q.Any,context:0})],bi.prototype,"content",void 0);let tn=class{constructor(e={}){Object.assign(this,e)}};w([D({type:$e})],tn.prototype,"single",void 0),w([D({type:Q.Any})],tn.prototype,"any",void 0),tn=w([he({type:se.Choice})],tn);class La{constructor(e={}){this.eContentType="",Object.assign(this,e)}}w([D({type:Q.ObjectIdentifier})],La.prototype,"eContentType",void 0),w([D({type:tn,context:0,optional:!0})],La.prototype,"eContent",void 0);let rn=class{constructor(e={}){Object.assign(this,e)}};w([D({type:$e,context:0,implicit:!0,optional:!0})],rn.prototype,"value",void 0),w([D({type:$e,converter:Dp,context:0,implicit:!0,optional:!0,repeated:"sequence"})],rn.prototype,"constructedValue",void 0),rn=w([he({type:se.Choice})],rn);class nn{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new ba,Object.assign(this,e)}}w([D({type:Q.ObjectIdentifier})],nn.prototype,"contentType",void 0),w([D({type:ba})],nn.prototype,"contentEncryptionAlgorithm",void 0),w([D({type:rn,optional:!0})],nn.prototype,"encryptedContent",void 0);class Oa{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}w([D({type:Q.ObjectIdentifier})],Oa.prototype,"keyAttrId",void 0),w([D({type:Q.Any,optional:!0})],Oa.prototype,"keyAttr",void 0);var zo;class Da{constructor(e={}){this.subjectKeyIdentifier=new Tr,Object.assign(this,e)}}w([D({type:Tr})],Da.prototype,"subjectKeyIdentifier",void 0),w([D({type:Q.GeneralizedTime,optional:!0})],Da.prototype,"date",void 0),w([D({type:Oa,optional:!0})],Da.prototype,"other",void 0);let Ai=class{constructor(e={}){Object.assign(this,e)}};w([D({type:Da,context:0,implicit:!0,optional:!0})],Ai.prototype,"rKeyId",void 0),w([D({type:gi,optional:!0})],Ai.prototype,"issuerAndSerialNumber",void 0),Ai=w([he({type:se.Choice})],Ai);class Wo{constructor(e={}){this.rid=new Ai,this.encryptedKey=new $e,Object.assign(this,e)}}w([D({type:Ai})],Wo.prototype,"rid",void 0),w([D({type:$e})],Wo.prototype,"encryptedKey",void 0);let Pa=zo=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,zo.prototype)}};Pa=zo=w([he({type:se.Sequence,itemType:Wo})],Pa);class Qo{constructor(e={}){this.algorithm=new Ae,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:Ae})],Qo.prototype,"algorithm",void 0),w([D({type:Q.BitString})],Qo.prototype,"publicKey",void 0);let Jr=class{constructor(e={}){Object.assign(this,e)}};w([D({type:Tr,context:0,implicit:!0,optional:!0})],Jr.prototype,"subjectKeyIdentifier",void 0),w([D({type:Qo,context:1,implicit:!0,optional:!0})],Jr.prototype,"originatorKey",void 0),w([D({type:gi,optional:!0})],Jr.prototype,"issuerAndSerialNumber",void 0),Jr=w([he({type:se.Choice})],Jr);class Bi{constructor(e={}){this.version=Sr.v3,this.originator=new Jr,this.keyEncryptionAlgorithm=new lr,this.recipientEncryptedKeys=new Pa,Object.assign(this,e)}}w([D({type:Q.Integer})],Bi.prototype,"version",void 0),w([D({type:Jr,context:0})],Bi.prototype,"originator",void 0),w([D({type:$e,context:1,optional:!0})],Bi.prototype,"ukm",void 0),w([D({type:lr})],Bi.prototype,"keyEncryptionAlgorithm",void 0),w([D({type:Pa})],Bi.prototype,"recipientEncryptedKeys",void 0);let wi=class{constructor(e={}){Object.assign(this,e)}};w([D({type:Tr,context:0,implicit:!0})],wi.prototype,"subjectKeyIdentifier",void 0),w([D({type:gi})],wi.prototype,"issuerAndSerialNumber",void 0),wi=w([he({type:se.Choice})],wi);class an{constructor(e={}){this.version=Sr.v0,this.rid=new wi,this.keyEncryptionAlgorithm=new lr,this.encryptedKey=new $e,Object.assign(this,e)}}w([D({type:Q.Integer})],an.prototype,"version",void 0),w([D({type:wi})],an.prototype,"rid",void 0),w([D({type:lr})],an.prototype,"keyEncryptionAlgorithm",void 0),w([D({type:$e})],an.prototype,"encryptedKey",void 0);class sn{constructor(e={}){this.keyIdentifier=new $e,Object.assign(this,e)}}w([D({type:$e})],sn.prototype,"keyIdentifier",void 0),w([D({type:Q.GeneralizedTime,optional:!0})],sn.prototype,"date",void 0),w([D({type:Oa,optional:!0})],sn.prototype,"other",void 0);class on{constructor(e={}){this.version=Sr.v4,this.kekid=new sn,this.keyEncryptionAlgorithm=new lr,this.encryptedKey=new $e,Object.assign(this,e)}}w([D({type:Q.Integer})],on.prototype,"version",void 0),w([D({type:sn})],on.prototype,"kekid",void 0),w([D({type:lr})],on.prototype,"keyEncryptionAlgorithm",void 0),w([D({type:$e})],on.prototype,"encryptedKey",void 0);class un{constructor(e={}){this.version=Sr.v0,this.keyEncryptionAlgorithm=new lr,this.encryptedKey=new $e,Object.assign(this,e)}}w([D({type:Q.Integer})],un.prototype,"version",void 0),w([D({type:Ro,context:0,optional:!0})],un.prototype,"keyDerivationAlgorithm",void 0),w([D({type:lr})],un.prototype,"keyEncryptionAlgorithm",void 0),w([D({type:$e})],un.prototype,"encryptedKey",void 0);class Yo{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:Q.ObjectIdentifier})],Yo.prototype,"oriType",void 0),w([D({type:Q.Any})],Yo.prototype,"oriValue",void 0);let Nr=class{constructor(e={}){Object.assign(this,e)}};w([D({type:an,optional:!0})],Nr.prototype,"ktri",void 0),w([D({type:Bi,context:1,implicit:!0,optional:!0})],Nr.prototype,"kari",void 0),w([D({type:on,context:2,implicit:!0,optional:!0})],Nr.prototype,"kekri",void 0),w([D({type:un,context:3,implicit:!0,optional:!0})],Nr.prototype,"pwri",void 0),w([D({type:Yo,context:4,implicit:!0,optional:!0})],Nr.prototype,"ori",void 0),Nr=w([he({type:se.Choice})],Nr);var Xo;let Va=Xo=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,Xo.prototype)}};Va=Xo=w([he({type:se.Set,itemType:Nr})],Va);var Jo;class Ma{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:Q.ObjectIdentifier})],Ma.prototype,"otherRevInfoFormat",void 0),w([D({type:Q.Any})],Ma.prototype,"otherRevInfo",void 0);let Fa=class{constructor(e={}){this.other=new Ma,Object.assign(this,e)}};w([D({type:Ma,context:1,implicit:!0})],Fa.prototype,"other",void 0),Fa=w([he({type:se.Choice})],Fa);let Ka=Jo=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,Jo.prototype)}};Ka=Jo=w([he({type:se.Set,itemType:Fa})],Ka);class Zo{constructor(e={}){Object.assign(this,e)}}w([D({type:Ua,context:0,implicit:!0,optional:!0})],Zo.prototype,"certs",void 0),w([D({type:Ka,context:1,implicit:!0,optional:!0})],Zo.prototype,"crls",void 0);var eu;let tu=eu=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,eu.prototype)}};tu=eu=w([he({type:se.Set,itemType:Ci})],tu);class cn{constructor(e={}){this.version=Sr.v0,this.recipientInfos=new Va,this.encryptedContentInfo=new nn,Object.assign(this,e)}}w([D({type:Q.Integer})],cn.prototype,"version",void 0),w([D({type:Zo,context:0,implicit:!0,optional:!0})],cn.prototype,"originatorInfo",void 0),w([D({type:Va})],cn.prototype,"recipientInfos",void 0),w([D({type:nn})],cn.prototype,"encryptedContentInfo",void 0),w([D({type:tu,context:1,implicit:!0,optional:!0})],cn.prototype,"unprotectedAttrs",void 0);const ld="1.2.840.113549.1.7.2";var ru;let ja=ru=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,ru.prototype)}};ja=ru=w([he({type:se.Set,itemType:Zi})],ja);class Ii{constructor(e={}){this.version=Sr.v0,this.digestAlgorithms=new ja,this.encapContentInfo=new La,this.signerInfos=new Aa,Object.assign(this,e)}}w([D({type:Q.Integer})],Ii.prototype,"version",void 0),w([D({type:ja})],Ii.prototype,"digestAlgorithms",void 0),w([D({type:La})],Ii.prototype,"encapContentInfo",void 0),w([D({type:Ua,context:0,implicit:!0,optional:!0})],Ii.prototype,"certificates",void 0),w([D({type:Ka,context:1,implicit:!0,optional:!0})],Ii.prototype,"crls",void 0),w([D({type:Aa})],Ii.prototype,"signerInfos",void 0);const ln="1.2.840.10045.2.1",iu="1.2.840.10045.4.1",Af="1.2.840.10045.4.3.1",nu="1.2.840.10045.4.3.2",au="1.2.840.10045.4.3.3",su="1.2.840.10045.4.3.4",Bf="1.2.840.10045.3.1.7",wf="1.3.132.0.34",If="1.3.132.0.35";function fn(r){return new Ae({algorithm:r})}const fd=fn(iu);fn(Af);const hd=fn(nu),pd=fn(au),dd=fn(su);let hn=class{constructor(e={}){Object.assign(this,e)}};w([D({type:Q.ObjectIdentifier})],hn.prototype,"fieldType",void 0),w([D({type:Q.Any})],hn.prototype,"parameters",void 0),hn=w([he({type:se.Sequence})],hn);class yd extends $e{}let Ti=class{constructor(e={}){Object.assign(this,e)}};w([D({type:Q.OctetString})],Ti.prototype,"a",void 0),w([D({type:Q.OctetString})],Ti.prototype,"b",void 0),w([D({type:Q.BitString,optional:!0})],Ti.prototype,"seed",void 0),Ti=w([he({type:se.Sequence})],Ti);var ou;(function(r){r[r.ecpVer1=1]="ecpVer1"})(ou||(ou={}));let Er=class{constructor(e={}){this.version=ou.ecpVer1,Object.assign(this,e)}};w([D({type:Q.Integer})],Er.prototype,"version",void 0),w([D({type:hn})],Er.prototype,"fieldID",void 0),w([D({type:Ti})],Er.prototype,"curve",void 0),w([D({type:yd})],Er.prototype,"base",void 0),w([D({type:Q.Integer,converter:et})],Er.prototype,"order",void 0),w([D({type:Q.Integer,optional:!0})],Er.prototype,"cofactor",void 0),Er=w([he({type:se.Sequence})],Er);let kr=class{constructor(e={}){Object.assign(this,e)}};w([D({type:Q.ObjectIdentifier})],kr.prototype,"namedCurve",void 0),w([D({type:Q.Null})],kr.prototype,"implicitCurve",void 0),w([D({type:Er})],kr.prototype,"specifiedCurve",void 0),kr=w([he({type:se.Choice})],kr);class Ha{constructor(e={}){this.version=1,this.privateKey=new $e,Object.assign(this,e)}}w([D({type:Q.Integer})],Ha.prototype,"version",void 0),w([D({type:$e})],Ha.prototype,"privateKey",void 0),w([D({type:kr,context:0,optional:!0})],Ha.prototype,"parameters",void 0),w([D({type:Q.BitString,context:1,optional:!0})],Ha.prototype,"publicKey",void 0);class qa{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:Q.Integer,converter:et})],qa.prototype,"r",void 0),w([D({type:Q.Integer,converter:et})],qa.prototype,"s",void 0);const Ut="1.2.840.113549.1.1",Zr=`${Ut}.1`,vd=`${Ut}.7`,gd=`${Ut}.9`,pn=`${Ut}.10`,md=`${Ut}.2`,Cd=`${Ut}.4`,Ga=`${Ut}.5`,xd=`${Ut}.14`,uu=`${Ut}.11`,$a=`${Ut}.12`,za=`${Ut}.13`,Tf=`${Ut}.15`,Nf=`${Ut}.16`,Wa="1.3.14.3.2.26",kf="2.16.840.1.101.3.4.2.4",Qa="2.16.840.1.101.3.4.2.1",Ya="2.16.840.1.101.3.4.2.2",Xa="2.16.840.1.101.3.4.2.3",Sd="2.16.840.1.101.3.4.2.5",Ed="2.16.840.1.101.3.4.2.6",bd="1.2.840.113549.2.2",Ad="1.2.840.113549.2.5",Ja=`${Ut}.8`;function lt(r){return new Ae({algorithm:r,parameters:null})}lt(bd),lt(Ad);const ei=lt(Wa);lt(kf),lt(Qa),lt(Ya),lt(Xa),lt(Sd),lt(Ed);const _f=new Ae({algorithm:Ja,parameters:ye.serialize(ei)}),Rf=new Ae({algorithm:gd,parameters:ye.serialize(ua.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});lt(Zr),lt(md),lt(Cd),lt(Ga),lt(Tf),lt(Nf),lt($a),lt(za),lt(Tf),lt(Nf);class Za{constructor(e={}){this.hashAlgorithm=new Ae(ei),this.maskGenAlgorithm=new Ae({algorithm:Ja,parameters:ye.serialize(ei)}),this.pSourceAlgorithm=new Ae(Rf),Object.assign(this,e)}}w([D({type:Ae,context:0,defaultValue:ei})],Za.prototype,"hashAlgorithm",void 0),w([D({type:Ae,context:1,defaultValue:_f})],Za.prototype,"maskGenAlgorithm",void 0),w([D({type:Ae,context:2,defaultValue:Rf})],Za.prototype,"pSourceAlgorithm",void 0),new Ae({algorithm:vd,parameters:ye.serialize(new Za)});class ti{constructor(e={}){this.hashAlgorithm=new Ae(ei),this.maskGenAlgorithm=new Ae({algorithm:Ja,parameters:ye.serialize(ei)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}}w([D({type:Ae,context:0,defaultValue:ei})],ti.prototype,"hashAlgorithm",void 0),w([D({type:Ae,context:1,defaultValue:_f})],ti.prototype,"maskGenAlgorithm",void 0),w([D({type:Q.Integer,context:2,defaultValue:20})],ti.prototype,"saltLength",void 0),w([D({type:Q.Integer,context:3,defaultValue:1})],ti.prototype,"trailerField",void 0),new Ae({algorithm:pn,parameters:ye.serialize(new ti)});class es{constructor(e={}){this.digestAlgorithm=new Ae,this.digest=new $e,Object.assign(this,e)}}w([D({type:Ae})],es.prototype,"digestAlgorithm",void 0),w([D({type:$e})],es.prototype,"digest",void 0);var cu;class ts{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:Q.Integer,converter:et})],ts.prototype,"prime",void 0),w([D({type:Q.Integer,converter:et})],ts.prototype,"exponent",void 0),w([D({type:Q.Integer,converter:et})],ts.prototype,"coefficient",void 0);let lu=cu=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,cu.prototype)}};lu=cu=w([he({type:se.Sequence,itemType:ts})],lu);class hr{constructor(e={}){this.version=0,this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),this.privateExponent=new ArrayBuffer(0),this.prime1=new ArrayBuffer(0),this.prime2=new ArrayBuffer(0),this.exponent1=new ArrayBuffer(0),this.exponent2=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:Q.Integer})],hr.prototype,"version",void 0),w([D({type:Q.Integer,converter:et})],hr.prototype,"modulus",void 0),w([D({type:Q.Integer,converter:et})],hr.prototype,"publicExponent",void 0),w([D({type:Q.Integer,converter:et})],hr.prototype,"privateExponent",void 0),w([D({type:Q.Integer,converter:et})],hr.prototype,"prime1",void 0),w([D({type:Q.Integer,converter:et})],hr.prototype,"prime2",void 0),w([D({type:Q.Integer,converter:et})],hr.prototype,"exponent1",void 0),w([D({type:Q.Integer,converter:et})],hr.prototype,"exponent2",void 0),w([D({type:Q.Integer,converter:et})],hr.prototype,"coefficient",void 0),w([D({type:lu,optional:!0})],hr.prototype,"otherPrimeInfos",void 0);class fu{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:Q.Integer,converter:et})],fu.prototype,"modulus",void 0),w([D({type:Q.Integer,converter:et})],fu.prototype,"publicExponent",void 0);var hu;(function(r){r[r.Transient=0]="Transient",r[r.Singleton=1]="Singleton",r[r.ResolutionScoped=2]="ResolutionScoped",r[r.ContainerScoped=3]="ContainerScoped"})(hu||(hu={}));var Lt=hu,Bd="injectionTokens";function wd(r){var e=Reflect.getMetadata("design:paramtypes",r)||[],t=Reflect.getOwnMetadata(Bd,r)||{};return Object.keys(t).forEach(function(i){e[+i]=t[i]}),e}function Uf(r){return!!r.useClass}function pu(r){return!!r.useFactory}var Lf=(function(){function r(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return r.prototype.createProxy=function(e){var t=this,i={},a=!1,o,s=function(){return a||(o=e(t.wrap()),a=!0),o};return new Proxy(i,this.createHandler(s))},r.prototype.createHandler=function(e){var t={},i=function(a){t[a]=function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];o[0]=e();var n=Reflect[a];return n.apply(void 0,Gr(o))}};return this.reflectMethods.forEach(i),t},r})();function Ni(r){return typeof r=="string"||typeof r=="symbol"}function Id(r){return typeof r=="object"&&"token"in r&&"multiple"in r}function Of(r){return typeof r=="object"&&"token"in r&&"transform"in r}function Td(r){return typeof r=="function"||r instanceof Lf}function rs(r){return!!r.useToken}function is(r){return r.useValue!=null}function Nd(r){return Uf(r)||is(r)||rs(r)||pu(r)}var du=(function(){function r(){this._registryMap=new Map}return r.prototype.entries=function(){return this._registryMap.entries()},r.prototype.getAll=function(e){return this.ensure(e),this._registryMap.get(e)},r.prototype.get=function(e){this.ensure(e);var t=this._registryMap.get(e);return t[t.length-1]||null},r.prototype.set=function(e,t){this.ensure(e),this._registryMap.get(e).push(t)},r.prototype.setAll=function(e,t){this._registryMap.set(e,t)},r.prototype.has=function(e){return this.ensure(e),this._registryMap.get(e).length>0},r.prototype.clear=function(){this._registryMap.clear()},r.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},r})(),kd=(function(r){Ys(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e})(du),ns=(function(){function r(){this.scopedResolutions=new Map}return r})();function _d(r,e){if(r===null)return"at position #"+e;var t=r.split(",")[e].trim();return'"'+t+'" at position #'+e}function Rd(r,e,t){return t===void 0&&(t=" "),Gr([r],e.message.split(`
|
|
6
|
+
`).map(function(i){return t+i})).join(`
|
|
7
|
+
`)}function Ud(r,e,t){var i=la(r.toString().match(/constructor\(([\w, ]+)\)/)||[],2),a=i[1],o=a===void 0?null:a,s=_d(o,e);return Rd("Cannot inject the dependency "+s+' of "'+r.name+'" constructor. Reason:',t)}function Ld(r){if(typeof r.dispose!="function")return!1;var e=r.dispose;return!(e.length>0)}var Od=(function(r){Ys(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e})(du),Dd=(function(r){Ys(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e})(du),Pd=(function(){function r(){this.preResolution=new Od,this.postResolution=new Dd}return r})(),Df=new Map,Vd=(function(){function r(e){this.parent=e,this._registry=new kd,this.interceptors=new Pd,this.disposed=!1,this.disposables=new Set}return r.prototype.register=function(e,t,i){i===void 0&&(i={lifecycle:Lt.Transient}),this.ensureNotDisposed();var a;if(Nd(t)?a=t:a={useClass:t},rs(a))for(var o=[e],s=a;s!=null;){var n=s.useToken;if(o.includes(n))throw new Error("Token registration cycle detected! "+Gr(o,[n]).join(" -> "));o.push(n);var p=this._registry.get(n);p&&rs(p.provider)?s=p.provider:s=null}if((i.lifecycle===Lt.Singleton||i.lifecycle==Lt.ContainerScoped||i.lifecycle==Lt.ResolutionScoped)&&(is(a)||pu(a)))throw new Error('Cannot use lifecycle "'+Lt[i.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:a,options:i}),this},r.prototype.registerType=function(e,t){return this.ensureNotDisposed(),Ni(t)?this.register(e,{useToken:t}):this.register(e,{useClass:t})},r.prototype.registerInstance=function(e,t){return this.ensureNotDisposed(),this.register(e,{useValue:t})},r.prototype.registerSingleton=function(e,t){if(this.ensureNotDisposed(),Ni(e)){if(Ni(t))return this.register(e,{useToken:t},{lifecycle:Lt.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:Lt.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var i=e;return t&&!Ni(t)&&(i=t),this.register(e,{useClass:i},{lifecycle:Lt.Singleton})},r.prototype.resolve=function(e,t,i){t===void 0&&(t=new ns),i===void 0&&(i=!1),this.ensureNotDisposed();var a=this.getRegistration(e);if(!a&&Ni(e)){if(i)return;throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"Single"),a){var o=this.resolveRegistration(a,t);return this.executePostResolutionInterceptor(e,o,"Single"),o}if(Td(e)){var o=this.construct(e,t);return this.executePostResolutionInterceptor(e,o,"Single"),o}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},r.prototype.executePreResolutionInterceptor=function(e,t){var i,a;if(this.interceptors.preResolution.has(e)){var o=[];try{for(var s=ca(this.interceptors.preResolution.getAll(e)),n=s.next();!n.done;n=s.next()){var p=n.value;p.options.frequency!="Once"&&o.push(p),p.callback(e,t)}}catch(f){i={error:f}}finally{try{n&&!n.done&&(a=s.return)&&a.call(s)}finally{if(i)throw i.error}}this.interceptors.preResolution.setAll(e,o)}},r.prototype.executePostResolutionInterceptor=function(e,t,i){var a,o;if(this.interceptors.postResolution.has(e)){var s=[];try{for(var n=ca(this.interceptors.postResolution.getAll(e)),p=n.next();!p.done;p=n.next()){var f=p.value;f.options.frequency!="Once"&&s.push(f),f.callback(e,t,i)}}catch(E){a={error:E}}finally{try{p&&!p.done&&(o=n.return)&&o.call(n)}finally{if(a)throw a.error}}this.interceptors.postResolution.setAll(e,s)}},r.prototype.resolveRegistration=function(e,t){if(this.ensureNotDisposed(),e.options.lifecycle===Lt.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);var i=e.options.lifecycle===Lt.Singleton,a=e.options.lifecycle===Lt.ContainerScoped,o=i||a,s;return is(e.provider)?s=e.provider.useValue:rs(e.provider)?s=o?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):Uf(e.provider)?s=o?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):pu(e.provider)?s=e.provider.useFactory(this):s=this.construct(e.provider,t),e.options.lifecycle===Lt.ResolutionScoped&&t.scopedResolutions.set(e,s),s},r.prototype.resolveAll=function(e,t,i){var a=this;t===void 0&&(t=new ns),i===void 0&&(i=!1),this.ensureNotDisposed();var o=this.getAllRegistrations(e);if(!o&&Ni(e)){if(i)return[];throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"All"),o){var s=o.map(function(p){return a.resolveRegistration(p,t)});return this.executePostResolutionInterceptor(e,s,"All"),s}var n=[this.construct(e,t)];return this.executePostResolutionInterceptor(e,n,"All"),n},r.prototype.isRegistered=function(e,t){return t===void 0&&(t=!1),this.ensureNotDisposed(),this._registry.has(e)||t&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},r.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},r.prototype.clearInstances=function(){var e,t;this.ensureNotDisposed();try{for(var i=ca(this._registry.entries()),a=i.next();!a.done;a=i.next()){var o=la(a.value,2),s=o[0],n=o[1];this._registry.setAll(s,n.filter(function(p){return!is(p.provider)}).map(function(p){return p.instance=void 0,p}))}}catch(p){e={error:p}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},r.prototype.createChildContainer=function(){var e,t;this.ensureNotDisposed();var i=new r(this);try{for(var a=ca(this._registry.entries()),o=a.next();!o.done;o=a.next()){var s=la(o.value,2),n=s[0],p=s[1];p.some(function(f){var E=f.options;return E.lifecycle===Lt.ContainerScoped})&&i._registry.setAll(n,p.map(function(f){return f.options.lifecycle===Lt.ContainerScoped?{provider:f.provider,options:f.options}:f}))}}catch(f){e={error:f}}finally{try{o&&!o.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return i},r.prototype.beforeResolution=function(e,t,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:t,options:i})},r.prototype.afterResolution=function(e,t,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:t,options:i})},r.prototype.dispose=function(){return ed(this,void 0,void 0,function(){var e;return td(this,function(t){switch(t.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(i){var a=i.dispose();a&&e.push(a)}),[4,Promise.all(e)];case 1:return t.sent(),[2]}})})},r.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},r.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},r.prototype.construct=function(e,t){var i=this;if(e instanceof Lf)return e.createProxy(function(o){return i.resolve(o,t)});var a=(function(){var o=Df.get(e);if(!o||o.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var s=o.map(i.resolveParams(t,e));return new(e.bind.apply(e,Gr([void 0],s)))})();return Ld(a)&&this.disposables.add(a),a},r.prototype.resolveParams=function(e,t){var i=this;return function(a,o){var s,n,p;try{return Id(a)?Of(a)?a.multiple?(s=i.resolve(a.transform)).transform.apply(s,Gr([i.resolveAll(a.token,new ns,a.isOptional)],a.transformArgs)):(n=i.resolve(a.transform)).transform.apply(n,Gr([i.resolve(a.token,e,a.isOptional)],a.transformArgs)):a.multiple?i.resolveAll(a.token,new ns,a.isOptional):i.resolve(a.token,e,a.isOptional):Of(a)?(p=i.resolve(a.transform,e)).transform.apply(p,Gr([i.resolve(a.token,e)],a.transformArgs)):i.resolve(a,e)}catch(f){throw new Error(Ud(t,o,f))}}},r.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},r})(),ft=new Vd;function as(r){return function(e){Df.set(e,wd(e))}}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var yu;class ss{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}}w([D({type:Q.ObjectIdentifier})],ss.prototype,"attrId",void 0),w([D({type:Q.Any,repeated:"set"})],ss.prototype,"attrValues",void 0);let Pf=yu=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,yu.prototype)}};Pf=yu=w([he({type:se.Sequence,itemType:ss})],Pf);var vu;let Vf=vu=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,vu.prototype)}};Vf=vu=w([he({type:se.Sequence,itemType:bi})],Vf);class Mf{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:Q.ObjectIdentifier})],Mf.prototype,"certId",void 0),w([D({type:Q.Any,context:0})],Mf.prototype,"certValue",void 0);class Ff{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:Q.ObjectIdentifier})],Ff.prototype,"crlId",void 0),w([D({type:Q.Any,context:0})],Ff.prototype,"crltValue",void 0);class Kf extends $e{}let os=class{constructor(e={}){this.encryptionAlgorithm=new Ae,this.encryptedData=new Kf,Object.assign(this,e)}};w([D({type:Ae})],os.prototype,"encryptionAlgorithm",void 0),w([D({type:Kf})],os.prototype,"encryptedData",void 0);var gu,mu;(function(r){r[r.v1=0]="v1"})(mu||(mu={}));class jf extends $e{}let Cu=gu=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,gu.prototype)}};Cu=gu=w([he({type:se.Sequence,itemType:Zt})],Cu);class dn{constructor(e={}){this.version=mu.v1,this.privateKeyAlgorithm=new Ae,this.privateKey=new jf,Object.assign(this,e)}}w([D({type:Q.Integer})],dn.prototype,"version",void 0),w([D({type:Ae})],dn.prototype,"privateKeyAlgorithm",void 0),w([D({type:jf})],dn.prototype,"privateKey",void 0),w([D({type:Cu,implicit:!0,context:0,optional:!0})],dn.prototype,"attributes",void 0);let Hf=class extends dn{};Hf=w([he({type:se.Sequence})],Hf);let qf=class extends os{};qf=w([he({type:se.Sequence})],qf);class Gf{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:Q.ObjectIdentifier})],Gf.prototype,"secretTypeId",void 0),w([D({type:Q.Any,context:0})],Gf.prototype,"secretValue",void 0);class yn{constructor(e={}){this.mac=new es,this.macSalt=new $e,this.iterations=1,Object.assign(this,e)}}w([D({type:es})],yn.prototype,"mac",void 0),w([D({type:$e})],yn.prototype,"macSalt",void 0),w([D({type:Q.Integer,defaultValue:1})],yn.prototype,"iterations",void 0);class us{constructor(e={}){this.version=3,this.authSafe=new bi,this.macData=new yn,Object.assign(this,e)}}w([D({type:Q.Integer})],us.prototype,"version",void 0),w([D({type:bi})],us.prototype,"authSafe",void 0),w([D({type:yn,optional:!0})],us.prototype,"macData",void 0);var xu;class cs{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:Q.ObjectIdentifier})],cs.prototype,"bagId",void 0),w([D({type:Q.Any,context:0})],cs.prototype,"bagValue",void 0),w([D({type:ss,repeated:"set",optional:!0})],cs.prototype,"bagAttributes",void 0);let $f=xu=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,xu.prototype)}};$f=xu=w([he({type:se.Sequence,itemType:cs})],$f);var Su,Eu,bu;const zf="1.2.840.113549.1.9",Wf=`${zf}.7`,ls=`${zf}.14`;let fs=class extends Bt{constructor(e={}){super(e)}toString(){return this.ia5String||super.toString()}};w([D({type:Q.IA5String})],fs.prototype,"ia5String",void 0),fs=w([he({type:se.Choice})],fs);let Qf=class extends bi{};Qf=w([he({type:se.Sequence})],Qf);let Yf=class extends us{};Yf=w([he({type:se.Sequence})],Yf);let Xf=class extends os{};Xf=w([he({type:se.Sequence})],Xf);let Au=class{constructor(e=""){this.value=e}toString(){return this.value}};w([D({type:Q.IA5String})],Au.prototype,"value",void 0),Au=w([he({type:se.Choice})],Au);let Jf=class extends fs{};Jf=w([he({type:se.Choice})],Jf);let Zf=class extends Bt{};Zf=w([he({type:se.Choice})],Zf);let Bu=class{constructor(e=new Date){this.value=e}};w([D({type:Q.GeneralizedTime})],Bu.prototype,"value",void 0),Bu=w([he({type:se.Choice})],Bu);let e0=class extends Bt{};e0=w([he({type:se.Choice})],e0);let wu=class{constructor(e="M"){this.value=e}toString(){return this.value}};w([D({type:Q.PrintableString})],wu.prototype,"value",void 0),wu=w([he({type:se.Choice})],wu);let hs=class{constructor(e=""){this.value=e}toString(){return this.value}};w([D({type:Q.PrintableString})],hs.prototype,"value",void 0),hs=w([he({type:se.Choice})],hs);let t0=class extends hs{};t0=w([he({type:se.Choice})],t0);let r0=class extends Bt{};r0=w([he({type:se.Choice})],r0);let Iu=class{constructor(e=""){this.value=e}toString(){return this.value}};w([D({type:Q.ObjectIdentifier})],Iu.prototype,"value",void 0),Iu=w([he({type:se.Choice})],Iu);let i0=class extends wt{};i0=w([he({type:se.Choice})],i0);let Tu=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};w([D({type:Q.Integer})],Tu.prototype,"value",void 0),Tu=w([he({type:se.Choice})],Tu);let n0=class extends fr{};n0=w([he({type:se.Sequence})],n0);let ps=class extends Bt{};ps=w([he({type:se.Choice})],ps);let a0=Su=class extends Cr{constructor(e){super(e),Object.setPrototypeOf(this,Su.prototype)}};a0=Su=w([he({type:se.Sequence})],a0);let s0=Eu=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,Eu.prototype)}};s0=Eu=w([he({type:se.Set,itemType:Ci})],s0);let Nu=class{constructor(e=""){this.value=e}toString(){return this.value}};w([D({type:Q.BmpString})],Nu.prototype,"value",void 0),Nu=w([he({type:se.Choice})],Nu);let ku=class extends Ae{};ku=w([he({type:se.Sequence})],ku);let o0=bu=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,bu.prototype)}};o0=bu=w([he({type:se.Sequence,itemType:ku})],o0);var _u;let ds=_u=class extends Ye{constructor(e){super(e),Object.setPrototypeOf(this,_u.prototype)}};ds=_u=w([he({type:se.Sequence,itemType:Zt})],ds);class ri{constructor(e={}){this.version=0,this.subject=new nt,this.subjectPKInfo=new zt,this.attributes=new ds,Object.assign(this,e)}}w([D({type:Q.Integer})],ri.prototype,"version",void 0),w([D({type:nt})],ri.prototype,"subject",void 0),w([D({type:zt})],ri.prototype,"subjectPKInfo",void 0),w([D({type:ds,implicit:!0,context:0,optional:!0})],ri.prototype,"attributes",void 0);class ki{constructor(e={}){this.certificationRequestInfo=new ri,this.signatureAlgorithm=new Ae,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}w([D({type:ri,raw:!0})],ki.prototype,"certificationRequestInfo",void 0),w([D({type:Ae})],ki.prototype,"signatureAlgorithm",void 0),w([D({type:Q.BitString})],ki.prototype,"signature",void 0);const vn="crypto.algorithm";class Md{getAlgorithms(){return ft.resolveAll(vn)}toAsnAlgorithm(e){({...e});for(const t of this.getAlgorithms()){const i=t.toAsnAlgorithm(e);if(i)return i}if(/^[0-9.]+$/.test(e.name)){const t=new Ae({algorithm:e.name});if("parameters"in e){const i=e;t.parameters=i.parameters}return t}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(e){for(const i of this.getAlgorithms()){const a=i.toWebAlgorithm(e);if(a)return a}return{name:e.algorithm,parameters:e.parameters}}}const _r="crypto.algorithmProvider";ft.registerSingleton(_r,Md);var ys;const Ot="1.3.36.3.3.2.8.1.1",u0=`${Ot}.1`,c0=`${Ot}.2`,l0=`${Ot}.3`,f0=`${Ot}.4`,h0=`${Ot}.5`,p0=`${Ot}.6`,d0=`${Ot}.7`,y0=`${Ot}.8`,v0=`${Ot}.9`,g0=`${Ot}.10`,m0=`${Ot}.11`,C0=`${Ot}.12`,x0=`${Ot}.13`,S0=`${Ot}.14`,E0="brainpoolP160r1",b0="brainpoolP160t1",A0="brainpoolP192r1",B0="brainpoolP192t1",w0="brainpoolP224r1",I0="brainpoolP224t1",T0="brainpoolP256r1",N0="brainpoolP256t1",k0="brainpoolP320r1",_0="brainpoolP320t1",R0="brainpoolP384r1",U0="brainpoolP384t1",L0="brainpoolP512r1",O0="brainpoolP512t1",it="ECDSA";let gn=ys=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case it.toLowerCase():if("hash"in e)switch((typeof e.hash=="string"?e.hash:e.hash.name).toLowerCase()){case"sha-1":return fd;case"sha-256":return hd;case"sha-384":return pd;case"sha-512":return dd}else if("namedCurve"in e){let t="";switch(e.namedCurve){case"P-256":t=Bf;break;case"K-256":t=ys.SECP256K1;break;case"P-384":t=wf;break;case"P-521":t=If;break;case E0:t=u0;break;case b0:t=c0;break;case A0:t=l0;break;case B0:t=f0;break;case w0:t=h0;break;case I0:t=p0;break;case T0:t=d0;break;case N0:t=y0;break;case k0:t=v0;break;case _0:t=g0;break;case R0:t=m0;break;case U0:t=C0;break;case L0:t=x0;break;case O0:t=S0;break}if(t)return new Ae({algorithm:ln,parameters:ye.serialize(new kr({namedCurve:t}))})}}return null}toWebAlgorithm(e){switch(e.algorithm){case iu:return{name:it,hash:{name:"SHA-1"}};case nu:return{name:it,hash:{name:"SHA-256"}};case au:return{name:it,hash:{name:"SHA-384"}};case su:return{name:it,hash:{name:"SHA-512"}};case ln:{if(!e.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(ye.parse(e.parameters,kr).namedCurve){case Bf:return{name:it,namedCurve:"P-256"};case ys.SECP256K1:return{name:it,namedCurve:"K-256"};case wf:return{name:it,namedCurve:"P-384"};case If:return{name:it,namedCurve:"P-521"};case u0:return{name:it,namedCurve:E0};case c0:return{name:it,namedCurve:b0};case l0:return{name:it,namedCurve:A0};case f0:return{name:it,namedCurve:B0};case h0:return{name:it,namedCurve:w0};case p0:return{name:it,namedCurve:I0};case d0:return{name:it,namedCurve:T0};case y0:return{name:it,namedCurve:N0};case v0:return{name:it,namedCurve:k0};case g0:return{name:it,namedCurve:_0};case m0:return{name:it,namedCurve:R0};case C0:return{name:it,namedCurve:U0};case x0:return{name:it,namedCurve:L0};case S0:return{name:it,namedCurve:O0}}}}return null}};gn.SECP256K1="1.3.132.0.10",gn=ys=w([as()],gn),ft.registerSingleton(vn,gn);const D0=Symbol("name"),P0=Symbol("value");class ze{constructor(e,t={},i=""){this[D0]=e,this[P0]=i;for(const a in t)this[a]=t[a]}}ze.NAME=D0,ze.VALUE=P0;class Fd{static toTextObject(e){const t=new ze("Algorithm Identifier",{},Rr.toString(e.algorithm));if(e.parameters)switch(e.algorithm){case ln:{const i=new gn().toWebAlgorithm(e);i&&"namedCurve"in i?t["Named Curve"]=i.namedCurve:t.Parameters=e.parameters;break}default:t.Parameters=e.parameters}return t}}class Rr{static toString(e){const t=this.items[e];return t||e}}Rr.items={[Wa]:"sha1",[kf]:"sha224",[Qa]:"sha256",[Ya]:"sha384",[Xa]:"sha512",[Zr]:"rsaEncryption",[Ga]:"sha1WithRSAEncryption",[xd]:"sha224WithRSAEncryption",[uu]:"sha256WithRSAEncryption",[$a]:"sha384WithRSAEncryption",[za]:"sha512WithRSAEncryption",[ln]:"ecPublicKey",[iu]:"ecdsaWithSHA1",[Af]:"ecdsaWithSHA224",[nu]:"ecdsaWithSHA256",[au]:"ecdsaWithSHA384",[su]:"ecdsaWithSHA512",[nd]:"TLS WWW server authentication",[ad]:"TLS WWW client authentication",[sd]:"Code Signing",[od]:"E-mail Protection",[ud]:"Time Stamping",[cd]:"OCSP Signing",[ld]:"Signed Data"};class ii{static serialize(e){return this.serializeObj(e).join(`
|
|
8
|
+
`)}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,t=0){const i=[];let a=this.pad(t++),o="";const s=e[ze.VALUE];s&&(o=` ${s}`),i.push(`${a}${e[ze.NAME]}:${o}`),a=this.pad(t);for(const n in e){if(typeof n=="symbol")continue;const p=e[n],f=n?`${n}: `:"";if(typeof p=="string"||typeof p=="number"||typeof p=="boolean")i.push(`${a}${f}${p}`);else if(p instanceof Date)i.push(`${a}${f}${p.toUTCString()}`);else if(Array.isArray(p))for(const E of p)E[ze.NAME]=n,i.push(...this.serializeObj(E,t));else if(p instanceof ze)p[ze.NAME]=n,i.push(...this.serializeObj(p,t));else if(ie.BufferSourceConverter.isBufferSource(p))n?(i.push(`${a}${f}`),i.push(...this.serializeBufferSource(p,t+1))):i.push(...this.serializeBufferSource(p,t));else if("toTextObject"in p){const E=p.toTextObject();E[ze.NAME]=n,i.push(...this.serializeObj(E,t))}else throw new TypeError("Cannot serialize data in text format. Unsupported type.")}return i}static serializeBufferSource(e,t=0){const i=this.pad(t),a=ie.BufferSourceConverter.toUint8Array(e),o=[];for(let s=0;s<a.length;){const n=[];for(let p=0;p<16&&s<a.length;p++){p===8&&n.push("");const f=a[s++].toString(16).padStart(2,"0");n.push(f)}o.push(`${i}${n.join(" ")}`)}return o}static serializeAlgorithm(e){return this.algorithmSerializer.toTextObject(e)}}ii.oidSerializer=Rr,ii.algorithmSerializer=Fd;var _i;class Ur{get rawData(){return je(this,_i,"f")||rt(this,_i,ye.serialize(this.asn),"f"),je(this,_i,"f")}constructor(...e){_i.set(this,void 0),ie.BufferSourceConverter.isBufferSource(e[0])?(this.asn=ye.parse(e[0],e[1]),rt(this,_i,ie.BufferSourceConverter.toArrayBuffer(e[0]),"f"),this.onInit(this.asn)):(this.asn=e[0],this.onInit(this.asn))}equal(e){return e instanceof Ur?ie.isEqual(e.rawData,this.rawData):!1}toString(e="text"){switch(e){case"asn":return ye.toString(this.rawData);case"text":return ii.serialize(this.toTextObject());case"hex":return ie.Convert.ToHex(this.rawData);case"base64":return ie.Convert.ToBase64(this.rawData);case"base64url":return ie.Convert.ToBase64Url(this.rawData);default:throw TypeError("Argument 'format' is unsupported value")}}getTextName(){return this.constructor.NAME}toTextObject(){const e=this.toTextObjectEmpty();return e[""]=this.rawData,e}toTextObjectEmpty(e){return new ze(this.getTextName(),{},e)}}_i=new WeakMap,Ur.NAME="ASN";class Kt extends Ur{constructor(...e){let t;ie.BufferSourceConverter.isBufferSource(e[0])?t=ie.BufferSourceConverter.toArrayBuffer(e[0]):t=ye.serialize(new Mt({extnID:e[0],critical:e[1],extnValue:new $e(ie.BufferSourceConverter.toArrayBuffer(e[2]))})),super(t,Mt)}onInit(e){this.type=e.extnID,this.critical=e.critical,this.value=e.extnValue.buffer}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.value,e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty(this.critical?"critical":void 0);return e[ze.NAME]===Kt.NAME&&(e[ze.NAME]=Rr.toString(this.type)),e}}var V0;class Lr{static isCryptoKeyPair(e){return e&&e.privateKey&&e.publicKey}static isCryptoKey(e){return e&&e.usages&&e.type&&e.algorithm&&e.extractable!==void 0}constructor(){this.items=new Map,this[V0]="CryptoProvider",typeof self<"u"&&typeof crypto<"u"?this.set(Lr.DEFAULT,crypto):typeof global<"u"&&global.crypto&&global.crypto.subtle&&this.set(Lr.DEFAULT,global.crypto)}clear(){this.items.clear()}delete(e){return this.items.delete(e)}forEach(e,t){return this.items.forEach(e,t)}has(e){return this.items.has(e)}get size(){return this.items.size}entries(){return this.items.entries()}keys(){return this.items.keys()}values(){return this.items.values()}[Symbol.iterator](){return this.items[Symbol.iterator]()}get(e=Lr.DEFAULT){const t=this.items.get(e.toLowerCase());if(!t)throw new Error(`Cannot get Crypto by name '${e}'`);return t}set(e,t){if(typeof e=="string"){if(!t)throw new TypeError("Argument 'value' is required");this.items.set(e.toLowerCase(),t)}else this.items.set(Lr.DEFAULT,e);return this}}V0=Symbol.toStringTag,Lr.DEFAULT="default";const ht=new Lr,Kd=/^[0-2](?:\.[1-9][0-9]*)+$/;function jd(r){return new RegExp(Kd).test(r)}class M0{constructor(e={}){this.items={};for(const t in e)this.register(t,e[t])}get(e){return this.items[e]||null}findId(e){return jd(e)?e:this.get(e)}register(e,t){this.items[e]=t,this.items[t]=e}}const Dt=new M0;Dt.register("CN","2.5.4.3"),Dt.register("L","2.5.4.7"),Dt.register("ST","2.5.4.8"),Dt.register("O","2.5.4.10"),Dt.register("OU","2.5.4.11"),Dt.register("C","2.5.4.6"),Dt.register("DC","0.9.2342.19200300.100.1.25"),Dt.register("E","1.2.840.113549.1.9.1"),Dt.register("G","2.5.4.42"),Dt.register("I","2.5.4.43"),Dt.register("SN","2.5.4.4"),Dt.register("T","2.5.4.12");function Hd(r,e){return`\\${ie.Convert.ToHex(ie.Convert.FromUtf8String(e)).toUpperCase()}`}function qd(r){return r.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,Hd)}class jt{static isASCII(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>255)return!1;return!0}static isPrintableString(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/g.test(e)}constructor(e,t={}){this.extraNames=new M0,this.asn=new nt;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const a=t[i];this.extraNames.register(i,a)}typeof e=="string"?this.asn=this.fromString(e):e instanceof nt?this.asn=e:ie.BufferSourceConverter.isBufferSource(e)?this.asn=ye.parse(e,nt):this.asn=this.fromJSON(e)}getField(e){const t=this.extraNames.findId(e)||Dt.findId(e),i=[];for(const a of this.asn)for(const o of a)o.type===t&&i.push(o.value.toString());return i}getName(e){return this.extraNames.get(e)||Dt.get(e)}toString(){return this.asn.map(e=>e.map(t=>{const i=this.getName(t.type)||t.type,a=t.value.anyValue?`#${ie.Convert.ToHex(t.value.anyValue)}`:qd(t.value.toString());return`${i}=${a}`}).join("+")).join(", ")}toJSON(){var e;const t=[];for(const i of this.asn){const a={};for(const o of i){const s=this.getName(o.type)||o.type;(e=a[s])!==null&&e!==void 0||(a[s]=[]),a[s].push(o.value.anyValue?`#${ie.Convert.ToHex(o.value.anyValue)}`:o.value.toString())}t.push(a)}return t}fromString(e){const t=new nt,i=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+"\\](?=[,+]|$))|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let a=null,o=",";for(;a=i.exec(`${e},`);){let[,s,n]=a;const p=n[n.length-1];(p===","||p==="+")&&(n=n.slice(0,n.length-1),a[3]=p);const f=a[3];s=this.getTypeOid(s);const E=this.createAttribute(s,n);o==="+"?t[t.length-1].push(E):t.push(new hi([E])),o=f}return t}fromJSON(e){const t=new nt;for(const i of e){const a=new hi;for(const o in i){const s=this.getTypeOid(o),n=i[o];for(const p of n){const f=this.createAttribute(s,p);a.push(f)}}t.push(a)}return t}getTypeOid(e){if(/[\d.]+/.test(e)||(e=this.getName(e)||""),!e)throw new Error(`Cannot get OID for name type '${e}'`);return e}createAttribute(e,t){const i=new fa({type:e});if(typeof t=="object")for(const a in t)switch(a){case"ia5String":i.value.ia5String=t[a];break;case"utf8String":i.value.utf8String=t[a];break;case"universalString":i.value.universalString=t[a];break;case"bmpString":i.value.bmpString=t[a];break;case"printableString":i.value.printableString=t[a];break}else if(t[0]==="#")i.value.anyValue=ie.Convert.FromHex(t.slice(1));else{const a=this.processStringValue(t);e===this.getName("E")||e===this.getName("DC")?i.value.ia5String=a:jt.isPrintableString(a)?i.value.printableString=a:i.value.utf8String=a}return i}processStringValue(e){const t=/"(.*?[^\\])?"/.exec(e);return t&&(e=t[1]),e.replace(/\\0a/ig,`
|
|
9
|
+
`).replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1")}toArrayBuffer(){return ye.serialize(this.asn)}async getThumbprint(...e){var t;let i,a="SHA-1";return e.length>=1&&!(!((t=e[0])===null||t===void 0)&&t.subtle)?(a=e[0]||a,i=e[1]||ht.get()):i=e[0]||ht.get(),await i.subtle.digest(a,this.toArrayBuffer())}}const F0="Cannot initialize GeneralName from ASN.1 data.",K0=`${F0} Unsupported string format in use.`,Gd=`${F0} Value doesn't match to GUID regular expression.`,j0=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,H0="1.3.6.1.4.1.311.25.1",q0="1.3.6.1.4.1.311.20.2.3",Ru="dns",Uu="dn",Lu="email",Ou="ip",Du="url",Pu="guid",Vu="upn",vs="id";class Or extends Ur{constructor(...e){let t;if(e.length===2)switch(e[0]){case Uu:{const i=new jt(e[1]).toArrayBuffer(),a=ye.parse(i,nt);t=new Ke({directoryName:a});break}case Ru:t=new Ke({dNSName:e[1]});break;case Lu:t=new Ke({rfc822Name:e[1]});break;case Pu:{const i=new RegExp(j0,"i").exec(e[1]);if(!i)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const a=i.slice(1).map((o,s)=>s<3?ie.Convert.ToHex(new Uint8Array(ie.Convert.FromHex(o)).reverse()):o).join("");t=new Ke({otherName:new Wi({typeId:H0,value:ye.serialize(new $e(ie.Convert.FromHex(a)))})});break}case Ou:t=new Ke({iPAddress:e[1]});break;case vs:t=new Ke({registeredID:e[1]});break;case Vu:{t=new Ke({otherName:new Wi({typeId:q0,value:ye.serialize(ql.toASN(e[1]))})});break}case Du:t=new Ke({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else ie.BufferSourceConverter.isBufferSource(e[0])?t=ye.parse(e[0],Ke):t=e[0];super(t)}onInit(e){if(e.dNSName!=null)this.type=Ru,this.value=e.dNSName;else if(e.rfc822Name!=null)this.type=Lu,this.value=e.rfc822Name;else if(e.iPAddress!=null)this.type=Ou,this.value=e.iPAddress;else if(e.uniformResourceIdentifier!=null)this.type=Du,this.value=e.uniformResourceIdentifier;else if(e.registeredID!=null)this.type=vs,this.value=e.registeredID;else if(e.directoryName!=null)this.type=Uu,this.value=new jt(e.directoryName).toString();else if(e.otherName!=null)if(e.otherName.typeId===H0){this.type=Pu;const t=ye.parse(e.otherName.value,$e),i=new RegExp(j0,"i").exec(ie.Convert.ToHex(t));if(!i)throw new Error(Gd);this.value=i.slice(1).map((a,o)=>o<3?ie.Convert.ToHex(new Uint8Array(ie.Convert.FromHex(a)).reverse()):a).join("-")}else if(e.otherName.typeId===q0)this.type=Vu,this.value=ye.parse(e.otherName.value,Bt).toString();else throw new Error(K0);else throw new Error(K0)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case Uu:case Ru:case Pu:case Ou:case vs:case Vu:case Du:e=this.type.toUpperCase();break;case Lu:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let t=this.value;return this.type===vs&&(t=Rr.toString(t)),new ze(e,void 0,t)}}class ni extends Ur{constructor(e){let t;if(e instanceof It)t=e;else if(Array.isArray(e)){const i=[];for(const a of e)if(a instanceof Ke)i.push(a);else{const o=ye.parse(new Or(a.type,a.value).rawData,Ke);i.push(o)}t=new It(i)}else if(ie.BufferSourceConverter.isBufferSource(e))t=ye.parse(e,It);else throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");super(t)}onInit(e){const t=[];for(const i of e){let a=null;try{a=new Or(i)}catch{continue}t.push(a)}this.items=t}toJSON(){return this.items.map(e=>e.toJSON())}toTextObject(){const e=super.toTextObjectEmpty();for(const t of this.items){const i=t.toTextObject();let a=e[i[ze.NAME]];Array.isArray(a)||(a=[],e[i[ze.NAME]]=a),a.push(i)}return e}}ni.NAME="GeneralNames";const mn="-{5}",Cn="\\n",$d=`[^${Cn}]+`,zd=`${mn}BEGIN (${$d}(?=${mn}))${mn}`,Wd=`${mn}END \\1${mn}`,Ri="\\n",Qd=`[^:${Cn}]+`,Yd=`(?:[^${Cn}]+${Ri}(?: +[^${Cn}]+${Ri})*)`,Xd=`(?:[a-zA-Z0-9=+/]+${Ri})+`,G0=`${zd}${Ri}(?:((?:${Qd}: ${Yd})+))?${Ri}?(${Xd})${Wd}`;class Ht{static isPem(e){return typeof e=="string"&&new RegExp(G0,"g").test(e.replace(/\r/g,""))}static decodeWithHeaders(e){e=e.replace(/\r/g,"");const t=new RegExp(G0,"g"),i=[];let a=null;for(;a=t.exec(e);){const o=a[3].replace(new RegExp(`[${Cn}]+`,"g"),""),s={type:a[1],headers:[],rawData:ie.Convert.FromBase64(o)},n=a[2];if(n){const p=n.split(new RegExp(Ri,"g"));let f=null;for(const E of p){const[I,B]=E.split(/:(.*)/);if(B===void 0){if(!f)throw new Error("Cannot parse PEM string. Incorrect header value");f.value+=I.trim()}else f&&s.headers.push(f),f={key:I,value:B.trim()}}f&&s.headers.push(f)}i.push(s)}return i}static decode(e){return this.decodeWithHeaders(e).map(i=>i.rawData)}static decodeFirst(e){const t=this.decode(e);if(!t.length)throw new RangeError("PEM string doesn't contain any objects");return t[0]}static encode(e,t){if(Array.isArray(e)){const i=new Array;return t?e.forEach(a=>{if(!ie.BufferSourceConverter.isBufferSource(a))throw new TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");i.push(this.encodeStruct({type:t,rawData:ie.BufferSourceConverter.toArrayBuffer(a)}))}):e.forEach(a=>{if(!("type"in a))throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");i.push(this.encodeStruct(a))}),i.join(`
|
|
10
|
+
`)}else{if(!t)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:t,rawData:ie.BufferSourceConverter.toArrayBuffer(e)})}}static encodeStruct(e){var t;const i=e.type.toLocaleUpperCase(),a=[];if(a.push(`-----BEGIN ${i}-----`),!((t=e.headers)===null||t===void 0)&&t.length){for(const f of e.headers)a.push(`${f.key}: ${f.value}`);a.push("")}const o=ie.Convert.ToBase64(e.rawData);let s,n=0;const p=Array();for(;n<o.length&&(o.length-n<64?s=o.substring(n):(s=o.substring(n,n+64),n+=64),s.length!==0);)if(p.push(s),s.length<64)break;return a.push(...p),a.push(`-----END ${i}-----`),a.join(`
|
|
11
|
+
`)}}Ht.CertificateTag="CERTIFICATE",Ht.CrlTag="CRL",Ht.CertificateRequestTag="CERTIFICATE REQUEST",Ht.PublicKeyTag="PUBLIC KEY",Ht.PrivateKeyTag="PRIVATE KEY";class br extends Ur{static isAsnEncoded(e){return ie.BufferSourceConverter.isBufferSource(e)||typeof e=="string"}static toArrayBuffer(e){if(typeof e=="string"){if(Ht.isPem(e))return Ht.decode(e)[0];if(ie.Convert.isHex(e))return ie.Convert.FromHex(e);if(ie.Convert.isBase64(e))return ie.Convert.FromBase64(e);if(ie.Convert.isBase64Url(e))return ie.Convert.FromBase64Url(e);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}else{const t=ie.BufferSourceConverter.toUint8Array(e);if(t.length>0&&t[0]===48)return ie.BufferSourceConverter.toArrayBuffer(e);const i=ie.Convert.ToBinary(e);if(Ht.isPem(i))return Ht.decode(i)[0];if(ie.Convert.isHex(i))return ie.Convert.FromHex(i);if(ie.Convert.isBase64(i))return ie.Convert.FromBase64(i);if(ie.Convert.isBase64Url(i))return ie.Convert.FromBase64Url(i);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}}constructor(...e){br.isAsnEncoded(e[0])?super(br.toArrayBuffer(e[0]),e[1]):super(e[0])}toString(e="pem"){switch(e){case"pem":return Ht.encode(this.rawData,this.tag);default:return super.toString(e)}}}class tr extends br{static async create(e,t=ht.get()){if(e instanceof tr)return e;if(Lr.isCryptoKey(e)){if(e.type!=="public")throw new TypeError("Public key is required");const i=await t.subtle.exportKey("spki",e);return new tr(i)}else{if(e.publicKey)return e.publicKey;if(ie.BufferSourceConverter.isBufferSource(e))return new tr(e);throw new TypeError("Unsupported PublicKeyType")}}constructor(e){br.isAsnEncoded(e)?super(e,zt):super(e),this.tag=Ht.PublicKeyTag}async export(...e){let t,i=["verify"],a={hash:"SHA-256",...this.algorithm};e.length>1?(a=e[0]||a,i=e[1]||i,t=e[2]||ht.get()):t=e[0]||ht.get();let o=this.rawData;const s=ye.parse(this.rawData,zt);return s.algorithm.algorithm===pn&&(o=Jd(s,o)),t.subtle.importKey("spki",o,a,!0,i)}onInit(e){const t=ft.resolve(_r),i=this.algorithm=t.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case Zr:{const a=ye.parse(e.subjectPublicKey,fu),o=ie.BufferSourceConverter.toUint8Array(a.modulus);i.publicExponent=ie.BufferSourceConverter.toUint8Array(a.publicExponent),i.modulusLength=(o[0]?o:o.slice(1)).byteLength<<3;break}}}async getThumbprint(...e){var t;let i,a="SHA-1";return e.length>=1&&!(!((t=e[0])===null||t===void 0)&&t.subtle)?(a=e[0]||a,i=e[1]||ht.get()):i=e[0]||ht.get(),await i.subtle.digest(a,this.rawData)}async getKeyIdentifier(...e){let t,i="SHA-1";e.length===1?typeof e[0]=="string"?(i=e[0],t=ht.get()):t=e[0]:e.length===2?(i=e[0],t=e[1]):t=ht.get();const a=ye.parse(this.rawData,zt);return await t.subtle.digest(i,a.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),t=ye.parse(this.rawData,zt);switch(e.Algorithm=ii.serializeAlgorithm(t.algorithm),t.algorithm.algorithm){case ln:e["EC Point"]=t.subjectPublicKey;break;case Zr:default:e["Raw Data"]=t.subjectPublicKey}return e}}function Jd(r,e){return r.algorithm=new Ae({algorithm:Zr,parameters:null}),e=ye.serialize(r),e}class xn extends Kt{static async create(e,t=!1,i=ht.get()){if("name"in e&&"serialNumber"in e)return new xn(e,t);const o=await(await tr.create(e,i)).getKeyIdentifier(i);return new xn(ie.Convert.ToHex(o),t)}constructor(...e){if(ie.BufferSourceConverter.isBufferSource(e[0]))super(e[0]);else if(typeof e[0]=="string"){const t=new $r({keyIdentifier:new so(ie.Convert.FromHex(e[0]))});super(ao,e[1],ye.serialize(t))}else{const t=e[0],i=t.name instanceof ni?ye.parse(t.name.rawData,It):t.name,a=new $r({authorityCertIssuer:i,authorityCertSerialNumber:ie.Convert.FromHex(t.serialNumber)});super(ao,e[1],ye.serialize(a))}}onInit(e){super.onInit(e);const t=ye.parse(e.extnValue,$r);t.keyIdentifier&&(this.keyId=ie.Convert.ToHex(t.keyIdentifier)),(t.authorityCertIssuer||t.authorityCertSerialNumber)&&(this.certId={name:t.authorityCertIssuer||[],serialNumber:t.authorityCertSerialNumber?ie.Convert.ToHex(t.authorityCertSerialNumber):""})}toTextObject(){const e=this.toTextObjectWithoutValue(),t=ye.parse(this.value,$r);return t.authorityCertIssuer&&(e["Authority Issuer"]=new ni(t.authorityCertIssuer).toTextObject()),t.authorityCertSerialNumber&&(e["Authority Serial Number"]=t.authorityCertSerialNumber),t.keyIdentifier&&(e[""]=t.keyIdentifier),e}}xn.NAME="Authority Key Identifier";class Mu extends Kt{constructor(...e){if(ie.BufferSourceConverter.isBufferSource(e[0])){super(e[0]);const t=ye.parse(this.value,pa);this.ca=t.cA,this.pathLength=t.pathLenConstraint}else{const t=new pa({cA:e[0],pathLenConstraint:e[1]});super(Xl,e[2],ye.serialize(t)),this.ca=e[0],this.pathLength=e[1]}}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ca&&(e.CA=this.ca),this.pathLength!==void 0&&(e["Path Length"]=this.pathLength),e}}Mu.NAME="Basic Constraints";var $0;(function(r){r.serverAuth="1.3.6.1.5.5.7.3.1",r.clientAuth="1.3.6.1.5.5.7.3.2",r.codeSigning="1.3.6.1.5.5.7.3.3",r.emailProtection="1.3.6.1.5.5.7.3.4",r.timeStamping="1.3.6.1.5.5.7.3.8",r.ocspSigning="1.3.6.1.5.5.7.3.9"})($0||($0={}));class Fu extends Kt{constructor(...e){if(ie.BufferSourceConverter.isBufferSource(e[0])){super(e[0]);const t=ye.parse(this.value,ma);this.usages=t.map(i=>i)}else{const t=new ma(e[0]);super(nf,e[1],ye.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(t=>Rr.toString(t)).join(", "),e}}Fu.NAME="Extended Key Usages";var Ui;(function(r){r[r.digitalSignature=1]="digitalSignature",r[r.nonRepudiation=2]="nonRepudiation",r[r.keyEncipherment=4]="keyEncipherment",r[r.dataEncipherment=8]="dataEncipherment",r[r.keyAgreement=16]="keyAgreement",r[r.keyCertSign=32]="keyCertSign",r[r.cRLSign=64]="cRLSign",r[r.encipherOnly=128]="encipherOnly",r[r.decipherOnly=256]="decipherOnly"})(Ui||(Ui={}));class gs extends Kt{constructor(...e){if(ie.BufferSourceConverter.isBufferSource(e[0])){super(e[0]);const t=ye.parse(this.value,Eo);this.usages=t.toNumber()}else{const t=new Eo(e[0]);super(of,e[1],ye.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=ye.parse(this.value,Eo);return e[""]=t.toJSON().join(", "),e}}gs.NAME="Key Usages";class Sn extends Kt{static async create(e,t=!1,i=ht.get()){const o=await(await tr.create(e,i)).getKeyIdentifier(i);return new Sn(ie.Convert.ToHex(o),t)}constructor(...e){if(ie.BufferSourceConverter.isBufferSource(e[0])){super(e[0]);const t=ye.parse(this.value,Tr);this.keyId=ie.Convert.ToHex(t)}else{const t=typeof e[0]=="string"?ie.Convert.FromHex(e[0]):e[0],i=new Tr(t);super(pf,e[1],ye.serialize(i)),this.keyId=ie.Convert.ToHex(t)}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=ye.parse(this.value,Tr);return e[""]=t,e}}Sn.NAME="Subject Key Identifier";class Ku extends Kt{constructor(...e){ie.BufferSourceConverter.isBufferSource(e[0])?super(e[0]):super(ff,e[1],new ni(e[0]||[]).rawData)}onInit(e){super.onInit(e);const t=ye.parse(e.extnValue,Io);this.names=new ni(t)}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.names.toTextObject();for(const i in t)e[i]=t[i];return e}}Ku.NAME="Subject Alternative Name";class qt{static register(e,t){this.items.set(e,t)}static create(e){const t=new Kt(e),i=this.items.get(t.type);return i?new i(e):t}}qt.items=new Map;class z0 extends Kt{constructor(...e){var t;if(ie.BufferSourceConverter.isBufferSource(e[0])){super(e[0]);const i=ye.parse(this.value,va);this.policies=i.map(a=>a.policyIdentifier)}else{const i=e[0],a=(t=e[1])!==null&&t!==void 0?t:!1,o=new va(i.map(s=>new ya({policyIdentifier:s})));super(Zl,a,ye.serialize(o)),this.policies=i}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(t=>new ze("",{},Rr.toString(t))),e}}z0.NAME="Certificate Policies",qt.register(Zl,z0);class W0 extends Kt{constructor(...e){var t;if(ie.BufferSourceConverter.isBufferSource(e[0]))super(e[0]);else if(Array.isArray(e[0])&&typeof e[0][0]=="string"){const a=e[0].map(s=>new yi({distributionPoint:new zr({fullName:[new Ke({uniformResourceIdentifier:s})]})})),o=new vi(a);super(yo,e[1],ye.serialize(o))}else{const i=new vi(e[0]);super(yo,e[1],ye.serialize(i))}(t=this.distributionPoints)!==null&&t!==void 0||(this.distributionPoints=[])}onInit(e){super.onInit(e);const t=ye.parse(e.extnValue,vi);this.distributionPoints=t}toTextObject(){const e=this.toTextObjectWithoutValue();return e["Distribution Point"]=this.distributionPoints.map(t=>{var i;const a={};return t.distributionPoint&&(a[""]=(i=t.distributionPoint.fullName)===null||i===void 0?void 0:i.map(o=>new Or(o).toString()).join(", ")),t.reasons&&(a.Reasons=t.reasons.toString()),t.cRLIssuer&&(a["CRL Issuer"]=t.cRLIssuer.map(o=>o.toString()).join(", ")),a}),e}}W0.NAME="CRL Distribution Points";class Q0 extends Kt{constructor(...e){var t,i,a,o;if(ie.BufferSourceConverter.isBufferSource(e[0]))super(e[0]);else if(e[0]instanceof di){const s=new di(e[0]);super(no,e[1],ye.serialize(s))}else{const s=e[0],n=new di;Cs(n,s,zl,"ocsp"),Cs(n,s,Wl,"caIssuers"),Cs(n,s,Ql,"timeStamping"),Cs(n,s,Yl,"caRepository"),super(no,e[1],ye.serialize(n))}(t=this.ocsp)!==null&&t!==void 0||(this.ocsp=[]),(i=this.caIssuers)!==null&&i!==void 0||(this.caIssuers=[]),(a=this.timeStamping)!==null&&a!==void 0||(this.timeStamping=[]),(o=this.caRepository)!==null&&o!==void 0||(this.caRepository=[])}onInit(e){super.onInit(e),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[],ye.parse(e.extnValue,di).forEach(i=>{switch(i.accessMethod){case zl:this.ocsp.push(new Or(i.accessLocation));break;case Wl:this.caIssuers.push(new Or(i.accessLocation));break;case Ql:this.timeStamping.push(new Or(i.accessLocation));break;case Yl:this.caRepository.push(new Or(i.accessLocation));break}})}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ocsp.length&&ms(e,"OCSP",this.ocsp),this.caIssuers.length&&ms(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&ms(e,"Time Stamping",this.timeStamping),this.caRepository.length&&ms(e,"CA Repository",this.caRepository),e}}Q0.NAME="Authority Info Access";function ms(r,e,t){if(t.length===1)r[e]=t[0].toTextObject();else{const i=new ze("");t.forEach((a,o)=>{const s=a.toTextObject(),n=`${s[ze.NAME]} ${o+1}`;let p=i[n];Array.isArray(p)||(p=[],i[n]=p),p.push(s)}),r[e]=i}}function Cs(r,e,t,i){const a=e[i];a&&(Array.isArray(a)?a:[a]).forEach(s=>{typeof s=="string"&&(s=new Or("url",s)),r.push(new Qi({accessMethod:t,accessLocation:ye.parse(s.rawData,Ke)}))})}class Y0 extends Kt{constructor(...e){ie.BufferSourceConverter.isBufferSource(e[0])?super(e[0]):super(af,e[1],new ni(e[0]||[]).rawData)}onInit(e){super.onInit(e);const t=ye.parse(e.extnValue,It);this.names=new ni(t)}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.names.toTextObject();for(const i in t)e[i]=t[i];return e}}Y0.NAME="Issuer Alternative Name";class Li extends Ur{constructor(...e){let t;if(ie.BufferSourceConverter.isBufferSource(e[0]))t=ie.BufferSourceConverter.toArrayBuffer(e[0]);else{const i=e[0],a=Array.isArray(e[1])?e[1].map(o=>ie.BufferSourceConverter.toArrayBuffer(o)):[];t=ye.serialize(new Zt({type:i,values:a}))}super(t,Zt)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Value=this.values.map(t=>new ze("",{"":t})),e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty();return e[ze.NAME]===Li.NAME&&(e[ze.NAME]=Rr.toString(this.type)),e}}Li.NAME="Attribute";class X0 extends Li{constructor(...e){var t;if(ie.BufferSourceConverter.isBufferSource(e[0]))super(e[0]);else{const i=new ps({printableString:e[0]});super(Wf,[ye.serialize(i)])}(t=this.password)!==null&&t!==void 0||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){const t=ye.parse(this.values[0],ps);this.password=t.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[ze.VALUE]=this.password,e}}X0.NAME="Challenge Password";class ju extends Li{constructor(...e){var t;if(ie.BufferSourceConverter.isBufferSource(e[0]))super(e[0]);else{const i=e[0],a=new Cr;for(const o of i)a.push(ye.parse(o.rawData,Mt));super(ls,[ye.serialize(a)])}(t=this.items)!==null&&t!==void 0||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){const t=ye.parse(this.values[0],Cr);this.items=t.map(i=>qt.create(ye.serialize(i)))}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.items.map(i=>i.toTextObject());for(const i of t)e[i[ze.NAME]]=i;return e}}ju.NAME="Extensions";class xs{static register(e,t){this.items.set(e,t)}static create(e){const t=new Li(e),i=this.items.get(t.type);return i?new i(e):t}}xs.items=new Map;const Oi="crypto.signatureFormatter";class Zd{toAsnSignature(e,t){return ie.BufferSourceConverter.toArrayBuffer(t)}toWebSignature(e,t){return ie.BufferSourceConverter.toArrayBuffer(t)}}var Ss;let Hu=Ss=class{static createPssParams(e,t){const i=Ss.getHashAlgorithm(e);return i?new ti({hashAlgorithm:i,maskGenAlgorithm:new Ae({algorithm:Ja,parameters:ye.serialize(i)}),saltLength:t}):null}static getHashAlgorithm(e){const t=ft.resolve(_r);return typeof e=="string"?t.toAsnAlgorithm({name:e}):typeof e=="object"&&e&&"name"in e?t.toAsnAlgorithm(e):null}toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if("hash"in e){let t;if(typeof e.hash=="string")t=e.hash;else if(e.hash&&typeof e.hash=="object"&&"name"in e.hash&&typeof e.hash.name=="string")t=e.hash.name.toUpperCase();else throw new Error("Cannot get hash algorithm name");switch(t.toLowerCase()){case"sha-1":return new Ae({algorithm:Ga,parameters:null});case"sha-256":return new Ae({algorithm:uu,parameters:null});case"sha-384":return new Ae({algorithm:$a,parameters:null});case"sha-512":return new Ae({algorithm:za,parameters:null})}}else return new Ae({algorithm:Zr,parameters:null});break;case"rsa-pss":if("hash"in e){if(!("saltLength"in e&&typeof e.saltLength=="number"))throw new Error("Cannot get 'saltLength' from 'alg' argument");const t=Ss.createPssParams(e.hash,e.saltLength);if(!t)throw new Error("Cannot create PSS parameters");return new Ae({algorithm:pn,parameters:ye.serialize(t)})}else return new Ae({algorithm:pn,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case Zr:return{name:"RSASSA-PKCS1-v1_5"};case Ga:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case uu:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case $a:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case za:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case pn:if(e.parameters){const t=ye.parse(e.parameters,ti);return{name:"RSA-PSS",hash:ft.resolve(_r).toWebAlgorithm(t.hashAlgorithm),saltLength:t.saltLength}}else return{name:"RSA-PSS"}}return null}};Hu=Ss=w([as()],Hu),ft.registerSingleton(vn,Hu);let qu=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new Ae({algorithm:Wa});case"sha-256":return new Ae({algorithm:Qa});case"sha-384":return new Ae({algorithm:Ya});case"sha-512":return new Ae({algorithm:Xa})}return null}toWebAlgorithm(e){switch(e.algorithm){case Wa:return{name:"SHA-1"};case Qa:return{name:"SHA-256"};case Ya:return{name:"SHA-384"};case Xa:return{name:"SHA-512"}}return null}};qu=w([as()],qu),ft.registerSingleton(vn,qu);class Wt{addPadding(e,t){const i=ie.BufferSourceConverter.toUint8Array(t),a=new Uint8Array(e);return a.set(i,e-i.length),a.buffer}removePadding(e,t=!1){let i=ie.BufferSourceConverter.toUint8Array(e);for(let a=0;a<i.length;a++)if(i[a]){i=i.slice(a);break}if(t&&i[0]>127){const a=new Uint8Array(i.length+1);return a.set(i,1),a.buffer}return i.buffer}toAsnSignature(e,t){if(e.name==="ECDSA"){const i=e.namedCurve,a=Wt.namedCurveSize.get(i)||Wt.defaultNamedCurveSize,o=new qa,s=ie.BufferSourceConverter.toUint8Array(t);return o.r=this.removePadding(s.slice(0,a),!0),o.s=this.removePadding(s.slice(a,a+a),!0),ye.serialize(o)}return null}toWebSignature(e,t){if(e.name==="ECDSA"){const i=ye.parse(t,qa),a=e.namedCurve,o=Wt.namedCurveSize.get(a)||Wt.defaultNamedCurveSize,s=this.addPadding(o,this.removePadding(i.r)),n=this.addPadding(o,this.removePadding(i.s));return ie.combine(s,n)}return null}}Wt.namedCurveSize=new Map,Wt.defaultNamedCurveSize=32;const Gu="1.3.101.110",J0="1.3.101.111",$u="1.3.101.112",Z0="1.3.101.113";let zu=class{toAsnAlgorithm(e){let t=null;switch(e.name.toLowerCase()){case"ed25519":t=$u;break;case"x25519":t=Gu;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":t=$u;break;case"ed448":t=Z0;break}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":t=Gu;break;case"x448":t=J0;break}}return t?new Ae({algorithm:t}):null}toWebAlgorithm(e){switch(e.algorithm){case $u:return{name:"Ed25519"};case Z0:return{name:"EdDSA",namedCurve:"Ed448"};case Gu:return{name:"X25519"};case J0:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};zu=w([as()],zu),ft.registerSingleton(vn,zu);var En,bn,An,Bn,wn,In,Tn,Di;class eh extends br{get subjectName(){return je(this,bn,"f")||rt(this,bn,new jt(this.asn.certificationRequestInfo.subject),"f"),je(this,bn,"f")}get subject(){return je(this,An,"f")||rt(this,An,this.subjectName.toString(),"f"),je(this,An,"f")}get signatureAlgorithm(){if(!je(this,Bn,"f")){const e=ft.resolve(_r);rt(this,Bn,e.toWebAlgorithm(this.asn.signatureAlgorithm),"f")}return je(this,Bn,"f")}get signature(){return je(this,wn,"f")||rt(this,wn,this.asn.signature,"f"),je(this,wn,"f")}get publicKey(){return je(this,In,"f")||rt(this,In,new tr(this.asn.certificationRequestInfo.subjectPKInfo),"f"),je(this,In,"f")}get attributes(){return je(this,Tn,"f")||rt(this,Tn,this.asn.certificationRequestInfo.attributes.map(e=>xs.create(ye.serialize(e))),"f"),je(this,Tn,"f")}get extensions(){if(!je(this,Di,"f")){rt(this,Di,[],"f");const e=this.getAttribute(ls);e instanceof ju&&rt(this,Di,e.items,"f")}return je(this,Di,"f")}get tbs(){return je(this,En,"f")||rt(this,En,this.asn.certificationRequestInfoRaw||ye.serialize(this.asn.certificationRequestInfo),"f"),je(this,En,"f")}constructor(e){const t=br.isAsnEncoded(e)?[e,ki]:[e];super(t[0],t[1]),En.set(this,void 0),bn.set(this,void 0),An.set(this,void 0),Bn.set(this,void 0),wn.set(this,void 0),In.set(this,void 0),Tn.set(this,void 0),Di.set(this,void 0),this.tag=Ht.CertificateRequestTag}onInit(e){}getAttribute(e){for(const t of this.attributes)if(t.type===e)return t;return null}getAttributes(e){return this.attributes.filter(t=>t.type===e)}getExtension(e){for(const t of this.extensions)if(t.type===e)return t;return null}getExtensions(e){return this.extensions.filter(t=>t.type===e)}async verify(e=ht.get()){const t={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(t,["verify"],e),a=ft.resolveAll(Oi).reverse();let o=null;for(const n of a)if(o=n.toWebSignature(t,this.signature),o)break;if(!o)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await e.subtle.verify(this.signatureAlgorithm,i,o,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),t=ye.parse(this.rawData,ki),i=t.certificationRequestInfo,a=new ze("",{Version:`${Wr[i.version]} (${i.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const o=new ze("");for(const s of this.attributes){const n=s.toTextObject();o[n[ze.NAME]]=n}a.Attributes=o}return e.Data=a,e.Signature=new ze("",{Algorithm:ii.serializeAlgorithm(t.signatureAlgorithm),"":t.signature}),e}}En=new WeakMap,bn=new WeakMap,An=new WeakMap,Bn=new WeakMap,wn=new WeakMap,In=new WeakMap,Tn=new WeakMap,Di=new WeakMap,eh.NAME="PKCS#10 Certificate Request";class ey{static async create(e,t=ht.get()){if(!e.keys.privateKey)throw new Error("Bad field 'keys' in 'params' argument. 'privateKey' is empty");if(!e.keys.publicKey)throw new Error("Bad field 'keys' in 'params' argument. 'publicKey' is empty");const i=await t.subtle.exportKey("spki",e.keys.publicKey),a=new ki({certificationRequestInfo:new ri({subjectPKInfo:ye.parse(i,zt)})});if(e.name){const I=e.name instanceof jt?e.name:new jt(e.name);a.certificationRequestInfo.subject=ye.parse(I.toArrayBuffer(),nt)}if(e.attributes)for(const I of e.attributes)a.certificationRequestInfo.attributes.push(ye.parse(I.rawData,Zt));if(e.extensions&&e.extensions.length){const I=new Zt({type:ls}),B=new Cr;for(const l of e.extensions)B.push(ye.parse(l.rawData,Mt));I.values.push(ye.serialize(B)),a.certificationRequestInfo.attributes.push(I)}const o={...e.signingAlgorithm,...e.keys.privateKey.algorithm},s=ft.resolve(_r);a.signatureAlgorithm=s.toAsnAlgorithm(o);const n=ye.serialize(a.certificationRequestInfo),p=await t.subtle.sign(o,e.keys.privateKey,n),f=ft.resolveAll(Oi).reverse();let E=null;for(const I of f)if(E=I.toAsnSignature(o,p),E)break;if(!E)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return a.signature=E,new eh(ye.serialize(a))}}var Nn,kn,_n,Rn,Un,Ln,On,Dn,Pn,Vn,Pi,Mn;class th extends br{get publicKey(){return je(this,Mn,"f")||rt(this,Mn,new tr(this.asn.tbsCertificate.subjectPublicKeyInfo),"f"),je(this,Mn,"f")}get serialNumber(){if(!je(this,kn,"f")){const e=this.asn.tbsCertificate;let t=new Uint8Array(e.serialNumber);t.length>1&&t[0]===0&&t[1]>127&&(t=t.slice(1)),rt(this,kn,ie.Convert.ToHex(t),"f")}return je(this,kn,"f")}get subjectName(){return je(this,_n,"f")||rt(this,_n,new jt(this.asn.tbsCertificate.subject),"f"),je(this,_n,"f")}get subject(){return je(this,Rn,"f")||rt(this,Rn,this.subjectName.toString(),"f"),je(this,Rn,"f")}get issuerName(){return je(this,Un,"f")||rt(this,Un,new jt(this.asn.tbsCertificate.issuer),"f"),je(this,Un,"f")}get issuer(){return je(this,Ln,"f")||rt(this,Ln,this.issuerName.toString(),"f"),je(this,Ln,"f")}get notBefore(){if(!je(this,On,"f")){const e=this.asn.tbsCertificate.validity.notBefore.utcTime||this.asn.tbsCertificate.validity.notBefore.generalTime;if(!e)throw new Error("Cannot get 'notBefore' value");rt(this,On,e,"f")}return je(this,On,"f")}get notAfter(){if(!je(this,Dn,"f")){const e=this.asn.tbsCertificate.validity.notAfter.utcTime||this.asn.tbsCertificate.validity.notAfter.generalTime;if(!e)throw new Error("Cannot get 'notAfter' value");rt(this,Dn,e,"f")}return je(this,Dn,"f")}get signatureAlgorithm(){if(!je(this,Pn,"f")){const e=ft.resolve(_r);rt(this,Pn,e.toWebAlgorithm(this.asn.signatureAlgorithm),"f")}return je(this,Pn,"f")}get signature(){return je(this,Vn,"f")||rt(this,Vn,this.asn.signatureValue,"f"),je(this,Vn,"f")}get extensions(){return je(this,Pi,"f")||(rt(this,Pi,[],"f"),this.asn.tbsCertificate.extensions&&rt(this,Pi,this.asn.tbsCertificate.extensions.map(e=>qt.create(ye.serialize(e))),"f")),je(this,Pi,"f")}get tbs(){return je(this,Nn,"f")||rt(this,Nn,this.asn.tbsCertificateRaw||ye.serialize(this.asn.tbsCertificate),"f"),je(this,Nn,"f")}constructor(e){const t=br.isAsnEncoded(e)?[e,Qr]:[e];super(t[0],t[1]),Nn.set(this,void 0),kn.set(this,void 0),_n.set(this,void 0),Rn.set(this,void 0),Un.set(this,void 0),Ln.set(this,void 0),On.set(this,void 0),Dn.set(this,void 0),Pn.set(this,void 0),Vn.set(this,void 0),Pi.set(this,void 0),Mn.set(this,void 0),this.tag=Ht.CertificateTag}onInit(e){}getExtension(e){for(const t of this.extensions)if(typeof e=="string"){if(t.type===e)return t}else if(t instanceof e)return t;return null}getExtensions(e){return this.extensions.filter(t=>typeof e=="string"?t.type===e:t instanceof e)}async verify(e={},t=ht.get()){let i,a;const o=e.publicKey;try{if(!o)i={...this.publicKey.algorithm,...this.signatureAlgorithm},a=await this.publicKey.export(i,["verify"],t);else if("publicKey"in o)i={...o.publicKey.algorithm,...this.signatureAlgorithm},a=await o.publicKey.export(i,["verify"],t);else if(o instanceof tr)i={...o.algorithm,...this.signatureAlgorithm},a=await o.export(i,["verify"],t);else if(ie.BufferSourceConverter.isBufferSource(o)){const f=new tr(o);i={...f.algorithm,...this.signatureAlgorithm},a=await f.export(i,["verify"],t)}else i={...o.algorithm,...this.signatureAlgorithm},a=o}catch{return!1}const s=ft.resolveAll(Oi).reverse();let n=null;for(const f of s)if(n=f.toWebSignature(i,this.signature),n)break;if(!n)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const p=await t.subtle.verify(this.signatureAlgorithm,a,n,this.tbs);if(e.signatureOnly)return p;{const E=(e.date||new Date).getTime();return p&&this.notBefore.getTime()<E&&E<this.notAfter.getTime()}}async getThumbprint(...e){let t,i="SHA-1";return e[0]&&(e[0].subtle?t=e[0]:(i=e[0]||i,t=e[1])),t??(t=ht.get()),await t.subtle.digest(i,this.rawData)}async isSelfSigned(e=ht.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){const e=this.toTextObjectEmpty(),t=ye.parse(this.rawData,Qr),i=t.tbsCertificate,a=new ze("",{Version:`${Wr[i.version]} (${i.version})`,"Serial Number":i.serialNumber,"Signature Algorithm":ii.serializeAlgorithm(i.signature),Issuer:this.issuer,Validity:new ze("",{"Not Before":i.validity.notBefore.getTime(),"Not After":i.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(i.issuerUniqueID&&(a["Issuer Unique ID"]=i.issuerUniqueID),i.subjectUniqueID&&(a["Subject Unique ID"]=i.subjectUniqueID),this.extensions.length){const o=new ze("");for(const s of this.extensions){const n=s.toTextObject();o[n[ze.NAME]]=n}a.Extensions=o}return e.Data=a,e.Signature=new ze("",{Algorithm:ii.serializeAlgorithm(t.signatureAlgorithm),"":t.signatureValue}),e}}Nn=new WeakMap,kn=new WeakMap,_n=new WeakMap,Rn=new WeakMap,Un=new WeakMap,Ln=new WeakMap,On=new WeakMap,Dn=new WeakMap,Pn=new WeakMap,Vn=new WeakMap,Pi=new WeakMap,Mn=new WeakMap,th.NAME="Certificate";function ty(r,e=ht.get()){const t=ie.BufferSourceConverter.toUint8Array(ie.Convert.FromHex(r||""));let i=t&&t.length&&t.some(o=>o>0)?new Uint8Array(t):void 0;i||(i=e.getRandomValues(new Uint8Array(16)));let a=0;for(;a<i.length-1&&i[a]===0;)a++;if(i=i.slice(a),i[0]>127){const o=new Uint8Array(i.length+1);o[0]=0,o.set(i,1),i=o}return i.buffer}class ry{static async createSelfSigned(e,t=ht.get()){if(!e.keys.privateKey)throw new Error("Bad field 'keys' in 'params' argument. 'privateKey' is empty");if(!e.keys.publicKey)throw new Error("Bad field 'keys' in 'params' argument. 'publicKey' is empty");return this.create({serialNumber:e.serialNumber,subject:e.name,issuer:e.name,notBefore:e.notBefore,notAfter:e.notAfter,publicKey:e.keys.publicKey,signingKey:e.keys.privateKey,signingAlgorithm:e.signingAlgorithm,extensions:e.extensions},t)}static async create(e,t=ht.get()){var i;let a;e.publicKey instanceof tr?a=e.publicKey.rawData:"publicKey"in e.publicKey?a=e.publicKey.publicKey.rawData:ie.BufferSourceConverter.isBufferSource(e.publicKey)?a=e.publicKey:a=await t.subtle.exportKey("spki",e.publicKey);const o=ty(e.serialNumber,t),s=e.notBefore||new Date,n=e.notAfter||new Date(s.getTime()+31536e6),p=new Qr({tbsCertificate:new Ft({version:Wr.v3,serialNumber:o,validity:new Ji({notBefore:s,notAfter:n}),extensions:new Cr(((i=e.extensions)===null||i===void 0?void 0:i.map(x=>ye.parse(x.rawData,Mt)))||[]),subjectPublicKeyInfo:ye.parse(a,zt)})});if(e.subject){const x=e.subject instanceof jt?e.subject:new jt(e.subject);p.tbsCertificate.subject=ye.parse(x.toArrayBuffer(),nt)}if(e.issuer){const x=e.issuer instanceof jt?e.issuer:new jt(e.issuer);p.tbsCertificate.issuer=ye.parse(x.toArrayBuffer(),nt)}const f={hash:"SHA-256"},E="signingKey"in e?{...f,...e.signingAlgorithm,...e.signingKey.algorithm}:{...f,...e.signingAlgorithm},I=ft.resolve(_r);p.tbsCertificate.signature=p.signatureAlgorithm=I.toAsnAlgorithm(E);const B=ye.serialize(p.tbsCertificate),l="signingKey"in e?await t.subtle.sign(E,e.signingKey,B):e.signature,y=ft.resolveAll(Oi).reverse();let S=null;for(const x of y)if(S=x.toAsnSignature(E,l),S)break;if(!S)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return p.signatureValue=S,new th(ye.serialize(p))}}var rh;(function(r){r[r.unspecified=0]="unspecified",r[r.keyCompromise=1]="keyCompromise",r[r.cACompromise=2]="cACompromise",r[r.affiliationChanged=3]="affiliationChanged",r[r.superseded=4]="superseded",r[r.cessationOfOperation=5]="cessationOfOperation",r[r.certificateHold=6]="certificateHold",r[r.removeFromCRL=8]="removeFromCRL",r[r.privilegeWithdrawn=9]="privilegeWithdrawn",r[r.aACompromise=10]="aACompromise"})(rh||(rh={})),qt.register(Xl,Mu),qt.register(nf,Fu),qt.register(of,gs),qt.register(pf,Sn),qt.register(ao,xn),qt.register(ff,Ku),qt.register(yo,W0),qt.register(no,Q0),qt.register(af,Y0),xs.register(Wf,X0),xs.register(ls,ju),ft.registerSingleton(Oi,Zd),ft.registerSingleton(Oi,Wt),Wt.namedCurveSize.set("P-256",32),Wt.namedCurveSize.set("K-256",32),Wt.namedCurveSize.set("P-384",48),Wt.namedCurveSize.set("P-521",66);async function iy({keys:r,algorithm:e,commonName:t,subjectAltNames:i}){const a=["dns","dn","email","ip","url","guid","upn","id"],o=[];for(const n of i){const p=()=>{throw TypeError("Invalid subject alternative name: "+n+". Does not contain one of the supported prefixes: "+JSON.stringify(a)+".")},f=n.indexOf(":");f===-1&&p();const E=n.substring(0,f),I=n.substring(f+1);a.indexOf(E)===-1&&p(),o.push({type:E,value:I})}return(await ey.create({name:[{CN:[t]}],keys:r,signingAlgorithm:e,extensions:[new gs(Ui.digitalSignature|Ui.keyEncipherment),new Ku(o)],attributes:[]})).toString("pem")}var Wu,ih;function Ge(){return ih||(ih=1,Wu={options:{usePureJavaScript:!1}}),Wu}var Qu={exports:{}},Yu,nh;function ny(){if(nh)return Yu;nh=1;var r={};Yu=r;var e={};r.encode=function(i,a,o){if(typeof a!="string")throw new TypeError('"alphabet" must be a string.');if(o!==void 0&&typeof o!="number")throw new TypeError('"maxline" must be a number.');var s="";if(!(i instanceof Uint8Array))s=t(i,a);else{var n=0,p=a.length,f=a.charAt(0),E=[0];for(n=0;n<i.length;++n){for(var I=0,B=i[n];I<E.length;++I)B+=E[I]<<8,E[I]=B%p,B=B/p|0;for(;B>0;)E.push(B%p),B=B/p|0}for(n=0;i[n]===0&&n<i.length-1;++n)s+=f;for(n=E.length-1;n>=0;--n)s+=a[E[n]]}if(o){var l=new RegExp(".{1,"+o+"}","g");s=s.match(l).join(`\r
|
|
12
|
+
`)}return s},r.decode=function(i,a){if(typeof i!="string")throw new TypeError('"input" must be a string.');if(typeof a!="string")throw new TypeError('"alphabet" must be a string.');var o=e[a];if(!o){o=e[a]=[];for(var s=0;s<a.length;++s)o[a.charCodeAt(s)]=s}i=i.replace(/\s/g,"");for(var n=a.length,p=a.charAt(0),f=[0],s=0;s<i.length;s++){var E=o[i.charCodeAt(s)];if(E===void 0)return;for(var I=0,B=E;I<f.length;++I)B+=f[I]*n,f[I]=B&255,B>>=8;for(;B>0;)f.push(B&255),B>>=8}for(var l=0;i[l]===p&&l<i.length-1;++l)f.push(0);return typeof Buffer<"u"?Buffer.from(f.reverse()):new Uint8Array(f.reverse())};function t(i,a){var o=0,s=a.length,n=a.charAt(0),p=[0];for(o=0;o<i.length();++o){for(var f=0,E=i.at(o);f<p.length;++f)E+=p[f]<<8,p[f]=E%s,E=E/s|0;for(;E>0;)p.push(E%s),E=E/s|0}var I="";for(o=0;i.at(o)===0&&o<i.length()-1;++o)I+=n;for(o=p.length-1;o>=0;--o)I+=a[p[o]];return I}return Yu}var ah;function We(){if(ah)return Qu.exports;ah=1;var r=Ge(),e=ny(),t=Qu.exports=r.util=r.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){t.nextTick=process.nextTick,typeof setImmediate=="function"?t.setImmediate=setImmediate:t.setImmediate=t.nextTick;return}if(typeof setImmediate=="function"){t.setImmediate=function(){return setImmediate.apply(void 0,arguments)},t.nextTick=function(h){return setImmediate(h)};return}if(t.setImmediate=function(h){setTimeout(h,0)},typeof window<"u"&&typeof window.postMessage=="function"){let h=function(u){if(u.source===window&&u.data===c){u.stopPropagation();var _=m.slice();m.length=0,_.forEach(function(M){M()})}};var c="forge.setImmediate",m=[];t.setImmediate=function(u){m.push(u),m.length===1&&window.postMessage(c,"*")},window.addEventListener("message",h,!0)}if(typeof MutationObserver<"u"){var A=Date.now(),N=!0,O=document.createElement("div"),m=[];new MutationObserver(function(){var u=m.slice();m.length=0,u.forEach(function(_){_()})}).observe(O,{attributes:!0});var C=t.setImmediate;t.setImmediate=function(u){Date.now()-A>15?(A=Date.now(),C(u)):(m.push(u),m.length===1&&O.setAttribute("a",N=!N))}}t.nextTick=t.setImmediate})(),t.isNodejs=typeof process<"u"&&process.versions&&process.versions.node,t.globalScope=(function(){return t.isNodejs?_s:typeof self>"u"?window:self})(),t.isArray=Array.isArray||function(c){return Object.prototype.toString.call(c)==="[object Array]"},t.isArrayBuffer=function(c){return typeof ArrayBuffer<"u"&&c instanceof ArrayBuffer},t.isArrayBufferView=function(c){return c&&t.isArrayBuffer(c.buffer)&&c.byteLength!==void 0};function i(c){if(!(c===8||c===16||c===24||c===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+c)}t.ByteBuffer=a;function a(c){if(this.data="",this.read=0,typeof c=="string")this.data=c;else if(t.isArrayBuffer(c)||t.isArrayBufferView(c))if(typeof Buffer<"u"&&c instanceof Buffer)this.data=c.toString("binary");else{var m=new Uint8Array(c);try{this.data=String.fromCharCode.apply(null,m)}catch{for(var A=0;A<m.length;++A)this.putByte(m[A])}}else(c instanceof a||typeof c=="object"&&typeof c.data=="string"&&typeof c.read=="number")&&(this.data=c.data,this.read=c.read);this._constructedStringLength=0}t.ByteStringBuffer=a;var o=4096;t.ByteStringBuffer.prototype._optimizeConstructedString=function(c){this._constructedStringLength+=c,this._constructedStringLength>o&&(this.data.substr(0,1),this._constructedStringLength=0)},t.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},t.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},t.ByteStringBuffer.prototype.putByte=function(c){return this.putBytes(String.fromCharCode(c))},t.ByteStringBuffer.prototype.fillWithByte=function(c,m){c=String.fromCharCode(c);for(var A=this.data;m>0;)m&1&&(A+=c),m>>>=1,m>0&&(c+=c);return this.data=A,this._optimizeConstructedString(m),this},t.ByteStringBuffer.prototype.putBytes=function(c){return this.data+=c,this._optimizeConstructedString(c.length),this},t.ByteStringBuffer.prototype.putString=function(c){return this.putBytes(t.encodeUtf8(c))},t.ByteStringBuffer.prototype.putInt16=function(c){return this.putBytes(String.fromCharCode(c>>8&255)+String.fromCharCode(c&255))},t.ByteStringBuffer.prototype.putInt24=function(c){return this.putBytes(String.fromCharCode(c>>16&255)+String.fromCharCode(c>>8&255)+String.fromCharCode(c&255))},t.ByteStringBuffer.prototype.putInt32=function(c){return this.putBytes(String.fromCharCode(c>>24&255)+String.fromCharCode(c>>16&255)+String.fromCharCode(c>>8&255)+String.fromCharCode(c&255))},t.ByteStringBuffer.prototype.putInt16Le=function(c){return this.putBytes(String.fromCharCode(c&255)+String.fromCharCode(c>>8&255))},t.ByteStringBuffer.prototype.putInt24Le=function(c){return this.putBytes(String.fromCharCode(c&255)+String.fromCharCode(c>>8&255)+String.fromCharCode(c>>16&255))},t.ByteStringBuffer.prototype.putInt32Le=function(c){return this.putBytes(String.fromCharCode(c&255)+String.fromCharCode(c>>8&255)+String.fromCharCode(c>>16&255)+String.fromCharCode(c>>24&255))},t.ByteStringBuffer.prototype.putInt=function(c,m){i(m);var A="";do m-=8,A+=String.fromCharCode(c>>m&255);while(m>0);return this.putBytes(A)},t.ByteStringBuffer.prototype.putSignedInt=function(c,m){return c<0&&(c+=2<<m-1),this.putInt(c,m)},t.ByteStringBuffer.prototype.putBuffer=function(c){return this.putBytes(c.getBytes())},t.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},t.ByteStringBuffer.prototype.getInt16=function(){var c=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,c},t.ByteStringBuffer.prototype.getInt24=function(){var c=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,c},t.ByteStringBuffer.prototype.getInt32=function(){var c=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,c},t.ByteStringBuffer.prototype.getInt16Le=function(){var c=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,c},t.ByteStringBuffer.prototype.getInt24Le=function(){var c=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,c},t.ByteStringBuffer.prototype.getInt32Le=function(){var c=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,c},t.ByteStringBuffer.prototype.getInt=function(c){i(c);var m=0;do m=(m<<8)+this.data.charCodeAt(this.read++),c-=8;while(c>0);return m},t.ByteStringBuffer.prototype.getSignedInt=function(c){var m=this.getInt(c),A=2<<c-2;return m>=A&&(m-=A<<1),m},t.ByteStringBuffer.prototype.getBytes=function(c){var m;return c?(c=Math.min(this.length(),c),m=this.data.slice(this.read,this.read+c),this.read+=c):c===0?m="":(m=this.read===0?this.data:this.data.slice(this.read),this.clear()),m},t.ByteStringBuffer.prototype.bytes=function(c){return typeof c>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+c)},t.ByteStringBuffer.prototype.at=function(c){return this.data.charCodeAt(this.read+c)},t.ByteStringBuffer.prototype.setAt=function(c,m){return this.data=this.data.substr(0,this.read+c)+String.fromCharCode(m)+this.data.substr(this.read+c+1),this},t.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},t.ByteStringBuffer.prototype.copy=function(){var c=t.createBuffer(this.data);return c.read=this.read,c},t.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},t.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},t.ByteStringBuffer.prototype.truncate=function(c){var m=Math.max(0,this.length()-c);return this.data=this.data.substr(this.read,m),this.read=0,this},t.ByteStringBuffer.prototype.toHex=function(){for(var c="",m=this.read;m<this.data.length;++m){var A=this.data.charCodeAt(m);A<16&&(c+="0"),c+=A.toString(16)}return c},t.ByteStringBuffer.prototype.toString=function(){return t.decodeUtf8(this.bytes())};function s(c,m){m=m||{},this.read=m.readOffset||0,this.growSize=m.growSize||1024;var A=t.isArrayBuffer(c),N=t.isArrayBufferView(c);if(A||N){A?this.data=new DataView(c):this.data=new DataView(c.buffer,c.byteOffset,c.byteLength),this.write="writeOffset"in m?m.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,c!=null&&this.putBytes(c),"writeOffset"in m&&(this.write=m.writeOffset)}t.DataBuffer=s,t.DataBuffer.prototype.length=function(){return this.write-this.read},t.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},t.DataBuffer.prototype.accommodate=function(c,m){if(this.length()>=c)return this;m=Math.max(m||this.growSize,c);var A=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),N=new Uint8Array(this.length()+m);return N.set(A),this.data=new DataView(N.buffer),this},t.DataBuffer.prototype.putByte=function(c){return this.accommodate(1),this.data.setUint8(this.write++,c),this},t.DataBuffer.prototype.fillWithByte=function(c,m){this.accommodate(m);for(var A=0;A<m;++A)this.data.setUint8(c);return this},t.DataBuffer.prototype.putBytes=function(c,m){if(t.isArrayBufferView(c)){var A=new Uint8Array(c.buffer,c.byteOffset,c.byteLength),N=A.byteLength-A.byteOffset;this.accommodate(N);var O=new Uint8Array(this.data.buffer,this.write);return O.set(A),this.write+=N,this}if(t.isArrayBuffer(c)){var A=new Uint8Array(c);this.accommodate(A.byteLength);var O=new Uint8Array(this.data.buffer);return O.set(A,this.write),this.write+=A.byteLength,this}if(c instanceof t.DataBuffer||typeof c=="object"&&typeof c.read=="number"&&typeof c.write=="number"&&t.isArrayBufferView(c.data)){var A=new Uint8Array(c.data.byteLength,c.read,c.length());this.accommodate(A.byteLength);var O=new Uint8Array(c.data.byteLength,this.write);return O.set(A),this.write+=A.byteLength,this}if(c instanceof t.ByteStringBuffer&&(c=c.data,m="binary"),m=m||"binary",typeof c=="string"){var C;if(m==="hex")return this.accommodate(Math.ceil(c.length/2)),C=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.hex.decode(c,C,this.write),this;if(m==="base64")return this.accommodate(Math.ceil(c.length/4)*3),C=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.base64.decode(c,C,this.write),this;if(m==="utf8"&&(c=t.encodeUtf8(c),m="binary"),m==="binary"||m==="raw")return this.accommodate(c.length),C=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.raw.decode(C),this;if(m==="utf16")return this.accommodate(c.length*2),C=new Uint16Array(this.data.buffer,this.write),this.write+=t.text.utf16.encode(C),this;throw new Error("Invalid encoding: "+m)}throw Error("Invalid parameter: "+c)},t.DataBuffer.prototype.putBuffer=function(c){return this.putBytes(c),c.clear(),this},t.DataBuffer.prototype.putString=function(c){return this.putBytes(c,"utf16")},t.DataBuffer.prototype.putInt16=function(c){return this.accommodate(2),this.data.setInt16(this.write,c),this.write+=2,this},t.DataBuffer.prototype.putInt24=function(c){return this.accommodate(3),this.data.setInt16(this.write,c>>8&65535),this.data.setInt8(this.write,c>>16&255),this.write+=3,this},t.DataBuffer.prototype.putInt32=function(c){return this.accommodate(4),this.data.setInt32(this.write,c),this.write+=4,this},t.DataBuffer.prototype.putInt16Le=function(c){return this.accommodate(2),this.data.setInt16(this.write,c,!0),this.write+=2,this},t.DataBuffer.prototype.putInt24Le=function(c){return this.accommodate(3),this.data.setInt8(this.write,c>>16&255),this.data.setInt16(this.write,c>>8&65535,!0),this.write+=3,this},t.DataBuffer.prototype.putInt32Le=function(c){return this.accommodate(4),this.data.setInt32(this.write,c,!0),this.write+=4,this},t.DataBuffer.prototype.putInt=function(c,m){i(m),this.accommodate(m/8);do m-=8,this.data.setInt8(this.write++,c>>m&255);while(m>0);return this},t.DataBuffer.prototype.putSignedInt=function(c,m){return i(m),this.accommodate(m/8),c<0&&(c+=2<<m-1),this.putInt(c,m)},t.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},t.DataBuffer.prototype.getInt16=function(){var c=this.data.getInt16(this.read);return this.read+=2,c},t.DataBuffer.prototype.getInt24=function(){var c=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,c},t.DataBuffer.prototype.getInt32=function(){var c=this.data.getInt32(this.read);return this.read+=4,c},t.DataBuffer.prototype.getInt16Le=function(){var c=this.data.getInt16(this.read,!0);return this.read+=2,c},t.DataBuffer.prototype.getInt24Le=function(){var c=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,c},t.DataBuffer.prototype.getInt32Le=function(){var c=this.data.getInt32(this.read,!0);return this.read+=4,c},t.DataBuffer.prototype.getInt=function(c){i(c);var m=0;do m=(m<<8)+this.data.getInt8(this.read++),c-=8;while(c>0);return m},t.DataBuffer.prototype.getSignedInt=function(c){var m=this.getInt(c),A=2<<c-2;return m>=A&&(m-=A<<1),m},t.DataBuffer.prototype.getBytes=function(c){var m;return c?(c=Math.min(this.length(),c),m=this.data.slice(this.read,this.read+c),this.read+=c):c===0?m="":(m=this.read===0?this.data:this.data.slice(this.read),this.clear()),m},t.DataBuffer.prototype.bytes=function(c){return typeof c>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+c)},t.DataBuffer.prototype.at=function(c){return this.data.getUint8(this.read+c)},t.DataBuffer.prototype.setAt=function(c,m){return this.data.setUint8(c,m),this},t.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},t.DataBuffer.prototype.copy=function(){return new t.DataBuffer(this)},t.DataBuffer.prototype.compact=function(){if(this.read>0){var c=new Uint8Array(this.data.buffer,this.read),m=new Uint8Array(c.byteLength);m.set(c),this.data=new DataView(m),this.write-=this.read,this.read=0}return this},t.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},t.DataBuffer.prototype.truncate=function(c){return this.write=Math.max(0,this.length()-c),this.read=Math.min(this.read,this.write),this},t.DataBuffer.prototype.toHex=function(){for(var c="",m=this.read;m<this.data.byteLength;++m){var A=this.data.getUint8(m);A<16&&(c+="0"),c+=A.toString(16)}return c},t.DataBuffer.prototype.toString=function(c){var m=new Uint8Array(this.data,this.read,this.length());if(c=c||"utf8",c==="binary"||c==="raw")return t.binary.raw.encode(m);if(c==="hex")return t.binary.hex.encode(m);if(c==="base64")return t.binary.base64.encode(m);if(c==="utf8")return t.text.utf8.decode(m);if(c==="utf16")return t.text.utf16.decode(m);throw new Error("Invalid encoding: "+c)},t.createBuffer=function(c,m){return m=m||"raw",c!==void 0&&m==="utf8"&&(c=t.encodeUtf8(c)),new t.ByteBuffer(c)},t.fillString=function(c,m){for(var A="";m>0;)m&1&&(A+=c),m>>>=1,m>0&&(c+=c);return A},t.xorBytes=function(c,m,A){for(var N="",O="",C="",h=0,u=0;A>0;--A,++h)O=c.charCodeAt(h)^m.charCodeAt(h),u>=10&&(N+=C,C="",u=0),C+=String.fromCharCode(O),++u;return N+=C,N},t.hexToBytes=function(c){var m="",A=0;for(c.length&!0&&(A=1,m+=String.fromCharCode(parseInt(c[0],16)));A<c.length;A+=2)m+=String.fromCharCode(parseInt(c.substr(A,2),16));return m},t.bytesToHex=function(c){return t.createBuffer(c).toHex()},t.int32ToBytes=function(c){return String.fromCharCode(c>>24&255)+String.fromCharCode(c>>16&255)+String.fromCharCode(c>>8&255)+String.fromCharCode(c&255)};var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",p=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],f="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";t.encode64=function(c,m){for(var A="",N="",O,C,h,u=0;u<c.length;)O=c.charCodeAt(u++),C=c.charCodeAt(u++),h=c.charCodeAt(u++),A+=n.charAt(O>>2),A+=n.charAt((O&3)<<4|C>>4),isNaN(C)?A+="==":(A+=n.charAt((C&15)<<2|h>>6),A+=isNaN(h)?"=":n.charAt(h&63)),m&&A.length>m&&(N+=A.substr(0,m)+`\r
|
|
13
|
+
`,A=A.substr(m));return N+=A,N},t.decode64=function(c){c=c.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var m="",A,N,O,C,h=0;h<c.length;)A=p[c.charCodeAt(h++)-43],N=p[c.charCodeAt(h++)-43],O=p[c.charCodeAt(h++)-43],C=p[c.charCodeAt(h++)-43],m+=String.fromCharCode(A<<2|N>>4),O!==64&&(m+=String.fromCharCode((N&15)<<4|O>>2),C!==64&&(m+=String.fromCharCode((O&3)<<6|C)));return m},t.encodeUtf8=function(c){return unescape(encodeURIComponent(c))},t.decodeUtf8=function(c){return decodeURIComponent(escape(c))},t.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:e.encode,decode:e.decode}},t.binary.raw.encode=function(c){return String.fromCharCode.apply(null,c)},t.binary.raw.decode=function(c,m,A){var N=m;N||(N=new Uint8Array(c.length)),A=A||0;for(var O=A,C=0;C<c.length;++C)N[O++]=c.charCodeAt(C);return m?O-A:N},t.binary.hex.encode=t.bytesToHex,t.binary.hex.decode=function(c,m,A){var N=m;N||(N=new Uint8Array(Math.ceil(c.length/2))),A=A||0;var O=0,C=A;for(c.length&1&&(O=1,N[C++]=parseInt(c[0],16));O<c.length;O+=2)N[C++]=parseInt(c.substr(O,2),16);return m?C-A:N},t.binary.base64.encode=function(c,m){for(var A="",N="",O,C,h,u=0;u<c.byteLength;)O=c[u++],C=c[u++],h=c[u++],A+=n.charAt(O>>2),A+=n.charAt((O&3)<<4|C>>4),isNaN(C)?A+="==":(A+=n.charAt((C&15)<<2|h>>6),A+=isNaN(h)?"=":n.charAt(h&63)),m&&A.length>m&&(N+=A.substr(0,m)+`\r
|
|
14
|
+
`,A=A.substr(m));return N+=A,N},t.binary.base64.decode=function(c,m,A){var N=m;N||(N=new Uint8Array(Math.ceil(c.length/4)*3)),c=c.replace(/[^A-Za-z0-9\+\/\=]/g,""),A=A||0;for(var O,C,h,u,_=0,M=A;_<c.length;)O=p[c.charCodeAt(_++)-43],C=p[c.charCodeAt(_++)-43],h=p[c.charCodeAt(_++)-43],u=p[c.charCodeAt(_++)-43],N[M++]=O<<2|C>>4,h!==64&&(N[M++]=(C&15)<<4|h>>2,u!==64&&(N[M++]=(h&3)<<6|u));return m?M-A:N.subarray(0,M)},t.binary.base58.encode=function(c,m){return t.binary.baseN.encode(c,f,m)},t.binary.base58.decode=function(c,m){return t.binary.baseN.decode(c,f,m)},t.text={utf8:{},utf16:{}},t.text.utf8.encode=function(c,m,A){c=t.encodeUtf8(c);var N=m;N||(N=new Uint8Array(c.length)),A=A||0;for(var O=A,C=0;C<c.length;++C)N[O++]=c.charCodeAt(C);return m?O-A:N},t.text.utf8.decode=function(c){return t.decodeUtf8(String.fromCharCode.apply(null,c))},t.text.utf16.encode=function(c,m,A){var N=m;N||(N=new Uint8Array(c.length*2));var O=new Uint16Array(N.buffer);A=A||0;for(var C=A,h=A,u=0;u<c.length;++u)O[h++]=c.charCodeAt(u),C+=2;return m?C-A:N},t.text.utf16.decode=function(c){return String.fromCharCode.apply(null,new Uint16Array(c.buffer))},t.deflate=function(c,m,A){if(m=t.decode64(c.deflate(t.encode64(m)).rval),A){var N=2,O=m.charCodeAt(1);O&32&&(N=6),m=m.substring(N,m.length-4)}return m},t.inflate=function(c,m,A){var N=c.inflate(t.encode64(m)).rval;return N===null?null:t.decode64(N)};var E=function(c,m,A){if(!c)throw new Error("WebStorage not available.");var N;if(A===null?N=c.removeItem(m):(A=t.encode64(JSON.stringify(A)),N=c.setItem(m,A)),typeof N<"u"&&N.rval!==!0){var O=new Error(N.error.message);throw O.id=N.error.id,O.name=N.error.name,O}},I=function(c,m){if(!c)throw new Error("WebStorage not available.");var A=c.getItem(m);if(c.init)if(A.rval===null){if(A.error){var N=new Error(A.error.message);throw N.id=A.error.id,N.name=A.error.name,N}A=null}else A=A.rval;return A!==null&&(A=JSON.parse(t.decode64(A))),A},B=function(c,m,A,N){var O=I(c,m);O===null&&(O={}),O[A]=N,E(c,m,O)},l=function(c,m,A){var N=I(c,m);return N!==null&&(N=A in N?N[A]:null),N},y=function(c,m,A){var N=I(c,m);if(N!==null&&A in N){delete N[A];var O=!0;for(var C in N){O=!1;break}O&&(N=null),E(c,m,N)}},S=function(c,m){E(c,m,null)},x=function(c,m,A){var N=null;typeof A>"u"&&(A=["web","flash"]);var O,C=!1,h=null;for(var u in A){O=A[u];try{if(O==="flash"||O==="both"){if(m[0]===null)throw new Error("Flash local storage not available.");N=c.apply(this,m),C=O==="flash"}(O==="web"||O==="both")&&(m[0]=localStorage,N=c.apply(this,m),C=!0)}catch(_){h=_}if(C)break}if(!C)throw h;return N};return t.setItem=function(c,m,A,N,O){x(B,arguments,O)},t.getItem=function(c,m,A,N){return x(l,arguments,N)},t.removeItem=function(c,m,A,N){x(y,arguments,N)},t.clearItems=function(c,m,A){x(S,arguments,A)},t.isEmpty=function(c){for(var m in c)if(c.hasOwnProperty(m))return!1;return!0},t.format=function(c){for(var m=/%./g,A,N,O=0,C=[],h=0;A=m.exec(c);){N=c.substring(h,m.lastIndex-2),N.length>0&&C.push(N),h=m.lastIndex;var u=A[0][1];switch(u){case"s":case"o":O<arguments.length?C.push(arguments[O+++1]):C.push("<?>");break;case"%":C.push("%");break;default:C.push("<%"+u+"?>")}}return C.push(c.substring(h)),C.join("")},t.formatNumber=function(c,m,A,N){var O=c,C=isNaN(m=Math.abs(m))?2:m,h=A===void 0?",":A,u=N===void 0?".":N,_=O<0?"-":"",M=parseInt(O=Math.abs(+O||0).toFixed(C),10)+"",G=M.length>3?M.length%3:0;return _+(G?M.substr(0,G)+u:"")+M.substr(G).replace(/(\d{3})(?=\d)/g,"$1"+u)+(C?h+Math.abs(O-M).toFixed(C).slice(2):"")},t.formatSize=function(c){return c>=1073741824?c=t.formatNumber(c/1073741824,2,".","")+" GiB":c>=1048576?c=t.formatNumber(c/1048576,2,".","")+" MiB":c>=1024?c=t.formatNumber(c/1024,0)+" KiB":c=t.formatNumber(c,0)+" bytes",c},t.bytesFromIP=function(c){return c.indexOf(".")!==-1?t.bytesFromIPv4(c):c.indexOf(":")!==-1?t.bytesFromIPv6(c):null},t.bytesFromIPv4=function(c){if(c=c.split("."),c.length!==4)return null;for(var m=t.createBuffer(),A=0;A<c.length;++A){var N=parseInt(c[A],10);if(isNaN(N))return null;m.putByte(N)}return m.getBytes()},t.bytesFromIPv6=function(c){var m=0;c=c.split(":").filter(function(h){return h.length===0&&++m,!0});for(var A=(8-c.length+m)*2,N=t.createBuffer(),O=0;O<8;++O){if(!c[O]||c[O].length===0){N.fillWithByte(0,A),A=0;continue}var C=t.hexToBytes(c[O]);C.length<2&&N.putByte(0),N.putBytes(C)}return N.getBytes()},t.bytesToIP=function(c){return c.length===4?t.bytesToIPv4(c):c.length===16?t.bytesToIPv6(c):null},t.bytesToIPv4=function(c){if(c.length!==4)return null;for(var m=[],A=0;A<c.length;++A)m.push(c.charCodeAt(A));return m.join(".")},t.bytesToIPv6=function(c){if(c.length!==16)return null;for(var m=[],A=[],N=0,O=0;O<c.length;O+=2){for(var C=t.bytesToHex(c[O]+c[O+1]);C[0]==="0"&&C!=="0";)C=C.substr(1);if(C==="0"){var h=A[A.length-1],u=m.length;!h||u!==h.end+1?A.push({start:u,end:u}):(h.end=u,h.end-h.start>A[N].end-A[N].start&&(N=A.length-1))}m.push(C)}if(A.length>0){var _=A[N];_.end-_.start>0&&(m.splice(_.start,_.end-_.start+1,""),_.start===0&&m.unshift(""),_.end===7&&m.push(""))}return m.join(":")},t.estimateCores=function(c,m){if(typeof c=="function"&&(m=c,c={}),c=c||{},"cores"in t&&!c.update)return m(null,t.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return t.cores=navigator.hardwareConcurrency,m(null,t.cores);if(typeof Worker>"u")return t.cores=1,m(null,t.cores);if(typeof Blob>"u")return t.cores=2,m(null,t.cores);var A=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(h){var u=Date.now(),_=u+4;self.postMessage({st:u,et:_})})}.toString(),")()"],{type:"application/javascript"}));N([],5,16);function N(h,u,_){if(u===0){var M=Math.floor(h.reduce(function(G,F){return G+F},0)/h.length);return t.cores=Math.max(1,M),URL.revokeObjectURL(A),m(null,t.cores)}O(_,function(G,F){h.push(C(_,F)),N(h,u-1,_)})}function O(h,u){for(var _=[],M=[],G=0;G<h;++G){var F=new Worker(A);F.addEventListener("message",function(z){if(M.push(z.data),M.length===h){for(var J=0;J<h;++J)_[J].terminate();u(null,M)}}),_.push(F)}for(var G=0;G<h;++G)_[G].postMessage(G)}function C(h,u){for(var _=[],M=0;M<h;++M)for(var G=u[M],F=_[M]=[],z=0;z<h;++z)if(M!==z){var J=u[z];(G.st>J.st&&G.st<J.et||J.st>G.st&&J.st<G.et)&&F.push(z)}return _.reduce(function(X,te){return Math.max(X,te.length)},0)}},Qu.exports}var Xu,sh;function Ju(){if(sh)return Xu;sh=1;var r=Ge();We(),Xu=r.cipher=r.cipher||{},r.cipher.algorithms=r.cipher.algorithms||{},r.cipher.createCipher=function(t,i){var a=t;if(typeof a=="string"&&(a=r.cipher.getAlgorithm(a),a&&(a=a())),!a)throw new Error("Unsupported algorithm: "+t);return new r.cipher.BlockCipher({algorithm:a,key:i,decrypt:!1})},r.cipher.createDecipher=function(t,i){var a=t;if(typeof a=="string"&&(a=r.cipher.getAlgorithm(a),a&&(a=a())),!a)throw new Error("Unsupported algorithm: "+t);return new r.cipher.BlockCipher({algorithm:a,key:i,decrypt:!0})},r.cipher.registerAlgorithm=function(t,i){t=t.toUpperCase(),r.cipher.algorithms[t]=i},r.cipher.getAlgorithm=function(t){return t=t.toUpperCase(),t in r.cipher.algorithms?r.cipher.algorithms[t]:null};var e=r.cipher.BlockCipher=function(t){this.algorithm=t.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=t.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=t.decrypt,this.algorithm.initialize(t)};return e.prototype.start=function(t){t=t||{};var i={};for(var a in t)i[a]=t[a];i.decrypt=this._decrypt,this._finish=!1,this._input=r.util.createBuffer(),this.output=t.output||r.util.createBuffer(),this.mode.start(i)},e.prototype.update=function(t){for(t&&this._input.putBuffer(t);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},e.prototype.finish=function(t){t&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(a){return t(this.blockSize,a,!1)},this.mode.unpad=function(a){return t(this.blockSize,a,!0)});var i={};return i.decrypt=this._decrypt,i.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,i)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,i))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,i))},Xu}var Zu={exports:{}},oh;function uh(){if(oh)return Zu.exports;oh=1;var r=Ge();We(),r.cipher=r.cipher||{};var e=Zu.exports=r.cipher.modes=r.cipher.modes||{};e.ecb=function(o){o=o||{},this.name="ECB",this.cipher=o.cipher,this.blockSize=o.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.ecb.prototype.start=function(o){},e.ecb.prototype.encrypt=function(o,s,n){if(o.length()<this.blockSize&&!(n&&o.length()>0))return!0;for(var p=0;p<this._ints;++p)this._inBlock[p]=o.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var p=0;p<this._ints;++p)s.putInt32(this._outBlock[p])},e.ecb.prototype.decrypt=function(o,s,n){if(o.length()<this.blockSize&&!(n&&o.length()>0))return!0;for(var p=0;p<this._ints;++p)this._inBlock[p]=o.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var p=0;p<this._ints;++p)s.putInt32(this._outBlock[p])},e.ecb.prototype.pad=function(o,s){var n=o.length()===this.blockSize?this.blockSize:this.blockSize-o.length();return o.fillWithByte(n,n),!0},e.ecb.prototype.unpad=function(o,s){if(s.overflow>0)return!1;var n=o.length(),p=o.at(n-1);return p>this.blockSize<<2?!1:(o.truncate(p),!0)},e.cbc=function(o){o=o||{},this.name="CBC",this.cipher=o.cipher,this.blockSize=o.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.cbc.prototype.start=function(o){if(o.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in o)this._iv=t(o.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")},e.cbc.prototype.encrypt=function(o,s,n){if(o.length()<this.blockSize&&!(n&&o.length()>0))return!0;for(var p=0;p<this._ints;++p)this._inBlock[p]=this._prev[p]^o.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var p=0;p<this._ints;++p)s.putInt32(this._outBlock[p]);this._prev=this._outBlock},e.cbc.prototype.decrypt=function(o,s,n){if(o.length()<this.blockSize&&!(n&&o.length()>0))return!0;for(var p=0;p<this._ints;++p)this._inBlock[p]=o.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var p=0;p<this._ints;++p)s.putInt32(this._prev[p]^this._outBlock[p]);this._prev=this._inBlock.slice(0)},e.cbc.prototype.pad=function(o,s){var n=o.length()===this.blockSize?this.blockSize:this.blockSize-o.length();return o.fillWithByte(n,n),!0},e.cbc.prototype.unpad=function(o,s){if(s.overflow>0)return!1;var n=o.length(),p=o.at(n-1);return p>this.blockSize<<2?!1:(o.truncate(p),!0)},e.cfb=function(o){o=o||{},this.name="CFB",this.cipher=o.cipher,this.blockSize=o.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0},e.cfb.prototype.start=function(o){if(!("iv"in o))throw new Error("Invalid IV parameter.");this._iv=t(o.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.cfb.prototype.encrypt=function(o,s,n){var p=o.length();if(p===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&p>=this.blockSize){for(var f=0;f<this._ints;++f)this._inBlock[f]=o.getInt32()^this._outBlock[f],s.putInt32(this._inBlock[f]);return}var E=(this.blockSize-p)%this.blockSize;E>0&&(E=this.blockSize-E),this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialBlock[f]=o.getInt32()^this._outBlock[f],this._partialOutput.putInt32(this._partialBlock[f]);if(E>0)o.read-=this.blockSize;else for(var f=0;f<this._ints;++f)this._inBlock[f]=this._partialBlock[f];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),E>0&&!n)return s.putBytes(this._partialOutput.getBytes(E-this._partialBytes)),this._partialBytes=E,!0;s.putBytes(this._partialOutput.getBytes(p-this._partialBytes)),this._partialBytes=0},e.cfb.prototype.decrypt=function(o,s,n){var p=o.length();if(p===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&p>=this.blockSize){for(var f=0;f<this._ints;++f)this._inBlock[f]=o.getInt32(),s.putInt32(this._inBlock[f]^this._outBlock[f]);return}var E=(this.blockSize-p)%this.blockSize;E>0&&(E=this.blockSize-E),this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialBlock[f]=o.getInt32(),this._partialOutput.putInt32(this._partialBlock[f]^this._outBlock[f]);if(E>0)o.read-=this.blockSize;else for(var f=0;f<this._ints;++f)this._inBlock[f]=this._partialBlock[f];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),E>0&&!n)return s.putBytes(this._partialOutput.getBytes(E-this._partialBytes)),this._partialBytes=E,!0;s.putBytes(this._partialOutput.getBytes(p-this._partialBytes)),this._partialBytes=0},e.ofb=function(o){o=o||{},this.name="OFB",this.cipher=o.cipher,this.blockSize=o.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0},e.ofb.prototype.start=function(o){if(!("iv"in o))throw new Error("Invalid IV parameter.");this._iv=t(o.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ofb.prototype.encrypt=function(o,s,n){var p=o.length();if(o.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&p>=this.blockSize){for(var f=0;f<this._ints;++f)s.putInt32(o.getInt32()^this._outBlock[f]),this._inBlock[f]=this._outBlock[f];return}var E=(this.blockSize-p)%this.blockSize;E>0&&(E=this.blockSize-E),this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialOutput.putInt32(o.getInt32()^this._outBlock[f]);if(E>0)o.read-=this.blockSize;else for(var f=0;f<this._ints;++f)this._inBlock[f]=this._outBlock[f];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),E>0&&!n)return s.putBytes(this._partialOutput.getBytes(E-this._partialBytes)),this._partialBytes=E,!0;s.putBytes(this._partialOutput.getBytes(p-this._partialBytes)),this._partialBytes=0},e.ofb.prototype.decrypt=e.ofb.prototype.encrypt,e.ctr=function(o){o=o||{},this.name="CTR",this.cipher=o.cipher,this.blockSize=o.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0},e.ctr.prototype.start=function(o){if(!("iv"in o))throw new Error("Invalid IV parameter.");this._iv=t(o.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ctr.prototype.encrypt=function(o,s,n){var p=o.length();if(p===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&p>=this.blockSize)for(var f=0;f<this._ints;++f)s.putInt32(o.getInt32()^this._outBlock[f]);else{var E=(this.blockSize-p)%this.blockSize;E>0&&(E=this.blockSize-E),this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialOutput.putInt32(o.getInt32()^this._outBlock[f]);if(E>0&&(o.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),E>0&&!n)return s.putBytes(this._partialOutput.getBytes(E-this._partialBytes)),this._partialBytes=E,!0;s.putBytes(this._partialOutput.getBytes(p-this._partialBytes)),this._partialBytes=0}i(this._inBlock)},e.ctr.prototype.decrypt=e.ctr.prototype.encrypt,e.gcm=function(o){o=o||{},this.name="GCM",this.cipher=o.cipher,this.blockSize=o.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0,this._R=3774873600},e.gcm.prototype.start=function(o){if(!("iv"in o))throw new Error("Invalid IV parameter.");var s=r.util.createBuffer(o.iv);this._cipherLength=0;var n;if("additionalData"in o?n=r.util.createBuffer(o.additionalData):n=r.util.createBuffer(),"tagLength"in o?this._tagLength=o.tagLength:this._tagLength=128,this._tag=null,o.decrypt&&(this._tag=r.util.createBuffer(o.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 p=s.length();if(p===12)this._j0=[s.getInt32(),s.getInt32(),s.getInt32(),1];else{for(this._j0=[0,0,0,0];s.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[s.getInt32(),s.getInt32(),s.getInt32(),s.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(p*8)))}this._inBlock=this._j0.slice(0),i(this._inBlock),this._partialBytes=0,n=r.util.createBuffer(n),this._aDataLength=a(n.length()*8);var f=n.length()%this.blockSize;for(f&&n.fillWithByte(0,this.blockSize-f),this._s=[0,0,0,0];n.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[n.getInt32(),n.getInt32(),n.getInt32(),n.getInt32()])},e.gcm.prototype.encrypt=function(o,s,n){var p=o.length();if(p===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&p>=this.blockSize){for(var f=0;f<this._ints;++f)s.putInt32(this._outBlock[f]^=o.getInt32());this._cipherLength+=this.blockSize}else{var E=(this.blockSize-p)%this.blockSize;E>0&&(E=this.blockSize-E),this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialOutput.putInt32(o.getInt32()^this._outBlock[f]);if(E<=0||n){if(n){var I=p%this.blockSize;this._cipherLength+=I,this._partialOutput.truncate(this.blockSize-I)}else this._cipherLength+=this.blockSize;for(var f=0;f<this._ints;++f)this._outBlock[f]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),E>0&&!n)return o.read-=this.blockSize,s.putBytes(this._partialOutput.getBytes(E-this._partialBytes)),this._partialBytes=E,!0;s.putBytes(this._partialOutput.getBytes(p-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),i(this._inBlock)},e.gcm.prototype.decrypt=function(o,s,n){var p=o.length();if(p<this.blockSize&&!(n&&p>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),i(this._inBlock),this._hashBlock[0]=o.getInt32(),this._hashBlock[1]=o.getInt32(),this._hashBlock[2]=o.getInt32(),this._hashBlock[3]=o.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var f=0;f<this._ints;++f)s.putInt32(this._outBlock[f]^this._hashBlock[f]);p<this.blockSize?this._cipherLength+=p%this.blockSize:this._cipherLength+=this.blockSize},e.gcm.prototype.afterFinish=function(o,s){var n=!0;s.decrypt&&s.overflow&&o.truncate(this.blockSize-s.overflow),this.tag=r.util.createBuffer();var p=this._aDataLength.concat(a(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,p);var f=[];this.cipher.encrypt(this._j0,f);for(var E=0;E<this._ints;++E)this.tag.putInt32(this._s[E]^f[E]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),s.decrypt&&this.tag.bytes()!==this._tag&&(n=!1),n},e.gcm.prototype.multiply=function(o,s){for(var n=[0,0,0,0],p=s.slice(0),f=0;f<128;++f){var E=o[f/32|0]&1<<31-f%32;E&&(n[0]^=p[0],n[1]^=p[1],n[2]^=p[2],n[3]^=p[3]),this.pow(p,p)}return n},e.gcm.prototype.pow=function(o,s){for(var n=o[3]&1,p=3;p>0;--p)s[p]=o[p]>>>1|(o[p-1]&1)<<31;s[0]=o[0]>>>1,n&&(s[0]^=this._R)},e.gcm.prototype.tableMultiply=function(o){for(var s=[0,0,0,0],n=0;n<32;++n){var p=n/8|0,f=o[p]>>>(7-n%8)*4&15,E=this._m[n][f];s[0]^=E[0],s[1]^=E[1],s[2]^=E[2],s[3]^=E[3]}return s},e.gcm.prototype.ghash=function(o,s,n){return s[0]^=n[0],s[1]^=n[1],s[2]^=n[2],s[3]^=n[3],this.tableMultiply(s)},e.gcm.prototype.generateHashTable=function(o,s){for(var n=8/s,p=4*n,f=16*n,E=new Array(f),I=0;I<f;++I){var B=[0,0,0,0],l=I/p|0,y=(p-1-I%p)*s;B[l]=1<<s-1<<y,E[I]=this.generateSubHashTable(this.multiply(B,o),s)}return E},e.gcm.prototype.generateSubHashTable=function(o,s){var n=1<<s,p=n>>>1,f=new Array(n);f[p]=o.slice(0);for(var E=p>>>1;E>0;)this.pow(f[2*E],f[E]=[]),E>>=1;for(E=2;E<p;){for(var I=1;I<E;++I){var B=f[E],l=f[I];f[E+I]=[B[0]^l[0],B[1]^l[1],B[2]^l[2],B[3]^l[3]]}E*=2}for(f[0]=[0,0,0,0],E=p+1;E<n;++E){var y=f[E^p];f[E]=[o[0]^y[0],o[1]^y[1],o[2]^y[2],o[3]^y[3]]}return f};function t(o,s){if(typeof o=="string"&&(o=r.util.createBuffer(o)),r.util.isArray(o)&&o.length>4){var n=o;o=r.util.createBuffer();for(var p=0;p<n.length;++p)o.putByte(n[p])}if(o.length()<s)throw new Error("Invalid IV length; got "+o.length()+" bytes and expected "+s+" bytes.");if(!r.util.isArray(o)){for(var f=[],E=s/4,p=0;p<E;++p)f.push(o.getInt32());o=f}return o}function i(o){o[o.length-1]=o[o.length-1]+1&4294967295}function a(o){return[o/4294967296|0,o&4294967295]}return Zu.exports}var ec,ch;function ai(){if(ch)return ec;ch=1;var r=Ge();Ju(),uh(),We(),ec=r.aes=r.aes||{},r.aes.startEncrypting=function(l,y,S,x){var c=B({key:l,output:S,decrypt:!1,mode:x});return c.start(y),c},r.aes.createEncryptionCipher=function(l,y){return B({key:l,output:null,decrypt:!1,mode:y})},r.aes.startDecrypting=function(l,y,S,x){var c=B({key:l,output:S,decrypt:!0,mode:x});return c.start(y),c},r.aes.createDecryptionCipher=function(l,y){return B({key:l,output:null,decrypt:!0,mode:y})},r.aes.Algorithm=function(l,y){t||f();var S=this;S.name=l,S.mode=new y({blockSize:16,cipher:{encrypt:function(x,c){return I(S._w,x,c,!1)},decrypt:function(x,c){return I(S._w,x,c,!0)}}}),S._init=!1},r.aes.Algorithm.prototype.initialize=function(l){if(!this._init){var y=l.key,S;if(typeof y=="string"&&(y.length===16||y.length===24||y.length===32))y=r.util.createBuffer(y);else if(r.util.isArray(y)&&(y.length===16||y.length===24||y.length===32)){S=y,y=r.util.createBuffer();for(var x=0;x<S.length;++x)y.putByte(S[x])}if(!r.util.isArray(y)){S=y,y=[];var c=S.length();if(c===16||c===24||c===32){c=c>>>2;for(var x=0;x<c;++x)y.push(S.getInt32())}}if(!r.util.isArray(y)||!(y.length===4||y.length===6||y.length===8))throw new Error("Invalid key parameter.");var m=this.mode.name,A=["CFB","OFB","CTR","GCM"].indexOf(m)!==-1;this._w=E(y,l.decrypt&&!A),this._init=!0}},r.aes._expandKey=function(l,y){return t||f(),E(l,y)},r.aes._updateBlock=I,e("AES-ECB",r.cipher.modes.ecb),e("AES-CBC",r.cipher.modes.cbc),e("AES-CFB",r.cipher.modes.cfb),e("AES-OFB",r.cipher.modes.ofb),e("AES-CTR",r.cipher.modes.ctr),e("AES-GCM",r.cipher.modes.gcm);function e(l,y){var S=function(){return new r.aes.Algorithm(l,y)};r.cipher.registerAlgorithm(l,S)}var t=!1,i=4,a,o,s,n,p;function f(){t=!0,s=[0,1,2,4,8,16,32,64,128,27,54];for(var l=new Array(256),y=0;y<128;++y)l[y]=y<<1,l[y+128]=y+128<<1^283;a=new Array(256),o=new Array(256),n=new Array(4),p=new Array(4);for(var y=0;y<4;++y)n[y]=new Array(256),p[y]=new Array(256);for(var S=0,x=0,c,m,A,N,O,C,h,y=0;y<256;++y){N=x^x<<1^x<<2^x<<3^x<<4,N=N>>8^N&255^99,a[S]=N,o[N]=S,O=l[N],c=l[S],m=l[c],A=l[m],C=O<<24^N<<16^N<<8^(N^O),h=(c^m^A)<<24^(S^A)<<16^(S^m^A)<<8^(S^c^A);for(var u=0;u<4;++u)n[u][S]=C,p[u][N]=h,C=C<<24|C>>>8,h=h<<24|h>>>8;S===0?S=x=1:(S=c^l[l[l[c^A]]],x^=l[l[x]])}}function E(l,y){for(var S=l.slice(0),x,c=1,m=S.length,A=m+6+1,N=i*A,O=m;O<N;++O)x=S[O-1],O%m===0?(x=a[x>>>16&255]<<24^a[x>>>8&255]<<16^a[x&255]<<8^a[x>>>24]^s[c]<<24,c++):m>6&&O%m===4&&(x=a[x>>>24]<<24^a[x>>>16&255]<<16^a[x>>>8&255]<<8^a[x&255]),S[O]=S[O-m]^x;if(y){var C,h=p[0],u=p[1],_=p[2],M=p[3],G=S.slice(0);N=S.length;for(var O=0,F=N-i;O<N;O+=i,F-=i)if(O===0||O===N-i)G[O]=S[F],G[O+1]=S[F+3],G[O+2]=S[F+2],G[O+3]=S[F+1];else for(var z=0;z<i;++z)C=S[F+z],G[O+(3&-z)]=h[a[C>>>24]]^u[a[C>>>16&255]]^_[a[C>>>8&255]]^M[a[C&255]];S=G}return S}function I(l,y,S,x){var c=l.length/4-1,m,A,N,O,C;x?(m=p[0],A=p[1],N=p[2],O=p[3],C=o):(m=n[0],A=n[1],N=n[2],O=n[3],C=a);var h,u,_,M,G,F,z;h=y[0]^l[0],u=y[x?3:1]^l[1],_=y[2]^l[2],M=y[x?1:3]^l[3];for(var J=3,X=1;X<c;++X)G=m[h>>>24]^A[u>>>16&255]^N[_>>>8&255]^O[M&255]^l[++J],F=m[u>>>24]^A[_>>>16&255]^N[M>>>8&255]^O[h&255]^l[++J],z=m[_>>>24]^A[M>>>16&255]^N[h>>>8&255]^O[u&255]^l[++J],M=m[M>>>24]^A[h>>>16&255]^N[u>>>8&255]^O[_&255]^l[++J],h=G,u=F,_=z;S[0]=C[h>>>24]<<24^C[u>>>16&255]<<16^C[_>>>8&255]<<8^C[M&255]^l[++J],S[x?3:1]=C[u>>>24]<<24^C[_>>>16&255]<<16^C[M>>>8&255]<<8^C[h&255]^l[++J],S[2]=C[_>>>24]<<24^C[M>>>16&255]<<16^C[h>>>8&255]<<8^C[u&255]^l[++J],S[x?1:3]=C[M>>>24]<<24^C[h>>>16&255]<<16^C[u>>>8&255]<<8^C[_&255]^l[++J]}function B(l){l=l||{};var y=(l.mode||"CBC").toUpperCase(),S="AES-"+y,x;l.decrypt?x=r.cipher.createDecipher(S,l.key):x=r.cipher.createCipher(S,l.key);var c=x.start;return x.start=function(m,A){var N=null;A instanceof r.util.ByteBuffer&&(N=A,A={}),A=A||{},A.output=N,A.iv=m,c.call(x,A)},x}return ec}var tc={exports:{}},rc={exports:{}},ic={exports:{}},lh;function si(){if(lh)return ic.exports;lh=1;var r=Ge();r.pki=r.pki||{};var e=ic.exports=r.pki.oids=r.oids=r.oids||{};function t(a,o){e[a]=o,e[o]=a}function i(a,o){e[a]=o}return t("1.2.840.113549.1.1.1","rsaEncryption"),t("1.2.840.113549.1.1.4","md5WithRSAEncryption"),t("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),t("1.2.840.113549.1.1.7","RSAES-OAEP"),t("1.2.840.113549.1.1.8","mgf1"),t("1.2.840.113549.1.1.9","pSpecified"),t("1.2.840.113549.1.1.10","RSASSA-PSS"),t("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),t("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),t("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),t("1.3.101.112","EdDSA25519"),t("1.2.840.10040.4.3","dsa-with-sha1"),t("1.3.14.3.2.7","desCBC"),t("1.3.14.3.2.26","sha1"),t("1.3.14.3.2.29","sha1WithRSASignature"),t("2.16.840.1.101.3.4.2.1","sha256"),t("2.16.840.1.101.3.4.2.2","sha384"),t("2.16.840.1.101.3.4.2.3","sha512"),t("2.16.840.1.101.3.4.2.4","sha224"),t("2.16.840.1.101.3.4.2.5","sha512-224"),t("2.16.840.1.101.3.4.2.6","sha512-256"),t("1.2.840.113549.2.2","md2"),t("1.2.840.113549.2.5","md5"),t("1.2.840.113549.1.7.1","data"),t("1.2.840.113549.1.7.2","signedData"),t("1.2.840.113549.1.7.3","envelopedData"),t("1.2.840.113549.1.7.4","signedAndEnvelopedData"),t("1.2.840.113549.1.7.5","digestedData"),t("1.2.840.113549.1.7.6","encryptedData"),t("1.2.840.113549.1.9.1","emailAddress"),t("1.2.840.113549.1.9.2","unstructuredName"),t("1.2.840.113549.1.9.3","contentType"),t("1.2.840.113549.1.9.4","messageDigest"),t("1.2.840.113549.1.9.5","signingTime"),t("1.2.840.113549.1.9.6","counterSignature"),t("1.2.840.113549.1.9.7","challengePassword"),t("1.2.840.113549.1.9.8","unstructuredAddress"),t("1.2.840.113549.1.9.14","extensionRequest"),t("1.2.840.113549.1.9.20","friendlyName"),t("1.2.840.113549.1.9.21","localKeyId"),t("1.2.840.113549.1.9.22.1","x509Certificate"),t("1.2.840.113549.1.12.10.1.1","keyBag"),t("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),t("1.2.840.113549.1.12.10.1.3","certBag"),t("1.2.840.113549.1.12.10.1.4","crlBag"),t("1.2.840.113549.1.12.10.1.5","secretBag"),t("1.2.840.113549.1.12.10.1.6","safeContentsBag"),t("1.2.840.113549.1.5.13","pkcs5PBES2"),t("1.2.840.113549.1.5.12","pkcs5PBKDF2"),t("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),t("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),t("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),t("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),t("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),t("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),t("1.2.840.113549.2.7","hmacWithSHA1"),t("1.2.840.113549.2.8","hmacWithSHA224"),t("1.2.840.113549.2.9","hmacWithSHA256"),t("1.2.840.113549.2.10","hmacWithSHA384"),t("1.2.840.113549.2.11","hmacWithSHA512"),t("1.2.840.113549.3.7","des-EDE3-CBC"),t("2.16.840.1.101.3.4.1.2","aes128-CBC"),t("2.16.840.1.101.3.4.1.22","aes192-CBC"),t("2.16.840.1.101.3.4.1.42","aes256-CBC"),t("2.5.4.3","commonName"),t("2.5.4.4","surname"),t("2.5.4.5","serialNumber"),t("2.5.4.6","countryName"),t("2.5.4.7","localityName"),t("2.5.4.8","stateOrProvinceName"),t("2.5.4.9","streetAddress"),t("2.5.4.10","organizationName"),t("2.5.4.11","organizationalUnitName"),t("2.5.4.12","title"),t("2.5.4.13","description"),t("2.5.4.15","businessCategory"),t("2.5.4.17","postalCode"),t("2.5.4.42","givenName"),t("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),t("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),t("2.16.840.1.113730.1.1","nsCertType"),t("2.16.840.1.113730.1.13","nsComment"),i("2.5.29.1","authorityKeyIdentifier"),i("2.5.29.2","keyAttributes"),i("2.5.29.3","certificatePolicies"),i("2.5.29.4","keyUsageRestriction"),i("2.5.29.5","policyMapping"),i("2.5.29.6","subtreesConstraint"),i("2.5.29.7","subjectAltName"),i("2.5.29.8","issuerAltName"),i("2.5.29.9","subjectDirectoryAttributes"),i("2.5.29.10","basicConstraints"),i("2.5.29.11","nameConstraints"),i("2.5.29.12","policyConstraints"),i("2.5.29.13","basicConstraints"),t("2.5.29.14","subjectKeyIdentifier"),t("2.5.29.15","keyUsage"),i("2.5.29.16","privateKeyUsagePeriod"),t("2.5.29.17","subjectAltName"),t("2.5.29.18","issuerAltName"),t("2.5.29.19","basicConstraints"),i("2.5.29.20","cRLNumber"),i("2.5.29.21","cRLReason"),i("2.5.29.22","expirationDate"),i("2.5.29.23","instructionCode"),i("2.5.29.24","invalidityDate"),i("2.5.29.25","cRLDistributionPoints"),i("2.5.29.26","issuingDistributionPoint"),i("2.5.29.27","deltaCRLIndicator"),i("2.5.29.28","issuingDistributionPoint"),i("2.5.29.29","certificateIssuer"),i("2.5.29.30","nameConstraints"),t("2.5.29.31","cRLDistributionPoints"),t("2.5.29.32","certificatePolicies"),i("2.5.29.33","policyMappings"),i("2.5.29.34","policyConstraints"),t("2.5.29.35","authorityKeyIdentifier"),i("2.5.29.36","policyConstraints"),t("2.5.29.37","extKeyUsage"),i("2.5.29.46","freshestCRL"),i("2.5.29.54","inhibitAnyPolicy"),t("1.3.6.1.4.1.11129.2.4.2","timestampList"),t("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),t("1.3.6.1.5.5.7.3.1","serverAuth"),t("1.3.6.1.5.5.7.3.2","clientAuth"),t("1.3.6.1.5.5.7.3.3","codeSigning"),t("1.3.6.1.5.5.7.3.4","emailProtection"),t("1.3.6.1.5.5.7.3.8","timeStamping"),ic.exports}var fh;function pr(){if(fh)return rc.exports;fh=1;var r=Ge();We(),si();var e=rc.exports=r.asn1=r.asn1||{};e.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},e.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},e.maxDepth=256,e.create=function(s,n,p,f,E){if(r.util.isArray(f)){for(var I=[],B=0;B<f.length;++B)f[B]!==void 0&&I.push(f[B]);f=I}var l={tagClass:s,type:n,constructed:p,composed:p||r.util.isArray(f),value:f};return E&&"bitStringContents"in E&&(l.bitStringContents=E.bitStringContents,l.original=e.copy(l)),l},e.copy=function(s,n){var p;if(r.util.isArray(s)){p=[];for(var f=0;f<s.length;++f)p.push(e.copy(s[f],n));return p}return typeof s=="string"?s:(p={tagClass:s.tagClass,type:s.type,constructed:s.constructed,composed:s.composed,value:e.copy(s.value,n)},n&&!n.excludeBitStringContents&&(p.bitStringContents=s.bitStringContents),p)},e.equals=function(s,n,p){if(r.util.isArray(s)){if(!r.util.isArray(n)||s.length!==n.length)return!1;for(var f=0;f<s.length;++f)if(!e.equals(s[f],n[f]))return!1;return!0}if(typeof s!=typeof n)return!1;if(typeof s=="string")return s===n;var E=s.tagClass===n.tagClass&&s.type===n.type&&s.constructed===n.constructed&&s.composed===n.composed&&e.equals(s.value,n.value);return p&&p.includeBitStringContents&&(E=E&&s.bitStringContents===n.bitStringContents),E},e.getBerValueLength=function(s){var n=s.getByte();if(n!==128){var p,f=n&128;return f?p=s.getInt((n&127)<<3):p=n,p}};function t(s,n,p){if(p>n){var f=new Error("Too few bytes to parse DER.");throw f.available=s.length(),f.remaining=n,f.requested=p,f}}var i=function(s,n){var p=s.getByte();if(n--,p!==128){var f,E=p&128;if(!E)f=p;else{var I=p&127;t(s,n,I),f=s.getInt(I<<3)}if(f<0)throw new Error("Negative length: "+f);return f}};e.fromDer=function(s,n){n===void 0&&(n={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof n=="boolean"&&(n={strict:n,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in n||(n.strict=!0),"parseAllBytes"in n||(n.parseAllBytes=!0),"decodeBitStrings"in n||(n.decodeBitStrings=!0),"maxDepth"in n||(n.maxDepth=e.maxDepth),typeof s=="string"&&(s=r.util.createBuffer(s));var p=s.length(),f=a(s,s.length(),0,n);if(n.parseAllBytes&&s.length()!==0){var E=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw E.byteCount=p,E.remaining=s.length(),E}return f};function a(s,n,p,f){if(p>=f.maxDepth)throw new Error("ASN.1 parsing error: Max depth exceeded.");var E;t(s,n,2);var I=s.getByte();n--;var B=I&192,l=I&31;E=s.length();var y=i(s,n);if(n-=E-s.length(),y!==void 0&&y>n){if(f.strict){var S=new Error("Too few bytes to read ASN.1 value.");throw S.available=s.length(),S.remaining=n,S.requested=y,S}y=n}var x,c,m=(I&32)===32;if(m)if(x=[],y===void 0)for(;;){if(t(s,n,2),s.bytes(2)==="\0\0"){s.getBytes(2),n-=2;break}E=s.length(),x.push(a(s,n,p+1,f)),n-=E-s.length()}else for(;y>0;)E=s.length(),x.push(a(s,y,p+1,f)),n-=E-s.length(),y-=E-s.length();if(x===void 0&&B===e.Class.UNIVERSAL&&l===e.Type.BITSTRING&&(c=s.bytes(y)),x===void 0&&f.decodeBitStrings&&B===e.Class.UNIVERSAL&&l===e.Type.BITSTRING&&y>1){var A=s.read,N=n,O=0;if(l===e.Type.BITSTRING&&(t(s,n,1),O=s.getByte(),n--),O===0)try{E=s.length();var C={strict:!0,decodeBitStrings:!0},h=a(s,n,p+1,C),u=E-s.length();n-=u,l==e.Type.BITSTRING&&u++;var _=h.tagClass;u===y&&(_===e.Class.UNIVERSAL||_===e.Class.CONTEXT_SPECIFIC)&&(x=[h])}catch{}x===void 0&&(s.read=A,n=N)}if(x===void 0){if(y===void 0){if(f.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");y=n}if(l===e.Type.BMPSTRING)for(x="";y>0;y-=2)t(s,n,2),x+=String.fromCharCode(s.getInt16()),n-=2;else x=s.getBytes(y),n-=y}var M=c===void 0?null:{bitStringContents:c};return e.create(B,l,m,x,M)}e.toDer=function(s){var n=r.util.createBuffer(),p=s.tagClass|s.type,f=r.util.createBuffer(),E=!1;if("bitStringContents"in s&&(E=!0,s.original&&(E=e.equals(s,s.original))),E)f.putBytes(s.bitStringContents);else if(s.composed){s.constructed?p|=32:f.putByte(0);for(var I=0;I<s.value.length;++I)s.value[I]!==void 0&&f.putBuffer(e.toDer(s.value[I]))}else if(s.type===e.Type.BMPSTRING)for(var I=0;I<s.value.length;++I)f.putInt16(s.value.charCodeAt(I));else s.type===e.Type.INTEGER&&s.value.length>1&&(s.value.charCodeAt(0)===0&&(s.value.charCodeAt(1)&128)===0||s.value.charCodeAt(0)===255&&(s.value.charCodeAt(1)&128)===128)?f.putBytes(s.value.substr(1)):f.putBytes(s.value);if(n.putByte(p),f.length()<=127)n.putByte(f.length()&127);else{var B=f.length(),l="";do l+=String.fromCharCode(B&255),B=B>>>8;while(B>0);n.putByte(l.length|128);for(var I=l.length-1;I>=0;--I)n.putByte(l.charCodeAt(I))}return n.putBuffer(f),n},e.oidToDer=function(s){var n=s.split("."),p=r.util.createBuffer();p.putByte(40*parseInt(n[0],10)+parseInt(n[1],10));for(var f,E,I,B,l=2;l<n.length;++l){if(f=!0,E=[],I=parseInt(n[l],10),I>4294967295)throw new Error("OID value too large; max is 32-bits.");do B=I&127,I=I>>>7,f||(B|=128),E.push(B),f=!1;while(I>0);for(var y=E.length-1;y>=0;--y)p.putByte(E[y])}return p},e.derToOid=function(s){var n;typeof s=="string"&&(s=r.util.createBuffer(s));var p=s.getByte();n=Math.floor(p/40)+"."+p%40;for(var f=0;s.length()>0;){if(f>70368744177663)throw new Error("OID value too large; max is 53-bits.");p=s.getByte(),f=f*128,p&128?f+=p&127:(n+="."+(f+p),f=0)}return n},e.utcTimeToDate=function(s){var n=new Date,p=parseInt(s.substr(0,2),10);p=p>=50?1900+p:2e3+p;var f=parseInt(s.substr(2,2),10)-1,E=parseInt(s.substr(4,2),10),I=parseInt(s.substr(6,2),10),B=parseInt(s.substr(8,2),10),l=0;if(s.length>11){var y=s.charAt(10),S=10;y!=="+"&&y!=="-"&&(l=parseInt(s.substr(10,2),10),S+=2)}if(n.setUTCFullYear(p,f,E),n.setUTCHours(I,B,l,0),S&&(y=s.charAt(S),y==="+"||y==="-")){var x=parseInt(s.substr(S+1,2),10),c=parseInt(s.substr(S+4,2),10),m=x*60+c;m*=6e4,y==="+"?n.setTime(+n-m):n.setTime(+n+m)}return n},e.generalizedTimeToDate=function(s){var n=new Date,p=parseInt(s.substr(0,4),10),f=parseInt(s.substr(4,2),10)-1,E=parseInt(s.substr(6,2),10),I=parseInt(s.substr(8,2),10),B=parseInt(s.substr(10,2),10),l=parseInt(s.substr(12,2),10),y=0,S=0,x=!1;s.charAt(s.length-1)==="Z"&&(x=!0);var c=s.length-5,m=s.charAt(c);if(m==="+"||m==="-"){var A=parseInt(s.substr(c+1,2),10),N=parseInt(s.substr(c+4,2),10);S=A*60+N,S*=6e4,m==="+"&&(S*=-1),x=!0}return s.charAt(14)==="."&&(y=parseFloat(s.substr(14),10)*1e3),x?(n.setUTCFullYear(p,f,E),n.setUTCHours(I,B,l,y),n.setTime(+n+S)):(n.setFullYear(p,f,E),n.setHours(I,B,l,y)),n},e.dateToUtcTime=function(s){if(typeof s=="string")return s;var n="",p=[];p.push((""+s.getUTCFullYear()).substr(2)),p.push(""+(s.getUTCMonth()+1)),p.push(""+s.getUTCDate()),p.push(""+s.getUTCHours()),p.push(""+s.getUTCMinutes()),p.push(""+s.getUTCSeconds());for(var f=0;f<p.length;++f)p[f].length<2&&(n+="0"),n+=p[f];return n+="Z",n},e.dateToGeneralizedTime=function(s){if(typeof s=="string")return s;var n="",p=[];p.push(""+s.getUTCFullYear()),p.push(""+(s.getUTCMonth()+1)),p.push(""+s.getUTCDate()),p.push(""+s.getUTCHours()),p.push(""+s.getUTCMinutes()),p.push(""+s.getUTCSeconds());for(var f=0;f<p.length;++f)p[f].length<2&&(n+="0"),n+=p[f];return n+="Z",n},e.integerToDer=function(s){var n=r.util.createBuffer();if(s>=-128&&s<128)return n.putSignedInt(s,8);if(s>=-32768&&s<32768)return n.putSignedInt(s,16);if(s>=-8388608&&s<8388608)return n.putSignedInt(s,24);if(s>=-2147483648&&s<2147483648)return n.putSignedInt(s,32);var p=new Error("Integer too large; max is 32-bits.");throw p.integer=s,p},e.derToInteger=function(s){typeof s=="string"&&(s=r.util.createBuffer(s));var n=s.length()*8;if(n>32)throw new Error("Integer too large; max is 32-bits.");return s.getSignedInt(n)},e.validate=function(s,n,p,f){var E=!1;if((s.tagClass===n.tagClass||typeof n.tagClass>"u")&&(s.type===n.type||typeof n.type>"u"))if(s.constructed===n.constructed||typeof n.constructed>"u"){if(E=!0,n.value&&r.util.isArray(n.value))for(var I=0,B=0;E&&B<n.value.length;++B){var l=n.value[B];E=!!l.optional;var y=s.value[I];if(!y){l.optional||(E=!1,f&&f.push("["+n.name+'] Missing required element. Expected tag class "'+l.tagClass+'", type "'+l.type+'"'));continue}var S=typeof l.tagClass<"u"&&typeof l.type<"u";if(S&&(y.tagClass!==l.tagClass||y.type!==l.type))if(l.optional){E=!0;continue}else{E=!1,f&&f.push("["+n.name+"] Tag mismatch. Expected ("+l.tagClass+","+l.type+"), got ("+y.tagClass+","+y.type+")");break}var x=e.validate(y,l,p,f);if(x)++I,E=!0;else if(l.optional)E=!0;else{E=!1;break}}if(E&&p&&(n.capture&&(p[n.capture]=s.value),n.captureAsn1&&(p[n.captureAsn1]=s),n.captureBitStringContents&&"bitStringContents"in s&&(p[n.captureBitStringContents]=s.bitStringContents),n.captureBitStringValue&&"bitStringContents"in s))if(s.bitStringContents.length<2)p[n.captureBitStringValue]="";else{var c=s.bitStringContents.charCodeAt(0);if(c!==0)throw new Error("captureBitStringValue only supported for zero unused bits");p[n.captureBitStringValue]=s.bitStringContents.slice(1)}}else f&&f.push("["+n.name+'] Expected constructed "'+n.constructed+'", got "'+s.constructed+'"');else f&&(s.tagClass!==n.tagClass&&f.push("["+n.name+'] Expected tag class "'+n.tagClass+'", got "'+s.tagClass+'"'),s.type!==n.type&&f.push("["+n.name+'] Expected type "'+n.type+'", got "'+s.type+'"'));return E};var o=/[^\\u0000-\\u00ff]/;return e.prettyPrint=function(s,n,p){var f="";n=n||0,p=p||2,n>0&&(f+=`
|
|
15
|
+
`);for(var E="",I=0;I<n*p;++I)E+=" ";switch(f+=E+"Tag: ",s.tagClass){case e.Class.UNIVERSAL:f+="Universal:";break;case e.Class.APPLICATION:f+="Application:";break;case e.Class.CONTEXT_SPECIFIC:f+="Context-Specific:";break;case e.Class.PRIVATE:f+="Private:";break}if(s.tagClass===e.Class.UNIVERSAL)switch(f+=s.type,s.type){case e.Type.NONE:f+=" (None)";break;case e.Type.BOOLEAN:f+=" (Boolean)";break;case e.Type.INTEGER:f+=" (Integer)";break;case e.Type.BITSTRING:f+=" (Bit string)";break;case e.Type.OCTETSTRING:f+=" (Octet string)";break;case e.Type.NULL:f+=" (Null)";break;case e.Type.OID:f+=" (Object Identifier)";break;case e.Type.ODESC:f+=" (Object Descriptor)";break;case e.Type.EXTERNAL:f+=" (External or Instance of)";break;case e.Type.REAL:f+=" (Real)";break;case e.Type.ENUMERATED:f+=" (Enumerated)";break;case e.Type.EMBEDDED:f+=" (Embedded PDV)";break;case e.Type.UTF8:f+=" (UTF8)";break;case e.Type.ROID:f+=" (Relative Object Identifier)";break;case e.Type.SEQUENCE:f+=" (Sequence)";break;case e.Type.SET:f+=" (Set)";break;case e.Type.PRINTABLESTRING:f+=" (Printable String)";break;case e.Type.IA5String:f+=" (IA5String (ASCII))";break;case e.Type.UTCTIME:f+=" (UTC time)";break;case e.Type.GENERALIZEDTIME:f+=" (Generalized time)";break;case e.Type.BMPSTRING:f+=" (BMP String)";break}else f+=s.type;if(f+=`
|
|
16
|
+
`,f+=E+"Constructed: "+s.constructed+`
|
|
17
|
+
`,s.composed){for(var B=0,l="",I=0;I<s.value.length;++I)s.value[I]!==void 0&&(B+=1,l+=e.prettyPrint(s.value[I],n+1,p),I+1<s.value.length&&(l+=","));f+=E+"Sub values: "+B+l}else{if(f+=E+"Value: ",s.type===e.Type.OID){var y=e.derToOid(s.value);f+=y,r.pki&&r.pki.oids&&y in r.pki.oids&&(f+=" ("+r.pki.oids[y]+") ")}if(s.type===e.Type.INTEGER)try{f+=e.derToInteger(s.value)}catch{f+="0x"+r.util.bytesToHex(s.value)}else if(s.type===e.Type.BITSTRING){if(s.value.length>1?f+="0x"+r.util.bytesToHex(s.value.slice(1)):f+="(none)",s.value.length>0){var S=s.value.charCodeAt(0);S==1?f+=" (1 unused bit shown)":S>1&&(f+=" ("+S+" unused bits shown)")}}else if(s.type===e.Type.OCTETSTRING)o.test(s.value)||(f+="("+s.value+") "),f+="0x"+r.util.bytesToHex(s.value);else if(s.type===e.Type.UTF8)try{f+=r.util.decodeUtf8(s.value)}catch(x){if(x.message==="URI malformed")f+="0x"+r.util.bytesToHex(s.value)+" (malformed UTF8)";else throw x}else s.type===e.Type.PRINTABLESTRING||s.type===e.Type.IA5String?f+=s.value:o.test(s.value)?f+="0x"+r.util.bytesToHex(s.value):s.value.length===0?f+="[null]":f+=s.value}return f},rc.exports}var nc={exports:{}},ac,hh;function Ar(){if(hh)return ac;hh=1;var r=Ge();return ac=r.md=r.md||{},r.md.algorithms=r.md.algorithms||{},ac}var ph;function Fn(){if(ph)return nc.exports;ph=1;var r=Ge();Ar(),We();var e=nc.exports=r.hmac=r.hmac||{};return e.create=function(){var t=null,i=null,a=null,o=null,s={};return s.start=function(n,p){if(n!==null)if(typeof n=="string")if(n=n.toLowerCase(),n in r.md.algorithms)i=r.md.algorithms[n].create();else throw new Error('Unknown hash algorithm "'+n+'"');else i=n;if(p===null)p=t;else{if(typeof p=="string")p=r.util.createBuffer(p);else if(r.util.isArray(p)){var f=p;p=r.util.createBuffer();for(var E=0;E<f.length;++E)p.putByte(f[E])}var I=p.length();I>i.blockLength&&(i.start(),i.update(p.bytes()),p=i.digest()),a=r.util.createBuffer(),o=r.util.createBuffer(),I=p.length();for(var E=0;E<I;++E){var f=p.at(E);a.putByte(54^f),o.putByte(92^f)}if(I<i.blockLength)for(var f=i.blockLength-I,E=0;E<f;++E)a.putByte(54),o.putByte(92);t=p,a=a.bytes(),o=o.bytes()}i.start(),i.update(a)},s.update=function(n){i.update(n)},s.getMac=function(){var n=i.digest().bytes();return i.start(),i.update(o),i.update(n),i.digest()},s.digest=s.getMac,s},nc.exports}var sc={exports:{}},dh;function oc(){if(dh)return sc.exports;dh=1;var r=Ge();Ar(),We();var e=sc.exports=r.md5=r.md5||{};r.md.md5=r.md.algorithms.md5=e,e.create=function(){s||n();var f=null,E=r.util.createBuffer(),I=new Array(16),B={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return B.start=function(){B.messageLength=0,B.fullMessageLength=B.messageLength64=[];for(var l=B.messageLengthSize/4,y=0;y<l;++y)B.fullMessageLength.push(0);return E=r.util.createBuffer(),f={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},B},B.start(),B.update=function(l,y){y==="utf8"&&(l=r.util.encodeUtf8(l));var S=l.length;B.messageLength+=S,S=[S/4294967296>>>0,S>>>0];for(var x=B.fullMessageLength.length-1;x>=0;--x)B.fullMessageLength[x]+=S[1],S[1]=S[0]+(B.fullMessageLength[x]/4294967296>>>0),B.fullMessageLength[x]=B.fullMessageLength[x]>>>0,S[0]=S[1]/4294967296>>>0;return E.putBytes(l),p(f,I,E),(E.read>2048||E.length()===0)&&E.compact(),B},B.digest=function(){var l=r.util.createBuffer();l.putBytes(E.bytes());var y=B.fullMessageLength[B.fullMessageLength.length-1]+B.messageLengthSize,S=y&B.blockLength-1;l.putBytes(t.substr(0,B.blockLength-S));for(var x,c=0,m=B.fullMessageLength.length-1;m>=0;--m)x=B.fullMessageLength[m]*8+c,c=x/4294967296>>>0,l.putInt32Le(x>>>0);var A={h0:f.h0,h1:f.h1,h2:f.h2,h3:f.h3};p(A,I,l);var N=r.util.createBuffer();return N.putInt32Le(A.h0),N.putInt32Le(A.h1),N.putInt32Le(A.h2),N.putInt32Le(A.h3),N},B};var t=null,i=null,a=null,o=null,s=!1;function n(){t="\x80",t+=r.util.fillString("\0",64),i=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],a=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],o=new Array(64);for(var f=0;f<64;++f)o[f]=Math.floor(Math.abs(Math.sin(f+1))*4294967296);s=!0}function p(f,E,I){for(var B,l,y,S,x,c,m,A,N=I.length();N>=64;){for(l=f.h0,y=f.h1,S=f.h2,x=f.h3,A=0;A<16;++A)E[A]=I.getInt32Le(),c=x^y&(S^x),B=l+c+o[A]+E[A],m=a[A],l=x,x=S,S=y,y+=B<<m|B>>>32-m;for(;A<32;++A)c=S^x&(y^S),B=l+c+o[A]+E[i[A]],m=a[A],l=x,x=S,S=y,y+=B<<m|B>>>32-m;for(;A<48;++A)c=y^S^x,B=l+c+o[A]+E[i[A]],m=a[A],l=x,x=S,S=y,y+=B<<m|B>>>32-m;for(;A<64;++A)c=S^(y|~x),B=l+c+o[A]+E[i[A]],m=a[A],l=x,x=S,S=y,y+=B<<m|B>>>32-m;f.h0=f.h0+l|0,f.h1=f.h1+y|0,f.h2=f.h2+S|0,f.h3=f.h3+x|0,N-=64}}return sc.exports}var uc={exports:{}},yh;function Vi(){if(yh)return uc.exports;yh=1;var r=Ge();We();var e=uc.exports=r.pem=r.pem||{};e.encode=function(a,o){o=o||{};var s="-----BEGIN "+a.type+`-----\r
|
|
18
|
+
`,n;if(a.procType&&(n={name:"Proc-Type",values:[String(a.procType.version),a.procType.type]},s+=t(n)),a.contentDomain&&(n={name:"Content-Domain",values:[a.contentDomain]},s+=t(n)),a.dekInfo&&(n={name:"DEK-Info",values:[a.dekInfo.algorithm]},a.dekInfo.parameters&&n.values.push(a.dekInfo.parameters),s+=t(n)),a.headers)for(var p=0;p<a.headers.length;++p)s+=t(a.headers[p]);return a.procType&&(s+=`\r
|
|
19
|
+
`),s+=r.util.encode64(a.body,o.maxline||64)+`\r
|
|
20
|
+
`,s+="-----END "+a.type+`-----\r
|
|
21
|
+
`,s},e.decode=function(a){for(var o=[],s=/\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^:]+)/,p=/\r?\n/,f;f=s.exec(a),!!f;){var E=f[1];E==="NEW CERTIFICATE REQUEST"&&(E="CERTIFICATE REQUEST");var I={type:E,procType:null,contentDomain:null,dekInfo:null,headers:[],body:r.util.decode64(f[3])};if(o.push(I),!!f[2]){for(var B=f[2].split(p),l=0;f&&l<B.length;){for(var y=B[l].replace(/\s+$/,""),S=l+1;S<B.length;++S){var x=B[S];if(!/\s/.test(x[0]))break;y+=x,l=S}if(f=y.match(n),f){for(var c={name:f[1],values:[]},m=f[2].split(","),A=0;A<m.length;++A)c.values.push(i(m[A]));if(I.procType)if(!I.contentDomain&&c.name==="Content-Domain")I.contentDomain=m[0]||"";else if(!I.dekInfo&&c.name==="DEK-Info"){if(c.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');I.dekInfo={algorithm:m[0],parameters:m[1]||null}}else I.headers.push(c);else{if(c.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(c.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');I.procType={version:m[0],type:m[1]}}}++l}if(I.procType==="ENCRYPTED"&&!I.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(o.length===0)throw new Error("Invalid PEM formatted message.");return o};function t(a){for(var o=a.name+": ",s=[],n=function(B,l){return" "+l},p=0;p<a.values.length;++p)s.push(a.values[p].replace(/^(\S+\r\n)/,n));o+=s.join(",")+`\r
|
|
22
|
+
`;for(var f=0,E=-1,p=0;p<o.length;++p,++f)if(f>65&&E!==-1){var I=o[E];I===","?(++E,o=o.substr(0,E)+`\r
|
|
23
|
+
`+o.substr(E)):o=o.substr(0,E)+`\r
|
|
24
|
+
`+I+o.substr(E+1),f=p-E-1,E=-1,++p}else(o[p]===" "||o[p]===" "||o[p]===",")&&(E=p);return o}function i(a){return a.replace(/^\s+/,"")}return uc.exports}var cc={exports:{}},lc,vh;function Es(){if(vh)return lc;vh=1;var r=Ge();Ju(),uh(),We(),lc=r.des=r.des||{},r.des.startEncrypting=function(l,y,S,x){var c=B({key:l,output:S,decrypt:!1,mode:x||(y===null?"ECB":"CBC")});return c.start(y),c},r.des.createEncryptionCipher=function(l,y){return B({key:l,output:null,decrypt:!1,mode:y})},r.des.startDecrypting=function(l,y,S,x){var c=B({key:l,output:S,decrypt:!0,mode:x||(y===null?"ECB":"CBC")});return c.start(y),c},r.des.createDecryptionCipher=function(l,y){return B({key:l,output:null,decrypt:!0,mode:y})},r.des.Algorithm=function(l,y){var S=this;S.name=l,S.mode=new y({blockSize:8,cipher:{encrypt:function(x,c){return I(S._keys,x,c,!1)},decrypt:function(x,c){return I(S._keys,x,c,!0)}}}),S._init=!1},r.des.Algorithm.prototype.initialize=function(l){if(!this._init){var y=r.util.createBuffer(l.key);if(this.name.indexOf("3DES")===0&&y.length()!==24)throw new Error("Invalid Triple-DES key size: "+y.length()*8);this._keys=E(y),this._init=!0}},e("DES-ECB",r.cipher.modes.ecb),e("DES-CBC",r.cipher.modes.cbc),e("DES-CFB",r.cipher.modes.cfb),e("DES-OFB",r.cipher.modes.ofb),e("DES-CTR",r.cipher.modes.ctr),e("3DES-ECB",r.cipher.modes.ecb),e("3DES-CBC",r.cipher.modes.cbc),e("3DES-CFB",r.cipher.modes.cfb),e("3DES-OFB",r.cipher.modes.ofb),e("3DES-CTR",r.cipher.modes.ctr);function e(l,y){var S=function(){return new r.des.Algorithm(l,y)};r.cipher.registerAlgorithm(l,S)}var t=[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],i=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],a=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],o=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],s=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],n=[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],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],f=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function E(l){for(var y=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],S=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],x=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],c=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],m=[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],N=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],O=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],C=[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],u=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],_=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],M=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],G=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],F=l.length()>8?3:1,z=[],J=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],X=0,te,ue=0;ue<F;ue++){var pe=l.getInt32(),ge=l.getInt32();te=(pe>>>4^ge)&252645135,ge^=te,pe^=te<<4,te=(ge>>>-16^pe)&65535,pe^=te,ge^=te<<-16,te=(pe>>>2^ge)&858993459,ge^=te,pe^=te<<2,te=(ge>>>-16^pe)&65535,pe^=te,ge^=te<<-16,te=(pe>>>1^ge)&1431655765,ge^=te,pe^=te<<1,te=(ge>>>8^pe)&16711935,pe^=te,ge^=te<<8,te=(pe>>>1^ge)&1431655765,ge^=te,pe^=te<<1,te=pe<<8|ge>>>20&240,pe=ge<<24|ge<<8&16711680|ge>>>8&65280|ge>>>24&240,ge=te;for(var ke=0;ke<J.length;++ke){J[ke]?(pe=pe<<2|pe>>>26,ge=ge<<2|ge>>>26):(pe=pe<<1|pe>>>27,ge=ge<<1|ge>>>27),pe&=-15,ge&=-15;var Ne=y[pe>>>28]|S[pe>>>24&15]|x[pe>>>20&15]|c[pe>>>16&15]|m[pe>>>12&15]|A[pe>>>8&15]|N[pe>>>4&15],Le=O[ge>>>28]|C[ge>>>24&15]|h[ge>>>20&15]|u[ge>>>16&15]|_[ge>>>12&15]|M[ge>>>8&15]|G[ge>>>4&15];te=(Le>>>16^Ne)&65535,z[X++]=Ne^te,z[X++]=Le^te<<16}}return z}function I(l,y,S,x){var c=l.length===32?3:9,m;c===3?m=x?[30,-2,-2]:[0,32,2]:m=x?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var A,N=y[0],O=y[1];A=(N>>>4^O)&252645135,O^=A,N^=A<<4,A=(N>>>16^O)&65535,O^=A,N^=A<<16,A=(O>>>2^N)&858993459,N^=A,O^=A<<2,A=(O>>>8^N)&16711935,N^=A,O^=A<<8,A=(N>>>1^O)&1431655765,O^=A,N^=A<<1,N=N<<1|N>>>31,O=O<<1|O>>>31;for(var C=0;C<c;C+=3){for(var h=m[C+1],u=m[C+2],_=m[C];_!=h;_+=u){var M=O^l[_],G=(O>>>4|O<<28)^l[_+1];A=N,N=O,O=A^(i[M>>>24&63]|o[M>>>16&63]|n[M>>>8&63]|f[M&63]|t[G>>>24&63]|a[G>>>16&63]|s[G>>>8&63]|p[G&63])}A=N,N=O,O=A}N=N>>>1|N<<31,O=O>>>1|O<<31,A=(N>>>1^O)&1431655765,O^=A,N^=A<<1,A=(O>>>8^N)&16711935,N^=A,O^=A<<8,A=(O>>>2^N)&858993459,N^=A,O^=A<<2,A=(N>>>16^O)&65535,O^=A,N^=A<<16,A=(N>>>4^O)&252645135,O^=A,N^=A<<4,S[0]=N,S[1]=O}function B(l){l=l||{};var y=(l.mode||"CBC").toUpperCase(),S="DES-"+y,x;l.decrypt?x=r.cipher.createDecipher(S,l.key):x=r.cipher.createCipher(S,l.key);var c=x.start;return x.start=function(m,A){var N=null;A instanceof r.util.ByteBuffer&&(N=A,A={}),A=A||{},A.output=N,A.iv=m,c.call(x,A)},x}return lc}var ay={},sy=Object.freeze({__proto__:null,default:ay}),fc=fp(sy),hc,gh;function pc(){if(gh)return hc;gh=1;var r=Ge();Fn(),Ar(),We();var e=r.pkcs5=r.pkcs5||{},t;return r.util.isNodejs&&!r.options.usePureJavaScript&&(t=fc),hc=r.pbkdf2=e.pbkdf2=function(i,a,o,s,n,p){if(typeof n=="function"&&(p=n,n=null),r.util.isNodejs&&!r.options.usePureJavaScript&&t.pbkdf2&&(n===null||typeof n!="object")&&(t.pbkdf2Sync.length>4||!n||n==="sha1"))return typeof n!="string"&&(n="sha1"),i=Buffer.from(i,"binary"),a=Buffer.from(a,"binary"),p?t.pbkdf2Sync.length===4?t.pbkdf2(i,a,o,s,function(C,h){if(C)return p(C);p(null,h.toString("binary"))}):t.pbkdf2(i,a,o,s,n,function(C,h){if(C)return p(C);p(null,h.toString("binary"))}):t.pbkdf2Sync.length===4?t.pbkdf2Sync(i,a,o,s).toString("binary"):t.pbkdf2Sync(i,a,o,s,n).toString("binary");if((typeof n>"u"||n===null)&&(n="sha1"),typeof n=="string"){if(!(n in r.md.algorithms))throw new Error("Unknown hash algorithm: "+n);n=r.md[n].create()}var f=n.digestLength;if(s>4294967295*f){var E=new Error("Derived key is too long.");if(p)return p(E);throw E}var I=Math.ceil(s/f),B=s-(I-1)*f,l=r.hmac.create();l.start(n,i);var y="",S,x,c;if(!p){for(var m=1;m<=I;++m){l.start(null,null),l.update(a),l.update(r.util.int32ToBytes(m)),S=c=l.digest().getBytes();for(var A=2;A<=o;++A)l.start(null,null),l.update(c),x=l.digest().getBytes(),S=r.util.xorBytes(S,x,f),c=x;y+=m<I?S:S.substr(0,B)}return y}var m=1,A;function N(){if(m>I)return p(null,y);l.start(null,null),l.update(a),l.update(r.util.int32ToBytes(m)),S=c=l.digest().getBytes(),A=2,O()}function O(){if(A<=o)return l.start(null,null),l.update(c),x=l.digest().getBytes(),S=r.util.xorBytes(S,x,f),c=x,++A,r.util.setImmediate(O);y+=m<I?S:S.substr(0,B),++m,N()}N()},hc}var bs={exports:{}},dc={exports:{}},mh;function Ch(){if(mh)return dc.exports;mh=1;var r=Ge();Ar(),We();var e=dc.exports=r.sha256=r.sha256||{};r.md.sha256=r.md.algorithms.sha256=e,e.create=function(){i||o();var n=null,p=r.util.createBuffer(),f=new Array(64),E={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return E.start=function(){E.messageLength=0,E.fullMessageLength=E.messageLength64=[];for(var I=E.messageLengthSize/4,B=0;B<I;++B)E.fullMessageLength.push(0);return p=r.util.createBuffer(),n={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},E},E.start(),E.update=function(I,B){B==="utf8"&&(I=r.util.encodeUtf8(I));var l=I.length;E.messageLength+=l,l=[l/4294967296>>>0,l>>>0];for(var y=E.fullMessageLength.length-1;y>=0;--y)E.fullMessageLength[y]+=l[1],l[1]=l[0]+(E.fullMessageLength[y]/4294967296>>>0),E.fullMessageLength[y]=E.fullMessageLength[y]>>>0,l[0]=l[1]/4294967296>>>0;return p.putBytes(I),s(n,f,p),(p.read>2048||p.length()===0)&&p.compact(),E},E.digest=function(){var I=r.util.createBuffer();I.putBytes(p.bytes());var B=E.fullMessageLength[E.fullMessageLength.length-1]+E.messageLengthSize,l=B&E.blockLength-1;I.putBytes(t.substr(0,E.blockLength-l));for(var y,S,x=E.fullMessageLength[0]*8,c=0;c<E.fullMessageLength.length-1;++c)y=E.fullMessageLength[c+1]*8,S=y/4294967296>>>0,x+=S,I.putInt32(x>>>0),x=y>>>0;I.putInt32(x);var m={h0:n.h0,h1:n.h1,h2:n.h2,h3:n.h3,h4:n.h4,h5:n.h5,h6:n.h6,h7:n.h7};s(m,f,I);var A=r.util.createBuffer();return A.putInt32(m.h0),A.putInt32(m.h1),A.putInt32(m.h2),A.putInt32(m.h3),A.putInt32(m.h4),A.putInt32(m.h5),A.putInt32(m.h6),A.putInt32(m.h7),A},E};var t=null,i=!1,a=null;function o(){t="\x80",t+=r.util.fillString("\0",64),a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],i=!0}function s(n,p,f){for(var E,I,B,l,y,S,x,c,m,A,N,O,C,h,u,_=f.length();_>=64;){for(x=0;x<16;++x)p[x]=f.getInt32();for(;x<64;++x)E=p[x-2],E=(E>>>17|E<<15)^(E>>>19|E<<13)^E>>>10,I=p[x-15],I=(I>>>7|I<<25)^(I>>>18|I<<14)^I>>>3,p[x]=E+p[x-7]+I+p[x-16]|0;for(c=n.h0,m=n.h1,A=n.h2,N=n.h3,O=n.h4,C=n.h5,h=n.h6,u=n.h7,x=0;x<64;++x)l=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7),y=h^O&(C^h),B=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),S=c&m|A&(c^m),E=u+l+y+a[x]+p[x],I=B+S,u=h,h=C,C=O,O=N+E>>>0,N=A,A=m,m=c,c=E+I>>>0;n.h0=n.h0+c|0,n.h1=n.h1+m|0,n.h2=n.h2+A|0,n.h3=n.h3+N|0,n.h4=n.h4+O|0,n.h5=n.h5+C|0,n.h6=n.h6+h|0,n.h7=n.h7+u|0,_-=64}}return dc.exports}var yc={exports:{}},xh;function Sh(){if(xh)return yc.exports;xh=1;var r=Ge();We();var e=null;r.util.isNodejs&&!r.options.usePureJavaScript&&!process.versions["node-webkit"]&&(e=fc);var t=yc.exports=r.prng=r.prng||{};return t.create=function(i){for(var a={plugin:i,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},o=i.md,s=new Array(32),n=0;n<32;++n)s[n]=o.create();a.pools=s,a.pool=0,a.generate=function(B,l){if(!l)return a.generateSync(B);var y=a.plugin.cipher,S=a.plugin.increment,x=a.plugin.formatKey,c=a.plugin.formatSeed,m=r.util.createBuffer();a.key=null,A();function A(N){if(N)return l(N);if(m.length()>=B)return l(null,m.getBytes(B));if(a.generated>1048575&&(a.key=null),a.key===null)return r.util.nextTick(function(){p(A)});var O=y(a.key,a.seed);a.generated+=O.length,m.putBytes(O),a.key=x(y(a.key,S(a.seed))),a.seed=c(y(a.key,a.seed)),r.util.setImmediate(A)}},a.generateSync=function(B){var l=a.plugin.cipher,y=a.plugin.increment,S=a.plugin.formatKey,x=a.plugin.formatSeed;a.key=null;for(var c=r.util.createBuffer();c.length()<B;){a.generated>1048575&&(a.key=null),a.key===null&&f();var m=l(a.key,a.seed);a.generated+=m.length,c.putBytes(m),a.key=S(l(a.key,y(a.seed))),a.seed=x(l(a.key,a.seed))}return c.getBytes(B)};function p(B){if(a.pools[0].messageLength>=32)return E(),B();var l=32-a.pools[0].messageLength<<5;a.seedFile(l,function(y,S){if(y)return B(y);a.collect(S),E(),B()})}function f(){if(a.pools[0].messageLength>=32)return E();var B=32-a.pools[0].messageLength<<5;a.collect(a.seedFileSync(B)),E()}function E(){a.reseeds=a.reseeds===4294967295?0:a.reseeds+1;var B=a.plugin.md.create();B.update(a.keyBytes);for(var l=1,y=0;y<32;++y)a.reseeds%l===0&&(B.update(a.pools[y].digest().getBytes()),a.pools[y].start()),l=l<<1;a.keyBytes=B.digest().getBytes(),B.start(),B.update(a.keyBytes);var S=B.digest().getBytes();a.key=a.plugin.formatKey(a.keyBytes),a.seed=a.plugin.formatSeed(S),a.generated=0}function I(B){var l=null,y=r.util.globalScope,S=y.crypto||y.msCrypto;S&&S.getRandomValues&&(l=function(u){return S.getRandomValues(u)});var x=r.util.createBuffer();if(l)for(;x.length()<B;){var c=Math.max(1,Math.min(B-x.length(),65536)/4),m=new Uint32Array(Math.floor(c));try{l(m);for(var A=0;A<m.length;++A)x.putInt32(m[A])}catch(u){if(!(typeof QuotaExceededError<"u"&&u instanceof QuotaExceededError))throw u}}if(x.length()<B)for(var N,O,C,h=Math.floor(Math.random()*65536);x.length()<B;){O=16807*(h&65535),N=16807*(h>>16),O+=(N&32767)<<16,O+=N>>15,O=(O&2147483647)+(O>>31),h=O&4294967295;for(var A=0;A<3;++A)C=h>>>(A<<3),C^=Math.floor(Math.random()*256),x.putByte(C&255)}return x.getBytes(B)}return e?(a.seedFile=function(B,l){e.randomBytes(B,function(y,S){if(y)return l(y);l(null,S.toString())})},a.seedFileSync=function(B){return e.randomBytes(B).toString()}):(a.seedFile=function(B,l){try{l(null,I(B))}catch(y){l(y)}},a.seedFileSync=I),a.collect=function(B){for(var l=B.length,y=0;y<l;++y)a.pools[a.pool].update(B.substr(y,1)),a.pool=a.pool===31?0:a.pool+1},a.collectInt=function(B,l){for(var y="",S=0;S<l;S+=8)y+=String.fromCharCode(B>>S&255);a.collect(y)},a.registerWorker=function(B){if(B===self)a.seedFile=function(y,S){function x(c){var m=c.data;m.forge&&m.forge.prng&&(self.removeEventListener("message",x),S(m.forge.prng.err,m.forge.prng.bytes))}self.addEventListener("message",x),self.postMessage({forge:{prng:{needed:y}}})};else{var l=function(y){var S=y.data;S.forge&&S.forge.prng&&a.seedFile(S.forge.prng.needed,function(x,c){B.postMessage({forge:{prng:{err:x,bytes:c}}})})};B.addEventListener("message",l)}},a},yc.exports}var Eh;function rr(){if(Eh)return bs.exports;Eh=1;var r=Ge();return ai(),Ch(),Sh(),We(),(function(){if(r.random&&r.random.getBytes){bs.exports=r.random;return}(function(e){var t={},i=new Array(4),a=r.util.createBuffer();t.formatKey=function(B){var l=r.util.createBuffer(B);return B=new Array(4),B[0]=l.getInt32(),B[1]=l.getInt32(),B[2]=l.getInt32(),B[3]=l.getInt32(),r.aes._expandKey(B,!1)},t.formatSeed=function(B){var l=r.util.createBuffer(B);return B=new Array(4),B[0]=l.getInt32(),B[1]=l.getInt32(),B[2]=l.getInt32(),B[3]=l.getInt32(),B},t.cipher=function(B,l){return r.aes._updateBlock(B,l,i,!1),a.putInt32(i[0]),a.putInt32(i[1]),a.putInt32(i[2]),a.putInt32(i[3]),a.getBytes()},t.increment=function(B){return++B[3],B},t.md=r.md.sha256;function o(){var B=r.prng.create(t);return B.getBytes=function(l,y){return B.generate(l,y)},B.getBytesSync=function(l){return B.generate(l)},B}var s=o(),n=null,p=r.util.globalScope,f=p.crypto||p.msCrypto;if(f&&f.getRandomValues&&(n=function(B){return f.getRandomValues(B)}),r.options.usePureJavaScript||!r.util.isNodejs&&!n){if(s.collectInt(+new Date,32),typeof navigator<"u"){var E="";for(var I in navigator)try{typeof navigator[I]=="string"&&(E+=navigator[I])}catch{}s.collect(E),E=null}e&&(e().mousemove(function(B){s.collectInt(B.clientX,16),s.collectInt(B.clientY,16)}),e().keypress(function(B){s.collectInt(B.charCode,8)}))}if(!r.random)r.random=s;else for(var I in s)r.random[I]=s[I];r.random.createInstance=o,bs.exports=r.random})(typeof jQuery<"u"?jQuery:null)})(),bs.exports}var vc,bh;function Ah(){if(bh)return vc;bh=1;var r=Ge();We();var e=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],t=[1,2,3,5],i=function(s,n){return s<<n&65535|(s&65535)>>16-n},a=function(s,n){return(s&65535)>>n|s<<16-n&65535};vc=r.rc2=r.rc2||{},r.rc2.expandKey=function(s,n){typeof s=="string"&&(s=r.util.createBuffer(s)),n=n||128;var p=s,f=s.length(),E=n,I=Math.ceil(E/8),B=255>>(E&7),l;for(l=f;l<128;l++)p.putByte(e[p.at(l-1)+p.at(l-f)&255]);for(p.setAt(128-I,e[p.at(128-I)&B]),l=127-I;l>=0;l--)p.setAt(l,e[p.at(l+1)^p.at(l+I)]);return p};var o=function(s,n,p){var f=!1,E=null,I=null,B=null,l,y,S,x,c=[];for(s=r.rc2.expandKey(s,n),S=0;S<64;S++)c.push(s.getInt16Le());p?(l=function(N){for(S=0;S<4;S++)N[S]+=c[x]+(N[(S+3)%4]&N[(S+2)%4])+(~N[(S+3)%4]&N[(S+1)%4]),N[S]=i(N[S],t[S]),x++},y=function(N){for(S=0;S<4;S++)N[S]+=c[N[(S+3)%4]&63]}):(l=function(N){for(S=3;S>=0;S--)N[S]=a(N[S],t[S]),N[S]-=c[x]+(N[(S+3)%4]&N[(S+2)%4])+(~N[(S+3)%4]&N[(S+1)%4]),x--},y=function(N){for(S=3;S>=0;S--)N[S]-=c[N[(S+3)%4]&63]});var m=function(N){var O=[];for(S=0;S<4;S++){var C=E.getInt16Le();B!==null&&(p?C^=B.getInt16Le():B.putInt16Le(C)),O.push(C&65535)}x=p?0:63;for(var h=0;h<N.length;h++)for(var u=0;u<N[h][0];u++)N[h][1](O);for(S=0;S<4;S++)B!==null&&(p?B.putInt16Le(O[S]):O[S]^=B.getInt16Le()),I.putInt16Le(O[S])},A=null;return A={start:function(N,O){N&&typeof N=="string"&&(N=r.util.createBuffer(N)),f=!1,E=r.util.createBuffer(),I=O||new r.util.createBuffer,B=N,A.output=I},update:function(N){for(f||E.putBuffer(N);E.length()>=8;)m([[5,l],[1,y],[6,l],[1,y],[5,l]])},finish:function(N){var O=!0;if(p)if(N)O=N(8,E,!p);else{var C=E.length()===8?8:8-E.length();E.fillWithByte(C,C)}if(O&&(f=!0,A.update()),!p&&(O=E.length()===0,O))if(N)O=N(8,I,!p);else{var h=I.length(),u=I.at(h-1);u>h?O=!1:I.truncate(u)}return O}},A};return r.rc2.startEncrypting=function(s,n,p){var f=r.rc2.createEncryptionCipher(s,128);return f.start(n,p),f},r.rc2.createEncryptionCipher=function(s,n){return o(s,n,!0)},r.rc2.startDecrypting=function(s,n,p){var f=r.rc2.createDecryptionCipher(s,128);return f.start(n,p),f},r.rc2.createDecryptionCipher=function(s,n){return o(s,n,!1)},vc}var gc,Bh;function As(){if(Bh)return gc;Bh=1;var r=Ge();gc=r.jsbn=r.jsbn||{};var e;function t(T,U,K){this.data=[],T!=null&&(typeof T=="number"?this.fromNumber(T,U,K):U==null&&typeof T!="string"?this.fromString(T,256):this.fromString(T,U))}r.jsbn.BigInteger=t;function i(){return new t(null)}function a(T,U,K,Y,oe,le){for(;--le>=0;){var Be=U*this.data[T++]+K.data[Y]+oe;oe=Math.floor(Be/67108864),K.data[Y++]=Be&67108863}return oe}function o(T,U,K,Y,oe,le){for(var Be=U&32767,Se=U>>15;--le>=0;){var Je=this.data[T]&32767,Et=this.data[T++]>>15,Qt=Se*Je+Et*Be;Je=Be*Je+((Qt&32767)<<15)+K.data[Y]+(oe&1073741823),oe=(Je>>>30)+(Qt>>>15)+Se*Et+(oe>>>30),K.data[Y++]=Je&1073741823}return oe}function s(T,U,K,Y,oe,le){for(var Be=U&16383,Se=U>>14;--le>=0;){var Je=this.data[T]&16383,Et=this.data[T++]>>14,Qt=Se*Je+Et*Be;Je=Be*Je+((Qt&16383)<<14)+K.data[Y]+oe,oe=(Je>>28)+(Qt>>14)+Se*Et,K.data[Y++]=Je&268435455}return oe}typeof navigator>"u"?(t.prototype.am=s,e=28):navigator.appName=="Microsoft Internet Explorer"?(t.prototype.am=o,e=30):navigator.appName!="Netscape"?(t.prototype.am=a,e=26):(t.prototype.am=s,e=28),t.prototype.DB=e,t.prototype.DM=(1<<e)-1,t.prototype.DV=1<<e;var n=52;t.prototype.FV=Math.pow(2,n),t.prototype.F1=n-e,t.prototype.F2=2*e-n;var p="0123456789abcdefghijklmnopqrstuvwxyz",f=new Array,E,I;for(E=48,I=0;I<=9;++I)f[E++]=I;for(E=97,I=10;I<36;++I)f[E++]=I;for(E=65,I=10;I<36;++I)f[E++]=I;function B(T){return p.charAt(T)}function l(T,U){var K=f[T.charCodeAt(U)];return K??-1}function y(T){for(var U=this.t-1;U>=0;--U)T.data[U]=this.data[U];T.t=this.t,T.s=this.s}function S(T){this.t=1,this.s=T<0?-1:0,T>0?this.data[0]=T:T<-1?this.data[0]=T+this.DV:this.t=0}function x(T){var U=i();return U.fromInt(T),U}function c(T,U){var K;if(U==16)K=4;else if(U==8)K=3;else if(U==256)K=8;else if(U==2)K=1;else if(U==32)K=5;else if(U==4)K=2;else{this.fromRadix(T,U);return}this.t=0,this.s=0;for(var Y=T.length,oe=!1,le=0;--Y>=0;){var Be=K==8?T[Y]&255:l(T,Y);if(Be<0){T.charAt(Y)=="-"&&(oe=!0);continue}oe=!1,le==0?this.data[this.t++]=Be:le+K>this.DB?(this.data[this.t-1]|=(Be&(1<<this.DB-le)-1)<<le,this.data[this.t++]=Be>>this.DB-le):this.data[this.t-1]|=Be<<le,le+=K,le>=this.DB&&(le-=this.DB)}K==8&&(T[0]&128)!=0&&(this.s=-1,le>0&&(this.data[this.t-1]|=(1<<this.DB-le)-1<<le)),this.clamp(),oe&&t.ZERO.subTo(this,this)}function m(){for(var T=this.s&this.DM;this.t>0&&this.data[this.t-1]==T;)--this.t}function A(T){if(this.s<0)return"-"+this.negate().toString(T);var U;if(T==16)U=4;else if(T==8)U=3;else if(T==2)U=1;else if(T==32)U=5;else if(T==4)U=2;else return this.toRadix(T);var K=(1<<U)-1,Y,oe=!1,le="",Be=this.t,Se=this.DB-Be*this.DB%U;if(Be-- >0)for(Se<this.DB&&(Y=this.data[Be]>>Se)>0&&(oe=!0,le=B(Y));Be>=0;)Se<U?(Y=(this.data[Be]&(1<<Se)-1)<<U-Se,Y|=this.data[--Be]>>(Se+=this.DB-U)):(Y=this.data[Be]>>(Se-=U)&K,Se<=0&&(Se+=this.DB,--Be)),Y>0&&(oe=!0),oe&&(le+=B(Y));return oe?le:"0"}function N(){var T=i();return t.ZERO.subTo(this,T),T}function O(){return this.s<0?this.negate():this}function C(T){var U=this.s-T.s;if(U!=0)return U;var K=this.t;if(U=K-T.t,U!=0)return this.s<0?-U:U;for(;--K>=0;)if((U=this.data[K]-T.data[K])!=0)return U;return 0}function h(T){var U=1,K;return(K=T>>>16)!=0&&(T=K,U+=16),(K=T>>8)!=0&&(T=K,U+=8),(K=T>>4)!=0&&(T=K,U+=4),(K=T>>2)!=0&&(T=K,U+=2),(K=T>>1)!=0&&(T=K,U+=1),U}function u(){return this.t<=0?0:this.DB*(this.t-1)+h(this.data[this.t-1]^this.s&this.DM)}function _(T,U){var K;for(K=this.t-1;K>=0;--K)U.data[K+T]=this.data[K];for(K=T-1;K>=0;--K)U.data[K]=0;U.t=this.t+T,U.s=this.s}function M(T,U){for(var K=T;K<this.t;++K)U.data[K-T]=this.data[K];U.t=Math.max(this.t-T,0),U.s=this.s}function G(T,U){var K=T%this.DB,Y=this.DB-K,oe=(1<<Y)-1,le=Math.floor(T/this.DB),Be=this.s<<K&this.DM,Se;for(Se=this.t-1;Se>=0;--Se)U.data[Se+le+1]=this.data[Se]>>Y|Be,Be=(this.data[Se]&oe)<<K;for(Se=le-1;Se>=0;--Se)U.data[Se]=0;U.data[le]=Be,U.t=this.t+le+1,U.s=this.s,U.clamp()}function F(T,U){U.s=this.s;var K=Math.floor(T/this.DB);if(K>=this.t){U.t=0;return}var Y=T%this.DB,oe=this.DB-Y,le=(1<<Y)-1;U.data[0]=this.data[K]>>Y;for(var Be=K+1;Be<this.t;++Be)U.data[Be-K-1]|=(this.data[Be]&le)<<oe,U.data[Be-K]=this.data[Be]>>Y;Y>0&&(U.data[this.t-K-1]|=(this.s&le)<<oe),U.t=this.t-K,U.clamp()}function z(T,U){for(var K=0,Y=0,oe=Math.min(T.t,this.t);K<oe;)Y+=this.data[K]-T.data[K],U.data[K++]=Y&this.DM,Y>>=this.DB;if(T.t<this.t){for(Y-=T.s;K<this.t;)Y+=this.data[K],U.data[K++]=Y&this.DM,Y>>=this.DB;Y+=this.s}else{for(Y+=this.s;K<T.t;)Y-=T.data[K],U.data[K++]=Y&this.DM,Y>>=this.DB;Y-=T.s}U.s=Y<0?-1:0,Y<-1?U.data[K++]=this.DV+Y:Y>0&&(U.data[K++]=Y),U.t=K,U.clamp()}function J(T,U){var K=this.abs(),Y=T.abs(),oe=K.t;for(U.t=oe+Y.t;--oe>=0;)U.data[oe]=0;for(oe=0;oe<Y.t;++oe)U.data[oe+K.t]=K.am(0,Y.data[oe],U,oe,0,K.t);U.s=0,U.clamp(),this.s!=T.s&&t.ZERO.subTo(U,U)}function X(T){for(var U=this.abs(),K=T.t=2*U.t;--K>=0;)T.data[K]=0;for(K=0;K<U.t-1;++K){var Y=U.am(K,U.data[K],T,2*K,0,1);(T.data[K+U.t]+=U.am(K+1,2*U.data[K],T,2*K+1,Y,U.t-K-1))>=U.DV&&(T.data[K+U.t]-=U.DV,T.data[K+U.t+1]=1)}T.t>0&&(T.data[T.t-1]+=U.am(K,U.data[K],T,2*K,0,1)),T.s=0,T.clamp()}function te(T,U,K){var Y=T.abs();if(!(Y.t<=0)){var oe=this.abs();if(oe.t<Y.t){U?.fromInt(0),K!=null&&this.copyTo(K);return}K==null&&(K=i());var le=i(),Be=this.s,Se=T.s,Je=this.DB-h(Y.data[Y.t-1]);Je>0?(Y.lShiftTo(Je,le),oe.lShiftTo(Je,K)):(Y.copyTo(le),oe.copyTo(K));var Et=le.t,Qt=le.data[Et-1];if(Qt!=0){var Gt=Qt*(1<<this.F1)+(Et>1?le.data[Et-2]>>this.F2:0),Br=this.FV/Gt,Ns=(1<<this.F1)/Gt,ar=1<<this.F2,sr=K.t,ks=sr-Et,Dr=U??i();for(le.dlShiftTo(ks,Dr),K.compareTo(Dr)>=0&&(K.data[K.t++]=1,K.subTo(Dr,K)),t.ONE.dlShiftTo(Et,Dr),Dr.subTo(le,le);le.t<Et;)le.data[le.t++]=0;for(;--ks>=0;){var Kc=K.data[--sr]==Qt?this.DM:Math.floor(K.data[sr]*Br+(K.data[sr-1]+ar)*Ns);if((K.data[sr]+=le.am(0,Kc,K,ks,0,Et))<Kc)for(le.dlShiftTo(ks,Dr),K.subTo(Dr,K);K.data[sr]<--Kc;)K.subTo(Dr,K)}U!=null&&(K.drShiftTo(Et,U),Be!=Se&&t.ZERO.subTo(U,U)),K.t=Et,K.clamp(),Je>0&&K.rShiftTo(Je,K),Be<0&&t.ZERO.subTo(K,K)}}}function ue(T){var U=i();return this.abs().divRemTo(T,null,U),this.s<0&&U.compareTo(t.ZERO)>0&&T.subTo(U,U),U}function pe(T){this.m=T}function ge(T){return T.s<0||T.compareTo(this.m)>=0?T.mod(this.m):T}function ke(T){return T}function Ne(T){T.divRemTo(this.m,null,T)}function Le(T,U,K){T.multiplyTo(U,K),this.reduce(K)}function Ee(T,U){T.squareTo(U),this.reduce(U)}pe.prototype.convert=ge,pe.prototype.revert=ke,pe.prototype.reduce=Ne,pe.prototype.mulTo=Le,pe.prototype.sqrTo=Ee;function fe(){if(this.t<1)return 0;var T=this.data[0];if((T&1)==0)return 0;var U=T&3;return U=U*(2-(T&15)*U)&15,U=U*(2-(T&255)*U)&255,U=U*(2-((T&65535)*U&65535))&65535,U=U*(2-T*U%this.DV)%this.DV,U>0?this.DV-U:-U}function Me(T){this.m=T,this.mp=T.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<T.DB-15)-1,this.mt2=2*T.t}function ce(T){var U=i();return T.abs().dlShiftTo(this.m.t,U),U.divRemTo(this.m,null,U),T.s<0&&U.compareTo(t.ZERO)>0&&this.m.subTo(U,U),U}function st(T){var U=i();return T.copyTo(U),this.reduce(U),U}function Ve(T){for(;T.t<=this.mt2;)T.data[T.t++]=0;for(var U=0;U<this.m.t;++U){var K=T.data[U]&32767,Y=K*this.mpl+((K*this.mph+(T.data[U]>>15)*this.mpl&this.um)<<15)&T.DM;for(K=U+this.m.t,T.data[K]+=this.m.am(0,Y,T,U,0,this.m.t);T.data[K]>=T.DV;)T.data[K]-=T.DV,T.data[++K]++}T.clamp(),T.drShiftTo(this.m.t,T),T.compareTo(this.m)>=0&&T.subTo(this.m,T)}function g(T,U){T.squareTo(U),this.reduce(U)}function P(T,U,K){T.multiplyTo(U,K),this.reduce(K)}Me.prototype.convert=ce,Me.prototype.revert=st,Me.prototype.reduce=Ve,Me.prototype.mulTo=P,Me.prototype.sqrTo=g;function L(){return(this.t>0?this.data[0]&1:this.s)==0}function d(T,U){if(T>4294967295||T<1)return t.ONE;var K=i(),Y=i(),oe=U.convert(this),le=h(T)-1;for(oe.copyTo(K);--le>=0;)if(U.sqrTo(K,Y),(T&1<<le)>0)U.mulTo(Y,oe,K);else{var Be=K;K=Y,Y=Be}return U.revert(K)}function k(T,U){var K;return T<256||U.isEven()?K=new pe(U):K=new Me(U),this.exp(T,K)}t.prototype.copyTo=y,t.prototype.fromInt=S,t.prototype.fromString=c,t.prototype.clamp=m,t.prototype.dlShiftTo=_,t.prototype.drShiftTo=M,t.prototype.lShiftTo=G,t.prototype.rShiftTo=F,t.prototype.subTo=z,t.prototype.multiplyTo=J,t.prototype.squareTo=X,t.prototype.divRemTo=te,t.prototype.invDigit=fe,t.prototype.isEven=L,t.prototype.exp=d,t.prototype.toString=A,t.prototype.negate=N,t.prototype.abs=O,t.prototype.compareTo=C,t.prototype.bitLength=u,t.prototype.mod=ue,t.prototype.modPowInt=k,t.ZERO=x(0),t.ONE=x(1);function $(){var T=i();return this.copyTo(T),T}function q(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function ae(){return this.t==0?this.s:this.data[0]<<24>>24}function me(){return this.t==0?this.s:this.data[0]<<16>>16}function Ie(T){return Math.floor(Math.LN2*this.DB/Math.log(T))}function re(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function Ce(T){if(T==null&&(T=10),this.signum()==0||T<2||T>36)return"0";var U=this.chunkSize(T),K=Math.pow(T,U),Y=x(K),oe=i(),le=i(),Be="";for(this.divRemTo(Y,oe,le);oe.signum()>0;)Be=(K+le.intValue()).toString(T).substr(1)+Be,oe.divRemTo(Y,oe,le);return le.intValue().toString(T)+Be}function Re(T,U){this.fromInt(0),U==null&&(U=10);for(var K=this.chunkSize(U),Y=Math.pow(U,K),oe=!1,le=0,Be=0,Se=0;Se<T.length;++Se){var Je=l(T,Se);if(Je<0){T.charAt(Se)=="-"&&this.signum()==0&&(oe=!0);continue}Be=U*Be+Je,++le>=K&&(this.dMultiply(Y),this.dAddOffset(Be,0),le=0,Be=0)}le>0&&(this.dMultiply(Math.pow(U,le)),this.dAddOffset(Be,0)),oe&&t.ZERO.subTo(this,this)}function Oe(T,U,K){if(typeof U=="number")if(T<2)this.fromInt(1);else for(this.fromNumber(T,K),this.testBit(T-1)||this.bitwiseTo(t.ONE.shiftLeft(T-1),j,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(U);)this.dAddOffset(2,0),this.bitLength()>T&&this.subTo(t.ONE.shiftLeft(T-1),this);else{var Y=new Array,oe=T&7;Y.length=(T>>3)+1,U.nextBytes(Y),oe>0?Y[0]&=(1<<oe)-1:Y[0]=0,this.fromString(Y,256)}}function De(){var T=this.t,U=new Array;U[0]=this.s;var K=this.DB-T*this.DB%8,Y,oe=0;if(T-- >0)for(K<this.DB&&(Y=this.data[T]>>K)!=(this.s&this.DM)>>K&&(U[oe++]=Y|this.s<<this.DB-K);T>=0;)K<8?(Y=(this.data[T]&(1<<K)-1)<<8-K,Y|=this.data[--T]>>(K+=this.DB-8)):(Y=this.data[T]>>(K-=8)&255,K<=0&&(K+=this.DB,--T)),(Y&128)!=0&&(Y|=-256),oe==0&&(this.s&128)!=(Y&128)&&++oe,(oe>0||Y!=this.s)&&(U[oe++]=Y);return U}function Ze(T){return this.compareTo(T)==0}function Qe(T){return this.compareTo(T)<0?this:T}function tt(T){return this.compareTo(T)>0?this:T}function R(T,U,K){var Y,oe,le=Math.min(T.t,this.t);for(Y=0;Y<le;++Y)K.data[Y]=U(this.data[Y],T.data[Y]);if(T.t<this.t){for(oe=T.s&this.DM,Y=le;Y<this.t;++Y)K.data[Y]=U(this.data[Y],oe);K.t=this.t}else{for(oe=this.s&this.DM,Y=le;Y<T.t;++Y)K.data[Y]=U(oe,T.data[Y]);K.t=T.t}K.s=U(this.s,T.s),K.clamp()}function v(T,U){return T&U}function b(T){var U=i();return this.bitwiseTo(T,v,U),U}function j(T,U){return T|U}function W(T){var U=i();return this.bitwiseTo(T,j,U),U}function V(T,U){return T^U}function H(T){var U=i();return this.bitwiseTo(T,V,U),U}function Z(T,U){return T&~U}function ne(T){var U=i();return this.bitwiseTo(T,Z,U),U}function de(){for(var T=i(),U=0;U<this.t;++U)T.data[U]=this.DM&~this.data[U];return T.t=this.t,T.s=~this.s,T}function Ue(T){var U=i();return T<0?this.rShiftTo(-T,U):this.lShiftTo(T,U),U}function _e(T){var U=i();return T<0?this.lShiftTo(-T,U):this.rShiftTo(T,U),U}function Pe(T){if(T==0)return-1;var U=0;return(T&65535)==0&&(T>>=16,U+=16),(T&255)==0&&(T>>=8,U+=8),(T&15)==0&&(T>>=4,U+=4),(T&3)==0&&(T>>=2,U+=2),(T&1)==0&&++U,U}function ve(){for(var T=0;T<this.t;++T)if(this.data[T]!=0)return T*this.DB+Pe(this.data[T]);return this.s<0?this.t*this.DB:-1}function xe(T){for(var U=0;T!=0;)T&=T-1,++U;return U}function be(){for(var T=0,U=this.s&this.DM,K=0;K<this.t;++K)T+=xe(this.data[K]^U);return T}function Te(T){var U=Math.floor(T/this.DB);return U>=this.t?this.s!=0:(this.data[U]&1<<T%this.DB)!=0}function He(T,U){var K=t.ONE.shiftLeft(T);return this.bitwiseTo(K,U,K),K}function Fe(T){return this.changeBit(T,j)}function qe(T){return this.changeBit(T,Z)}function Xe(T){return this.changeBit(T,V)}function ot(T,U){for(var K=0,Y=0,oe=Math.min(T.t,this.t);K<oe;)Y+=this.data[K]+T.data[K],U.data[K++]=Y&this.DM,Y>>=this.DB;if(T.t<this.t){for(Y+=T.s;K<this.t;)Y+=this.data[K],U.data[K++]=Y&this.DM,Y>>=this.DB;Y+=this.s}else{for(Y+=this.s;K<T.t;)Y+=T.data[K],U.data[K++]=Y&this.DM,Y>>=this.DB;Y+=T.s}U.s=Y<0?-1:0,Y>0?U.data[K++]=Y:Y<-1&&(U.data[K++]=this.DV+Y),U.t=K,U.clamp()}function ut(T){var U=i();return this.addTo(T,U),U}function ct(T){var U=i();return this.subTo(T,U),U}function dt(T){var U=i();return this.multiplyTo(T,U),U}function yt(T){var U=i();return this.divRemTo(T,U,null),U}function vt(T){var U=i();return this.divRemTo(T,null,U),U}function gt(T){var U=i(),K=i();return this.divRemTo(T,U,K),new Array(U,K)}function mt(T){this.data[this.t]=this.am(0,T-1,this,0,0,this.t),++this.t,this.clamp()}function Ct(T,U){if(T!=0){for(;this.t<=U;)this.data[this.t++]=0;for(this.data[U]+=T;this.data[U]>=this.DV;)this.data[U]-=this.DV,++U>=this.t&&(this.data[this.t++]=0),++this.data[U]}}function at(){}function pt(T){return T}function xt(T,U,K){T.multiplyTo(U,K)}function St(T,U){T.squareTo(U)}at.prototype.convert=pt,at.prototype.revert=pt,at.prototype.mulTo=xt,at.prototype.sqrTo=St;function Ny(T){return this.exp(T,new at)}function ky(T,U,K){var Y=Math.min(this.t+T.t,U);for(K.s=0,K.t=Y;Y>0;)K.data[--Y]=0;var oe;for(oe=K.t-this.t;Y<oe;++Y)K.data[Y+this.t]=this.am(0,T.data[Y],K,Y,0,this.t);for(oe=Math.min(T.t,U);Y<oe;++Y)this.am(0,T.data[Y],K,Y,0,U-Y);K.clamp()}function _y(T,U,K){--U;var Y=K.t=this.t+T.t-U;for(K.s=0;--Y>=0;)K.data[Y]=0;for(Y=Math.max(U-this.t,0);Y<T.t;++Y)K.data[this.t+Y-U]=this.am(U-Y,T.data[Y],K,0,0,this.t+Y-U);K.clamp(),K.drShiftTo(1,K)}function Mi(T){this.r2=i(),this.q3=i(),t.ONE.dlShiftTo(2*T.t,this.r2),this.mu=this.r2.divide(T),this.m=T}function Ry(T){if(T.s<0||T.t>2*this.m.t)return T.mod(this.m);if(T.compareTo(this.m)<0)return T;var U=i();return T.copyTo(U),this.reduce(U),U}function Uy(T){return T}function Ly(T){for(T.drShiftTo(this.m.t-1,this.r2),T.t>this.m.t+1&&(T.t=this.m.t+1,T.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);T.compareTo(this.r2)<0;)T.dAddOffset(1,this.m.t+1);for(T.subTo(this.r2,T);T.compareTo(this.m)>=0;)T.subTo(this.m,T)}function Oy(T,U){T.squareTo(U),this.reduce(U)}function Dy(T,U,K){T.multiplyTo(U,K),this.reduce(K)}Mi.prototype.convert=Ry,Mi.prototype.revert=Uy,Mi.prototype.reduce=Ly,Mi.prototype.mulTo=Dy,Mi.prototype.sqrTo=Oy;function Py(T,U){var K=T.bitLength(),Y,oe=x(1),le;if(K<=0)return oe;K<18?Y=1:K<48?Y=3:K<144?Y=4:K<768?Y=5:Y=6,K<8?le=new pe(U):U.isEven()?le=new Mi(U):le=new Me(U);var Be=new Array,Se=3,Je=Y-1,Et=(1<<Y)-1;if(Be[1]=le.convert(this),Y>1){var Qt=i();for(le.sqrTo(Be[1],Qt);Se<=Et;)Be[Se]=i(),le.mulTo(Qt,Be[Se-2],Be[Se]),Se+=2}var Gt=T.t-1,Br,Ns=!0,ar=i(),sr;for(K=h(T.data[Gt])-1;Gt>=0;){for(K>=Je?Br=T.data[Gt]>>K-Je&Et:(Br=(T.data[Gt]&(1<<K+1)-1)<<Je-K,Gt>0&&(Br|=T.data[Gt-1]>>this.DB+K-Je)),Se=Y;(Br&1)==0;)Br>>=1,--Se;if((K-=Se)<0&&(K+=this.DB,--Gt),Ns)Be[Br].copyTo(oe),Ns=!1;else{for(;Se>1;)le.sqrTo(oe,ar),le.sqrTo(ar,oe),Se-=2;Se>0?le.sqrTo(oe,ar):(sr=oe,oe=ar,ar=sr),le.mulTo(ar,Be[Br],oe)}for(;Gt>=0&&(T.data[Gt]&1<<K)==0;)le.sqrTo(oe,ar),sr=oe,oe=ar,ar=sr,--K<0&&(K=this.DB-1,--Gt)}return le.revert(oe)}function Vy(T){var U=this.s<0?this.negate():this.clone(),K=T.s<0?T.negate():T.clone();if(U.compareTo(K)<0){var Y=U;U=K,K=Y}var oe=U.getLowestSetBit(),le=K.getLowestSetBit();if(le<0)return U;for(oe<le&&(le=oe),le>0&&(U.rShiftTo(le,U),K.rShiftTo(le,K));U.signum()>0;)(oe=U.getLowestSetBit())>0&&U.rShiftTo(oe,U),(oe=K.getLowestSetBit())>0&&K.rShiftTo(oe,K),U.compareTo(K)>=0?(U.subTo(K,U),U.rShiftTo(1,U)):(K.subTo(U,K),K.rShiftTo(1,K));return le>0&&K.lShiftTo(le,K),K}function My(T){if(T<=0)return 0;var U=this.DV%T,K=this.s<0?T-1:0;if(this.t>0)if(U==0)K=this.data[0]%T;else for(var Y=this.t-1;Y>=0;--Y)K=(U*K+this.data[Y])%T;return K}function Fy(T){var U=T.isEven();if(this.isEven()&&U||T.signum()==0)return t.ZERO;for(var K=T.clone(),Y=this.clone(),oe=x(1),le=x(0),Be=x(0),Se=x(1);K.signum()!=0;){for(;K.isEven();)K.rShiftTo(1,K),U?((!oe.isEven()||!le.isEven())&&(oe.addTo(this,oe),le.subTo(T,le)),oe.rShiftTo(1,oe)):le.isEven()||le.subTo(T,le),le.rShiftTo(1,le);for(;Y.isEven();)Y.rShiftTo(1,Y),U?((!Be.isEven()||!Se.isEven())&&(Be.addTo(this,Be),Se.subTo(T,Se)),Be.rShiftTo(1,Be)):Se.isEven()||Se.subTo(T,Se),Se.rShiftTo(1,Se);K.compareTo(Y)>=0?(K.subTo(Y,K),U&&oe.subTo(Be,oe),le.subTo(Se,le)):(Y.subTo(K,Y),U&&Be.subTo(oe,Be),Se.subTo(le,Se))}if(Y.compareTo(t.ONE)!=0)return t.ZERO;if(Se.compareTo(T)>=0)return Se.subtract(T);if(Se.signum()<0)Se.addTo(T,Se);else return Se;return Se.signum()<0?Se.add(T):Se}var nr=[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],Ky=(1<<26)/nr[nr.length-1];function jy(T){var U,K=this.abs();if(K.t==1&&K.data[0]<=nr[nr.length-1]){for(U=0;U<nr.length;++U)if(K.data[0]==nr[U])return!0;return!1}if(K.isEven())return!1;for(U=1;U<nr.length;){for(var Y=nr[U],oe=U+1;oe<nr.length&&Y<Ky;)Y*=nr[oe++];for(Y=K.modInt(Y);U<oe;)if(Y%nr[U++]==0)return!1}return K.millerRabin(T)}function Hy(T){var U=this.subtract(t.ONE),K=U.getLowestSetBit();if(K<=0)return!1;for(var Y=U.shiftRight(K),oe=qy(),le,Be=0;Be<T;++Be){do le=new t(this.bitLength(),oe);while(le.compareTo(t.ONE)<=0||le.compareTo(U)>=0);var Se=le.modPow(Y,this);if(Se.compareTo(t.ONE)!=0&&Se.compareTo(U)!=0){for(var Je=1;Je++<K&&Se.compareTo(U)!=0;)if(Se=Se.modPowInt(2,this),Se.compareTo(t.ONE)==0)return!1;if(Se.compareTo(U)!=0)return!1}}return!0}function qy(){return{nextBytes:function(T){for(var U=0;U<T.length;++U)T[U]=Math.floor(Math.random()*256)}}}return t.prototype.chunkSize=Ie,t.prototype.toRadix=Ce,t.prototype.fromRadix=Re,t.prototype.fromNumber=Oe,t.prototype.bitwiseTo=R,t.prototype.changeBit=He,t.prototype.addTo=ot,t.prototype.dMultiply=mt,t.prototype.dAddOffset=Ct,t.prototype.multiplyLowerTo=ky,t.prototype.multiplyUpperTo=_y,t.prototype.modInt=My,t.prototype.millerRabin=Hy,t.prototype.clone=$,t.prototype.intValue=q,t.prototype.byteValue=ae,t.prototype.shortValue=me,t.prototype.signum=re,t.prototype.toByteArray=De,t.prototype.equals=Ze,t.prototype.min=Qe,t.prototype.max=tt,t.prototype.and=b,t.prototype.or=W,t.prototype.xor=H,t.prototype.andNot=ne,t.prototype.not=de,t.prototype.shiftLeft=Ue,t.prototype.shiftRight=_e,t.prototype.getLowestSetBit=ve,t.prototype.bitCount=be,t.prototype.testBit=Te,t.prototype.setBit=Fe,t.prototype.clearBit=qe,t.prototype.flipBit=Xe,t.prototype.add=ut,t.prototype.subtract=ct,t.prototype.multiply=dt,t.prototype.divide=yt,t.prototype.remainder=vt,t.prototype.divideAndRemainder=gt,t.prototype.modPow=Py,t.prototype.modInverse=Fy,t.prototype.pow=Ny,t.prototype.gcd=Vy,t.prototype.isProbablePrime=jy,gc}var mc={exports:{}},Cc={exports:{}},wh;function Kn(){if(wh)return Cc.exports;wh=1;var r=Ge();Ar(),We();var e=Cc.exports=r.sha1=r.sha1||{};r.md.sha1=r.md.algorithms.sha1=e,e.create=function(){i||a();var s=null,n=r.util.createBuffer(),p=new Array(80),f={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return f.start=function(){f.messageLength=0,f.fullMessageLength=f.messageLength64=[];for(var E=f.messageLengthSize/4,I=0;I<E;++I)f.fullMessageLength.push(0);return n=r.util.createBuffer(),s={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},f},f.start(),f.update=function(E,I){I==="utf8"&&(E=r.util.encodeUtf8(E));var B=E.length;f.messageLength+=B,B=[B/4294967296>>>0,B>>>0];for(var l=f.fullMessageLength.length-1;l>=0;--l)f.fullMessageLength[l]+=B[1],B[1]=B[0]+(f.fullMessageLength[l]/4294967296>>>0),f.fullMessageLength[l]=f.fullMessageLength[l]>>>0,B[0]=B[1]/4294967296>>>0;return n.putBytes(E),o(s,p,n),(n.read>2048||n.length()===0)&&n.compact(),f},f.digest=function(){var E=r.util.createBuffer();E.putBytes(n.bytes());var I=f.fullMessageLength[f.fullMessageLength.length-1]+f.messageLengthSize,B=I&f.blockLength-1;E.putBytes(t.substr(0,f.blockLength-B));for(var l,y,S=f.fullMessageLength[0]*8,x=0;x<f.fullMessageLength.length-1;++x)l=f.fullMessageLength[x+1]*8,y=l/4294967296>>>0,S+=y,E.putInt32(S>>>0),S=l>>>0;E.putInt32(S);var c={h0:s.h0,h1:s.h1,h2:s.h2,h3:s.h3,h4:s.h4};o(c,p,E);var m=r.util.createBuffer();return m.putInt32(c.h0),m.putInt32(c.h1),m.putInt32(c.h2),m.putInt32(c.h3),m.putInt32(c.h4),m},f};var t=null,i=!1;function a(){t="\x80",t+=r.util.fillString("\0",64),i=!0}function o(s,n,p){for(var f,E,I,B,l,y,S,x,c=p.length();c>=64;){for(E=s.h0,I=s.h1,B=s.h2,l=s.h3,y=s.h4,x=0;x<16;++x)f=p.getInt32(),n[x]=f,S=l^I&(B^l),f=(E<<5|E>>>27)+S+y+1518500249+f,y=l,l=B,B=(I<<30|I>>>2)>>>0,I=E,E=f;for(;x<20;++x)f=n[x-3]^n[x-8]^n[x-14]^n[x-16],f=f<<1|f>>>31,n[x]=f,S=l^I&(B^l),f=(E<<5|E>>>27)+S+y+1518500249+f,y=l,l=B,B=(I<<30|I>>>2)>>>0,I=E,E=f;for(;x<32;++x)f=n[x-3]^n[x-8]^n[x-14]^n[x-16],f=f<<1|f>>>31,n[x]=f,S=I^B^l,f=(E<<5|E>>>27)+S+y+1859775393+f,y=l,l=B,B=(I<<30|I>>>2)>>>0,I=E,E=f;for(;x<40;++x)f=n[x-6]^n[x-16]^n[x-28]^n[x-32],f=f<<2|f>>>30,n[x]=f,S=I^B^l,f=(E<<5|E>>>27)+S+y+1859775393+f,y=l,l=B,B=(I<<30|I>>>2)>>>0,I=E,E=f;for(;x<60;++x)f=n[x-6]^n[x-16]^n[x-28]^n[x-32],f=f<<2|f>>>30,n[x]=f,S=I&B|l&(I^B),f=(E<<5|E>>>27)+S+y+2400959708+f,y=l,l=B,B=(I<<30|I>>>2)>>>0,I=E,E=f;for(;x<80;++x)f=n[x-6]^n[x-16]^n[x-28]^n[x-32],f=f<<2|f>>>30,n[x]=f,S=I^B^l,f=(E<<5|E>>>27)+S+y+3395469782+f,y=l,l=B,B=(I<<30|I>>>2)>>>0,I=E,E=f;s.h0=s.h0+E|0,s.h1=s.h1+I|0,s.h2=s.h2+B|0,s.h3=s.h3+l|0,s.h4=s.h4+y|0,c-=64}}return Cc.exports}var Ih;function Th(){if(Ih)return mc.exports;Ih=1;var r=Ge();We(),rr(),Kn();var e=mc.exports=r.pkcs1=r.pkcs1||{};e.encode_rsa_oaep=function(i,a,o){var s,n,p,f;typeof o=="string"?(s=o,n=arguments[3]||void 0,p=arguments[4]||void 0):o&&(s=o.label||void 0,n=o.seed||void 0,p=o.md||void 0,o.mgf1&&o.mgf1.md&&(f=o.mgf1.md)),p?p.start():p=r.md.sha1.create(),f||(f=p);var E=Math.ceil(i.n.bitLength()/8),I=E-2*p.digestLength-2;if(a.length>I){var B=new Error("RSAES-OAEP input message length is too long.");throw B.length=a.length,B.maxLength=I,B}s||(s=""),p.update(s,"raw");for(var l=p.digest(),y="",S=I-a.length,x=0;x<S;x++)y+="\0";var c=l.getBytes()+y+""+a;if(!n)n=r.random.getBytes(p.digestLength);else if(n.length!==p.digestLength){var B=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw B.seedLength=n.length,B.digestLength=p.digestLength,B}var m=t(n,E-p.digestLength-1,f),A=r.util.xorBytes(c,m,c.length),N=t(A,p.digestLength,f),O=r.util.xorBytes(n,N,n.length);return"\0"+O+A},e.decode_rsa_oaep=function(i,a,o){var s,n,p;typeof o=="string"?(s=o,n=arguments[3]||void 0):o&&(s=o.label||void 0,n=o.md||void 0,o.mgf1&&o.mgf1.md&&(p=o.mgf1.md));var f=Math.ceil(i.n.bitLength()/8);if(a.length!==f){var A=new Error("RSAES-OAEP encoded message length is invalid.");throw A.length=a.length,A.expectedLength=f,A}if(n===void 0?n=r.md.sha1.create():n.start(),p||(p=n),f<2*n.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");s||(s=""),n.update(s,"raw");for(var E=n.digest().getBytes(),I=a.charAt(0),B=a.substring(1,n.digestLength+1),l=a.substring(1+n.digestLength),y=t(l,n.digestLength,p),S=r.util.xorBytes(B,y,B.length),x=t(S,f-n.digestLength-1,p),c=r.util.xorBytes(l,x,l.length),m=c.substring(0,n.digestLength),A=I!=="\0",N=0;N<n.digestLength;++N)A|=E.charAt(N)!==m.charAt(N);for(var O=1,C=n.digestLength,h=n.digestLength;h<c.length;h++){var u=c.charCodeAt(h),_=u&1^1,M=O?65534:0;A|=u&M,O=O&_,C+=O}if(A||c.charCodeAt(C)!==1)throw new Error("Invalid RSAES-OAEP padding.");return c.substring(C+1)};function t(i,a,o){o||(o=r.md.sha1.create());for(var s="",n=Math.ceil(a/o.digestLength),p=0;p<n;++p){var f=String.fromCharCode(p>>24&255,p>>16&255,p>>8&255,p&255);o.start(),o.update(i+f),s+=o.digest().getBytes()}return s.substring(0,a)}return mc.exports}var Bs={exports:{}},Nh;function kh(){if(Nh)return Bs.exports;Nh=1;var r=Ge();return We(),As(),rr(),(function(){if(r.prime){Bs.exports=r.prime;return}var e=Bs.exports=r.prime=r.prime||{},t=r.jsbn.BigInteger,i=[6,4,2,4,2,4,6,2],a=new t(null);a.fromInt(30);var o=function(B,l){return B|l};e.generateProbablePrime=function(B,l,y){typeof l=="function"&&(y=l,l={}),l=l||{};var S=l.algorithm||"PRIMEINC";typeof S=="string"&&(S={name:S}),S.options=S.options||{};var x=l.prng||r.random,c={nextBytes:function(m){for(var A=x.getBytesSync(m.length),N=0;N<m.length;++N)m[N]=A.charCodeAt(N)}};if(S.name==="PRIMEINC")return s(B,c,S.options,y);throw new Error("Invalid prime generation algorithm: "+S.name)};function s(B,l,y,S){return"workers"in y?f(B,l,y,S):n(B,l,y,S)}function n(B,l,y,S){var x=E(B,l),c=0,m=I(x.bitLength());"millerRabinTests"in y&&(m=y.millerRabinTests);var A=10;"maxBlockTime"in y&&(A=y.maxBlockTime),p(x,B,l,c,m,A,S)}function p(B,l,y,S,x,c,m){var A=+new Date;do{if(B.bitLength()>l&&(B=E(l,y)),B.isProbablePrime(x))return m(null,B);B.dAddOffset(i[S++%8],0)}while(c<0||+new Date-A<c);r.util.setImmediate(function(){p(B,l,y,S,x,c,m)})}function f(B,l,y,S){if(typeof Worker>"u")return n(B,l,y,S);var x=E(B,l),c=y.workers,m=y.workLoad||100,A=m*30/8,N=y.workerScript||"forge/prime.worker.js";if(c===-1)return r.util.estimateCores(function(C,h){C&&(h=2),c=h-1,O()});O();function O(){c=Math.max(1,c);for(var C=[],h=0;h<c;++h)C[h]=new Worker(N);for(var h=0;h<c;++h)C[h].addEventListener("message",_);var u=!1;function _(M){if(!u){var G=M.data;if(G.found){for(var F=0;F<C.length;++F)C[F].terminate();return u=!0,S(null,new t(G.prime,16))}x.bitLength()>B&&(x=E(B,l));var z=x.toString(16);M.target.postMessage({hex:z,workLoad:m}),x.dAddOffset(A,0)}}}}function E(B,l){var y=new t(B,l),S=B-1;return y.testBit(S)||y.bitwiseTo(t.ONE.shiftLeft(S),o,y),y.dAddOffset(31-y.mod(a).byteValue(),0),y}function I(B){return B<=100?27:B<=150?18:B<=200?15:B<=250?12:B<=300?9:B<=350?8:B<=400?7:B<=500?6:B<=600?5:B<=800?4:B<=1250?3:2}})(),Bs.exports}var xc,_h;function ws(){if(_h)return xc;_h=1;var r=Ge();if(pr(),As(),si(),Th(),kh(),rr(),We(),typeof e>"u")var e=r.jsbn.BigInteger;var t=r.util.isNodejs?fc:null,i=r.asn1,a=r.util;r.pki=r.pki||{},xc=r.pki.rsa=r.rsa=r.rsa||{};var o=r.pki,s=[6,4,2,4,2,4,6,2],n={name:"PrivateKeyInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},p={name:"RSAPrivateKey",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},f={name:"RSAPublicKey",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},E=r.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},I={name:"DigestInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:i.Class.UNIVERSAL,type:i.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},B=function(h){var u;if(h.algorithm in o.oids)u=o.oids[h.algorithm];else{var _=new Error("Unknown message digest algorithm.");throw _.algorithm=h.algorithm,_}var M=i.oidToDer(u).getBytes(),G=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),F=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);F.value.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,M)),F.value.push(i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,""));var z=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,h.digest().getBytes());return G.value.push(F),G.value.push(z),i.toDer(G).getBytes()},l=function(h,u,_){if(_)return h.modPow(u.e,u.n);if(!u.p||!u.q)return h.modPow(u.d,u.n);u.dP||(u.dP=u.d.mod(u.p.subtract(e.ONE))),u.dQ||(u.dQ=u.d.mod(u.q.subtract(e.ONE))),u.qInv||(u.qInv=u.q.modInverse(u.p));var M;do M=new e(r.util.bytesToHex(r.random.getBytes(u.n.bitLength()/8)),16);while(M.compareTo(u.n)>=0||!M.gcd(u.n).equals(e.ONE));h=h.multiply(M.modPow(u.e,u.n)).mod(u.n);for(var G=h.mod(u.p).modPow(u.dP,u.p),F=h.mod(u.q).modPow(u.dQ,u.q);G.compareTo(F)<0;)G=G.add(u.p);var z=G.subtract(F).multiply(u.qInv).mod(u.p).multiply(u.q).add(F);return z=z.multiply(M.modInverse(u.n)).mod(u.n),z};o.rsa.encrypt=function(h,u,_){var M=_,G,F=Math.ceil(u.n.bitLength()/8);_!==!1&&_!==!0?(M=_===2,G=y(h,u,_)):(G=r.util.createBuffer(),G.putBytes(h));for(var z=new e(G.toHex(),16),J=l(z,u,M),X=J.toString(16),te=r.util.createBuffer(),ue=F-Math.ceil(X.length/2);ue>0;)te.putByte(0),--ue;return te.putBytes(r.util.hexToBytes(X)),te.getBytes()},o.rsa.decrypt=function(h,u,_,M){var G=Math.ceil(u.n.bitLength()/8);if(h.length!==G){var F=new Error("Encrypted message length is invalid.");throw F.length=h.length,F.expected=G,F}var z=new e(r.util.createBuffer(h).toHex(),16);if(z.compareTo(u.n)>=0)throw new Error("Encrypted message is invalid.");for(var J=l(z,u,_),X=J.toString(16),te=r.util.createBuffer(),ue=G-Math.ceil(X.length/2);ue>0;)te.putByte(0),--ue;return te.putBytes(r.util.hexToBytes(X)),M!==!1?S(te.getBytes(),u,_):te.getBytes()},o.rsa.createKeyPairGenerationState=function(h,u,_){typeof h=="string"&&(h=parseInt(h,10)),h=h||2048,_=_||{};var M=_.prng||r.random,G={nextBytes:function(J){for(var X=M.getBytesSync(J.length),te=0;te<J.length;++te)J[te]=X.charCodeAt(te)}},F=_.algorithm||"PRIMEINC",z;if(F==="PRIMEINC")z={algorithm:F,state:0,bits:h,rng:G,eInt:u||65537,e:new e(null),p:null,q:null,qBits:h>>1,pBits:h-(h>>1),pqState:0,num:null,keys:null},z.e.fromInt(z.eInt);else throw new Error("Invalid key generation algorithm: "+F);return z},o.rsa.stepKeyPairGenerationState=function(h,u){"algorithm"in h||(h.algorithm="PRIMEINC");var _=new e(null);_.fromInt(30);for(var M=0,G=function(pe,ge){return pe|ge},F=+new Date,z,J=0;h.keys===null&&(u<=0||J<u);){if(h.state===0){var X=h.p===null?h.pBits:h.qBits,te=X-1;h.pqState===0?(h.num=new e(X,h.rng),h.num.testBit(te)||h.num.bitwiseTo(e.ONE.shiftLeft(te),G,h.num),h.num.dAddOffset(31-h.num.mod(_).byteValue(),0),M=0,++h.pqState):h.pqState===1?h.num.bitLength()>X?h.pqState=0:h.num.isProbablePrime(m(h.num.bitLength()))?++h.pqState:h.num.dAddOffset(s[M++%8],0):h.pqState===2?h.pqState=h.num.subtract(e.ONE).gcd(h.e).compareTo(e.ONE)===0?3:0:h.pqState===3&&(h.pqState=0,h.p===null?h.p=h.num:h.q=h.num,h.p!==null&&h.q!==null&&++h.state,h.num=null)}else if(h.state===1)h.p.compareTo(h.q)<0&&(h.num=h.p,h.p=h.q,h.q=h.num),++h.state;else if(h.state===2)h.p1=h.p.subtract(e.ONE),h.q1=h.q.subtract(e.ONE),h.phi=h.p1.multiply(h.q1),++h.state;else if(h.state===3)h.phi.gcd(h.e).compareTo(e.ONE)===0?++h.state:(h.p=null,h.q=null,h.state=0);else if(h.state===4)h.n=h.p.multiply(h.q),h.n.bitLength()===h.bits?++h.state:(h.q=null,h.state=0);else if(h.state===5){var ue=h.e.modInverse(h.phi);h.keys={privateKey:o.rsa.setPrivateKey(h.n,h.e,ue,h.p,h.q,ue.mod(h.p1),ue.mod(h.q1),h.q.modInverse(h.p)),publicKey:o.rsa.setPublicKey(h.n,h.e)}}z=+new Date,J+=z-F,F=z}return h.keys!==null},o.rsa.generateKeyPair=function(h,u,_,M){if(arguments.length===1?typeof h=="object"?(_=h,h=void 0):typeof h=="function"&&(M=h,h=void 0):arguments.length===2?typeof h=="number"?typeof u=="function"?(M=u,u=void 0):typeof u!="number"&&(_=u,u=void 0):(_=h,M=u,h=void 0,u=void 0):arguments.length===3&&(typeof u=="number"?typeof _=="function"&&(M=_,_=void 0):(M=_,_=u,u=void 0)),_=_||{},h===void 0&&(h=_.bits||2048),u===void 0&&(u=_.e||65537),!r.options.usePureJavaScript&&!_.prng&&h>=256&&h<=16384&&(u===65537||u===3)){if(M){if(A("generateKeyPair"))return t.generateKeyPair("rsa",{modulusLength:h,publicExponent:u,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(J,X,te){if(J)return M(J);M(null,{privateKey:o.privateKeyFromPem(te),publicKey:o.publicKeyFromPem(X)})});if(N("generateKey")&&N("exportKey"))return a.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:h,publicExponent:C(u),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(J){return a.globalScope.crypto.subtle.exportKey("pkcs8",J.privateKey)}).then(void 0,function(J){M(J)}).then(function(J){if(J){var X=o.privateKeyFromAsn1(i.fromDer(r.util.createBuffer(J)));M(null,{privateKey:X,publicKey:o.setRsaPublicKey(X.n,X.e)})}});if(O("generateKey")&&O("exportKey")){var G=a.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:h,publicExponent:C(u),hash:{name:"SHA-256"}},!0,["sign","verify"]);G.oncomplete=function(J){var X=J.target.result,te=a.globalScope.msCrypto.subtle.exportKey("pkcs8",X.privateKey);te.oncomplete=function(ue){var pe=ue.target.result,ge=o.privateKeyFromAsn1(i.fromDer(r.util.createBuffer(pe)));M(null,{privateKey:ge,publicKey:o.setRsaPublicKey(ge.n,ge.e)})},te.onerror=function(ue){M(ue)}},G.onerror=function(J){M(J)};return}}else if(A("generateKeyPairSync")){var F=t.generateKeyPairSync("rsa",{modulusLength:h,publicExponent:u,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:o.privateKeyFromPem(F.privateKey),publicKey:o.publicKeyFromPem(F.publicKey)}}}var z=o.rsa.createKeyPairGenerationState(h,u,_);if(!M)return o.rsa.stepKeyPairGenerationState(z,0),z.keys;x(z,_,M)},o.setRsaPublicKey=o.rsa.setPublicKey=function(h,u){var _={n:h,e:u};return _.encrypt=function(M,G,F){if(typeof G=="string"?G=G.toUpperCase():G===void 0&&(G="RSAES-PKCS1-V1_5"),G==="RSAES-PKCS1-V1_5")G={encode:function(J,X,te){return y(J,X,2).getBytes()}};else if(G==="RSA-OAEP"||G==="RSAES-OAEP")G={encode:function(J,X){return r.pkcs1.encode_rsa_oaep(X,J,F)}};else if(["RAW","NONE","NULL",null].indexOf(G)!==-1)G={encode:function(J){return J}};else if(typeof G=="string")throw new Error('Unsupported encryption scheme: "'+G+'".');var z=G.encode(M,_,!0);return o.rsa.encrypt(z,_,!0)},_.verify=function(M,G,F,z){typeof F=="string"?F=F.toUpperCase():F===void 0&&(F="RSASSA-PKCS1-V1_5"),z===void 0&&(z={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in z||(z._parseAllDigestBytes=!0),F==="RSASSA-PKCS1-V1_5"?F={verify:function(X,te){te=S(te,_,!0);var ue=i.fromDer(te,{parseAllBytes:z._parseAllDigestBytes}),pe={},ge=[];if(!i.validate(ue,I,pe,ge)){var ke=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw ke.errors=ge,ke}var Ne=i.derToOid(pe.algorithmIdentifier);if(!(Ne===r.oids.md2||Ne===r.oids.md5||Ne===r.oids.sha1||Ne===r.oids.sha224||Ne===r.oids.sha256||Ne===r.oids.sha384||Ne===r.oids.sha512||Ne===r.oids["sha512-224"]||Ne===r.oids["sha512-256"])){var ke=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw ke.oid=Ne,ke}if((Ne===r.oids.md2||Ne===r.oids.md5)&&!("parameters"in pe))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifier NULL parameters.");return X===pe.digest}}:(F==="NONE"||F==="NULL"||F===null)&&(F={verify:function(X,te){return te=S(te,_,!0),X===te}});var J=o.rsa.decrypt(G,_,!0,!1);return F.verify(M,J,_.n.bitLength())},_},o.setRsaPrivateKey=o.rsa.setPrivateKey=function(h,u,_,M,G,F,z,J){var X={n:h,e:u,d:_,p:M,q:G,dP:F,dQ:z,qInv:J};return X.decrypt=function(te,ue,pe){typeof ue=="string"?ue=ue.toUpperCase():ue===void 0&&(ue="RSAES-PKCS1-V1_5");var ge=o.rsa.decrypt(te,X,!1,!1);if(ue==="RSAES-PKCS1-V1_5")ue={decode:S};else if(ue==="RSA-OAEP"||ue==="RSAES-OAEP")ue={decode:function(ke,Ne){return r.pkcs1.decode_rsa_oaep(Ne,ke,pe)}};else if(["RAW","NONE","NULL",null].indexOf(ue)!==-1)ue={decode:function(ke){return ke}};else throw new Error('Unsupported encryption scheme: "'+ue+'".');return ue.decode(ge,X,!1)},X.sign=function(te,ue){var pe=!1;typeof ue=="string"&&(ue=ue.toUpperCase()),ue===void 0||ue==="RSASSA-PKCS1-V1_5"?(ue={encode:B},pe=1):(ue==="NONE"||ue==="NULL"||ue===null)&&(ue={encode:function(){return te}},pe=1);var ge=ue.encode(te,X.n.bitLength());return o.rsa.encrypt(ge,X,pe)},X},o.wrapRsaPrivateKey=function(h){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(0).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.rsaEncryption).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(h).getBytes())])},o.privateKeyFromAsn1=function(h){var u={},_=[];if(i.validate(h,n,u,_)&&(h=i.fromDer(r.util.createBuffer(u.privateKey))),u={},_=[],!i.validate(h,p,u,_)){var M=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw M.errors=_,M}var G,F,z,J,X,te,ue,pe;return G=r.util.createBuffer(u.privateKeyModulus).toHex(),F=r.util.createBuffer(u.privateKeyPublicExponent).toHex(),z=r.util.createBuffer(u.privateKeyPrivateExponent).toHex(),J=r.util.createBuffer(u.privateKeyPrime1).toHex(),X=r.util.createBuffer(u.privateKeyPrime2).toHex(),te=r.util.createBuffer(u.privateKeyExponent1).toHex(),ue=r.util.createBuffer(u.privateKeyExponent2).toHex(),pe=r.util.createBuffer(u.privateKeyCoefficient).toHex(),o.setRsaPrivateKey(new e(G,16),new e(F,16),new e(z,16),new e(J,16),new e(X,16),new e(te,16),new e(ue,16),new e(pe,16))},o.privateKeyToAsn1=o.privateKeyToRSAPrivateKey=function(h){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(0).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,c(h.n)),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,c(h.e)),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,c(h.d)),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,c(h.p)),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,c(h.q)),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,c(h.dP)),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,c(h.dQ)),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,c(h.qInv))])},o.publicKeyFromAsn1=function(h){var u={},_=[];if(i.validate(h,E,u,_)){var M=i.derToOid(u.publicKeyOid);if(M!==o.oids.rsaEncryption){var G=new Error("Cannot read public key. Unknown OID.");throw G.oid=M,G}h=u.rsaPublicKey}if(_=[],!i.validate(h,f,u,_)){var G=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw G.errors=_,G}var F=r.util.createBuffer(u.publicKeyModulus).toHex(),z=r.util.createBuffer(u.publicKeyExponent).toHex();return o.setRsaPublicKey(new e(F,16),new e(z,16))},o.publicKeyToAsn1=o.publicKeyToSubjectPublicKeyInfo=function(h){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.rsaEncryption).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,[o.publicKeyToRSAPublicKey(h)])])},o.publicKeyToRSAPublicKey=function(h){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,c(h.n)),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,c(h.e))])};function y(h,u,_){var M=r.util.createBuffer(),G=Math.ceil(u.n.bitLength()/8);if(h.length>G-11){var F=new Error("Message is too long for PKCS#1 v1.5 padding.");throw F.length=h.length,F.max=G-11,F}M.putByte(0),M.putByte(_);var z=G-3-h.length,J;if(_===0||_===1){J=_===0?0:255;for(var X=0;X<z;++X)M.putByte(J)}else for(;z>0;){for(var te=0,ue=r.random.getBytes(z),X=0;X<z;++X)J=ue.charCodeAt(X),J===0?++te:M.putByte(J);z=te}return M.putByte(0),M.putBytes(h),M}function S(h,u,_,M){var G=Math.ceil(u.n.bitLength()/8),F=r.util.createBuffer(h),z=F.getByte(),J=F.getByte();if(z!==0||_&&J!==0&&J!==1||!_&&J!=2||_&&J===0&&typeof M>"u")throw new Error("Encryption block is invalid.");var X=0;if(J===0){X=G-3-M;for(var te=0;te<X;++te)if(F.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(J===1)for(X=0;F.length()>1;){if(F.getByte()!==255){--F.read;break}++X}else if(J===2)for(X=0;F.length()>1;){if(F.getByte()===0){--F.read;break}++X}var ue=F.getByte();if(ue!==0||X!==G-3-F.length())throw new Error("Encryption block is invalid.");return F.getBytes()}function x(h,u,_){typeof u=="function"&&(_=u,u={}),u=u||{};var M={algorithm:{name:u.algorithm||"PRIMEINC",options:{workers:u.workers||2,workLoad:u.workLoad||100,workerScript:u.workerScript}}};"prng"in u&&(M.prng=u.prng),G();function G(){F(h.pBits,function(J,X){if(J)return _(J);if(h.p=X,h.q!==null)return z(J,h.q);F(h.qBits,z)})}function F(J,X){r.prime.generateProbablePrime(J,M,X)}function z(J,X){if(J)return _(J);if(h.q=X,h.p.compareTo(h.q)<0){var te=h.p;h.p=h.q,h.q=te}if(h.p.subtract(e.ONE).gcd(h.e).compareTo(e.ONE)!==0){h.p=null,G();return}if(h.q.subtract(e.ONE).gcd(h.e).compareTo(e.ONE)!==0){h.q=null,F(h.qBits,z);return}if(h.p1=h.p.subtract(e.ONE),h.q1=h.q.subtract(e.ONE),h.phi=h.p1.multiply(h.q1),h.phi.gcd(h.e).compareTo(e.ONE)!==0){h.p=h.q=null,G();return}if(h.n=h.p.multiply(h.q),h.n.bitLength()!==h.bits){h.q=null,F(h.qBits,z);return}var ue=h.e.modInverse(h.phi);h.keys={privateKey:o.rsa.setPrivateKey(h.n,h.e,ue,h.p,h.q,ue.mod(h.p1),ue.mod(h.q1),h.q.modInverse(h.p)),publicKey:o.rsa.setPublicKey(h.n,h.e)},_(null,h.keys)}}function c(h){var u=h.toString(16);u[0]>="8"&&(u="00"+u);var _=r.util.hexToBytes(u);return _.length>1&&(_.charCodeAt(0)===0&&(_.charCodeAt(1)&128)===0||_.charCodeAt(0)===255&&(_.charCodeAt(1)&128)===128)?_.substr(1):_}function m(h){return h<=100?27:h<=150?18:h<=200?15:h<=250?12:h<=300?9:h<=350?8:h<=400?7:h<=500?6:h<=600?5:h<=800?4:h<=1250?3:2}function A(h){return r.util.isNodejs&&typeof t[h]=="function"}function N(h){return typeof a.globalScope<"u"&&typeof a.globalScope.crypto=="object"&&typeof a.globalScope.crypto.subtle=="object"&&typeof a.globalScope.crypto.subtle[h]=="function"}function O(h){return typeof a.globalScope<"u"&&typeof a.globalScope.msCrypto=="object"&&typeof a.globalScope.msCrypto.subtle=="object"&&typeof a.globalScope.msCrypto.subtle[h]=="function"}function C(h){for(var u=r.util.hexToBytes(h.toString(16)),_=new Uint8Array(u.length),M=0;M<u.length;++M)_[M]=u.charCodeAt(M);return _}return xc}var Sc,Rh;function Uh(){if(Rh)return Sc;Rh=1;var r=Ge();if(ai(),pr(),Es(),Ar(),si(),pc(),Vi(),rr(),Ah(),ws(),We(),typeof e>"u")var e=r.jsbn.BigInteger;var t=r.asn1,i=r.pki=r.pki||{};Sc=i.pbe=r.pbe=r.pbe||{};var a=i.oids,o={name:"EncryptedPrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},s={name:"PBES2Algorithms",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},n={name:"pkcs-12PbeParams",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"iterations"}]};i.encryptPrivateKeyInfo=function(B,l,y){y=y||{},y.saltSize=y.saltSize||8,y.count=y.count||2048,y.algorithm=y.algorithm||"aes128",y.prfAlgorithm=y.prfAlgorithm||"sha1";var S=r.random.getBytesSync(y.saltSize),x=y.count,c=t.integerToDer(x),m,A,N;if(y.algorithm.indexOf("aes")===0||y.algorithm==="des"){var O,C,h;switch(y.algorithm){case"aes128":m=16,O=16,C=a["aes128-CBC"],h=r.aes.createEncryptionCipher;break;case"aes192":m=24,O=16,C=a["aes192-CBC"],h=r.aes.createEncryptionCipher;break;case"aes256":m=32,O=16,C=a["aes256-CBC"],h=r.aes.createEncryptionCipher;break;case"des":m=8,O=8,C=a.desCBC,h=r.des.createEncryptionCipher;break;default:var u=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw u.algorithm=y.algorithm,u}var _="hmacWith"+y.prfAlgorithm.toUpperCase(),M=E(_),G=r.pkcs5.pbkdf2(l,S,x,m,M),F=r.random.getBytesSync(O),z=h(G);z.start(F),z.update(t.toDer(B)),z.finish(),N=z.output.getBytes();var J=I(S,c,m,_);A=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(a.pkcs5PBES2).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(a.pkcs5PBKDF2).getBytes()),J]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(C).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,F)])])])}else if(y.algorithm==="3des"){m=24;var X=new r.util.ByteBuffer(S),G=i.pbe.generatePkcs12Key(l,X,1,x,m),F=i.pbe.generatePkcs12Key(l,X,2,x,m),z=r.des.createEncryptionCipher(G);z.start(F),z.update(t.toDer(B)),z.finish(),N=z.output.getBytes(),A=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,S),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,c.getBytes())])])}else{var u=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw u.algorithm=y.algorithm,u}var te=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[A,t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,N)]);return te},i.decryptPrivateKeyInfo=function(B,l){var y=null,S={},x=[];if(!t.validate(B,o,S,x)){var c=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=x,c}var m=t.derToOid(S.encryptionOid),A=i.pbe.getCipher(m,S.encryptionParams,l),N=r.util.createBuffer(S.encryptedData);return A.update(N),A.finish()&&(y=t.fromDer(A.output)),y},i.encryptedPrivateKeyToPem=function(B,l){var y={type:"ENCRYPTED PRIVATE KEY",body:t.toDer(B).getBytes()};return r.pem.encode(y,{maxline:l})},i.encryptedPrivateKeyFromPem=function(B){var l=r.pem.decode(B)[0];if(l.type!=="ENCRYPTED PRIVATE KEY"){var y=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw y.headerType=l.type,y}if(l.procType&&l.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return t.fromDer(l.body)},i.encryptRsaPrivateKey=function(B,l,y){if(y=y||{},!y.legacy){var S=i.wrapRsaPrivateKey(i.privateKeyToAsn1(B));return S=i.encryptPrivateKeyInfo(S,l,y),i.encryptedPrivateKeyToPem(S)}var x,c,m,A;switch(y.algorithm){case"aes128":x="AES-128-CBC",m=16,c=r.random.getBytesSync(16),A=r.aes.createEncryptionCipher;break;case"aes192":x="AES-192-CBC",m=24,c=r.random.getBytesSync(16),A=r.aes.createEncryptionCipher;break;case"aes256":x="AES-256-CBC",m=32,c=r.random.getBytesSync(16),A=r.aes.createEncryptionCipher;break;case"3des":x="DES-EDE3-CBC",m=24,c=r.random.getBytesSync(8),A=r.des.createEncryptionCipher;break;case"des":x="DES-CBC",m=8,c=r.random.getBytesSync(8),A=r.des.createEncryptionCipher;break;default:var N=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+y.algorithm+'".');throw N.algorithm=y.algorithm,N}var O=r.pbe.opensslDeriveBytes(l,c.substr(0,8),m),C=A(O);C.start(c),C.update(t.toDer(i.privateKeyToAsn1(B))),C.finish();var h={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:x,parameters:r.util.bytesToHex(c).toUpperCase()},body:C.output.getBytes()};return r.pem.encode(h)},i.decryptRsaPrivateKey=function(B,l){var y=null,S=r.pem.decode(B)[0];if(S.type!=="ENCRYPTED PRIVATE KEY"&&S.type!=="PRIVATE KEY"&&S.type!=="RSA PRIVATE KEY"){var x=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw x.headerType=x,x}if(S.procType&&S.procType.type==="ENCRYPTED"){var c,m;switch(S.dekInfo.algorithm){case"DES-CBC":c=8,m=r.des.createDecryptionCipher;break;case"DES-EDE3-CBC":c=24,m=r.des.createDecryptionCipher;break;case"AES-128-CBC":c=16,m=r.aes.createDecryptionCipher;break;case"AES-192-CBC":c=24,m=r.aes.createDecryptionCipher;break;case"AES-256-CBC":c=32,m=r.aes.createDecryptionCipher;break;case"RC2-40-CBC":c=5,m=function(h){return r.rc2.createDecryptionCipher(h,40)};break;case"RC2-64-CBC":c=8,m=function(h){return r.rc2.createDecryptionCipher(h,64)};break;case"RC2-128-CBC":c=16,m=function(h){return r.rc2.createDecryptionCipher(h,128)};break;default:var x=new Error('Could not decrypt private key; unsupported encryption algorithm "'+S.dekInfo.algorithm+'".');throw x.algorithm=S.dekInfo.algorithm,x}var A=r.util.hexToBytes(S.dekInfo.parameters),N=r.pbe.opensslDeriveBytes(l,A.substr(0,8),c),O=m(N);if(O.start(A),O.update(r.util.createBuffer(S.body)),O.finish())y=O.output.getBytes();else return y}else y=S.body;return S.type==="ENCRYPTED PRIVATE KEY"?y=i.decryptPrivateKeyInfo(t.fromDer(y),l):y=t.fromDer(y),y!==null&&(y=i.privateKeyFromAsn1(y)),y},i.pbe.generatePkcs12Key=function(B,l,y,S,x,c){var m,A;if(typeof c>"u"||c===null){if(!("sha1"in r.md))throw new Error('"sha1" hash algorithm unavailable.');c=r.md.sha1.create()}var N=c.digestLength,O=c.blockLength,C=new r.util.ByteBuffer,h=new r.util.ByteBuffer;if(B!=null){for(A=0;A<B.length;A++)h.putInt16(B.charCodeAt(A));h.putInt16(0)}var u=h.length(),_=l.length(),M=new r.util.ByteBuffer;M.fillWithByte(y,O);var G=O*Math.ceil(_/O),F=new r.util.ByteBuffer;for(A=0;A<G;A++)F.putByte(l.at(A%_));var z=O*Math.ceil(u/O),J=new r.util.ByteBuffer;for(A=0;A<z;A++)J.putByte(h.at(A%u));var X=F;X.putBuffer(J);for(var te=Math.ceil(x/N),ue=1;ue<=te;ue++){var pe=new r.util.ByteBuffer;pe.putBytes(M.bytes()),pe.putBytes(X.bytes());for(var ge=0;ge<S;ge++)c.start(),c.update(pe.getBytes()),pe=c.digest();var ke=new r.util.ByteBuffer;for(A=0;A<O;A++)ke.putByte(pe.at(A%N));var Ne=Math.ceil(_/O)+Math.ceil(u/O),Le=new r.util.ByteBuffer;for(m=0;m<Ne;m++){var Ee=new r.util.ByteBuffer(X.getBytes(O)),fe=511;for(A=ke.length()-1;A>=0;A--)fe=fe>>8,fe+=ke.at(A)+Ee.at(A),Ee.setAt(A,fe&255);Le.putBuffer(Ee)}X=Le,C.putBuffer(pe)}return C.truncate(C.length()-x),C},i.pbe.getCipher=function(B,l,y){switch(B){case i.oids.pkcs5PBES2:return i.pbe.getCipherForPBES2(B,l,y);case i.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case i.oids["pbewithSHAAnd40BitRC2-CBC"]:return i.pbe.getCipherForPKCS12PBE(B,l,y);default:var S=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw S.oid=B,S.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],S}},i.pbe.getCipherForPBES2=function(B,l,y){var S={},x=[];if(!t.validate(l,s,S,x)){var c=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=x,c}if(B=t.derToOid(S.kdfOid),B!==i.oids.pkcs5PBKDF2){var c=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw c.oid=B,c.supportedOids=["pkcs5PBKDF2"],c}if(B=t.derToOid(S.encOid),B!==i.oids["aes128-CBC"]&&B!==i.oids["aes192-CBC"]&&B!==i.oids["aes256-CBC"]&&B!==i.oids["des-EDE3-CBC"]&&B!==i.oids.desCBC){var c=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw c.oid=B,c.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],c}var m=S.kdfSalt,A=r.util.createBuffer(S.kdfIterationCount);A=A.getInt(A.length()<<3);var N,O;switch(i.oids[B]){case"aes128-CBC":N=16,O=r.aes.createDecryptionCipher;break;case"aes192-CBC":N=24,O=r.aes.createDecryptionCipher;break;case"aes256-CBC":N=32,O=r.aes.createDecryptionCipher;break;case"des-EDE3-CBC":N=24,O=r.des.createDecryptionCipher;break;case"desCBC":N=8,O=r.des.createDecryptionCipher;break}var C=f(S.prfOid),h=r.pkcs5.pbkdf2(y,m,A,N,C),u=S.encIv,_=O(h);return _.start(u),_},i.pbe.getCipherForPKCS12PBE=function(B,l,y){var S={},x=[];if(!t.validate(l,n,S,x)){var c=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=x,c}var m=r.util.createBuffer(S.salt),A=r.util.createBuffer(S.iterations);A=A.getInt(A.length()<<3);var N,O,C;switch(B){case i.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:N=24,O=8,C=r.des.startDecrypting;break;case i.oids["pbewithSHAAnd40BitRC2-CBC"]:N=5,O=8,C=function(G,F){var z=r.rc2.createDecryptionCipher(G,40);return z.start(F,null),z};break;default:var c=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw c.oid=B,c}var h=f(S.prfOid),u=i.pbe.generatePkcs12Key(y,m,1,A,N,h);h.start();var _=i.pbe.generatePkcs12Key(y,m,2,A,O,h);return C(u,_)},i.pbe.opensslDeriveBytes=function(B,l,y,S){if(typeof S>"u"||S===null){if(!("md5"in r.md))throw new Error('"md5" hash algorithm unavailable.');S=r.md.md5.create()}l===null&&(l="");for(var x=[p(S,B+l)],c=16,m=1;c<y;++m,c+=16)x.push(p(S,x[m-1]+B+l));return x.join("").substr(0,y)};function p(B,l){return B.start().update(l).digest().getBytes()}function f(B){var l;if(!B)l="hmacWithSHA1";else if(l=i.oids[t.derToOid(B)],!l){var y=new Error("Unsupported PRF OID.");throw y.oid=B,y.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],y}return E(l)}function E(B){var l=r.md;switch(B){case"hmacWithSHA224":l=r.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":B=B.substr(8).toLowerCase();break;default:var y=new Error("Unsupported PRF algorithm.");throw y.algorithm=B,y.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],y}if(!l||!(B in l))throw new Error("Unknown hash algorithm: "+B);return l[B].create()}function I(B,l,y,S){var x=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,B),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,l.getBytes())]);return S!=="hmacWithSHA1"&&x.value.push(t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,r.util.hexToBytes(y.toString(16))),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(i.oids[S]).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])),x}return Sc}var Ec={exports:{}},bc={exports:{}},Lh;function Oh(){if(Lh)return bc.exports;Lh=1;var r=Ge();pr(),We();var e=r.asn1,t=bc.exports=r.pkcs7asn1=r.pkcs7asn1||{};r.pkcs7=r.pkcs7||{},r.pkcs7.asn1=t;var i={name:"ContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};t.contentInfoValidator=i;var a={name:"EncryptedContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};t.envelopedDataValidator={name:"EnvelopedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(a)},t.encryptedDataValidator={name:"EncryptedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"}].concat(a)};var o={name:"SignerInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};return t.signedDataValidator={name:"SignedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},i,{name:"SignedData.Certificates",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,capture:"signerInfos",optional:!0,value:[o]}]},t.recipientInfoValidator={name:"RecipientInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]},bc.exports}var Ac={exports:{}},Bc={exports:{}},Dh;function Ph(){if(Dh)return Bc.exports;Dh=1;var r=Ge();We(),r.mgf=r.mgf||{};var e=Bc.exports=r.mgf.mgf1=r.mgf1=r.mgf1||{};return e.create=function(t){var i={generate:function(a,o){for(var s=new r.util.ByteBuffer,n=Math.ceil(o/t.digestLength),p=0;p<n;p++){var f=new r.util.ByteBuffer;f.putInt32(p),t.start(),t.update(a+f.getBytes()),s.putBuffer(t.digest())}return s.truncate(s.length()-o),s.getBytes()}};return i},Bc.exports}var wc,Vh;function oy(){if(Vh)return wc;Vh=1;var r=Ge();return Ph(),wc=r.mgf=r.mgf||{},r.mgf.mgf1=r.mgf1,wc}var Ic={exports:{}},Mh;function Tc(){if(Mh)return Ic.exports;Mh=1;var r=Ge();rr(),We();var e=Ic.exports=r.pss=r.pss||{};return e.create=function(t){arguments.length===3&&(t={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var i=t.md,a=t.mgf,o=i.digestLength,s=t.salt||null;typeof s=="string"&&(s=r.util.createBuffer(s));var n;if("saltLength"in t)n=t.saltLength;else if(s!==null)n=s.length();else throw new Error("Salt length not specified or specific salt not given.");if(s!==null&&s.length()!==n)throw new Error("Given salt length does not match length of given salt.");var p=t.prng||r.random,f={};return f.encode=function(E,I){var B,l=I-1,y=Math.ceil(l/8),S=E.digest().getBytes();if(y<o+n+2)throw new Error("Message is too long to encrypt.");var x;s===null?x=p.getBytesSync(n):x=s.bytes();var c=new r.util.ByteBuffer;c.fillWithByte(0,8),c.putBytes(S),c.putBytes(x),i.start(),i.update(c.getBytes());var m=i.digest().getBytes(),A=new r.util.ByteBuffer;A.fillWithByte(0,y-n-o-2),A.putByte(1),A.putBytes(x);var N=A.getBytes(),O=y-o-1,C=a.generate(m,O),h="";for(B=0;B<O;B++)h+=String.fromCharCode(N.charCodeAt(B)^C.charCodeAt(B));var u=65280>>8*y-l&255;return h=String.fromCharCode(h.charCodeAt(0)&~u)+h.substr(1),h+m+"\xBC"},f.verify=function(E,I,B){var l,y=B-1,S=Math.ceil(y/8);if(I=I.substr(-S),S<o+n+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(I.charCodeAt(S-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var x=S-o-1,c=I.substr(0,x),m=I.substr(x,o),A=65280>>8*S-y&255;if((c.charCodeAt(0)&A)!==0)throw new Error("Bits beyond keysize not zero as expected.");var N=a.generate(m,x),O="";for(l=0;l<x;l++)O+=String.fromCharCode(c.charCodeAt(l)^N.charCodeAt(l));O=String.fromCharCode(O.charCodeAt(0)&~A)+O.substr(1);var C=S-o-n-2;for(l=0;l<C;l++)if(O.charCodeAt(l)!==0)throw new Error("Leftmost octets not zero as expected");if(O.charCodeAt(C)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var h=O.substr(-n),u=new r.util.ByteBuffer;u.fillWithByte(0,8),u.putBytes(E),u.putBytes(h),i.start(),i.update(u.getBytes());var _=i.digest().getBytes();return m===_},f},Ic.exports}var Fh;function Nc(){if(Fh)return Ac.exports;Fh=1;var r=Ge();ai(),pr(),Es(),Ar(),oy(),si(),Vi(),Tc(),ws(),We();var e=r.asn1,t=Ac.exports=r.pki=r.pki||{},i=t.oids,a={};a.CN=i.commonName,a.commonName="CN",a.C=i.countryName,a.countryName="C",a.L=i.localityName,a.localityName="L",a.ST=i.stateOrProvinceName,a.stateOrProvinceName="ST",a.O=i.organizationName,a.organizationName="O",a.OU=i.organizationalUnitName,a.organizationalUnitName="OU",a.E=i.emailAddress,a.emailAddress="E";var o=r.pki.rsa.publicKeyValidator,s={name:"Certificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},o,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},n={name:"rsapss",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},p={name:"CertificationRequestInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},o,{name:"CertificationRequestInfo.attributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0}]}]}]},f={name:"CertificationRequest",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[p,{name:"CertificationRequest.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};t.RDNAttributesAsArray=function(C,h){for(var u=[],_,M,G,F=0;F<C.value.length;++F){_=C.value[F];for(var z=0;z<_.value.length;++z)G={},M=_.value[z],G.type=e.derToOid(M.value[0].value),G.value=M.value[1].value,G.valueTagClass=M.value[1].type,G.type in i&&(G.name=i[G.type],G.name in a&&(G.shortName=a[G.name])),h&&(h.update(G.type),h.update(G.value)),u.push(G)}return u},t.CRIAttributesAsArray=function(C){for(var h=[],u=0;u<C.length;++u)for(var _=C[u],M=e.derToOid(_.value[0].value),G=_.value[1].value,F=0;F<G.length;++F){var z={};if(z.type=M,z.value=G[F].value,z.valueTagClass=G[F].type,z.type in i&&(z.name=i[z.type],z.name in a&&(z.shortName=a[z.name])),z.type===i.extensionRequest){z.extensions=[];for(var J=0;J<z.value.length;++J)z.extensions.push(t.certificateExtensionFromAsn1(z.value[J]))}h.push(z)}return h};function E(C,h){typeof h=="string"&&(h={shortName:h});for(var u=null,_,M=0;u===null&&M<C.attributes.length;++M)_=C.attributes[M],(h.type&&h.type===_.type||h.name&&h.name===_.name||h.shortName&&h.shortName===_.shortName)&&(u=_);return u}var I=function(C,h,u){var _={};if(C!==i["RSASSA-PSS"])return _;u&&(_={hash:{algorithmOid:i.sha1},mgf:{algorithmOid:i.mgf1,hash:{algorithmOid:i.sha1}},saltLength:20});var M={},G=[];if(!e.validate(h,n,M,G)){var F=new Error("Cannot read RSASSA-PSS parameter block.");throw F.errors=G,F}return M.hashOid!==void 0&&(_.hash=_.hash||{},_.hash.algorithmOid=e.derToOid(M.hashOid)),M.maskGenOid!==void 0&&(_.mgf=_.mgf||{},_.mgf.algorithmOid=e.derToOid(M.maskGenOid),_.mgf.hash=_.mgf.hash||{},_.mgf.hash.algorithmOid=e.derToOid(M.maskGenHashOid)),M.saltLength!==void 0&&(_.saltLength=M.saltLength.charCodeAt(0)),_},B=function(C){switch(i[C.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return r.md.sha1.create();case"md5WithRSAEncryption":return r.md.md5.create();case"sha256WithRSAEncryption":return r.md.sha256.create();case"sha384WithRSAEncryption":return r.md.sha384.create();case"sha512WithRSAEncryption":return r.md.sha512.create();case"RSASSA-PSS":return r.md.sha256.create();default:var h=new Error("Could not compute "+C.type+" digest. Unknown signature OID.");throw h.signatureOid=C.signatureOid,h}},l=function(C){var h=C.certificate,u;switch(h.signatureOid){case i.sha1WithRSAEncryption:case i.sha1WithRSASignature:break;case i["RSASSA-PSS"]:var _,M;if(_=i[h.signatureParameters.mgf.hash.algorithmOid],_===void 0||r.md[_]===void 0){var G=new Error("Unsupported MGF hash function.");throw G.oid=h.signatureParameters.mgf.hash.algorithmOid,G.name=_,G}if(M=i[h.signatureParameters.mgf.algorithmOid],M===void 0||r.mgf[M]===void 0){var G=new Error("Unsupported MGF function.");throw G.oid=h.signatureParameters.mgf.algorithmOid,G.name=M,G}if(M=r.mgf[M].create(r.md[_].create()),_=i[h.signatureParameters.hash.algorithmOid],_===void 0||r.md[_]===void 0){var G=new Error("Unsupported RSASSA-PSS hash function.");throw G.oid=h.signatureParameters.hash.algorithmOid,G.name=_,G}u=r.pss.create(r.md[_].create(),M,h.signatureParameters.saltLength);break}return h.publicKey.verify(C.md.digest().getBytes(),C.signature,u)};t.certificateFromPem=function(C,h,u){var _=r.pem.decode(C)[0];if(_.type!=="CERTIFICATE"&&_.type!=="X509 CERTIFICATE"&&_.type!=="TRUSTED CERTIFICATE"){var M=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw M.headerType=_.type,M}if(_.procType&&_.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var G=e.fromDer(_.body,u);return t.certificateFromAsn1(G,h)},t.certificateToPem=function(C,h){var u={type:"CERTIFICATE",body:e.toDer(t.certificateToAsn1(C)).getBytes()};return r.pem.encode(u,{maxline:h})},t.publicKeyFromPem=function(C){var h=r.pem.decode(C)[0];if(h.type!=="PUBLIC KEY"&&h.type!=="RSA PUBLIC KEY"){var u=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw u.headerType=h.type,u}if(h.procType&&h.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var _=e.fromDer(h.body);return t.publicKeyFromAsn1(_)},t.publicKeyToPem=function(C,h){var u={type:"PUBLIC KEY",body:e.toDer(t.publicKeyToAsn1(C)).getBytes()};return r.pem.encode(u,{maxline:h})},t.publicKeyToRSAPublicKeyPem=function(C,h){var u={type:"RSA PUBLIC KEY",body:e.toDer(t.publicKeyToRSAPublicKey(C)).getBytes()};return r.pem.encode(u,{maxline:h})},t.getPublicKeyFingerprint=function(C,h){h=h||{};var u=h.md||r.md.sha1.create(),_=h.type||"RSAPublicKey",M;switch(_){case"RSAPublicKey":M=e.toDer(t.publicKeyToRSAPublicKey(C)).getBytes();break;case"SubjectPublicKeyInfo":M=e.toDer(t.publicKeyToAsn1(C)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+h.type+'".')}u.start(),u.update(M);var G=u.digest();if(h.encoding==="hex"){var F=G.toHex();return h.delimiter?F.match(/.{2}/g).join(h.delimiter):F}else{if(h.encoding==="binary")return G.getBytes();if(h.encoding)throw new Error('Unknown encoding "'+h.encoding+'".')}return G},t.certificationRequestFromPem=function(C,h,u){var _=r.pem.decode(C)[0];if(_.type!=="CERTIFICATE REQUEST"){var M=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw M.headerType=_.type,M}if(_.procType&&_.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var G=e.fromDer(_.body,u);return t.certificationRequestFromAsn1(G,h)},t.certificationRequestToPem=function(C,h){var u={type:"CERTIFICATE REQUEST",body:e.toDer(t.certificationRequestToAsn1(C)).getBytes()};return r.pem.encode(u,{maxline:h})},t.createCertificate=function(){var C={};return C.version=2,C.serialNumber="00",C.signatureOid=null,C.signature=null,C.siginfo={},C.siginfo.algorithmOid=null,C.validity={},C.validity.notBefore=new Date,C.validity.notAfter=new Date,C.issuer={},C.issuer.getField=function(h){return E(C.issuer,h)},C.issuer.addField=function(h){S([h]),C.issuer.attributes.push(h)},C.issuer.attributes=[],C.issuer.hash=null,C.subject={},C.subject.getField=function(h){return E(C.subject,h)},C.subject.addField=function(h){S([h]),C.subject.attributes.push(h)},C.subject.attributes=[],C.subject.hash=null,C.extensions=[],C.publicKey=null,C.md=null,C.setSubject=function(h,u){S(h),C.subject.attributes=h,delete C.subject.uniqueId,u&&(C.subject.uniqueId=u),C.subject.hash=null},C.setIssuer=function(h,u){S(h),C.issuer.attributes=h,delete C.issuer.uniqueId,u&&(C.issuer.uniqueId=u),C.issuer.hash=null},C.setExtensions=function(h){for(var u=0;u<h.length;++u)x(h[u],{cert:C});C.extensions=h},C.getExtension=function(h){typeof h=="string"&&(h={name:h});for(var u=null,_,M=0;u===null&&M<C.extensions.length;++M)_=C.extensions[M],(h.id&&_.id===h.id||h.name&&_.name===h.name)&&(u=_);return u},C.sign=function(h,u){C.md=u||r.md.sha1.create();var _=i[C.md.algorithm+"WithRSAEncryption"];if(!_){var M=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw M.algorithm=C.md.algorithm,M}C.signatureOid=C.siginfo.algorithmOid=_,C.tbsCertificate=t.getTBSCertificate(C);var G=e.toDer(C.tbsCertificate);C.md.update(G.getBytes()),C.signature=h.sign(C.md)},C.verify=function(h){var u=!1;if(!C.issued(h)){var _=h.issuer,M=C.subject,G=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 G.expectedIssuer=M.attributes,G.actualIssuer=_.attributes,G}var F=h.md;if(F===null){F=B({signatureOid:h.signatureOid,type:"certificate"});var z=h.tbsCertificate||t.getTBSCertificate(h),J=e.toDer(z);F.update(J.getBytes())}return F!==null&&(u=l({certificate:C,md:F,signature:h.signature})),u},C.isIssuer=function(h){var u=!1,_=C.issuer,M=h.subject;if(_.hash&&M.hash)u=_.hash===M.hash;else if(_.attributes.length===M.attributes.length){u=!0;for(var G,F,z=0;u&&z<_.attributes.length;++z)G=_.attributes[z],F=M.attributes[z],(G.type!==F.type||G.value!==F.value)&&(u=!1)}return u},C.issued=function(h){return h.isIssuer(C)},C.generateSubjectKeyIdentifier=function(){return t.getPublicKeyFingerprint(C.publicKey,{type:"RSAPublicKey"})},C.verifySubjectKeyIdentifier=function(){for(var h=i.subjectKeyIdentifier,u=0;u<C.extensions.length;++u){var _=C.extensions[u];if(_.id===h){var M=C.generateSubjectKeyIdentifier().getBytes();return r.util.hexToBytes(_.subjectKeyIdentifier)===M}}return!1},C},t.certificateFromAsn1=function(C,h){var u={},_=[];if(!e.validate(C,s,u,_)){var M=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw M.errors=_,M}var G=e.derToOid(u.publicKeyOid);if(G!==t.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var F=t.createCertificate();F.version=u.certVersion?u.certVersion.charCodeAt(0):0;var z=r.util.createBuffer(u.certSerialNumber);F.serialNumber=z.toHex(),F.signatureOid=r.asn1.derToOid(u.certSignatureOid),F.signatureParameters=I(F.signatureOid,u.certSignatureParams,!0),F.siginfo.algorithmOid=r.asn1.derToOid(u.certinfoSignatureOid),F.siginfo.parameters=I(F.siginfo.algorithmOid,u.certinfoSignatureParams,!1),F.signature=u.certSignature;var J=[];if(u.certValidity1UTCTime!==void 0&&J.push(e.utcTimeToDate(u.certValidity1UTCTime)),u.certValidity2GeneralizedTime!==void 0&&J.push(e.generalizedTimeToDate(u.certValidity2GeneralizedTime)),u.certValidity3UTCTime!==void 0&&J.push(e.utcTimeToDate(u.certValidity3UTCTime)),u.certValidity4GeneralizedTime!==void 0&&J.push(e.generalizedTimeToDate(u.certValidity4GeneralizedTime)),J.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(J.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(F.validity.notBefore=J[0],F.validity.notAfter=J[1],F.tbsCertificate=u.tbsCertificate,h){F.md=B({signatureOid:F.signatureOid,type:"certificate"});var X=e.toDer(F.tbsCertificate);F.md.update(X.getBytes())}var te=r.md.sha1.create(),ue=e.toDer(u.certIssuer);te.update(ue.getBytes()),F.issuer.getField=function(ke){return E(F.issuer,ke)},F.issuer.addField=function(ke){S([ke]),F.issuer.attributes.push(ke)},F.issuer.attributes=t.RDNAttributesAsArray(u.certIssuer),u.certIssuerUniqueId&&(F.issuer.uniqueId=u.certIssuerUniqueId),F.issuer.hash=te.digest().toHex();var pe=r.md.sha1.create(),ge=e.toDer(u.certSubject);return pe.update(ge.getBytes()),F.subject.getField=function(ke){return E(F.subject,ke)},F.subject.addField=function(ke){S([ke]),F.subject.attributes.push(ke)},F.subject.attributes=t.RDNAttributesAsArray(u.certSubject),u.certSubjectUniqueId&&(F.subject.uniqueId=u.certSubjectUniqueId),F.subject.hash=pe.digest().toHex(),u.certExtensions?F.extensions=t.certificateExtensionsFromAsn1(u.certExtensions):F.extensions=[],F.publicKey=t.publicKeyFromAsn1(u.subjectPublicKeyInfo),F},t.certificateExtensionsFromAsn1=function(C){for(var h=[],u=0;u<C.value.length;++u)for(var _=C.value[u],M=0;M<_.value.length;++M)h.push(t.certificateExtensionFromAsn1(_.value[M]));return h},t.certificateExtensionFromAsn1=function(C){var h={};if(h.id=e.derToOid(C.value[0].value),h.critical=!1,C.value[1].type===e.Type.BOOLEAN?(h.critical=C.value[1].value.charCodeAt(0)!==0,h.value=C.value[2].value):h.value=C.value[1].value,h.id in i){if(h.name=i[h.id],h.name==="keyUsage"){var u=e.fromDer(h.value),_=0,M=0;u.value.length>1&&(_=u.value.charCodeAt(1),M=u.value.length>2?u.value.charCodeAt(2):0),h.digitalSignature=(_&128)===128,h.nonRepudiation=(_&64)===64,h.keyEncipherment=(_&32)===32,h.dataEncipherment=(_&16)===16,h.keyAgreement=(_&8)===8,h.keyCertSign=(_&4)===4,h.cRLSign=(_&2)===2,h.encipherOnly=(_&1)===1,h.decipherOnly=(M&128)===128}else if(h.name==="basicConstraints"){var u=e.fromDer(h.value);u.value.length>0&&u.value[0].type===e.Type.BOOLEAN?h.cA=u.value[0].value.charCodeAt(0)!==0:h.cA=!1;var G=null;u.value.length>0&&u.value[0].type===e.Type.INTEGER?G=u.value[0].value:u.value.length>1&&(G=u.value[1].value),G!==null&&(h.pathLenConstraint=e.derToInteger(G))}else if(h.name==="extKeyUsage")for(var u=e.fromDer(h.value),F=0;F<u.value.length;++F){var z=e.derToOid(u.value[F].value);z in i?h[i[z]]=!0:h[z]=!0}else if(h.name==="nsCertType"){var u=e.fromDer(h.value),_=0;u.value.length>1&&(_=u.value.charCodeAt(1)),h.client=(_&128)===128,h.server=(_&64)===64,h.email=(_&32)===32,h.objsign=(_&16)===16,h.reserved=(_&8)===8,h.sslCA=(_&4)===4,h.emailCA=(_&2)===2,h.objCA=(_&1)===1}else if(h.name==="subjectAltName"||h.name==="issuerAltName"){h.altNames=[];for(var J,u=e.fromDer(h.value),X=0;X<u.value.length;++X){J=u.value[X];var te={type:J.type,value:J.value};switch(h.altNames.push(te),J.type){case 1:case 2:case 6:break;case 7:te.ip=r.util.bytesToIP(J.value);break;case 8:te.oid=e.derToOid(J.value);break}}}else if(h.name==="subjectKeyIdentifier"){var u=e.fromDer(h.value);h.subjectKeyIdentifier=r.util.bytesToHex(u.value)}}return h},t.certificationRequestFromAsn1=function(C,h){var u={},_=[];if(!e.validate(C,f,u,_)){var M=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw M.errors=_,M}var G=e.derToOid(u.publicKeyOid);if(G!==t.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var F=t.createCertificationRequest();if(F.version=u.csrVersion?u.csrVersion.charCodeAt(0):0,F.signatureOid=r.asn1.derToOid(u.csrSignatureOid),F.signatureParameters=I(F.signatureOid,u.csrSignatureParams,!0),F.siginfo.algorithmOid=r.asn1.derToOid(u.csrSignatureOid),F.siginfo.parameters=I(F.siginfo.algorithmOid,u.csrSignatureParams,!1),F.signature=u.csrSignature,F.certificationRequestInfo=u.certificationRequestInfo,h){F.md=B({signatureOid:F.signatureOid,type:"certification request"});var z=e.toDer(F.certificationRequestInfo);F.md.update(z.getBytes())}var J=r.md.sha1.create();return F.subject.getField=function(X){return E(F.subject,X)},F.subject.addField=function(X){S([X]),F.subject.attributes.push(X)},F.subject.attributes=t.RDNAttributesAsArray(u.certificationRequestInfoSubject,J),F.subject.hash=J.digest().toHex(),F.publicKey=t.publicKeyFromAsn1(u.subjectPublicKeyInfo),F.getAttribute=function(X){return E(F,X)},F.addAttribute=function(X){S([X]),F.attributes.push(X)},F.attributes=t.CRIAttributesAsArray(u.certificationRequestInfoAttributes||[]),F},t.createCertificationRequest=function(){var C={};return C.version=0,C.signatureOid=null,C.signature=null,C.siginfo={},C.siginfo.algorithmOid=null,C.subject={},C.subject.getField=function(h){return E(C.subject,h)},C.subject.addField=function(h){S([h]),C.subject.attributes.push(h)},C.subject.attributes=[],C.subject.hash=null,C.publicKey=null,C.attributes=[],C.getAttribute=function(h){return E(C,h)},C.addAttribute=function(h){S([h]),C.attributes.push(h)},C.md=null,C.setSubject=function(h){S(h),C.subject.attributes=h,C.subject.hash=null},C.setAttributes=function(h){S(h),C.attributes=h},C.sign=function(h,u){C.md=u||r.md.sha1.create();var _=i[C.md.algorithm+"WithRSAEncryption"];if(!_){var M=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw M.algorithm=C.md.algorithm,M}C.signatureOid=C.siginfo.algorithmOid=_,C.certificationRequestInfo=t.getCertificationRequestInfo(C);var G=e.toDer(C.certificationRequestInfo);C.md.update(G.getBytes()),C.signature=h.sign(C.md)},C.verify=function(){var h=!1,u=C.md;if(u===null){u=B({signatureOid:C.signatureOid,type:"certification request"});var _=C.certificationRequestInfo||t.getCertificationRequestInfo(C),M=e.toDer(_);u.update(M.getBytes())}return u!==null&&(h=l({certificate:C,md:u,signature:C.signature})),h},C};function y(C){for(var h=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),u,_,M=C.attributes,G=0;G<M.length;++G){u=M[G];var F=u.value,z=e.Type.PRINTABLESTRING;"valueTagClass"in u&&(z=u.valueTagClass,z===e.Type.UTF8&&(F=r.util.encodeUtf8(F))),_=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.type).getBytes()),e.create(e.Class.UNIVERSAL,z,!1,F)])]),h.value.push(_)}return h}function S(C){for(var h,u=0;u<C.length;++u){if(h=C[u],typeof h.name>"u"&&(h.type&&h.type in t.oids?h.name=t.oids[h.type]:h.shortName&&h.shortName in a&&(h.name=t.oids[a[h.shortName]])),typeof h.type>"u")if(h.name&&h.name in t.oids)h.type=t.oids[h.name];else{var _=new Error("Attribute type not specified.");throw _.attribute=h,_}if(typeof h.shortName>"u"&&h.name&&h.name in a&&(h.shortName=a[h.name]),h.type===i.extensionRequest&&(h.valueConstructed=!0,h.valueTagClass=e.Type.SEQUENCE,!h.value&&h.extensions)){h.value=[];for(var M=0;M<h.extensions.length;++M)h.value.push(t.certificateExtensionToAsn1(x(h.extensions[M])))}if(typeof h.value>"u"){var _=new Error("Attribute value not specified.");throw _.attribute=h,_}}}function x(C,h){if(h=h||{},typeof C.name>"u"&&C.id&&C.id in t.oids&&(C.name=t.oids[C.id]),typeof C.id>"u")if(C.name&&C.name in t.oids)C.id=t.oids[C.name];else{var u=new Error("Extension ID not specified.");throw u.extension=C,u}if(typeof C.value<"u")return C;if(C.name==="keyUsage"){var _=0,M=0,G=0;C.digitalSignature&&(M|=128,_=7),C.nonRepudiation&&(M|=64,_=6),C.keyEncipherment&&(M|=32,_=5),C.dataEncipherment&&(M|=16,_=4),C.keyAgreement&&(M|=8,_=3),C.keyCertSign&&(M|=4,_=2),C.cRLSign&&(M|=2,_=1),C.encipherOnly&&(M|=1,_=0),C.decipherOnly&&(G|=128,_=7);var F=String.fromCharCode(_);G!==0?F+=String.fromCharCode(M)+String.fromCharCode(G):M!==0&&(F+=String.fromCharCode(M)),C.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,F)}else if(C.name==="basicConstraints")C.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),C.cA&&C.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,"\xFF")),"pathLenConstraint"in C&&C.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(C.pathLenConstraint).getBytes()));else if(C.name==="extKeyUsage"){C.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var z=C.value.value;for(var J in C)C[J]===!0&&(J in i?z.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(i[J]).getBytes())):J.indexOf(".")!==-1&&z.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(J).getBytes())))}else if(C.name==="nsCertType"){var _=0,M=0;C.client&&(M|=128,_=7),C.server&&(M|=64,_=6),C.email&&(M|=32,_=5),C.objsign&&(M|=16,_=4),C.reserved&&(M|=8,_=3),C.sslCA&&(M|=4,_=2),C.emailCA&&(M|=2,_=1),C.objCA&&(M|=1,_=0);var F=String.fromCharCode(_);M!==0&&(F+=String.fromCharCode(M)),C.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,F)}else if(C.name==="subjectAltName"||C.name==="issuerAltName"){C.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var X,te=0;te<C.altNames.length;++te){X=C.altNames[te];var F=X.value;if(X.type===7&&X.ip){if(F=r.util.bytesFromIP(X.ip),F===null){var u=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw u.extension=C,u}}else X.type===8&&(X.oid?F=e.oidToDer(e.oidToDer(X.oid)):F=e.oidToDer(F));C.value.value.push(e.create(e.Class.CONTEXT_SPECIFIC,X.type,!1,F))}}else if(C.name==="nsComment"&&h.cert){if(!/^[\x00-\x7F]*$/.test(C.comment)||C.comment.length<1||C.comment.length>128)throw new Error('Invalid "nsComment" content.');C.value=e.create(e.Class.UNIVERSAL,e.Type.IA5STRING,!1,C.comment)}else if(C.name==="subjectKeyIdentifier"&&h.cert){var ue=h.cert.generateSubjectKeyIdentifier();C.subjectKeyIdentifier=ue.toHex(),C.value=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,ue.getBytes())}else if(C.name==="authorityKeyIdentifier"&&h.cert){C.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var z=C.value.value;if(C.keyIdentifier){var pe=C.keyIdentifier===!0?h.cert.generateSubjectKeyIdentifier().getBytes():C.keyIdentifier;z.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!1,pe))}if(C.authorityCertIssuer){var ge=[e.create(e.Class.CONTEXT_SPECIFIC,4,!0,[y(C.authorityCertIssuer===!0?h.cert.issuer:C.authorityCertIssuer)])];z.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,ge))}if(C.serialNumber){var ke=r.util.hexToBytes(C.serialNumber===!0?h.cert.serialNumber:C.serialNumber);z.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!1,ke))}}else if(C.name==="cRLDistributionPoints"){C.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var z=C.value.value,Ne=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),Le=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]),X,te=0;te<C.altNames.length;++te){X=C.altNames[te];var F=X.value;if(X.type===7&&X.ip){if(F=r.util.bytesFromIP(X.ip),F===null){var u=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw u.extension=C,u}}else X.type===8&&(X.oid?F=e.oidToDer(e.oidToDer(X.oid)):F=e.oidToDer(F));Le.value.push(e.create(e.Class.CONTEXT_SPECIFIC,X.type,!1,F))}Ne.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[Le])),z.push(Ne)}if(typeof C.value>"u"){var u=new Error("Extension value not specified.");throw u.extension=C,u}return C}function c(C,h){switch(C){case i["RSASSA-PSS"]:var u=[];return h.hash.algorithmOid!==void 0&&u.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(h.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])),h.mgf.algorithmOid!==void 0&&u.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(h.mgf.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(h.mgf.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])])),h.saltLength!==void 0&&u.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(h.saltLength).getBytes())])),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,u);default:return e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")}}function m(C){var h=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);if(C.attributes.length===0)return h;for(var u=C.attributes,_=0;_<u.length;++_){var M=u[_],G=M.value,F=e.Type.UTF8;"valueTagClass"in M&&(F=M.valueTagClass),F===e.Type.UTF8&&(G=r.util.encodeUtf8(G));var z=!1;"valueConstructed"in M&&(z=M.valueConstructed);var J=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(M.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,F,z,G)])]);h.value.push(J)}return h}var A=new Date("1950-01-01T00:00:00Z"),N=new Date("2050-01-01T00:00:00Z");function O(C){return C>=A&&C<N?e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(C)):e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(C))}return t.getTBSCertificate=function(C){var h=O(C.validity.notBefore),u=O(C.validity.notAfter),_=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(C.version).getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,r.util.hexToBytes(C.serialNumber)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(C.siginfo.algorithmOid).getBytes()),c(C.siginfo.algorithmOid,C.siginfo.parameters)]),y(C.issuer),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[h,u]),y(C.subject),t.publicKeyToAsn1(C.publicKey)]);return C.issuer.uniqueId&&_.value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+C.issuer.uniqueId)])),C.subject.uniqueId&&_.value.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+C.subject.uniqueId)])),C.extensions.length>0&&_.value.push(t.certificateExtensionsToAsn1(C.extensions)),_},t.getCertificationRequestInfo=function(C){var h=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(C.version).getBytes()),y(C.subject),t.publicKeyToAsn1(C.publicKey),m(C)]);return h},t.distinguishedNameToAsn1=function(C){return y(C)},t.certificateToAsn1=function(C){var h=C.tbsCertificate||t.getTBSCertificate(C);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[h,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(C.signatureOid).getBytes()),c(C.signatureOid,C.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+C.signature)])},t.certificateExtensionsToAsn1=function(C){var h=e.create(e.Class.CONTEXT_SPECIFIC,3,!0,[]),u=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);h.value.push(u);for(var _=0;_<C.length;++_)u.value.push(t.certificateExtensionToAsn1(C[_]));return h},t.certificateExtensionToAsn1=function(C){var h=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);h.value.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(C.id).getBytes())),C.critical&&h.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,"\xFF"));var u=C.value;return typeof C.value!="string"&&(u=e.toDer(u).getBytes()),h.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,u)),h},t.certificationRequestToAsn1=function(C){var h=C.certificationRequestInfo||t.getCertificationRequestInfo(C);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[h,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(C.signatureOid).getBytes()),c(C.signatureOid,C.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+C.signature)])},t.createCaStore=function(C){var h={certs:{}};h.getIssuer=function(F){var z=u(F.issuer);return z},h.addCertificate=function(F){if(typeof F=="string"&&(F=r.pki.certificateFromPem(F)),_(F.subject),!h.hasCertificate(F))if(F.subject.hash in h.certs){var z=h.certs[F.subject.hash];r.util.isArray(z)||(z=[z]),z.push(F),h.certs[F.subject.hash]=z}else h.certs[F.subject.hash]=F},h.hasCertificate=function(F){typeof F=="string"&&(F=r.pki.certificateFromPem(F));var z=u(F.subject);if(!z)return!1;r.util.isArray(z)||(z=[z]);for(var J=e.toDer(t.certificateToAsn1(F)).getBytes(),X=0;X<z.length;++X){var te=e.toDer(t.certificateToAsn1(z[X])).getBytes();if(J===te)return!0}return!1},h.listAllCertificates=function(){var F=[];for(var z in h.certs)if(h.certs.hasOwnProperty(z)){var J=h.certs[z];if(!r.util.isArray(J))F.push(J);else for(var X=0;X<J.length;++X)F.push(J[X])}return F},h.removeCertificate=function(F){var z;if(typeof F=="string"&&(F=r.pki.certificateFromPem(F)),_(F.subject),!h.hasCertificate(F))return null;var J=u(F.subject);if(!r.util.isArray(J))return z=h.certs[F.subject.hash],delete h.certs[F.subject.hash],z;for(var X=e.toDer(t.certificateToAsn1(F)).getBytes(),te=0;te<J.length;++te){var ue=e.toDer(t.certificateToAsn1(J[te])).getBytes();X===ue&&(z=J[te],J.splice(te,1))}return J.length===0&&delete h.certs[F.subject.hash],z};function u(F){return _(F),h.certs[F.hash]||null}function _(F){if(!F.hash){var z=r.md.sha1.create();F.attributes=t.RDNAttributesAsArray(y(F),z),F.hash=z.digest().toHex()}}if(C)for(var M=0;M<C.length;++M){var G=C[M];h.addCertificate(G)}return h},t.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"},t.verifyCertificateChain=function(C,h,u){typeof u=="function"&&(u={verify:u}),u=u||{},h=h.slice(0);var _=h.slice(0),M=u.validityCheckDate;typeof M>"u"&&(M=new Date);var G=!0,F=null,z=0;do{var J=h.shift(),X=null,te=!1;if(M&&(M<J.validity.notBefore||M>J.validity.notAfter)&&(F={message:"Certificate is not valid yet or has expired.",error:t.certificateError.certificate_expired,notBefore:J.validity.notBefore,notAfter:J.validity.notAfter,now:M}),F===null){if(X=h[0]||C.getIssuer(J),X===null&&J.isIssuer(J)&&(te=!0,X=J),X){var ue=X;r.util.isArray(ue)||(ue=[ue]);for(var pe=!1;!pe&&ue.length>0;){X=ue.shift();try{pe=X.verify(J)}catch{}}pe||(F={message:"Certificate signature is invalid.",error:t.certificateError.bad_certificate})}F===null&&(!X||te)&&!C.hasCertificate(J)&&(F={message:"Certificate is not trusted.",error:t.certificateError.unknown_ca})}if(F===null&&X&&!J.isIssuer(X)&&(F={message:"Certificate issuer is invalid.",error:t.certificateError.bad_certificate}),F===null)for(var ge={keyUsage:!0,basicConstraints:!0},ke=0;F===null&&ke<J.extensions.length;++ke){var Ne=J.extensions[ke];Ne.critical&&!(Ne.name in ge)&&(F={message:"Certificate has an unsupported critical extension.",error:t.certificateError.unsupported_certificate})}if(F===null&&(!G||h.length===0&&(!X||te))){var Le=J.getExtension("basicConstraints"),Ee=J.getExtension("keyUsage");if(Ee!==null&&(!Ee.keyCertSign||Le===null)&&(F={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:t.certificateError.bad_certificate}),F===null&&Le!==null&&!Le.cA&&(F={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:t.certificateError.bad_certificate}),F===null&&Ee!==null&&"pathLenConstraint"in Le){var fe=z-1;fe>Le.pathLenConstraint&&(F={message:"Certificate basicConstraints pathLenConstraint violated.",error:t.certificateError.bad_certificate})}}var Me=F===null?!0:F.error,ce=u.verify?u.verify(Me,z,_):Me;if(ce===!0)F=null;else throw Me===!0&&(F={message:"The application rejected the certificate.",error:t.certificateError.bad_certificate}),(ce||ce===0)&&(typeof ce=="object"&&!r.util.isArray(ce)?(ce.message&&(F.message=ce.message),ce.error&&(F.error=ce.error)):typeof ce=="string"&&(F.error=ce)),F;G=!1,++z}while(h.length>0);return!0},Ac.exports}var Kh;function jh(){if(Kh)return Ec.exports;Kh=1;var r=Ge();pr(),Fn(),si(),Oh(),Uh(),rr(),ws(),Kn(),We(),Nc();var e=r.asn1,t=r.pki,i=Ec.exports=r.pkcs12=r.pkcs12||{},a={name:"ContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},o={name:"PFX",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},a,{name:"PFX.macData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",optional:!0,tagClass:e.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},s={name:"SafeBag",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},n={name:"Attribute",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,capture:"values"}]},p={name:"CertBag",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:e.Class.UNIVERSAL,type:e.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function f(S,x,c,m){for(var A=[],N=0;N<S.length;N++)for(var O=0;O<S[N].safeBags.length;O++){var C=S[N].safeBags[O];if(!(m!==void 0&&C.type!==m)){if(x===null){A.push(C);continue}C.attributes[x]!==void 0&&C.attributes[x].indexOf(c)>=0&&A.push(C)}}return A}i.pkcs12FromAsn1=function(S,x,c){typeof x=="string"?(c=x,x=!0):x===void 0&&(x=!0);var m={},A=[];if(!e.validate(S,o,m,A)){var N=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw N.errors=N,N}var O={version:m.version.charCodeAt(0),safeContents:[],getBags:function(X){var te={},ue;return"localKeyId"in X?ue=X.localKeyId:"localKeyIdHex"in X&&(ue=r.util.hexToBytes(X.localKeyIdHex)),ue===void 0&&!("friendlyName"in X)&&"bagType"in X&&(te[X.bagType]=f(O.safeContents,null,null,X.bagType)),ue!==void 0&&(te.localKeyId=f(O.safeContents,"localKeyId",ue,X.bagType)),"friendlyName"in X&&(te.friendlyName=f(O.safeContents,"friendlyName",X.friendlyName,X.bagType)),te},getBagsByFriendlyName:function(X,te){return f(O.safeContents,"friendlyName",X,te)},getBagsByLocalKeyId:function(X,te){return f(O.safeContents,"localKeyId",X,te)}};if(m.version.charCodeAt(0)!==3){var N=new Error("PKCS#12 PFX of version other than 3 not supported.");throw N.version=m.version.charCodeAt(0),N}if(e.derToOid(m.contentType)!==t.oids.data){var N=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw N.oid=e.derToOid(m.contentType),N}var C=m.content.value[0];if(C.tagClass!==e.Class.UNIVERSAL||C.type!==e.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(C=E(C),m.mac){var h=null,u=0,_=e.derToOid(m.macAlgorithm);switch(_){case t.oids.sha1:h=r.md.sha1.create(),u=20;break;case t.oids.sha256:h=r.md.sha256.create(),u=32;break;case t.oids.sha384:h=r.md.sha384.create(),u=48;break;case t.oids.sha512:h=r.md.sha512.create(),u=64;break;case t.oids.md5:h=r.md.md5.create(),u=16;break}if(h===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+_);var M=new r.util.ByteBuffer(m.macSalt),G="macIterations"in m?parseInt(r.util.bytesToHex(m.macIterations),16):1,F=i.generateKey(c,M,3,G,u,h),z=r.hmac.create();z.start(h,F),z.update(C.value);var J=z.getMac();if(J.getBytes()!==m.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}else if(Array.isArray(S.value)&&S.value.length>2)throw new Error("Invalid PKCS#12. macData field present but MAC was not validated.");return I(O,C.value,x,c),O};function E(S){if(S.composed||S.constructed){for(var x=r.util.createBuffer(),c=0;c<S.value.length;++c)x.putBytes(S.value[c].value);S.composed=S.constructed=!1,S.value=x.getBytes()}return S}function I(S,x,c,m){if(x=e.fromDer(x,c),x.tagClass!==e.Class.UNIVERSAL||x.type!==e.Type.SEQUENCE||x.constructed!==!0)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var A=0;A<x.value.length;A++){var N=x.value[A],O={},C=[];if(!e.validate(N,a,O,C)){var h=new Error("Cannot read ContentInfo.");throw h.errors=C,h}var u={encrypted:!1},_=null,M=O.content.value[0];switch(e.derToOid(O.contentType)){case t.oids.data:if(M.tagClass!==e.Class.UNIVERSAL||M.type!==e.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");_=E(M).value;break;case t.oids.encryptedData:_=B(M,m),u.encrypted=!0;break;default:var h=new Error("Unsupported PKCS#12 contentType.");throw h.contentType=e.derToOid(O.contentType),h}u.safeBags=l(_,c,m),S.safeContents.push(u)}}function B(S,x){var c={},m=[];if(!e.validate(S,r.pkcs7.asn1.encryptedDataValidator,c,m)){var A=new Error("Cannot read EncryptedContentInfo.");throw A.errors=m,A}var N=e.derToOid(c.contentType);if(N!==t.oids.data){var A=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw A.oid=N,A}N=e.derToOid(c.encAlgorithm);var O=t.pbe.getCipher(N,c.encParameter,x),C=E(c.encryptedContentAsn1),h=r.util.createBuffer(C.value);if(O.update(h),!O.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return O.output.getBytes()}function l(S,x,c){if(!x&&S.length===0)return[];if(S=e.fromDer(S,x),S.tagClass!==e.Class.UNIVERSAL||S.type!==e.Type.SEQUENCE||S.constructed!==!0)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var m=[],A=0;A<S.value.length;A++){var N=S.value[A],O={},C=[];if(!e.validate(N,s,O,C)){var h=new Error("Cannot read SafeBag.");throw h.errors=C,h}var u={type:e.derToOid(O.bagId),attributes:y(O.bagAttributes)};m.push(u);var _,M,G=O.bagValue.value[0];switch(u.type){case t.oids.pkcs8ShroudedKeyBag:if(G=t.decryptPrivateKeyInfo(G,c),G===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case t.oids.keyBag:try{u.key=t.privateKeyFromAsn1(G)}catch{u.key=null,u.asn1=G}continue;case t.oids.certBag:_=p,M=function(){if(e.derToOid(O.certId)!==t.oids.x509Certificate){var z=new Error("Unsupported certificate type, only X.509 supported.");throw z.oid=e.derToOid(O.certId),z}var J=e.fromDer(O.cert,x);try{u.cert=t.certificateFromAsn1(J,!0)}catch{u.cert=null,u.asn1=J}};break;default:var h=new Error("Unsupported PKCS#12 SafeBag type.");throw h.oid=u.type,h}if(_!==void 0&&!e.validate(G,_,O,C)){var h=new Error("Cannot read PKCS#12 "+_.name);throw h.errors=C,h}M()}return m}function y(S){var x={};if(S!==void 0)for(var c=0;c<S.length;++c){var m={},A=[];if(!e.validate(S[c],n,m,A)){var N=new Error("Cannot read PKCS#12 BagAttribute.");throw N.errors=A,N}var O=e.derToOid(m.oid);if(t.oids[O]!==void 0){x[t.oids[O]]=[];for(var C=0;C<m.values.length;++C)x[t.oids[O]].push(m.values[C].value)}}return x}return i.toPkcs12Asn1=function(S,x,c,m){m=m||{},m.saltSize=m.saltSize||8,m.count=m.count||2048,m.algorithm=m.algorithm||m.encAlgorithm||"aes128","useMac"in m||(m.useMac=!0),"localKeyId"in m||(m.localKeyId=null),"generateLocalKeyId"in m||(m.generateLocalKeyId=!0);var A=m.localKeyId,N;if(A!==null)A=r.util.hexToBytes(A);else if(m.generateLocalKeyId)if(x){var O=r.util.isArray(x)?x[0]:x;typeof O=="string"&&(O=t.certificateFromPem(O));var C=r.md.sha1.create();C.update(e.toDer(t.certificateToAsn1(O)).getBytes()),A=C.digest().getBytes()}else A=r.random.getBytes(20);var h=[];A!==null&&h.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.localKeyId).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,A)])])),"friendlyName"in m&&h.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.friendlyName).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.BMPSTRING,!1,m.friendlyName)])])),h.length>0&&(N=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,h));var u=[],_=[];x!==null&&(r.util.isArray(x)?_=x:_=[x]);for(var M=[],G=0;G<_.length;++G){x=_[G],typeof x=="string"&&(x=t.certificateFromPem(x));var F=G===0?N:void 0,z=t.certificateToAsn1(x),J=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.certBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.x509Certificate).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(z).getBytes())])])]),F]);M.push(J)}if(M.length>0){var X=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,M),te=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(X).getBytes())])]);u.push(te)}var ue=null;if(S!==null){var pe=t.wrapRsaPrivateKey(t.privateKeyToAsn1(S));c===null?ue=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.keyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[pe]),N]):ue=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.pkcs8ShroudedKeyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[t.encryptPrivateKeyInfo(pe,c,m)]),N]);var ge=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[ue]),ke=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(ge).getBytes())])]);u.push(ke)}var Ne=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,u),Le;if(m.useMac){var C=r.md.sha1.create(),Ee=new r.util.ByteBuffer(r.random.getBytes(m.saltSize)),fe=m.count,S=i.generateKey(c,Ee,3,fe,20),Me=r.hmac.create();Me.start(C,S),Me.update(e.toDer(Ne).getBytes());var ce=Me.getMac();Le=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.sha1).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,ce.getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,Ee.getBytes()),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(fe).getBytes())])}return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(3).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(Ne).getBytes())])]),Le])},i.generateKey=r.pbe.generatePkcs12Key,Ec.exports}var Hh;function qh(){if(Hh)return cc.exports;Hh=1;var r=Ge();pr(),si(),Uh(),Vi(),pc(),jh(),Tc(),ws(),We(),Nc();var e=r.asn1,t=cc.exports=r.pki=r.pki||{};return t.pemToDer=function(i){var a=r.pem.decode(i)[0];if(a.procType&&a.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return r.util.createBuffer(a.body)},t.privateKeyFromPem=function(i){var a=r.pem.decode(i)[0];if(a.type!=="PRIVATE KEY"&&a.type!=="RSA PRIVATE KEY"){var o=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw o.headerType=a.type,o}if(a.procType&&a.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var s=e.fromDer(a.body);return t.privateKeyFromAsn1(s)},t.privateKeyToPem=function(i,a){var o={type:"RSA PRIVATE KEY",body:e.toDer(t.privateKeyToAsn1(i)).getBytes()};return r.pem.encode(o,{maxline:a})},t.privateKeyInfoToPem=function(i,a){var o={type:"PRIVATE KEY",body:e.toDer(i).getBytes()};return r.pem.encode(o,{maxline:a})},cc.exports}var kc,Gh;function $h(){if(Gh)return kc;Gh=1;var r=Ge();pr(),Fn(),oc(),Vi(),qh(),rr(),Kn(),We();var e=function(g,P,L,d){var k=r.util.createBuffer(),$=g.length>>1,q=$+(g.length&1),ae=g.substr(0,q),me=g.substr($,q),Ie=r.util.createBuffer(),re=r.hmac.create();L=P+L;var Ce=Math.ceil(d/16),Re=Math.ceil(d/20);re.start("MD5",ae);var Oe=r.util.createBuffer();Ie.putBytes(L);for(var De=0;De<Ce;++De)re.start(null,null),re.update(Ie.getBytes()),Ie.putBuffer(re.digest()),re.start(null,null),re.update(Ie.bytes()+L),Oe.putBuffer(re.digest());re.start("SHA1",me);var Ze=r.util.createBuffer();Ie.clear(),Ie.putBytes(L);for(var De=0;De<Re;++De)re.start(null,null),re.update(Ie.getBytes()),Ie.putBuffer(re.digest()),re.start(null,null),re.update(Ie.bytes()+L),Ze.putBuffer(re.digest());return k.putBytes(r.util.xorBytes(Oe.getBytes(),Ze.getBytes(),d)),k},t=function(g,P,L){var d=r.hmac.create();d.start("SHA1",g);var k=r.util.createBuffer();return k.putInt32(P[0]),k.putInt32(P[1]),k.putByte(L.type),k.putByte(L.version.major),k.putByte(L.version.minor),k.putInt16(L.length),k.putBytes(L.fragment.bytes()),d.update(k.getBytes()),d.digest().getBytes()},i=function(g,P,L){var d=!1;try{var k=g.deflate(P.fragment.getBytes());P.fragment=r.util.createBuffer(k),P.length=k.length,d=!0}catch{}return d},a=function(g,P,L){var d=!1;try{var k=g.inflate(P.fragment.getBytes());P.fragment=r.util.createBuffer(k),P.length=k.length,d=!0}catch{}return d},o=function(g,P){var L=0;switch(P){case 1:L=g.getByte();break;case 2:L=g.getInt16();break;case 3:L=g.getInt24();break;case 4:L=g.getInt32();break}return r.util.createBuffer(g.getBytes(L))},s=function(g,P,L){g.putInt(L.length(),P<<3),g.putBuffer(L)},n={};n.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}},n.SupportedVersions=[n.Versions.TLS_1_1,n.Versions.TLS_1_0],n.Version=n.SupportedVersions[0],n.MaxFragment=15360,n.ConnectionEnd={server:0,client:1},n.PRFAlgorithm={tls_prf_sha256:0},n.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},n.CipherType={stream:0,block:1,aead:2},n.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},n.CompressionMethod={none:0,deflate:1},n.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},n.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},n.Alert={},n.Alert.Level={warning:1,fatal:2},n.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},n.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},n.CipherSuites={},n.getCipherSuite=function(g){var P=null;for(var L in n.CipherSuites){var d=n.CipherSuites[L];if(d.id[0]===g.charCodeAt(0)&&d.id[1]===g.charCodeAt(1)){P=d;break}}return P},n.handleUnexpected=function(g,P){var L=!g.open&&g.entity===n.ConnectionEnd.client;L||g.error(g,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.unexpected_message}})},n.handleHelloRequest=function(g,P,L){!g.handshaking&&g.handshakes>0&&(n.queue(g,n.createAlert(g,{level:n.Alert.Level.warning,description:n.Alert.Description.no_renegotiation})),n.flush(g)),g.process()},n.parseHelloMessage=function(g,P,L){var d=null,k=g.entity===n.ConnectionEnd.client;if(L<38)g.error(g,{message:k?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.illegal_parameter}});else{var $=P.fragment,q=$.length();if(d={version:{major:$.getByte(),minor:$.getByte()},random:r.util.createBuffer($.getBytes(32)),session_id:o($,1),extensions:[]},k?(d.cipher_suite=$.getBytes(2),d.compression_method=$.getByte()):(d.cipher_suites=o($,2),d.compression_methods=o($,1)),q=L-(q-$.length()),q>0){for(var ae=o($,2);ae.length()>0;)d.extensions.push({type:[ae.getByte(),ae.getByte()],data:o(ae,2)});if(!k)for(var me=0;me<d.extensions.length;++me){var Ie=d.extensions[me];if(Ie.type[0]===0&&Ie.type[1]===0)for(var re=o(Ie.data,2);re.length()>0;){var Ce=re.getByte();if(Ce!==0)break;g.session.extensions.server_name.serverNameList.push(o(re,2).getBytes())}}}if(g.session.version&&(d.version.major!==g.session.version.major||d.version.minor!==g.session.version.minor))return g.error(g,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.protocol_version}});if(k)g.session.cipherSuite=n.getCipherSuite(d.cipher_suite);else for(var Re=r.util.createBuffer(d.cipher_suites.bytes());Re.length()>0&&(g.session.cipherSuite=n.getCipherSuite(Re.getBytes(2)),g.session.cipherSuite===null););if(g.session.cipherSuite===null)return g.error(g,{message:"No cipher suites in common.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.handshake_failure},cipherSuite:r.util.bytesToHex(d.cipher_suite)});k?g.session.compressionMethod=d.compression_method:g.session.compressionMethod=n.CompressionMethod.none}return d},n.createSecurityParameters=function(g,P){var L=g.entity===n.ConnectionEnd.client,d=P.random.bytes(),k=L?g.session.sp.client_random:d,$=L?d:n.createRandom().getBytes();g.session.sp={entity:g.entity,prf_algorithm:n.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:g.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:k,server_random:$}},n.handleServerHello=function(g,P,L){var d=n.parseHelloMessage(g,P,L);if(!g.fail){if(d.version.minor<=g.version.minor)g.version.minor=d.version.minor;else return g.error(g,{message:"Incompatible TLS version.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.protocol_version}});g.session.version=g.version;var k=d.session_id.bytes();k.length>0&&k===g.session.id?(g.expect=l,g.session.resuming=!0,g.session.sp.server_random=d.random.bytes()):(g.expect=f,g.session.resuming=!1,n.createSecurityParameters(g,d)),g.session.id=k,g.process()}},n.handleClientHello=function(g,P,L){var d=n.parseHelloMessage(g,P,L);if(!g.fail){var k=d.session_id.bytes(),$=null;if(g.sessionCache&&($=g.sessionCache.getSession(k),$===null?k="":($.version.major!==d.version.major||$.version.minor>d.version.minor)&&($=null,k="")),k.length===0&&(k=r.random.getBytes(32)),g.session.id=k,g.session.clientHelloVersion=d.version,g.session.sp={},$)g.version=g.session.version=$.version,g.session.sp=$.sp;else{for(var q,ae=1;ae<n.SupportedVersions.length&&(q=n.SupportedVersions[ae],!(q.minor<=d.version.minor));++ae);g.version={major:q.major,minor:q.minor},g.session.version=g.version}$!==null?(g.expect=O,g.session.resuming=!0,g.session.sp.client_random=d.random.bytes()):(g.expect=g.verifyClient!==!1?m:A,g.session.resuming=!1,n.createSecurityParameters(g,d)),g.open=!0,n.queue(g,n.createRecord(g,{type:n.ContentType.handshake,data:n.createServerHello(g)})),g.session.resuming?(n.queue(g,n.createRecord(g,{type:n.ContentType.change_cipher_spec,data:n.createChangeCipherSpec()})),g.state.pending=n.createConnectionState(g),g.state.current.write=g.state.pending.write,n.queue(g,n.createRecord(g,{type:n.ContentType.handshake,data:n.createFinished(g)}))):(n.queue(g,n.createRecord(g,{type:n.ContentType.handshake,data:n.createCertificate(g)})),g.fail||(n.queue(g,n.createRecord(g,{type:n.ContentType.handshake,data:n.createServerKeyExchange(g)})),g.verifyClient!==!1&&n.queue(g,n.createRecord(g,{type:n.ContentType.handshake,data:n.createCertificateRequest(g)})),n.queue(g,n.createRecord(g,{type:n.ContentType.handshake,data:n.createServerHelloDone(g)})))),n.flush(g),g.process()}},n.handleCertificate=function(g,P,L){if(L<3)return g.error(g,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.illegal_parameter}});var d=P.fragment,k={certificate_list:o(d,3)},$,q,ae=[];try{for(;k.certificate_list.length()>0;)$=o(k.certificate_list,3),q=r.asn1.fromDer($),$=r.pki.certificateFromAsn1(q,!0),ae.push($)}catch(Ie){return g.error(g,{message:"Could not parse certificate list.",cause:Ie,send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.bad_certificate}})}var me=g.entity===n.ConnectionEnd.client;(me||g.verifyClient===!0)&&ae.length===0?g.error(g,{message:me?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.illegal_parameter}}):ae.length===0?g.expect=me?E:A:(me?g.session.serverCertificate=ae[0]:g.session.clientCertificate=ae[0],n.verifyCertificateChain(g,ae)&&(g.expect=me?E:A)),g.process()},n.handleServerKeyExchange=function(g,P,L){if(L>0)return g.error(g,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.unsupported_certificate}});g.expect=I,g.process()},n.handleClientKeyExchange=function(g,P,L){if(L<48)return g.error(g,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.unsupported_certificate}});var d=P.fragment,k={enc_pre_master_secret:o(d,2).getBytes()},$=null;if(g.getPrivateKey)try{$=g.getPrivateKey(g,g.session.serverCertificate),$=r.pki.privateKeyFromPem($)}catch(me){g.error(g,{message:"Could not get private key.",cause:me,send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.internal_error}})}if($===null)return g.error(g,{message:"No private key set.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.internal_error}});try{var q=g.session.sp;q.pre_master_secret=$.decrypt(k.enc_pre_master_secret);var ae=g.session.clientHelloVersion;if(ae.major!==q.pre_master_secret.charCodeAt(0)||ae.minor!==q.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch{q.pre_master_secret=r.random.getBytes(48)}g.expect=O,g.session.clientCertificate!==null&&(g.expect=N),g.process()},n.handleCertificateRequest=function(g,P,L){if(L<3)return g.error(g,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.illegal_parameter}});var d=P.fragment,k={certificate_types:o(d,1),certificate_authorities:o(d,2)};g.session.certificateRequest=k,g.expect=B,g.process()},n.handleCertificateVerify=function(g,P,L){if(L<2)return g.error(g,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.illegal_parameter}});var d=P.fragment;d.read-=4;var k=d.bytes();d.read+=4;var $={signature:o(d,2).getBytes()},q=r.util.createBuffer();q.putBuffer(g.session.md5.digest()),q.putBuffer(g.session.sha1.digest()),q=q.getBytes();try{var ae=g.session.clientCertificate;if(!ae.publicKey.verify(q,$.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");g.session.md5.update(k),g.session.sha1.update(k)}catch{return g.error(g,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.handshake_failure}})}g.expect=O,g.process()},n.handleServerHelloDone=function(g,P,L){if(L>0)return g.error(g,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.record_overflow}});if(g.serverCertificate===null){var d={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.insufficient_security}},k=0,$=g.verify(g,d.alert.description,k,[]);if($!==!0)return($||$===0)&&(typeof $=="object"&&!r.util.isArray($)?($.message&&(d.message=$.message),$.alert&&(d.alert.description=$.alert)):typeof $=="number"&&(d.alert.description=$)),g.error(g,d)}g.session.certificateRequest!==null&&(P=n.createRecord(g,{type:n.ContentType.handshake,data:n.createCertificate(g)}),n.queue(g,P)),P=n.createRecord(g,{type:n.ContentType.handshake,data:n.createClientKeyExchange(g)}),n.queue(g,P),g.expect=x;var q=function(ae,me){ae.session.certificateRequest!==null&&ae.session.clientCertificate!==null&&n.queue(ae,n.createRecord(ae,{type:n.ContentType.handshake,data:n.createCertificateVerify(ae,me)})),n.queue(ae,n.createRecord(ae,{type:n.ContentType.change_cipher_spec,data:n.createChangeCipherSpec()})),ae.state.pending=n.createConnectionState(ae),ae.state.current.write=ae.state.pending.write,n.queue(ae,n.createRecord(ae,{type:n.ContentType.handshake,data:n.createFinished(ae)})),ae.expect=l,n.flush(ae),ae.process()};if(g.session.certificateRequest===null||g.session.clientCertificate===null)return q(g,null);n.getClientSignature(g,q)},n.handleChangeCipherSpec=function(g,P){if(P.fragment.getByte()!==1)return g.error(g,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.illegal_parameter}});var L=g.entity===n.ConnectionEnd.client;(g.session.resuming&&L||!g.session.resuming&&!L)&&(g.state.pending=n.createConnectionState(g)),g.state.current.read=g.state.pending.read,(!g.session.resuming&&L||g.session.resuming&&!L)&&(g.state.pending=null),g.expect=L?y:C,g.process()},n.handleFinished=function(g,P,L){var d=P.fragment;d.read-=4;var k=d.bytes();d.read+=4;var $=P.fragment.getBytes();d=r.util.createBuffer(),d.putBuffer(g.session.md5.digest()),d.putBuffer(g.session.sha1.digest());var q=g.entity===n.ConnectionEnd.client,ae=q?"server finished":"client finished",me=g.session.sp,Ie=12,re=e;if(d=re(me.master_secret,ae,d.getBytes(),Ie),d.getBytes()!==$)return g.error(g,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.decrypt_error}});g.session.md5.update(k),g.session.sha1.update(k),(g.session.resuming&&q||!g.session.resuming&&!q)&&(n.queue(g,n.createRecord(g,{type:n.ContentType.change_cipher_spec,data:n.createChangeCipherSpec()})),g.state.current.write=g.state.pending.write,g.state.pending=null,n.queue(g,n.createRecord(g,{type:n.ContentType.handshake,data:n.createFinished(g)}))),g.expect=q?S:h,g.handshaking=!1,++g.handshakes,g.peerCertificate=q?g.session.serverCertificate:g.session.clientCertificate,n.flush(g),g.isConnected=!0,g.connected(g),g.process()},n.handleAlert=function(g,P){var L=P.fragment,d={level:L.getByte(),description:L.getByte()},k;switch(d.description){case n.Alert.Description.close_notify:k="Connection closed.";break;case n.Alert.Description.unexpected_message:k="Unexpected message.";break;case n.Alert.Description.bad_record_mac:k="Bad record MAC.";break;case n.Alert.Description.decryption_failed:k="Decryption failed.";break;case n.Alert.Description.record_overflow:k="Record overflow.";break;case n.Alert.Description.decompression_failure:k="Decompression failed.";break;case n.Alert.Description.handshake_failure:k="Handshake failure.";break;case n.Alert.Description.bad_certificate:k="Bad certificate.";break;case n.Alert.Description.unsupported_certificate:k="Unsupported certificate.";break;case n.Alert.Description.certificate_revoked:k="Certificate revoked.";break;case n.Alert.Description.certificate_expired:k="Certificate expired.";break;case n.Alert.Description.certificate_unknown:k="Certificate unknown.";break;case n.Alert.Description.illegal_parameter:k="Illegal parameter.";break;case n.Alert.Description.unknown_ca:k="Unknown certificate authority.";break;case n.Alert.Description.access_denied:k="Access denied.";break;case n.Alert.Description.decode_error:k="Decode error.";break;case n.Alert.Description.decrypt_error:k="Decrypt error.";break;case n.Alert.Description.export_restriction:k="Export restriction.";break;case n.Alert.Description.protocol_version:k="Unsupported protocol version.";break;case n.Alert.Description.insufficient_security:k="Insufficient security.";break;case n.Alert.Description.internal_error:k="Internal error.";break;case n.Alert.Description.user_canceled:k="User canceled.";break;case n.Alert.Description.no_renegotiation:k="Renegotiation not supported.";break;default:k="Unknown error.";break}if(d.description===n.Alert.Description.close_notify)return g.close();g.error(g,{message:k,send:!1,origin:g.entity===n.ConnectionEnd.client?"server":"client",alert:d}),g.process()},n.handleHandshake=function(g,P){var L=P.fragment,d=L.getByte(),k=L.getInt24();if(k>L.length())return g.fragmented=P,P.fragment=r.util.createBuffer(),L.read-=4,g.process();g.fragmented=null,L.read-=4;var $=L.bytes(k+4);L.read+=4,d in Le[g.entity][g.expect]?(g.entity===n.ConnectionEnd.server&&!g.open&&!g.fail&&(g.handshaking=!0,g.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:r.md.md5.create(),sha1:r.md.sha1.create()}),d!==n.HandshakeType.hello_request&&d!==n.HandshakeType.certificate_verify&&d!==n.HandshakeType.finished&&(g.session.md5.update($),g.session.sha1.update($)),Le[g.entity][g.expect][d](g,P,k)):n.handleUnexpected(g,P)},n.handleApplicationData=function(g,P){g.data.putBuffer(P.fragment),g.dataReady(g),g.process()},n.handleHeartbeat=function(g,P){var L=P.fragment,d=L.getByte(),k=L.getInt16(),$=L.getBytes(k);if(d===n.HeartbeatMessageType.heartbeat_request){if(g.handshaking||k>$.length)return g.process();n.queue(g,n.createRecord(g,{type:n.ContentType.heartbeat,data:n.createHeartbeat(n.HeartbeatMessageType.heartbeat_response,$)})),n.flush(g)}else if(d===n.HeartbeatMessageType.heartbeat_response){if($!==g.expectedHeartbeatPayload)return g.process();g.heartbeatReceived&&g.heartbeatReceived(g,r.util.createBuffer($))}g.process()};var p=0,f=1,E=2,I=3,B=4,l=5,y=6,S=7,x=8,c=0,m=1,A=2,N=3,O=4,C=5,h=6,u=n.handleUnexpected,_=n.handleChangeCipherSpec,M=n.handleAlert,G=n.handleHandshake,F=n.handleApplicationData,z=n.handleHeartbeat,J=[];J[n.ConnectionEnd.client]=[[u,M,G,u,z],[u,M,G,u,z],[u,M,G,u,z],[u,M,G,u,z],[u,M,G,u,z],[_,M,u,u,z],[u,M,G,u,z],[u,M,G,F,z],[u,M,G,u,z]],J[n.ConnectionEnd.server]=[[u,M,G,u,z],[u,M,G,u,z],[u,M,G,u,z],[u,M,G,u,z],[_,M,u,u,z],[u,M,G,u,z],[u,M,G,F,z],[u,M,G,u,z]];var X=n.handleHelloRequest,te=n.handleServerHello,ue=n.handleCertificate,pe=n.handleServerKeyExchange,ge=n.handleCertificateRequest,ke=n.handleServerHelloDone,Ne=n.handleFinished,Le=[];Le[n.ConnectionEnd.client]=[[u,u,te,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[X,u,u,u,u,u,u,u,u,u,u,ue,pe,ge,ke,u,u,u,u,u,u],[X,u,u,u,u,u,u,u,u,u,u,u,pe,ge,ke,u,u,u,u,u,u],[X,u,u,u,u,u,u,u,u,u,u,u,u,ge,ke,u,u,u,u,u,u],[X,u,u,u,u,u,u,u,u,u,u,u,u,u,ke,u,u,u,u,u,u],[X,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[X,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,Ne],[X,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[X,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u]];var Ee=n.handleClientHello,fe=n.handleClientKeyExchange,Me=n.handleCertificateVerify;Le[n.ConnectionEnd.server]=[[u,Ee,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,ue,u,u,u,u,u,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,fe,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,Me,u,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,Ne],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u]],n.generateKeys=function(g,P){var L=e,d=P.client_random+P.server_random;g.session.resuming||(P.master_secret=L(P.pre_master_secret,"master secret",d,48).bytes(),P.pre_master_secret=null),d=P.server_random+P.client_random;var k=2*P.mac_key_length+2*P.enc_key_length,$=g.version.major===n.Versions.TLS_1_0.major&&g.version.minor===n.Versions.TLS_1_0.minor;$&&(k+=2*P.fixed_iv_length);var q=L(P.master_secret,"key expansion",d,k),ae={client_write_MAC_key:q.getBytes(P.mac_key_length),server_write_MAC_key:q.getBytes(P.mac_key_length),client_write_key:q.getBytes(P.enc_key_length),server_write_key:q.getBytes(P.enc_key_length)};return $&&(ae.client_write_IV=q.getBytes(P.fixed_iv_length),ae.server_write_IV=q.getBytes(P.fixed_iv_length)),ae},n.createConnectionState=function(g){var P=g.entity===n.ConnectionEnd.client,L=function(){var $={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(q){return!0},compressionState:null,compressFunction:function(q){return!0},updateSequenceNumber:function(){$.sequenceNumber[1]===4294967295?($.sequenceNumber[1]=0,++$.sequenceNumber[0]):++$.sequenceNumber[1]}};return $},d={read:L(),write:L()};if(d.read.update=function($,q){return d.read.cipherFunction(q,d.read)?d.read.compressFunction($,q,d.read)||$.error($,{message:"Could not decompress record.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.decompression_failure}}):$.error($,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.bad_record_mac}}),!$.fail},d.write.update=function($,q){return d.write.compressFunction($,q,d.write)?d.write.cipherFunction(q,d.write)||$.error($,{message:"Could not encrypt record.",send:!1,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.internal_error}}):$.error($,{message:"Could not compress record.",send:!1,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.internal_error}}),!$.fail},g.session){var k=g.session.sp;switch(g.session.cipherSuite.initSecurityParameters(k),k.keys=n.generateKeys(g,k),d.read.macKey=P?k.keys.server_write_MAC_key:k.keys.client_write_MAC_key,d.write.macKey=P?k.keys.client_write_MAC_key:k.keys.server_write_MAC_key,g.session.cipherSuite.initConnectionState(d,g,k),k.compression_algorithm){case n.CompressionMethod.none:break;case n.CompressionMethod.deflate:d.read.compressFunction=a,d.write.compressFunction=i;break;default:throw new Error("Unsupported compression algorithm.")}}return d},n.createRandom=function(){var g=new Date,P=+g+g.getTimezoneOffset()*6e4,L=r.util.createBuffer();return L.putInt32(P),L.putBytes(r.random.getBytes(28)),L},n.createRecord=function(g,P){if(!P.data)return null;var L={type:P.type,version:{major:g.version.major,minor:g.version.minor},length:P.data.length(),fragment:P.data};return L},n.createAlert=function(g,P){var L=r.util.createBuffer();return L.putByte(P.level),L.putByte(P.description),n.createRecord(g,{type:n.ContentType.alert,data:L})},n.createClientHello=function(g){g.session.clientHelloVersion={major:g.version.major,minor:g.version.minor};for(var P=r.util.createBuffer(),L=0;L<g.cipherSuites.length;++L){var d=g.cipherSuites[L];P.putByte(d.id[0]),P.putByte(d.id[1])}var k=P.length(),$=r.util.createBuffer();$.putByte(n.CompressionMethod.none);var q=$.length(),ae=r.util.createBuffer();if(g.virtualHost){var me=r.util.createBuffer();me.putByte(0),me.putByte(0);var Ie=r.util.createBuffer();Ie.putByte(0),s(Ie,2,r.util.createBuffer(g.virtualHost));var re=r.util.createBuffer();s(re,2,Ie),s(me,2,re),ae.putBuffer(me)}var Ce=ae.length();Ce>0&&(Ce+=2);var Re=g.session.id,Oe=Re.length+1+2+4+28+2+k+1+q+Ce,De=r.util.createBuffer();return De.putByte(n.HandshakeType.client_hello),De.putInt24(Oe),De.putByte(g.version.major),De.putByte(g.version.minor),De.putBytes(g.session.sp.client_random),s(De,1,r.util.createBuffer(Re)),s(De,2,P),s(De,1,$),Ce>0&&s(De,2,ae),De},n.createServerHello=function(g){var P=g.session.id,L=P.length+1+2+4+28+2+1,d=r.util.createBuffer();return d.putByte(n.HandshakeType.server_hello),d.putInt24(L),d.putByte(g.version.major),d.putByte(g.version.minor),d.putBytes(g.session.sp.server_random),s(d,1,r.util.createBuffer(P)),d.putByte(g.session.cipherSuite.id[0]),d.putByte(g.session.cipherSuite.id[1]),d.putByte(g.session.compressionMethod),d},n.createCertificate=function(g){var P=g.entity===n.ConnectionEnd.client,L=null;if(g.getCertificate){var d;P?d=g.session.certificateRequest:d=g.session.extensions.server_name.serverNameList,L=g.getCertificate(g,d)}var k=r.util.createBuffer();if(L!==null)try{r.util.isArray(L)||(L=[L]);for(var $=null,q=0;q<L.length;++q){var ae=r.pem.decode(L[q])[0];if(ae.type!=="CERTIFICATE"&&ae.type!=="X509 CERTIFICATE"&&ae.type!=="TRUSTED CERTIFICATE"){var me=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw me.headerType=ae.type,me}if(ae.procType&&ae.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var Ie=r.util.createBuffer(ae.body);$===null&&($=r.asn1.fromDer(Ie.bytes(),!1));var re=r.util.createBuffer();s(re,3,Ie),k.putBuffer(re)}L=r.pki.certificateFromAsn1($),P?g.session.clientCertificate=L:g.session.serverCertificate=L}catch(Oe){return g.error(g,{message:"Could not send certificate list.",cause:Oe,send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.bad_certificate}})}var Ce=3+k.length(),Re=r.util.createBuffer();return Re.putByte(n.HandshakeType.certificate),Re.putInt24(Ce),s(Re,3,k),Re},n.createClientKeyExchange=function(g){var P=r.util.createBuffer();P.putByte(g.session.clientHelloVersion.major),P.putByte(g.session.clientHelloVersion.minor),P.putBytes(r.random.getBytes(46));var L=g.session.sp;L.pre_master_secret=P.getBytes();var d=g.session.serverCertificate.publicKey;P=d.encrypt(L.pre_master_secret);var k=P.length+2,$=r.util.createBuffer();return $.putByte(n.HandshakeType.client_key_exchange),$.putInt24(k),$.putInt16(P.length),$.putBytes(P),$},n.createServerKeyExchange=function(g){var P=r.util.createBuffer();return P},n.getClientSignature=function(g,P){var L=r.util.createBuffer();L.putBuffer(g.session.md5.digest()),L.putBuffer(g.session.sha1.digest()),L=L.getBytes(),g.getSignature=g.getSignature||function(d,k,$){var q=null;if(d.getPrivateKey)try{q=d.getPrivateKey(d,d.session.clientCertificate),q=r.pki.privateKeyFromPem(q)}catch(ae){d.error(d,{message:"Could not get private key.",cause:ae,send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.internal_error}})}q===null?d.error(d,{message:"No private key set.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.internal_error}}):k=q.sign(k,null),$(d,k)},g.getSignature(g,L,P)},n.createCertificateVerify=function(g,P){var L=P.length+2,d=r.util.createBuffer();return d.putByte(n.HandshakeType.certificate_verify),d.putInt24(L),d.putInt16(P.length),d.putBytes(P),d},n.createCertificateRequest=function(g){var P=r.util.createBuffer();P.putByte(1);var L=r.util.createBuffer();for(var d in g.caStore.certs){var k=g.caStore.certs[d],$=r.pki.distinguishedNameToAsn1(k.subject),q=r.asn1.toDer($);L.putInt16(q.length()),L.putBuffer(q)}var ae=1+P.length()+2+L.length(),me=r.util.createBuffer();return me.putByte(n.HandshakeType.certificate_request),me.putInt24(ae),s(me,1,P),s(me,2,L),me},n.createServerHelloDone=function(g){var P=r.util.createBuffer();return P.putByte(n.HandshakeType.server_hello_done),P.putInt24(0),P},n.createChangeCipherSpec=function(){var g=r.util.createBuffer();return g.putByte(1),g},n.createFinished=function(g){var P=r.util.createBuffer();P.putBuffer(g.session.md5.digest()),P.putBuffer(g.session.sha1.digest());var L=g.entity===n.ConnectionEnd.client,d=g.session.sp,k=12,$=e,q=L?"client finished":"server finished";P=$(d.master_secret,q,P.getBytes(),k);var ae=r.util.createBuffer();return ae.putByte(n.HandshakeType.finished),ae.putInt24(P.length()),ae.putBuffer(P),ae},n.createHeartbeat=function(g,P,L){typeof L>"u"&&(L=P.length);var d=r.util.createBuffer();d.putByte(g),d.putInt16(L),d.putBytes(P);var k=d.length(),$=Math.max(16,k-L-3);return d.putBytes(r.random.getBytes($)),d},n.queue=function(g,P){if(P&&!(P.fragment.length()===0&&(P.type===n.ContentType.handshake||P.type===n.ContentType.alert||P.type===n.ContentType.change_cipher_spec))){if(P.type===n.ContentType.handshake){var L=P.fragment.bytes();g.session.md5.update(L),g.session.sha1.update(L),L=null}var d;if(P.fragment.length()<=n.MaxFragment)d=[P];else{d=[];for(var k=P.fragment.bytes();k.length>n.MaxFragment;)d.push(n.createRecord(g,{type:P.type,data:r.util.createBuffer(k.slice(0,n.MaxFragment))})),k=k.slice(n.MaxFragment);k.length>0&&d.push(n.createRecord(g,{type:P.type,data:r.util.createBuffer(k)}))}for(var $=0;$<d.length&&!g.fail;++$){var q=d[$],ae=g.state.current.write;ae.update(g,q)&&g.records.push(q)}}},n.flush=function(g){for(var P=0;P<g.records.length;++P){var L=g.records[P];g.tlsData.putByte(L.type),g.tlsData.putByte(L.version.major),g.tlsData.putByte(L.version.minor),g.tlsData.putInt16(L.fragment.length()),g.tlsData.putBuffer(g.records[P].fragment)}return g.records=[],g.tlsDataReady(g)};var ce=function(g){switch(g){case!0:return!0;case r.pki.certificateError.bad_certificate:return n.Alert.Description.bad_certificate;case r.pki.certificateError.unsupported_certificate:return n.Alert.Description.unsupported_certificate;case r.pki.certificateError.certificate_revoked:return n.Alert.Description.certificate_revoked;case r.pki.certificateError.certificate_expired:return n.Alert.Description.certificate_expired;case r.pki.certificateError.certificate_unknown:return n.Alert.Description.certificate_unknown;case r.pki.certificateError.unknown_ca:return n.Alert.Description.unknown_ca;default:return n.Alert.Description.bad_certificate}},st=function(g){switch(g){case!0:return!0;case n.Alert.Description.bad_certificate:return r.pki.certificateError.bad_certificate;case n.Alert.Description.unsupported_certificate:return r.pki.certificateError.unsupported_certificate;case n.Alert.Description.certificate_revoked:return r.pki.certificateError.certificate_revoked;case n.Alert.Description.certificate_expired:return r.pki.certificateError.certificate_expired;case n.Alert.Description.certificate_unknown:return r.pki.certificateError.certificate_unknown;case n.Alert.Description.unknown_ca:return r.pki.certificateError.unknown_ca;default:return r.pki.certificateError.bad_certificate}};n.verifyCertificateChain=function(g,P){try{var L={};for(var d in g.verifyOptions)L[d]=g.verifyOptions[d];L.verify=function($,q,ae){var me=ce($),Ie=g.verify(g,$,q,ae);if(Ie!==!0){if(typeof Ie=="object"&&!r.util.isArray(Ie)){var re=new Error("The application rejected the certificate.");throw re.send=!0,re.alert={level:n.Alert.Level.fatal,description:n.Alert.Description.bad_certificate},Ie.message&&(re.message=Ie.message),Ie.alert&&(re.alert.description=Ie.alert),re}Ie!==$&&(Ie=st(Ie))}return Ie},r.pki.verifyCertificateChain(g.caStore,P,L)}catch($){var k=$;(typeof k!="object"||r.util.isArray(k))&&(k={send:!0,alert:{level:n.Alert.Level.fatal,description:ce($)}}),"send"in k||(k.send=!0),"alert"in k||(k.alert={level:n.Alert.Level.fatal,description:ce(k.error)}),g.error(g,k)}return!g.fail},n.createSessionCache=function(g,P){var L=null;if(g&&g.getSession&&g.setSession&&g.order)L=g;else{L={},L.cache=g||{},L.capacity=Math.max(P||100,1),L.order=[];for(var d in g)L.order.length<=P?L.order.push(d):delete g[d];L.getSession=function(k){var $=null,q=null;if(k?q=r.util.bytesToHex(k):L.order.length>0&&(q=L.order[0]),q!==null&&q in L.cache){$=L.cache[q],delete L.cache[q];for(var ae in L.order)if(L.order[ae]===q){L.order.splice(ae,1);break}}return $},L.setSession=function(k,$){if(L.order.length===L.capacity){var q=L.order.shift();delete L.cache[q]}var q=r.util.bytesToHex(k);L.order.push(q),L.cache[q]=$}}return L},n.createConnection=function(g){var P=null;g.caStore?r.util.isArray(g.caStore)?P=r.pki.createCaStore(g.caStore):P=g.caStore:P=r.pki.createCaStore();var L=g.cipherSuites||null;if(L===null){L=[];for(var d in n.CipherSuites)L.push(n.CipherSuites[d])}var k=g.server?n.ConnectionEnd.server:n.ConnectionEnd.client,$=g.sessionCache?n.createSessionCache(g.sessionCache):null,q={version:{major:n.Version.major,minor:n.Version.minor},entity:k,sessionId:g.sessionId,caStore:P,sessionCache:$,cipherSuites:L,connected:g.connected,virtualHost:g.virtualHost||null,verifyClient:g.verifyClient||!1,verify:g.verify||function(re,Ce,Re,Oe){return Ce},verifyOptions:g.verifyOptions||{},getCertificate:g.getCertificate||null,getPrivateKey:g.getPrivateKey||null,getSignature:g.getSignature||null,input:r.util.createBuffer(),tlsData:r.util.createBuffer(),data:r.util.createBuffer(),tlsDataReady:g.tlsDataReady,dataReady:g.dataReady,heartbeatReceived:g.heartbeatReceived,closed:g.closed,error:function(re,Ce){Ce.origin=Ce.origin||(re.entity===n.ConnectionEnd.client?"client":"server"),Ce.send&&(n.queue(re,n.createAlert(re,Ce.alert)),n.flush(re));var Re=Ce.fatal!==!1;Re&&(re.fail=!0),g.error(re,Ce),Re&&re.close(!1)},deflate:g.deflate||null,inflate:g.inflate||null};q.reset=function(re){q.version={major:n.Version.major,minor:n.Version.minor},q.record=null,q.session=null,q.peerCertificate=null,q.state={pending:null,current:null},q.expect=q.entity===n.ConnectionEnd.client?p:c,q.fragmented=null,q.records=[],q.open=!1,q.handshakes=0,q.handshaking=!1,q.isConnected=!1,q.fail=!(re||typeof re>"u"),q.input.clear(),q.tlsData.clear(),q.data.clear(),q.state.current=n.createConnectionState(q)},q.reset();var ae=function(re,Ce){var Re=Ce.type-n.ContentType.change_cipher_spec,Oe=J[re.entity][re.expect];Re in Oe?Oe[Re](re,Ce):n.handleUnexpected(re,Ce)},me=function(re){var Ce=0,Re=re.input,Oe=Re.length();if(Oe<5)Ce=5-Oe;else{re.record={type:Re.getByte(),version:{major:Re.getByte(),minor:Re.getByte()},length:Re.getInt16(),fragment:r.util.createBuffer(),ready:!1};var De=re.record.version.major===re.version.major;De&&re.session&&re.session.version&&(De=re.record.version.minor===re.version.minor),De||re.error(re,{message:"Incompatible TLS version.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.protocol_version}})}return Ce},Ie=function(re){var Ce=0,Re=re.input,Oe=Re.length();if(Oe<re.record.length)Ce=re.record.length-Oe;else{re.record.fragment.putBytes(Re.getBytes(re.record.length)),Re.compact();var De=re.state.current.read;De.update(re,re.record)&&(re.fragmented!==null&&(re.fragmented.type===re.record.type?(re.fragmented.fragment.putBuffer(re.record.fragment),re.record=re.fragmented):re.error(re,{message:"Invalid fragmented record.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.unexpected_message}})),re.record.ready=!0)}return Ce};return q.handshake=function(re){if(q.entity!==n.ConnectionEnd.client)q.error(q,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(q.handshaking)q.error(q,{message:"Handshake already in progress.",fatal:!1});else{q.fail&&!q.open&&q.handshakes===0&&(q.fail=!1),q.handshaking=!0,re=re||"";var Ce=null;re.length>0&&(q.sessionCache&&(Ce=q.sessionCache.getSession(re)),Ce===null&&(re="")),re.length===0&&q.sessionCache&&(Ce=q.sessionCache.getSession(),Ce!==null&&(re=Ce.id)),q.session={id:re,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:r.md.md5.create(),sha1:r.md.sha1.create()},Ce&&(q.version=Ce.version,q.session.sp=Ce.sp),q.session.sp.client_random=n.createRandom().getBytes(),q.open=!0,n.queue(q,n.createRecord(q,{type:n.ContentType.handshake,data:n.createClientHello(q)})),n.flush(q)}},q.process=function(re){var Ce=0;return re&&q.input.putBytes(re),q.fail||(q.record!==null&&q.record.ready&&q.record.fragment.isEmpty()&&(q.record=null),q.record===null&&(Ce=me(q)),!q.fail&&q.record!==null&&!q.record.ready&&(Ce=Ie(q)),!q.fail&&q.record!==null&&q.record.ready&&ae(q,q.record)),Ce},q.prepare=function(re){return n.queue(q,n.createRecord(q,{type:n.ContentType.application_data,data:r.util.createBuffer(re)})),n.flush(q)},q.prepareHeartbeatRequest=function(re,Ce){return re instanceof r.util.ByteBuffer&&(re=re.bytes()),typeof Ce>"u"&&(Ce=re.length),q.expectedHeartbeatPayload=re,n.queue(q,n.createRecord(q,{type:n.ContentType.heartbeat,data:n.createHeartbeat(n.HeartbeatMessageType.heartbeat_request,re,Ce)})),n.flush(q)},q.close=function(re){if(!q.fail&&q.sessionCache&&q.session){var Ce={id:q.session.id,version:q.session.version,sp:q.session.sp};Ce.sp.keys=null,q.sessionCache.setSession(Ce.id,Ce)}q.open&&(q.open=!1,q.input.clear(),(q.isConnected||q.handshaking)&&(q.isConnected=q.handshaking=!1,n.queue(q,n.createAlert(q,{level:n.Alert.Level.warning,description:n.Alert.Description.close_notify})),n.flush(q)),q.closed(q)),q.reset(re)},q},kc=r.tls=r.tls||{};for(var Ve in n)typeof n[Ve]!="function"&&(r.tls[Ve]=n[Ve]);return r.tls.prf_tls1=e,r.tls.hmac_sha1=t,r.tls.createSessionCache=n.createSessionCache,r.tls.createConnection=n.createConnection,kc}var zh;function uy(){if(zh)return tc.exports;zh=1;var r=Ge();ai(),$h();var e=tc.exports=r.tls;e.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(p){p.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,p.cipher_type=e.CipherType.block,p.enc_key_length=16,p.block_length=16,p.fixed_iv_length=16,p.record_iv_length=16,p.mac_algorithm=e.MACAlgorithm.hmac_sha1,p.mac_length=20,p.mac_key_length=20},initConnectionState:t},e.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(p){p.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,p.cipher_type=e.CipherType.block,p.enc_key_length=32,p.block_length=16,p.fixed_iv_length=16,p.record_iv_length=16,p.mac_algorithm=e.MACAlgorithm.hmac_sha1,p.mac_length=20,p.mac_key_length=20},initConnectionState:t};function t(p,f,E){var I=f.entity===r.tls.ConnectionEnd.client;p.read.cipherState={init:!1,cipher:r.cipher.createDecipher("AES-CBC",I?E.keys.server_write_key:E.keys.client_write_key),iv:I?E.keys.server_write_IV:E.keys.client_write_IV},p.write.cipherState={init:!1,cipher:r.cipher.createCipher("AES-CBC",I?E.keys.client_write_key:E.keys.server_write_key),iv:I?E.keys.client_write_IV:E.keys.server_write_IV},p.read.cipherFunction=s,p.write.cipherFunction=i,p.read.macLength=p.write.macLength=E.mac_length,p.read.macFunction=p.write.macFunction=e.hmac_sha1}function i(p,f){var E=!1,I=f.macFunction(f.macKey,f.sequenceNumber,p);p.fragment.putBytes(I),f.updateSequenceNumber();var B;p.version.minor===e.Versions.TLS_1_0.minor?B=f.cipherState.init?null:f.cipherState.iv:B=r.random.getBytesSync(16),f.cipherState.init=!0;var l=f.cipherState.cipher;return l.start({iv:B}),p.version.minor>=e.Versions.TLS_1_1.minor&&l.output.putBytes(B),l.update(p.fragment),l.finish(a)&&(p.fragment=l.output,p.length=p.fragment.length(),E=!0),E}function a(p,f,E){if(!E){var I=p-f.length()%p;f.fillWithByte(I-1,I)}return!0}function o(p,f,E){var I=!0;if(E){for(var B=f.length(),l=f.last(),y=B-1-l;y<B-1;++y)I=I&&f.at(y)==l;I&&f.truncate(l+1)}return I}function s(p,f){var E=!1,I;p.version.minor===e.Versions.TLS_1_0.minor?I=f.cipherState.init?null:f.cipherState.iv:I=p.fragment.getBytes(16),f.cipherState.init=!0;var B=f.cipherState.cipher;B.start({iv:I}),B.update(p.fragment),E=B.finish(o);var l=f.macLength,y=r.random.getBytesSync(l),S=B.output.length();S>=l?(p.fragment=B.output.getBytes(S-l),y=B.output.getBytes(l)):p.fragment=B.output.getBytes(),p.fragment=r.util.createBuffer(p.fragment),p.length=p.fragment.length();var x=f.macFunction(f.macKey,f.sequenceNumber,p);return f.updateSequenceNumber(),E=n(f.macKey,y,x)&&E,E}function n(p,f,E){var I=r.hmac.create();return I.start("SHA1",p),I.update(f),f=I.digest().getBytes(),I.start(null,null),I.update(E),E=I.digest().getBytes(),f===E}return tc.exports}var _c={exports:{}},Wh;function Qh(){if(Wh)return _c.exports;Wh=1;var r=Ge();Ar(),We();var e=_c.exports=r.sha512=r.sha512||{};r.md.sha512=r.md.algorithms.sha512=e;var t=r.sha384=r.sha512.sha384=r.sha512.sha384||{};t.create=function(){return e.create("SHA-384")},r.md.sha384=r.md.algorithms.sha384=t,r.sha512.sha256=r.sha512.sha256||{create:function(){return e.create("SHA-512/256")}},r.md["sha512/256"]=r.md.algorithms["sha512/256"]=r.sha512.sha256,r.sha512.sha224=r.sha512.sha224||{create:function(){return e.create("SHA-512/224")}},r.md["sha512/224"]=r.md.algorithms["sha512/224"]=r.sha512.sha224,e.create=function(f){if(a||n(),typeof f>"u"&&(f="SHA-512"),!(f in s))throw new Error("Invalid SHA-512 algorithm: "+f);for(var E=s[f],I=null,B=r.util.createBuffer(),l=new Array(80),y=0;y<80;++y)l[y]=new Array(2);var S=64;switch(f){case"SHA-384":S=48;break;case"SHA-512/256":S=32;break;case"SHA-512/224":S=28;break}var x={algorithm:f.replace("-","").toLowerCase(),blockLength:128,digestLength:S,messageLength:0,fullMessageLength:null,messageLengthSize:16};return x.start=function(){x.messageLength=0,x.fullMessageLength=x.messageLength128=[];for(var c=x.messageLengthSize/4,m=0;m<c;++m)x.fullMessageLength.push(0);B=r.util.createBuffer(),I=new Array(E.length);for(var m=0;m<E.length;++m)I[m]=E[m].slice(0);return x},x.start(),x.update=function(c,m){m==="utf8"&&(c=r.util.encodeUtf8(c));var A=c.length;x.messageLength+=A,A=[A/4294967296>>>0,A>>>0];for(var N=x.fullMessageLength.length-1;N>=0;--N)x.fullMessageLength[N]+=A[1],A[1]=A[0]+(x.fullMessageLength[N]/4294967296>>>0),x.fullMessageLength[N]=x.fullMessageLength[N]>>>0,A[0]=A[1]/4294967296>>>0;return B.putBytes(c),p(I,l,B),(B.read>2048||B.length()===0)&&B.compact(),x},x.digest=function(){var c=r.util.createBuffer();c.putBytes(B.bytes());var m=x.fullMessageLength[x.fullMessageLength.length-1]+x.messageLengthSize,A=m&x.blockLength-1;c.putBytes(i.substr(0,x.blockLength-A));for(var N,O,C=x.fullMessageLength[0]*8,h=0;h<x.fullMessageLength.length-1;++h)N=x.fullMessageLength[h+1]*8,O=N/4294967296>>>0,C+=O,c.putInt32(C>>>0),C=N>>>0;c.putInt32(C);for(var u=new Array(I.length),h=0;h<I.length;++h)u[h]=I[h].slice(0);p(u,l,c);var _=r.util.createBuffer(),M;f==="SHA-512"?M=u.length:f==="SHA-384"?M=u.length-2:M=u.length-4;for(var h=0;h<M;++h)_.putInt32(u[h][0]),(h!==M-1||f!=="SHA-512/224")&&_.putInt32(u[h][1]);return _},x};var i=null,a=!1,o=null,s=null;function n(){i="\x80",i+=r.util.fillString("\0",128),o=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],s={},s["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],s["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],s["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],s["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],a=!0}function p(f,E,I){for(var B,l,y,S,x,c,m,A,N,O,C,h,u,_,M,G,F,z,J,X,te,ue,pe,ge,ke,Ne,Le,Ee,fe,Me,ce,st,Ve,g,P,L=I.length();L>=128;){for(fe=0;fe<16;++fe)E[fe][0]=I.getInt32()>>>0,E[fe][1]=I.getInt32()>>>0;for(;fe<80;++fe)st=E[fe-2],Me=st[0],ce=st[1],B=((Me>>>19|ce<<13)^(ce>>>29|Me<<3)^Me>>>6)>>>0,l=((Me<<13|ce>>>19)^(ce<<3|Me>>>29)^(Me<<26|ce>>>6))>>>0,g=E[fe-15],Me=g[0],ce=g[1],y=((Me>>>1|ce<<31)^(Me>>>8|ce<<24)^Me>>>7)>>>0,S=((Me<<31|ce>>>1)^(Me<<24|ce>>>8)^(Me<<25|ce>>>7))>>>0,Ve=E[fe-7],P=E[fe-16],ce=l+Ve[1]+S+P[1],E[fe][0]=B+Ve[0]+y+P[0]+(ce/4294967296>>>0)>>>0,E[fe][1]=ce>>>0;for(u=f[0][0],_=f[0][1],M=f[1][0],G=f[1][1],F=f[2][0],z=f[2][1],J=f[3][0],X=f[3][1],te=f[4][0],ue=f[4][1],pe=f[5][0],ge=f[5][1],ke=f[6][0],Ne=f[6][1],Le=f[7][0],Ee=f[7][1],fe=0;fe<80;++fe)m=((te>>>14|ue<<18)^(te>>>18|ue<<14)^(ue>>>9|te<<23))>>>0,A=((te<<18|ue>>>14)^(te<<14|ue>>>18)^(ue<<23|te>>>9))>>>0,N=(ke^te&(pe^ke))>>>0,O=(Ne^ue&(ge^Ne))>>>0,x=((u>>>28|_<<4)^(_>>>2|u<<30)^(_>>>7|u<<25))>>>0,c=((u<<4|_>>>28)^(_<<30|u>>>2)^(_<<25|u>>>7))>>>0,C=(u&M|F&(u^M))>>>0,h=(_&G|z&(_^G))>>>0,ce=Ee+A+O+o[fe][1]+E[fe][1],B=Le+m+N+o[fe][0]+E[fe][0]+(ce/4294967296>>>0)>>>0,l=ce>>>0,ce=c+h,y=x+C+(ce/4294967296>>>0)>>>0,S=ce>>>0,Le=ke,Ee=Ne,ke=pe,Ne=ge,pe=te,ge=ue,ce=X+l,te=J+B+(ce/4294967296>>>0)>>>0,ue=ce>>>0,J=F,X=z,F=M,z=G,M=u,G=_,ce=l+S,u=B+y+(ce/4294967296>>>0)>>>0,_=ce>>>0;ce=f[0][1]+_,f[0][0]=f[0][0]+u+(ce/4294967296>>>0)>>>0,f[0][1]=ce>>>0,ce=f[1][1]+G,f[1][0]=f[1][0]+M+(ce/4294967296>>>0)>>>0,f[1][1]=ce>>>0,ce=f[2][1]+z,f[2][0]=f[2][0]+F+(ce/4294967296>>>0)>>>0,f[2][1]=ce>>>0,ce=f[3][1]+X,f[3][0]=f[3][0]+J+(ce/4294967296>>>0)>>>0,f[3][1]=ce>>>0,ce=f[4][1]+ue,f[4][0]=f[4][0]+te+(ce/4294967296>>>0)>>>0,f[4][1]=ce>>>0,ce=f[5][1]+ge,f[5][0]=f[5][0]+pe+(ce/4294967296>>>0)>>>0,f[5][1]=ce>>>0,ce=f[6][1]+Ne,f[6][0]=f[6][0]+ke+(ce/4294967296>>>0)>>>0,f[6][1]=ce>>>0,ce=f[7][1]+Ee,f[7][0]=f[7][0]+Le+(ce/4294967296>>>0)>>>0,f[7][1]=ce>>>0,L-=128}}return _c.exports}var Is={},Yh;function cy(){if(Yh)return Is;Yh=1;var r=Ge();pr();var e=r.asn1;return Is.privateKeyValidator={name:"PrivateKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},Is.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]},Is}var Rc,Xh;function ly(){if(Xh)return Rc;Xh=1;var r=Ge();As(),rr(),Qh(),We();var e=cy(),t=e.publicKeyValidator,i=e.privateKeyValidator;if(typeof a>"u")var a=r.jsbn.BigInteger;var o=r.util.ByteBuffer,s=typeof Buffer>"u"?Uint8Array:Buffer;r.pki=r.pki||{},Rc=r.pki.ed25519=r.ed25519=r.ed25519||{};var n=r.ed25519;n.constants={},n.constants.PUBLIC_KEY_BYTE_LENGTH=32,n.constants.PRIVATE_KEY_BYTE_LENGTH=64,n.constants.SEED_BYTE_LENGTH=32,n.constants.SIGN_BYTE_LENGTH=64,n.constants.HASH_BYTE_LENGTH=64,n.generateKeyPair=function(g){g=g||{};var P=g.seed;if(P===void 0)P=r.random.getBytesSync(n.constants.SEED_BYTE_LENGTH);else if(typeof P=="string"){if(P.length!==n.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+n.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(P instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');P=p({message:P,encoding:"binary"});for(var L=new s(n.constants.PUBLIC_KEY_BYTE_LENGTH),d=new s(n.constants.PRIVATE_KEY_BYTE_LENGTH),k=0;k<32;++k)d[k]=P[k];return m(L,d),{publicKey:L,privateKey:d}},n.privateKeyFromAsn1=function(g){var P={},L=[],d=r.asn1.validate(g,i,P,L);if(!d){var k=new Error("Invalid Key.");throw k.errors=L,k}var $=r.asn1.derToOid(P.privateKeyOid),q=r.oids.EdDSA25519;if($!==q)throw new Error('Invalid OID "'+$+'"; OID must be "'+q+'".');var ae=P.privateKey,me=p({message:r.asn1.fromDer(ae).value,encoding:"binary"});return{privateKeyBytes:me}},n.publicKeyFromAsn1=function(g){var P={},L=[],d=r.asn1.validate(g,t,P,L);if(!d){var k=new Error("Invalid Key.");throw k.errors=L,k}var $=r.asn1.derToOid(P.publicKeyOid),q=r.oids.EdDSA25519;if($!==q)throw new Error('Invalid OID "'+$+'"; OID must be "'+q+'".');var ae=P.ed25519PublicKey;if(ae.length!==n.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return p({message:ae,encoding:"binary"})},n.publicKeyFromPrivateKey=function(g){g=g||{};var P=p({message:g.privateKey,encoding:"binary"});if(P.length!==n.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+n.constants.PRIVATE_KEY_BYTE_LENGTH);for(var L=new s(n.constants.PUBLIC_KEY_BYTE_LENGTH),d=0;d<L.length;++d)L[d]=P[32+d];return L},n.sign=function(g){g=g||{};var P=p(g),L=p({message:g.privateKey,encoding:"binary"});if(L.length===n.constants.SEED_BYTE_LENGTH){var d=n.generateKeyPair({seed:L});L=d.privateKey}else if(L.length!==n.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+n.constants.SEED_BYTE_LENGTH+" or "+n.constants.PRIVATE_KEY_BYTE_LENGTH);var k=new s(n.constants.SIGN_BYTE_LENGTH+P.length);A(k,P,P.length,L);for(var $=new s(n.constants.SIGN_BYTE_LENGTH),q=0;q<$.length;++q)$[q]=k[q];return $},n.verify=function(g){g=g||{};var P=p(g);if(g.signature===void 0)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var L=p({message:g.signature,encoding:"binary"});if(L.length!==n.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+n.constants.SIGN_BYTE_LENGTH);var d=p({message:g.publicKey,encoding:"binary"});if(d.length!==n.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+n.constants.PUBLIC_KEY_BYTE_LENGTH);var k=new s(n.constants.SIGN_BYTE_LENGTH+P.length),$=new s(n.constants.SIGN_BYTE_LENGTH+P.length),q;for(q=0;q<n.constants.SIGN_BYTE_LENGTH;++q)k[q]=L[q];for(q=0;q<P.length;++q)k[q+n.constants.SIGN_BYTE_LENGTH]=P[q];return N($,k,k.length,d)>=0};function p(g){var P=g.message;if(P instanceof Uint8Array||P instanceof s)return P;var L=g.encoding;if(P===void 0)if(g.md)P=g.md.digest().getBytes(),L="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof P=="string"&&!L)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof P=="string"){if(typeof Buffer<"u")return Buffer.from(P,L);P=new o(P,L)}else if(!(P instanceof o))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 d=new s(P.length()),k=0;k<d.length;++k)d[k]=P.at(k);return d}var f=fe(),E=fe([1]),I=fe([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),B=fe([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),l=fe([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=fe([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),S=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]),x=fe([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function c(g,P){var L=r.md.sha512.create(),d=new o(g);L.update(d.getBytes(P),"binary");var k=L.digest().getBytes();if(typeof Buffer<"u")return Buffer.from(k,"binary");for(var $=new s(n.constants.HASH_BYTE_LENGTH),q=0;q<64;++q)$[q]=k.charCodeAt(q);return $}function m(g,P){var L=[fe(),fe(),fe(),fe()],d,k=c(P,32);for(k[0]&=248,k[31]&=127,k[31]|=64,ge(L,k),_(g,L),d=0;d<32;++d)P[d+32]=g[d];return 0}function A(g,P,L,d){var k,$,q=new Float64Array(64),ae=[fe(),fe(),fe(),fe()],me=c(d,32);me[0]&=248,me[31]&=127,me[31]|=64;var Ie=L+64;for(k=0;k<L;++k)g[64+k]=P[k];for(k=0;k<32;++k)g[32+k]=me[32+k];var re=c(g.subarray(32),L+32);for(C(re),ge(ae,re),_(g,ae),k=32;k<64;++k)g[k]=d[k];var Ce=c(g,L+64);for(C(Ce),k=32;k<64;++k)q[k]=0;for(k=0;k<32;++k)q[k]=re[k];for(k=0;k<32;++k)for($=0;$<32;$++)q[k+$]+=Ce[k]*me[$];return O(g.subarray(32),q),Ie}function N(g,P,L,d){var k,$,q=new s(32),ae=[fe(),fe(),fe(),fe()],me=[fe(),fe(),fe(),fe()];if($=-1,L<64||G(me,d))return-1;for(k=0;k<L;++k)g[k]=P[k];for(k=0;k<32;++k)g[k+32]=d[k];var Ie=c(g,L);if(C(Ie),pe(ae,me,Ie),ge(me,P.subarray(32)),h(ae,me),_(q,ae),L-=64,X(P,0,q,0)){for(k=0;k<L;++k)g[k]=0;return-1}for(k=0;k<L;++k)g[k]=P[k+64];return $=L,$}function O(g,P){var L,d,k,$;for(d=63;d>=32;--d){for(L=0,k=d-32,$=d-12;k<$;++k)P[k]+=L-16*P[d]*S[k-(d-32)],L=P[k]+128>>8,P[k]-=L*256;P[k]+=L,P[d]=0}for(L=0,k=0;k<32;++k)P[k]+=L-(P[31]>>4)*S[k],L=P[k]>>8,P[k]&=255;for(k=0;k<32;++k)P[k]-=L*S[k];for(d=0;d<32;++d)P[d+1]+=P[d]>>8,g[d]=P[d]&255}function C(g){for(var P=new Float64Array(64),L=0;L<64;++L)P[L]=g[L],g[L]=0;O(g,P)}function h(g,P){var L=fe(),d=fe(),k=fe(),$=fe(),q=fe(),ae=fe(),me=fe(),Ie=fe(),re=fe();ce(L,g[1],g[0]),ce(re,P[1],P[0]),Ve(L,L,re),Me(d,g[0],g[1]),Me(re,P[0],P[1]),Ve(d,d,re),Ve(k,g[3],P[3]),Ve(k,k,B),Ve($,g[2],P[2]),Me($,$,$),ce(q,d,L),ce(ae,$,k),Me(me,$,k),Me(Ie,d,L),Ve(g[0],q,ae),Ve(g[1],Ie,me),Ve(g[2],me,ae),Ve(g[3],q,Ie)}function u(g,P,L){for(var d=0;d<4;++d)Ee(g[d],P[d],L)}function _(g,P){var L=fe(),d=fe(),k=fe();Ne(k,P[2]),Ve(L,P[0],k),Ve(d,P[1],k),M(g,d),g[31]^=ue(L)<<7}function M(g,P){var L,d,k,$=fe(),q=fe();for(L=0;L<16;++L)q[L]=P[L];for(Le(q),Le(q),Le(q),d=0;d<2;++d){for($[0]=q[0]-65517,L=1;L<15;++L)$[L]=q[L]-65535-($[L-1]>>16&1),$[L-1]&=65535;$[15]=q[15]-32767-($[14]>>16&1),k=$[15]>>16&1,$[14]&=65535,Ee(q,$,1-k)}for(L=0;L<16;L++)g[2*L]=q[L]&255,g[2*L+1]=q[L]>>8}function G(g,P){var L=fe(),d=fe(),k=fe(),$=fe(),q=fe(),ae=fe(),me=fe();return ke(g[2],E),F(g[1],P),st(k,g[1]),Ve($,k,I),ce(k,k,g[2]),Me($,g[2],$),st(q,$),st(ae,q),Ve(me,ae,q),Ve(L,me,k),Ve(L,L,$),z(L,L),Ve(L,L,k),Ve(L,L,$),Ve(L,L,$),Ve(g[0],L,$),st(d,g[0]),Ve(d,d,$),J(d,k)&&Ve(g[0],g[0],x),st(d,g[0]),Ve(d,d,$),J(d,k)?-1:(ue(g[0])===P[31]>>7&&ce(g[0],f,g[0]),Ve(g[3],g[0],g[1]),0)}function F(g,P){var L;for(L=0;L<16;++L)g[L]=P[2*L]+(P[2*L+1]<<8);g[15]&=32767}function z(g,P){var L=fe(),d;for(d=0;d<16;++d)L[d]=P[d];for(d=250;d>=0;--d)st(L,L),d!==1&&Ve(L,L,P);for(d=0;d<16;++d)g[d]=L[d]}function J(g,P){var L=new s(32),d=new s(32);return M(L,g),M(d,P),X(L,0,d,0)}function X(g,P,L,d){return te(g,P,L,d,32)}function te(g,P,L,d,k){var $,q=0;for($=0;$<k;++$)q|=g[P+$]^L[d+$];return(1&q-1>>>8)-1}function ue(g){var P=new s(32);return M(P,g),P[0]&1}function pe(g,P,L){var d,k;for(ke(g[0],f),ke(g[1],E),ke(g[2],E),ke(g[3],f),k=255;k>=0;--k)d=L[k/8|0]>>(k&7)&1,u(g,P,d),h(P,g),h(g,g),u(g,P,d)}function ge(g,P){var L=[fe(),fe(),fe(),fe()];ke(L[0],l),ke(L[1],y),ke(L[2],E),Ve(L[3],l,y),pe(g,L,P)}function ke(g,P){var L;for(L=0;L<16;L++)g[L]=P[L]|0}function Ne(g,P){var L=fe(),d;for(d=0;d<16;++d)L[d]=P[d];for(d=253;d>=0;--d)st(L,L),d!==2&&d!==4&&Ve(L,L,P);for(d=0;d<16;++d)g[d]=L[d]}function Le(g){var P,L,d=1;for(P=0;P<16;++P)L=g[P]+d+65535,d=Math.floor(L/65536),g[P]=L-d*65536;g[0]+=d-1+37*(d-1)}function Ee(g,P,L){for(var d,k=~(L-1),$=0;$<16;++$)d=k&(g[$]^P[$]),g[$]^=d,P[$]^=d}function fe(g){var P,L=new Float64Array(16);if(g)for(P=0;P<g.length;++P)L[P]=g[P];return L}function Me(g,P,L){for(var d=0;d<16;++d)g[d]=P[d]+L[d]}function ce(g,P,L){for(var d=0;d<16;++d)g[d]=P[d]-L[d]}function st(g,P){Ve(g,P,P)}function Ve(g,P,L){var d,k,$=0,q=0,ae=0,me=0,Ie=0,re=0,Ce=0,Re=0,Oe=0,De=0,Ze=0,Qe=0,tt=0,R=0,v=0,b=0,j=0,W=0,V=0,H=0,Z=0,ne=0,de=0,Ue=0,_e=0,Pe=0,ve=0,xe=0,be=0,Te=0,He=0,Fe=L[0],qe=L[1],Xe=L[2],ot=L[3],ut=L[4],ct=L[5],dt=L[6],yt=L[7],vt=L[8],gt=L[9],mt=L[10],Ct=L[11],at=L[12],pt=L[13],xt=L[14],St=L[15];d=P[0],$+=d*Fe,q+=d*qe,ae+=d*Xe,me+=d*ot,Ie+=d*ut,re+=d*ct,Ce+=d*dt,Re+=d*yt,Oe+=d*vt,De+=d*gt,Ze+=d*mt,Qe+=d*Ct,tt+=d*at,R+=d*pt,v+=d*xt,b+=d*St,d=P[1],q+=d*Fe,ae+=d*qe,me+=d*Xe,Ie+=d*ot,re+=d*ut,Ce+=d*ct,Re+=d*dt,Oe+=d*yt,De+=d*vt,Ze+=d*gt,Qe+=d*mt,tt+=d*Ct,R+=d*at,v+=d*pt,b+=d*xt,j+=d*St,d=P[2],ae+=d*Fe,me+=d*qe,Ie+=d*Xe,re+=d*ot,Ce+=d*ut,Re+=d*ct,Oe+=d*dt,De+=d*yt,Ze+=d*vt,Qe+=d*gt,tt+=d*mt,R+=d*Ct,v+=d*at,b+=d*pt,j+=d*xt,W+=d*St,d=P[3],me+=d*Fe,Ie+=d*qe,re+=d*Xe,Ce+=d*ot,Re+=d*ut,Oe+=d*ct,De+=d*dt,Ze+=d*yt,Qe+=d*vt,tt+=d*gt,R+=d*mt,v+=d*Ct,b+=d*at,j+=d*pt,W+=d*xt,V+=d*St,d=P[4],Ie+=d*Fe,re+=d*qe,Ce+=d*Xe,Re+=d*ot,Oe+=d*ut,De+=d*ct,Ze+=d*dt,Qe+=d*yt,tt+=d*vt,R+=d*gt,v+=d*mt,b+=d*Ct,j+=d*at,W+=d*pt,V+=d*xt,H+=d*St,d=P[5],re+=d*Fe,Ce+=d*qe,Re+=d*Xe,Oe+=d*ot,De+=d*ut,Ze+=d*ct,Qe+=d*dt,tt+=d*yt,R+=d*vt,v+=d*gt,b+=d*mt,j+=d*Ct,W+=d*at,V+=d*pt,H+=d*xt,Z+=d*St,d=P[6],Ce+=d*Fe,Re+=d*qe,Oe+=d*Xe,De+=d*ot,Ze+=d*ut,Qe+=d*ct,tt+=d*dt,R+=d*yt,v+=d*vt,b+=d*gt,j+=d*mt,W+=d*Ct,V+=d*at,H+=d*pt,Z+=d*xt,ne+=d*St,d=P[7],Re+=d*Fe,Oe+=d*qe,De+=d*Xe,Ze+=d*ot,Qe+=d*ut,tt+=d*ct,R+=d*dt,v+=d*yt,b+=d*vt,j+=d*gt,W+=d*mt,V+=d*Ct,H+=d*at,Z+=d*pt,ne+=d*xt,de+=d*St,d=P[8],Oe+=d*Fe,De+=d*qe,Ze+=d*Xe,Qe+=d*ot,tt+=d*ut,R+=d*ct,v+=d*dt,b+=d*yt,j+=d*vt,W+=d*gt,V+=d*mt,H+=d*Ct,Z+=d*at,ne+=d*pt,de+=d*xt,Ue+=d*St,d=P[9],De+=d*Fe,Ze+=d*qe,Qe+=d*Xe,tt+=d*ot,R+=d*ut,v+=d*ct,b+=d*dt,j+=d*yt,W+=d*vt,V+=d*gt,H+=d*mt,Z+=d*Ct,ne+=d*at,de+=d*pt,Ue+=d*xt,_e+=d*St,d=P[10],Ze+=d*Fe,Qe+=d*qe,tt+=d*Xe,R+=d*ot,v+=d*ut,b+=d*ct,j+=d*dt,W+=d*yt,V+=d*vt,H+=d*gt,Z+=d*mt,ne+=d*Ct,de+=d*at,Ue+=d*pt,_e+=d*xt,Pe+=d*St,d=P[11],Qe+=d*Fe,tt+=d*qe,R+=d*Xe,v+=d*ot,b+=d*ut,j+=d*ct,W+=d*dt,V+=d*yt,H+=d*vt,Z+=d*gt,ne+=d*mt,de+=d*Ct,Ue+=d*at,_e+=d*pt,Pe+=d*xt,ve+=d*St,d=P[12],tt+=d*Fe,R+=d*qe,v+=d*Xe,b+=d*ot,j+=d*ut,W+=d*ct,V+=d*dt,H+=d*yt,Z+=d*vt,ne+=d*gt,de+=d*mt,Ue+=d*Ct,_e+=d*at,Pe+=d*pt,ve+=d*xt,xe+=d*St,d=P[13],R+=d*Fe,v+=d*qe,b+=d*Xe,j+=d*ot,W+=d*ut,V+=d*ct,H+=d*dt,Z+=d*yt,ne+=d*vt,de+=d*gt,Ue+=d*mt,_e+=d*Ct,Pe+=d*at,ve+=d*pt,xe+=d*xt,be+=d*St,d=P[14],v+=d*Fe,b+=d*qe,j+=d*Xe,W+=d*ot,V+=d*ut,H+=d*ct,Z+=d*dt,ne+=d*yt,de+=d*vt,Ue+=d*gt,_e+=d*mt,Pe+=d*Ct,ve+=d*at,xe+=d*pt,be+=d*xt,Te+=d*St,d=P[15],b+=d*Fe,j+=d*qe,W+=d*Xe,V+=d*ot,H+=d*ut,Z+=d*ct,ne+=d*dt,de+=d*yt,Ue+=d*vt,_e+=d*gt,Pe+=d*mt,ve+=d*Ct,xe+=d*at,be+=d*pt,Te+=d*xt,He+=d*St,$+=38*j,q+=38*W,ae+=38*V,me+=38*H,Ie+=38*Z,re+=38*ne,Ce+=38*de,Re+=38*Ue,Oe+=38*_e,De+=38*Pe,Ze+=38*ve,Qe+=38*xe,tt+=38*be,R+=38*Te,v+=38*He,k=1,d=$+k+65535,k=Math.floor(d/65536),$=d-k*65536,d=q+k+65535,k=Math.floor(d/65536),q=d-k*65536,d=ae+k+65535,k=Math.floor(d/65536),ae=d-k*65536,d=me+k+65535,k=Math.floor(d/65536),me=d-k*65536,d=Ie+k+65535,k=Math.floor(d/65536),Ie=d-k*65536,d=re+k+65535,k=Math.floor(d/65536),re=d-k*65536,d=Ce+k+65535,k=Math.floor(d/65536),Ce=d-k*65536,d=Re+k+65535,k=Math.floor(d/65536),Re=d-k*65536,d=Oe+k+65535,k=Math.floor(d/65536),Oe=d-k*65536,d=De+k+65535,k=Math.floor(d/65536),De=d-k*65536,d=Ze+k+65535,k=Math.floor(d/65536),Ze=d-k*65536,d=Qe+k+65535,k=Math.floor(d/65536),Qe=d-k*65536,d=tt+k+65535,k=Math.floor(d/65536),tt=d-k*65536,d=R+k+65535,k=Math.floor(d/65536),R=d-k*65536,d=v+k+65535,k=Math.floor(d/65536),v=d-k*65536,d=b+k+65535,k=Math.floor(d/65536),b=d-k*65536,$+=k-1+37*(k-1),k=1,d=$+k+65535,k=Math.floor(d/65536),$=d-k*65536,d=q+k+65535,k=Math.floor(d/65536),q=d-k*65536,d=ae+k+65535,k=Math.floor(d/65536),ae=d-k*65536,d=me+k+65535,k=Math.floor(d/65536),me=d-k*65536,d=Ie+k+65535,k=Math.floor(d/65536),Ie=d-k*65536,d=re+k+65535,k=Math.floor(d/65536),re=d-k*65536,d=Ce+k+65535,k=Math.floor(d/65536),Ce=d-k*65536,d=Re+k+65535,k=Math.floor(d/65536),Re=d-k*65536,d=Oe+k+65535,k=Math.floor(d/65536),Oe=d-k*65536,d=De+k+65535,k=Math.floor(d/65536),De=d-k*65536,d=Ze+k+65535,k=Math.floor(d/65536),Ze=d-k*65536,d=Qe+k+65535,k=Math.floor(d/65536),Qe=d-k*65536,d=tt+k+65535,k=Math.floor(d/65536),tt=d-k*65536,d=R+k+65535,k=Math.floor(d/65536),R=d-k*65536,d=v+k+65535,k=Math.floor(d/65536),v=d-k*65536,d=b+k+65535,k=Math.floor(d/65536),b=d-k*65536,$+=k-1+37*(k-1),g[0]=$,g[1]=q,g[2]=ae,g[3]=me,g[4]=Ie,g[5]=re,g[6]=Ce,g[7]=Re,g[8]=Oe,g[9]=De,g[10]=Ze,g[11]=Qe,g[12]=tt,g[13]=R,g[14]=v,g[15]=b}return Rc}var Uc,Jh;function fy(){if(Jh)return Uc;Jh=1;var r=Ge();We(),rr(),As(),Uc=r.kem=r.kem||{};var e=r.jsbn.BigInteger;r.kem.rsa={},r.kem.rsa.create=function(i,a){a=a||{};var o=a.prng||r.random,s={};return s.encrypt=function(n,p){var f=Math.ceil(n.n.bitLength()/8),E;do E=new e(r.util.bytesToHex(o.getBytesSync(f)),16).mod(n.n);while(E.compareTo(e.ONE)<=0);E=r.util.hexToBytes(E.toString(16));var I=f-E.length;I>0&&(E=r.util.fillString("\0",I)+E);var B=n.encrypt(E,"NONE"),l=i.generate(E,p);return{encapsulation:B,key:l}},s.decrypt=function(n,p,f){var E=n.decrypt(p,"NONE");return i.generate(E,f)},s},r.kem.kdf1=function(i,a){t(this,i,0,a||i.digestLength)},r.kem.kdf2=function(i,a){t(this,i,1,a||i.digestLength)};function t(i,a,o,s){i.generate=function(n,p){for(var f=new r.util.ByteBuffer,E=Math.ceil(p/s)+o,I=new r.util.ByteBuffer,B=o;B<E;++B){I.putInt32(B),a.start(),a.update(n+I.getBytes());var l=a.digest();f.putBytes(l.getBytes(s))}return f.truncate(f.length()-p),f.getBytes()}}return Uc}var Lc,Zh;function hy(){if(Zh)return Lc;Zh=1;var r=Ge();We(),Lc=r.log=r.log||{},r.log.levels=["none","error","warning","info","debug","verbose","max"];var e={},t=[],i=null;r.log.LEVEL_LOCKED=2,r.log.NO_LEVEL_CHECK=4,r.log.INTERPOLATE=8;for(var a=0;a<r.log.levels.length;++a){var o=r.log.levels[a];e[o]={index:a,name:o.toUpperCase()}}r.log.logMessage=function(B){for(var l=e[B.level].index,y=0;y<t.length;++y){var S=t[y];if(S.flags&r.log.NO_LEVEL_CHECK)S.f(B);else{var x=e[S.level].index;l<=x&&S.f(S,B)}}},r.log.prepareStandard=function(B){"standard"in B||(B.standard=e[B.level].name+" ["+B.category+"] "+B.message)},r.log.prepareFull=function(B){if(!("full"in B)){var l=[B.message];l=l.concat([]),B.full=r.util.format.apply(this,l)}},r.log.prepareStandardFull=function(B){"standardFull"in B||(r.log.prepareStandard(B),B.standardFull=B.standard)};for(var s=["error","warning","info","debug","verbose"],a=0;a<s.length;++a)(function(l){r.log[l]=function(y,S){var x=Array.prototype.slice.call(arguments).slice(2),c={timestamp:new Date,level:l,category:y,message:S,arguments:x};r.log.logMessage(c)}})(s[a]);if(r.log.makeLogger=function(B){var l={flags:0,f:B};return r.log.setLevel(l,"none"),l},r.log.setLevel=function(B,l){var y=!1;if(B&&!(B.flags&r.log.LEVEL_LOCKED))for(var S=0;S<r.log.levels.length;++S){var x=r.log.levels[S];if(l==x){B.level=l,y=!0;break}}return y},r.log.lock=function(B,l){typeof l>"u"||l?B.flags|=r.log.LEVEL_LOCKED:B.flags&=~r.log.LEVEL_LOCKED},r.log.addLogger=function(B){t.push(B)},typeof console<"u"&&"log"in console){var n;if(console.error&&console.warn&&console.info&&console.debug){var p={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},f=function(B,l){r.log.prepareStandard(l);var y=p[l.level],S=[l.standard];S=S.concat(l.arguments.slice()),y.apply(console,S)};n=r.log.makeLogger(f)}else{var f=function(l,y){r.log.prepareStandardFull(y),console.log(y.standardFull)};n=r.log.makeLogger(f)}r.log.setLevel(n,"debug"),r.log.addLogger(n),i=n}else console={log:function(){}};if(i!==null&&typeof window<"u"&&window.location){var E=new URL(window.location.href).searchParams;if(E.has("console.level")&&r.log.setLevel(i,E.get("console.level").slice(-1)[0]),E.has("console.lock")){var I=E.get("console.lock").slice(-1)[0];I=="true"&&r.log.lock(i)}}return r.log.consoleLogger=i,Lc}var Oc,ep;function py(){return ep||(ep=1,Oc=Ar(),oc(),Kn(),Ch(),Qh()),Oc}var Dc={exports:{}},tp;function dy(){if(tp)return Dc.exports;tp=1;var r=Ge();ai(),pr(),Es(),si(),Vi(),Oh(),rr(),We(),Nc();var e=r.asn1,t=Dc.exports=r.pkcs7=r.pkcs7||{};t.messageFromPem=function(l){var y=r.pem.decode(l)[0];if(y.type!=="PKCS7"){var S=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw S.headerType=y.type,S}if(y.procType&&y.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var x=e.fromDer(y.body);return t.messageFromAsn1(x)},t.messageToPem=function(l,y){var S={type:"PKCS7",body:e.toDer(l.toAsn1()).getBytes()};return r.pem.encode(S,{maxline:y})},t.messageFromAsn1=function(l){var y={},S=[];if(!e.validate(l,t.asn1.contentInfoValidator,y,S)){var x=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw x.errors=S,x}var c=e.derToOid(y.contentType),m;switch(c){case r.pki.oids.envelopedData:m=t.createEnvelopedData();break;case r.pki.oids.encryptedData:m=t.createEncryptedData();break;case r.pki.oids.signedData:m=t.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+c+" is not (yet) supported.")}return m.fromAsn1(y.content.value[0]),m},t.createSignedData=function(){var l=null;return l={type:r.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(x){if(I(l,x,t.asn1.signedDataValidator),l.certificates=[],l.crls=[],l.digestAlgorithmIdentifiers=[],l.contentInfo=null,l.signerInfos=[],l.rawCapture.certificates)for(var c=l.rawCapture.certificates.value,m=0;m<c.length;++m)l.certificates.push(r.pki.certificateFromAsn1(c[m]))},toAsn1:function(){l.contentInfo||l.sign();for(var x=[],c=0;c<l.certificates.length;++c)x.push(r.pki.certificateToAsn1(l.certificates[c]));var m=[],A=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(l.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,l.digestAlgorithmIdentifiers),l.contentInfo])]);return x.length>0&&A.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,x)),m.length>0&&A.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,m)),A.value[0].value.push(e.create(e.Class.UNIVERSAL,e.Type.SET,!0,l.signerInfos)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(l.type).getBytes()),A])},addSigner:function(x){var c=x.issuer,m=x.serialNumber;if(x.certificate){var A=x.certificate;typeof A=="string"&&(A=r.pki.certificateFromPem(A)),c=A.issuer.attributes,m=A.serialNumber}var N=x.key;if(!N)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof N=="string"&&(N=r.pki.privateKeyFromPem(N));var O=x.digestAlgorithm||r.pki.oids.sha1;switch(O){case r.pki.oids.sha1:case r.pki.oids.sha256:case r.pki.oids.sha384:case r.pki.oids.sha512:case r.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+O)}var C=x.authenticatedAttributes||[];if(C.length>0){for(var h=!1,u=!1,_=0;_<C.length;++_){var M=C[_];if(!h&&M.type===r.pki.oids.contentType){if(h=!0,u)break;continue}if(!u&&M.type===r.pki.oids.messageDigest){if(u=!0,h)break;continue}}if(!h||!u)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.")}l.signers.push({key:N,version:1,issuer:c,serialNumber:m,digestAlgorithm:O,signatureAlgorithm:r.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:C,unauthenticatedAttributes:[]})},sign:function(x){if(x=x||{},(typeof l.content!="object"||l.contentInfo===null)&&(l.contentInfo=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.pki.oids.data).getBytes())]),"content"in l)){var c;l.content instanceof r.util.ByteBuffer?c=l.content.bytes():typeof l.content=="string"&&(c=r.util.encodeUtf8(l.content)),x.detached?l.detachedContent=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,c):l.contentInfo.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,c)]))}if(l.signers.length!==0){var m=y();S(m)}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(x){typeof x=="string"&&(x=r.pki.certificateFromPem(x)),l.certificates.push(x)},addCertificateRevokationList:function(x){throw new Error("PKCS#7 CRL support not yet implemented.")}},l;function y(){for(var x={},c=0;c<l.signers.length;++c){var m=l.signers[c],A=m.digestAlgorithm;A in x||(x[A]=r.md[r.pki.oids[A]].create()),m.authenticatedAttributes.length===0?m.md=x[A]:m.md=r.md[r.pki.oids[A]].create()}l.digestAlgorithmIdentifiers=[];for(var A in x)l.digestAlgorithmIdentifiers.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(A).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]));return x}function S(x){var c;if(l.detachedContent?c=l.detachedContent:(c=l.contentInfo.value[1],c=c.value[0]),!c)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var m=e.derToOid(l.contentInfo.value[0].value),A=e.toDer(c);A.getByte(),e.getBerValueLength(A),A=A.getBytes();for(var N in x)x[N].start().update(A);for(var O=new Date,C=0;C<l.signers.length;++C){var h=l.signers[C];if(h.authenticatedAttributes.length===0){if(m!==r.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=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var u=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[]),_=0;_<h.authenticatedAttributes.length;++_){var M=h.authenticatedAttributes[_];M.type===r.pki.oids.messageDigest?M.value=x[h.digestAlgorithm].digest():M.type===r.pki.oids.signingTime&&(M.value||(M.value=O)),u.value.push(f(M)),h.authenticatedAttributesAsn1.value.push(f(M))}A=e.toDer(u).getBytes(),h.md.start().update(A)}h.signature=h.key.sign(h.md,"RSASSA-PKCS1-V1_5")}l.signerInfos=p(l.signers)}},t.createEncryptedData=function(){var l=null;return l={type:r.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:r.pki.oids["aes256-CBC"]},fromAsn1:function(y){I(l,y,t.asn1.encryptedDataValidator)},decrypt:function(y){y!==void 0&&(l.encryptedContent.key=y),B(l)}},l},t.createEnvelopedData=function(){var l=null;return l={type:r.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:r.pki.oids["aes256-CBC"]},fromAsn1:function(y){var S=I(l,y,t.asn1.envelopedDataValidator);l.recipients=o(S.recipientInfos.value)},toAsn1:function(){return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(l.type).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(l.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,s(l.recipients)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,E(l.encryptedContent))])])])},findRecipient:function(y){for(var S=y.issuer.attributes,x=0;x<l.recipients.length;++x){var c=l.recipients[x],m=c.issuer;if(c.serialNumber===y.serialNumber&&m.length===S.length){for(var A=!0,N=0;N<S.length;++N)if(m[N].type!==S[N].type||m[N].value!==S[N].value){A=!1;break}if(A)return c}}return null},decrypt:function(y,S){if(l.encryptedContent.key===void 0&&y!==void 0&&S!==void 0)switch(y.encryptedContent.algorithm){case r.pki.oids.rsaEncryption:case r.pki.oids.desCBC:var x=S.decrypt(y.encryptedContent.content);l.encryptedContent.key=r.util.createBuffer(x);break;default:throw new Error("Unsupported asymmetric cipher, OID "+y.encryptedContent.algorithm)}B(l)},addRecipient:function(y){l.recipients.push({version:0,issuer:y.issuer.attributes,serialNumber:y.serialNumber,encryptedContent:{algorithm:r.pki.oids.rsaEncryption,key:y.publicKey}})},encrypt:function(y,S){if(l.encryptedContent.content===void 0){S=S||l.encryptedContent.algorithm,y=y||l.encryptedContent.key;var x,c,m;switch(S){case r.pki.oids["aes128-CBC"]:x=16,c=16,m=r.aes.createEncryptionCipher;break;case r.pki.oids["aes192-CBC"]:x=24,c=16,m=r.aes.createEncryptionCipher;break;case r.pki.oids["aes256-CBC"]:x=32,c=16,m=r.aes.createEncryptionCipher;break;case r.pki.oids["des-EDE3-CBC"]:x=24,c=8,m=r.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+S)}if(y===void 0)y=r.util.createBuffer(r.random.getBytes(x));else if(y.length()!=x)throw new Error("Symmetric key has wrong length; got "+y.length()+" bytes, expected "+x+".");l.encryptedContent.algorithm=S,l.encryptedContent.key=y,l.encryptedContent.parameter=r.util.createBuffer(r.random.getBytes(c));var A=m(y);if(A.start(l.encryptedContent.parameter.copy()),A.update(l.content),!A.finish())throw new Error("Symmetric encryption failed.");l.encryptedContent.content=A.output}for(var N=0;N<l.recipients.length;++N){var O=l.recipients[N];if(O.encryptedContent.content===void 0)switch(O.encryptedContent.algorithm){case r.pki.oids.rsaEncryption:O.encryptedContent.content=O.encryptedContent.key.encrypt(l.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+O.encryptedContent.algorithm)}}}},l};function i(l){var y={},S=[];if(!e.validate(l,t.asn1.recipientInfoValidator,y,S)){var x=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw x.errors=S,x}return{version:y.version.charCodeAt(0),issuer:r.pki.RDNAttributesAsArray(y.issuer),serialNumber:r.util.createBuffer(y.serial).toHex(),encryptedContent:{algorithm:e.derToOid(y.encAlgorithm),parameter:y.encParameter?y.encParameter.value:void 0,content:y.encKey}}}function a(l){return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(l.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[r.pki.distinguishedNameToAsn1({attributes:l.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,r.util.hexToBytes(l.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(l.encryptedContent.algorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,l.encryptedContent.content)])}function o(l){for(var y=[],S=0;S<l.length;++S)y.push(i(l[S]));return y}function s(l){for(var y=[],S=0;S<l.length;++S)y.push(a(l[S]));return y}function n(l){var y=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(l.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[r.pki.distinguishedNameToAsn1({attributes:l.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,r.util.hexToBytes(l.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(l.digestAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])]);if(l.authenticatedAttributesAsn1&&y.value.push(l.authenticatedAttributesAsn1),y.value.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(l.signatureAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])),y.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,l.signature)),l.unauthenticatedAttributes.length>0){for(var S=e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[]),x=0;x<l.unauthenticatedAttributes.length;++x){var c=l.unauthenticatedAttributes[x];S.values.push(f(c))}y.value.push(S)}return y}function p(l){for(var y=[],S=0;S<l.length;++S)y.push(n(l[S]));return y}function f(l){var y;if(l.type===r.pki.oids.contentType)y=e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(l.value).getBytes());else if(l.type===r.pki.oids.messageDigest)y=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,l.value.bytes());else if(l.type===r.pki.oids.signingTime){var S=new Date("1950-01-01T00:00:00Z"),x=new Date("2050-01-01T00:00:00Z"),c=l.value;if(typeof c=="string"){var m=Date.parse(c);isNaN(m)?c.length===13?c=e.utcTimeToDate(c):c=e.generalizedTimeToDate(c):c=new Date(m)}c>=S&&c<x?y=e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(c)):y=e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(c))}return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(l.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[y])])}function E(l){return[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.pki.oids.data).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(l.algorithm).getBytes()),l.parameter?e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,l.parameter.getBytes()):void 0]),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,l.content.getBytes())])]}function I(l,y,S){var x={},c=[];if(!e.validate(y,S,x,c)){var m=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw m.errors=m,m}var A=e.derToOid(x.contentType);if(A!==r.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(x.encryptedContent){var N="";if(r.util.isArray(x.encryptedContent))for(var O=0;O<x.encryptedContent.length;++O){if(x.encryptedContent[O].type!==e.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");N+=x.encryptedContent[O].value}else N=x.encryptedContent;l.encryptedContent={algorithm:e.derToOid(x.encAlgorithm),parameter:r.util.createBuffer(x.encParameter.value),content:r.util.createBuffer(N)}}if(x.content){var N="";if(r.util.isArray(x.content))for(var O=0;O<x.content.length;++O){if(x.content[O].type!==e.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");N+=x.content[O].value}else N=x.content;l.content=r.util.createBuffer(N)}return l.version=x.version.charCodeAt(0),l.rawCapture=x,x}function B(l){if(l.encryptedContent.key===void 0)throw new Error("Symmetric key not available.");if(l.content===void 0){var y;switch(l.encryptedContent.algorithm){case r.pki.oids["aes128-CBC"]:case r.pki.oids["aes192-CBC"]:case r.pki.oids["aes256-CBC"]:y=r.aes.createDecryptionCipher(l.encryptedContent.key);break;case r.pki.oids.desCBC:case r.pki.oids["des-EDE3-CBC"]:y=r.des.createDecryptionCipher(l.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+l.encryptedContent.algorithm)}if(y.start(l.encryptedContent.parameter),y.update(l.encryptedContent.content),!y.finish())throw new Error("Symmetric decryption failed.");l.content=y.output}}return Dc.exports}var Pc={exports:{}},rp;function yy(){if(rp)return Pc.exports;rp=1;var r=Ge();ai(),Fn(),oc(),Kn(),We();var e=Pc.exports=r.ssh=r.ssh||{};e.privateKeyToPutty=function(o,s,n){n=n||"",s=s||"";var p="ssh-rsa",f=s===""?"none":"aes256-cbc",E="PuTTY-User-Key-File-2: "+p+`\r
|
|
25
|
+
`;E+="Encryption: "+f+`\r
|
|
26
|
+
`,E+="Comment: "+n+`\r
|
|
27
|
+
`;var I=r.util.createBuffer();i(I,p),t(I,o.e),t(I,o.n);var B=r.util.encode64(I.bytes(),64),l=Math.floor(B.length/66)+1;E+="Public-Lines: "+l+`\r
|
|
28
|
+
`,E+=B;var y=r.util.createBuffer();t(y,o.d),t(y,o.p),t(y,o.q),t(y,o.qInv);var S;if(!s)S=r.util.encode64(y.bytes(),64);else{var x=y.length()+16-1;x-=x%16;var c=a(y.bytes());c.truncate(c.length()-x+y.length()),y.putBuffer(c);var m=r.util.createBuffer();m.putBuffer(a("\0\0\0\0",s)),m.putBuffer(a("\0\0\0",s));var A=r.aes.createEncryptionCipher(m.truncate(8),"CBC");A.start(r.util.createBuffer().fillWithByte(0,16)),A.update(y.copy()),A.finish();var N=A.output;N.truncate(16),S=r.util.encode64(N.bytes(),64)}l=Math.floor(S.length/66)+1,E+=`\r
|
|
29
|
+
Private-Lines: `+l+`\r
|
|
30
|
+
`,E+=S;var O=a("putty-private-key-file-mac-key",s),C=r.util.createBuffer();i(C,p),i(C,f),i(C,n),C.putInt32(I.length()),C.putBuffer(I),C.putInt32(y.length()),C.putBuffer(y);var h=r.hmac.create();return h.start("sha1",O),h.update(C.bytes()),E+=`\r
|
|
31
|
+
Private-MAC: `+h.digest().toHex()+`\r
|
|
32
|
+
`,E},e.publicKeyToOpenSSH=function(o,s){var n="ssh-rsa";s=s||"";var p=r.util.createBuffer();return i(p,n),t(p,o.e),t(p,o.n),n+" "+r.util.encode64(p.bytes())+" "+s},e.privateKeyToOpenSSH=function(o,s){return s?r.pki.encryptRsaPrivateKey(o,s,{legacy:!0,algorithm:"aes128"}):r.pki.privateKeyToPem(o)},e.getPublicKeyFingerprint=function(o,s){s=s||{};var n=s.md||r.md.md5.create(),p="ssh-rsa",f=r.util.createBuffer();i(f,p),t(f,o.e),t(f,o.n),n.start(),n.update(f.getBytes());var E=n.digest();if(s.encoding==="hex"){var I=E.toHex();return s.delimiter?I.match(/.{2}/g).join(s.delimiter):I}else{if(s.encoding==="binary")return E.getBytes();if(s.encoding)throw new Error('Unknown encoding "'+s.encoding+'".')}return E};function t(o,s){var n=s.toString(16);n[0]>="8"&&(n="00"+n);var p=r.util.hexToBytes(n);o.putInt32(p.length),o.putBytes(p)}function i(o,s){o.putInt32(s.length),o.putString(s)}function a(){for(var o=r.md.sha1.create(),s=arguments.length,n=0;n<s;++n)o.update(arguments[n]);return o.digest()}return Pc.exports}var Vc,ip;function vy(){return ip||(ip=1,Vc=Ge(),ai(),uy(),pr(),Ju(),Es(),ly(),Fn(),fy(),hy(),py(),Ph(),pc(),Vi(),Th(),jh(),dy(),qh(),kh(),Sh(),Tc(),rr(),Ah(),yy(),$h(),We()),Vc}var _t=vy(),Mc={},jn={},np;function gy(){if(np)return jn;np=1,jn.byteLength=n,jn.toByteArray=f,jn.fromByteArray=B;for(var r=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=i.length;a<o;++a)r[a]=i[a],e[i.charCodeAt(a)]=a;e[45]=62,e[95]=63;function s(l){var y=l.length;if(y%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var S=l.indexOf("=");S===-1&&(S=y);var x=S===y?0:4-S%4;return[S,x]}function n(l){var y=s(l),S=y[0],x=y[1];return(S+x)*3/4-x}function p(l,y,S){return(y+S)*3/4-S}function f(l){var y,S=s(l),x=S[0],c=S[1],m=new t(p(l,x,c)),A=0,N=c>0?x-4:x,O;for(O=0;O<N;O+=4)y=e[l.charCodeAt(O)]<<18|e[l.charCodeAt(O+1)]<<12|e[l.charCodeAt(O+2)]<<6|e[l.charCodeAt(O+3)],m[A++]=y>>16&255,m[A++]=y>>8&255,m[A++]=y&255;return c===2&&(y=e[l.charCodeAt(O)]<<2|e[l.charCodeAt(O+1)]>>4,m[A++]=y&255),c===1&&(y=e[l.charCodeAt(O)]<<10|e[l.charCodeAt(O+1)]<<4|e[l.charCodeAt(O+2)]>>2,m[A++]=y>>8&255,m[A++]=y&255),m}function E(l){return r[l>>18&63]+r[l>>12&63]+r[l>>6&63]+r[l&63]}function I(l,y,S){for(var x,c=[],m=y;m<S;m+=3)x=(l[m]<<16&16711680)+(l[m+1]<<8&65280)+(l[m+2]&255),c.push(E(x));return c.join("")}function B(l){for(var y,S=l.length,x=S%3,c=[],m=16383,A=0,N=S-x;A<N;A+=m)c.push(I(l,A,A+m>N?N:A+m));return x===1?(y=l[S-1],c.push(r[y>>2]+r[y<<4&63]+"==")):x===2&&(y=(l[S-2]<<8)+l[S-1],c.push(r[y>>10]+r[y>>4&63]+r[y<<2&63]+"=")),c.join("")}return jn}var Ts={};var ap;function my(){return ap||(ap=1,Ts.read=function(r,e,t,i,a){var o,s,n=a*8-i-1,p=(1<<n)-1,f=p>>1,E=-7,I=t?a-1:0,B=t?-1:1,l=r[e+I];for(I+=B,o=l&(1<<-E)-1,l>>=-E,E+=n;E>0;o=o*256+r[e+I],I+=B,E-=8);for(s=o&(1<<-E)-1,o>>=-E,E+=i;E>0;s=s*256+r[e+I],I+=B,E-=8);if(o===0)o=1-f;else{if(o===p)return s?NaN:(l?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-f}return(l?-1:1)*s*Math.pow(2,o-i)},Ts.write=function(r,e,t,i,a,o){var s,n,p,f=o*8-a-1,E=(1<<f)-1,I=E>>1,B=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,l=i?0:o-1,y=i?1:-1,S=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(n=isNaN(e)?1:0,s=E):(s=Math.floor(Math.log(e)/Math.LN2),e*(p=Math.pow(2,-s))<1&&(s--,p*=2),s+I>=1?e+=B/p:e+=B*Math.pow(2,1-I),e*p>=2&&(s++,p/=2),s+I>=E?(n=0,s=E):s+I>=1?(n=(e*p-1)*Math.pow(2,a),s=s+I):(n=e*Math.pow(2,I-1)*Math.pow(2,a),s=0));a>=8;r[t+l]=n&255,l+=y,n/=256,a-=8);for(s=s<<a|n,f+=a;f>0;r[t+l]=s&255,l+=y,s/=256,f-=8);r[t+l-y]|=S*128}),Ts}var sp;function Cy(){return sp||(sp=1,(function(r){const e=gy(),t=my(),i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=n,r.SlowBuffer=m,r.INSPECT_MAX_BYTES=50;const a=2147483647;r.kMaxLength=a,n.TYPED_ARRAY_SUPPORT=o(),!n.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{const R=new Uint8Array(1),v={foo:function(){return 42}};return Object.setPrototypeOf(v,Uint8Array.prototype),Object.setPrototypeOf(R,v),R.foo()===42}catch{return!1}}Object.defineProperty(n.prototype,"parent",{enumerable:!0,get:function(){if(n.isBuffer(this))return this.buffer}}),Object.defineProperty(n.prototype,"offset",{enumerable:!0,get:function(){if(n.isBuffer(this))return this.byteOffset}});function s(R){if(R>a)throw new RangeError('The value "'+R+'" is invalid for option "size"');const v=new Uint8Array(R);return Object.setPrototypeOf(v,n.prototype),v}function n(R,v,b){if(typeof R=="number"){if(typeof v=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return I(R)}return p(R,v,b)}n.poolSize=8192;function p(R,v,b){if(typeof R=="string")return B(R,v);if(ArrayBuffer.isView(R))return y(R);if(R==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof R);if(Oe(R,ArrayBuffer)||R&&Oe(R.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Oe(R,SharedArrayBuffer)||R&&Oe(R.buffer,SharedArrayBuffer)))return S(R,v,b);if(typeof R=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const j=R.valueOf&&R.valueOf();if(j!=null&&j!==R)return n.from(j,v,b);const W=x(R);if(W)return W;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof R[Symbol.toPrimitive]=="function")return n.from(R[Symbol.toPrimitive]("string"),v,b);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof R)}n.from=function(R,v,b){return p(R,v,b)},Object.setPrototypeOf(n.prototype,Uint8Array.prototype),Object.setPrototypeOf(n,Uint8Array);function f(R){if(typeof R!="number")throw new TypeError('"size" argument must be of type number');if(R<0)throw new RangeError('The value "'+R+'" is invalid for option "size"')}function E(R,v,b){return f(R),R<=0?s(R):v!==void 0?typeof b=="string"?s(R).fill(v,b):s(R).fill(v):s(R)}n.alloc=function(R,v,b){return E(R,v,b)};function I(R){return f(R),s(R<0?0:c(R)|0)}n.allocUnsafe=function(R){return I(R)},n.allocUnsafeSlow=function(R){return I(R)};function B(R,v){if((typeof v!="string"||v==="")&&(v="utf8"),!n.isEncoding(v))throw new TypeError("Unknown encoding: "+v);const b=A(R,v)|0;let j=s(b);const W=j.write(R,v);return W!==b&&(j=j.slice(0,W)),j}function l(R){const v=R.length<0?0:c(R.length)|0,b=s(v);for(let j=0;j<v;j+=1)b[j]=R[j]&255;return b}function y(R){if(Oe(R,Uint8Array)){const v=new Uint8Array(R);return S(v.buffer,v.byteOffset,v.byteLength)}return l(R)}function S(R,v,b){if(v<0||R.byteLength<v)throw new RangeError('"offset" is outside of buffer bounds');if(R.byteLength<v+(b||0))throw new RangeError('"length" is outside of buffer bounds');let j;return v===void 0&&b===void 0?j=new Uint8Array(R):b===void 0?j=new Uint8Array(R,v):j=new Uint8Array(R,v,b),Object.setPrototypeOf(j,n.prototype),j}function x(R){if(n.isBuffer(R)){const v=c(R.length)|0,b=s(v);return b.length===0||R.copy(b,0,0,v),b}if(R.length!==void 0)return typeof R.length!="number"||De(R.length)?s(0):l(R);if(R.type==="Buffer"&&Array.isArray(R.data))return l(R.data)}function c(R){if(R>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return R|0}function m(R){return+R!=R&&(R=0),n.alloc(+R)}n.isBuffer=function(v){return v!=null&&v._isBuffer===!0&&v!==n.prototype},n.compare=function(v,b){if(Oe(v,Uint8Array)&&(v=n.from(v,v.offset,v.byteLength)),Oe(b,Uint8Array)&&(b=n.from(b,b.offset,b.byteLength)),!n.isBuffer(v)||!n.isBuffer(b))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(v===b)return 0;let j=v.length,W=b.length;for(let V=0,H=Math.min(j,W);V<H;++V)if(v[V]!==b[V]){j=v[V],W=b[V];break}return j<W?-1:W<j?1:0},n.isEncoding=function(v){switch(String(v).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},n.concat=function(v,b){if(!Array.isArray(v))throw new TypeError('"list" argument must be an Array of Buffers');if(v.length===0)return n.alloc(0);let j;if(b===void 0)for(b=0,j=0;j<v.length;++j)b+=v[j].length;const W=n.allocUnsafe(b);let V=0;for(j=0;j<v.length;++j){let H=v[j];if(Oe(H,Uint8Array))V+H.length>W.length?(n.isBuffer(H)||(H=n.from(H)),H.copy(W,V)):Uint8Array.prototype.set.call(W,H,V);else if(n.isBuffer(H))H.copy(W,V);else throw new TypeError('"list" argument must be an Array of Buffers');V+=H.length}return W};function A(R,v){if(n.isBuffer(R))return R.length;if(ArrayBuffer.isView(R)||Oe(R,ArrayBuffer))return R.byteLength;if(typeof R!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof R);const b=R.length,j=arguments.length>2&&arguments[2]===!0;if(!j&&b===0)return 0;let W=!1;for(;;)switch(v){case"ascii":case"latin1":case"binary":return b;case"utf8":case"utf-8":return me(R).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b*2;case"hex":return b>>>1;case"base64":return Ce(R).length;default:if(W)return j?-1:me(R).length;v=(""+v).toLowerCase(),W=!0}}n.byteLength=A;function N(R,v,b){let j=!1;if((v===void 0||v<0)&&(v=0),v>this.length||((b===void 0||b>this.length)&&(b=this.length),b<=0)||(b>>>=0,v>>>=0,b<=v))return"";for(R||(R="utf8");;)switch(R){case"hex":return ge(this,v,b);case"utf8":case"utf-8":return J(this,v,b);case"ascii":return ue(this,v,b);case"latin1":case"binary":return pe(this,v,b);case"base64":return z(this,v,b);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ke(this,v,b);default:if(j)throw new TypeError("Unknown encoding: "+R);R=(R+"").toLowerCase(),j=!0}}n.prototype._isBuffer=!0;function O(R,v,b){const j=R[v];R[v]=R[b],R[b]=j}n.prototype.swap16=function(){const v=this.length;if(v%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let b=0;b<v;b+=2)O(this,b,b+1);return this},n.prototype.swap32=function(){const v=this.length;if(v%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let b=0;b<v;b+=4)O(this,b,b+3),O(this,b+1,b+2);return this},n.prototype.swap64=function(){const v=this.length;if(v%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let b=0;b<v;b+=8)O(this,b,b+7),O(this,b+1,b+6),O(this,b+2,b+5),O(this,b+3,b+4);return this},n.prototype.toString=function(){const v=this.length;return v===0?"":arguments.length===0?J(this,0,v):N.apply(this,arguments)},n.prototype.toLocaleString=n.prototype.toString,n.prototype.equals=function(v){if(!n.isBuffer(v))throw new TypeError("Argument must be a Buffer");return this===v?!0:n.compare(this,v)===0},n.prototype.inspect=function(){let v="";const b=r.INSPECT_MAX_BYTES;return v=this.toString("hex",0,b).replace(/(.{2})/g,"$1 ").trim(),this.length>b&&(v+=" ... "),"<Buffer "+v+">"},i&&(n.prototype[i]=n.prototype.inspect),n.prototype.compare=function(v,b,j,W,V){if(Oe(v,Uint8Array)&&(v=n.from(v,v.offset,v.byteLength)),!n.isBuffer(v))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof v);if(b===void 0&&(b=0),j===void 0&&(j=v?v.length:0),W===void 0&&(W=0),V===void 0&&(V=this.length),b<0||j>v.length||W<0||V>this.length)throw new RangeError("out of range index");if(W>=V&&b>=j)return 0;if(W>=V)return-1;if(b>=j)return 1;if(b>>>=0,j>>>=0,W>>>=0,V>>>=0,this===v)return 0;let H=V-W,Z=j-b;const ne=Math.min(H,Z),de=this.slice(W,V),Ue=v.slice(b,j);for(let _e=0;_e<ne;++_e)if(de[_e]!==Ue[_e]){H=de[_e],Z=Ue[_e];break}return H<Z?-1:Z<H?1:0};function C(R,v,b,j,W){if(R.length===0)return-1;if(typeof b=="string"?(j=b,b=0):b>2147483647?b=2147483647:b<-2147483648&&(b=-2147483648),b=+b,De(b)&&(b=W?0:R.length-1),b<0&&(b=R.length+b),b>=R.length){if(W)return-1;b=R.length-1}else if(b<0)if(W)b=0;else return-1;if(typeof v=="string"&&(v=n.from(v,j)),n.isBuffer(v))return v.length===0?-1:h(R,v,b,j,W);if(typeof v=="number")return v=v&255,typeof Uint8Array.prototype.indexOf=="function"?W?Uint8Array.prototype.indexOf.call(R,v,b):Uint8Array.prototype.lastIndexOf.call(R,v,b):h(R,[v],b,j,W);throw new TypeError("val must be string, number or Buffer")}function h(R,v,b,j,W){let V=1,H=R.length,Z=v.length;if(j!==void 0&&(j=String(j).toLowerCase(),j==="ucs2"||j==="ucs-2"||j==="utf16le"||j==="utf-16le")){if(R.length<2||v.length<2)return-1;V=2,H/=2,Z/=2,b/=2}function ne(Ue,_e){return V===1?Ue[_e]:Ue.readUInt16BE(_e*V)}let de;if(W){let Ue=-1;for(de=b;de<H;de++)if(ne(R,de)===ne(v,Ue===-1?0:de-Ue)){if(Ue===-1&&(Ue=de),de-Ue+1===Z)return Ue*V}else Ue!==-1&&(de-=de-Ue),Ue=-1}else for(b+Z>H&&(b=H-Z),de=b;de>=0;de--){let Ue=!0;for(let _e=0;_e<Z;_e++)if(ne(R,de+_e)!==ne(v,_e)){Ue=!1;break}if(Ue)return de}return-1}n.prototype.includes=function(v,b,j){return this.indexOf(v,b,j)!==-1},n.prototype.indexOf=function(v,b,j){return C(this,v,b,j,!0)},n.prototype.lastIndexOf=function(v,b,j){return C(this,v,b,j,!1)};function u(R,v,b,j){b=Number(b)||0;const W=R.length-b;j?(j=Number(j),j>W&&(j=W)):j=W;const V=v.length;j>V/2&&(j=V/2);let H;for(H=0;H<j;++H){const Z=parseInt(v.substr(H*2,2),16);if(De(Z))return H;R[b+H]=Z}return H}function _(R,v,b,j){return Re(me(v,R.length-b),R,b,j)}function M(R,v,b,j){return Re(Ie(v),R,b,j)}function G(R,v,b,j){return Re(Ce(v),R,b,j)}function F(R,v,b,j){return Re(re(v,R.length-b),R,b,j)}n.prototype.write=function(v,b,j,W){if(b===void 0)W="utf8",j=this.length,b=0;else if(j===void 0&&typeof b=="string")W=b,j=this.length,b=0;else if(isFinite(b))b=b>>>0,isFinite(j)?(j=j>>>0,W===void 0&&(W="utf8")):(W=j,j=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const V=this.length-b;if((j===void 0||j>V)&&(j=V),v.length>0&&(j<0||b<0)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");W||(W="utf8");let H=!1;for(;;)switch(W){case"hex":return u(this,v,b,j);case"utf8":case"utf-8":return _(this,v,b,j);case"ascii":case"latin1":case"binary":return M(this,v,b,j);case"base64":return G(this,v,b,j);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,v,b,j);default:if(H)throw new TypeError("Unknown encoding: "+W);W=(""+W).toLowerCase(),H=!0}},n.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function z(R,v,b){return v===0&&b===R.length?e.fromByteArray(R):e.fromByteArray(R.slice(v,b))}function J(R,v,b){b=Math.min(R.length,b);const j=[];let W=v;for(;W<b;){const V=R[W];let H=null,Z=V>239?4:V>223?3:V>191?2:1;if(W+Z<=b){let ne,de,Ue,_e;switch(Z){case 1:V<128&&(H=V);break;case 2:ne=R[W+1],(ne&192)===128&&(_e=(V&31)<<6|ne&63,_e>127&&(H=_e));break;case 3:ne=R[W+1],de=R[W+2],(ne&192)===128&&(de&192)===128&&(_e=(V&15)<<12|(ne&63)<<6|de&63,_e>2047&&(_e<55296||_e>57343)&&(H=_e));break;case 4:ne=R[W+1],de=R[W+2],Ue=R[W+3],(ne&192)===128&&(de&192)===128&&(Ue&192)===128&&(_e=(V&15)<<18|(ne&63)<<12|(de&63)<<6|Ue&63,_e>65535&&_e<1114112&&(H=_e))}}H===null?(H=65533,Z=1):H>65535&&(H-=65536,j.push(H>>>10&1023|55296),H=56320|H&1023),j.push(H),W+=Z}return te(j)}const X=4096;function te(R){const v=R.length;if(v<=X)return String.fromCharCode.apply(String,R);let b="",j=0;for(;j<v;)b+=String.fromCharCode.apply(String,R.slice(j,j+=X));return b}function ue(R,v,b){let j="";b=Math.min(R.length,b);for(let W=v;W<b;++W)j+=String.fromCharCode(R[W]&127);return j}function pe(R,v,b){let j="";b=Math.min(R.length,b);for(let W=v;W<b;++W)j+=String.fromCharCode(R[W]);return j}function ge(R,v,b){const j=R.length;(!v||v<0)&&(v=0),(!b||b<0||b>j)&&(b=j);let W="";for(let V=v;V<b;++V)W+=Ze[R[V]];return W}function ke(R,v,b){const j=R.slice(v,b);let W="";for(let V=0;V<j.length-1;V+=2)W+=String.fromCharCode(j[V]+j[V+1]*256);return W}n.prototype.slice=function(v,b){const j=this.length;v=~~v,b=b===void 0?j:~~b,v<0?(v+=j,v<0&&(v=0)):v>j&&(v=j),b<0?(b+=j,b<0&&(b=0)):b>j&&(b=j),b<v&&(b=v);const W=this.subarray(v,b);return Object.setPrototypeOf(W,n.prototype),W};function Ne(R,v,b){if(R%1!==0||R<0)throw new RangeError("offset is not uint");if(R+v>b)throw new RangeError("Trying to access beyond buffer length")}n.prototype.readUintLE=n.prototype.readUIntLE=function(v,b,j){v=v>>>0,b=b>>>0,j||Ne(v,b,this.length);let W=this[v],V=1,H=0;for(;++H<b&&(V*=256);)W+=this[v+H]*V;return W},n.prototype.readUintBE=n.prototype.readUIntBE=function(v,b,j){v=v>>>0,b=b>>>0,j||Ne(v,b,this.length);let W=this[v+--b],V=1;for(;b>0&&(V*=256);)W+=this[v+--b]*V;return W},n.prototype.readUint8=n.prototype.readUInt8=function(v,b){return v=v>>>0,b||Ne(v,1,this.length),this[v]},n.prototype.readUint16LE=n.prototype.readUInt16LE=function(v,b){return v=v>>>0,b||Ne(v,2,this.length),this[v]|this[v+1]<<8},n.prototype.readUint16BE=n.prototype.readUInt16BE=function(v,b){return v=v>>>0,b||Ne(v,2,this.length),this[v]<<8|this[v+1]},n.prototype.readUint32LE=n.prototype.readUInt32LE=function(v,b){return v=v>>>0,b||Ne(v,4,this.length),(this[v]|this[v+1]<<8|this[v+2]<<16)+this[v+3]*16777216},n.prototype.readUint32BE=n.prototype.readUInt32BE=function(v,b){return v=v>>>0,b||Ne(v,4,this.length),this[v]*16777216+(this[v+1]<<16|this[v+2]<<8|this[v+3])},n.prototype.readBigUInt64LE=Qe(function(v){v=v>>>0,k(v,"offset");const b=this[v],j=this[v+7];(b===void 0||j===void 0)&&$(v,this.length-8);const W=b+this[++v]*2**8+this[++v]*2**16+this[++v]*2**24,V=this[++v]+this[++v]*2**8+this[++v]*2**16+j*2**24;return BigInt(W)+(BigInt(V)<<BigInt(32))}),n.prototype.readBigUInt64BE=Qe(function(v){v=v>>>0,k(v,"offset");const b=this[v],j=this[v+7];(b===void 0||j===void 0)&&$(v,this.length-8);const W=b*2**24+this[++v]*2**16+this[++v]*2**8+this[++v],V=this[++v]*2**24+this[++v]*2**16+this[++v]*2**8+j;return(BigInt(W)<<BigInt(32))+BigInt(V)}),n.prototype.readIntLE=function(v,b,j){v=v>>>0,b=b>>>0,j||Ne(v,b,this.length);let W=this[v],V=1,H=0;for(;++H<b&&(V*=256);)W+=this[v+H]*V;return V*=128,W>=V&&(W-=Math.pow(2,8*b)),W},n.prototype.readIntBE=function(v,b,j){v=v>>>0,b=b>>>0,j||Ne(v,b,this.length);let W=b,V=1,H=this[v+--W];for(;W>0&&(V*=256);)H+=this[v+--W]*V;return V*=128,H>=V&&(H-=Math.pow(2,8*b)),H},n.prototype.readInt8=function(v,b){return v=v>>>0,b||Ne(v,1,this.length),this[v]&128?(255-this[v]+1)*-1:this[v]},n.prototype.readInt16LE=function(v,b){v=v>>>0,b||Ne(v,2,this.length);const j=this[v]|this[v+1]<<8;return j&32768?j|4294901760:j},n.prototype.readInt16BE=function(v,b){v=v>>>0,b||Ne(v,2,this.length);const j=this[v+1]|this[v]<<8;return j&32768?j|4294901760:j},n.prototype.readInt32LE=function(v,b){return v=v>>>0,b||Ne(v,4,this.length),this[v]|this[v+1]<<8|this[v+2]<<16|this[v+3]<<24},n.prototype.readInt32BE=function(v,b){return v=v>>>0,b||Ne(v,4,this.length),this[v]<<24|this[v+1]<<16|this[v+2]<<8|this[v+3]},n.prototype.readBigInt64LE=Qe(function(v){v=v>>>0,k(v,"offset");const b=this[v],j=this[v+7];(b===void 0||j===void 0)&&$(v,this.length-8);const W=this[v+4]+this[v+5]*2**8+this[v+6]*2**16+(j<<24);return(BigInt(W)<<BigInt(32))+BigInt(b+this[++v]*256+this[++v]*65536+this[++v]*16777216)}),n.prototype.readBigInt64BE=Qe(function(v){v=v>>>0,k(v,"offset");const b=this[v],j=this[v+7];(b===void 0||j===void 0)&&$(v,this.length-8);const W=(b<<24)+this[++v]*2**16+this[++v]*2**8+this[++v];return(BigInt(W)<<BigInt(32))+BigInt(this[++v]*16777216+this[++v]*65536+this[++v]*256+j)}),n.prototype.readFloatLE=function(v,b){return v=v>>>0,b||Ne(v,4,this.length),t.read(this,v,!0,23,4)},n.prototype.readFloatBE=function(v,b){return v=v>>>0,b||Ne(v,4,this.length),t.read(this,v,!1,23,4)},n.prototype.readDoubleLE=function(v,b){return v=v>>>0,b||Ne(v,8,this.length),t.read(this,v,!0,52,8)},n.prototype.readDoubleBE=function(v,b){return v=v>>>0,b||Ne(v,8,this.length),t.read(this,v,!1,52,8)};function Le(R,v,b,j,W,V){if(!n.isBuffer(R))throw new TypeError('"buffer" argument must be a Buffer instance');if(v>W||v<V)throw new RangeError('"value" argument is out of bounds');if(b+j>R.length)throw new RangeError("Index out of range")}n.prototype.writeUintLE=n.prototype.writeUIntLE=function(v,b,j,W){if(v=+v,b=b>>>0,j=j>>>0,!W){const Z=Math.pow(2,8*j)-1;Le(this,v,b,j,Z,0)}let V=1,H=0;for(this[b]=v&255;++H<j&&(V*=256);)this[b+H]=v/V&255;return b+j},n.prototype.writeUintBE=n.prototype.writeUIntBE=function(v,b,j,W){if(v=+v,b=b>>>0,j=j>>>0,!W){const Z=Math.pow(2,8*j)-1;Le(this,v,b,j,Z,0)}let V=j-1,H=1;for(this[b+V]=v&255;--V>=0&&(H*=256);)this[b+V]=v/H&255;return b+j},n.prototype.writeUint8=n.prototype.writeUInt8=function(v,b,j){return v=+v,b=b>>>0,j||Le(this,v,b,1,255,0),this[b]=v&255,b+1},n.prototype.writeUint16LE=n.prototype.writeUInt16LE=function(v,b,j){return v=+v,b=b>>>0,j||Le(this,v,b,2,65535,0),this[b]=v&255,this[b+1]=v>>>8,b+2},n.prototype.writeUint16BE=n.prototype.writeUInt16BE=function(v,b,j){return v=+v,b=b>>>0,j||Le(this,v,b,2,65535,0),this[b]=v>>>8,this[b+1]=v&255,b+2},n.prototype.writeUint32LE=n.prototype.writeUInt32LE=function(v,b,j){return v=+v,b=b>>>0,j||Le(this,v,b,4,4294967295,0),this[b+3]=v>>>24,this[b+2]=v>>>16,this[b+1]=v>>>8,this[b]=v&255,b+4},n.prototype.writeUint32BE=n.prototype.writeUInt32BE=function(v,b,j){return v=+v,b=b>>>0,j||Le(this,v,b,4,4294967295,0),this[b]=v>>>24,this[b+1]=v>>>16,this[b+2]=v>>>8,this[b+3]=v&255,b+4};function Ee(R,v,b,j,W){d(v,j,W,R,b,7);let V=Number(v&BigInt(4294967295));R[b++]=V,V=V>>8,R[b++]=V,V=V>>8,R[b++]=V,V=V>>8,R[b++]=V;let H=Number(v>>BigInt(32)&BigInt(4294967295));return R[b++]=H,H=H>>8,R[b++]=H,H=H>>8,R[b++]=H,H=H>>8,R[b++]=H,b}function fe(R,v,b,j,W){d(v,j,W,R,b,7);let V=Number(v&BigInt(4294967295));R[b+7]=V,V=V>>8,R[b+6]=V,V=V>>8,R[b+5]=V,V=V>>8,R[b+4]=V;let H=Number(v>>BigInt(32)&BigInt(4294967295));return R[b+3]=H,H=H>>8,R[b+2]=H,H=H>>8,R[b+1]=H,H=H>>8,R[b]=H,b+8}n.prototype.writeBigUInt64LE=Qe(function(v,b=0){return Ee(this,v,b,BigInt(0),BigInt("0xffffffffffffffff"))}),n.prototype.writeBigUInt64BE=Qe(function(v,b=0){return fe(this,v,b,BigInt(0),BigInt("0xffffffffffffffff"))}),n.prototype.writeIntLE=function(v,b,j,W){if(v=+v,b=b>>>0,!W){const ne=Math.pow(2,8*j-1);Le(this,v,b,j,ne-1,-ne)}let V=0,H=1,Z=0;for(this[b]=v&255;++V<j&&(H*=256);)v<0&&Z===0&&this[b+V-1]!==0&&(Z=1),this[b+V]=(v/H>>0)-Z&255;return b+j},n.prototype.writeIntBE=function(v,b,j,W){if(v=+v,b=b>>>0,!W){const ne=Math.pow(2,8*j-1);Le(this,v,b,j,ne-1,-ne)}let V=j-1,H=1,Z=0;for(this[b+V]=v&255;--V>=0&&(H*=256);)v<0&&Z===0&&this[b+V+1]!==0&&(Z=1),this[b+V]=(v/H>>0)-Z&255;return b+j},n.prototype.writeInt8=function(v,b,j){return v=+v,b=b>>>0,j||Le(this,v,b,1,127,-128),v<0&&(v=255+v+1),this[b]=v&255,b+1},n.prototype.writeInt16LE=function(v,b,j){return v=+v,b=b>>>0,j||Le(this,v,b,2,32767,-32768),this[b]=v&255,this[b+1]=v>>>8,b+2},n.prototype.writeInt16BE=function(v,b,j){return v=+v,b=b>>>0,j||Le(this,v,b,2,32767,-32768),this[b]=v>>>8,this[b+1]=v&255,b+2},n.prototype.writeInt32LE=function(v,b,j){return v=+v,b=b>>>0,j||Le(this,v,b,4,2147483647,-2147483648),this[b]=v&255,this[b+1]=v>>>8,this[b+2]=v>>>16,this[b+3]=v>>>24,b+4},n.prototype.writeInt32BE=function(v,b,j){return v=+v,b=b>>>0,j||Le(this,v,b,4,2147483647,-2147483648),v<0&&(v=4294967295+v+1),this[b]=v>>>24,this[b+1]=v>>>16,this[b+2]=v>>>8,this[b+3]=v&255,b+4},n.prototype.writeBigInt64LE=Qe(function(v,b=0){return Ee(this,v,b,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),n.prototype.writeBigInt64BE=Qe(function(v,b=0){return fe(this,v,b,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Me(R,v,b,j,W,V){if(b+j>R.length)throw new RangeError("Index out of range");if(b<0)throw new RangeError("Index out of range")}function ce(R,v,b,j,W){return v=+v,b=b>>>0,W||Me(R,v,b,4),t.write(R,v,b,j,23,4),b+4}n.prototype.writeFloatLE=function(v,b,j){return ce(this,v,b,!0,j)},n.prototype.writeFloatBE=function(v,b,j){return ce(this,v,b,!1,j)};function st(R,v,b,j,W){return v=+v,b=b>>>0,W||Me(R,v,b,8),t.write(R,v,b,j,52,8),b+8}n.prototype.writeDoubleLE=function(v,b,j){return st(this,v,b,!0,j)},n.prototype.writeDoubleBE=function(v,b,j){return st(this,v,b,!1,j)},n.prototype.copy=function(v,b,j,W){if(!n.isBuffer(v))throw new TypeError("argument should be a Buffer");if(j||(j=0),!W&&W!==0&&(W=this.length),b>=v.length&&(b=v.length),b||(b=0),W>0&&W<j&&(W=j),W===j||v.length===0||this.length===0)return 0;if(b<0)throw new RangeError("targetStart out of bounds");if(j<0||j>=this.length)throw new RangeError("Index out of range");if(W<0)throw new RangeError("sourceEnd out of bounds");W>this.length&&(W=this.length),v.length-b<W-j&&(W=v.length-b+j);const V=W-j;return this===v&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(b,j,W):Uint8Array.prototype.set.call(v,this.subarray(j,W),b),V},n.prototype.fill=function(v,b,j,W){if(typeof v=="string"){if(typeof b=="string"?(W=b,b=0,j=this.length):typeof j=="string"&&(W=j,j=this.length),W!==void 0&&typeof W!="string")throw new TypeError("encoding must be a string");if(typeof W=="string"&&!n.isEncoding(W))throw new TypeError("Unknown encoding: "+W);if(v.length===1){const H=v.charCodeAt(0);(W==="utf8"&&H<128||W==="latin1")&&(v=H)}}else typeof v=="number"?v=v&255:typeof v=="boolean"&&(v=Number(v));if(b<0||this.length<b||this.length<j)throw new RangeError("Out of range index");if(j<=b)return this;b=b>>>0,j=j===void 0?this.length:j>>>0,v||(v=0);let V;if(typeof v=="number")for(V=b;V<j;++V)this[V]=v;else{const H=n.isBuffer(v)?v:n.from(v,W),Z=H.length;if(Z===0)throw new TypeError('The value "'+v+'" is invalid for argument "value"');for(V=0;V<j-b;++V)this[V+b]=H[V%Z]}return this};const Ve={};function g(R,v,b){Ve[R]=class extends b{constructor(){super(),Object.defineProperty(this,"message",{value:v.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${R}]`,this.stack,delete this.name}get code(){return R}set code(W){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:W,writable:!0})}toString(){return`${this.name} [${R}]: ${this.message}`}}}g("ERR_BUFFER_OUT_OF_BOUNDS",function(R){return R?`${R} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),g("ERR_INVALID_ARG_TYPE",function(R,v){return`The "${R}" argument must be of type number. Received type ${typeof v}`},TypeError),g("ERR_OUT_OF_RANGE",function(R,v,b){let j=`The value of "${R}" is out of range.`,W=b;return Number.isInteger(b)&&Math.abs(b)>4294967296?W=P(String(b)):typeof b=="bigint"&&(W=String(b),(b>BigInt(2)**BigInt(32)||b<-(BigInt(2)**BigInt(32)))&&(W=P(W)),W+="n"),j+=` It must be ${v}. Received ${W}`,j},RangeError);function P(R){let v="",b=R.length;const j=R[0]==="-"?1:0;for(;b>=j+4;b-=3)v=`_${R.slice(b-3,b)}${v}`;return`${R.slice(0,b)}${v}`}function L(R,v,b){k(v,"offset"),(R[v]===void 0||R[v+b]===void 0)&&$(v,R.length-(b+1))}function d(R,v,b,j,W,V){if(R>b||R<v){const H=typeof v=="bigint"?"n":"";let Z;throw v===0||v===BigInt(0)?Z=`>= 0${H} and < 2${H} ** ${(V+1)*8}${H}`:Z=`>= -(2${H} ** ${(V+1)*8-1}${H}) and < 2 ** ${(V+1)*8-1}${H}`,new Ve.ERR_OUT_OF_RANGE("value",Z,R)}L(j,W,V)}function k(R,v){if(typeof R!="number")throw new Ve.ERR_INVALID_ARG_TYPE(v,"number",R)}function $(R,v,b){throw Math.floor(R)!==R?(k(R,b),new Ve.ERR_OUT_OF_RANGE("offset","an integer",R)):v<0?new Ve.ERR_BUFFER_OUT_OF_BOUNDS:new Ve.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${v}`,R)}const q=/[^+/0-9A-Za-z-_]/g;function ae(R){if(R=R.split("=")[0],R=R.trim().replace(q,""),R.length<2)return"";for(;R.length%4!==0;)R=R+"=";return R}function me(R,v){v=v||1/0;let b;const j=R.length;let W=null;const V=[];for(let H=0;H<j;++H){if(b=R.charCodeAt(H),b>55295&&b<57344){if(!W){if(b>56319){(v-=3)>-1&&V.push(239,191,189);continue}else if(H+1===j){(v-=3)>-1&&V.push(239,191,189);continue}W=b;continue}if(b<56320){(v-=3)>-1&&V.push(239,191,189),W=b;continue}b=(W-55296<<10|b-56320)+65536}else W&&(v-=3)>-1&&V.push(239,191,189);if(W=null,b<128){if((v-=1)<0)break;V.push(b)}else if(b<2048){if((v-=2)<0)break;V.push(b>>6|192,b&63|128)}else if(b<65536){if((v-=3)<0)break;V.push(b>>12|224,b>>6&63|128,b&63|128)}else if(b<1114112){if((v-=4)<0)break;V.push(b>>18|240,b>>12&63|128,b>>6&63|128,b&63|128)}else throw new Error("Invalid code point")}return V}function Ie(R){const v=[];for(let b=0;b<R.length;++b)v.push(R.charCodeAt(b)&255);return v}function re(R,v){let b,j,W;const V=[];for(let H=0;H<R.length&&!((v-=2)<0);++H)b=R.charCodeAt(H),j=b>>8,W=b%256,V.push(W),V.push(j);return V}function Ce(R){return e.toByteArray(ae(R))}function Re(R,v,b,j){let W;for(W=0;W<j&&!(W+b>=v.length||W>=R.length);++W)v[W+b]=R[W];return W}function Oe(R,v){return R instanceof v||R!=null&&R.constructor!=null&&R.constructor.name!=null&&R.constructor.name===v.name}function De(R){return R!==R}const Ze=(function(){const R="0123456789abcdef",v=new Array(256);for(let b=0;b<16;++b){const j=b*16;for(let W=0;W<16;++W)v[j+W]=R[b]+R[W]}return v})();function Qe(R){return typeof BigInt>"u"?tt:R}function tt(){throw new Error("BigInt not supported")}})(Mc)),Mc}var op=Cy();const ee=_t.asn1,ir=_t.pki,xy=_t.pkcs12,Fc=function(r){const e=_t.util.createBuffer(op.Buffer.from(r,"base64"));return ee.fromDer(e,!0)},Sy=function(r,e,t,i){i=i||{},i.saltSize=i.saltSize||8,i.count=i.count||2048,i.algorithm=i.algorithm||i.encAlgorithm||"aes128","useMac"in i||(i.useMac=!0),"localKeyId"in i||(i.localKeyId=null),"generateLocalKeyId"in i||(i.generateLocalKeyId=!0);var a=i.localKeyId,o;if(a!==null)a=_t.util.hexToBytes(a);else if(i.generateLocalKeyId)if(e){var s=_t.util.isArray(e)?e[0]:e;typeof s=="string"&&(s=Fc(s));var n=_t.md.sha1.create();n.update(ee.toDer(s).getBytes()),a=n.digest().getBytes()}else a=_t.random.getBytes(20);var p=[];a!==null&&p.push(ee.create(ee.Class.UNIVERSAL,ee.Type.SEQUENCE,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.OID,!1,ee.oidToDer(ir.oids.localKeyId).getBytes()),ee.create(ee.Class.UNIVERSAL,ee.Type.SET,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.OCTETSTRING,!1,a)])])),"friendlyName"in i&&p.push(ee.create(ee.Class.UNIVERSAL,ee.Type.SEQUENCE,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.OID,!1,ee.oidToDer(ir.oids.friendlyName).getBytes()),ee.create(ee.Class.UNIVERSAL,ee.Type.SET,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.BMPSTRING,!1,i.friendlyName)])])),p.length>0&&(o=ee.create(ee.Class.UNIVERSAL,ee.Type.SET,!0,p));var f=[],E=[];e!==null&&(_t.util.isArray(e)?E=e:E=[e]);for(var I=[],B=0;B<E.length;++B){e=E[B],typeof e=="string"&&(e=Fc(e));var l=B===0?o:void 0,y=e,S=ee.create(ee.Class.UNIVERSAL,ee.Type.SEQUENCE,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.OID,!1,ee.oidToDer(ir.oids.certBag).getBytes()),ee.create(ee.Class.CONTEXT_SPECIFIC,0,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.SEQUENCE,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.OID,!1,ee.oidToDer(ir.oids.x509Certificate).getBytes()),ee.create(ee.Class.CONTEXT_SPECIFIC,0,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.OCTETSTRING,!1,ee.toDer(y).getBytes())])])]),l]);I.push(S)}if(I.length>0){var x=ee.create(ee.Class.UNIVERSAL,ee.Type.SEQUENCE,!0,I),c=ee.create(ee.Class.UNIVERSAL,ee.Type.SEQUENCE,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.OID,!1,ee.oidToDer(ir.oids.data).getBytes()),ee.create(ee.Class.CONTEXT_SPECIFIC,0,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.OCTETSTRING,!1,ee.toDer(x).getBytes())])]);f.push(c)}var m=null;if(r!==null){var A=Fc(r);t===null?m=ee.create(ee.Class.UNIVERSAL,ee.Type.SEQUENCE,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.OID,!1,ee.oidToDer(ir.oids.keyBag).getBytes()),ee.create(ee.Class.CONTEXT_SPECIFIC,0,!0,[A]),o]):m=ee.create(ee.Class.UNIVERSAL,ee.Type.SEQUENCE,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.OID,!1,ee.oidToDer(ir.oids.pkcs8ShroudedKeyBag).getBytes()),ee.create(ee.Class.CONTEXT_SPECIFIC,0,!0,[ir.encryptPrivateKeyInfo(A,t,i)]),o]);var N=ee.create(ee.Class.UNIVERSAL,ee.Type.SEQUENCE,!0,[m]),O=ee.create(ee.Class.UNIVERSAL,ee.Type.SEQUENCE,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.OID,!1,ee.oidToDer(ir.oids.data).getBytes()),ee.create(ee.Class.CONTEXT_SPECIFIC,0,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.OCTETSTRING,!1,ee.toDer(N).getBytes())])]);f.push(O)}var C=ee.create(ee.Class.UNIVERSAL,ee.Type.SEQUENCE,!0,f),h;if(i.useMac){var n=_t.md.sha1.create(),u=new _t.util.ByteBuffer(_t.random.getBytes(i.saltSize)),_=i.count,r=xy.generateKey(t,u,3,_,20),M=_t.hmac.create();M.start(n,r),M.update(ee.toDer(C).getBytes());var G=M.getMac();h=ee.create(ee.Class.UNIVERSAL,ee.Type.SEQUENCE,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.SEQUENCE,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.SEQUENCE,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.OID,!1,ee.oidToDer(ir.oids.sha1).getBytes()),ee.create(ee.Class.UNIVERSAL,ee.Type.NULL,!1,"")]),ee.create(ee.Class.UNIVERSAL,ee.Type.OCTETSTRING,!1,G.getBytes())]),ee.create(ee.Class.UNIVERSAL,ee.Type.OCTETSTRING,!1,u.getBytes()),ee.create(ee.Class.UNIVERSAL,ee.Type.INTEGER,!1,ee.integerToDer(_).getBytes())])}return ee.create(ee.Class.UNIVERSAL,ee.Type.SEQUENCE,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.INTEGER,!1,ee.integerToDer(3).getBytes()),ee.create(ee.Class.UNIVERSAL,ee.Type.SEQUENCE,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.OID,!1,ee.oidToDer(ir.oids.data).getBytes()),ee.create(ee.Class.CONTEXT_SPECIFIC,0,!0,[ee.create(ee.Class.UNIVERSAL,ee.Type.OCTETSTRING,!1,ee.toDer(C).getBytes())])]),h])};function Ey(r){const e="-----BEGIN CERTIFICATE-----",t="-----END CERTIFICATE-----",i=[];let a=r;for(;;){const o=a.indexOf(e),s=a.indexOf(t);if(o===-1||s===-1)break;const n=a.slice(o+e.length,s).replace(/\s+/g,"");i.push(n),a=a.slice(s+t.length)}return i}async function by({certChainPEM:r,privKeyDERB64:e,pkcs12Password:t,pkcs12Algorithm:i,allowWeakPassword:a}){let o,s="3des";i&&(s=i);const n=s==="3des"?12:8;if(!a&&(!t||t.length<n))throw TypeError("Parameter pkcs12Password must be at least "+n+" characters long (for "+s+")! Please set a strong password since PKCS#12 file passwords may be easily brute-forced offline. Set allowWeakPassword=true to skip this check (unrecommended).");const p=Ey(r);o=Sy(e,p,t,{algorithm:s});const f=_t.asn1.toDer(o).getBytes();return _t.util.encode64(f)}function Ay(r){document.body.removeChild(r.target)}function By({buffer:r,targetName:e,mimeType:t}){const i=new Blob([r],{type:t}),a=document.createElement("a");a.download=e,a.innerHTML="Download File",a.href=window.URL.createObjectURL(i),a.onclick=Ay,a.style.display="none",document.body.appendChild(a),a.click()}function wy({buffer:r,targetName:e}){return By({buffer:r,targetName:e,mimeType:"application/x-pkcs12"})}function Iy(r){return op.Buffer.from(r,"base64")}async function Ty({algorithm:r,keys:e}){const t=new Date(+new Date-6e4),i=new Date(+new Date+1e3*60*60*24*30);return(await ry.createSelfSigned({serialNumber:"01",name:"CN=TinyPKI clientSideCertReqLib Demo",notBefore:t,notAfter:i,signingAlgorithm:r,keys:e,extensions:[new Mu(!0,2,!0),new Fu(["1.2.3.4.5.6.7","2.3.4.5.6.7.8"],!0),new gs(Ui.keyCertSign|Ui.cRLSign,!0),await Sn.create(e.publicKey)]})).toString("pem")}return Pr.base64ToBuffer=Iy,Pr.exportKeyDERB64=lp,Pr.generateCSR=iy,Pr.generatePKCS12=by,Pr.generateSelfSignedCert=Ty,Pr.savePKCS12BufferAsFile=wy,Pr})({});
|
|
33
|
+
//# sourceMappingURL=tinypki-client-side-cert-req-lib.js.map
|