function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==typeof t?t:t+""}function _toPrimitive(e,t){if("object"!=typeof e||!e)return e;var r;if("undefined"!=typeof Symbol&&void 0!==(r=e[Symbol.toPrimitive])){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)} /*! * MIT License * * Copyright (c) Peculiar Ventures. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */var x509=function(e,t){"use strict"; /*! * MIT License * * Copyright (c) 2017-2024 Peculiar Ventures, LLC * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */class r{static isArrayBuffer(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){const i=r.toUint8Array(e),n=r.toUint8Array(t);if(i.length!==n.byteLength)return!1;for(let e=0;e=0;i--)r+=e[e.length-1-i]*Math.pow(2,t*i);return r}function h(e,t,r=-1){const i=r;let n=e,s=0,o=Math.pow(2,t);for(let r=1;r<8;r++){if(e=0;e--){const r=Math.pow(2,e*t);o[s-e-1]=Math.floor(n/r),n-=o[s-e-1]*r}return e}o*=Math.pow(2,t)}return new ArrayBuffer(0)}function f(...e){let t=0,r=0;for(const r of e)t+=r.length;const i=new ArrayBuffer(t),n=new Uint8Array(i);for(const t of e)n.set(t,r),r+=t.length;return n}function d(){const e=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const t=255===e[0]&&128&e[1],r=0===e[0]&&!(128&e[1]);(t||r)&&this.warnings.push("Needlessly long format")}const t=new ArrayBuffer(this.valueHex.byteLength),r=new Uint8Array(t);for(let e=0;e=s.length)return this.error="End of input reached before message was fully decoded",-1;if(e++,!(128&s[t]))break}this.blockLength=e+1;const t=this.valueHexView=new Uint8Array(e);for(let r=0;r8)return this.error="Too big integer",-1;if(o+1>s.length)return this.error="End of input reached before message was fully decoded",-1;const a=t+1,c=n.subarray(a,a+o);return 0===c[o-1]&&this.warnings.push("Needlessly long encoded length"),this.length=p(c,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=o+1,t+this.blockLength}toBER(e=!1){let t,r;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),!1===e&&(r=new Uint8Array(t),r[0]=128),t;if(this.longFormUsed){const i=h(this.length,8);if(i.byteLength>127)return this.error="Too big length",k;if(t=new ArrayBuffer(i.byteLength+1),e)return t;const n=new Uint8Array(i);r=new Uint8Array(t),r[0]=128|i.byteLength;for(let e=0;ei.maxDepth)return function(e){const t=new L({},T);return t.error=e,{offset:-1,result:t}}("Maximum ASN.1 nesting depth exceeded");i.depth=n;try{return z(e,t,r,i)}finally{i.depth-=1}}function z(e,t=0,r=e.length,i=K()){const n=t;let s=new L({},T);const o=new I;if(!m(o,e,t,r))return s.error=o.error,{offset:-1,result:s};if(!e.subarray(t,t+r).length)return s.error="Zero buffer length",{offset:-1,result:s};const a=function(e){if(e.nodesCount+=1,e.nodesCount>e.maxNodes)return"Maximum ASN.1 node count exceeded"}(i);if(a)return s.error=a,{offset:-1,result:s};let c=s.idBlock.fromBER(e,t,r);if(s.idBlock.warnings.length&&s.warnings.concat(s.idBlock.warnings),-1===c)return s.error=s.idBlock.error,{offset:-1,result:s};if(t=c,r-=s.idBlock.blockLength,c=s.lenBlock.fromBER(e,t,r),s.lenBlock.warnings.length&&s.warnings.concat(s.lenBlock.warnings),-1===c)return s.error=s.lenBlock.error,{offset:-1,result:s};t=c,r-=s.lenBlock.blockLength;const l=s.lenBlock.isIndefiniteForm?r:s.lenBlock.length,u=function(e,t){if(e>t.maxContentLength)return"Maximum ASN.1 content length exceeded"}(l,i);if(u)return s.error=u,{offset:-1,result:s};if(!s.idBlock.isConstructed&&s.lenBlock.isIndefiniteForm)return s.error="Indefinite length form used for primitive encoding form",{offset:-1,result:s};let p=L;if(1===s.idBlock.tagClass){if(s.idBlock.tagNumber>=37&&!1===s.idBlock.isHexOnly)return s.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:s};switch(s.idBlock.tagNumber){case 0:if(s.idBlock.isConstructed&&s.lenBlock.length>0)return s.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:s};p=U.EndOfContent;break;case 1:p=U.Boolean;break;case 2:p=U.Integer;break;case 3:p=U.BitString;break;case 4:p=U.OctetString;break;case 5:p=U.Null;break;case 6:p=U.ObjectIdentifier;break;case 10:p=U.Enumerated;break;case 12:p=U.Utf8String;break;case 13:p=U.RelativeObjectIdentifier;break;case 14:p=U.TIME;break;case 15:return s.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:s};case 16:p=U.Sequence;break;case 17:p=U.Set;break;case 18:p=U.NumericString;break;case 19:p=U.PrintableString;break;case 20:p=U.TeletexString;break;case 21:p=U.VideotexString;break;case 22:p=U.IA5String;break;case 23:p=U.UTCTime;break;case 24:p=U.GeneralizedTime;break;case 25:p=U.GraphicString;break;case 26:p=U.VisibleString;break;case 27:p=U.GeneralString;break;case 28:p=U.UniversalString;break;case 29:p=U.CharacterString;break;case 30:p=U.BmpString;break;case 31:p=U.DATE;break;case 32:p=U.TimeOfDay;break;case 33:p=U.DateTime;break;case 34:p=U.Duration;break;default:{const e=s.idBlock.isConstructed?new U.Constructed:new U.Primitive;e.idBlock=s.idBlock,e.lenBlock=s.lenBlock,e.warnings=s.warnings,s=e}}}else p=s.idBlock.isConstructed?U.Constructed:U.Primitive;return s=function(e,t){if(e instanceof t)return e;const r=new t;return r.idBlock=e.idBlock,r.lenBlock=e.lenBlock,r.warnings=e.warnings,r.valueBeforeDecodeView=e.valueBeforeDecodeView,r}(s,p),c=s.fromBER(e,t,l,i),s.valueBeforeDecodeView=e.subarray(n,n+s.blockLength),{offset:c,result:s}}function W(e,t={}){if(!e.byteLength){const e=new L({},T);return e.error="Input buffer has zero length",{offset:-1,result:e}}return z(r.toUint8Array(e).slice(),0,e.byteLength,K(t))}function q(e,t){return e?1:t}class G extends T{constructor({value:e=[],isIndefiniteForm:t=!1,...r}={}){super(r),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,i,n){const s=r.toUint8Array(e),o=null!=n?n:K();if(!m(this,s,t,i))return-1;if(this.valueBeforeDecodeView=s.subarray(t,t+i),0===this.valueBeforeDecodeView.length)return this.warnings.push("Zero buffer length"),t;let a=t;for(;q(this.isIndefiniteForm,i)>0;){const e=F(s,a,i,o);if(-1===e.offset)return this.error=e.result.error,this.warnings.concat(e.result.warnings),-1;if(a=e.offset,this.blockLength+=e.result.blockLength,i-=e.result.blockLength,this.value.push(e.result),this.isIndefiniteForm&&e.result.constructor.NAME===P)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===P?this.value.pop():this.warnings.push("No EndOfContent block encoded")),a}toBER(e,t){const r=t||new b;for(let t=0;t` ${e}`).join("\n"));const t=3===this.idBlock.tagClass?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :\n${e.join("\n")}`:`${t} :`}}J=Q,U.Constructed=J,Q.NAME="CONSTRUCTED";class ee extends T{fromBER(e,t,r){return t}toBER(e){return k}}ee.override="EndOfContentValueBlock";class te extends L{constructor(e={}){super(e,ee),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}X=te,U.EndOfContent=X,te.NAME=P;class re extends L{constructor(e={}){super(e,T),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,r){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+=r,t+r>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+r}toBER(e,t){const r=new ArrayBuffer(2);if(!e){const e=new Uint8Array(r);e[0]=5,e[1]=0}return t&&t.write(r),r}onAsciiEncoding(){return`${this.constructor.NAME}`}}Z=re,U.Null=Z,re.NAME="NULL";class ie extends(N(T)){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=r.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}fromBER(e,t,i){const n=r.toUint8Array(e);return m(this,n,t,i)?(this.valueHexView=n.subarray(t,t+i),i>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,d.call(this),this.blockLength=i,t+i):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}ie.NAME="BooleanValueBlock";let ne=class extends L{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor(e={}){super(e,ie),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};Y=ne,U.Boolean=Y,ne.NAME="BOOLEAN";class se extends(N(G)){constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,r,i){let n=0;if(this.isConstructed){if(this.isHexOnly=!1,n=G.prototype.fromBER.call(this,e,t,r,i),-1===n)return n;for(let e=0;e0&&r.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=r.unusedBits}return s}const o=r.toUint8Array(e);if(!m(this,o,t,i))return-1;const a=o.subarray(t,t+i);if(this.unusedBits=a[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const e=a.subarray(1);try{if(e.byteLength){const t=null!=n?n:K(),r=F(e,0,e.byteLength,t);-1!==r.offset&&r.offset===i-1&&(this.value=[r.result])}}catch(e){}}return this.valueHexView=a.subarray(1),this.blockLength=a.length,t+i}toBER(e,t){if(this.isConstructed)return G.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength){const e=new Uint8Array(1);return e[0]=0,e.buffer}const r=new Uint8Array(this.valueHexView.length+1);return r[0]=this.unusedBits,r.set(this.valueHexView,1),r.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}var le;ce.NAME="BitStringValueBlock";let ue=class extends L{constructor({idBlock:e={},lenBlock:t={},...r}={}){var i,n;null!==(i=r.isConstructed)&&void 0!==i||(r.isConstructed=!!(null===(n=r.value)||void 0===n?void 0:n.length)),super({idBlock:{isConstructed:r.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!r.isIndefiniteForm},...r},ce),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,r,i){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,r,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Q.prototype.onAsciiEncoding.call(this);{const e=[],t=this.valueBlock.valueHexView;for(const r of t)e.push(r.toString(2).padStart(8,"0"));const r=e.join("");return`${this.constructor.NAME} : ${r.substring(0,r.length-this.valueBlock.unusedBits)}`}}};var pe,he,fe,de,ye,ge,ve;function me(e,t){const r=new Uint8Array([0]),i=new Uint8Array(e),n=new Uint8Array(t);let s=i.slice(0);const o=s.length-1,a=n.slice(0),c=a.length-1;let l=0;let u=0;for(let e=c=0;e--,u++){if(!0==u=s.length)s=f(new Uint8Array([l%10]),s);else s[o-u]=l%10}return r[0]>0&&(s=f(r,s)),s}function be(e){if(e>=w.length)for(let t=w.length;t<=e;t++){const e=new Uint8Array([0]);let r=w[t-1].slice(0);for(let t=r.length-1;t>=0;t--){const i=new Uint8Array([(r[t]<<1)+e[0]]);e[0]=i[0]/10,r[t]=i[0]%10}e[0]>0&&(r=f(e,r)),w.push(r)}return w[e]}function we(e,t){let r=0;const i=new Uint8Array(e),n=new Uint8Array(t),s=i.slice(0),o=s.length-1,a=n.slice(0),c=a.length-1;let l,u=0;for(let e=c;e>=0;e--,u++)if(l=s[o-u]-a[c-u]-r,!0==l<0)r=1,s[o-u]=l+10;else r=0,s[o-u]=l;if(r>0)for(let e=o-c+1;e>=0;e--,u++){if(l=s[o-u]-r,!(l<0)){r=0,s[o-u]=l;break}r=1,s[o-u]=l+10}return s.slice()}le=ue,U.BitString=le,ue.NAME=O;class Ae extends(N(T)){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=d.call(this)))}constructor({value:e,...t}={}){super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),void 0!==e&&(this.valueDec=e)}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(function(e){const t=e<0?-1*e:e;let r=128;for(let i=1;i<8;i++){if(t<=r){if(e<0){const e=h(r-t,8,i);return new Uint8Array(e)[0]|=128,e}let n=h(t,8,i),s=new Uint8Array(n);if(128&s[0]){const e=n.slice(0),t=new Uint8Array(e);n=new ArrayBuffer(n.byteLength+1),s=new Uint8Array(n);for(let r=0;r1&&(i=s.length+1),this.valueHexView=s.subarray(i-s.length)),n}toDER(e=!1){const t=this.valueHexView;switch(!0){case!!(128&t[0]):{const e=new Uint8Array(this.valueHexView.length+1);e[0]=0,e.set(t,1),this.valueHexView=e}break;case 0===t[0]&&!(128&t[1]):this.valueHexView=this.valueHexView.subarray(1)}return this.toBER(e)}fromBER(e,t,r){const i=super.fromBER(e,t,r);return-1===i||this.setValueHex(),i}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=8*this.valueHexView.length-1;let t,r=new Uint8Array(8*this.valueHexView.length/3),i=0;const n=this.valueHexView;let s="",o=!1;for(let o=n.byteLength-1;o>=0;o--){t=n[o];for(let n=0;n<8;n++){if(!(1&~t))if(i===e)r=we(be(i),r),s="-";else r=me(r,be(i));i++,t>>=1}}for(let e=0;e0;){const t=new Be;if(i=t.fromBER(e,i,r),-1===i)return this.blockLength=0,this.error=t.error,i;0===this.value.length&&(t.isFirstSid=!0),this.blockLength+=t.blockLength,r-=t.blockLength,this.value.push(t)}return i}toBER(e){const t=[];for(let r=0;rNumber.MAX_SAFE_INTEGER){g();const t=BigInt(i);e.valueBigInt=t}else if(e.valueDec=parseInt(i,10),isNaN(e.valueDec))return;this.value.length||(e.isFirstSid=!0,n=!0),this.value.push(e)}}while(-1!==r)}toString(){let e="",t=!1;for(let r=0;r0;){const t=new Pe;if(i=t.fromBER(e,i,r),-1===i)return this.blockLength=0,this.error=t.error,i;this.blockLength+=t.blockLength,r-=t.blockLength,this.value.push(t)}return i}toBER(e,t){const r=[];for(let t=0;t4)continue;const s=4-n.length;for(let e=n.length-1;e>=0;e--)r[4*i+e+s]=n[e]}this.valueBlock.value=e}}nt.NAME="UniversalStringValueBlock";class st extends nt{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}Re=st,U.UniversalString=Re,st.NAME="UniversalString";class ot extends _e{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}Ve=ot,U.NumericString=Ve,ot.NAME="NumericString";class at extends _e{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}He=at,U.PrintableString=He,at.NAME="PrintableString";class ct extends _e{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}$e=ct,U.TeletexString=$e,ct.NAME="TeletexString";class lt extends _e{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}Me=lt,U.VideotexString=Me,lt.NAME="VideotexString";class ut extends _e{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}Ke=ut,U.IA5String=Ke,ut.NAME="IA5String";class pt extends _e{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}Fe=pt,U.GraphicString=Fe,pt.NAME="GraphicString";class ht extends _e{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}ze=ht,U.VisibleString=ze,ht.NAME="VisibleString";class ft extends _e{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}We=ft,U.GeneralString=We,ft.NAME="GeneralString";class dt extends _e{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}qe=dt,U.CharacterString=qe,dt.NAME="CharacterString";class yt extends ht{constructor({value:e,valueDate:t,...r}={}){if(super(r),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 t=0;t=50?1900+r:2e3+r,this.month=parseInt(t[2],10),this.day=parseInt(t[3],10),this.hour=parseInt(t[4],10),this.minute=parseInt(t[5],10),this.second=parseInt(t[6],10)}toString(e="iso"){if("iso"===e){const e=new Array(7);return e[0]=y(this.year<2e3?this.year-1900:this.year-2e3,2),e[1]=y(this.month,2),e[2]=y(this.day,2),e[3]=y(this.hour,2),e[4]=y(this.minute,2),e[5]=y(this.second,2),e[6]="Z",e.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}}}Ge=yt,U.UTCTime=Ge,yt.NAME="UTCTime";class gt extends yt{constructor(e={}){var t;super(e),null!==(t=this.millisecond)&&void 0!==t||(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,r=!1,i="",n="",s=0,o=0,a=0;if("Z"===e[e.length-1])i=e.substring(0,e.length-1),r=!0;else{const t=new Number(e[e.length-1]);if(isNaN(t.valueOf()))throw new Error("Wrong input string for conversion");i=e}if(r){if(-1!==i.indexOf("+"))throw new Error("Wrong input string for conversion");if(-1!==i.indexOf("-"))throw new Error("Wrong input string for conversion")}else{let e=1,t=i.indexOf("+"),r="";if(-1===t&&(t=i.indexOf("-"),e=-1),-1!==t){if(r=i.substring(t+1),i=i.substring(0,t),2!==r.length&&4!==r.length)throw new Error("Wrong input string for conversion");let n=parseInt(r.substring(0,2),10);if(isNaN(n.valueOf()))throw new Error("Wrong input string for conversion");if(o=e*n,4===r.length){if(n=parseInt(r.substring(2,4),10),isNaN(n.valueOf()))throw new Error("Wrong input string for conversion");a=e*n}}}let c=i.indexOf(".");if(-1===c&&(c=i.indexOf(",")),-1!==c){const e=new Number(`0${i.substring(c)}`);if(isNaN(e.valueOf()))throw new Error("Wrong input string for conversion");s=e.valueOf(),n=i.substring(0,c)}else n=i;switch(!0){case 8===n.length:if(t=/(\d{4})(\d{2})(\d{2})/gi,-1!==c)throw new Error("Wrong input string for conversion");break;case 10===n.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})/gi,-1!==c){let e=60*s;this.minute=Math.floor(e),e=60*(e-this.minute),this.second=Math.floor(e),e=1e3*(e-this.second),this.millisecond=Math.floor(e)}break;case 12===n.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==c){let e=60*s;this.second=Math.floor(e),e=1e3*(e-this.second),this.millisecond=Math.floor(e)}break;case 14===n.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==c){const e=1e3*s;this.millisecond=Math.floor(e)}break;default:throw new Error("Wrong input string for conversion")}const l=t.exec(n);if(null===l)throw new Error("Wrong input string for conversion");for(let e=1;e0&&r.valueBlock.value[0]instanceof Bt&&(s=t.valueBlock.value.length),0===s)return{verified:!0,result:e};if(0===t.valueBlock.value.length&&0!==r.valueBlock.value.length){let t=!0;for(let e=0;e=t.valueBlock.value.length){if(!1===r.valueBlock.value[o].optional){const t={verified:!1,result:e};return e.error="Inconsistent length between ASN.1 data and schema",r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,B),r.name&&(delete e[r.name],t.name=r.name)),t}}else if(r.valueBlock.value[0]instanceof Bt){if(n=kt(e,t.valueBlock.value[o],r.valueBlock.value[0].value),!1===n.verified){if(!r.valueBlock.value[0].optional)return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,B),r.name&&delete e[r.name]),n;i++}if(S in r.valueBlock.value[0]&&r.valueBlock.value[0].name.length>0){let i={};i="local"in r.valueBlock.value[0]&&r.valueBlock.value[0].local?t:e,void 0===i[r.valueBlock.value[0].name]&&(i[r.valueBlock.value[0].name]=[]),i[r.valueBlock.value[0].name].push(t.valueBlock.value[o])}}else if(n=kt(e,t.valueBlock.value[o-i],r.valueBlock.value[o]),!1===n.verified){if(!r.valueBlock.value[o].optional)return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,B),r.name&&delete e[r.name]),n;i++}if(!1===n.verified){const t={verified:!1,result:e};return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,B),r.name&&(delete e[r.name],t.name=r.name)),t}return{verified:!0,result:e}}if(r.primitiveSchema&&x in t.valueBlock){const i=z(t.valueBlock.valueHexView);if(-1===i.offset){const t={verified:!1,result:i.result};return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,B),r.name&&(delete e[r.name],t.name=r.name)),t}return kt(e,i.result,r.primitiveSchema)}return{verified:!0,result:e}}var Ct=Object.freeze({__proto__:null,Any:St,BaseBlock:L,BaseStringBlock:R,BitString:ue,BmpString:it,Boolean:ne,CharacterString:dt,Choice:xt,Constructed:Q,DATE:vt,DEFAULT_MAX_CONTENT_LENGTH:M,DEFAULT_MAX_DEPTH:100,DEFAULT_MAX_NODES:1e4,DateTime:bt,Duration:wt,EndOfContent:te,Enumerated:xe,GeneralString:ft,GeneralizedTime:gt,GraphicString:pt,HexBlock:N,IA5String:ut,Integer:Se,Null:re,NumericString:ot,ObjectIdentifier:Ce,OctetString:ae,Primitive:$,PrintableString:at,RawData:class{get data(){return this.dataView.slice().buffer}set data(e){this.dataView=r.toUint8Array(e)}constructor({data:e=C}={}){this.dataView=r.toUint8Array(e)}fromBER(e,t,i){const n=t+i;return this.dataView=r.toUint8Array(e).subarray(t,n),n}toBER(e){return this.dataView.slice().buffer}},RelativeObjectIdentifier:Oe,Repeated:Bt,Sequence:Ne,Set:Ie,TIME:At,TeletexString:ct,TimeOfDay:mt,UTCTime:yt,UniversalString:st,Utf8String:tt,ValueBlock:T,VideotexString:lt,ViewWriter:b,VisibleString:ht,compareSchema:kt,fromBER:W,verifySchema:function(e,t){if(t instanceof Object==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const i=z(r.toUint8Array(e));return-1===i.offset?{verified:!1,result:i.result}:kt(i.result,i.result,t)}});function Pt(e){return Object.prototype.toString.call(e)}function Et(e){return"[object ArrayBuffer]"===Pt(e)}function Ot(e){return Et(e)||function(e){return"undefined"!=typeof SharedArrayBuffer&&"[object SharedArrayBuffer]"===Pt(e)}(e)}function Nt(e){return function(e){if(ArrayBuffer.isView(e))return!0;if(!e||"object"!=typeof e)return!1;const t=e;return"number"==typeof t.byteOffset&&"number"==typeof t.byteLength&&Ot(t.buffer)}(e)}function It(e){return Ot(e)||Nt(e)}function Tt(e){if(!It(e))throw new TypeError("Expected ArrayBuffer, SharedArrayBuffer, or ArrayBufferView")}function jt(e){return Tt(e),Ot(e)?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function _t(e){if(Tt(e),Et(e))return e;const t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(jt(e)),t}function Ut(e){const t=jt(e);let r="";for(const e of t)r+=String.fromCharCode(e);return r}function Lt(e){const t=new Uint8Array(e.length);for(let r=0;re.length>0),c=function(e){var t,r,i,n,s;const o=null!==(t=e.match(/[0-9A-Fa-f]+|[^0-9A-Fa-f]+/g))&&void 0!==t?t:[];if(o.length<3)return;const a=o.filter((e,t)=>t%2==0),c=o.filter((e,t)=>t%2==1),l=c[0];if(!l||c.some(e=>e!==l))return;if(a.some(e=>0===e.length||e.length%2!=0))return;const u=null!==(r=null===(i=a[0])||void 0===i?void 0:i.length)&&void 0!==r?r:0;return u&&!(a.slice(0,-1).some(e=>e.length!==u)||(null!==(n=null===(s=a[a.length-1])||void 0===s?void 0:s.length)&&void 0!==n?n:0)>u)?{size:u/2,separator:l}:void 0}(null!==(t=null===(r=a[0])||void 0===r?void 0:r.trim())&&void 0!==t?t:""),l={case:Mt(i),prefix:n};if(c&&(l.group=c),o&&a.length>1){var u;const e=Kt(null!==(u=a[0])&&void 0!==u?u:"").length/2;e>0&&a.slice(0,-1).every(t=>Kt(t).length/2===e)&&(l.line={bytesPerLine:e,separator:o})}return l}function zt(e,t){if(!t)return e.join("");if(!Number.isInteger(t.size)||t.size<1)throw new RangeError("Hex group size must be a positive integer");const r=[];for(let i=0;it.length-e.length);for(const e of n)Ht(e);let s=e.trim();if(/^0x/i.test(s)){if(!i)throw new TypeError("Hexadecimal text must not include a 0x prefix");s=s.slice(2)}let o="",a=!1;for(let e=0;e0)throw new TypeError("Hexadecimal text must not end with a separator");if(o.length%2!=0){if(!t.allowOddLength)throw new TypeError("Hexadecimal text must contain an even number of characters");o=`0${o}`}return o.toLowerCase()}(e,t)}function qt(e,t={}){var r,i;const n=jt(e),s=null!==(r=t.case)&&void 0!==r?r:"lower",o=Array.from(n,e=>{const t=e.toString(16).padStart(2,"0");return"upper"===s?t.toUpperCase():t});let a="";if(t.line){var c;const e=t.line.bytesPerLine;if(!Number.isInteger(e)||e<1)throw new RangeError("Hex bytesPerLine must be a positive integer");const r=null!==(c=t.line.separator)&&void 0!==c?c:"\n",i=[];for(let r=0;re.trim()).filter(Boolean),r={};let i=0;for(;ir)}(e,{label:t,strict:!0});return r.data}const yr={name:"pem",encode:(e,t)=>{if(null==t||!t.label)throw new TypeError("PEM label is required");return fr(t.label,e,t)},decode:(e,t)=>dr(e,null==t?void 0:t.label),format:function(e,t){return fr(t.label,e,t)},is:e=>"string"==typeof e&&/-----BEGIN [^-]+-----/.test(e),parse:function(e,t={}){const[r]=hr(e,{...t,strict:!0}),i={label:r.label,headers:r.headers,lineLength:r.lineLength,newline:r.newline};return{bytes:r.data,format:i,normalized:fr(r.label,r.data,i)}}};function gr(e){return e.trim().toLowerCase()}function vr(e){return e instanceof Error?e:new Error(String(e))}function mr(e,t,r){for(const t of[r.name,...null!==(i=r.aliases)&&void 0!==i?i:[]]){var i;e.delete(gr(t))}t.delete(gr(r.name))}function br(e,t,r){const i=e[r];if("function"!=typeof i)throw new Error(`Converter '${t}' does not support ${r}()`);return i}function wr(e,t,r){const i=gr(r.name||e),n=t.trim();if(!n)return 0;let s=!1;r.is&&(s=r.is(t));let o=!1;try{r.decode(t),o=!0}catch(e){o=!1}if(!s&&!o)return 0;switch(i){case"pem":return/-----BEGIN [^-]+-----/.test(t)?1:0;case"hex":{const e=n.replace(/^0x/i,"").replace(/[\s:.-]/g,"");return!e||/[^0-9a-f]/i.test(e)||e.length%2!=0?0:/^0x/i.test(n)||/[:\s.-]/.test(n)?.95:/[a-f]/.test(n)||/[A-F]/.test(n)?.8:.45}case"base64url":return/[-_]/.test(n)?.95:/=/.test(n)?.1:.6;case"base64":return/[+/=]/.test(n)?.9:.55;case"binary":case"utf8":case"utf16be":case"utf16le":return 0;default:return s&&o?.75:.5}}var Ar,Sr;!function(e=[]){const t=new Map,r=new Set,i={register(e,i={}){var n;if(!e.name||!gr(e.name))throw new TypeError("Converter name is required");const s=[...new Set([e.name,...null!==(n=e.aliases)&&void 0!==n?n:[]].map(gr))],o=new Set;for(const e of s){const r=t.get(e);if(r){if(!i.override)throw new Error(`Converter '${e}' is already registered`);o.add(r)}}for(const e of o)mr(t,r,e);for(const r of s)t.set(r,e);return r.add(gr(e.name)),this},unregister(e){const i=t.get(gr(e));return!!i&&(mr(t,r,i),!0)},has:e=>t.has(gr(e)),get(e){const r=t.get(gr(e));if(!r)throw new Error(`Converter '${e}' is not registered`);return r},list(){return[...r].map(e=>this.get(e))},encode(e,t,r){return this.get(e).encode(t,r)},decode(e,t,r){return this.get(e).decode(t,r)},tryDecode(e,t,r){try{return{ok:!0,bytes:this.decode(e,t,r)}}catch(e){return{ok:!1,error:vr(e)}}},normalize(e,t,r){const i=this.get(e);return br(i,e,"normalize").call(i,t,r)},parse(e,t,r){const i=this.get(e);return br(i,e,"parse").call(i,t,r)},format(e,t,r){const i=this.get(e);return br(i,e,"format").call(i,t,r)},transcode(e,t){const r=this.decode(t.from,e,t.fromOptions);return this.encode(t.to,r,t.toOptions)},detect(e,t={}){var r;const i=null!==(r=t.formats)&&void 0!==r&&r.length?t.formats.map(e=>String(e)):this.list().map(e=>e.name).filter(e=>!["binary","utf8","utf16be","utf16le"].includes(gr(e))),n=new Map;for(const t of i){const r=this.get(t),i=wr(t,e,r);if(i<=0)continue;const s=r.name,o=n.get(s);(!o||i>o.confidence)&&n.set(s,{format:s,confidence:i})}return[...n.values()].sort((e,t)=>t.confidence-e.confidence)}};for(const t of e)i.register(t)}([{name:"binary",aliases:["latin1"],encode:Ut,decode:Lt,is:function(e){return"string"==typeof e}},{name:"hex",encode:qt,decode:Gt,format:function(e,t){return qt(e,t)},is:function(e,t={}){if("string"!=typeof e)return!1;try{return Wt(e,t),!0}catch(e){return!1}},normalize:Wt,parse:function(e,t={}){const r=Wt(e,t);return{bytes:Gt(r),format:Ft(e),normalized:r}}},{name:"base64",aliases:["b64"],encode:tr,decode:rr,is:er,normalize:Qt},{name:"base64url",aliases:["base64-url","b64url"],encode:function(e,t){return ir.encode(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")},decode:function(e,t){const r=sr(e);if(!or(r))throw new TypeError("Input is not valid Base64Url text");return ir.decode(ir.pad(r.replace(/-/g,"+").replace(/_/g,"/")))},is:or,normalize:sr},{name:"utf8",aliases:["utf-8"],encode:e=>function(e){return new TextDecoder("utf-8",{fatal:!1}).decode(jt(e))}(e),decode:e=>function(e){return(new TextEncoder).encode(e)}(e),is:e=>"string"==typeof e},{name:"utf16be",aliases:["utf16","utf-16","utf-16be"],encode:e=>Xt(e),decode:e=>Jt(e),is:e=>"string"==typeof e},{name:"utf16le",aliases:["utf-16le","ucs2","usc2"],encode:e=>Xt(e,{littleEndian:!0}),decode:e=>Jt(e,{littleEndian:!0}),is:e=>"string"==typeof e},yr]),function(e){e[e.Sequence=0]="Sequence",e[e.Set=1]="Set",e[e.Choice=2]="Choice"}(Ar||(Ar={})),function(e){e[e.Any=1]="Any",e[e.Boolean=2]="Boolean",e[e.OctetString=3]="OctetString",e[e.BitString=4]="BitString",e[e.Integer=5]="Integer",e[e.Enumerated=6]="Enumerated",e[e.ObjectIdentifier=7]="ObjectIdentifier",e[e.Utf8String=8]="Utf8String",e[e.BmpString=9]="BmpString",e[e.UniversalString=10]="UniversalString",e[e.NumericString=11]="NumericString",e[e.PrintableString=12]="PrintableString",e[e.TeletexString=13]="TeletexString",e[e.VideotexString=14]="VideotexString",e[e.IA5String=15]="IA5String",e[e.GraphicString=16]="GraphicString",e[e.VisibleString=17]="VisibleString",e[e.GeneralString=18]="GeneralString",e[e.CharacterString=19]="CharacterString",e[e.UTCTime=20]="UTCTime",e[e.GeneralizedTime=21]="GeneralizedTime",e[e.DATE=22]="DATE",e[e.TimeOfDay=23]="TimeOfDay",e[e.DateTime=24]="DateTime",e[e.Duration=25]="Duration",e[e.TIME=26]="TIME",e[e.Null=27]="Null",e[e.RelativeObjectIdentifier=28]="RelativeObjectIdentifier"}(Sr||(Sr={}));class xr{constructor(e,t=0){if(_defineProperty(this,"unusedBits",0),_defineProperty(this,"value",new ArrayBuffer(0)),e)if("number"==typeof e)this.fromNumber(e);else{if(!It(e))throw TypeError("Unsupported type of 'params' argument for BitString");this.unusedBits=t,this.value=_t(e)}}fromASN(e){if(!(e instanceof ue))throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=e.valueBlock.unusedBits,this.value=_t(e.valueBlock.valueHex),this}toASN(){return new ue({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new ue({name:e})}toNumber(){let e="";const t=new Uint8Array(this.value);for(const r of t)e+=r.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 r=t.length+7>>3;this.unusedBits=(r<<3)-t.length;const i=new Uint8Array(r);t=t.padStart(r<<3,"0").split("").reverse().join("");let n=0;for(;ne instanceof re?null:_t(e.valueBeforeDecodeView),toASN:e=>{if(null===e)return new re;const t=W(e,{maxDepth:1/0,maxNodes:1/0,maxContentLength:1/0});if(t.result.error)throw new Error(t.result.error);return t.result}},Cr={fromASN:e=>e.valueBlock.valueHexView.byteLength>=4?e.valueBlock.toString():e.valueBlock.valueDec,toASN:e=>new Se({value:+e})},Pr={fromASN:e=>e.valueBlock.valueDec,toASN:e=>new xe({value:e})},Er={fromASN:e=>_t(e.valueBlock.valueHexView),toASN:e=>new Se({valueHex:e})},Or={fromASN:e=>_t(e.valueBlock.valueHexView),toASN:e=>new ue({valueHex:e})},Nr={fromASN:e=>e.valueBlock.toString(),toASN:e=>new Ce({value:e})},Ir={fromASN:e=>e.valueBlock.toString(),toASN:e=>new Oe({value:e})},Tr={fromASN:e=>e.valueBlock.value,toASN:e=>new ne({value:e})},jr={fromASN:e=>_t(e.valueBlock.valueHexView),toASN:e=>new ae({valueHex:e})},_r={fromASN:e=>new Br(e.getValue()),toASN:e=>e.toASN()};function Ur(e){return{fromASN:e=>e.valueBlock.value,toASN:t=>new e({value:t})}}const Lr=Ur(tt),Dr=Ur(it),Rr=Ur(st),Vr=Ur(ot),Hr=Ur(at),$r=Ur(ct),Mr=Ur(lt),Kr=Ur(ut),Fr=Ur(pt),zr=Ur(ht),Wr=Ur(ft),qr=Ur(dt),Gr={fromASN:e=>e.toDate(),toASN:e=>new yt({valueDate:e})},Jr={fromASN:e=>e.toDate(),toASN:e=>new gt({valueDate:e})},Xr={fromASN:()=>null,toASN:()=>new re};function Zr(e){switch(e){case Sr.Any:return kr;case Sr.BitString:return Or;case Sr.BmpString:return Dr;case Sr.Boolean:return Tr;case Sr.CharacterString:return qr;case Sr.Enumerated:return Pr;case Sr.GeneralString:return Wr;case Sr.GeneralizedTime:return Jr;case Sr.GraphicString:return Fr;case Sr.IA5String:return Kr;case Sr.Integer:return Cr;case Sr.Null:return Xr;case Sr.NumericString:return Vr;case Sr.ObjectIdentifier:return Nr;case Sr.RelativeObjectIdentifier:return Ir;case Sr.OctetString:return jr;case Sr.PrintableString:return Hr;case Sr.TeletexString:return $r;case Sr.UTCTime:return Gr;case Sr.UniversalString:return Rr;case Sr.Utf8String:return Lr;case Sr.VideotexString:return Mr;case Sr.VisibleString:return zr;default:return null}}function Yr(e){return"function"==typeof e&&e.prototype?!(!e.prototype.toASN||!e.prototype.fromASN)||Yr(e.prototype):!!(e&&"object"==typeof e&&"toASN"in e&&"fromASN"in e)}function Qr(e){if(e){var t;const r=Object.getPrototypeOf(e);return(null==r||null===(t=r.prototype)||void 0===t?void 0:t.constructor)===Array||Qr(r)}return!1}function ei(e,t){if(!e||!t)return!1;if(e.byteLength!==t.byteLength)return!1;const r=new Uint8Array(e),i=new Uint8Array(t);for(let t=0;tt=>{let r;ti.has(t)?r=ti.get(t):(r=ti.createDefault(t),ti.set(t,r)),Object.assign(r,e)},ii=e=>(t,r)=>{let i;ti.has(t.constructor)?i=ti.get(t.constructor):(i=ti.createDefault(t.constructor),ti.set(t.constructor,i));const n=Object.assign({},e);if("number"==typeof n.type&&!n.converter){const i=Zr(e.type);if(!i)throw new Error(`Cannot get default converter for property '${r}' of ${t.constructor.name}`);n.converter=i}n.raw=e.raw,i.items[r]=n};class ni extends Error{constructor(...e){super(...e),_defineProperty(this,"schemas",[])}}class si{static parse(e,t,r){const i=W(_t(e),null==r?void 0:r.berOptions);if(i.result.error)throw new Error(i.result.error);return this.fromASN(i.result,t,r)}static fromASN(e,t,r){try{if(Yr(t)){return(new t).fromASN(e)}const i=ti.get(t);ti.cache(t);let n=i.schema;const s=this.handleChoiceTypes(e,i,t,n,r);if(null!=s&&s.result)return s.result;null!=s&&s.targetSchema&&(n=s.targetSchema);const o=this.handleSequenceTypes(e,i,t,n),a=new t;return Qr(t)?this.handleArrayTypes(e,i,t,r):(this.processSchemaItems(i,o,a,r),a)}catch(e){throw e instanceof ni&&e.schemas.push(t.name),e}}static handleChoiceTypes(e,t,r,i,n){if(e.constructor===Q&&t.type===Ar.Choice&&3===e.idBlock.tagClass)for(const i in t.items){const s=t.items[i];if(s.context===e.idBlock.tagNumber&&s.implicit&&"function"==typeof s.type&&ti.has(s.type)){const t=ti.get(s.type);if(t&&t.type===Ar.Sequence){const t=new Ne;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in t.valueBlock){t.valueBlock.value=e.valueBlock.value;const o=this.fromASN(t,s.type,n),a=new r;return a[i]=o,{result:a}}}}}else if(e.constructor===Q&&t.type!==Ar.Choice){const r=new Q({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:t.schema.valueBlock.value});for(const r in t.items)delete e[r];return{targetSchema:r}}return null}static handleSequenceTypes(e,t,r,i){if(t.type===Ar.Sequence){const t=kt({},e,i);if(!t.verified)throw new ni(`Data does not match to ${r.name} ASN1 schema.${t.result.error?` ${t.result.error}`:""}`);return t}{const t=kt({},e,i);if(!t.verified)throw new ni(`Data does not match to ${r.name} ASN1 schema.${t.result.error?` ${t.result.error}`:""}`);return t}}static processRepeatedField(e,t,r){let i=e.slice(t);if(1===i.length&&"Sequence"===i[0].constructor.name){const e=i[0];e.valueBlock&&e.valueBlock.value&&Array.isArray(e.valueBlock.value)&&(i=e.valueBlock.value)}if("number"==typeof r.type){const e=Zr(r.type);if(!e)throw new Error(`No converter for ASN.1 type ${r.type}`);return i.filter(e=>e&&e.valueBlock).map(t=>{try{return e.fromASN(t)}catch(e){return}}).filter(e=>void 0!==e)}return i.filter(e=>e&&e.valueBlock).map(e=>{try{return this.fromASN(e,r.type)}catch(e){return}}).filter(e=>void 0!==e)}static processPrimitiveField(e,t){const r=Zr(t.type);if(!r)throw new Error(`No converter for ASN.1 type ${t.type}`);return r.fromASN(e)}static isOptionalChoiceField(e){return e.optional&&"function"==typeof e.type&&ti.has(e.type)&&ti.get(e.type).type===Ar.Choice}static processOptionalChoiceField(e,t){try{return{processed:!0,value:this.fromASN(e,t.type)}}catch(e){if(e instanceof ni&&/Wrong values for Choice type/.test(e.message))return{processed:!1};throw e}}static handleArrayTypes(e,t,r,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 n=t.itemType;if("number"==typeof n){const t=Zr(n);if(!t)throw new Error(`Cannot get default converter for array item of ${r.name} ASN1 schema`);return r.from(e.valueBlock.value,e=>t.fromASN(e))}return r.from(e.valueBlock.value,e=>this.fromASN(e,n,i))}static processSchemaItems(e,t,r,i){for(const n in e.items){const s=t.result[n];if(!s)continue;const o=e.items[n],a=o.type;let c;c="number"==typeof a||Yr(a)?this.processPrimitiveSchemaItem(s,o,a,i):this.processComplexSchemaItem(s,o,a,i),c&&"object"==typeof c&&"value"in c&&"raw"in c?(r[n]=c.value,r[`${n}Raw`]=c.raw):r[n]=c}}static processPrimitiveSchemaItem(e,t,r,i){var n;const s=null!==(n=t.converter)&&void 0!==n?n:Yr(r)?new r:null;if(!s)throw new Error("Converter is empty");return t.repeated?this.processRepeatedPrimitiveItem(e,t,s,i):this.processSinglePrimitiveItem(e,t,r,s,i)}static processRepeatedPrimitiveItem(e,t,r,i){if(t.implicit){const n=new("sequence"===t.repeated?Ne:Ie);n.valueBlock=e.valueBlock;const s=W(n.toBER(!1),null==i?void 0:i.berOptions);if(-1===s.offset)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 o=s.result.valueBlock.value;return Array.from(o,e=>r.fromASN(e))}return Array.from(e,e=>r.fromASN(e))}static processSinglePrimitiveItem(e,t,r,i,n){let s=e;if(t.implicit){let e;if(Yr(r))e=(new r).toSchema("");else{const t=Sr[r],i=Ct[t];if(!i)throw new Error(`Cannot get '${t}' class from asn1js module`);e=new i}e.valueBlock=s.valueBlock,s=W(e.toBER(!1),null==n?void 0:n.berOptions).result}return i.fromASN(s)}static processComplexSchemaItem(e,t,r,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,e=>this.fromASN(e,r,i))}{const n=this.handleImplicitTagging(e,t,r);if(!this.isOptionalChoiceField(t)){const s=this.fromASN(n,r,i);return t.raw?{value:s,raw:e.valueBeforeDecodeView}:s}try{return this.fromASN(n,r,i)}catch(e){if(e instanceof ni&&/Wrong values for Choice type/.test(e.message))return;throw e}}}static handleImplicitTagging(e,t,r){if(t.implicit&&"number"==typeof t.context){const t=ti.get(r);if(t.type===Ar.Sequence){const t=new Ne;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in t.valueBlock)return t.valueBlock.value=e.valueBlock.value,t}else if(t.type===Ar.Set){const t=new Ie;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in t.valueBlock)return t.valueBlock.value=e.valueBlock.value,t}}return e}}class oi{static serialize(e){return e instanceof L?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&"object"==typeof e&&Yr(e))return e.toASN();if(!e||"object"!=typeof e)throw new TypeError("Parameter 1 should be type of Object.");const t=e.constructor,r=ti.get(t);ti.cache(t);let i,n=[];if(r.itemType){if(!Array.isArray(e))throw new TypeError("Parameter 1 should be type of Array.");if("number"==typeof r.itemType){const i=Zr(r.itemType);if(!i)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);n=e.map(e=>i.toASN(e))}else n=e.map(e=>this.toAsnItem({type:r.itemType},"[]",t,e))}else for(const i in r.items){const s=r.items[i],o=e[i];if(void 0===o||s.defaultValue===o||"object"==typeof s.defaultValue&&"object"==typeof o&&ei(this.serialize(s.defaultValue),this.serialize(o)))continue;const a=oi.toAsnItem(s,i,t,o);if("number"==typeof s.context)if(s.implicit)if(s.repeated||"number"!=typeof s.type&&!Yr(s.type))n.push(new Q({optional:s.optional,idBlock:{tagClass:3,tagNumber:s.context},value:a.valueBlock.value}));else{const e={};e.valueHex=a instanceof re?_t(a.valueBeforeDecodeView):a.valueBlock.toBER(),n.push(new $({optional:s.optional,idBlock:{tagClass:3,tagNumber:s.context},...e}))}else n.push(new Q({optional:s.optional,idBlock:{tagClass:3,tagNumber:s.context},value:[a]}));else s.repeated?n=n.concat(a):n.push(a)}switch(r.type){case Ar.Sequence:i=new Ne({value:n});break;case Ar.Set:i=new Ie({value:n});break;case Ar.Choice:if(!n[0])throw new Error(`Schema '${t.name}' has wrong data. Choice cannot be empty.`);i=n[0]}return i}static toAsnItem(e,t,r,i){let n;if("number"==typeof e.type){const s=e.converter;if(!s)throw new Error(`Property '${t}' doesn't have converter for type ${Sr[e.type]} in schema '${r.name}'`);if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const t=Array.from(i,e=>s.toASN(e));n=new("sequence"===e.repeated?Ne:Ie)({value:t})}else n=s.toASN(i)}else if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const t=Array.from(i,e=>this.toASN(e));n=new("sequence"===e.repeated?Ne:Ie)({value:t})}else n=this.toASN(i);return n}}class ai extends Array{constructor(e=[]){if("number"==typeof e)super(e);else{super();for(const t of e)this.push(t)}}}class ci{static serialize(e){return oi.serialize(e)}static parse(e,t,r){return si.parse(e,t,r)}static toString(e,t){const r=W(It(e)?_t(e):ci.serialize(e),null==t?void 0:t.berOptions);if(-1===r.offset)throw new Error(`Cannot decode ASN.1 data. ${r.result.error}`);return r.result.toString()}}var li,ui,pi,hi=function(e,t){return hi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},hi(e,t)};function fi(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}hi(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function di(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}function yi(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((i=i.apply(e,t||[])).next())})}function gi(e,t){var r,i,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,i&&(n=2&a[0]?i.return:a[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,a[1])).done)return n;switch(i=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function mi(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o}function bi(){for(var e=[],t=0;t{const t=parseInt(e,10);if(isNaN(t)||t<0||t>255)throw new Error("Invalid IPv4 address part");return t})}static parseIPv6(e){const t=this.expandIPv6(e).split(":");if(8!==t.length)throw new Error("Invalid IPv6 address");return t.reduce((e,t)=>{const r=parseInt(t,16);if(isNaN(r)||r<0||r>65535)throw new Error("Invalid IPv6 address part");return e.push(r>>8&255),e.push(255&r),e},[])}static expandIPv6(e){if(!e.includes("::"))return e;const t=e.split("::");if(t.length>2)throw new Error("Invalid IPv6 address");const r=t[0]?t[0].split(":"):[],i=t[1]?t[1].split(":"):[],n=8-(r.length+i.length);if(n<0)throw new Error("Invalid IPv6 address");return[...r,...Array(n).fill("0"),...i].join(":")}static formatIPv6(e){const t=[];for(let r=0;r<16;r+=2)t.push((e[r]<<8|e[r+1]).toString(16));return this.compressIPv6(t.join(":"))}static compressIPv6(e){const t=e.split(":");let r=-1,i=0,n=-1,s=0;for(let e=0;ei&&(r=n,i=s),n=-1,s=0);if(s>i&&(r=n,i=s),i>1){return`${t.slice(0,r).join(":")}::${t.slice(r+i).join(":")}`}return e}static parseCIDR(e){const[t,r]=e.split("/"),i=parseInt(r,10);if(this.isIPv4(t)){if(i<0||i>32)throw new Error("Invalid IPv4 prefix length");return[this.parseIPv4(t),i]}if(i<0||i>128)throw new Error("Invalid IPv6 prefix length");return[this.parseIPv6(t),i]}static decodeIP(e){if(64===e.length&&0===parseInt(e,16))return"::/0";if(16!==e.length)return e;const t=parseInt(e.slice(8),16).toString(2).split("").reduce((e,t)=>e+ +t,0);let r=e.slice(0,8).replace(/(.{2})/g,e=>`${parseInt(e,16)}.`);return r=r.slice(0,-1),`${r}/${t}`}static toString(e){const t=new Uint8Array(e);if(4===t.length)return Array.from(t).join(".");if(16===t.length)return this.formatIPv6(t);if(8===t.length||32===t.length){const e=t.length/2,r=t.slice(0,e),i=t.slice(e);if(t.every(e=>0===e))return 8===t.length?"0.0.0.0/0":"::/0";const n=i.reduce((e,t)=>e+(t.toString(2).match(/1/g)||[]).length,0);if(8===t.length){return`${Array.from(r).join(".")}/${n}`}return`${this.formatIPv6(r)}/${n}`}return this.decodeIP(qt(e))}static fromString(e){if(e.includes("/")){const[t,r]=this.parseCIDR(e),i=new Uint8Array(t.length);let n=r;for(let e=0;e=8?(i[e]=255,n-=8):n>0&&(i[e]=255<<8-n,n=0);const s=new Uint8Array(2*t.length);return s.set(t,0),s.set(i,t.length),s.buffer}const t=this.isIPv4(e)?this.parseIPv4(e):this.parseIPv6(e);return new Uint8Array(t).buffer}}let xi=class{constructor(e={}){_defineProperty(this,"teletexString",void 0),_defineProperty(this,"printableString",void 0),_defineProperty(this,"universalString",void 0),_defineProperty(this,"utf8String",void 0),_defineProperty(this,"bmpString",void 0),Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};di([ii({type:Sr.TeletexString})],xi.prototype,"teletexString",void 0),di([ii({type:Sr.PrintableString})],xi.prototype,"printableString",void 0),di([ii({type:Sr.UniversalString})],xi.prototype,"universalString",void 0),di([ii({type:Sr.Utf8String})],xi.prototype,"utf8String",void 0),di([ii({type:Sr.BmpString})],xi.prototype,"bmpString",void 0),xi=di([ri({type:Ar.Choice})],xi);let Bi=class extends xi{constructor(e={}){super(e),_defineProperty(this,"ia5String",void 0),_defineProperty(this,"anyValue",void 0),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?qt(this.anyValue):super.toString())}};di([ii({type:Sr.IA5String})],Bi.prototype,"ia5String",void 0),di([ii({type:Sr.Any})],Bi.prototype,"anyValue",void 0),Bi=di([ri({type:Ar.Choice})],Bi);class ki{constructor(e={}){_defineProperty(this,"type",""),_defineProperty(this,"value",new Bi),Object.assign(this,e)}}di([ii({type:Sr.ObjectIdentifier})],ki.prototype,"type",void 0),di([ii({type:Bi})],ki.prototype,"value",void 0);let Ci=li=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,li.prototype)}};Ci=li=di([ri({type:Ar.Set,itemType:ki})],Ci);let Pi=ui=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,ui.prototype)}};Pi=ui=di([ri({type:Ar.Sequence,itemType:Ci})],Pi);let Ei=pi=class extends Pi{constructor(e){super(e),Object.setPrototypeOf(this,pi.prototype)}};Ei=pi=di([ri({type:Ar.Sequence})],Ei);const Oi={fromASN:e=>Si.toString(jr.fromASN(e)),toASN:e=>jr.toASN(Si.fromString(e))};class Ni{constructor(e={}){_defineProperty(this,"typeId",""),_defineProperty(this,"value",new ArrayBuffer(0)),Object.assign(this,e)}}di([ii({type:Sr.ObjectIdentifier})],Ni.prototype,"typeId",void 0),di([ii({type:Sr.Any,context:0})],Ni.prototype,"value",void 0);class Ii{constructor(e={}){_defineProperty(this,"nameAssigner",void 0),_defineProperty(this,"partyName",new xi),Object.assign(this,e)}}di([ii({type:xi,optional:!0,context:0,implicit:!0})],Ii.prototype,"nameAssigner",void 0),di([ii({type:xi,context:1,implicit:!0})],Ii.prototype,"partyName",void 0);let Ti=class{constructor(e={}){_defineProperty(this,"otherName",void 0),_defineProperty(this,"rfc822Name",void 0),_defineProperty(this,"dNSName",void 0),_defineProperty(this,"x400Address",void 0),_defineProperty(this,"directoryName",void 0),_defineProperty(this,"ediPartyName",void 0),_defineProperty(this,"uniformResourceIdentifier",void 0),_defineProperty(this,"iPAddress",void 0),_defineProperty(this,"registeredID",void 0),Object.assign(this,e)}};di([ii({type:Ni,context:0,implicit:!0})],Ti.prototype,"otherName",void 0),di([ii({type:Sr.IA5String,context:1,implicit:!0})],Ti.prototype,"rfc822Name",void 0),di([ii({type:Sr.IA5String,context:2,implicit:!0})],Ti.prototype,"dNSName",void 0),di([ii({type:Sr.Any,context:3,implicit:!0})],Ti.prototype,"x400Address",void 0),di([ii({type:Ei,context:4,implicit:!1})],Ti.prototype,"directoryName",void 0),di([ii({type:Ii,context:5})],Ti.prototype,"ediPartyName",void 0),di([ii({type:Sr.IA5String,context:6,implicit:!0})],Ti.prototype,"uniformResourceIdentifier",void 0),di([ii({type:Sr.OctetString,context:7,implicit:!0,converter:Oi})],Ti.prototype,"iPAddress",void 0),di([ii({type:Sr.ObjectIdentifier,context:8,implicit:!0})],Ti.prototype,"registeredID",void 0),Ti=di([ri({type:Ar.Choice})],Ti);const ji="1.3.6.1.5.5.7",_i=`${ji}.3`,Ui=`${ji}.48`,Li=`${Ui}.1`,Di=`${Ui}.2`,Ri=`${Ui}.3`,Vi=`${Ui}.5`,Hi="2.5.29";var $i;const Mi=`${`${ji}.1`}.1`;class Ki{constructor(e={}){_defineProperty(this,"accessMethod",""),_defineProperty(this,"accessLocation",new Ti),Object.assign(this,e)}}di([ii({type:Sr.ObjectIdentifier})],Ki.prototype,"accessMethod",void 0),di([ii({type:Ti})],Ki.prototype,"accessLocation",void 0);let Fi=$i=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,$i.prototype)}};Fi=$i=di([ri({type:Ar.Sequence,itemType:Ki})],Fi);const zi=`${Hi}.35`;class Wi extends Br{}class qi{constructor(e={}){_defineProperty(this,"keyIdentifier",void 0),_defineProperty(this,"authorityCertIssuer",void 0),_defineProperty(this,"authorityCertSerialNumber",void 0),e&&Object.assign(this,e)}}di([ii({type:Wi,context:0,optional:!0,implicit:!0})],qi.prototype,"keyIdentifier",void 0),di([ii({type:Ti,context:1,optional:!0,implicit:!0,repeated:"sequence"})],qi.prototype,"authorityCertIssuer",void 0),di([ii({type:Sr.Integer,context:2,optional:!0,implicit:!0,converter:Er})],qi.prototype,"authorityCertSerialNumber",void 0);const Gi=`${Hi}.19`;class Ji{constructor(e={}){_defineProperty(this,"cA",!1),_defineProperty(this,"pathLenConstraint",void 0),Object.assign(this,e)}}var Xi;di([ii({type:Sr.Boolean,defaultValue:!1})],Ji.prototype,"cA",void 0),di([ii({type:Sr.Integer,optional:!0})],Ji.prototype,"pathLenConstraint",void 0);let Zi=Xi=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,Xi.prototype)}};var Yi;Zi=Xi=di([ri({type:Ar.Sequence,itemType:Ti})],Zi);const Qi=`${Hi}.29`;let en=Yi=class extends Zi{constructor(e){super(e),Object.setPrototypeOf(this,Yi.prototype)}};var tn;en=Yi=di([ri({type:Ar.Sequence})],en);const rn=`${Hi}.32`;let nn=class{constructor(e={}){_defineProperty(this,"ia5String",void 0),_defineProperty(this,"visibleString",void 0),_defineProperty(this,"bmpString",void 0),_defineProperty(this,"utf8String",void 0),Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};di([ii({type:Sr.IA5String})],nn.prototype,"ia5String",void 0),di([ii({type:Sr.VisibleString})],nn.prototype,"visibleString",void 0),di([ii({type:Sr.BmpString})],nn.prototype,"bmpString",void 0),di([ii({type:Sr.Utf8String})],nn.prototype,"utf8String",void 0),nn=di([ri({type:Ar.Choice})],nn);class sn{constructor(e={}){_defineProperty(this,"organization",new nn),_defineProperty(this,"noticeNumbers",[]),Object.assign(this,e)}}di([ii({type:nn})],sn.prototype,"organization",void 0),di([ii({type:Sr.Integer,repeated:"sequence"})],sn.prototype,"noticeNumbers",void 0);class on{constructor(e={}){_defineProperty(this,"noticeRef",void 0),_defineProperty(this,"explicitText",void 0),Object.assign(this,e)}}di([ii({type:sn,optional:!0})],on.prototype,"noticeRef",void 0),di([ii({type:nn,optional:!0})],on.prototype,"explicitText",void 0);let an=class{constructor(e={}){_defineProperty(this,"cPSuri",void 0),_defineProperty(this,"userNotice",void 0),Object.assign(this,e)}};di([ii({type:Sr.IA5String})],an.prototype,"cPSuri",void 0),di([ii({type:on})],an.prototype,"userNotice",void 0),an=di([ri({type:Ar.Choice})],an);class cn{constructor(e={}){_defineProperty(this,"policyQualifierId",""),_defineProperty(this,"qualifier",new ArrayBuffer(0)),Object.assign(this,e)}}di([ii({type:Sr.ObjectIdentifier})],cn.prototype,"policyQualifierId",void 0),di([ii({type:Sr.Any})],cn.prototype,"qualifier",void 0);class ln{constructor(e={}){_defineProperty(this,"policyIdentifier",""),_defineProperty(this,"policyQualifiers",void 0),Object.assign(this,e)}}di([ii({type:Sr.ObjectIdentifier})],ln.prototype,"policyIdentifier",void 0),di([ii({type:cn,repeated:"sequence",optional:!0})],ln.prototype,"policyQualifiers",void 0);let un=tn=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,tn.prototype)}};un=tn=di([ri({type:Ar.Sequence,itemType:ln})],un);let pn=class{constructor(e=0){_defineProperty(this,"value",void 0),this.value=e}};di([ii({type:Sr.Integer})],pn.prototype,"value",void 0),pn=di([ri({type:Ar.Choice})],pn);let hn=class extends pn{};var fn;hn=di([ri({type:Ar.Choice})],hn);const dn=`${Hi}.31`;var yn;!function(e){e[e.unused=1]="unused",e[e.keyCompromise=2]="keyCompromise",e[e.cACompromise=4]="cACompromise",e[e.affiliationChanged=8]="affiliationChanged",e[e.superseded=16]="superseded",e[e.cessationOfOperation=32]="cessationOfOperation",e[e.certificateHold=64]="certificateHold",e[e.privilegeWithdrawn=128]="privilegeWithdrawn",e[e.aACompromise=256]="aACompromise"}(yn||(yn={}));class gn extends xr{toJSON(){const e=[],t=this.toNumber();return t&yn.aACompromise&&e.push("aACompromise"),t&yn.affiliationChanged&&e.push("affiliationChanged"),t&yn.cACompromise&&e.push("cACompromise"),t&yn.certificateHold&&e.push("certificateHold"),t&yn.cessationOfOperation&&e.push("cessationOfOperation"),t&yn.keyCompromise&&e.push("keyCompromise"),t&yn.privilegeWithdrawn&&e.push("privilegeWithdrawn"),t&yn.superseded&&e.push("superseded"),t&yn.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let vn=class{constructor(e={}){_defineProperty(this,"fullName",void 0),_defineProperty(this,"nameRelativeToCRLIssuer",void 0),Object.assign(this,e)}};di([ii({type:Ti,context:0,repeated:"sequence",implicit:!0})],vn.prototype,"fullName",void 0),di([ii({type:Ci,context:1,implicit:!0})],vn.prototype,"nameRelativeToCRLIssuer",void 0),vn=di([ri({type:Ar.Choice})],vn);class mn{constructor(e={}){_defineProperty(this,"distributionPoint",void 0),_defineProperty(this,"reasons",void 0),_defineProperty(this,"cRLIssuer",void 0),Object.assign(this,e)}}di([ii({type:vn,context:0,optional:!0})],mn.prototype,"distributionPoint",void 0),di([ii({type:gn,context:1,optional:!0,implicit:!0})],mn.prototype,"reasons",void 0),di([ii({type:Ti,context:2,optional:!0,repeated:"sequence",implicit:!0})],mn.prototype,"cRLIssuer",void 0);let bn=fn=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,fn.prototype)}};var wn;bn=fn=di([ri({type:Ar.Sequence,itemType:mn})],bn);let An=wn=class extends bn{constructor(e){super(e),Object.setPrototypeOf(this,wn.prototype)}};An=wn=di([ri({type:Ar.Sequence,itemType:mn})],An);class Sn{constructor(e={}){_defineProperty(this,"distributionPoint",void 0),_defineProperty(this,"onlyContainsUserCerts",Sn.ONLY),_defineProperty(this,"onlyContainsCACerts",Sn.ONLY),_defineProperty(this,"onlySomeReasons",void 0),_defineProperty(this,"indirectCRL",Sn.ONLY),_defineProperty(this,"onlyContainsAttributeCerts",Sn.ONLY),Object.assign(this,e)}}_defineProperty(Sn,"ONLY",!1),di([ii({type:vn,context:0,optional:!0})],Sn.prototype,"distributionPoint",void 0),di([ii({type:Sr.Boolean,context:1,defaultValue:Sn.ONLY,implicit:!0})],Sn.prototype,"onlyContainsUserCerts",void 0),di([ii({type:Sr.Boolean,context:2,defaultValue:Sn.ONLY,implicit:!0})],Sn.prototype,"onlyContainsCACerts",void 0),di([ii({type:gn,context:3,optional:!0,implicit:!0})],Sn.prototype,"onlySomeReasons",void 0),di([ii({type:Sr.Boolean,context:4,defaultValue:Sn.ONLY,implicit:!0})],Sn.prototype,"indirectCRL",void 0),di([ii({type:Sr.Boolean,context:5,defaultValue:Sn.ONLY,implicit:!0})],Sn.prototype,"onlyContainsAttributeCerts",void 0);const xn=`${Hi}.21`;var Bn;!function(e){e[e.unspecified=0]="unspecified",e[e.keyCompromise=1]="keyCompromise",e[e.cACompromise=2]="cACompromise",e[e.affiliationChanged=3]="affiliationChanged",e[e.superseded=4]="superseded",e[e.cessationOfOperation=5]="cessationOfOperation",e[e.certificateHold=6]="certificateHold",e[e.removeFromCRL=8]="removeFromCRL",e[e.privilegeWithdrawn=9]="privilegeWithdrawn",e[e.aACompromise=10]="aACompromise"}(Bn||(Bn={}));let kn=class{constructor(e=Bn.unspecified){_defineProperty(this,"reason",Bn.unspecified),this.reason=e}toJSON(){return Bn[this.reason]}toString(){return this.toJSON()}};var Cn;di([ii({type:Sr.Enumerated})],kn.prototype,"reason",void 0),kn=di([ri({type:Ar.Choice})],kn);const Pn=`${Hi}.37`;let En=Cn=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,Cn.prototype)}};En=Cn=di([ri({type:Ar.Sequence,itemType:Sr.ObjectIdentifier})],En);const On=`${_i}.1`,Nn=`${_i}.2`,In=`${_i}.3`,Tn=`${_i}.4`,jn=`${_i}.8`,_n=`${_i}.9`;let Un=class{constructor(e=new ArrayBuffer(0)){_defineProperty(this,"value",void 0),this.value=e}};di([ii({type:Sr.Integer,converter:Er})],Un.prototype,"value",void 0),Un=di([ri({type:Ar.Choice})],Un);const Ln=`${Hi}.24`;let Dn=class{constructor(e){_defineProperty(this,"value",new Date),e&&(this.value=e)}};var Rn;di([ii({type:Sr.GeneralizedTime})],Dn.prototype,"value",void 0),Dn=di([ri({type:Ar.Choice})],Dn);const Vn=`${Hi}.18`;let Hn=Rn=class extends Zi{constructor(e){super(e),Object.setPrototypeOf(this,Rn.prototype)}};Hn=Rn=di([ri({type:Ar.Sequence})],Hn);const $n=`${Hi}.15`;var Mn,Kn;!function(e){e[e.digitalSignature=1]="digitalSignature",e[e.nonRepudiation=2]="nonRepudiation",e[e.keyEncipherment=4]="keyEncipherment",e[e.dataEncipherment=8]="dataEncipherment",e[e.keyAgreement=16]="keyAgreement",e[e.keyCertSign=32]="keyCertSign",e[e.cRLSign=64]="cRLSign",e[e.encipherOnly=128]="encipherOnly",e[e.decipherOnly=256]="decipherOnly"}(Mn||(Mn={}));class Fn extends xr{toJSON(){const e=this.toNumber(),t=[];return e&Mn.cRLSign&&t.push("crlSign"),e&Mn.dataEncipherment&&t.push("dataEncipherment"),e&Mn.decipherOnly&&t.push("decipherOnly"),e&Mn.digitalSignature&&t.push("digitalSignature"),e&Mn.encipherOnly&&t.push("encipherOnly"),e&Mn.keyAgreement&&t.push("keyAgreement"),e&Mn.keyCertSign&&t.push("keyCertSign"),e&Mn.keyEncipherment&&t.push("keyEncipherment"),e&Mn.nonRepudiation&&t.push("nonRepudiation"),t}toString(){return`[${this.toJSON().join(", ")}]`}}class zn{constructor(e={}){_defineProperty(this,"base",new Ti),_defineProperty(this,"minimum",0),_defineProperty(this,"maximum",void 0),Object.assign(this,e)}}di([ii({type:Ti})],zn.prototype,"base",void 0),di([ii({type:Sr.Integer,context:0,defaultValue:0,implicit:!0})],zn.prototype,"minimum",void 0),di([ii({type:Sr.Integer,context:1,optional:!0,implicit:!0})],zn.prototype,"maximum",void 0);let Wn=Kn=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,Kn.prototype)}};Wn=Kn=di([ri({type:Ar.Sequence,itemType:zn})],Wn);class qn{constructor(e={}){_defineProperty(this,"permittedSubtrees",void 0),_defineProperty(this,"excludedSubtrees",void 0),Object.assign(this,e)}}di([ii({type:Wn,context:0,optional:!0,implicit:!0})],qn.prototype,"permittedSubtrees",void 0),di([ii({type:Wn,context:1,optional:!0,implicit:!0})],qn.prototype,"excludedSubtrees",void 0);class Gn{constructor(e={}){_defineProperty(this,"requireExplicitPolicy",void 0),_defineProperty(this,"inhibitPolicyMapping",void 0),Object.assign(this,e)}}var Jn;di([ii({type:Sr.Integer,context:0,implicit:!0,optional:!0,converter:Er})],Gn.prototype,"requireExplicitPolicy",void 0),di([ii({type:Sr.Integer,context:1,implicit:!0,optional:!0,converter:Er})],Gn.prototype,"inhibitPolicyMapping",void 0);class Xn{constructor(e={}){_defineProperty(this,"issuerDomainPolicy",""),_defineProperty(this,"subjectDomainPolicy",""),Object.assign(this,e)}}di([ii({type:Sr.ObjectIdentifier})],Xn.prototype,"issuerDomainPolicy",void 0),di([ii({type:Sr.ObjectIdentifier})],Xn.prototype,"subjectDomainPolicy",void 0);let Zn=Jn=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,Jn.prototype)}};var Yn;Zn=Jn=di([ri({type:Ar.Sequence,itemType:Xn})],Zn);const Qn=`${Hi}.17`;let es=Yn=class extends Zi{constructor(e){super(e),Object.setPrototypeOf(this,Yn.prototype)}};es=Yn=di([ri({type:Ar.Sequence})],es);let ts=class{constructor(e={}){_defineProperty(this,"type",""),_defineProperty(this,"values",[]),Object.assign(this,e)}};var rs;di([ii({type:Sr.ObjectIdentifier})],ts.prototype,"type",void 0),di([ii({type:Sr.Any,repeated:"set"})],ts.prototype,"values",void 0);let is=rs=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,rs.prototype)}};is=rs=di([ri({type:Ar.Sequence,itemType:ts})],is);const ns=`${Hi}.14`;class ss extends Wi{}class os{constructor(e={}){_defineProperty(this,"notBefore",void 0),_defineProperty(this,"notAfter",void 0),Object.assign(this,e)}}var as,cs;di([ii({type:Sr.GeneralizedTime,context:0,implicit:!0,optional:!0})],os.prototype,"notBefore",void 0),di([ii({type:Sr.GeneralizedTime,context:1,implicit:!0,optional:!0})],os.prototype,"notAfter",void 0),function(e){e[e.keyUpdateAllowed=1]="keyUpdateAllowed",e[e.newExtensions=2]="newExtensions",e[e.pKIXCertificate=4]="pKIXCertificate"}(as||(as={}));class ls extends xr{toJSON(){const e=[],t=this.toNumber();return t&as.pKIXCertificate&&e.push("pKIXCertificate"),t&as.newExtensions&&e.push("newExtensions"),t&as.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class us{constructor(e={}){_defineProperty(this,"entrustVers",""),_defineProperty(this,"entrustInfoFlags",new ls),Object.assign(this,e)}}di([ii({type:Sr.GeneralString})],us.prototype,"entrustVers",void 0),di([ii({type:ls})],us.prototype,"entrustInfoFlags",void 0);let ps=cs=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,cs.prototype)}};ps=cs=di([ri({type:Ar.Sequence,itemType:Ki})],ps);class hs{constructor(e={}){_defineProperty(this,"algorithm",""),_defineProperty(this,"parameters",void 0),Object.assign(this,e)}isEqual(e){return e instanceof hs&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&function(e,t,r={}){const i=jt(e),n=jt(t);if(!r.constantTime&&i.byteLength!==n.byteLength)return!1;const s=Math.max(i.byteLength,n.byteLength);let o=i.byteLength^n.byteLength;for(let e=0;e2049?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}};di([ii({type:Sr.UTCTime})],ds.prototype,"utcTime",void 0),di([ii({type:Sr.GeneralizedTime})],ds.prototype,"generalTime",void 0),ds=di([ri({type:Ar.Choice})],ds);class ys{constructor(e){_defineProperty(this,"notBefore",new ds(new Date)),_defineProperty(this,"notAfter",new ds(new Date)),e&&(this.notBefore=new ds(e.notBefore),this.notAfter=new ds(e.notAfter))}}var gs;di([ii({type:ds})],ys.prototype,"notBefore",void 0),di([ii({type:ds})],ys.prototype,"notAfter",void 0);let vs=(t=class e{constructor(t={}){_defineProperty(this,"extnID",""),_defineProperty(this,"critical",e.CRITICAL),_defineProperty(this,"extnValue",new Br),Object.assign(this,t)}},_defineProperty(t,"CRITICAL",!1),t);di([ii({type:Sr.ObjectIdentifier})],vs.prototype,"extnID",void 0),di([ii({type:Sr.Boolean,defaultValue:vs.CRITICAL})],vs.prototype,"critical",void 0),di([ii({type:Br})],vs.prototype,"extnValue",void 0);let ms=gs=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,gs.prototype)}};var bs;ms=gs=di([ri({type:Ar.Sequence,itemType:vs})],ms),function(e){e[e.v1=0]="v1",e[e.v2=1]="v2",e[e.v3=2]="v3"}(bs||(bs={}));class ws{constructor(e={}){_defineProperty(this,"version",bs.v1),_defineProperty(this,"serialNumber",new ArrayBuffer(0)),_defineProperty(this,"signature",new hs),_defineProperty(this,"issuer",new Ei),_defineProperty(this,"validity",new ys),_defineProperty(this,"subject",new Ei),_defineProperty(this,"subjectPublicKeyInfo",new fs),_defineProperty(this,"issuerUniqueID",void 0),_defineProperty(this,"subjectUniqueID",void 0),_defineProperty(this,"extensions",void 0),Object.assign(this,e)}}di([ii({type:Sr.Integer,context:0,defaultValue:bs.v1})],ws.prototype,"version",void 0),di([ii({type:Sr.Integer,converter:Er})],ws.prototype,"serialNumber",void 0),di([ii({type:hs})],ws.prototype,"signature",void 0),di([ii({type:Ei})],ws.prototype,"issuer",void 0),di([ii({type:ys})],ws.prototype,"validity",void 0),di([ii({type:Ei})],ws.prototype,"subject",void 0),di([ii({type:fs})],ws.prototype,"subjectPublicKeyInfo",void 0),di([ii({type:Sr.BitString,context:1,implicit:!0,optional:!0})],ws.prototype,"issuerUniqueID",void 0),di([ii({type:Sr.BitString,context:2,implicit:!0,optional:!0})],ws.prototype,"subjectUniqueID",void 0),di([ii({type:ms,context:3,optional:!0})],ws.prototype,"extensions",void 0);class As{constructor(e={}){_defineProperty(this,"tbsCertificate",new ws),_defineProperty(this,"tbsCertificateRaw",void 0),_defineProperty(this,"signatureAlgorithm",new hs),_defineProperty(this,"signatureValue",new ArrayBuffer(0)),Object.assign(this,e)}}di([ii({type:ws,raw:!0})],As.prototype,"tbsCertificate",void 0),di([ii({type:hs})],As.prototype,"signatureAlgorithm",void 0),di([ii({type:Sr.BitString})],As.prototype,"signatureValue",void 0);class Ss{constructor(e={}){_defineProperty(this,"userCertificate",new ArrayBuffer(0)),_defineProperty(this,"revocationDate",new ds),_defineProperty(this,"crlEntryExtensions",void 0),Object.assign(this,e)}}di([ii({type:Sr.Integer,converter:Er})],Ss.prototype,"userCertificate",void 0),di([ii({type:ds})],Ss.prototype,"revocationDate",void 0),di([ii({type:vs,optional:!0,repeated:"sequence"})],Ss.prototype,"crlEntryExtensions",void 0);class xs{constructor(e={}){_defineProperty(this,"version",void 0),_defineProperty(this,"signature",new hs),_defineProperty(this,"issuer",new Ei),_defineProperty(this,"thisUpdate",new ds),_defineProperty(this,"nextUpdate",void 0),_defineProperty(this,"revokedCertificates",void 0),_defineProperty(this,"crlExtensions",void 0),Object.assign(this,e)}}di([ii({type:Sr.Integer,optional:!0})],xs.prototype,"version",void 0),di([ii({type:hs})],xs.prototype,"signature",void 0),di([ii({type:Ei})],xs.prototype,"issuer",void 0),di([ii({type:ds})],xs.prototype,"thisUpdate",void 0),di([ii({type:ds,optional:!0})],xs.prototype,"nextUpdate",void 0),di([ii({type:Ss,repeated:"sequence",optional:!0})],xs.prototype,"revokedCertificates",void 0),di([ii({type:vs,optional:!0,context:0,repeated:"sequence"})],xs.prototype,"crlExtensions",void 0);class Bs{constructor(e={}){_defineProperty(this,"tbsCertList",new xs),_defineProperty(this,"tbsCertListRaw",void 0),_defineProperty(this,"signatureAlgorithm",new hs),_defineProperty(this,"signature",new ArrayBuffer(0)),Object.assign(this,e)}}di([ii({type:xs,raw:!0})],Bs.prototype,"tbsCertList",void 0),di([ii({type:hs})],Bs.prototype,"signatureAlgorithm",void 0),di([ii({type:Sr.BitString})],Bs.prototype,"signature",void 0);class ks{constructor(e={}){_defineProperty(this,"issuer",new Ei),_defineProperty(this,"serialNumber",new ArrayBuffer(0)),Object.assign(this,e)}}di([ii({type:Ei})],ks.prototype,"issuer",void 0),di([ii({type:Sr.Integer,converter:Er})],ks.prototype,"serialNumber",void 0);let Cs=class{constructor(e={}){_defineProperty(this,"subjectKeyIdentifier",void 0),_defineProperty(this,"issuerAndSerialNumber",void 0),Object.assign(this,e)}};var Ps;di([ii({type:ss,context:0,implicit:!0})],Cs.prototype,"subjectKeyIdentifier",void 0),di([ii({type:ks})],Cs.prototype,"issuerAndSerialNumber",void 0),Cs=di([ri({type:Ar.Choice})],Cs),function(e){e[e.v0=0]="v0",e[e.v1=1]="v1",e[e.v2=2]="v2",e[e.v3=3]="v3",e[e.v4=4]="v4",e[e.v5=5]="v5"}(Ps||(Ps={}));let Es=class extends hs{};Es=di([ri({type:Ar.Sequence})],Es);let Os=class extends hs{};Os=di([ri({type:Ar.Sequence})],Os);let Ns=class extends hs{};Ns=di([ri({type:Ar.Sequence})],Ns);let Is=class extends hs{};Is=di([ri({type:Ar.Sequence})],Is);let Ts=class extends hs{};Ts=di([ri({type:Ar.Sequence})],Ts);let js=class extends hs{};js=di([ri({type:Ar.Sequence})],js);let _s=class{constructor(e={}){_defineProperty(this,"attrType",""),_defineProperty(this,"attrValues",[]),Object.assign(this,e)}};var Us;di([ii({type:Sr.ObjectIdentifier})],_s.prototype,"attrType",void 0),di([ii({type:Sr.Any,repeated:"set"})],_s.prototype,"attrValues",void 0);class Ls{constructor(e={}){_defineProperty(this,"version",Ps.v0),_defineProperty(this,"sid",new Cs),_defineProperty(this,"digestAlgorithm",new Es),_defineProperty(this,"signedAttrs",void 0),_defineProperty(this,"signedAttrsRaw",void 0),_defineProperty(this,"signatureAlgorithm",new Os),_defineProperty(this,"signature",new Br),_defineProperty(this,"unsignedAttrs",void 0),Object.assign(this,e)}}di([ii({type:Sr.Integer})],Ls.prototype,"version",void 0),di([ii({type:Cs})],Ls.prototype,"sid",void 0),di([ii({type:Es})],Ls.prototype,"digestAlgorithm",void 0),di([ii({type:_s,repeated:"set",context:0,implicit:!0,optional:!0,raw:!0})],Ls.prototype,"signedAttrs",void 0),di([ii({type:Os})],Ls.prototype,"signatureAlgorithm",void 0),di([ii({type:Br})],Ls.prototype,"signature",void 0),di([ii({type:_s,repeated:"set",context:1,implicit:!0,optional:!0})],Ls.prototype,"unsignedAttrs",void 0);let Ds=Us=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,Us.prototype)}};Ds=Us=di([ri({type:Ar.Set,itemType:Ls})],Ds);let Rs=class extends Ls{};Rs=di([ri({type:Ar.Sequence})],Rs);let Vs=class extends ds{};Vs=di([ri({type:Ar.Choice})],Vs);class Hs{constructor(e={}){_defineProperty(this,"acIssuer",new Ti),_defineProperty(this,"acSerial",0),_defineProperty(this,"attrs",[]),Object.assign(this,e)}}var $s;di([ii({type:Ti})],Hs.prototype,"acIssuer",void 0),di([ii({type:Sr.Integer})],Hs.prototype,"acSerial",void 0),di([ii({type:ts,repeated:"sequence"})],Hs.prototype,"attrs",void 0);let Ms=$s=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,$s.prototype)}};Ms=$s=di([ri({type:Ar.Sequence,itemType:Sr.ObjectIdentifier})],Ms);class Ks{constructor(e={}){_defineProperty(this,"pathLenConstraint",void 0),_defineProperty(this,"permittedAttrs",void 0),_defineProperty(this,"excludedAttrs",void 0),_defineProperty(this,"permitUnSpecified",!0),Object.assign(this,e)}}di([ii({type:Sr.Integer,optional:!0})],Ks.prototype,"pathLenConstraint",void 0),di([ii({type:Ms,implicit:!0,context:0,optional:!0})],Ks.prototype,"permittedAttrs",void 0),di([ii({type:Ms,implicit:!0,context:1,optional:!0})],Ks.prototype,"excludedAttrs",void 0),di([ii({type:Sr.Boolean,defaultValue:!0})],Ks.prototype,"permitUnSpecified",void 0);class Fs{constructor(e={}){_defineProperty(this,"issuer",new Zi),_defineProperty(this,"serial",new ArrayBuffer(0)),_defineProperty(this,"issuerUID",new ArrayBuffer(0)),Object.assign(this,e)}}var zs;di([ii({type:Zi})],Fs.prototype,"issuer",void 0),di([ii({type:Sr.Integer,converter:Er})],Fs.prototype,"serial",void 0),di([ii({type:Sr.BitString,optional:!0})],Fs.prototype,"issuerUID",void 0),function(e){e[e.publicKey=0]="publicKey",e[e.publicKeyCert=1]="publicKeyCert",e[e.otherObjectTypes=2]="otherObjectTypes"}(zs||(zs={}));class Ws{constructor(e={}){_defineProperty(this,"digestedObjectType",zs.publicKey),_defineProperty(this,"otherObjectTypeID",void 0),_defineProperty(this,"digestAlgorithm",new hs),_defineProperty(this,"objectDigest",new ArrayBuffer(0)),Object.assign(this,e)}}di([ii({type:Sr.Enumerated})],Ws.prototype,"digestedObjectType",void 0),di([ii({type:Sr.ObjectIdentifier,optional:!0})],Ws.prototype,"otherObjectTypeID",void 0),di([ii({type:hs})],Ws.prototype,"digestAlgorithm",void 0),di([ii({type:Sr.BitString})],Ws.prototype,"objectDigest",void 0);class qs{constructor(e={}){_defineProperty(this,"issuerName",void 0),_defineProperty(this,"baseCertificateID",void 0),_defineProperty(this,"objectDigestInfo",void 0),Object.assign(this,e)}}di([ii({type:Zi,optional:!0})],qs.prototype,"issuerName",void 0),di([ii({type:Fs,context:0,implicit:!0,optional:!0})],qs.prototype,"baseCertificateID",void 0),di([ii({type:Ws,context:1,implicit:!0,optional:!0})],qs.prototype,"objectDigestInfo",void 0);let Gs=class{constructor(e={}){_defineProperty(this,"v1Form",void 0),_defineProperty(this,"v2Form",void 0),Object.assign(this,e)}};di([ii({type:Ti,repeated:"sequence"})],Gs.prototype,"v1Form",void 0),di([ii({type:qs,context:0,implicit:!0})],Gs.prototype,"v2Form",void 0),Gs=di([ri({type:Ar.Choice})],Gs);class Js{constructor(e={}){_defineProperty(this,"notBeforeTime",new Date),_defineProperty(this,"notAfterTime",new Date),Object.assign(this,e)}}di([ii({type:Sr.GeneralizedTime})],Js.prototype,"notBeforeTime",void 0),di([ii({type:Sr.GeneralizedTime})],Js.prototype,"notAfterTime",void 0);class Xs{constructor(e={}){_defineProperty(this,"baseCertificateID",void 0),_defineProperty(this,"entityName",void 0),_defineProperty(this,"objectDigestInfo",void 0),Object.assign(this,e)}}var Zs,Ys,Qs;di([ii({type:Fs,implicit:!0,context:0,optional:!0})],Xs.prototype,"baseCertificateID",void 0),di([ii({type:Zi,implicit:!0,context:1,optional:!0})],Xs.prototype,"entityName",void 0),di([ii({type:Ws,implicit:!0,context:2,optional:!0})],Xs.prototype,"objectDigestInfo",void 0),function(e){e[e.v2=1]="v2"}(Zs||(Zs={}));class eo{constructor(e={}){_defineProperty(this,"version",Zs.v2),_defineProperty(this,"holder",new Xs),_defineProperty(this,"issuer",new Gs),_defineProperty(this,"signature",new hs),_defineProperty(this,"serialNumber",new ArrayBuffer(0)),_defineProperty(this,"attrCertValidityPeriod",new Js),_defineProperty(this,"attributes",[]),_defineProperty(this,"issuerUniqueID",void 0),_defineProperty(this,"extensions",void 0),Object.assign(this,e)}}di([ii({type:Sr.Integer})],eo.prototype,"version",void 0),di([ii({type:Xs})],eo.prototype,"holder",void 0),di([ii({type:Gs})],eo.prototype,"issuer",void 0),di([ii({type:hs})],eo.prototype,"signature",void 0),di([ii({type:Sr.Integer,converter:Er})],eo.prototype,"serialNumber",void 0),di([ii({type:Js})],eo.prototype,"attrCertValidityPeriod",void 0),di([ii({type:ts,repeated:"sequence"})],eo.prototype,"attributes",void 0),di([ii({type:Sr.BitString,optional:!0})],eo.prototype,"issuerUniqueID",void 0),di([ii({type:ms,optional:!0})],eo.prototype,"extensions",void 0);class to{constructor(e={}){_defineProperty(this,"acinfo",new eo),_defineProperty(this,"signatureAlgorithm",new hs),_defineProperty(this,"signatureValue",new ArrayBuffer(0)),Object.assign(this,e)}}di([ii({type:eo})],to.prototype,"acinfo",void 0),di([ii({type:hs})],to.prototype,"signatureAlgorithm",void 0),di([ii({type:Sr.BitString})],to.prototype,"signatureValue",void 0),function(e){e[e.unmarked=1]="unmarked",e[e.unclassified=2]="unclassified",e[e.restricted=4]="restricted",e[e.confidential=8]="confidential",e[e.secret=16]="secret",e[e.topSecret=32]="topSecret"}(Ys||(Ys={}));class ro extends xr{}class io{constructor(e={}){_defineProperty(this,"type",""),_defineProperty(this,"value",new ArrayBuffer(0)),Object.assign(this,e)}}di([ii({type:Sr.ObjectIdentifier,implicit:!0,context:0})],io.prototype,"type",void 0),di([ii({type:Sr.Any,implicit:!0,context:1})],io.prototype,"value",void 0);class no{constructor(e={}){_defineProperty(this,"policyId",""),_defineProperty(this,"classList",new ro(Ys.unclassified)),_defineProperty(this,"securityCategories",void 0),Object.assign(this,e)}}di([ii({type:Sr.ObjectIdentifier})],no.prototype,"policyId",void 0),di([ii({type:ro,defaultValue:new ro(Ys.unclassified)})],no.prototype,"classList",void 0),di([ii({type:io,repeated:"set"})],no.prototype,"securityCategories",void 0);class so{constructor(e={}){_defineProperty(this,"cotets",void 0),_defineProperty(this,"oid",void 0),_defineProperty(this,"string",void 0),Object.assign(this,e)}}di([ii({type:Br})],so.prototype,"cotets",void 0),di([ii({type:Sr.ObjectIdentifier})],so.prototype,"oid",void 0),di([ii({type:Sr.Utf8String})],so.prototype,"string",void 0);class oo{constructor(e={}){_defineProperty(this,"policyAuthority",void 0),_defineProperty(this,"values",[]),Object.assign(this,e)}}di([ii({type:Zi,implicit:!0,context:0,optional:!0})],oo.prototype,"policyAuthority",void 0),di([ii({type:so,repeated:"sequence"})],oo.prototype,"values",void 0);class ao{constructor(e={}){_defineProperty(this,"targetCertificate",new Fs),_defineProperty(this,"targetName",void 0),_defineProperty(this,"certDigestInfo",void 0),Object.assign(this,e)}}di([ii({type:Fs})],ao.prototype,"targetCertificate",void 0),di([ii({type:Ti,optional:!0})],ao.prototype,"targetName",void 0),di([ii({type:Ws,optional:!0})],ao.prototype,"certDigestInfo",void 0);let co=class{constructor(e={}){_defineProperty(this,"targetName",void 0),_defineProperty(this,"targetGroup",void 0),_defineProperty(this,"targetCert",void 0),Object.assign(this,e)}};di([ii({type:Ti,context:0,implicit:!0})],co.prototype,"targetName",void 0),di([ii({type:Ti,context:1,implicit:!0})],co.prototype,"targetGroup",void 0),di([ii({type:ao,context:2,implicit:!0})],co.prototype,"targetCert",void 0),co=di([ri({type:Ar.Choice})],co);let lo=Qs=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,Qs.prototype)}};var uo;lo=Qs=di([ri({type:Ar.Sequence,itemType:co})],lo);let po=uo=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,uo.prototype)}};po=uo=di([ri({type:Ar.Sequence,itemType:lo})],po);class ho{constructor(e={}){_defineProperty(this,"roleAuthority",void 0),_defineProperty(this,"roleName",void 0),Object.assign(this,e)}}di([ii({type:Zi,implicit:!0,context:0,optional:!0})],ho.prototype,"roleAuthority",void 0),di([ii({type:Ti,implicit:!0,context:1})],ho.prototype,"roleName",void 0);class fo{constructor(e={}){_defineProperty(this,"service",new Ti),_defineProperty(this,"ident",new Ti),_defineProperty(this,"authInfo",void 0),Object.assign(this,e)}}var yo;di([ii({type:Ti})],fo.prototype,"service",void 0),di([ii({type:Ti})],fo.prototype,"ident",void 0),di([ii({type:Br,optional:!0})],fo.prototype,"authInfo",void 0);class go{constructor(e={}){_defineProperty(this,"otherCertFormat",""),_defineProperty(this,"otherCert",new ArrayBuffer(0)),Object.assign(this,e)}}di([ii({type:Sr.ObjectIdentifier})],go.prototype,"otherCertFormat",void 0),di([ii({type:Sr.Any})],go.prototype,"otherCert",void 0);let vo=class{constructor(e={}){_defineProperty(this,"certificate",void 0),_defineProperty(this,"v2AttrCert",void 0),_defineProperty(this,"other",void 0),Object.assign(this,e)}};di([ii({type:As})],vo.prototype,"certificate",void 0),di([ii({type:to,context:2,implicit:!0})],vo.prototype,"v2AttrCert",void 0),di([ii({type:go,context:3,implicit:!0})],vo.prototype,"other",void 0),vo=di([ri({type:Ar.Choice})],vo);let mo=yo=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,yo.prototype)}};mo=yo=di([ri({type:Ar.Set,itemType:vo})],mo);class bo{constructor(e={}){_defineProperty(this,"contentType",""),_defineProperty(this,"content",new ArrayBuffer(0)),Object.assign(this,e)}}di([ii({type:Sr.ObjectIdentifier})],bo.prototype,"contentType",void 0),di([ii({type:Sr.Any,context:0})],bo.prototype,"content",void 0);let wo=class{constructor(e={}){_defineProperty(this,"single",void 0),_defineProperty(this,"any",void 0),Object.assign(this,e)}};di([ii({type:Br})],wo.prototype,"single",void 0),di([ii({type:Sr.Any})],wo.prototype,"any",void 0),wo=di([ri({type:Ar.Choice})],wo);class Ao{constructor(e={}){_defineProperty(this,"eContentType",""),_defineProperty(this,"eContent",void 0),Object.assign(this,e)}}di([ii({type:Sr.ObjectIdentifier})],Ao.prototype,"eContentType",void 0),di([ii({type:wo,context:0,optional:!0})],Ao.prototype,"eContent",void 0);let So=class{constructor(e={}){_defineProperty(this,"value",void 0),_defineProperty(this,"constructedValue",void 0),Object.assign(this,e)}};di([ii({type:Br,context:0,implicit:!0,optional:!0})],So.prototype,"value",void 0),di([ii({type:Br,converter:_r,context:0,implicit:!0,optional:!0,repeated:"sequence"})],So.prototype,"constructedValue",void 0),So=di([ri({type:Ar.Choice})],So);class xo{constructor(e={}){_defineProperty(this,"contentType",""),_defineProperty(this,"contentEncryptionAlgorithm",new Is),_defineProperty(this,"encryptedContent",void 0),Object.assign(this,e)}}di([ii({type:Sr.ObjectIdentifier})],xo.prototype,"contentType",void 0),di([ii({type:Is})],xo.prototype,"contentEncryptionAlgorithm",void 0),di([ii({type:So,optional:!0})],xo.prototype,"encryptedContent",void 0);class Bo{constructor(e={}){_defineProperty(this,"keyAttrId",""),_defineProperty(this,"keyAttr",void 0),Object.assign(this,e)}}var ko;di([ii({type:Sr.ObjectIdentifier})],Bo.prototype,"keyAttrId",void 0),di([ii({type:Sr.Any,optional:!0})],Bo.prototype,"keyAttr",void 0);class Co{constructor(e={}){_defineProperty(this,"subjectKeyIdentifier",new ss),_defineProperty(this,"date",void 0),_defineProperty(this,"other",void 0),Object.assign(this,e)}}di([ii({type:ss})],Co.prototype,"subjectKeyIdentifier",void 0),di([ii({type:Sr.GeneralizedTime,optional:!0})],Co.prototype,"date",void 0),di([ii({type:Bo,optional:!0})],Co.prototype,"other",void 0);let Po=class{constructor(e={}){_defineProperty(this,"rKeyId",void 0),_defineProperty(this,"issuerAndSerialNumber",void 0),Object.assign(this,e)}};di([ii({type:Co,context:0,implicit:!0,optional:!0})],Po.prototype,"rKeyId",void 0),di([ii({type:ks,optional:!0})],Po.prototype,"issuerAndSerialNumber",void 0),Po=di([ri({type:Ar.Choice})],Po);class Eo{constructor(e={}){_defineProperty(this,"rid",new Po),_defineProperty(this,"encryptedKey",new Br),Object.assign(this,e)}}di([ii({type:Po})],Eo.prototype,"rid",void 0),di([ii({type:Br})],Eo.prototype,"encryptedKey",void 0);let Oo=ko=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,ko.prototype)}};Oo=ko=di([ri({type:Ar.Sequence,itemType:Eo})],Oo);class No{constructor(e={}){_defineProperty(this,"algorithm",new hs),_defineProperty(this,"publicKey",new ArrayBuffer(0)),Object.assign(this,e)}}di([ii({type:hs})],No.prototype,"algorithm",void 0),di([ii({type:Sr.BitString})],No.prototype,"publicKey",void 0);let Io=class{constructor(e={}){_defineProperty(this,"subjectKeyIdentifier",void 0),_defineProperty(this,"originatorKey",void 0),_defineProperty(this,"issuerAndSerialNumber",void 0),Object.assign(this,e)}};di([ii({type:ss,context:0,implicit:!0,optional:!0})],Io.prototype,"subjectKeyIdentifier",void 0),di([ii({type:No,context:1,implicit:!0,optional:!0})],Io.prototype,"originatorKey",void 0),di([ii({type:ks,optional:!0})],Io.prototype,"issuerAndSerialNumber",void 0),Io=di([ri({type:Ar.Choice})],Io);class To{constructor(e={}){_defineProperty(this,"version",Ps.v3),_defineProperty(this,"originator",new Io),_defineProperty(this,"ukm",void 0),_defineProperty(this,"keyEncryptionAlgorithm",new Ns),_defineProperty(this,"recipientEncryptedKeys",new Oo),Object.assign(this,e)}}di([ii({type:Sr.Integer})],To.prototype,"version",void 0),di([ii({type:Io,context:0})],To.prototype,"originator",void 0),di([ii({type:Br,context:1,optional:!0})],To.prototype,"ukm",void 0),di([ii({type:Ns})],To.prototype,"keyEncryptionAlgorithm",void 0),di([ii({type:Oo})],To.prototype,"recipientEncryptedKeys",void 0);let jo=class{constructor(e={}){_defineProperty(this,"subjectKeyIdentifier",void 0),_defineProperty(this,"issuerAndSerialNumber",void 0),Object.assign(this,e)}};di([ii({type:ss,context:0,implicit:!0})],jo.prototype,"subjectKeyIdentifier",void 0),di([ii({type:ks})],jo.prototype,"issuerAndSerialNumber",void 0),jo=di([ri({type:Ar.Choice})],jo);class _o{constructor(e={}){_defineProperty(this,"version",Ps.v0),_defineProperty(this,"rid",new jo),_defineProperty(this,"keyEncryptionAlgorithm",new Ns),_defineProperty(this,"encryptedKey",new Br),Object.assign(this,e)}}di([ii({type:Sr.Integer})],_o.prototype,"version",void 0),di([ii({type:jo})],_o.prototype,"rid",void 0),di([ii({type:Ns})],_o.prototype,"keyEncryptionAlgorithm",void 0),di([ii({type:Br})],_o.prototype,"encryptedKey",void 0);class Uo{constructor(e={}){_defineProperty(this,"keyIdentifier",new Br),_defineProperty(this,"date",void 0),_defineProperty(this,"other",void 0),Object.assign(this,e)}}di([ii({type:Br})],Uo.prototype,"keyIdentifier",void 0),di([ii({type:Sr.GeneralizedTime,optional:!0})],Uo.prototype,"date",void 0),di([ii({type:Bo,optional:!0})],Uo.prototype,"other",void 0);class Lo{constructor(e={}){_defineProperty(this,"version",Ps.v4),_defineProperty(this,"kekid",new Uo),_defineProperty(this,"keyEncryptionAlgorithm",new Ns),_defineProperty(this,"encryptedKey",new Br),Object.assign(this,e)}}di([ii({type:Sr.Integer})],Lo.prototype,"version",void 0),di([ii({type:Uo})],Lo.prototype,"kekid",void 0),di([ii({type:Ns})],Lo.prototype,"keyEncryptionAlgorithm",void 0),di([ii({type:Br})],Lo.prototype,"encryptedKey",void 0);class Do{constructor(e={}){_defineProperty(this,"version",Ps.v0),_defineProperty(this,"keyDerivationAlgorithm",void 0),_defineProperty(this,"keyEncryptionAlgorithm",new Ns),_defineProperty(this,"encryptedKey",new Br),Object.assign(this,e)}}di([ii({type:Sr.Integer})],Do.prototype,"version",void 0),di([ii({type:js,context:0,optional:!0})],Do.prototype,"keyDerivationAlgorithm",void 0),di([ii({type:Ns})],Do.prototype,"keyEncryptionAlgorithm",void 0),di([ii({type:Br})],Do.prototype,"encryptedKey",void 0);class Ro{constructor(e={}){_defineProperty(this,"oriType",""),_defineProperty(this,"oriValue",new ArrayBuffer(0)),Object.assign(this,e)}}di([ii({type:Sr.ObjectIdentifier})],Ro.prototype,"oriType",void 0),di([ii({type:Sr.Any})],Ro.prototype,"oriValue",void 0);let Vo=class{constructor(e={}){_defineProperty(this,"ktri",void 0),_defineProperty(this,"kari",void 0),_defineProperty(this,"kekri",void 0),_defineProperty(this,"pwri",void 0),_defineProperty(this,"ori",void 0),Object.assign(this,e)}};var Ho;di([ii({type:_o,optional:!0})],Vo.prototype,"ktri",void 0),di([ii({type:To,context:1,implicit:!0,optional:!0})],Vo.prototype,"kari",void 0),di([ii({type:Lo,context:2,implicit:!0,optional:!0})],Vo.prototype,"kekri",void 0),di([ii({type:Do,context:3,implicit:!0,optional:!0})],Vo.prototype,"pwri",void 0),di([ii({type:Ro,context:4,implicit:!0,optional:!0})],Vo.prototype,"ori",void 0),Vo=di([ri({type:Ar.Choice})],Vo);let $o=Ho=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,Ho.prototype)}};var Mo;$o=Ho=di([ri({type:Ar.Set,itemType:Vo})],$o);class Ko{constructor(e={}){_defineProperty(this,"otherRevInfoFormat",""),_defineProperty(this,"otherRevInfo",new ArrayBuffer(0)),Object.assign(this,e)}}di([ii({type:Sr.ObjectIdentifier})],Ko.prototype,"otherRevInfoFormat",void 0),di([ii({type:Sr.Any})],Ko.prototype,"otherRevInfo",void 0);let Fo=class{constructor(e={}){_defineProperty(this,"other",new Ko),Object.assign(this,e)}};di([ii({type:Ko,context:1,implicit:!0})],Fo.prototype,"other",void 0),Fo=di([ri({type:Ar.Choice})],Fo);let zo=Mo=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,Mo.prototype)}};zo=Mo=di([ri({type:Ar.Set,itemType:Fo})],zo);class Wo{constructor(e={}){_defineProperty(this,"certs",void 0),_defineProperty(this,"crls",void 0),Object.assign(this,e)}}var qo;di([ii({type:mo,context:0,implicit:!0,optional:!0})],Wo.prototype,"certs",void 0),di([ii({type:zo,context:1,implicit:!0,optional:!0})],Wo.prototype,"crls",void 0);let Go=qo=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,qo.prototype)}};Go=qo=di([ri({type:Ar.Set,itemType:_s})],Go);class Jo{constructor(e={}){_defineProperty(this,"version",Ps.v0),_defineProperty(this,"originatorInfo",void 0),_defineProperty(this,"recipientInfos",new $o),_defineProperty(this,"encryptedContentInfo",new xo),_defineProperty(this,"unprotectedAttrs",void 0),Object.assign(this,e)}}di([ii({type:Sr.Integer})],Jo.prototype,"version",void 0),di([ii({type:Wo,context:0,implicit:!0,optional:!0})],Jo.prototype,"originatorInfo",void 0),di([ii({type:$o})],Jo.prototype,"recipientInfos",void 0),di([ii({type:xo})],Jo.prototype,"encryptedContentInfo",void 0),di([ii({type:Go,context:1,implicit:!0,optional:!0})],Jo.prototype,"unprotectedAttrs",void 0);const Xo="1.2.840.113549.1.7.2";var Zo;let Yo=Zo=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,Zo.prototype)}};Yo=Zo=di([ri({type:Ar.Set,itemType:Es})],Yo);class Qo{constructor(e={}){_defineProperty(this,"version",Ps.v0),_defineProperty(this,"digestAlgorithms",new Yo),_defineProperty(this,"encapContentInfo",new Ao),_defineProperty(this,"certificates",void 0),_defineProperty(this,"crls",void 0),_defineProperty(this,"signerInfos",new Ds),Object.assign(this,e)}}di([ii({type:Sr.Integer})],Qo.prototype,"version",void 0),di([ii({type:Yo})],Qo.prototype,"digestAlgorithms",void 0),di([ii({type:Ao})],Qo.prototype,"encapContentInfo",void 0),di([ii({type:mo,context:0,implicit:!0,optional:!0})],Qo.prototype,"certificates",void 0),di([ii({type:zo,context:1,implicit:!0,optional:!0})],Qo.prototype,"crls",void 0),di([ii({type:Ds})],Qo.prototype,"signerInfos",void 0);const ea="1.2.840.10045.2.1",ta="1.2.840.10045.4.1",ra="1.2.840.10045.4.3.1",ia="1.2.840.10045.4.3.2",na="1.2.840.10045.4.3.3",sa="1.2.840.10045.4.3.4",oa="1.2.840.10045.3.1.7",aa="1.3.132.0.34",ca="1.3.132.0.35";function la(e){return new hs({algorithm:e})}const ua=la(ta);la(ra);const pa=la(ia),ha=la(na),fa=la(sa);let da=class{constructor(e={}){_defineProperty(this,"fieldType",void 0),_defineProperty(this,"parameters",void 0),Object.assign(this,e)}};di([ii({type:Sr.ObjectIdentifier})],da.prototype,"fieldType",void 0),di([ii({type:Sr.Any})],da.prototype,"parameters",void 0),da=di([ri({type:Ar.Sequence})],da);let ya=class{constructor(e={}){_defineProperty(this,"a",void 0),_defineProperty(this,"b",void 0),_defineProperty(this,"seed",void 0),Object.assign(this,e)}};var ga;di([ii({type:Sr.OctetString})],ya.prototype,"a",void 0),di([ii({type:Sr.OctetString})],ya.prototype,"b",void 0),di([ii({type:Sr.BitString,optional:!0})],ya.prototype,"seed",void 0),ya=di([ri({type:Ar.Sequence})],ya),function(e){e[e.ecpVer1=1]="ecpVer1"}(ga||(ga={}));let va=class{constructor(e={}){_defineProperty(this,"version",ga.ecpVer1),_defineProperty(this,"fieldID",void 0),_defineProperty(this,"curve",void 0),_defineProperty(this,"base",void 0),_defineProperty(this,"order",void 0),_defineProperty(this,"cofactor",void 0),Object.assign(this,e)}};di([ii({type:Sr.Integer})],va.prototype,"version",void 0),di([ii({type:da})],va.prototype,"fieldID",void 0),di([ii({type:ya})],va.prototype,"curve",void 0),di([ii({type:class extends Br{}})],va.prototype,"base",void 0),di([ii({type:Sr.Integer,converter:Er})],va.prototype,"order",void 0),di([ii({type:Sr.Integer,optional:!0})],va.prototype,"cofactor",void 0),va=di([ri({type:Ar.Sequence})],va);let ma=class{constructor(e={}){_defineProperty(this,"namedCurve",void 0),_defineProperty(this,"implicitCurve",void 0),_defineProperty(this,"specifiedCurve",void 0),Object.assign(this,e)}};di([ii({type:Sr.ObjectIdentifier})],ma.prototype,"namedCurve",void 0),di([ii({type:Sr.Null})],ma.prototype,"implicitCurve",void 0),di([ii({type:va})],ma.prototype,"specifiedCurve",void 0),ma=di([ri({type:Ar.Choice})],ma);class ba{constructor(e={}){_defineProperty(this,"version",1),_defineProperty(this,"privateKey",new Br),_defineProperty(this,"parameters",void 0),_defineProperty(this,"publicKey",void 0),Object.assign(this,e)}}di([ii({type:Sr.Integer})],ba.prototype,"version",void 0),di([ii({type:Br})],ba.prototype,"privateKey",void 0),di([ii({type:ma,context:0,optional:!0})],ba.prototype,"parameters",void 0),di([ii({type:Sr.BitString,context:1,optional:!0})],ba.prototype,"publicKey",void 0);class wa{constructor(e={}){_defineProperty(this,"r",new ArrayBuffer(0)),_defineProperty(this,"s",new ArrayBuffer(0)),Object.assign(this,e)}}di([ii({type:Sr.Integer,converter:Er})],wa.prototype,"r",void 0),di([ii({type:Sr.Integer,converter:Er})],wa.prototype,"s",void 0);const Aa="1.2.840.113549.1.1",Sa=`${Aa}.1`,xa=`${Aa}.7`,Ba=`${Aa}.9`,ka=`${Aa}.10`,Ca=`${Aa}.2`,Pa=`${Aa}.4`,Ea=`${Aa}.5`,Oa=`${Aa}.14`,Na=`${Aa}.11`,Ia=`${Aa}.12`,Ta=`${Aa}.13`,ja=`${Aa}.15`,_a=`${Aa}.16`,Ua="1.3.14.3.2.26",La="2.16.840.1.101.3.4.2.4",Da="2.16.840.1.101.3.4.2.1",Ra="2.16.840.1.101.3.4.2.2",Va="2.16.840.1.101.3.4.2.3",Ha=`${Aa}.8`;function $a(e){return new hs({algorithm:e,parameters:null})}$a("1.2.840.113549.2.2"),$a("1.2.840.113549.2.5");const Ma=$a(Ua);$a(La),$a(Da),$a(Ra),$a(Va),$a("2.16.840.1.101.3.4.2.5"),$a("2.16.840.1.101.3.4.2.6");const Ka=new hs({algorithm:Ha,parameters:ci.serialize(Ma)}),Fa=new hs({algorithm:Ba,parameters:ci.serialize(jr.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});$a(Sa),$a(Ca),$a(Pa),$a(Ea),$a(ja),$a(_a),$a(Ia),$a(Ta),$a(ja),$a(_a);class za{constructor(e={}){_defineProperty(this,"hashAlgorithm",new hs(Ma)),_defineProperty(this,"maskGenAlgorithm",new hs({algorithm:Ha,parameters:ci.serialize(Ma)})),_defineProperty(this,"pSourceAlgorithm",new hs(Fa)),Object.assign(this,e)}}di([ii({type:hs,context:0,defaultValue:Ma})],za.prototype,"hashAlgorithm",void 0),di([ii({type:hs,context:1,defaultValue:Ka})],za.prototype,"maskGenAlgorithm",void 0),di([ii({type:hs,context:2,defaultValue:Fa})],za.prototype,"pSourceAlgorithm",void 0),new hs({algorithm:xa,parameters:ci.serialize(new za)});class Wa{constructor(e={}){_defineProperty(this,"hashAlgorithm",new hs(Ma)),_defineProperty(this,"maskGenAlgorithm",new hs({algorithm:Ha,parameters:ci.serialize(Ma)})),_defineProperty(this,"saltLength",20),_defineProperty(this,"trailerField",1),Object.assign(this,e)}}di([ii({type:hs,context:0,defaultValue:Ma})],Wa.prototype,"hashAlgorithm",void 0),di([ii({type:hs,context:1,defaultValue:Ka})],Wa.prototype,"maskGenAlgorithm",void 0),di([ii({type:Sr.Integer,context:2,defaultValue:20})],Wa.prototype,"saltLength",void 0),di([ii({type:Sr.Integer,context:3,defaultValue:1})],Wa.prototype,"trailerField",void 0),new hs({algorithm:ka,parameters:ci.serialize(new Wa)});class qa{constructor(e={}){_defineProperty(this,"digestAlgorithm",new hs),_defineProperty(this,"digest",new Br),Object.assign(this,e)}}var Ga;di([ii({type:hs})],qa.prototype,"digestAlgorithm",void 0),di([ii({type:Br})],qa.prototype,"digest",void 0);class Ja{constructor(e={}){_defineProperty(this,"prime",new ArrayBuffer(0)),_defineProperty(this,"exponent",new ArrayBuffer(0)),_defineProperty(this,"coefficient",new ArrayBuffer(0)),Object.assign(this,e)}}di([ii({type:Sr.Integer,converter:Er})],Ja.prototype,"prime",void 0),di([ii({type:Sr.Integer,converter:Er})],Ja.prototype,"exponent",void 0),di([ii({type:Sr.Integer,converter:Er})],Ja.prototype,"coefficient",void 0);let Xa=Ga=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,Ga.prototype)}};Xa=Ga=di([ri({type:Ar.Sequence,itemType:Ja})],Xa);class Za{constructor(e={}){_defineProperty(this,"version",0),_defineProperty(this,"modulus",new ArrayBuffer(0)),_defineProperty(this,"publicExponent",new ArrayBuffer(0)),_defineProperty(this,"privateExponent",new ArrayBuffer(0)),_defineProperty(this,"prime1",new ArrayBuffer(0)),_defineProperty(this,"prime2",new ArrayBuffer(0)),_defineProperty(this,"exponent1",new ArrayBuffer(0)),_defineProperty(this,"exponent2",new ArrayBuffer(0)),_defineProperty(this,"coefficient",new ArrayBuffer(0)),_defineProperty(this,"otherPrimeInfos",void 0),Object.assign(this,e)}}di([ii({type:Sr.Integer})],Za.prototype,"version",void 0),di([ii({type:Sr.Integer,converter:Er})],Za.prototype,"modulus",void 0),di([ii({type:Sr.Integer,converter:Er})],Za.prototype,"publicExponent",void 0),di([ii({type:Sr.Integer,converter:Er})],Za.prototype,"privateExponent",void 0),di([ii({type:Sr.Integer,converter:Er})],Za.prototype,"prime1",void 0),di([ii({type:Sr.Integer,converter:Er})],Za.prototype,"prime2",void 0),di([ii({type:Sr.Integer,converter:Er})],Za.prototype,"exponent1",void 0),di([ii({type:Sr.Integer,converter:Er})],Za.prototype,"exponent2",void 0),di([ii({type:Sr.Integer,converter:Er})],Za.prototype,"coefficient",void 0),di([ii({type:Xa,optional:!0})],Za.prototype,"otherPrimeInfos",void 0);class Ya{constructor(e={}){_defineProperty(this,"modulus",new ArrayBuffer(0)),_defineProperty(this,"publicExponent",new ArrayBuffer(0)),Object.assign(this,e)}}var Qa;di([ii({type:Sr.Integer,converter:Er})],Ya.prototype,"modulus",void 0),di([ii({type:Sr.Integer,converter:Er})],Ya.prototype,"publicExponent",void 0),function(e){e[e.Transient=0]="Transient",e[e.Singleton=1]="Singleton",e[e.ResolutionScoped=2]="ResolutionScoped",e[e.ContainerScoped=3]="ContainerScoped"}(Qa||(Qa={}));var ec=Qa;function tc(e){return!!e.useClass}function rc(e){return!!e.useFactory}var ic=function(){function e(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return e.prototype.createProxy=function(e){var t,r=this,i=!1;return new Proxy({},this.createHandler(function(){return i||(t=e(r.wrap()),i=!0),t}))},e.prototype.createHandler=function(e){var t={};return this.reflectMethods.forEach(function(r){t[r]=function(){for(var t=[],i=0;i0},e.prototype.clear=function(){this._registryMap.clear()},e.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},e}(),lc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return fi(t,e),t}(cc),uc=function(){this.scopedResolutions=new Map};function pc(e,t,r){var i,n,s=mi(e.toString().match(/constructor\(([\w, ]+)\)/)||[],2)[1],o=function(e,t){return null===e?"at position #"+t:'"'+e.split(",")[t].trim()+'" at position #'+t}(void 0===s?null:s,t);return i="Cannot inject the dependency "+o+' of "'+e.name+'" constructor. Reason:',void 0===n&&(n=" "),bi([i],r.message.split("\n").map(function(e){return n+e})).join("\n")}var hc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return fi(t,e),t}(cc),fc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return fi(t,e),t}(cc),dc=function(){this.preResolution=new hc,this.postResolution=new fc},yc=new Map,gc=function(){function e(e){this.parent=e,this._registry=new lc,this.interceptors=new dc,this.disposed=!1,this.disposables=new Set}return e.prototype.register=function(e,t,r){var i;if(void 0===r&&(r={lifecycle:ec.Transient}),this.ensureNotDisposed(),i=function(e){return tc(e)||ac(e)||oc(e)||rc(e)}(t)?t:{useClass:t},oc(i))for(var n=[e],s=i;null!=s;){var o=s.useToken;if(n.includes(o))throw new Error("Token registration cycle detected! "+bi(n,[o]).join(" -> "));n.push(o);var a=this._registry.get(o);s=a&&oc(a.provider)?a.provider:null}if((r.lifecycle===ec.Singleton||r.lifecycle==ec.ContainerScoped||r.lifecycle==ec.ResolutionScoped)&&(ac(i)||rc(i)))throw new Error('Cannot use lifecycle "'+ec[r.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:i,options:r}),this},e.prototype.registerType=function(e,t){return this.ensureNotDisposed(),nc(t)?this.register(e,{useToken:t}):this.register(e,{useClass:t})},e.prototype.registerInstance=function(e,t){return this.ensureNotDisposed(),this.register(e,{useValue:t})},e.prototype.registerSingleton=function(e,t){if(this.ensureNotDisposed(),nc(e)){if(nc(t))return this.register(e,{useToken:t},{lifecycle:ec.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:ec.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var r=e;return t&&!nc(t)&&(r=t),this.register(e,{useClass:r},{lifecycle:ec.Singleton})},e.prototype.resolve=function(e,t,r){void 0===t&&(t=new uc),void 0===r&&(r=!1),this.ensureNotDisposed();var i=this.getRegistration(e);if(!i&&nc(e)){if(r)return;throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"Single"),i){var n=this.resolveRegistration(i,t);return this.executePostResolutionInterceptor(e,n,"Single"),n}if(function(e){return"function"==typeof e||e instanceof ic}(e)){n=this.construct(e,t);return this.executePostResolutionInterceptor(e,n,"Single"),n}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},e.prototype.executePreResolutionInterceptor=function(e,t){var r,i;if(this.interceptors.preResolution.has(e)){var n=[];try{for(var s=vi(this.interceptors.preResolution.getAll(e)),o=s.next();!o.done;o=s.next()){var a=o.value;"Once"!=a.options.frequency&&n.push(a),a.callback(e,t)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}this.interceptors.preResolution.setAll(e,n)}},e.prototype.executePostResolutionInterceptor=function(e,t,r){var i,n;if(this.interceptors.postResolution.has(e)){var s=[];try{for(var o=vi(this.interceptors.postResolution.getAll(e)),a=o.next();!a.done;a=o.next()){var c=a.value;"Once"!=c.options.frequency&&s.push(c),c.callback(e,t,r)}}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}this.interceptors.postResolution.setAll(e,s)}},e.prototype.resolveRegistration=function(e,t){if(this.ensureNotDisposed(),e.options.lifecycle===ec.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);var r,i=e.options.lifecycle===ec.Singleton,n=e.options.lifecycle===ec.ContainerScoped,s=i||n;return r=ac(e.provider)?e.provider.useValue:oc(e.provider)?s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):tc(e.provider)?s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):rc(e.provider)?e.provider.useFactory(this):this.construct(e.provider,t),e.options.lifecycle===ec.ResolutionScoped&&t.scopedResolutions.set(e,r),r},e.prototype.resolveAll=function(e,t,r){var i=this;void 0===t&&(t=new uc),void 0===r&&(r=!1),this.ensureNotDisposed();var n=this.getAllRegistrations(e);if(!n&&nc(e)){if(r)return[];throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"All"),n){var s=n.map(function(e){return i.resolveRegistration(e,t)});return this.executePostResolutionInterceptor(e,s,"All"),s}var o=[this.construct(e,t)];return this.executePostResolutionInterceptor(e,o,"All"),o},e.prototype.isRegistered=function(e,t){return void 0===t&&(t=!1),this.ensureNotDisposed(),this._registry.has(e)||t&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},e.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},e.prototype.clearInstances=function(){var e,t;this.ensureNotDisposed();try{for(var r=vi(this._registry.entries()),i=r.next();!i.done;i=r.next()){var n=mi(i.value,2),s=n[0],o=n[1];this._registry.setAll(s,o.filter(function(e){return!ac(e.provider)}).map(function(e){return e.instance=void 0,e}))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},e.prototype.createChildContainer=function(){var t,r;this.ensureNotDisposed();var i=new e(this);try{for(var n=vi(this._registry.entries()),s=n.next();!s.done;s=n.next()){var o=mi(s.value,2),a=o[0],c=o[1];c.some(function(e){return e.options.lifecycle===ec.ContainerScoped})&&i._registry.setAll(a,c.map(function(e){return e.options.lifecycle===ec.ContainerScoped?{provider:e.provider,options:e.options}:e}))}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return i},e.prototype.beforeResolution=function(e,t,r){void 0===r&&(r={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:t,options:r})},e.prototype.afterResolution=function(e,t,r){void 0===r&&(r={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:t,options:r})},e.prototype.dispose=function(){return yi(this,void 0,void 0,function(){var e;return gi(this,function(t){switch(t.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(t){var r=t.dispose();r&&e.push(r)}),[4,Promise.all(e)];case 1:return t.sent(),[2]}})})},e.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},e.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},e.prototype.construct=function(e,t){var r=this;if(e instanceof ic)return e.createProxy(function(e){return r.resolve(e,t)});var i,n=function(){var i=yc.get(e);if(!i||0===i.length){if(0===e.length)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var n=i.map(r.resolveParams(t,e));return new(e.bind.apply(e,bi([void 0],n)))}();return"function"!=typeof(i=n).dispose||i.dispose.length>0||this.disposables.add(n),n},e.prototype.resolveParams=function(e,t){var r=this;return function(i,n){var s,o,a,c;try{return"object"==typeof(c=i)&&"token"in c&&"multiple"in c?sc(i)?i.multiple?(s=r.resolve(i.transform)).transform.apply(s,bi([r.resolveAll(i.token,new uc,i.isOptional)],i.transformArgs)):(o=r.resolve(i.transform)).transform.apply(o,bi([r.resolve(i.token,e,i.isOptional)],i.transformArgs)):i.multiple?r.resolveAll(i.token,new uc,i.isOptional):r.resolve(i.token,e,i.isOptional):sc(i)?(a=r.resolve(i.transform,e)).transform.apply(a,bi([r.resolve(i.token,e)],i.transformArgs)):r.resolve(i,e)}catch(e){throw new Error(pc(t,n,e))}}},e.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},e}(),vc=new gc;function mc(e){return function(e){yc.set(e,function(e){var t=Reflect.getMetadata("design:paramtypes",e)||[],r=Reflect.getOwnMetadata("injectionTokens",e)||{};return Object.keys(r).forEach(function(e){t[+e]=r[e]}),t}(e))}}if("undefined"==typeof Reflect||!Reflect.getMetadata)throw new Error("tsyringe requires a reflect polyfill. Please add 'import \"reflect-metadata\"' to the top of your entry point.");const bc="crypto.algorithm";class wc{getAlgorithms(){return vc.resolveAll(bc)}toAsnAlgorithm(e){const t={...e};t.hash&&"string"==typeof t.hash&&(t.hash={name:t.hash});for(const e of this.getAlgorithms()){const r=e.toAsnAlgorithm(t);if(r)return r}if(/^[0-9.]+$/.test(e.name)){const t=new hs({algorithm:e.name});if("parameters"in e){const r=e;t.parameters=r.parameters}return t}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(e){for(const t of this.getAlgorithms()){const r=t.toWebAlgorithm(e);if(r)return r}return{name:e.algorithm,parameters:e.parameters}}}const Ac="crypto.algorithmProvider";var Sc;vc.registerSingleton(Ac,wc);const xc="1.3.36.3.3.2.8.1.1",Bc=`${xc}.1`,kc=`${xc}.2`,Cc=`${xc}.3`,Pc=`${xc}.4`,Ec=`${xc}.5`,Oc=`${xc}.6`,Nc=`${xc}.7`,Ic=`${xc}.8`,Tc=`${xc}.9`,jc=`${xc}.10`,_c=`${xc}.11`,Uc=`${xc}.12`,Lc=`${xc}.13`,Dc=`${xc}.14`,Rc="brainpoolP160r1",Vc="brainpoolP160t1",Hc="brainpoolP192r1",$c="brainpoolP192t1",Mc="brainpoolP224r1",Kc="brainpoolP224t1",Fc="brainpoolP256r1",zc="brainpoolP256t1",Wc="brainpoolP320r1",qc="brainpoolP320t1",Gc="brainpoolP384r1",Jc="brainpoolP384t1",Xc="brainpoolP512r1",Zc="brainpoolP512t1",Yc="ECDSA";e.EcAlgorithm=Sc=class{toAsnAlgorithm(e){if(e.name.toLowerCase()===Yc.toLowerCase())if("hash"in e){switch(("string"==typeof e.hash?e.hash:e.hash.name).toLowerCase()){case"sha-1":return ua;case"sha-256":return pa;case"sha-384":return ha;case"sha-512":return fa}}else if("namedCurve"in e){let t="";switch(e.namedCurve){case"P-256":t=oa;break;case"K-256":t=Sc.SECP256K1;break;case"P-384":t=aa;break;case"P-521":t=ca;break;case Rc:t=Bc;break;case Vc:t=kc;break;case Hc:t=Cc;break;case $c:t=Pc;break;case Mc:t=Ec;break;case Kc:t=Oc;break;case Fc:t=Nc;break;case zc:t=Ic;break;case Wc:t=Tc;break;case qc:t=jc;break;case Gc:t=_c;break;case Jc:t=Uc;break;case Xc:t=Lc;break;case Zc:t=Dc}if(t)return new hs({algorithm:ea,parameters:ci.serialize(new ma({namedCurve:t}))})}return null}toWebAlgorithm(e){switch(e.algorithm){case ta:return{name:Yc,hash:{name:"SHA-1"}};case ia:return{name:Yc,hash:{name:"SHA-256"}};case na:return{name:Yc,hash:{name:"SHA-384"}};case sa:return{name:Yc,hash:{name:"SHA-512"}};case ea:if(!e.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(ci.parse(e.parameters,ma).namedCurve){case oa:return{name:Yc,namedCurve:"P-256"};case Sc.SECP256K1:return{name:Yc,namedCurve:"K-256"};case aa:return{name:Yc,namedCurve:"P-384"};case ca:return{name:Yc,namedCurve:"P-521"};case Bc:return{name:Yc,namedCurve:Rc};case kc:return{name:Yc,namedCurve:Vc};case Cc:return{name:Yc,namedCurve:Hc};case Pc:return{name:Yc,namedCurve:$c};case Ec:return{name:Yc,namedCurve:Mc};case Oc:return{name:Yc,namedCurve:Kc};case Nc:return{name:Yc,namedCurve:Fc};case Ic:return{name:Yc,namedCurve:zc};case Tc:return{name:Yc,namedCurve:Wc};case jc:return{name:Yc,namedCurve:qc};case _c:return{name:Yc,namedCurve:Gc};case Uc:return{name:Yc,namedCurve:Jc};case Lc:return{name:Yc,namedCurve:Xc};case Dc:return{name:Yc,namedCurve:Zc}}}return null}},e.EcAlgorithm.SECP256K1="1.3.132.0.10",e.EcAlgorithm=Sc=di([mc()],e.EcAlgorithm),vc.registerSingleton(bc,e.EcAlgorithm);const Qc=Symbol("name"),el=Symbol("value");class tl{constructor(e,t={},r=""){this[Qc]=e,this[el]=r;for(const e in t)this[e]=t[e]}}tl.NAME=Qc,tl.VALUE=el;class rl{static toTextObject(t){const r=new tl("Algorithm Identifier",{},il.toString(t.algorithm));if(t.parameters)switch(t.algorithm){case ea:{const i=(new e.EcAlgorithm).toWebAlgorithm(t);i&&"namedCurve"in i?r["Named Curve"]=i.namedCurve:r.Parameters=t.parameters;break}default:r.Parameters=t.parameters}return r}}class il{static toString(e){const t=this.items[e];return t||e}}il.items={[Ua]:"sha1",[La]:"sha224",[Da]:"sha256",[Ra]:"sha384",[Va]:"sha512",[Sa]:"rsaEncryption",[Ea]:"sha1WithRSAEncryption",[Oa]:"sha224WithRSAEncryption",[Na]:"sha256WithRSAEncryption",[Ia]:"sha384WithRSAEncryption",[Ta]:"sha512WithRSAEncryption",[ea]:"ecPublicKey",[ta]:"ecdsaWithSHA1",[ra]:"ecdsaWithSHA224",[ia]:"ecdsaWithSHA256",[na]:"ecdsaWithSHA384",[sa]:"ecdsaWithSHA512",[On]:"TLS WWW server authentication",[Nn]:"TLS WWW client authentication",[In]:"Code Signing",[Tn]:"E-mail Protection",[jn]:"Time Stamping",[_n]:"OCSP Signing",[Xo]:"Signed Data"};class nl{static serialize(e){return this.serializeObj(e).join("\n")}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,t=0){const i=[];let n=this.pad(t++),s="";const o=e[tl.VALUE];o&&(s=` ${o}`),i.push(`${n}${e[tl.NAME]}:${s}`),n=this.pad(t);for(const s in e){if("symbol"==typeof s)continue;const o=e[s],a=s?`${s}: `:"";if("string"==typeof o||"number"==typeof o||"boolean"==typeof o)i.push(`${n}${a}${o}`);else if(o instanceof Date)i.push(`${n}${a}${o.toUTCString()}`);else if(Array.isArray(o))for(const e of o)e[tl.NAME]=s,i.push(...this.serializeObj(e,t));else if(o instanceof tl)o[tl.NAME]=s,i.push(...this.serializeObj(o,t));else if(r.isBufferSource(o))s?(i.push(`${n}${a}`),i.push(...this.serializeBufferSource(o,t+1))):i.push(...this.serializeBufferSource(o,t));else{if(!("toTextObject"in o))throw new TypeError("Cannot serialize data in text format. Unsupported type.");{const e=o.toTextObject();e[tl.NAME]=s,i.push(...this.serializeObj(e,t))}}}return i}static serializeBufferSource(e,t=0){const i=this.pad(t),n=r.toUint8Array(e),s=[];for(let e=0;e127){const e=new Uint8Array(r.length+1);e[0]=0,e.set(r,1),r=e}return r.buffer}function fl(e){return hl(r.toUint8Array(l.FromHex(e||"")))}function dl(e){let t=r.toUint8Array(e);return t.length>1&&0===t[0]&&t[1]>127&&(t=t.slice(1)),l.ToHex(t)}class yl extends cl{constructor(...e){let t,i;r.isBufferSource(e[0])?(t=r.toArrayBuffer(e[0]),i=e[1]):(t=ci.serialize(new vs({extnID:e[0],critical:e[1],extnValue:new Br(r.toArrayBuffer(e[2]))})),i=pl),super(t,vs,i)}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[tl.NAME]===yl.NAME&&(e[tl.NAME]=il.toString(this.type)),e}}const gl=/^[0-2](?:\.[1-9][0-9]*)+$/;class vl{constructor(e={}){this.items={};for(const t in e)this.register(t,e[t])}get(e){return this.items[e]||null}findId(e){return t=e,new RegExp(gl).test(t)?e:this.get(e);var t}register(e,t){this.items[e]=t,this.items[t]=e}}const ml=new vl;function bl(e,t){return`\\${l.ToHex(l.FromUtf8String(t)).toUpperCase()}`}ml.register("CN","2.5.4.3"),ml.register("L","2.5.4.7"),ml.register("ST","2.5.4.8"),ml.register("O","2.5.4.10"),ml.register("OU","2.5.4.11"),ml.register("C","2.5.4.6"),ml.register("DC","0.9.2342.19200300.100.1.25"),ml.register("E","1.2.840.113549.1.9.1"),ml.register("G","2.5.4.42"),ml.register("I","2.5.4.43"),ml.register("SN","2.5.4.4"),ml.register("T","2.5.4.12");class wl{static isASCII(e){for(let t=0;t255)return!1}return!0}static isPrintableString(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/g.test(e)}constructor(e,t={}){this.extraNames=new vl,this.asn=new Ei;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const r=t[e];this.extraNames.register(e,r)}"string"==typeof e?this.asn=this.fromString(e):e instanceof Ei?this.asn=e:r.isBufferSource(e)?this.asn=ci.parse(e,Ei):this.asn=this.fromJSON(e)}getField(e){const t=this.extraNames.findId(e)||ml.findId(e),r=[];for(const e of this.asn)for(const i of e)i.type===t&&r.push(i.value.toString());return r}getName(e){return this.extraNames.get(e)||ml.get(e)}toString(){return this.asn.map(e=>e.map(e=>`${this.getName(e.type)||e.type}=${e.value.anyValue?`#${l.ToHex(e.value.anyValue)}`:e.value.toString().replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,bl)}`).join("+")).join(", ")}toJSON(){var e;const t=[];for(const r of this.asn){const i={};for(const t of r){const r=this.getName(t.type)||t.type;null!==(e=i[r])&&void 0!==e||(i[r]=[]),i[r].push(t.value.anyValue?`#${l.ToHex(t.value.anyValue)}`:t.value.toString())}t.push(i)}return t}fromString(e){const t=new Ei,r=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+"\\](?=[,+]|$))|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let i=null,n=",";for(;i=r.exec(`${e},`);){let[,e,r]=i;const s=r[r.length-1];","!==s&&"+"!==s||(r=r.slice(0,r.length-1),i[3]=s);const o=i[3];e=this.getTypeOid(e);const a=this.createAttribute(e,r);"+"===n?t[t.length-1].push(a):t.push(new Ci([a])),n=o}return t}fromJSON(e){const t=new Ei;for(const r of e){const e=new Ci;for(const t in r){const i=this.getTypeOid(t),n=r[t];for(const t of n){const r=this.createAttribute(i,t);e.push(r)}}t.push(e)}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 r=new ki({type:e});if("object"==typeof t)for(const e in t)switch(e){case"ia5String":r.value.ia5String=t[e];break;case"utf8String":r.value.utf8String=t[e];break;case"universalString":r.value.universalString=t[e];break;case"bmpString":r.value.bmpString=t[e];break;case"printableString":r.value.printableString=t[e]}else if("#"===t[0])r.value.anyValue=l.FromHex(t.slice(1));else{const i=this.processStringValue(t);e===this.getName("E")||e===this.getName("DC")?r.value.ia5String=i:wl.isPrintableString(i)?r.value.printableString=i:r.value.utf8String=i}return r}processStringValue(e){const t=/"(.*?[^\\])?"/.exec(e);return t&&(e=t[1]),e.replace(/\\0a/gi,"\n").replace(/\\0d/gi,"\r").replace(/\\0g/gi,"\t").replace(/\\(.)/g,"$1")}toArrayBuffer(){return ci.serialize(this.asn)}async getThumbprint(e,t){let r,i="SHA-1";return e&&("object"==typeof e&&"subtle"in e?r=e:(i=e,r=t)),null!=r||(r=ul.get()),await r.subtle.digest(i,this.toArrayBuffer())}}const Al="Cannot initialize GeneralName from ASN.1 data.",Sl=`${Al} Unsupported string format in use.`,xl=`${Al} Value doesn't match to GUID regular expression.`,Bl=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,kl="1.3.6.1.4.1.311.25.1",Cl="1.3.6.1.4.1.311.20.2.3",Pl="dns",El="dn",Ol="email",Nl="ip",Il="url",Tl="guid",jl="upn",_l="id";class Ul extends cl{constructor(...e){var t;let i,n;if(r.isBufferSource(e[0]))n=e[1],i=ci.parse(e[0],Ti,n);else if("string"==typeof e[0])switch(n=pl,e[0]){case El:{const t=new wl(e[1]).toArrayBuffer(),r=ci.parse(t,Ei,pl);i=new Ti({directoryName:r});break}case Pl:i=new Ti({dNSName:e[1]});break;case Ol:i=new Ti({rfc822Name:e[1]});break;case Tl:{const t=new RegExp(Bl,"i").exec(e[1]);if(!t)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const r=t.slice(1).map((e,t)=>t<3?l.ToHex(new Uint8Array(l.FromHex(e)).reverse()):e).join("");i=new Ti({otherName:new Ni({typeId:kl,value:ci.serialize(new Br(l.FromHex(r)))})});break}case Nl:i=new Ti({iPAddress:e[1]});break;case _l:i=new Ti({registeredID:e[1]});break;case jl:i=new Ti({otherName:new Ni({typeId:Cl,value:ci.serialize(Lr.toASN(e[1]))})});break;case Il:i=new Ti({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else i=e[0],n=null!==(t=e[1])&&void 0!==t?t:pl;super(i,n)}onInit(e){if(null!=e.dNSName)this.type=Pl,this.value=e.dNSName;else if(null!=e.rfc822Name)this.type=Ol,this.value=e.rfc822Name;else if(null!=e.iPAddress)this.type=Nl,this.value=e.iPAddress;else if(null!=e.uniformResourceIdentifier)this.type=Il,this.value=e.uniformResourceIdentifier;else if(null!=e.registeredID)this.type=_l,this.value=e.registeredID;else if(null!=e.directoryName)this.type=El,this.value=new wl(e.directoryName).toString();else{if(null==e.otherName)throw new Error(Sl);if(e.otherName.typeId===kl){this.type=Tl;const t=ci.parse(e.otherName.value,Br,this.parseOptions),r=new RegExp(Bl,"i").exec(l.ToHex(t));if(!r)throw new Error(xl);this.value=r.slice(1).map((e,t)=>t<3?l.ToHex(new Uint8Array(l.FromHex(e)).reverse()):e).join("-")}else{if(e.otherName.typeId!==Cl)throw new Error(Sl);this.type=jl,this.value=ci.parse(e.otherName.value,xi,this.parseOptions).toString()}}}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case El:case Pl:case Tl:case Nl:case _l:case jl:case Il:e=this.type.toUpperCase();break;case Ol:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let t=this.value;return this.type===_l&&(t=il.toString(t)),new tl(e,void 0,t)}}class Ll extends cl{constructor(e,t){let i,n=pl;if(e instanceof Zi)i=e;else if(Array.isArray(e)){const t=[];for(const r of e)if(r instanceof Ti)t.push(r);else{const e=ci.parse(new Ul(r.type,r.value).rawData,Ti,pl);t.push(e)}i=new Zi(t)}else{if(!r.isBufferSource(e))throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");i=ci.parse(e,Zi,t),n=null!=t?t:{}}super(i,n)}onInit(e){const t=[];for(const r of e){let e=null;try{e=new Ul(r,this.parseOptions)}catch(e){continue}t.push(e)}this.items=t}toJSON(){return this.items.map(e=>e.toJSON())}toTextObject(){const e=super.toTextObjectEmpty();for(const t of this.items){const r=t.toTextObject();let i=e[r[tl.NAME]];Array.isArray(i)||(i=[],e[r[tl.NAME]]=i),i.push(r)}return e}}Ll.NAME="GeneralNames";const Dl="-{5}",Rl="\\n",Vl="\\n",Hl=`${`${Dl}BEGIN (${`[^${Rl}]+`}(?=${Dl}))${Dl}`}${Vl}(?:((?:${`[^:${Rl}]+`}: ${`(?:[^${Rl}]+${Vl}(?: +[^${Rl}]+${Vl})*)`})+))?${Vl}?(${`(?:[a-zA-Z0-9=+/]+${Vl})+`})${`${Dl}END \\1${Dl}`}`,$l=new RegExp(`[${Rl}]+`,"g");class Ml{static isPem(e){return"string"==typeof e&&new RegExp(Hl,"g").test(e.replace(/\r/g,""))}static decodeWithHeaders(e){e=e.replace(/\r/g,"");const t=new RegExp(Hl,"g"),r=[];let i=null;for(;i=t.exec(e);){const e=i[3].replace($l,""),t={type:i[1],headers:[],rawData:l.FromBase64(e)},n=i[2];if(n){const e=n.split(new RegExp(Vl,"g"));let r=null;for(const i of e){const[e,n]=i.split(/:(.*)/);if(void 0===n){if(!r)throw new Error("Cannot parse PEM string. Incorrect header value");r.value+=e.trim()}else r&&t.headers.push(r),r={key:e,value:n.trim()}}r&&t.headers.push(r)}r.push(t)}return r}static decode(e){return this.decodeWithHeaders(e).map(e=>e.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(e=>{if(!r.isBufferSource(e))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:r.toArrayBuffer(e)}))}):e.forEach(e=>{if(!("type"in e))throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");i.push(this.encodeStruct(e))}),i.join("\n")}if(!t)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:t,rawData:r.toArrayBuffer(e)})}static encodeStruct(e){var t;const r=e.type.toLocaleUpperCase(),i=[];if(i.push(`-----BEGIN ${r}-----`),null===(t=e.headers)||void 0===t?void 0:t.length){for(const t of e.headers)i.push(`${t.key}: ${t.value}`);i.push("")}const n=l.ToBase64(e.rawData);for(let e=0;e0&&48===t[0])return r.toArrayBuffer(e);const i=l.ToBinary(e);if(Ml.isPem(i))return Ml.decode(i)[0];if(l.isHex(i))return l.FromHex(i);if(l.isBase64(i))return l.FromBase64(i);if(l.isBase64Url(i))return l.FromBase64Url(i);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}}constructor(...e){Kl.isAsnEncoded(e[0])?super(Kl.toArrayBuffer(e[0]),e[1],e[2]):super(e[0],e[1])}toString(e="pem"){return"pem"===e?Ml.encode(this.rawData,this.tag):super.toString(e)}}class Fl extends Kl{static async create(e,t=ul.get()){if(e instanceof Fl)return e;if(ll.isCryptoKey(e)){if("public"!==e.type)throw new TypeError("Public key is required");const r=await t.subtle.exportKey("spki",e);return new Fl(r)}if(e.publicKey)return e.publicKey;if(r.isBufferSource(e))return new Fl(e);throw new TypeError("Unsupported PublicKeyType")}constructor(e,t){Kl.isAsnEncoded(e)?super(e,fs,t):super(e,t),this.tag=Ml.PublicKeyTag}async export(e,t,r){let i,n=["verify"],s={hash:"SHA-256",...this.algorithm};t?(s=e,n=t,i=r):i=e,null!=i||(i=ul.get());let o=this.rawData;const a=ci.parse(this.rawData,fs,this.parseOptions);return a.algorithm.algorithm===ka&&(o=function(e,t){return e.algorithm=new hs({algorithm:Sa,parameters:null}),t=ci.serialize(e),t}(a,o)),i.subtle.importKey("spki",o,s,!0,n)}onInit(e){const t=vc.resolve(Ac),i=this.algorithm=t.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case Sa:{const t=ci.parse(e.subjectPublicKey,Ya,this.parseOptions),n=r.toUint8Array(t.modulus);i.publicExponent=r.toUint8Array(t.publicExponent),i.modulusLength=(n[0]?n:n.slice(1)).byteLength<<3;break}}}async getThumbprint(e,t){let r,i="SHA-1";return e&&("object"==typeof e&&"subtle"in e?r=e:(i=e,r=t)),null!=r||(r=ul.get()),await r.subtle.digest(i,this.rawData)}async getKeyIdentifier(e,t){let r,i="SHA-1";e&&("object"==typeof e&&"subtle"in e?r=e:(i=e,r=t)),null!=r||(r=ul.get());const n=ci.parse(this.rawData,fs,this.parseOptions);return await r.subtle.digest(i,n.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),t=ci.parse(this.rawData,fs,this.parseOptions);if(e.Algorithm=nl.serializeAlgorithm(t.algorithm),t.algorithm.algorithm===ea)e["EC Point"]=t.subjectPublicKey;else e["Raw Data"]=t.subjectPublicKey;return e}}class zl extends yl{static async create(e,t=!1,r=ul.get()){if("name"in e&&"serialNumber"in e)return new zl(e,t);const i=await Fl.create(e,r),n=await i.getKeyIdentifier(r);return new zl(l.ToHex(n),t)}constructor(...e){if(r.isBufferSource(e[0]))super(e[0],e[1]);else if("string"==typeof e[0]){const t=new qi({keyIdentifier:new Wi(l.FromHex(e[0]))});super(zi,e[1],ci.serialize(t))}else{const t=e[0],r=t.name instanceof Ll?ci.parse(t.name.rawData,Zi,pl):t.name,i=new qi({authorityCertIssuer:r,authorityCertSerialNumber:l.FromHex(t.serialNumber)});super(zi,e[1],ci.serialize(i))}}onInit(e){super.onInit(e);const t=ci.parse(e.extnValue,qi,this.parseOptions);t.keyIdentifier&&(this.keyId=l.ToHex(t.keyIdentifier)),(t.authorityCertIssuer||t.authorityCertSerialNumber)&&(this.certId={name:t.authorityCertIssuer||[],serialNumber:t.authorityCertSerialNumber?l.ToHex(t.authorityCertSerialNumber):""})}toTextObject(){const e=this.toTextObjectWithoutValue(),t=ci.parse(this.value,qi,this.parseOptions);return t.authorityCertIssuer&&(e["Authority Issuer"]=new Ll(t.authorityCertIssuer).toTextObject()),t.authorityCertSerialNumber&&(e["Authority Serial Number"]=t.authorityCertSerialNumber),t.keyIdentifier&&(e[""]=t.keyIdentifier),e}}zl.NAME="Authority Key Identifier";class Wl extends yl{constructor(...e){if(r.isBufferSource(e[0])){super(e[0],e[1]);const t=ci.parse(this.value,Ji,this.parseOptions);this.ca=t.cA,this.pathLength=t.pathLenConstraint}else{const t=new Ji({cA:e[0],pathLenConstraint:e[1]});super(Gi,e[2],ci.serialize(t)),this.ca=e[0],this.pathLength=e[1]}}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ca&&(e.CA=this.ca),void 0!==this.pathLength&&(e["Path Length"]=this.pathLength),e}}Wl.NAME="Basic Constraints",e.ExtendedKeyUsage=void 0,function(e){e.serverAuth="1.3.6.1.5.5.7.3.1",e.clientAuth="1.3.6.1.5.5.7.3.2",e.codeSigning="1.3.6.1.5.5.7.3.3",e.emailProtection="1.3.6.1.5.5.7.3.4",e.timeStamping="1.3.6.1.5.5.7.3.8",e.ocspSigning="1.3.6.1.5.5.7.3.9"}(e.ExtendedKeyUsage||(e.ExtendedKeyUsage={}));class ql extends yl{constructor(...e){if(r.isBufferSource(e[0])){super(e[0],e[1]);const t=ci.parse(this.value,En,this.parseOptions);this.usages=t.map(e=>e)}else{const t=new En(e[0]);super(Pn,e[1],ci.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(e=>il.toString(e)).join(", "),e}}ql.NAME="Extended Key Usages",e.KeyUsageFlags=void 0,function(e){e[e.digitalSignature=1]="digitalSignature",e[e.nonRepudiation=2]="nonRepudiation",e[e.keyEncipherment=4]="keyEncipherment",e[e.dataEncipherment=8]="dataEncipherment",e[e.keyAgreement=16]="keyAgreement",e[e.keyCertSign=32]="keyCertSign",e[e.cRLSign=64]="cRLSign",e[e.encipherOnly=128]="encipherOnly",e[e.decipherOnly=256]="decipherOnly"}(e.KeyUsageFlags||(e.KeyUsageFlags={}));class Gl extends yl{constructor(...e){if(r.isBufferSource(e[0])){super(e[0],e[1]);const t=ci.parse(this.value,Fn,this.parseOptions);this.usages=t.toNumber()}else{const t=new Fn(e[0]);super($n,e[1],ci.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=ci.parse(this.value,Fn,this.parseOptions);return e[""]=t.toJSON().join(", "),e}}Gl.NAME="Key Usages";class Jl extends yl{static async create(e,t=!1,r=ul.get()){const i=await Fl.create(e,r),n=await i.getKeyIdentifier(r);return new Jl(l.ToHex(n),t)}constructor(...e){if(r.isBufferSource(e[0])){super(e[0],e[1]);const t=ci.parse(this.value,ss,this.parseOptions);this.keyId=l.ToHex(t)}else{const t="string"==typeof e[0]?l.FromHex(e[0]):e[0],r=new ss(t);super(ns,e[1],ci.serialize(r)),this.keyId=l.ToHex(t)}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=ci.parse(this.value,ss,this.parseOptions);return e[""]=t,e}}Jl.NAME="Subject Key Identifier";class Xl extends yl{constructor(...e){r.isBufferSource(e[0])?super(e[0],e[1]):super(Qn,e[1],new Ll(e[0]||[]).rawData)}onInit(e){super.onInit(e);const t=ci.parse(e.extnValue,es,this.parseOptions);this.names=new Ll(t)}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.names.toTextObject();for(const r in t)e[r]=t[r];return e}}Xl.NAME="Subject Alternative Name";class Zl{static register(e,t){this.items.set(e,t)}static create(e,t){const r=new yl(e,t),i=this.items.get(r.type);return i?new i(e,t):r}}Zl.items=new Map;class Yl extends yl{constructor(...e){var t;if(r.isBufferSource(e[0])){super(e[0],e[1]);const t=ci.parse(this.value,un,this.parseOptions);this.policies=t.map(e=>e.policyIdentifier)}else{const r=e[0],i=null!==(t=e[1])&&void 0!==t&&t,n=new un(r.map(e=>new ln({policyIdentifier:e})));super(rn,i,ci.serialize(n)),this.policies=r}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(e=>new tl("",{},il.toString(e))),e}}Yl.NAME="Certificate Policies",Zl.register(rn,Yl);class Ql extends yl{constructor(...e){var t;if(r.isBufferSource(e[0]))super(e[0],e[1]);else if(Array.isArray(e[0])&&"string"==typeof e[0][0]){const t=e[0].map(e=>new mn({distributionPoint:new vn({fullName:[new Ti({uniformResourceIdentifier:e})]})})),r=new bn(t);super(dn,e[1],ci.serialize(r))}else{const t=new bn(e[0]);super(dn,e[1],ci.serialize(t))}null!==(t=this.distributionPoints)&&void 0!==t||(this.distributionPoints=[])}onInit(e){super.onInit(e);const t=ci.parse(e.extnValue,bn,this.parseOptions);this.distributionPoints=t}toTextObject(){const e=this.toTextObjectWithoutValue();return e["Distribution Point"]=this.distributionPoints.map(e=>{var t;const r=new tl("");return(null===(t=e.distributionPoint)||void 0===t?void 0:t.fullName)&&(r[""]=e.distributionPoint.fullName.map(e=>new Ul(e).toString()).join(", ")),e.reasons&&(r.Reasons=e.reasons.toString()),e.cRLIssuer&&(r["CRL Issuer"]=e.cRLIssuer.map(e=>e.toString()).join(", ")),r}),e}}Ql.NAME="CRL Distribution Points";class eu extends yl{constructor(...e){var t,i,n,s;if(r.isBufferSource(e[0]))super(e[0],e[1]);else if(e[0]instanceof Fi){const t=new Fi(e[0]);super(Mi,e[1],ci.serialize(t))}else{const t=e[0],r=new Fi;ru(r,t,Li,"ocsp"),ru(r,t,Di,"caIssuers"),ru(r,t,Ri,"timeStamping"),ru(r,t,Vi,"caRepository"),super(Mi,e[1],ci.serialize(r))}null!==(t=this.ocsp)&&void 0!==t||(this.ocsp=[]),null!==(i=this.caIssuers)&&void 0!==i||(this.caIssuers=[]),null!==(n=this.timeStamping)&&void 0!==n||(this.timeStamping=[]),null!==(s=this.caRepository)&&void 0!==s||(this.caRepository=[])}onInit(e){super.onInit(e),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[];ci.parse(e.extnValue,Fi,this.parseOptions).forEach(e=>{switch(e.accessMethod){case Li:this.ocsp.push(new Ul(e.accessLocation));break;case Di:this.caIssuers.push(new Ul(e.accessLocation));break;case Ri:this.timeStamping.push(new Ul(e.accessLocation));break;case Vi:this.caRepository.push(new Ul(e.accessLocation))}})}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ocsp.length&&tu(e,"OCSP",this.ocsp),this.caIssuers.length&&tu(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&tu(e,"Time Stamping",this.timeStamping),this.caRepository.length&&tu(e,"CA Repository",this.caRepository),e}}function tu(e,t,r){if(1===r.length)e[t]=r[0].toTextObject();else{const i=new tl("");r.forEach((e,t)=>{const r=e.toTextObject(),n=`${r[tl.NAME]} ${t+1}`;let s=i[n];Array.isArray(s)||(s=[],i[n]=s),s.push(r)}),e[t]=i}}function ru(e,t,r,i){const n=t[i];if(n){(Array.isArray(n)?n:[n]).forEach(t=>{"string"==typeof t&&(t=new Ul("url",t)),e.push(new Ki({accessMethod:r,accessLocation:ci.parse(t.rawData,Ti,pl)}))})}}eu.NAME="Authority Info Access";class iu extends yl{constructor(...e){r.isBufferSource(e[0])?super(e[0],e[1]):super(Vn,e[1],new Ll(e[0]||[]).rawData)}onInit(e){super.onInit(e);const t=ci.parse(e.extnValue,Zi,this.parseOptions);this.names=new Ll(t)}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.names.toTextObject();for(const r in t)e[r]=t[r];return e}}var nu;iu.NAME="Issuer Alternative Name";class su{constructor(e={}){_defineProperty(this,"attrId",""),_defineProperty(this,"attrValues",[]),Object.assign(e)}}di([ii({type:Sr.ObjectIdentifier})],su.prototype,"attrId",void 0),di([ii({type:Sr.Any,repeated:"set"})],su.prototype,"attrValues",void 0);let ou=nu=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,nu.prototype)}};var au;ou=nu=di([ri({type:Ar.Sequence,itemType:su})],ou);let cu=au=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,au.prototype)}};cu=au=di([ri({type:Ar.Sequence,itemType:bo})],cu);class lu{constructor(e={}){_defineProperty(this,"certId",""),_defineProperty(this,"certValue",new ArrayBuffer(0)),Object.assign(this,e)}}di([ii({type:Sr.ObjectIdentifier})],lu.prototype,"certId",void 0),di([ii({type:Sr.Any,context:0})],lu.prototype,"certValue",void 0);class uu{constructor(e={}){_defineProperty(this,"crlId",""),_defineProperty(this,"crltValue",new ArrayBuffer(0)),Object.assign(this,e)}}di([ii({type:Sr.ObjectIdentifier})],uu.prototype,"crlId",void 0),di([ii({type:Sr.Any,context:0})],uu.prototype,"crltValue",void 0);class pu extends Br{}let hu=class{constructor(e={}){_defineProperty(this,"encryptionAlgorithm",new hs),_defineProperty(this,"encryptedData",new pu),Object.assign(this,e)}};var fu,du;di([ii({type:hs})],hu.prototype,"encryptionAlgorithm",void 0),di([ii({type:pu})],hu.prototype,"encryptedData",void 0),function(e){e[e.v1=0]="v1"}(du||(du={}));class yu extends Br{}let gu=fu=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,fu.prototype)}};gu=fu=di([ri({type:Ar.Sequence,itemType:ts})],gu);let vu=class{constructor(e={}){_defineProperty(this,"version",du.v1),_defineProperty(this,"privateKeyAlgorithm",new hs),_defineProperty(this,"privateKey",new yu),_defineProperty(this,"attributes",void 0),Object.assign(this,e)}};di([ii({type:Sr.Integer})],vu.prototype,"version",void 0),di([ii({type:hs})],vu.prototype,"privateKeyAlgorithm",void 0),di([ii({type:yu})],vu.prototype,"privateKey",void 0),di([ii({type:gu,implicit:!0,context:0,optional:!0})],vu.prototype,"attributes",void 0);let mu=class extends vu{};mu=di([ri({type:Ar.Sequence})],mu);let bu=class extends hu{};bu=di([ri({type:Ar.Sequence})],bu);class wu{constructor(e={}){_defineProperty(this,"secretTypeId",""),_defineProperty(this,"secretValue",new ArrayBuffer(0)),Object.assign(this,e)}}di([ii({type:Sr.ObjectIdentifier})],wu.prototype,"secretTypeId",void 0),di([ii({type:Sr.Any,context:0})],wu.prototype,"secretValue",void 0);class Au{constructor(e={}){_defineProperty(this,"mac",new qa),_defineProperty(this,"macSalt",new Br),_defineProperty(this,"iterations",1),Object.assign(this,e)}}di([ii({type:qa})],Au.prototype,"mac",void 0),di([ii({type:Br})],Au.prototype,"macSalt",void 0),di([ii({type:Sr.Integer,defaultValue:1})],Au.prototype,"iterations",void 0);class Su{constructor(e={}){_defineProperty(this,"version",3),_defineProperty(this,"authSafe",new bo),_defineProperty(this,"macData",new Au),Object.assign(this,e)}}var xu;di([ii({type:Sr.Integer})],Su.prototype,"version",void 0),di([ii({type:bo})],Su.prototype,"authSafe",void 0),di([ii({type:Au,optional:!0})],Su.prototype,"macData",void 0);class Bu{constructor(e={}){_defineProperty(this,"bagId",""),_defineProperty(this,"bagValue",new ArrayBuffer(0)),_defineProperty(this,"bagAttributes",void 0),Object.assign(this,e)}}di([ii({type:Sr.ObjectIdentifier})],Bu.prototype,"bagId",void 0),di([ii({type:Sr.Any,context:0})],Bu.prototype,"bagValue",void 0),di([ii({type:su,repeated:"set",optional:!0})],Bu.prototype,"bagAttributes",void 0);let ku=xu=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,xu.prototype)}};var Cu,Pu,Eu;ku=xu=di([ri({type:Ar.Sequence,itemType:Bu})],ku);const Ou="1.2.840.113549.1.9",Nu=`${Ou}.7`,Iu=`${Ou}.14`;let Tu=class extends xi{constructor(e={}){super(e),_defineProperty(this,"ia5String",void 0)}toString(){return this.ia5String||super.toString()}};di([ii({type:Sr.IA5String})],Tu.prototype,"ia5String",void 0),Tu=di([ri({type:Ar.Choice})],Tu);let ju=class extends bo{};ju=di([ri({type:Ar.Sequence})],ju);let _u=class extends Su{};_u=di([ri({type:Ar.Sequence})],_u);let Uu=class extends hu{};Uu=di([ri({type:Ar.Sequence})],Uu);let Lu=class{constructor(e=""){_defineProperty(this,"value",void 0),this.value=e}toString(){return this.value}};di([ii({type:Sr.IA5String})],Lu.prototype,"value",void 0),Lu=di([ri({type:Ar.Choice})],Lu);let Du=class extends Tu{};Du=di([ri({type:Ar.Choice})],Du);let Ru=class extends xi{};Ru=di([ri({type:Ar.Choice})],Ru);let Vu=class{constructor(e=new Date){_defineProperty(this,"value",void 0),this.value=e}};di([ii({type:Sr.GeneralizedTime})],Vu.prototype,"value",void 0),Vu=di([ri({type:Ar.Choice})],Vu);let Hu=class extends xi{};Hu=di([ri({type:Ar.Choice})],Hu);let $u=class{constructor(e="M"){_defineProperty(this,"value",void 0),this.value=e}toString(){return this.value}};di([ii({type:Sr.PrintableString})],$u.prototype,"value",void 0),$u=di([ri({type:Ar.Choice})],$u);let Mu=class{constructor(e=""){_defineProperty(this,"value",void 0),this.value=e}toString(){return this.value}};di([ii({type:Sr.PrintableString})],Mu.prototype,"value",void 0),Mu=di([ri({type:Ar.Choice})],Mu);let Ku=class extends Mu{};Ku=di([ri({type:Ar.Choice})],Ku);let Fu=class extends xi{};Fu=di([ri({type:Ar.Choice})],Fu);let zu=class{constructor(e=""){_defineProperty(this,"value",void 0),this.value=e}toString(){return this.value}};di([ii({type:Sr.ObjectIdentifier})],zu.prototype,"value",void 0),zu=di([ri({type:Ar.Choice})],zu);let Wu=class extends ds{};Wu=di([ri({type:Ar.Choice})],Wu);let qu=class{constructor(e=0){_defineProperty(this,"value",void 0),this.value=e}toString(){return this.value.toString()}};di([ii({type:Sr.Integer})],qu.prototype,"value",void 0),qu=di([ri({type:Ar.Choice})],qu);let Gu=class extends Ls{};Gu=di([ri({type:Ar.Sequence})],Gu);let Ju=class extends xi{};Ju=di([ri({type:Ar.Choice})],Ju);let Xu=Cu=class extends ms{constructor(e){super(e),Object.setPrototypeOf(this,Cu.prototype)}};Xu=Cu=di([ri({type:Ar.Sequence})],Xu);let Zu=Pu=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,Pu.prototype)}};Zu=Pu=di([ri({type:Ar.Set,itemType:_s})],Zu);let Yu=class{constructor(e=""){_defineProperty(this,"value",void 0),this.value=e}toString(){return this.value}};di([ii({type:Sr.BmpString})],Yu.prototype,"value",void 0),Yu=di([ri({type:Ar.Choice})],Yu);let Qu=class extends hs{};Qu=di([ri({type:Ar.Sequence})],Qu);let ep=Eu=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,Eu.prototype)}};ep=Eu=di([ri({type:Ar.Sequence,itemType:Qu})],ep);class tp extends cl{constructor(...e){let t,i;if(r.isBufferSource(e[0]))t=r.toArrayBuffer(e[0]),i=e[1];else{const n=e[0],s=Array.isArray(e[1])?e[1].map(e=>r.toArrayBuffer(e)):[];t=ci.serialize(new ts({type:n,values:s})),i=pl}super(t,ts,i)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Value=this.values.map(e=>new tl("",{"":e})),e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty();return e[tl.NAME]===tp.NAME&&(e[tl.NAME]=il.toString(this.type)),e}}tp.NAME="Attribute";class rp extends tp{constructor(...e){var t;if(r.isBufferSource(e[0]))super(e[0],e[1]);else{const t=new Ju({printableString:e[0]});super(Nu,[ci.serialize(t)])}null!==(t=this.password)&&void 0!==t||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){const e=ci.parse(this.values[0],Ju,this.parseOptions);this.password=e.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[tl.VALUE]=this.password,e}}rp.NAME="Challenge Password";class ip extends tp{constructor(...e){var t;if(r.isBufferSource(e[0]))super(e[0],e[1]);else{const t=e[0],r=new ms;for(const e of t)r.push(ci.parse(e.rawData,vs,pl));super(Iu,[ci.serialize(r)])}null!==(t=this.items)&&void 0!==t||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){const e=ci.parse(this.values[0],ms,this.parseOptions);this.items=e.map(e=>Zl.create(ci.serialize(e),this.parseOptions))}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.items.map(e=>e.toTextObject());for(const r of t)e[r[tl.NAME]]=r;return e}}ip.NAME="Extensions";class np{static register(e,t){this.items.set(e,t)}static create(e,t){const r=new tp(e,t),i=this.items.get(r.type);return i?new i(e,t):r}}np.items=new Map;const sp="crypto.signatureFormatter";class op{toAsnSignature(e,t){return r.toArrayBuffer(t)}toWebSignature(e,t){return r.toArrayBuffer(t)}}var ap;e.RsaAlgorithm=ap=class{static createPssParams(e,t){const r=ap.getHashAlgorithm(e);return r?new Wa({hashAlgorithm:r,maskGenAlgorithm:new hs({algorithm:Ha,parameters:ci.serialize(r)}),saltLength:t}):null}static getHashAlgorithm(e){const t=vc.resolve(Ac);return"string"==typeof e?t.toAsnAlgorithm({name:e}):"object"==typeof e&&e&&"name"in e?t.toAsnAlgorithm(e):null}toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if(!("hash"in e))return new hs({algorithm:Sa,parameters:null});{let t;if("string"==typeof e.hash)t=e.hash;else{if(!e.hash||"object"!=typeof e.hash||!("name"in e.hash)||"string"!=typeof e.hash.name)throw new Error("Cannot get hash algorithm name");t=e.hash.name.toUpperCase()}switch(t.toLowerCase()){case"sha-1":return new hs({algorithm:Ea,parameters:null});case"sha-256":return new hs({algorithm:Na,parameters:null});case"sha-384":return new hs({algorithm:Ia,parameters:null});case"sha-512":return new hs({algorithm:Ta,parameters:null})}}break;case"rsa-pss":if("hash"in e){if(!("saltLength"in e)||"number"!=typeof e.saltLength)throw new Error("Cannot get 'saltLength' from 'alg' argument");const t=ap.createPssParams(e.hash,e.saltLength);if(!t)throw new Error("Cannot create PSS parameters");return new hs({algorithm:ka,parameters:ci.serialize(t)})}return new hs({algorithm:ka,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case Sa:return{name:"RSASSA-PKCS1-v1_5"};case Ea:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case Na:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case Ia:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case Ta:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case ka:if(e.parameters){const t=ci.parse(e.parameters,Wa);return{name:"RSA-PSS",hash:vc.resolve(Ac).toWebAlgorithm(t.hashAlgorithm),saltLength:t.saltLength}}return{name:"RSA-PSS"}}return null}},e.RsaAlgorithm=ap=di([mc()],e.RsaAlgorithm),vc.registerSingleton(bc,e.RsaAlgorithm),e.ShaAlgorithm=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new hs({algorithm:Ua});case"sha-256":return new hs({algorithm:Da});case"sha-384":return new hs({algorithm:Ra});case"sha-512":return new hs({algorithm:Va})}return null}toWebAlgorithm(e){switch(e.algorithm){case Ua:return{name:"SHA-1"};case Da:return{name:"SHA-256"};case Ra:return{name:"SHA-384"};case Va:return{name:"SHA-512"}}return null}},e.ShaAlgorithm=di([mc()],e.ShaAlgorithm),vc.registerSingleton(bc,e.ShaAlgorithm);class cp{addPadding(e,t){const i=r.toUint8Array(t),n=new Uint8Array(e);return n.set(i,e-i.length),n.buffer}removePadding(e,t=!1){let i=r.toUint8Array(e);for(let e=0;e127){const e=new Uint8Array(i.length+1);return e.set(i,1),e.buffer}return i.buffer}toAsnSignature(e,t){if("ECDSA"===e.name){const i=e.namedCurve,n=cp.namedCurveSize.get(i)||cp.defaultNamedCurveSize,s=new wa,o=r.toUint8Array(t);return s.r=this.removePadding(o.slice(0,n),!0),s.s=this.removePadding(o.slice(n,n+n),!0),ci.serialize(s)}return null}toWebSignature(e,t){if("ECDSA"===e.name){const r=ci.parse(t,wa),i=e.namedCurve,n=cp.namedCurveSize.get(i)||cp.defaultNamedCurveSize;return function(...e){const t=e.map(e=>e.byteLength).reduce((e,t)=>e+t),r=new Uint8Array(t);let i=0;return e.map(e=>new Uint8Array(e)).forEach(e=>{for(const t of e)r[i++]=t}),r.buffer}(this.addPadding(n,this.removePadding(r.r)),this.addPadding(n,this.removePadding(r.s)))}return null}}cp.namedCurveSize=new Map,cp.defaultNamedCurveSize=32;const lp="1.3.101.110",up="1.3.101.111",pp="1.3.101.112",hp="1.3.101.113";var fp,dp;e.EdAlgorithm=class{toAsnAlgorithm(e){let t=null;switch(e.name.toLowerCase()){case"ed25519":t=pp;break;case"x25519":t=lp;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":t=pp;break;case"ed448":t=hp}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":t=lp;break;case"x448":t=up}}return t?new hs({algorithm:t}):null}toWebAlgorithm(e){switch(e.algorithm){case pp:return{name:"Ed25519"};case hp:return{name:"EdDSA",namedCurve:"Ed448"};case lp:return{name:"X25519"};case up:return{name:"ECDH-ES",namedCurve:"X448"}}return null}},e.EdAlgorithm=di([mc()],e.EdAlgorithm),vc.registerSingleton(bc,e.EdAlgorithm);let yp=fp=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,fp.prototype)}};yp=fp=di([ri({type:Ar.Sequence,itemType:hs})],yp);let gp=dp=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,dp.prototype)}};var vp,mp;gp=dp=di([ri({type:Ar.Sequence,itemType:Sr.BitString})],gp),function(e){e[e.v1=0]="v1",e[e.v2=1]="v2"}(mp||(mp={}));let bp=class extends hs{};bp=di([ri({type:Ar.Sequence})],bp);let wp=class{constructor(){_defineProperty(this,"version",mp.v1),_defineProperty(this,"privateKeyAlgorithm",new hs),_defineProperty(this,"privateKey",new ArrayBuffer(0)),_defineProperty(this,"attributes",void 0),_defineProperty(this,"publicKey",void 0)}};di([ii({type:Sr.Integer})],wp.prototype,"version",void 0),di([ii({type:hs})],wp.prototype,"privateKeyAlgorithm",void 0),di([ii({type:Sr.OctetString})],wp.prototype,"privateKey",void 0),di([ii({type:gu,context:0,implicit:!0,optional:!0})],wp.prototype,"attributes",void 0),di([ii({type:Sr.BitString,context:1,implicit:!0,optional:!0})],wp.prototype,"publicKey",void 0),wp=di([ri({type:Ar.Sequence})],wp);let Ap=class extends wp{};Ap=di([ri({type:Ar.Sequence})],Ap);let Sp=vp=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,vp.prototype)}};var xp,Bp;Sp=vp=di([ri({type:Ar.Sequence,itemType:wp})],Sp);let kp=class extends hs{};kp=di([ri({type:Ar.Sequence})],kp);let Cp=xp=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,xp.prototype)}};Cp=xp=di([ri({type:Ar.Sequence,itemType:fs})],Cp);let Pp=Bp=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,Bp.prototype)}};Pp=Bp=di([ri({type:Ar.Sequence,itemType:wp})],Pp);const Ep="2.16.840.1.101.3.4.3",Op=`${Ep}.17`,Np=`${Ep}.18`,Ip=`${Ep}.19`,Tp=`${Ep}.20`,jp=`${Ep}.21`,_p=`${Ep}.22`,Up=`${Ep}.23`,Lp=`${Ep}.24`,Dp=`${Ep}.25`,Rp=`${Ep}.26`,Vp=`${Ep}.27`,Hp=`${Ep}.28`,$p=`${Ep}.29`,Mp=`${Ep}.30`,Kp=`${Ep}.31`;var Fp;e.MlDsaAlgorithm=class{toAsnAlgorithm(e){let t=null;switch(e.name.toLowerCase()){case"ml-dsa-44":t=Op;break;case"ml-dsa-65":t=Np;break;case"ml-dsa-87":t=Ip}return t?new hs({algorithm:t}):null}toWebAlgorithm(e){switch(e.algorithm){case Op:return{name:"ML-DSA-44"};case Np:return{name:"ML-DSA-65"};case Ip:return{name:"ML-DSA-87"}}return null}},e.MlDsaAlgorithm=di([mc()],e.MlDsaAlgorithm),vc.registerSingleton(bc,e.MlDsaAlgorithm),e.SlhDsaAlgorithm=class{toAsnAlgorithm(e){let t=null;switch(e.name.toLowerCase()){case"slh-dsa-sha2-128s":t=Tp;break;case"slh-dsa-sha2-128f":t=jp;break;case"slh-dsa-sha2-192s":t=_p;break;case"slh-dsa-sha2-192f":t=Up;break;case"slh-dsa-sha2-256s":t=Lp;break;case"slh-dsa-sha2-256f":t=Dp;break;case"slh-dsa-shake-128s":t=Rp;break;case"slh-dsa-shake-128f":t=Vp;break;case"slh-dsa-shake-192s":t=Hp;break;case"slh-dsa-shake-192f":t=$p;break;case"slh-dsa-shake-256s":t=Mp;break;case"slh-dsa-shake-256f":t=Kp}return t?new hs({algorithm:t}):null}toWebAlgorithm(e){switch(e.algorithm){case Tp:return{name:"SLH-DSA-SHA2-128s"};case jp:return{name:"SLH-DSA-SHA2-128f"};case _p:return{name:"SLH-DSA-SHA2-192s"};case Up:return{name:"SLH-DSA-SHA2-192f"};case Lp:return{name:"SLH-DSA-SHA2-256s"};case Dp:return{name:"SLH-DSA-SHA2-256f"};case Rp:return{name:"SLH-DSA-SHAKE-128s"};case Vp:return{name:"SLH-DSA-SHAKE-128f"};case Hp:return{name:"SLH-DSA-SHAKE-192s"};case $p:return{name:"SLH-DSA-SHAKE-192f"};case Mp:return{name:"SLH-DSA-SHAKE-256s"};case Kp:return{name:"SLH-DSA-SHAKE-256f"}}return null}},e.SlhDsaAlgorithm=di([mc()],e.SlhDsaAlgorithm),vc.registerSingleton(bc,e.SlhDsaAlgorithm);let zp=Fp=class extends ai{constructor(e){super(e),Object.setPrototypeOf(this,Fp.prototype)}};zp=Fp=di([ri({type:Ar.Sequence,itemType:ts})],zp);class Wp{constructor(e={}){_defineProperty(this,"version",0),_defineProperty(this,"subject",new Ei),_defineProperty(this,"subjectPKInfo",new fs),_defineProperty(this,"attributes",new zp),Object.assign(this,e)}}di([ii({type:Sr.Integer})],Wp.prototype,"version",void 0),di([ii({type:Ei})],Wp.prototype,"subject",void 0),di([ii({type:fs})],Wp.prototype,"subjectPKInfo",void 0),di([ii({type:zp,implicit:!0,context:0,optional:!0})],Wp.prototype,"attributes",void 0);class qp{constructor(e={}){_defineProperty(this,"certificationRequestInfo",new Wp),_defineProperty(this,"certificationRequestInfoRaw",void 0),_defineProperty(this,"signatureAlgorithm",new hs),_defineProperty(this,"signature",new ArrayBuffer(0)),Object.assign(this,e)}}var Gp,Jp,Xp,Zp,Yp,Qp,eh,th,rh,ih,nh,sh,oh,ah,ch,lh,uh,ph,hh,fh,dh,yh,gh,vh,mh,bh,wh,Ah,Sh,xh,Bh,kh,Ch,Ph;di([ii({type:Wp,raw:!0})],qp.prototype,"certificationRequestInfo",void 0),di([ii({type:hs})],qp.prototype,"signatureAlgorithm",void 0),di([ii({type:Sr.BitString})],qp.prototype,"signature",void 0);class Eh extends Kl{get subjectName(){return wi(this,Jp,"f")||Ai(this,Jp,new wl(this.asn.certificationRequestInfo.subject),"f"),wi(this,Jp,"f")}get subject(){return wi(this,Xp,"f")||Ai(this,Xp,this.subjectName.toString(),"f"),wi(this,Xp,"f")}get signatureAlgorithm(){if(!wi(this,Zp,"f")){const e=vc.resolve(Ac);Ai(this,Zp,e.toWebAlgorithm(this.asn.signatureAlgorithm),"f")}return wi(this,Zp,"f")}get signature(){return wi(this,Yp,"f")||Ai(this,Yp,this.asn.signature,"f"),wi(this,Yp,"f")}get publicKey(){return wi(this,Qp,"f")||Ai(this,Qp,new Fl(this.asn.certificationRequestInfo.subjectPKInfo,this.parseOptions),"f"),wi(this,Qp,"f")}get attributes(){return wi(this,eh,"f")||Ai(this,eh,this.asn.certificationRequestInfo.attributes.map(e=>np.create(ci.serialize(e),this.parseOptions)),"f"),wi(this,eh,"f")}get extensions(){if(!wi(this,th,"f")){Ai(this,th,[],"f");const e=this.getAttribute(Iu);e instanceof ip&&Ai(this,th,e.items,"f")}return wi(this,th,"f")}get tbs(){return wi(this,Gp,"f")||Ai(this,Gp,this.asn.certificationRequestInfoRaw||ci.serialize(this.asn.certificationRequestInfo),"f"),wi(this,Gp,"f")}constructor(e,t){const r=Kl.isAsnEncoded(e)?[e,qp,t]:[e,t];super(r[0],r[1],r[2]),Gp.set(this,void 0),Jp.set(this,void 0),Xp.set(this,void 0),Zp.set(this,void 0),Yp.set(this,void 0),Qp.set(this,void 0),eh.set(this,void 0),th.set(this,void 0),this.tag=Ml.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=ul.get()){const t={...this.publicKey.algorithm,...this.signatureAlgorithm},r=await this.publicKey.export(t,["verify"],e),i=vc.resolveAll(sp).reverse();let n=null;for(const e of i)if(n=e.toWebSignature(t,this.signature),n)break;if(!n)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await e.subtle.verify(this.signatureAlgorithm,r,n,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),t=ci.parse(this.rawData,qp,this.parseOptions),r=t.certificationRequestInfo,i=new tl("",{Version:`${bs[r.version]} (${r.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const e=new tl("");for(const t of this.attributes){const r=t.toTextObject();e[r[tl.NAME]]=r}i.Attributes=e}return e.Data=i,e.Signature=new tl("",{Algorithm:nl.serializeAlgorithm(t.signatureAlgorithm),"":t.signature}),e}}Gp=new WeakMap,Jp=new WeakMap,Xp=new WeakMap,Zp=new WeakMap,Yp=new WeakMap,Qp=new WeakMap,eh=new WeakMap,th=new WeakMap,Eh.NAME="PKCS#10 Certificate Request";class Oh extends Kl{get publicKey(){return wi(this,fh,"f")||Ai(this,fh,new Fl(this.asn.tbsCertificate.subjectPublicKeyInfo,this.parseOptions),"f"),wi(this,fh,"f")}get serialNumber(){return wi(this,ih,"f")||Ai(this,ih,dl(this.asn.tbsCertificate.serialNumber),"f"),wi(this,ih,"f")}get subjectName(){return wi(this,nh,"f")||Ai(this,nh,new wl(this.asn.tbsCertificate.subject),"f"),wi(this,nh,"f")}get subject(){return wi(this,sh,"f")||Ai(this,sh,this.subjectName.toString(),"f"),wi(this,sh,"f")}get issuerName(){return wi(this,oh,"f")||Ai(this,oh,new wl(this.asn.tbsCertificate.issuer),"f"),wi(this,oh,"f")}get issuer(){return wi(this,ah,"f")||Ai(this,ah,this.issuerName.toString(),"f"),wi(this,ah,"f")}get notBefore(){if(!wi(this,ch,"f")){const e=this.asn.tbsCertificate.validity.notBefore.utcTime||this.asn.tbsCertificate.validity.notBefore.generalTime;if(!e)throw new Error("Cannot get 'notBefore' value");Ai(this,ch,e,"f")}return wi(this,ch,"f")}get notAfter(){if(!wi(this,lh,"f")){const e=this.asn.tbsCertificate.validity.notAfter.utcTime||this.asn.tbsCertificate.validity.notAfter.generalTime;if(!e)throw new Error("Cannot get 'notAfter' value");Ai(this,lh,e,"f")}return wi(this,lh,"f")}get signatureAlgorithm(){if(!wi(this,uh,"f")){const e=vc.resolve(Ac);Ai(this,uh,e.toWebAlgorithm(this.asn.signatureAlgorithm),"f")}return wi(this,uh,"f")}get signature(){return wi(this,ph,"f")||Ai(this,ph,this.asn.signatureValue,"f"),wi(this,ph,"f")}get extensions(){return wi(this,hh,"f")||(Ai(this,hh,[],"f"),this.asn.tbsCertificate.extensions&&Ai(this,hh,this.asn.tbsCertificate.extensions.map(e=>Zl.create(ci.serialize(e),this.parseOptions)),"f")),wi(this,hh,"f")}get tbs(){return wi(this,rh,"f")||Ai(this,rh,this.asn.tbsCertificateRaw||ci.serialize(this.asn.tbsCertificate),"f"),wi(this,rh,"f")}constructor(e,t){const r=Kl.isAsnEncoded(e)?[e,As,t]:[e,t];super(r[0],r[1],r[2]),rh.set(this,void 0),ih.set(this,void 0),nh.set(this,void 0),sh.set(this,void 0),oh.set(this,void 0),ah.set(this,void 0),ch.set(this,void 0),lh.set(this,void 0),uh.set(this,void 0),ph.set(this,void 0),hh.set(this,void 0),fh.set(this,void 0),this.tag=Ml.CertificateTag}onInit(e){}getExtension(e){for(const t of this.extensions)if("string"==typeof e){if(t.type===e)return t}else if(t instanceof e)return t;return null}getExtensions(e){return this.extensions.filter(t=>"string"==typeof e?t.type===e:t instanceof e)}async verify(e={},t=ul.get()){let i,n;const s=e.publicKey;try{if(s)if("publicKey"in s)i={...s.publicKey.algorithm,...this.signatureAlgorithm},n=await s.publicKey.export(i,["verify"],t);else if(s instanceof Fl)i={...s.algorithm,...this.signatureAlgorithm},n=await s.export(i,["verify"],t);else if(r.isBufferSource(s)){const e=new Fl(s);i={...e.algorithm,...this.signatureAlgorithm},n=await e.export(i,["verify"],t)}else i={...s.algorithm,...this.signatureAlgorithm},n=s;else i={...this.publicKey.algorithm,...this.signatureAlgorithm},n=await this.publicKey.export(i,["verify"],t)}catch(e){return!1}const o=vc.resolveAll(sp).reverse();let a=null;for(const e of o)if(a=e.toWebSignature(i,this.signature),a)break;if(!a)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const c=await t.subtle.verify(this.signatureAlgorithm,n,a,this.tbs);if(e.signatureOnly)return c;{const t=(e.date||new Date).getTime();return c&&this.notBefore.getTime()new vo({certificate:ci.parse(e.rawData,As,wi(this,dh,"f"))})));const r=new bo({contentType:Xo,content:ci.serialize(t)}),i=ci.serialize(r);return"raw"===e?i:this.toString(e)}import(e,t){const r=Kl.toArrayBuffer(e),i=ci.parse(r,bo,t);if(i.contentType!==Xo)throw new TypeError("Cannot parse CMS package. Incoming data is not a SignedData object.");const n=ci.parse(i.content,Qo,t),s=[];for(const e of n.certificates||[])e.certificate&&s.push(new Oh(e.certificate,t));this.clear();for(const e of s)this.push(e);Ai(this,dh,t,"f")}clear(){for(;this.pop(););}toString(e="pem"){const t=this.export("raw");switch(e){case"pem":return Ml.encode(t,"CMS");case"pem-chain":return this.map(e=>e.toString("pem")).join("\n");case"asn":return ci.toString(t,wi(this,dh,"f"));case"hex":return l.ToHex(t);case"base64":return l.ToBase64(t);case"base64url":return l.ToBase64Url(t);case"text":return nl.serialize(this.toTextObject());default:throw TypeError("Argument 'format' is unsupported value")}}toTextObject(){const e=ci.parse(this.export("raw"),bo,wi(this,dh,"f")),t=ci.parse(e.content,Qo,wi(this,dh,"f"));return new tl("X509Certificates",{"Content Type":il.toString(e.contentType),Content:new tl("",{Version:`${Ps[t.version]} (${t.version})`,Certificates:new tl("",{Certificate:this.map(e=>e.toTextObject())})})})}}dh=new WeakMap;e.X509CrlReason=void 0,(wh=e.X509CrlReason||(e.X509CrlReason={}))[wh.unspecified=0]="unspecified",wh[wh.keyCompromise=1]="keyCompromise",wh[wh.cACompromise=2]="cACompromise",wh[wh.affiliationChanged=3]="affiliationChanged",wh[wh.superseded=4]="superseded",wh[wh.cessationOfOperation=5]="cessationOfOperation",wh[wh.certificateHold=6]="certificateHold",wh[wh.removeFromCRL=8]="removeFromCRL",wh[wh.privilegeWithdrawn=9]="privilegeWithdrawn",wh[wh.aACompromise=10]="aACompromise";class Ih extends cl{get serialNumber(){return wi(this,yh,"f")||Ai(this,yh,dl(this.asn.userCertificate),"f"),wi(this,yh,"f")}get revocationDate(){return wi(this,gh,"f")||Ai(this,gh,this.asn.revocationDate.getTime(),"f"),wi(this,gh,"f")}get reason(){return void 0===wi(this,vh,"f")&&this.extensions,wi(this,vh,"f")}get invalidity(){return void 0===wi(this,mh,"f")&&this.extensions,wi(this,mh,"f")}get extensions(){return wi(this,bh,"f")||(Ai(this,bh,[],"f"),this.asn.crlEntryExtensions&&Ai(this,bh,this.asn.crlEntryExtensions.map(e=>{const t=Zl.create(ci.serialize(e),this.parseOptions);switch(t.type){case xn:void 0===wi(this,vh,"f")&&Ai(this,vh,ci.parse(t.value,kn,this.parseOptions).reason,"f");break;case Ln:void 0===wi(this,mh,"f")&&Ai(this,mh,ci.parse(t.value,Dn,this.parseOptions).value,"f")}return t}),"f")),wi(this,bh,"f")}constructor(...e){let t,i;if(r.isBufferSource(e[0])?(t=r.toArrayBuffer(e[0]),i=e[1]):"string"==typeof e[0]?t=ci.serialize(new Ss({userCertificate:fl(e[0]),revocationDate:new ds(e[1]),crlEntryExtensions:e[2]})):e[0]instanceof Ss&&(t=e[0],i=e[1]),!t)throw new TypeError("Cannot create X509CrlEntry instance. Wrong constructor arguments.");const n=t instanceof Ss?[t,i]:[t,Ss,i];super(n[0],n[1],n[2]),yh.set(this,void 0),gh.set(this,void 0),vh.set(this,void 0),mh.set(this,void 0),bh.set(this,void 0)}onInit(e){}}yh=new WeakMap,gh=new WeakMap,vh=new WeakMap,mh=new WeakMap,bh=new WeakMap;class Th extends Kl{get version(){return this.asn.tbsCertList.version}get signatureAlgorithm(){if(!wi(this,Sh,"f")){const e=vc.resolve(Ac);Ai(this,Sh,e.toWebAlgorithm(this.asn.signatureAlgorithm),"f")}return wi(this,Sh,"f")}get signature(){return this.asn.signature}get issuer(){return this.issuerName.toString()}get issuerName(){return wi(this,xh,"f")||Ai(this,xh,new wl(this.asn.tbsCertList.issuer),"f"),wi(this,xh,"f")}get thisUpdate(){if(!wi(this,Bh,"f")){const e=this.asn.tbsCertList.thisUpdate.getTime();if(!e)throw new Error("Cannot get 'thisUpdate' value");Ai(this,Bh,e,"f")}return wi(this,Bh,"f")}get nextUpdate(){var e;return void 0===wi(this,kh,"f")&&Ai(this,kh,(null===(e=this.asn.tbsCertList.nextUpdate)||void 0===e?void 0:e.getTime())||void 0,"f"),wi(this,kh,"f")}get entries(){var e;return wi(this,Ch,"f")||Ai(this,Ch,(null===(e=this.asn.tbsCertList.revokedCertificates)||void 0===e?void 0:e.map(e=>new Ih(e,this.parseOptions)))||[],"f"),wi(this,Ch,"f")}get extensions(){return wi(this,Ph,"f")||(Ai(this,Ph,[],"f"),this.asn.tbsCertList.crlExtensions&&Ai(this,Ph,this.asn.tbsCertList.crlExtensions.map(e=>Zl.create(ci.serialize(e),this.parseOptions)),"f")),wi(this,Ph,"f")}get tbs(){return wi(this,Ah,"f")||Ai(this,Ah,this.asn.tbsCertListRaw||ci.serialize(this.asn.tbsCertList),"f"),wi(this,Ah,"f")}get tbsCertListSignatureAlgorithm(){return this.asn.tbsCertList.signature}get certListSignatureAlgorithm(){return this.asn.signatureAlgorithm}constructor(e,t){const r=Kl.isAsnEncoded(e)?[e,Bs,t]:[e,t];super(r[0],r[1],r[2]),this.tag=Ml.CrlTag,Ah.set(this,void 0),Sh.set(this,void 0),xh.set(this,void 0),Bh.set(this,void 0),kh.set(this,void 0),Ch.set(this,void 0),Ph.set(this,void 0)}onInit(e){}getExtension(e){for(const t of this.extensions)if("string"==typeof e){if(t.type===e)return t}else if(t instanceof e)return t;return null}getExtensions(e){return this.extensions.filter(t=>"string"==typeof e?t.type===e:t instanceof e)}async verify(e,t=ul.get()){if(!this.certListSignatureAlgorithm.isEqual(this.tbsCertListSignatureAlgorithm))throw new Error("algorithm identifier in the sequence tbsCertList and CertificateList mismatch");let r,i;const n=e.publicKey;try{n instanceof Oh?(r={...n.publicKey.algorithm,...n.signatureAlgorithm},i=await n.publicKey.export(r,["verify"])):n instanceof Fl?(r={...n.algorithm,...this.signatureAlgorithm},i=await n.export(r,["verify"])):(r={...n.algorithm,...this.signatureAlgorithm},i=n)}catch(e){return!1}const s=vc.resolveAll(sp).reverse();let o=null;for(const e of s)if(o=e.toWebSignature(r,this.signature),o)break;if(!o)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return await t.subtle.verify(this.signatureAlgorithm,i,o,this.tbs)}async getThumbprint(e,t){let r,i="SHA-1";return e&&("object"==typeof e&&"subtle"in e?r=e:(i=e,r=t)),null!=r||(r=ul.get()),await r.subtle.digest(i,this.rawData)}findRevoked(e){const t=fl("string"==typeof e?e:e.serialNumber);for(const e of this.asn.tbsCertList.revokedCertificates||[])if(r.isEqual(e.userCertificate,t))return new Ih(ci.serialize(e),this.parseOptions);return null}}Ah=new WeakMap,Sh=new WeakMap,xh=new WeakMap,Bh=new WeakMap,kh=new WeakMap,Ch=new WeakMap,Ph=new WeakMap;return Zl.register(Gi,Wl),Zl.register(Pn,ql),Zl.register($n,Gl),Zl.register(ns,Jl),Zl.register(zi,zl),Zl.register(Qn,Xl),Zl.register(dn,Ql),Zl.register(Mi,eu),Zl.register(Vn,iu),np.register(Nu,rp),np.register(Iu,ip),vc.registerSingleton(sp,op),vc.registerSingleton(sp,cp),cp.namedCurveSize.set("P-256",32),cp.namedCurveSize.set("K-256",32),cp.namedCurveSize.set("P-384",48),cp.namedCurveSize.set("P-521",66),e.AlgorithmProvider=wc,e.AsnData=cl,e.AsnDefaultSignatureFormatter=op,e.AsnEcSignatureFormatter=cp,e.Attribute=tp,e.AttributeFactory=np,e.AuthorityInfoAccessExtension=eu,e.AuthorityKeyIdentifierExtension=zl,e.BasicConstraintsExtension=Wl,e.CRLDistributionPointsExtension=Ql,e.CertificatePolicyExtension=Yl,e.ChallengePasswordAttribute=rp,e.CryptoProvider=ll,e.DN=El,e.DNS=Pl,e.DefaultAlgorithmSerializer=rl,e.EMAIL=Ol,e.ExtendedKeyUsageExtension=ql,e.Extension=yl,e.ExtensionFactory=Zl,e.ExtensionsAttribute=ip,e.GUID=Tl,e.GeneralName=Ul,e.GeneralNames=Ll,e.IP=Nl,e.IssuerAlternativeNameExtension=iu,e.KeyUsagesExtension=Gl,e.Name=wl,e.NameIdentifier=vl,e.OidSerializer=il,e.PemConverter=Ml,e.PemData=Kl,e.Pkcs10CertificateRequest=Eh,e.Pkcs10CertificateRequestGenerator=class{static async create(e,t=ul.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 r=await t.subtle.exportKey("spki",e.keys.publicKey),i=new qp({certificationRequestInfo:new Wp({subjectPKInfo:ci.parse(r,fs,pl)})});if(e.name){const t=e.name instanceof wl?e.name:new wl(e.name);i.certificationRequestInfo.subject=ci.parse(t.toArrayBuffer(),Ei,pl)}if(e.attributes)for(const t of e.attributes)i.certificationRequestInfo.attributes.push(ci.parse(t.rawData,ts,pl));if(e.extensions&&e.extensions.length){const t=new ts({type:Iu}),r=new ms;for(const t of e.extensions)r.push(ci.parse(t.rawData,vs,pl));t.values.push(ci.serialize(r)),i.certificationRequestInfo.attributes.push(t)}const n={...e.signingAlgorithm,...e.keys.privateKey.algorithm},s=vc.resolve(Ac);i.signatureAlgorithm=s.toAsnAlgorithm(n);const o=ci.serialize(i.certificationRequestInfo),a=await t.subtle.sign(n,e.keys.privateKey,o),c=vc.resolveAll(sp).reverse();let l=null;for(const e of c)if(l=e.toAsnSignature(n,a),l)break;if(!l)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return i.signature=l,new Eh(ci.serialize(i),pl)}},e.PublicKey=Fl,e.REGISTERED_ID=_l,e.SubjectAlternativeNameExtension=Xl,e.SubjectKeyIdentifierExtension=Jl,e.TextConverter=nl,e.TextObject=tl,e.UPN=jl,e.URL=Il,e.X509Certificate=Oh,e.X509CertificateGenerator=class{static async createSelfSigned(e,t=ul.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=ul.get()){var i;let n,s=pl;e.publicKey instanceof Fl?n=e.publicKey.rawData:"publicKey"in e.publicKey?n=e.publicKey.publicKey.rawData:r.isBufferSource(e.publicKey)?(n=e.publicKey,s=void 0):n=await t.subtle.exportKey("spki",e.publicKey);const o=function(e,t=ul.get()){const i=r.toUint8Array(l.FromHex(e||""));return hl(i.length&&i.some(e=>e>0)?i:t.getRandomValues(new Uint8Array(16)))}(e.serialNumber,t),a=e.notBefore||new Date,c=e.notAfter||new Date(a.getTime()+31536e6),u=new As({tbsCertificate:new ws({version:bs.v3,serialNumber:o,validity:new ys({notBefore:a,notAfter:c}),extensions:new ms((null===(i=e.extensions)||void 0===i?void 0:i.map(e=>ci.parse(e.rawData,vs,pl)))||[]),subjectPublicKeyInfo:ci.parse(n,fs,s)})});if(e.subject){const t=e.subject instanceof wl?e.subject:new wl(e.subject);u.tbsCertificate.subject=ci.parse(t.toArrayBuffer(),Ei,pl)}if(e.issuer){const t=e.issuer instanceof wl?e.issuer:new wl(e.issuer);u.tbsCertificate.issuer=ci.parse(t.toArrayBuffer(),Ei,pl)}const p={hash:"SHA-256"},h="signingKey"in e?{...p,...e.signingAlgorithm,...e.signingKey.algorithm}:{...p,...e.signingAlgorithm},f=vc.resolve(Ac);u.tbsCertificate.signature=u.signatureAlgorithm=f.toAsnAlgorithm(h);const d=ci.serialize(u.tbsCertificate),y="signingKey"in e?await t.subtle.sign(h,e.signingKey,d):e.signature,g=vc.resolveAll(sp).reverse();let v=null;for(const e of g)if(v=e.toAsnSignature(h,y),v)break;if(!v)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return u.signatureValue=v,new Oh(ci.serialize(u),pl)}},e.X509Certificates=Nh,e.X509ChainBuilder=class{constructor(e={}){this.certificates=[],e.certificates&&(this.certificates=e.certificates)}async build(e,t=ul.get()){const r=new Nh(e);let i=e;for(;i=await this.findIssuer(i,t);){const e=await i.getThumbprint(t);for(const i of r){if(u(e,await i.getThumbprint(t)))throw new Error("Cannot build a certificate chain. Circular dependency.")}r.push(i)}return r}async findIssuer(e,t=ul.get()){if(!await e.isSelfSigned(t)){const r=e.getExtension(zi);for(const i of this.certificates)if(i.subject===e.issuer){if(r)if(r.keyId){const e=i.getExtension(ns);if(e&&e.keyId!==r.keyId)continue}else if(r.certId){const e=i.getExtension(Qn);if(e&&(r.certId.serialNumber!==i.serialNumber||!u(ci.serialize(r.certId.name),ci.serialize(e))))continue}try{const r={...i.publicKey.algorithm,...e.signatureAlgorithm},n=await i.publicKey.export(r,["verify"],t);if(!await e.verify({publicKey:n,signatureOnly:!0},t))continue}catch(e){continue}return i}}return null}},e.X509Crl=Th,e.X509CrlEntry=Ih,e.X509CrlGenerator=class{static async create(e,t=ul.get()){var r;const i=e.issuer instanceof wl?e.issuer:new wl(e.issuer),n=new Bs({tbsCertList:new xs({version:bs.v2,issuer:ci.parse(i.toArrayBuffer(),Ei,pl),thisUpdate:new ds(e.thisUpdate||new Date)})});if(e.nextUpdate&&(n.tbsCertList.nextUpdate=new ds(e.nextUpdate)),e.extensions&&e.extensions.length&&(n.tbsCertList.crlExtensions=new ms(e.extensions.map(e=>ci.parse(e.rawData,vs,pl))||[])),e.entries&&e.entries.length){n.tbsCertList.revokedCertificates=[];for(const t of e.entries){const i=fl(t.serialNumber);if(n.tbsCertList.revokedCertificates.findIndex(e=>u(e.userCertificate,i))>-1)throw new Error(`Certificate serial number ${t.serialNumber} already exists in tbsCertList`);const s=new Ss({userCertificate:i,revocationDate:new ds(t.revocationDate||new Date)});if("extensions"in t&&(null===(r=t.extensions)||void 0===r?void 0:r.length)?s.crlEntryExtensions=t.extensions.map(e=>ci.parse(e.rawData,vs,pl)):s.crlEntryExtensions=[],!(t instanceof Ih)&&(t.reason&&s.crlEntryExtensions.push(new vs({extnID:xn,critical:!1,extnValue:new Br(ci.serialize(new kn(t.reason)))})),t.invalidity&&s.crlEntryExtensions.push(new vs({extnID:Ln,critical:!1,extnValue:new Br(ci.serialize(new Dn(t.invalidity)))})),t.issuer)){const t=e.issuer instanceof wl?e.issuer:new wl(e.issuer);s.crlEntryExtensions.push(new vs({extnID:Qi,critical:!1,extnValue:new Br(ci.serialize(ci.parse(t.toArrayBuffer(),Ei,pl)))}))}n.tbsCertList.revokedCertificates.push(s)}}const s={...e.signingAlgorithm,...e.signingKey.algorithm},o=vc.resolve(Ac);n.tbsCertList.signature=n.signatureAlgorithm=o.toAsnAlgorithm(s);const a=ci.serialize(n.tbsCertList),c=await t.subtle.sign(s,e.signingKey,a),l=vc.resolveAll(sp).reverse();let p=null;for(const e of l)if(p=e.toAsnSignature(s,c),p)break;if(!p)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return n.signature=p,new Th(ci.serialize(n),pl)}},e.cryptoProvider=ul,e.diAlgorithm=bc,e.diAlgorithmProvider=Ac,e.diAsnSignatureFormatter=sp,e.idEd25519=pp,e.idEd448=hp,e.idX25519=lp,e.idX448=up,e}({});