@kong-ui-public/entities-certificates 3.6.0 → 3.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
13
|
and limitations under the License.
|
|
14
|
-
***************************************************************************** */var ta;(function(r){(function(e){var t=typeof globalThis=="object"?globalThis:typeof Pn=="object"?Pn:typeof self=="object"?self:typeof this=="object"?this:u(),i=n(r);typeof t.Reflect<"u"&&(i=n(t.Reflect,i)),e(i,t),typeof t.Reflect>"u"&&(t.Reflect=r);function n(f,d){return function(v,y){Object.defineProperty(f,v,{configurable:!0,writable:!0,value:y}),d&&d(v,y)}}function s(){try{return Function("return this;")()}catch{}}function c(){try{return(0,eval)("(function() { return this; })()")}catch{}}function u(){return s()||c()}})(function(e,t){var i=Object.prototype.hasOwnProperty,n=typeof Symbol=="function",s=n&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",c=n&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",u=typeof Object.create=="function",f={__proto__:[]}instanceof Array,d=!u&&!f,v={create:u?function(){return Xs(Object.create(null))}:f?function(){return Xs({__proto__:null})}:function(){return Xs({})},has:d?function(g,b){return i.call(g,b)}:function(g,b){return b in g},get:d?function(g,b){return i.call(g,b)?g[b]:void 0}:function(g,b){return g[b]}},y=Object.getPrototypeOf(Function),z=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:ap(),O=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:cp(),p=typeof WeakMap=="function"?WeakMap:lp(),m=n?Symbol.for("@reflect-metadata:registry"):void 0,S=np(),w=op(S);function I(g,b,A,N){if(W(A)){if(!ve(g))throw new TypeError;if(!be(b))throw new TypeError;return Be(g,b)}else{if(!ve(g))throw new TypeError;if(!H(b))throw new TypeError;if(!H(N)&&!W(N)&&!J(N))throw new TypeError;return J(N)&&(N=void 0),A=Y(A),ce(g,b,A,N)}}e("decorate",I);function k(g,b){function A(N,G){if(!H(N))throw new TypeError;if(!W(G)&&!Ar(G))throw new TypeError;br(g,b,N,G)}return A}e("metadata",k);function B(g,b,A,N){if(!H(A))throw new TypeError;return W(N)||(N=Y(N)),br(g,b,A,N)}e("defineMetadata",B);function Z(g,b,A){if(!H(b))throw new TypeError;return W(A)||(A=Y(A)),pe(g,b,A)}e("hasMetadata",Z);function se(g,b,A){if(!H(b))throw new TypeError;return W(A)||(A=Y(A)),at(g,b,A)}e("hasOwnMetadata",se);function D(g,b,A){if(!H(b))throw new TypeError;return W(A)||(A=Y(A)),ee(g,b,A)}e("getMetadata",D);function C(g,b,A){if(!H(b))throw new TypeError;return W(A)||(A=Y(A)),bt(g,b,A)}e("getOwnMetadata",C);function j(g,b){if(!H(g))throw new TypeError;return W(b)||(b=Y(b)),wr(g,b)}e("getMetadataKeys",j);function de(g,b){if(!H(g))throw new TypeError;return W(b)||(b=Y(b)),Gt(g,b)}e("getOwnMetadataKeys",de);function re(g,b,A){if(!H(b))throw new TypeError;if(W(A)||(A=Y(A)),!H(b))throw new TypeError;W(A)||(A=Y(A));var N=ii(b,A,!1);return W(N)?!1:N.OrdinaryDeleteMetadata(g,b,A)}e("deleteMetadata",re);function Be(g,b){for(var A=g.length-1;A>=0;--A){var N=g[A],G=N(b);if(!W(G)&&!J(G)){if(!be(G))throw new TypeError;b=G}}return b}function ce(g,b,A,N){for(var G=g.length-1;G>=0;--G){var he=g[G],we=he(b,A,N);if(!W(we)&&!J(we)){if(!H(we))throw new TypeError;N=we}}return N}function pe(g,b,A){var N=at(g,b,A);if(N)return!0;var G=Qs(b);return J(G)?!1:pe(g,G,A)}function at(g,b,A){var N=ii(b,A,!1);return W(N)?!1:Ue(N.OrdinaryHasOwnMetadata(g,b,A))}function ee(g,b,A){var N=at(g,b,A);if(N)return bt(g,b,A);var G=Qs(b);if(!J(G))return ee(g,G,A)}function bt(g,b,A){var N=ii(b,A,!1);if(!W(N))return N.OrdinaryGetOwnMetadata(g,b,A)}function br(g,b,A,N){var G=ii(A,N,!0);G.OrdinaryDefineOwnMetadata(g,b,A,N)}function wr(g,b){var A=Gt(g,b),N=Qs(g);if(N===null)return A;var G=wr(N,b);if(G.length<=0)return A;if(A.length<=0)return G;for(var he=new O,we=[],X=0,V=A;X<V.length;X++){var L=V[X],$=he.has(L);$||(he.add(L),we.push(L))}for(var K=0,te=G;K<te.length;K++){var L=te[K],$=he.has(L);$||(he.add(L),we.push(L))}return we}function Gt(g,b){var A=ii(g,b,!1);return A?A.OrdinaryOwnMetadataKeys(g,b):[]}function wt(g){if(g===null)return 1;switch(typeof g){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return g===null?1:6;default:return 6}}function W(g){return g===void 0}function J(g){return g===null}function R(g){return typeof g=="symbol"}function H(g){return typeof g=="object"?g!==null:typeof g=="function"}function ae(g,b){switch(wt(g)){case 0:return g;case 1:return g;case 2:return g;case 3:return g;case 4:return g;case 5:return g}var A=b===3?"string":b===5?"number":"default",N=Au(g,s);if(N!==void 0){var G=N.call(g,A);if(H(G))throw new TypeError;return G}return Ne(g,A==="default"?"number":A)}function Ne(g,b){if(b==="string"){var A=g.toString;if(q(A)){var N=A.call(g);if(!H(N))return N}var G=g.valueOf;if(q(G)){var N=G.call(g);if(!H(N))return N}}else{var G=g.valueOf;if(q(G)){var N=G.call(g);if(!H(N))return N}var he=g.toString;if(q(he)){var N=he.call(g);if(!H(N))return N}}throw new TypeError}function Ue(g){return!!g}function Sr(g){return""+g}function Y(g){var b=ae(g,3);return R(b)?b:Sr(b)}function ve(g){return Array.isArray?Array.isArray(g):g instanceof Object?g instanceof Array:Object.prototype.toString.call(g)==="[object Array]"}function q(g){return typeof g=="function"}function be(g){return typeof g=="function"}function Ar(g){switch(wt(g)){case 3:return!0;case 4:return!0;default:return!1}}function Zs(g,b){return g===b||g!==g&&b!==b}function Au(g,b){var A=g[b];if(A!=null){if(!q(A))throw new TypeError;return A}}function ku(g){var b=Au(g,c);if(!q(b))throw new TypeError;var A=b.call(g);if(!H(A))throw new TypeError;return A}function xu(g){return g.value}function Cu(g){var b=g.next();return b.done?!1:b}function Bu(g){var b=g.return;b&&b.call(g)}function Qs(g){var b=Object.getPrototypeOf(g);if(typeof g!="function"||g===y||b!==y)return b;var A=g.prototype,N=A&&Object.getPrototypeOf(A);if(N==null||N===Object.prototype)return b;var G=N.constructor;return typeof G!="function"||G===g?b:G}function ip(){var g;!W(m)&&typeof t.Reflect<"u"&&!(m in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(g=sp(t.Reflect));var b,A,N,G=new p,he={registerProvider:we,getProvider:V,setProvider:$};return he;function we(K){if(!Object.isExtensible(he))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case g===K:break;case W(b):b=K;break;case b===K:break;case W(A):A=K;break;case A===K:break;default:N===void 0&&(N=new O),N.add(K);break}}function X(K,te){if(!W(b)){if(b.isProviderFor(K,te))return b;if(!W(A)){if(A.isProviderFor(K,te))return b;if(!W(N))for(var le=ku(N);;){var ye=Cu(le);if(!ye)return;var Qe=xu(ye);if(Qe.isProviderFor(K,te))return Bu(le),Qe}}}if(!W(g)&&g.isProviderFor(K,te))return g}function V(K,te){var le=G.get(K),ye;return W(le)||(ye=le.get(te)),W(ye)&&(ye=X(K,te),W(ye)||(W(le)&&(le=new z,G.set(K,le)),le.set(te,ye))),ye}function L(K){if(W(K))throw new TypeError;return b===K||A===K||!W(N)&&N.has(K)}function $(K,te,le){if(!L(le))throw new Error("Metadata provider not registered.");var ye=V(K,te);if(ye!==le){if(!W(ye))return!1;var Qe=G.get(K);W(Qe)&&(Qe=new z,G.set(K,Qe)),Qe.set(te,le)}return!0}}function np(){var g;return!W(m)&&H(t.Reflect)&&Object.isExtensible(t.Reflect)&&(g=t.Reflect[m]),W(g)&&(g=ip()),!W(m)&&H(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,m,{enumerable:!1,configurable:!1,writable:!1,value:g}),g}function op(g){var b=new p,A={isProviderFor:function(L,$){var K=b.get(L);return W(K)?!1:K.has($)},OrdinaryDefineOwnMetadata:we,OrdinaryHasOwnMetadata:G,OrdinaryGetOwnMetadata:he,OrdinaryOwnMetadataKeys:X,OrdinaryDeleteMetadata:V};return S.registerProvider(A),A;function N(L,$,K){var te=b.get(L),le=!1;if(W(te)){if(!K)return;te=new z,b.set(L,te),le=!0}var ye=te.get($);if(W(ye)){if(!K)return;if(ye=new z,te.set($,ye),!g.setProvider(L,$,A))throw te.delete($),le&&b.delete(L),new Error("Wrong provider for target.")}return ye}function G(L,$,K){var te=N($,K,!1);return W(te)?!1:Ue(te.has(L))}function he(L,$,K){var te=N($,K,!1);if(!W(te))return te.get(L)}function we(L,$,K,te){var le=N(K,te,!0);le.set(L,$)}function X(L,$){var K=[],te=N(L,$,!1);if(W(te))return K;for(var le=te.keys(),ye=ku(le),Qe=0;;){var Eu=Cu(ye);if(!Eu)return K.length=Qe,K;var up=xu(Eu);try{K[Qe]=up}catch(fp){try{Bu(ye)}finally{throw fp}}Qe++}}function V(L,$,K){var te=N($,K,!1);if(W(te)||!te.delete(L))return!1;if(te.size===0){var le=b.get($);W(le)||(le.delete(K),le.size===0&&b.delete(le))}return!0}}function sp(g){var b=g.defineMetadata,A=g.hasOwnMetadata,N=g.getOwnMetadata,G=g.getOwnMetadataKeys,he=g.deleteMetadata,we=new p,X={isProviderFor:function(V,L){var $=we.get(V);return W($)?G(V,L).length?(W($)&&($=new O,we.set(V,$)),$.add(L),!0):!1:$.has(L)},OrdinaryDefineOwnMetadata:b,OrdinaryHasOwnMetadata:A,OrdinaryGetOwnMetadata:N,OrdinaryOwnMetadataKeys:G,OrdinaryDeleteMetadata:he};return X}function ii(g,b,A){var N=S.getProvider(g,b);if(!W(N))return N;if(A){if(S.setProvider(g,b,w))return w;throw new Error("Illegal state.")}}function ap(){var g={},b=[],A=function(){function X(V,L,$){this._index=0,this._keys=V,this._values=L,this._selector=$}return X.prototype["@@iterator"]=function(){return this},X.prototype[c]=function(){return this},X.prototype.next=function(){var V=this._index;if(V>=0&&V<this._keys.length){var L=this._selector(this._keys[V],this._values[V]);return V+1>=this._keys.length?(this._index=-1,this._keys=b,this._values=b):this._index++,{value:L,done:!1}}return{value:void 0,done:!0}},X.prototype.throw=function(V){throw this._index>=0&&(this._index=-1,this._keys=b,this._values=b),V},X.prototype.return=function(V){return this._index>=0&&(this._index=-1,this._keys=b,this._values=b),{value:V,done:!0}},X}(),N=function(){function X(){this._keys=[],this._values=[],this._cacheKey=g,this._cacheIndex=-2}return Object.defineProperty(X.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),X.prototype.has=function(V){return this._find(V,!1)>=0},X.prototype.get=function(V){var L=this._find(V,!1);return L>=0?this._values[L]:void 0},X.prototype.set=function(V,L){var $=this._find(V,!0);return this._values[$]=L,this},X.prototype.delete=function(V){var L=this._find(V,!1);if(L>=0){for(var $=this._keys.length,K=L+1;K<$;K++)this._keys[K-1]=this._keys[K],this._values[K-1]=this._values[K];return this._keys.length--,this._values.length--,Zs(V,this._cacheKey)&&(this._cacheKey=g,this._cacheIndex=-2),!0}return!1},X.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=g,this._cacheIndex=-2},X.prototype.keys=function(){return new A(this._keys,this._values,G)},X.prototype.values=function(){return new A(this._keys,this._values,he)},X.prototype.entries=function(){return new A(this._keys,this._values,we)},X.prototype["@@iterator"]=function(){return this.entries()},X.prototype[c]=function(){return this.entries()},X.prototype._find=function(V,L){if(!Zs(this._cacheKey,V)){this._cacheIndex=-1;for(var $=0;$<this._keys.length;$++)if(Zs(this._keys[$],V)){this._cacheIndex=$;break}}return this._cacheIndex<0&&L&&(this._cacheIndex=this._keys.length,this._keys.push(V),this._values.push(void 0)),this._cacheIndex},X}();return N;function G(X,V){return X}function he(X,V){return V}function we(X,V){return[X,V]}}function cp(){var g=function(){function b(){this._map=new z}return Object.defineProperty(b.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),b.prototype.has=function(A){return this._map.has(A)},b.prototype.add=function(A){return this._map.set(A,A),this},b.prototype.delete=function(A){return this._map.delete(A)},b.prototype.clear=function(){this._map.clear()},b.prototype.keys=function(){return this._map.keys()},b.prototype.values=function(){return this._map.keys()},b.prototype.entries=function(){return this._map.entries()},b.prototype["@@iterator"]=function(){return this.keys()},b.prototype[c]=function(){return this.keys()},b}();return g}function lp(){var g=16,b=v.create(),A=N();return function(){function V(){this._key=N()}return V.prototype.has=function(L){var $=G(L,!1);return $!==void 0?v.has($,this._key):!1},V.prototype.get=function(L){var $=G(L,!1);return $!==void 0?v.get($,this._key):void 0},V.prototype.set=function(L,$){var K=G(L,!0);return K[this._key]=$,this},V.prototype.delete=function(L){var $=G(L,!1);return $!==void 0?delete $[this._key]:!1},V.prototype.clear=function(){this._key=N()},V}();function N(){var V;do V="@@WeakMap@@"+X();while(v.has(b,V));return b[V]=!0,V}function G(V,L){if(!i.call(V,A)){if(!L)return;Object.defineProperty(V,A,{value:v.create()})}return V[A]}function he(V,L){for(var $=0;$<L;++$)V[$]=Math.random()*255|0;return V}function we(V){return typeof Uint8Array=="function"?typeof crypto<"u"?crypto.getRandomValues(new Uint8Array(V)):typeof msCrypto<"u"?msCrypto.getRandomValues(new Uint8Array(V)):he(new Uint8Array(V),V):he(new Array(V),V)}function X(){var V=we(g);V[6]=V[6]&79|64,V[8]=V[8]&191|128;for(var L="",$=0;$<g;++$){var K=V[$];($===4||$===6||$===8)&&(L+="-"),K<16&&(L+="0"),L+=K.toString(16).toLowerCase()}return L}}function Xs(g){return g.__=void 0,delete g.__,g}})})(ta||(ta={}));/*!
|
|
14
|
+
***************************************************************************** */var ta;(function(r){(function(e){var t=typeof globalThis=="object"?globalThis:typeof Pn=="object"?Pn:typeof self=="object"?self:typeof this=="object"?this:u(),i=n(r);typeof t.Reflect<"u"&&(i=n(t.Reflect,i)),e(i,t),typeof t.Reflect>"u"&&(t.Reflect=r);function n(f,d){return function(b,y){Object.defineProperty(f,b,{configurable:!0,writable:!0,value:y}),d&&d(b,y)}}function s(){try{return Function("return this;")()}catch{}}function c(){try{return(0,eval)("(function() { return this; })()")}catch{}}function u(){return s()||c()}})(function(e,t){var i=Object.prototype.hasOwnProperty,n=typeof Symbol=="function",s=n&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",c=n&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",u=typeof Object.create=="function",f={__proto__:[]}instanceof Array,d=!u&&!f,b={create:u?function(){return Xs(Object.create(null))}:f?function(){return Xs({__proto__:null})}:function(){return Xs({})},has:d?function(g,v){return i.call(g,v)}:function(g,v){return v in g},get:d?function(g,v){return i.call(g,v)?g[v]:void 0}:function(g,v){return g[v]}},y=Object.getPrototypeOf(Function),W=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:ap(),O=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:cp(),p=typeof WeakMap=="function"?WeakMap:lp(),m=n?Symbol.for("@reflect-metadata:registry"):void 0,A=np(),w=op(A);function I(g,v,S,N){if(z(S)){if(!be(g))throw new TypeError;if(!ve(v))throw new TypeError;return Be(g,v)}else{if(!be(g))throw new TypeError;if(!H(v))throw new TypeError;if(!H(N)&&!z(N)&&!J(N))throw new TypeError;return J(N)&&(N=void 0),S=Y(S),ce(g,v,S,N)}}e("decorate",I);function k(g,v){function S(N,G){if(!H(N))throw new TypeError;if(!z(G)&&!Sr(G))throw new TypeError;vr(g,v,N,G)}return S}e("metadata",k);function B(g,v,S,N){if(!H(S))throw new TypeError;return z(N)||(N=Y(N)),vr(g,v,S,N)}e("defineMetadata",B);function Z(g,v,S){if(!H(v))throw new TypeError;return z(S)||(S=Y(S)),pe(g,v,S)}e("hasMetadata",Z);function se(g,v,S){if(!H(v))throw new TypeError;return z(S)||(S=Y(S)),at(g,v,S)}e("hasOwnMetadata",se);function D(g,v,S){if(!H(v))throw new TypeError;return z(S)||(S=Y(S)),ee(g,v,S)}e("getMetadata",D);function C(g,v,S){if(!H(v))throw new TypeError;return z(S)||(S=Y(S)),vt(g,v,S)}e("getOwnMetadata",C);function j(g,v){if(!H(g))throw new TypeError;return z(v)||(v=Y(v)),wr(g,v)}e("getMetadataKeys",j);function de(g,v){if(!H(g))throw new TypeError;return z(v)||(v=Y(v)),Gt(g,v)}e("getOwnMetadataKeys",de);function re(g,v,S){if(!H(v))throw new TypeError;if(z(S)||(S=Y(S)),!H(v))throw new TypeError;z(S)||(S=Y(S));var N=ii(v,S,!1);return z(N)?!1:N.OrdinaryDeleteMetadata(g,v,S)}e("deleteMetadata",re);function Be(g,v){for(var S=g.length-1;S>=0;--S){var N=g[S],G=N(v);if(!z(G)&&!J(G)){if(!ve(G))throw new TypeError;v=G}}return v}function ce(g,v,S,N){for(var G=g.length-1;G>=0;--G){var he=g[G],we=he(v,S,N);if(!z(we)&&!J(we)){if(!H(we))throw new TypeError;N=we}}return N}function pe(g,v,S){var N=at(g,v,S);if(N)return!0;var G=Qs(v);return J(G)?!1:pe(g,G,S)}function at(g,v,S){var N=ii(v,S,!1);return z(N)?!1:Ue(N.OrdinaryHasOwnMetadata(g,v,S))}function ee(g,v,S){var N=at(g,v,S);if(N)return vt(g,v,S);var G=Qs(v);if(!J(G))return ee(g,G,S)}function vt(g,v,S){var N=ii(v,S,!1);if(!z(N))return N.OrdinaryGetOwnMetadata(g,v,S)}function vr(g,v,S,N){var G=ii(S,N,!0);G.OrdinaryDefineOwnMetadata(g,v,S,N)}function wr(g,v){var S=Gt(g,v),N=Qs(g);if(N===null)return S;var G=wr(N,v);if(G.length<=0)return S;if(S.length<=0)return G;for(var he=new O,we=[],X=0,V=S;X<V.length;X++){var L=V[X],$=he.has(L);$||(he.add(L),we.push(L))}for(var K=0,te=G;K<te.length;K++){var L=te[K],$=he.has(L);$||(he.add(L),we.push(L))}return we}function Gt(g,v){var S=ii(g,v,!1);return S?S.OrdinaryOwnMetadataKeys(g,v):[]}function wt(g){if(g===null)return 1;switch(typeof g){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return g===null?1:6;default:return 6}}function z(g){return g===void 0}function J(g){return g===null}function R(g){return typeof g=="symbol"}function H(g){return typeof g=="object"?g!==null:typeof g=="function"}function ae(g,v){switch(wt(g)){case 0:return g;case 1:return g;case 2:return g;case 3:return g;case 4:return g;case 5:return g}var S=v===3?"string":v===5?"number":"default",N=Su(g,s);if(N!==void 0){var G=N.call(g,S);if(H(G))throw new TypeError;return G}return Ne(g,S==="default"?"number":S)}function Ne(g,v){if(v==="string"){var S=g.toString;if(q(S)){var N=S.call(g);if(!H(N))return N}var G=g.valueOf;if(q(G)){var N=G.call(g);if(!H(N))return N}}else{var G=g.valueOf;if(q(G)){var N=G.call(g);if(!H(N))return N}var he=g.toString;if(q(he)){var N=he.call(g);if(!H(N))return N}}throw new TypeError}function Ue(g){return!!g}function Ar(g){return""+g}function Y(g){var v=ae(g,3);return R(v)?v:Ar(v)}function be(g){return Array.isArray?Array.isArray(g):g instanceof Object?g instanceof Array:Object.prototype.toString.call(g)==="[object Array]"}function q(g){return typeof g=="function"}function ve(g){return typeof g=="function"}function Sr(g){switch(wt(g)){case 3:return!0;case 4:return!0;default:return!1}}function Zs(g,v){return g===v||g!==g&&v!==v}function Su(g,v){var S=g[v];if(S!=null){if(!q(S))throw new TypeError;return S}}function ku(g){var v=Su(g,c);if(!q(v))throw new TypeError;var S=v.call(g);if(!H(S))throw new TypeError;return S}function xu(g){return g.value}function Cu(g){var v=g.next();return v.done?!1:v}function Bu(g){var v=g.return;v&&v.call(g)}function Qs(g){var v=Object.getPrototypeOf(g);if(typeof g!="function"||g===y||v!==y)return v;var S=g.prototype,N=S&&Object.getPrototypeOf(S);if(N==null||N===Object.prototype)return v;var G=N.constructor;return typeof G!="function"||G===g?v:G}function ip(){var g;!z(m)&&typeof t.Reflect<"u"&&!(m in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(g=sp(t.Reflect));var v,S,N,G=new p,he={registerProvider:we,getProvider:V,setProvider:$};return he;function we(K){if(!Object.isExtensible(he))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case g===K:break;case z(v):v=K;break;case v===K:break;case z(S):S=K;break;case S===K:break;default:N===void 0&&(N=new O),N.add(K);break}}function X(K,te){if(!z(v)){if(v.isProviderFor(K,te))return v;if(!z(S)){if(S.isProviderFor(K,te))return v;if(!z(N))for(var le=ku(N);;){var ye=Cu(le);if(!ye)return;var Qe=xu(ye);if(Qe.isProviderFor(K,te))return Bu(le),Qe}}}if(!z(g)&&g.isProviderFor(K,te))return g}function V(K,te){var le=G.get(K),ye;return z(le)||(ye=le.get(te)),z(ye)&&(ye=X(K,te),z(ye)||(z(le)&&(le=new W,G.set(K,le)),le.set(te,ye))),ye}function L(K){if(z(K))throw new TypeError;return v===K||S===K||!z(N)&&N.has(K)}function $(K,te,le){if(!L(le))throw new Error("Metadata provider not registered.");var ye=V(K,te);if(ye!==le){if(!z(ye))return!1;var Qe=G.get(K);z(Qe)&&(Qe=new W,G.set(K,Qe)),Qe.set(te,le)}return!0}}function np(){var g;return!z(m)&&H(t.Reflect)&&Object.isExtensible(t.Reflect)&&(g=t.Reflect[m]),z(g)&&(g=ip()),!z(m)&&H(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,m,{enumerable:!1,configurable:!1,writable:!1,value:g}),g}function op(g){var v=new p,S={isProviderFor:function(L,$){var K=v.get(L);return z(K)?!1:K.has($)},OrdinaryDefineOwnMetadata:we,OrdinaryHasOwnMetadata:G,OrdinaryGetOwnMetadata:he,OrdinaryOwnMetadataKeys:X,OrdinaryDeleteMetadata:V};return A.registerProvider(S),S;function N(L,$,K){var te=v.get(L),le=!1;if(z(te)){if(!K)return;te=new W,v.set(L,te),le=!0}var ye=te.get($);if(z(ye)){if(!K)return;if(ye=new W,te.set($,ye),!g.setProvider(L,$,S))throw te.delete($),le&&v.delete(L),new Error("Wrong provider for target.")}return ye}function G(L,$,K){var te=N($,K,!1);return z(te)?!1:Ue(te.has(L))}function he(L,$,K){var te=N($,K,!1);if(!z(te))return te.get(L)}function we(L,$,K,te){var le=N(K,te,!0);le.set(L,$)}function X(L,$){var K=[],te=N(L,$,!1);if(z(te))return K;for(var le=te.keys(),ye=ku(le),Qe=0;;){var Eu=Cu(ye);if(!Eu)return K.length=Qe,K;var up=xu(Eu);try{K[Qe]=up}catch(fp){try{Bu(ye)}finally{throw fp}}Qe++}}function V(L,$,K){var te=N($,K,!1);if(z(te)||!te.delete(L))return!1;if(te.size===0){var le=v.get($);z(le)||(le.delete(K),le.size===0&&v.delete(le))}return!0}}function sp(g){var v=g.defineMetadata,S=g.hasOwnMetadata,N=g.getOwnMetadata,G=g.getOwnMetadataKeys,he=g.deleteMetadata,we=new p,X={isProviderFor:function(V,L){var $=we.get(V);return z($)?G(V,L).length?(z($)&&($=new O,we.set(V,$)),$.add(L),!0):!1:$.has(L)},OrdinaryDefineOwnMetadata:v,OrdinaryHasOwnMetadata:S,OrdinaryGetOwnMetadata:N,OrdinaryOwnMetadataKeys:G,OrdinaryDeleteMetadata:he};return X}function ii(g,v,S){var N=A.getProvider(g,v);if(!z(N))return N;if(S){if(A.setProvider(g,v,w))return w;throw new Error("Illegal state.")}}function ap(){var g={},v=[],S=function(){function X(V,L,$){this._index=0,this._keys=V,this._values=L,this._selector=$}return X.prototype["@@iterator"]=function(){return this},X.prototype[c]=function(){return this},X.prototype.next=function(){var V=this._index;if(V>=0&&V<this._keys.length){var L=this._selector(this._keys[V],this._values[V]);return V+1>=this._keys.length?(this._index=-1,this._keys=v,this._values=v):this._index++,{value:L,done:!1}}return{value:void 0,done:!0}},X.prototype.throw=function(V){throw this._index>=0&&(this._index=-1,this._keys=v,this._values=v),V},X.prototype.return=function(V){return this._index>=0&&(this._index=-1,this._keys=v,this._values=v),{value:V,done:!0}},X}(),N=function(){function X(){this._keys=[],this._values=[],this._cacheKey=g,this._cacheIndex=-2}return Object.defineProperty(X.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),X.prototype.has=function(V){return this._find(V,!1)>=0},X.prototype.get=function(V){var L=this._find(V,!1);return L>=0?this._values[L]:void 0},X.prototype.set=function(V,L){var $=this._find(V,!0);return this._values[$]=L,this},X.prototype.delete=function(V){var L=this._find(V,!1);if(L>=0){for(var $=this._keys.length,K=L+1;K<$;K++)this._keys[K-1]=this._keys[K],this._values[K-1]=this._values[K];return this._keys.length--,this._values.length--,Zs(V,this._cacheKey)&&(this._cacheKey=g,this._cacheIndex=-2),!0}return!1},X.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=g,this._cacheIndex=-2},X.prototype.keys=function(){return new S(this._keys,this._values,G)},X.prototype.values=function(){return new S(this._keys,this._values,he)},X.prototype.entries=function(){return new S(this._keys,this._values,we)},X.prototype["@@iterator"]=function(){return this.entries()},X.prototype[c]=function(){return this.entries()},X.prototype._find=function(V,L){if(!Zs(this._cacheKey,V)){this._cacheIndex=-1;for(var $=0;$<this._keys.length;$++)if(Zs(this._keys[$],V)){this._cacheIndex=$;break}}return this._cacheIndex<0&&L&&(this._cacheIndex=this._keys.length,this._keys.push(V),this._values.push(void 0)),this._cacheIndex},X}();return N;function G(X,V){return X}function he(X,V){return V}function we(X,V){return[X,V]}}function cp(){var g=function(){function v(){this._map=new W}return Object.defineProperty(v.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),v.prototype.has=function(S){return this._map.has(S)},v.prototype.add=function(S){return this._map.set(S,S),this},v.prototype.delete=function(S){return this._map.delete(S)},v.prototype.clear=function(){this._map.clear()},v.prototype.keys=function(){return this._map.keys()},v.prototype.values=function(){return this._map.keys()},v.prototype.entries=function(){return this._map.entries()},v.prototype["@@iterator"]=function(){return this.keys()},v.prototype[c]=function(){return this.keys()},v}();return g}function lp(){var g=16,v=b.create(),S=N();return function(){function V(){this._key=N()}return V.prototype.has=function(L){var $=G(L,!1);return $!==void 0?b.has($,this._key):!1},V.prototype.get=function(L){var $=G(L,!1);return $!==void 0?b.get($,this._key):void 0},V.prototype.set=function(L,$){var K=G(L,!0);return K[this._key]=$,this},V.prototype.delete=function(L){var $=G(L,!1);return $!==void 0?delete $[this._key]:!1},V.prototype.clear=function(){this._key=N()},V}();function N(){var V;do V="@@WeakMap@@"+X();while(b.has(v,V));return v[V]=!0,V}function G(V,L){if(!i.call(V,S)){if(!L)return;Object.defineProperty(V,S,{value:b.create()})}return V[S]}function he(V,L){for(var $=0;$<L;++$)V[$]=Math.random()*255|0;return V}function we(V){return typeof Uint8Array=="function"?typeof crypto<"u"?crypto.getRandomValues(new Uint8Array(V)):typeof msCrypto<"u"?msCrypto.getRandomValues(new Uint8Array(V)):he(new Uint8Array(V),V):he(new Array(V),V)}function X(){var V=we(g);V[6]=V[6]&79|64,V[8]=V[8]&191|128;for(var L="",$=0;$<g;++$){var K=V[$];($===4||$===6||$===8)&&(L+="-"),K<16&&(L+="0"),L+=K.toString(16).toLowerCase()}return L}}function Xs(g){return g.__=void 0,delete g.__,g}})})(ta||(ta={}));/*!
|
|
15
15
|
* MIT License
|
|
16
16
|
*
|
|
17
17
|
* Copyright (c) 2017-2022 Peculiar Ventures, LLC
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
*
|
|
37
37
|
*/const Ou="[object ArrayBuffer]";class _{static isArrayBuffer(e){return Object.prototype.toString.call(e)===Ou}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){const i=_.toUint8Array(e),n=_.toUint8Array(t);if(i.length!==n.byteLength)return!1;for(let s=0;s<i.length;s++)if(i[s]!==n[s])return!1;return!0}static concat(...e){let t;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?t=e[0]:e[e.length-1]instanceof Function?t=e.slice(0,e.length-1):t=e;let i=0;for(const c of t)i+=c.byteLength;const n=new Uint8Array(i);let s=0;for(const c of t){const u=this.toUint8Array(c);n.set(u,s),s+=u.length}return e[e.length-1]instanceof Function?this.toView(n,e[e.length-1]):n.buffer}}const Dn="string",Tu=/^[0-9a-f]+$/i,Vu=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,_u=/^[a-zA-Z0-9-_]+$/;class ra{static fromString(e){const t=unescape(encodeURIComponent(e)),i=new Uint8Array(t.length);for(let n=0;n<t.length;n++)i[n]=t.charCodeAt(n);return i.buffer}static toString(e){const t=_.toUint8Array(e);let i="";for(let s=0;s<t.length;s++)i+=String.fromCharCode(t[s]);return decodeURIComponent(escape(i))}}class Xe{static toString(e,t=!1){const i=_.toArrayBuffer(e),n=new DataView(i);let s="";for(let c=0;c<i.byteLength;c+=2){const u=n.getUint16(c,t);s+=String.fromCharCode(u)}return s}static fromString(e,t=!1){const i=new ArrayBuffer(e.length*2),n=new DataView(i);for(let s=0;s<e.length;s++)n.setUint16(s*2,e.charCodeAt(s),t);return i}}class M{static isHex(e){return typeof e===Dn&&Tu.test(e)}static isBase64(e){return typeof e===Dn&&Vu.test(e)}static isBase64Url(e){return typeof e===Dn&&_u.test(e)}static ToString(e,t="utf8"){const i=_.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(i);case"binary":return this.ToBinary(i);case"hex":return this.ToHex(i);case"base64":return this.ToBase64(i);case"base64url":return this.ToBase64Url(i);case"utf16le":return Xe.toString(i,!0);case"utf16":case"utf16be":return Xe.toString(i);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return Xe.fromString(e,!0);case"utf16":case"utf16be":return Xe.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){const t=_.toUint8Array(e);if(typeof btoa<"u"){const i=this.ToString(t,"binary");return btoa(i)}else return Buffer.from(t).toString("base64")}static FromBase64(e){const t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!M.isBase64(t))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(t)):new Uint8Array(Buffer.from(t,"base64")).buffer}static FromBase64Url(e){const t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!M.isBase64Url(t))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(t.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,t=M.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return ra.fromString(e);case"utf16":case"utf16be":return Xe.fromString(e);case"utf16le":case"usc2":return Xe.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=M.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return ra.toString(e);case"utf16":case"utf16be":return Xe.toString(e);case"utf16le":case"usc2":return Xe.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){const t=e.length,i=new Uint8Array(t);for(let n=0;n<t;n++)i[n]=e.charCodeAt(n);return i.buffer}static ToBinary(e){const t=_.toUint8Array(e);let i="";for(let n=0;n<t.length;n++)i+=String.fromCharCode(t[n]);return i}static ToHex(e){const t=_.toUint8Array(e);let i="";const n=t.length;for(let s=0;s<n;s++){const c=t[s];c<16&&(i+="0"),i+=c.toString(16)}return i}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!M.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);const i=new Uint8Array(t.length/2);for(let n=0;n<t.length;n=n+2){const s=t.slice(n,n+2);i[n/2]=parseInt(s,16)}return i.buffer}static ToUtf16String(e,t=!1){return Xe.toString(e,t)}static FromUtf16String(e,t=!1){return Xe.fromString(e,t)}static Base64Padding(e){const t=4-e.length%4;if(t<4)for(let i=0;i<t;i++)e+="=";return e}static formatString(e){return(e==null?void 0:e.replace(/[\n\r\t ]/g,""))||""}}M.DEFAULT_UTF8_ENCODING="utf8";function ju(...r){const e=r.map(n=>n.byteLength).reduce((n,s)=>n+s),t=new Uint8Array(e);let i=0;return r.map(n=>new Uint8Array(n)).forEach(n=>{for(const s of n)t[i++]=s}),t.buffer}function ia(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;const t=new Uint8Array(r),i=new Uint8Array(e);for(let n=0;n<r.byteLength;n++)if(t[n]!==i[n])return!1;return!0}/*!
|
|
38
38
|
Copyright (c) Peculiar Ventures, LLC
|
|
39
|
-
*/function
|
|
39
|
+
*/function Wt(r,e){let t=0;if(r.length===1)return r[0];for(let i=r.length-1;i>=0;i--)t+=r[r.length-1-i]*Math.pow(2,e*i);return t}function Et(r,e,t=-1){const i=t;let n=r,s=0,c=Math.pow(2,e);for(let u=1;u<8;u++){if(r<c){let f;if(i<0)f=new ArrayBuffer(u),s=u;else{if(i<u)return new ArrayBuffer(0);f=new ArrayBuffer(i),s=i}const d=new Uint8Array(f);for(let b=u-1;b>=0;b--){const y=Math.pow(2,b*e);d[s-b-1]=Math.floor(n/y),n-=d[s-b-1]*y}return f}c*=Math.pow(2,e)}return new ArrayBuffer(0)}function Rn(...r){let e=0,t=0;for(const s of r)e+=s.length;const i=new ArrayBuffer(e),n=new Uint8Array(i);for(const s of r)n.set(s,t),t+=s.length;return n}function na(){const r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const u=r[0]===255&&r[1]&128,f=r[0]===0&&(r[1]&128)===0;(u||f)&&this.warnings.push("Needlessly long format")}const e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let u=0;u<this.valueHex.byteLength;u++)t[u]=0;t[0]=r[0]&128;const i=Wt(t,8),n=new ArrayBuffer(this.valueHex.byteLength),s=new Uint8Array(n);for(let u=0;u<this.valueHex.byteLength;u++)s[u]=r[u];return s[0]&=127,Wt(s,8)-i}function Pu(r){const e=r<0?r*-1:r;let t=128;for(let i=1;i<8;i++){if(e<=t){if(r<0){const c=t-e,u=Et(c,8,i),f=new Uint8Array(u);return f[0]|=128,u}let n=Et(e,8,i),s=new Uint8Array(n);if(s[0]&128){const c=n.slice(0),u=new Uint8Array(c);n=new ArrayBuffer(n.byteLength+1),s=new Uint8Array(n);for(let f=0;f<c.byteLength;f++)s[f+1]=u[f];s[0]=0}return n}t*=Math.pow(2,8)}return new ArrayBuffer(0)}function Du(r,e){if(r.byteLength!==e.byteLength)return!1;const t=new Uint8Array(r),i=new Uint8Array(e);for(let n=0;n<t.length;n++)if(t[n]!==i[n])return!1;return!0}function De(r,e){const t=r.toString(10);if(e<t.length)return"";const i=e-t.length,n=new Array(i);for(let c=0;c<i;c++)n[c]="0";return n.join("").concat(t)}/*!
|
|
40
40
|
* Copyright (c) 2014, GMO GlobalSign
|
|
41
41
|
* Copyright (c) 2015-2022, Peculiar Ventures
|
|
42
42
|
* All rights reserved.
|
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
69
69
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
70
70
|
*
|
|
71
|
-
*/function si(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function Mn(r){let e=0,t=0;for(let n=0;n<r.length;n++){const s=r[n];e+=s.byteLength}const i=new Uint8Array(e);for(let n=0;n<r.length;n++){const s=r[n];i.set(new Uint8Array(s),t),t+=s.byteLength}return i.buffer}function ct(r,e,t,i){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):i<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-i<0?(r.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(r.error="Wrong parameter: inputBuffer has zero length",!1):(r.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}class ai{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return Mn(this.items)}}const kr=[new Uint8Array([1])],oa="0123456789",$n="name",sa="valueHexView",Ru="isHexOnly",Mu="idBlock",$u="tagClass",Uu="tagNumber",Hu="isConstructed",Lu="fromBER",Fu="toBER",Ku="local",Oe="",Ge=new ArrayBuffer(0),ci=new Uint8Array(0),xr="EndOfContent",aa="OCTET STRING",ca="BIT STRING";function et(r){var e;return e=class extends r{constructor(...i){var n;super(...i);const s=i[0]||{};this.isHexOnly=(n=s.isHexOnly)!==null&&n!==void 0?n:!1,this.valueHexView=s.valueHex?_.toUint8Array(s.valueHex):ci}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(i){this.valueHexView=new Uint8Array(i)}fromBER(i,n,s){const c=i instanceof ArrayBuffer?new Uint8Array(i):i;if(!ct(this,c,n,s))return-1;const u=n+s;return this.valueHexView=c.subarray(n,u),this.valueHexView.length?(this.blockLength=s,u):(this.warnings.push("Zero buffer length"),n)}toBER(i=!1){return this.isHexOnly?i?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",Ge)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:M.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}class It{constructor({blockLength:e=0,error:t=Oe,warnings:i=[],valueBeforeDecode:n=ci}={}){this.blockLength=e,this.error=t,this.warnings=i,this.valueBeforeDecodeView=_.toUint8Array(n)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:M.ToHex(this.valueBeforeDecodeView)}}}It.NAME="baseBlock";class Ee extends It{fromBER(e,t,i){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}Ee.NAME="valueBlock";class la extends et(It){constructor({idBlock:e={}}={}){var t,i,n,s;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?_.toUint8Array(e.valueHex):ci,this.tagClass=(i=e.tagClass)!==null&&i!==void 0?i:-1,this.tagNumber=(n=e.tagNumber)!==null&&n!==void 0?n:-1,this.isConstructed=(s=e.isConstructed)!==null&&s!==void 0?s:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",Ge}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){const n=new Uint8Array(1);if(!e){let s=this.tagNumber;s&=31,t|=s,n[0]=t}return n.buffer}if(!this.isHexOnly){const n=Et(this.tagNumber,7),s=new Uint8Array(n),c=n.byteLength,u=new Uint8Array(c+1);if(u[0]=t|31,!e){for(let f=0;f<c-1;f++)u[f+1]=s[f]|128;u[c]=s[c-1]}return u.buffer}const i=new Uint8Array(this.valueHexView.byteLength+1);if(i[0]=t|31,!e){const n=this.valueHexView;for(let s=0;s<n.length-1;s++)i[s+1]=n[s]|128;i[this.valueHexView.byteLength]=n[n.length-1]}return i.buffer}fromBER(e,t,i){const n=_.toUint8Array(e);if(!ct(this,n,t,i))return-1;const s=n.subarray(t,t+i);if(s.length===0)return this.error="Zero buffer length",-1;switch(s[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(s[0]&32)===32,this.isHexOnly=!1;const u=s[0]&31;if(u!==31)this.tagNumber=u,this.blockLength=1;else{let f=1,d=this.valueHexView=new Uint8Array(255),v=255;for(;s[f]&128;){if(d[f-1]=s[f]&127,f++,f>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(f===v){v+=255;const z=new Uint8Array(v);for(let O=0;O<d.length;O++)z[O]=d[O];d=this.valueHexView=new Uint8Array(v)}}this.blockLength=f+1,d[f-1]=s[f]&127;const y=new Uint8Array(f);for(let z=0;z<f;z++)y[z]=d[z];d=this.valueHexView=new Uint8Array(f),d.set(y),this.blockLength<=9?this.tagNumber=zt(d,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}}la.NAME="identificationBlock";class ua extends It{constructor({lenBlock:e={}}={}){var t,i,n;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(i=e.longFormUsed)!==null&&i!==void 0?i:!1,this.length=(n=e.length)!==null&&n!==void 0?n:0}fromBER(e,t,i){const n=_.toUint8Array(e);if(!ct(this,n,t,i))return-1;const s=n.subarray(t,t+i);if(s.length===0)return this.error="Zero buffer length",-1;if(s[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=s[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(s[0]&128),this.longFormUsed===!1)return this.length=s[0],this.blockLength=1,t+this.blockLength;const c=s[0]&127;if(c>8)return this.error="Too big integer",-1;if(c+1>s.length)return this.error="End of input reached before message was fully decoded",-1;const u=t+1,f=n.subarray(u,u+c);return f[c-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=zt(f,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=c+1,t+this.blockLength}toBER(e=!1){let t,i;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(t),i[0]=128),t;if(this.longFormUsed){const n=Et(this.length,8);if(n.byteLength>127)return this.error="Too big length",Ge;if(t=new ArrayBuffer(n.byteLength+1),e)return t;const s=new Uint8Array(n);i=new Uint8Array(t),i[0]=n.byteLength|128;for(let c=0;c<n.byteLength;c++)i[c+1]=s[c];return t}return t=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(t),i[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}ua.NAME="lengthBlock";const P={};class Se extends It{constructor({name:e=Oe,optional:t=!1,primitiveSchema:i,...n}={},s){super(n),this.name=e,this.optional=t,i&&(this.primitiveSchema=i),this.idBlock=new la(n),this.lenBlock=new ua(n),this.valueBlock=s?new s(n):new Ee(n)}fromBER(e,t,i){const n=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return n===-1?(this.error=this.valueBlock.error,n):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),n)}toBER(e,t){const i=t||new ai;t||fa(this);const n=this.idBlock.toBER(e);if(i.write(n),this.lenBlock.isIndefiniteForm)i.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,i),i.write(new ArrayBuffer(2));else{const s=this.valueBlock.toBER(e);this.lenBlock.length=s.byteLength;const c=this.lenBlock.toBER(e);i.write(c),i.write(s)}return t?Ge:i.final()}toJSON(){const e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():M.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${M.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;const t=this.toBER(),i=e.toBER();return Du(t,i)}}Se.NAME="BaseBlock";function fa(r){if(r instanceof P.Constructed)for(const e of r.valueBlock.value)fa(e)&&(r.lenBlock.isIndefiniteForm=!0);return!!r.lenBlock.isIndefiniteForm}class Un extends Se{constructor({value:e=Oe,...t}={},i){super(t,i),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,i){const n=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return n===-1?(this.error=this.valueBlock.error,n):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),n)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}Un.NAME="BaseStringBlock";class da extends et(Ee){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}}da.NAME="PrimitiveValueBlock";var pa;class Cr extends Se{constructor(e={}){super(e,da),this.idBlock.isConstructed=!1}}pa=Cr,P.Primitive=pa,Cr.NAME="PRIMITIVE";function qu(r,e){if(r instanceof e)return r;const t=new e;return t.idBlock=r.idBlock,t.lenBlock=r.lenBlock,t.warnings=r.warnings,t.valueBeforeDecodeView=r.valueBeforeDecodeView,t}function Wt(r,e=0,t=r.length){const i=e;let n=new Se({},Ee);const s=new It;if(!ct(s,r,e,t))return n.error=s.error,{offset:-1,result:n};if(!r.subarray(e,e+t).length)return n.error="Zero buffer length",{offset:-1,result:n};let u=n.idBlock.fromBER(r,e,t);if(n.idBlock.warnings.length&&n.warnings.concat(n.idBlock.warnings),u===-1)return n.error=n.idBlock.error,{offset:-1,result:n};if(e=u,t-=n.idBlock.blockLength,u=n.lenBlock.fromBER(r,e,t),n.lenBlock.warnings.length&&n.warnings.concat(n.lenBlock.warnings),u===-1)return n.error=n.lenBlock.error,{offset:-1,result:n};if(e=u,t-=n.lenBlock.blockLength,!n.idBlock.isConstructed&&n.lenBlock.isIndefiniteForm)return n.error="Indefinite length form used for primitive encoding form",{offset:-1,result:n};let f=Se;switch(n.idBlock.tagClass){case 1:if(n.idBlock.tagNumber>=37&&n.idBlock.isHexOnly===!1)return n.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:n};switch(n.idBlock.tagNumber){case 0:if(n.idBlock.isConstructed&&n.lenBlock.length>0)return n.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:n};f=P.EndOfContent;break;case 1:f=P.Boolean;break;case 2:f=P.Integer;break;case 3:f=P.BitString;break;case 4:f=P.OctetString;break;case 5:f=P.Null;break;case 6:f=P.ObjectIdentifier;break;case 10:f=P.Enumerated;break;case 12:f=P.Utf8String;break;case 13:f=P.RelativeObjectIdentifier;break;case 14:f=P.TIME;break;case 15:return n.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:n};case 16:f=P.Sequence;break;case 17:f=P.Set;break;case 18:f=P.NumericString;break;case 19:f=P.PrintableString;break;case 20:f=P.TeletexString;break;case 21:f=P.VideotexString;break;case 22:f=P.IA5String;break;case 23:f=P.UTCTime;break;case 24:f=P.GeneralizedTime;break;case 25:f=P.GraphicString;break;case 26:f=P.VisibleString;break;case 27:f=P.GeneralString;break;case 28:f=P.UniversalString;break;case 29:f=P.CharacterString;break;case 30:f=P.BmpString;break;case 31:f=P.DATE;break;case 32:f=P.TimeOfDay;break;case 33:f=P.DateTime;break;case 34:f=P.Duration;break;default:{const d=n.idBlock.isConstructed?new P.Constructed:new P.Primitive;d.idBlock=n.idBlock,d.lenBlock=n.lenBlock,d.warnings=n.warnings,n=d}}break;case 2:case 3:case 4:default:f=n.idBlock.isConstructed?P.Constructed:P.Primitive}return n=qu(n,f),u=n.fromBER(r,e,n.lenBlock.isIndefiniteForm?t:n.lenBlock.length),n.valueBeforeDecodeView=r.subarray(i,i+n.blockLength),{offset:u,result:n}}function Jt(r){if(!r.byteLength){const e=new Se({},Ee);return e.error="Input buffer has zero length",{offset:-1,result:e}}return Wt(_.toUint8Array(r).slice(),0,r.byteLength)}function Gu(r,e){return r?1:e}class St extends Ee{constructor({value:e=[],isIndefiniteForm:t=!1,...i}={}){super(i),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,i){const n=_.toUint8Array(e);if(!ct(this,n,t,i))return-1;if(this.valueBeforeDecodeView=n.subarray(t,t+i),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let s=t;for(;Gu(this.isIndefiniteForm,i)>0;){const c=Wt(n,s,i);if(c.offset===-1)return this.error=c.result.error,this.warnings.concat(c.result.warnings),-1;if(s=c.offset,this.blockLength+=c.result.blockLength,i-=c.result.blockLength,this.value.push(c.result),this.isIndefiniteForm&&c.result.constructor.NAME===xr)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===xr?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(e,t){const i=t||new ai;for(let n=0;n<this.value.length;n++)this.value[n].toBER(e,i);return t?Ge:i.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const t of this.value)e.value.push(t.toJSON());return e}}St.NAME="ConstructedValueBlock";var ha;class Te extends Se{constructor(e={}){super(e,St),this.idBlock.isConstructed=!0}fromBER(e,t,i){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const n=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return n===-1?(this.error=this.valueBlock.error,n):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),n)}onAsciiEncoding(){const e=[];for(const i of this.valueBlock.value)e.push(i.toString("ascii").split(`
|
|
71
|
+
*/function si(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function Mn(r){let e=0,t=0;for(let n=0;n<r.length;n++){const s=r[n];e+=s.byteLength}const i=new Uint8Array(e);for(let n=0;n<r.length;n++){const s=r[n];i.set(new Uint8Array(s),t),t+=s.byteLength}return i.buffer}function ct(r,e,t,i){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):i<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-i<0?(r.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(r.error="Wrong parameter: inputBuffer has zero length",!1):(r.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}class ai{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return Mn(this.items)}}const kr=[new Uint8Array([1])],oa="0123456789",$n="name",sa="valueHexView",Ru="isHexOnly",Mu="idBlock",$u="tagClass",Uu="tagNumber",Hu="isConstructed",Lu="fromBER",Fu="toBER",Ku="local",Oe="",Ge=new ArrayBuffer(0),ci=new Uint8Array(0),xr="EndOfContent",aa="OCTET STRING",ca="BIT STRING";function et(r){var e;return e=class extends r{constructor(...i){var n;super(...i);const s=i[0]||{};this.isHexOnly=(n=s.isHexOnly)!==null&&n!==void 0?n:!1,this.valueHexView=s.valueHex?_.toUint8Array(s.valueHex):ci}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(i){this.valueHexView=new Uint8Array(i)}fromBER(i,n,s){const c=i instanceof ArrayBuffer?new Uint8Array(i):i;if(!ct(this,c,n,s))return-1;const u=n+s;return this.valueHexView=c.subarray(n,u),this.valueHexView.length?(this.blockLength=s,u):(this.warnings.push("Zero buffer length"),n)}toBER(i=!1){return this.isHexOnly?i?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",Ge)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:M.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}class It{constructor({blockLength:e=0,error:t=Oe,warnings:i=[],valueBeforeDecode:n=ci}={}){this.blockLength=e,this.error=t,this.warnings=i,this.valueBeforeDecodeView=_.toUint8Array(n)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:M.ToHex(this.valueBeforeDecodeView)}}}It.NAME="baseBlock";class Ee extends It{fromBER(e,t,i){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}Ee.NAME="valueBlock";class la extends et(It){constructor({idBlock:e={}}={}){var t,i,n,s;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?_.toUint8Array(e.valueHex):ci,this.tagClass=(i=e.tagClass)!==null&&i!==void 0?i:-1,this.tagNumber=(n=e.tagNumber)!==null&&n!==void 0?n:-1,this.isConstructed=(s=e.isConstructed)!==null&&s!==void 0?s:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",Ge}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){const n=new Uint8Array(1);if(!e){let s=this.tagNumber;s&=31,t|=s,n[0]=t}return n.buffer}if(!this.isHexOnly){const n=Et(this.tagNumber,7),s=new Uint8Array(n),c=n.byteLength,u=new Uint8Array(c+1);if(u[0]=t|31,!e){for(let f=0;f<c-1;f++)u[f+1]=s[f]|128;u[c]=s[c-1]}return u.buffer}const i=new Uint8Array(this.valueHexView.byteLength+1);if(i[0]=t|31,!e){const n=this.valueHexView;for(let s=0;s<n.length-1;s++)i[s+1]=n[s]|128;i[this.valueHexView.byteLength]=n[n.length-1]}return i.buffer}fromBER(e,t,i){const n=_.toUint8Array(e);if(!ct(this,n,t,i))return-1;const s=n.subarray(t,t+i);if(s.length===0)return this.error="Zero buffer length",-1;switch(s[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(s[0]&32)===32,this.isHexOnly=!1;const u=s[0]&31;if(u!==31)this.tagNumber=u,this.blockLength=1;else{let f=1,d=this.valueHexView=new Uint8Array(255),b=255;for(;s[f]&128;){if(d[f-1]=s[f]&127,f++,f>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(f===b){b+=255;const W=new Uint8Array(b);for(let O=0;O<d.length;O++)W[O]=d[O];d=this.valueHexView=new Uint8Array(b)}}this.blockLength=f+1,d[f-1]=s[f]&127;const y=new Uint8Array(f);for(let W=0;W<f;W++)y[W]=d[W];d=this.valueHexView=new Uint8Array(f),d.set(y),this.blockLength<=9?this.tagNumber=Wt(d,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}}la.NAME="identificationBlock";class ua extends It{constructor({lenBlock:e={}}={}){var t,i,n;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(i=e.longFormUsed)!==null&&i!==void 0?i:!1,this.length=(n=e.length)!==null&&n!==void 0?n:0}fromBER(e,t,i){const n=_.toUint8Array(e);if(!ct(this,n,t,i))return-1;const s=n.subarray(t,t+i);if(s.length===0)return this.error="Zero buffer length",-1;if(s[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=s[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(s[0]&128),this.longFormUsed===!1)return this.length=s[0],this.blockLength=1,t+this.blockLength;const c=s[0]&127;if(c>8)return this.error="Too big integer",-1;if(c+1>s.length)return this.error="End of input reached before message was fully decoded",-1;const u=t+1,f=n.subarray(u,u+c);return f[c-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=Wt(f,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=c+1,t+this.blockLength}toBER(e=!1){let t,i;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(t),i[0]=128),t;if(this.longFormUsed){const n=Et(this.length,8);if(n.byteLength>127)return this.error="Too big length",Ge;if(t=new ArrayBuffer(n.byteLength+1),e)return t;const s=new Uint8Array(n);i=new Uint8Array(t),i[0]=n.byteLength|128;for(let c=0;c<n.byteLength;c++)i[c+1]=s[c];return t}return t=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(t),i[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}ua.NAME="lengthBlock";const P={};class Ae extends It{constructor({name:e=Oe,optional:t=!1,primitiveSchema:i,...n}={},s){super(n),this.name=e,this.optional=t,i&&(this.primitiveSchema=i),this.idBlock=new la(n),this.lenBlock=new ua(n),this.valueBlock=s?new s(n):new Ee(n)}fromBER(e,t,i){const n=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return n===-1?(this.error=this.valueBlock.error,n):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),n)}toBER(e,t){const i=t||new ai;t||fa(this);const n=this.idBlock.toBER(e);if(i.write(n),this.lenBlock.isIndefiniteForm)i.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,i),i.write(new ArrayBuffer(2));else{const s=this.valueBlock.toBER(e);this.lenBlock.length=s.byteLength;const c=this.lenBlock.toBER(e);i.write(c),i.write(s)}return t?Ge:i.final()}toJSON(){const e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():M.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${M.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;const t=this.toBER(),i=e.toBER();return Du(t,i)}}Ae.NAME="BaseBlock";function fa(r){if(r instanceof P.Constructed)for(const e of r.valueBlock.value)fa(e)&&(r.lenBlock.isIndefiniteForm=!0);return!!r.lenBlock.isIndefiniteForm}class Un extends Ae{constructor({value:e=Oe,...t}={},i){super(t,i),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,i){const n=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return n===-1?(this.error=this.valueBlock.error,n):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),n)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}Un.NAME="BaseStringBlock";class da extends et(Ee){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}}da.NAME="PrimitiveValueBlock";var pa;class Cr extends Ae{constructor(e={}){super(e,da),this.idBlock.isConstructed=!1}}pa=Cr,P.Primitive=pa,Cr.NAME="PRIMITIVE";function qu(r,e){if(r instanceof e)return r;const t=new e;return t.idBlock=r.idBlock,t.lenBlock=r.lenBlock,t.warnings=r.warnings,t.valueBeforeDecodeView=r.valueBeforeDecodeView,t}function zt(r,e=0,t=r.length){const i=e;let n=new Ae({},Ee);const s=new It;if(!ct(s,r,e,t))return n.error=s.error,{offset:-1,result:n};if(!r.subarray(e,e+t).length)return n.error="Zero buffer length",{offset:-1,result:n};let u=n.idBlock.fromBER(r,e,t);if(n.idBlock.warnings.length&&n.warnings.concat(n.idBlock.warnings),u===-1)return n.error=n.idBlock.error,{offset:-1,result:n};if(e=u,t-=n.idBlock.blockLength,u=n.lenBlock.fromBER(r,e,t),n.lenBlock.warnings.length&&n.warnings.concat(n.lenBlock.warnings),u===-1)return n.error=n.lenBlock.error,{offset:-1,result:n};if(e=u,t-=n.lenBlock.blockLength,!n.idBlock.isConstructed&&n.lenBlock.isIndefiniteForm)return n.error="Indefinite length form used for primitive encoding form",{offset:-1,result:n};let f=Ae;switch(n.idBlock.tagClass){case 1:if(n.idBlock.tagNumber>=37&&n.idBlock.isHexOnly===!1)return n.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:n};switch(n.idBlock.tagNumber){case 0:if(n.idBlock.isConstructed&&n.lenBlock.length>0)return n.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:n};f=P.EndOfContent;break;case 1:f=P.Boolean;break;case 2:f=P.Integer;break;case 3:f=P.BitString;break;case 4:f=P.OctetString;break;case 5:f=P.Null;break;case 6:f=P.ObjectIdentifier;break;case 10:f=P.Enumerated;break;case 12:f=P.Utf8String;break;case 13:f=P.RelativeObjectIdentifier;break;case 14:f=P.TIME;break;case 15:return n.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:n};case 16:f=P.Sequence;break;case 17:f=P.Set;break;case 18:f=P.NumericString;break;case 19:f=P.PrintableString;break;case 20:f=P.TeletexString;break;case 21:f=P.VideotexString;break;case 22:f=P.IA5String;break;case 23:f=P.UTCTime;break;case 24:f=P.GeneralizedTime;break;case 25:f=P.GraphicString;break;case 26:f=P.VisibleString;break;case 27:f=P.GeneralString;break;case 28:f=P.UniversalString;break;case 29:f=P.CharacterString;break;case 30:f=P.BmpString;break;case 31:f=P.DATE;break;case 32:f=P.TimeOfDay;break;case 33:f=P.DateTime;break;case 34:f=P.Duration;break;default:{const d=n.idBlock.isConstructed?new P.Constructed:new P.Primitive;d.idBlock=n.idBlock,d.lenBlock=n.lenBlock,d.warnings=n.warnings,n=d}}break;case 2:case 3:case 4:default:f=n.idBlock.isConstructed?P.Constructed:P.Primitive}return n=qu(n,f),u=n.fromBER(r,e,n.lenBlock.isIndefiniteForm?t:n.lenBlock.length),n.valueBeforeDecodeView=r.subarray(i,i+n.blockLength),{offset:u,result:n}}function Jt(r){if(!r.byteLength){const e=new Ae({},Ee);return e.error="Input buffer has zero length",{offset:-1,result:e}}return zt(_.toUint8Array(r).slice(),0,r.byteLength)}function Gu(r,e){return r?1:e}class At extends Ee{constructor({value:e=[],isIndefiniteForm:t=!1,...i}={}){super(i),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,i){const n=_.toUint8Array(e);if(!ct(this,n,t,i))return-1;if(this.valueBeforeDecodeView=n.subarray(t,t+i),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let s=t;for(;Gu(this.isIndefiniteForm,i)>0;){const c=zt(n,s,i);if(c.offset===-1)return this.error=c.result.error,this.warnings.concat(c.result.warnings),-1;if(s=c.offset,this.blockLength+=c.result.blockLength,i-=c.result.blockLength,this.value.push(c.result),this.isIndefiniteForm&&c.result.constructor.NAME===xr)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===xr?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(e,t){const i=t||new ai;for(let n=0;n<this.value.length;n++)this.value[n].toBER(e,i);return t?Ge:i.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const t of this.value)e.value.push(t.toJSON());return e}}At.NAME="ConstructedValueBlock";var ha;class Te extends Ae{constructor(e={}){super(e,At),this.idBlock.isConstructed=!0}fromBER(e,t,i){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const n=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return n===-1?(this.error=this.valueBlock.error,n):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),n)}onAsciiEncoding(){const e=[];for(const i of this.valueBlock.value)e.push(i.toString("ascii").split(`
|
|
72
72
|
`).map(n=>` ${n}`).join(`
|
|
73
73
|
`));const t=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :
|
|
74
74
|
${e.join(`
|
|
75
|
-
`)}`:`${t} :`}}ha=Te,P.Constructed=ha,Te.NAME="CONSTRUCTED";class ya extends Ee{fromBER(e,t,i){return t}toBER(e){return Ge}}ya.override="EndOfContentValueBlock";var ga;class Hn extends Se{constructor(e={}){super(e,ya),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}ga=Hn,P.EndOfContent=ga,Hn.NAME=xr;var ma;class Nt extends Se{constructor(e={}){super(e,Ee),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,i){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=i,t+i>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+i}toBER(e,t){const i=new ArrayBuffer(2);if(!e){const n=new Uint8Array(i);n[0]=5,n[1]=0}return t&&t.write(i),i}onAsciiEncoding(){return`${this.constructor.NAME}`}}ma=Nt,P.Null=ma,Nt.NAME="NULL";class va extends et(Ee){constructor({value:e,...t}={}){super(t),t.valueHex?this.valueHexView=_.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}fromBER(e,t,i){const n=_.toUint8Array(e);return ct(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,na.call(this),this.blockLength=i,t+i):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}va.NAME="BooleanValueBlock";var ba;let li=class extends Se{constructor(e={}){super(e,va),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};ba=li,P.Boolean=ba,li.NAME="BOOLEAN";class wa extends et(St){constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,i){let n=0;if(this.isConstructed){if(this.isHexOnly=!1,n=St.prototype.fromBER.call(this,e,t,i),n===-1)return n;for(let s=0;s<this.value.length;s++){const c=this.value[s].constructor.NAME;if(c===xr){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(c!==aa)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,n=super.fromBER(e,t,i),this.blockLength=i;return n}toBER(e,t){return this.isConstructed?St.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}wa.NAME="OctetStringValueBlock";var Sa;let Ot=class Iu extends Se{constructor({idBlock:e={},lenBlock:t={},...i}={}){var n,s;(n=i.isConstructed)!==null&&n!==void 0||(i.isConstructed=!!(!((s=i.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:i.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!i.isIndefiniteForm},...i},wa),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,i){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,i===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){const s=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(t,t+i);try{if(s.byteLength){const c=Wt(s,0,s.byteLength);c.offset!==-1&&c.offset===i&&(this.valueBlock.value=[c.result])}}catch{}}return super.fromBER(e,t,i)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?Te.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${M.ToHex(this.valueBlock.valueHexView)}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const e=[];for(const t of this.valueBlock.value)t instanceof Iu&&e.push(t.valueBlock.valueHexView);return _.concat(e)}};Sa=Ot,P.OctetString=Sa,Ot.NAME=aa;class Aa extends et(St){constructor({unusedBits:e=0,isConstructed:t=!1,...i}={}){super(i),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,i){if(!i)return t;let n=-1;if(this.isConstructed){if(n=St.prototype.fromBER.call(this,e,t,i),n===-1)return n;for(const u of this.value){const f=u.constructor.NAME;if(f===xr){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(f!==ca)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const d=u.valueBlock;if(this.unusedBits>0&&d.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=d.unusedBits}return n}const s=_.toUint8Array(e);if(!ct(this,s,t,i))return-1;const c=s.subarray(t,t+i);if(this.unusedBits=c[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const u=c.subarray(1);try{if(u.byteLength){const f=Wt(u,0,u.byteLength);f.offset!==-1&&f.offset===i-1&&(this.value=[f.result])}}catch{}}return this.valueHexView=c.subarray(1),this.blockLength=c.length,t+i}toBER(e,t){if(this.isConstructed)return St.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return Ge;const i=new Uint8Array(this.valueHexView.length+1);return i[0]=this.unusedBits,i.set(this.valueHexView,1),i.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}Aa.NAME="BitStringValueBlock";var ka;let Tt=class extends Se{constructor({idBlock:e={},lenBlock:t={},...i}={}){var n,s;(n=i.isConstructed)!==null&&n!==void 0||(i.isConstructed=!!(!((s=i.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:i.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!i.isIndefiniteForm},...i},Aa),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,i){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Te.prototype.onAsciiEncoding.call(this);{const e=[],t=this.valueBlock.valueHexView;for(const n of t)e.push(n.toString(2).padStart(8,"0"));const i=e.join("");return`${this.constructor.NAME} : ${i.substring(0,i.length-this.valueBlock.unusedBits)}`}}};ka=Tt,P.BitString=ka,Tt.NAME=ca;var xa;function zu(r,e){const t=new Uint8Array([0]),i=new Uint8Array(r),n=new Uint8Array(e);let s=i.slice(0);const c=s.length-1,u=n.slice(0),f=u.length-1;let d=0;const v=f<c?c:f;let y=0;for(let z=v;z>=0;z--,y++){switch(!0){case y<u.length:d=s[c-y]+u[f-y]+t[0];break;default:d=s[c-y]+t[0]}switch(t[0]=d/10,!0){case y>=s.length:s=Rn(new Uint8Array([d%10]),s);break;default:s[c-y]=d%10}}return t[0]>0&&(s=Rn(t,s)),s}function Ca(r){if(r>=kr.length)for(let e=kr.length;e<=r;e++){const t=new Uint8Array([0]);let i=kr[e-1].slice(0);for(let n=i.length-1;n>=0;n--){const s=new Uint8Array([(i[n]<<1)+t[0]]);t[0]=s[0]/10,i[n]=s[0]%10}t[0]>0&&(i=Rn(t,i)),kr.push(i)}return kr[r]}function Wu(r,e){let t=0;const i=new Uint8Array(r),n=new Uint8Array(e),s=i.slice(0),c=s.length-1,u=n.slice(0),f=u.length-1;let d,v=0;for(let y=f;y>=0;y--,v++)switch(d=s[c-v]-u[f-v]-t,!0){case d<0:t=1,s[c-v]=d+10;break;default:t=0,s[c-v]=d}if(t>0)for(let y=c-f+1;y>=0;y--,v++)if(d=s[c-v]-t,d<0)t=1,s[c-v]=d+10;else{t=0,s[c-v]=d;break}return s.slice()}class Ln extends et(Ee){constructor({value:e,...t}={}){super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}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=na.call(this)))}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(Pu(e))}get valueDec(){return this._valueDec}fromDER(e,t,i,n=0){const s=this.fromBER(e,t,i);if(s===-1)return s;const c=this.valueHexView;return c[0]===0&&c[1]&128?this.valueHexView=c.subarray(1):n!==0&&c.length<n&&(n-c.length>1&&(n=c.length+1),this.valueHexView=c.subarray(n-c.length)),s}toDER(e=!1){const t=this.valueHexView;switch(!0){case(t[0]&128)!==0:{const i=new Uint8Array(this.valueHexView.length+1);i[0]=0,i.set(t,1),this.valueHexView=i}break;case(t[0]===0&&(t[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,t,i){const n=super.fromBER(e,t,i);return n===-1||this.setValueHex(),n}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=this.valueHexView.length*8-1;let t=new Uint8Array(this.valueHexView.length*8/3),i=0,n;const s=this.valueHexView;let c="",u=!1;for(let f=s.byteLength-1;f>=0;f--){n=s[f];for(let d=0;d<8;d++){if((n&1)===1)switch(i){case e:t=Wu(Ca(i),t),c="-";break;default:t=zu(t,Ca(i))}i++,n>>=1}}for(let f=0;f<t.length;f++)t[f]&&(u=!0),u&&(c+=oa.charAt(t[f]));return u===!1&&(c+=oa.charAt(0)),c}}xa=Ln,Ln.NAME="IntegerValueBlock",Object.defineProperty(xa.prototype,"valueHex",{set:function(r){this.valueHexView=new Uint8Array(r),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var Ba;class tt extends Se{constructor(e={}){super(e,Ln),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return si(),BigInt(this.valueBlock.toString())}static fromBigInt(e){si();const t=BigInt(e),i=new ai,n=t.toString(16).replace(/^-/,""),s=new Uint8Array(M.FromHex(n));if(t<0){const u=new Uint8Array(s.length+(s[0]&128?1:0));u[0]|=128;const d=BigInt(`0x${M.ToHex(u)}`)+t,v=_.toUint8Array(M.FromHex(d.toString(16)));v[0]|=128,i.write(v)}else s[0]&128&&i.write(new Uint8Array([0])),i.write(s);return new tt({valueHex:i.final()})}convertToDER(){const e=new tt({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new tt({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}Ba=tt,P.Integer=Ba,tt.NAME="INTEGER";var Ea;class ui extends tt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}Ea=ui,P.Enumerated=Ea,ui.NAME="ENUMERATED";class Fn extends et(Ee){constructor({valueDec:e=-1,isFirstSid:t=!1,...i}={}){super(i),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,i){if(!i)return t;const n=_.toUint8Array(e);if(!ct(this,n,t,i))return-1;const s=n.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let u=0;u<i&&(this.valueHexView[u]=s[u]&127,this.blockLength++,!!(s[u]&128));u++);const c=new Uint8Array(this.blockLength);for(let u=0;u<this.blockLength;u++)c[u]=this.valueHexView[u];return this.valueHexView=c,s[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=zt(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){si();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;const i=new Uint8Array(t.length/7);for(let n=0;n<i.length;n++)i[n]=parseInt(t.slice(n*7,n*7+7),2)+(n+1<i.length?128:0);this.fromBER(i.buffer,0,i.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const n=this.valueHexView,s=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength-1;c++)s[c]=n[c]|128;return s[this.blockLength-1]=n[this.blockLength-1],s.buffer}const t=Et(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",Ge;const i=new Uint8Array(t.byteLength);if(!e){const n=new Uint8Array(t),s=t.byteLength-1;for(let c=0;c<s;c++)i[c]=n[c]|128;i[s]=n[s]}return i}toString(){let e="";if(this.isHexOnly)e=M.ToHex(this.valueHexView);else if(this.isFirstSid){let t=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",t-=40):(e="2.",t-=80),e+=t.toString()}else e=this.valueDec.toString();return e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}}Fn.NAME="sidBlock";class Ia extends Ee{constructor({value:e=Oe,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let n=t;for(;i>0;){const s=new Fn;if(n=s.fromBER(e,n,i),n===-1)return this.blockLength=0,this.error=s.error,n;this.value.length===0&&(s.isFirstSid=!0),this.blockLength+=s.blockLength,i-=s.blockLength,this.value.push(s)}return n}toBER(e){const t=[];for(let i=0;i<this.value.length;i++){const n=this.value[i].toBER(e);if(n.byteLength===0)return this.error=this.value[i].error,Ge;t.push(n)}return Mn(t)}fromString(e){this.value=[];let t=0,i=0,n="",s=!1;do if(i=e.indexOf(".",t),i===-1?n=e.substring(t):n=e.substring(t,i),t=i+1,s){const c=this.value[0];let u=0;switch(c.valueDec){case 0:break;case 1:u=40;break;case 2:u=80;break;default:this.value=[];return}const f=parseInt(n,10);if(isNaN(f))return;c.valueDec=f+u,s=!1}else{const c=new Fn;if(n>Number.MAX_SAFE_INTEGER){si();const u=BigInt(n);c.valueBigInt=u}else if(c.valueDec=parseInt(n,10),isNaN(c.valueDec))return;this.value.length||(c.isFirstSid=!0,s=!0),this.value.push(c)}while(i!==-1)}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let n=this.value[i].toString();i!==0&&(e=`${e}.`),t?(n=`{${n}}`,this.value[i].isFirstSid?e=`2.{${n} - 80}`:e+=n):e+=n}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}Ia.NAME="ObjectIdentifierValueBlock";var Na;class fi extends Se{constructor(e={}){super(e,Ia),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}Na=fi,P.ObjectIdentifier=Na,fi.NAME="OBJECT IDENTIFIER";class Kn extends et(It){constructor({valueDec:e=0,...t}={}){super(t),this.valueDec=e}fromBER(e,t,i){if(i===0)return t;const n=_.toUint8Array(e);if(!ct(this,n,t,i))return-1;const s=n.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let u=0;u<i&&(this.valueHexView[u]=s[u]&127,this.blockLength++,!!(s[u]&128));u++);const c=new Uint8Array(this.blockLength);for(let u=0;u<this.blockLength;u++)c[u]=this.valueHexView[u];return this.valueHexView=c,s[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=zt(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const n=this.valueHexView,s=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength-1;c++)s[c]=n[c]|128;return s[this.blockLength-1]=n[this.blockLength-1],s.buffer}const t=Et(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",Ge;const i=new Uint8Array(t.byteLength);if(!e){const n=new Uint8Array(t),s=t.byteLength-1;for(let c=0;c<s;c++)i[c]=n[c]|128;i[s]=n[s]}return i.buffer}toString(){let e="";return this.isHexOnly?e=M.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}Kn.NAME="relativeSidBlock";class Oa extends Ee{constructor({value:e=Oe,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let n=t;for(;i>0;){const s=new Kn;if(n=s.fromBER(e,n,i),n===-1)return this.blockLength=0,this.error=s.error,n;this.blockLength+=s.blockLength,i-=s.blockLength,this.value.push(s)}return n}toBER(e,t){const i=[];for(let n=0;n<this.value.length;n++){const s=this.value[n].toBER(e);if(s.byteLength===0)return this.error=this.value[n].error,Ge;i.push(s)}return Mn(i)}fromString(e){this.value=[];let t=0,i=0,n="";do{i=e.indexOf(".",t),i===-1?n=e.substring(t):n=e.substring(t,i),t=i+1;const s=new Kn;if(s.valueDec=parseInt(n,10),isNaN(s.valueDec))return!0;this.value.push(s)}while(i!==-1);return!0}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let n=this.value[i].toString();i!==0&&(e=`${e}.`),t&&(n=`{${n}}`),e+=n}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}Oa.NAME="RelativeObjectIdentifierValueBlock";var Ta;class qn extends Se{constructor(e={}){super(e,Oa),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}Ta=qn,P.RelativeObjectIdentifier=Ta,qn.NAME="RelativeObjectIdentifier";var Va;class lt extends Te{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}Va=lt,P.Sequence=Va,lt.NAME="SEQUENCE";var _a;let ut=class extends Te{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};_a=ut,P.Set=_a,ut.NAME="SET";class ja extends et(Ee){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=Oe}toJSON(){return{...super.toJSON(),value:this.value}}}ja.NAME="StringValueBlock";class Pa extends ja{}Pa.NAME="SimpleStringValueBlock";class Re extends Un{constructor({...e}={}){super(e,Pa)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,_.toUint8Array(e))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(t);for(let n=0;n<t;n++)i[n]=e.charCodeAt(n);this.valueBlock.value=e}}Re.NAME="SIMPLE STRING";class Da extends Re{fromBuffer(e){this.valueBlock.valueHexView=_.toUint8Array(e);try{this.valueBlock.value=M.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=M.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(M.FromUtf8String(e)),this.valueBlock.value=e}}Da.NAME="Utf8StringValueBlock";var Ra;class ft extends Da{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}Ra=ft,P.Utf8String=Ra,ft.NAME="UTF8String";class Ma extends Re{fromBuffer(e){this.valueBlock.value=M.ToUtf16String(e),this.valueBlock.valueHexView=_.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(M.FromUtf16String(e))}}Ma.NAME="BmpStringValueBlock";var $a;class di extends Ma{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}$a=di,P.BmpString=$a,di.NAME="BMPString";class Ua extends Re{fromBuffer(e){const t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),i=new Uint8Array(t);for(let n=0;n<i.length;n+=4)i[n]=i[n+3],i[n+1]=i[n+2],i[n+2]=0,i[n+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(t*4);for(let n=0;n<t;n++){const s=Et(e.charCodeAt(n),8),c=new Uint8Array(s);if(c.length>4)continue;const u=4-c.length;for(let f=c.length-1;f>=0;f--)i[n*4+f+u]=c[f]}this.valueBlock.value=e}}Ua.NAME="UniversalStringValueBlock";var Ha;class pi extends Ua{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}Ha=pi,P.UniversalString=Ha,pi.NAME="UniversalString";var La;class hi extends Re{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}La=hi,P.NumericString=La,hi.NAME="NumericString";var Fa;class yi extends Re{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}Fa=yi,P.PrintableString=Fa,yi.NAME="PrintableString";var Ka;class gi extends Re{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}Ka=gi,P.TeletexString=Ka,gi.NAME="TeletexString";var qa;class mi extends Re{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}qa=mi,P.VideotexString=qa,mi.NAME="VideotexString";var Ga;class vi extends Re{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}Ga=vi,P.IA5String=Ga,vi.NAME="IA5String";var za;class bi extends Re{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}za=bi,P.GraphicString=za,bi.NAME="GraphicString";var Wa;class Br extends Re{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}Wa=Br,P.VisibleString=Wa,Br.NAME="VisibleString";var Ja;class wi extends Re{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}Ja=wi,P.GeneralString=Ja,wi.NAME="GeneralString";var Ya;class Si extends Re{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}Ya=Si,P.CharacterString=Ya,Si.NAME="CharacterString";var Za;class Er extends Br{constructor({value:e,valueDate:t,...i}={}){if(super(i),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let n=0;n<e.length;n++)this.valueBlock.valueHexView[n]=e.charCodeAt(n)}t&&(this.fromDate(t),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,_.toUint8Array(e)))}toBuffer(){const e=this.toString(),t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let n=0;n<e.length;n++)i[n]=e.charCodeAt(n);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){const i=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(i===null){this.error="Wrong input string for conversion";return}const n=parseInt(i[1],10);n>=50?this.year=1900+n:this.year=2e3+n,this.month=parseInt(i[2],10),this.day=parseInt(i[3],10),this.hour=parseInt(i[4],10),this.minute=parseInt(i[5],10),this.second=parseInt(i[6],10)}toString(e="iso"){if(e==="iso"){const t=new Array(7);return t[0]=De(this.year<2e3?this.year-1900:this.year-2e3,2),t[1]=De(this.month,2),t[2]=De(this.day,2),t[3]=De(this.hour,2),t[4]=De(this.minute,2),t[5]=De(this.second,2),t[6]="Z",t.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}Za=Er,P.UTCTime=Za,Er.NAME="UTCTime";var Qa;class Ai extends Er{constructor(e={}){var t;super(e),(t=this.millisecond)!==null&&t!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(e){let t=!1,i="",n="",s=0,c,u=0,f=0;if(e[e.length-1]==="Z")i=e.substring(0,e.length-1),t=!0;else{const y=new Number(e[e.length-1]);if(isNaN(y.valueOf()))throw new Error("Wrong input string for conversion");i=e}if(t){if(i.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(i.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let y=1,z=i.indexOf("+"),O="";if(z===-1&&(z=i.indexOf("-"),y=-1),z!==-1){if(O=i.substring(z+1),i=i.substring(0,z),O.length!==2&&O.length!==4)throw new Error("Wrong input string for conversion");let p=parseInt(O.substring(0,2),10);if(isNaN(p.valueOf()))throw new Error("Wrong input string for conversion");if(u=y*p,O.length===4){if(p=parseInt(O.substring(2,4),10),isNaN(p.valueOf()))throw new Error("Wrong input string for conversion");f=y*p}}}let d=i.indexOf(".");if(d===-1&&(d=i.indexOf(",")),d!==-1){const y=new Number(`0${i.substring(d)}`);if(isNaN(y.valueOf()))throw new Error("Wrong input string for conversion");s=y.valueOf(),n=i.substring(0,d)}else n=i;switch(!0){case n.length===8:if(c=/(\d{4})(\d{2})(\d{2})/ig,d!==-1)throw new Error("Wrong input string for conversion");break;case n.length===10:if(c=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let y=60*s;this.minute=Math.floor(y),y=60*(y-this.minute),this.second=Math.floor(y),y=1e3*(y-this.second),this.millisecond=Math.floor(y)}break;case n.length===12:if(c=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let y=60*s;this.second=Math.floor(y),y=1e3*(y-this.second),this.millisecond=Math.floor(y)}break;case n.length===14:if(c=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){const y=1e3*s;this.millisecond=Math.floor(y)}break;default:throw new Error("Wrong input string for conversion")}const v=c.exec(n);if(v===null)throw new Error("Wrong input string for conversion");for(let y=1;y<v.length;y++)switch(y){case 1:this.year=parseInt(v[y],10);break;case 2:this.month=parseInt(v[y],10);break;case 3:this.day=parseInt(v[y],10);break;case 4:this.hour=parseInt(v[y],10)+u;break;case 5:this.minute=parseInt(v[y],10)+f;break;case 6:this.second=parseInt(v[y],10);break;default:throw new Error("Wrong input string for conversion")}if(t===!1){const y=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=y.getUTCFullYear(),this.month=y.getUTCMonth(),this.day=y.getUTCDay(),this.hour=y.getUTCHours(),this.minute=y.getUTCMinutes(),this.second=y.getUTCSeconds(),this.millisecond=y.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){const t=[];return t.push(De(this.year,4)),t.push(De(this.month,2)),t.push(De(this.day,2)),t.push(De(this.hour,2)),t.push(De(this.minute,2)),t.push(De(this.second,2)),this.millisecond!==0&&(t.push("."),t.push(De(this.millisecond,3))),t.push("Z"),t.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}Qa=Ai,P.GeneralizedTime=Qa,Ai.NAME="GeneralizedTime";var Xa;class Gn extends ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}Xa=Gn,P.DATE=Xa,Gn.NAME="DATE";var ec;class zn extends ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}ec=zn,P.TimeOfDay=ec,zn.NAME="TimeOfDay";var tc;class Wn extends ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}tc=Wn,P.DateTime=tc,Wn.NAME="DateTime";var rc;class Jn extends ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}rc=Jn,P.Duration=rc,Jn.NAME="Duration";var ic;class Yn extends ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}ic=Yn,P.TIME=ic,Yn.NAME="TIME";class Vt{constructor({name:e=Oe,optional:t=!1}={}){this.name=e,this.optional=t}}class Zn extends Vt{constructor({value:e=[],...t}={}){super(t),this.value=e}}class ki extends Vt{constructor({value:e=new Vt,local:t=!1,...i}={}){super(i),this.value=e,this.local=t}}class Ju{constructor({data:e=ci}={}){this.dataView=_.toUint8Array(e)}get data(){return this.dataView.slice().buffer}set data(e){this.dataView=_.toUint8Array(e)}fromBER(e,t,i){const n=t+i;return this.dataView=_.toUint8Array(e).subarray(t,n),n}toBER(e){return this.dataView.slice().buffer}}function _t(r,e,t){if(t instanceof Zn){for(let s=0;s<t.value.length;s++)if(_t(r,e,t.value[s]).verified)return{verified:!0,result:r};{const s={verified:!1,result:{error:"Wrong values for Choice type"}};return t.hasOwnProperty($n)&&(s.name=t.name),s}}if(t instanceof Vt)return t.hasOwnProperty($n)&&(r[t.name]=e),{verified:!0,result:r};if(!(r instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Mu in t))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Lu in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Fu in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const i=t.idBlock.toBER(!1);if(i.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(t.idBlock.fromBER(i,0,i.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(t.idBlock.hasOwnProperty($u)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(Uu)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(Hu)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:r};if(!(Ru in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:r};if(t.idBlock.isHexOnly){if(!(sa in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const s=t.idBlock.valueHexView,c=e.idBlock.valueHexView;if(s.length!==c.length)return{verified:!1,result:r};for(let u=0;u<s.length;u++)if(s[u]!==c[1])return{verified:!1,result:r}}if(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Oe),t.name&&(r[t.name]=e)),t instanceof P.Constructed){let s=0,c={verified:!1,result:{error:"Unknown error"}},u=t.valueBlock.value.length;if(u>0&&t.valueBlock.value[0]instanceof ki&&(u=e.valueBlock.value.length),u===0)return{verified:!0,result:r};if(e.valueBlock.value.length===0&&t.valueBlock.value.length!==0){let f=!0;for(let d=0;d<t.valueBlock.value.length;d++)f=f&&(t.valueBlock.value[d].optional||!1);return f?{verified:!0,result:r}:(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Oe),t.name&&delete r[t.name]),r.error="Inconsistent object length",{verified:!1,result:r})}for(let f=0;f<u;f++)if(f-s>=e.valueBlock.value.length){if(t.valueBlock.value[f].optional===!1){const d={verified:!1,result:r};return r.error="Inconsistent length between ASN.1 data and schema",t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Oe),t.name&&(delete r[t.name],d.name=t.name)),d}}else if(t.valueBlock.value[0]instanceof ki){if(c=_t(r,e.valueBlock.value[f],t.valueBlock.value[0].value),c.verified===!1)if(t.valueBlock.value[0].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Oe),t.name&&delete r[t.name]),c;if($n in t.valueBlock.value[0]&&t.valueBlock.value[0].name.length>0){let d={};Ku in t.valueBlock.value[0]&&t.valueBlock.value[0].local?d=e:d=r,typeof d[t.valueBlock.value[0].name]>"u"&&(d[t.valueBlock.value[0].name]=[]),d[t.valueBlock.value[0].name].push(e.valueBlock.value[f])}}else if(c=_t(r,e.valueBlock.value[f-s],t.valueBlock.value[f]),c.verified===!1)if(t.valueBlock.value[f].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Oe),t.name&&delete r[t.name]),c;if(c.verified===!1){const f={verified:!1,result:r};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Oe),t.name&&(delete r[t.name],f.name=t.name)),f}return{verified:!0,result:r}}if(t.primitiveSchema&&sa in e.valueBlock){const s=Wt(e.valueBlock.valueHexView);if(s.offset===-1){const c={verified:!1,result:s.result};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Oe),t.name&&(delete r[t.name],c.name=t.name)),c}return _t(r,s.result,t.primitiveSchema)}return{verified:!0,result:r}}function Yu(r,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const t=Wt(_.toUint8Array(r));return t.offset===-1?{verified:!1,result:t.result}:_t(t.result,t.result,e)}const nc=Object.freeze(Object.defineProperty({__proto__:null,Any:Vt,BaseBlock:Se,BaseStringBlock:Un,BitString:Tt,BmpString:di,Boolean:li,CharacterString:Si,Choice:Zn,Constructed:Te,DATE:Gn,DateTime:Wn,Duration:Jn,EndOfContent:Hn,Enumerated:ui,GeneralString:wi,GeneralizedTime:Ai,GraphicString:bi,HexBlock:et,IA5String:vi,Integer:tt,Null:Nt,NumericString:hi,ObjectIdentifier:fi,OctetString:Ot,Primitive:Cr,PrintableString:yi,RawData:Ju,RelativeObjectIdentifier:qn,Repeated:ki,Sequence:lt,Set:ut,TIME:Yn,TeletexString:gi,TimeOfDay:zn,UTCTime:Er,UniversalString:pi,Utf8String:ft,ValueBlock:Ee,VideotexString:mi,ViewWriter:ai,VisibleString:Br,compareSchema:_t,fromBER:Jt,verifySchema:Yu},Symbol.toStringTag,{value:"Module"}));var x;(function(r){r[r.Sequence=0]="Sequence",r[r.Set=1]="Set",r[r.Choice=2]="Choice"})(x||(x={}));var h;(function(r){r[r.Any=1]="Any",r[r.Boolean=2]="Boolean",r[r.OctetString=3]="OctetString",r[r.BitString=4]="BitString",r[r.Integer=5]="Integer",r[r.Enumerated=6]="Enumerated",r[r.ObjectIdentifier=7]="ObjectIdentifier",r[r.Utf8String=8]="Utf8String",r[r.BmpString=9]="BmpString",r[r.UniversalString=10]="UniversalString",r[r.NumericString=11]="NumericString",r[r.PrintableString=12]="PrintableString",r[r.TeletexString=13]="TeletexString",r[r.VideotexString=14]="VideotexString",r[r.IA5String=15]="IA5String",r[r.GraphicString=16]="GraphicString",r[r.VisibleString=17]="VisibleString",r[r.GeneralString=18]="GeneralString",r[r.CharacterString=19]="CharacterString",r[r.UTCTime=20]="UTCTime",r[r.GeneralizedTime=21]="GeneralizedTime",r[r.DATE=22]="DATE",r[r.TimeOfDay=23]="TimeOfDay",r[r.DateTime=24]="DateTime",r[r.Duration=25]="Duration",r[r.TIME=26]="TIME",r[r.Null=27]="Null"})(h||(h={}));class xi{constructor(e,t=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(_.isBufferSource(e))this.unusedBits=t,this.value=_.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof Tt))throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=e.valueBlock.unusedBits,this.value=e.valueBlock.valueHex,this}toASN(){return new Tt({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new Tt({name:e})}toNumber(){let e="";const t=new Uint8Array(this.value);for(const i of t)e+=i.toString(2).padStart(8,"0");return e=e.split("").reverse().join(""),this.unusedBits&&(e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(e,2)}fromNumber(e){let t=e.toString(2);const i=t.length+7>>3;this.unusedBits=(i<<3)-t.length;const n=new Uint8Array(i);t=t.padStart(i<<3,"0").split("").reverse().join("");let s=0;for(;s<i;)n[s]=parseInt(t.slice(s<<3,(s<<3)+8),2),s++;this.value=n.buffer}}class ie{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):_.isBufferSource(e)?this.buffer=_.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof Ot))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new Ot({valueHex:this.buffer})}toSchema(e){return new Ot({name:e})}}const Zu={fromASN:r=>r instanceof Nt?null:r.valueBeforeDecodeView,toASN:r=>{if(r===null)return new Nt;const e=Jt(r);if(e.result.error)throw new Error(e.result.error);return e.result}},Qu={fromASN:r=>r.valueBlock.valueHexView.byteLength>=4?r.valueBlock.toString():r.valueBlock.valueDec,toASN:r=>new tt({value:+r})},Xu={fromASN:r=>r.valueBlock.valueDec,toASN:r=>new ui({value:r})},ue={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new tt({valueHex:r})},ef={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new Tt({valueHex:r})},tf={fromASN:r=>r.valueBlock.toString(),toASN:r=>new fi({value:r})},rf={fromASN:r=>r.valueBlock.value,toASN:r=>new li({value:r})},Ci={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new Ot({valueHex:r})},nf={fromASN:r=>new ie(r.getValue()),toASN:r=>r.toASN()};function He(r){return{fromASN:e=>e.valueBlock.value,toASN:e=>new r({value:e})}}const oc=He(ft),of=He(di),sf=He(pi),af=He(hi),cf=He(yi),lf=He(gi),uf=He(mi),ff=He(vi),df=He(bi),pf=He(Br),hf=He(wi),yf=He(Si),gf={fromASN:r=>r.toDate(),toASN:r=>new Er({valueDate:r})},mf={fromASN:r=>r.toDate(),toASN:r=>new Ai({valueDate:r})},vf={fromASN:()=>null,toASN:()=>new Nt};function Qn(r){switch(r){case h.Any:return Zu;case h.BitString:return ef;case h.BmpString:return of;case h.Boolean:return rf;case h.CharacterString:return yf;case h.Enumerated:return Xu;case h.GeneralString:return hf;case h.GeneralizedTime:return mf;case h.GraphicString:return df;case h.IA5String:return ff;case h.Integer:return Qu;case h.Null:return vf;case h.NumericString:return af;case h.ObjectIdentifier:return tf;case h.OctetString:return Ci;case h.PrintableString:return cf;case h.TeletexString:return lf;case h.UTCTime:return gf;case h.UniversalString:return sf;case h.Utf8String:return oc;case h.VideotexString:return uf;case h.VisibleString:return pf;default:return null}}function dt(r){return typeof r=="function"&&r.prototype?r.prototype.toASN&&r.prototype.fromASN?!0:dt(r.prototype):!!(r&&typeof r=="object"&&"toASN"in r&&"fromASN"in r)}function sc(r){var e;if(r){const t=Object.getPrototypeOf(r);return((e=t==null?void 0:t.prototype)===null||e===void 0?void 0:e.constructor)===Array?!0:sc(t)}return!1}function bf(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;const t=new Uint8Array(r),i=new Uint8Array(e);for(let n=0;n<r.byteLength;n++)if(t[n]!==i[n])return!1;return!0}class wf{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e,t=!1){const i=this.items.get(e);if(!i)throw new Error(`Cannot get schema for '${e.prototype.constructor.name}' target`);if(t&&!i.schema)throw new Error(`Schema '${e.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return i}cache(e){const t=this.get(e);t.schema||(t.schema=this.create(e,!0))}createDefault(e){const t={type:x.Sequence,items:{}},i=this.findParentSchema(e);return i&&(Object.assign(t,i),t.items=Object.assign({},t.items,i.items)),t}create(e,t){const i=this.items.get(e)||this.createDefault(e),n=[];for(const s in i.items){const c=i.items[s],u=t?s:"";let f;if(typeof c.type=="number"){const v=h[c.type],y=nc[v];if(!y)throw new Error(`Cannot get ASN1 class by name '${v}'`);f=new y({name:u})}else dt(c.type)?f=new c.type().toSchema(u):c.optional?this.get(c.type).type===x.Choice?f=new Vt({name:u}):(f=this.create(c.type,!1),f.name=u):f=new Vt({name:u});const d=!!c.optional||c.defaultValue!==void 0;if(c.repeated){f.name="";const v=c.repeated==="set"?ut:lt;f=new v({name:"",value:[new ki({name:u,value:f})]})}if(c.context!==null&&c.context!==void 0)if(c.implicit)if(typeof c.type=="number"||dt(c.type)){const v=c.repeated?Te:Cr;n.push(new v({name:u,optional:d,idBlock:{tagClass:3,tagNumber:c.context}}))}else{this.cache(c.type);const v=!!c.repeated;let y=v?f:this.get(c.type,!0).schema;y="valueBlock"in y?y.valueBlock.value:y.value,n.push(new Te({name:v?"":u,optional:d,idBlock:{tagClass:3,tagNumber:c.context},value:y}))}else n.push(new Te({optional:d,idBlock:{tagClass:3,tagNumber:c.context},value:[f]}));else f.optional=d,n.push(f)}switch(i.type){case x.Sequence:return new lt({value:n,name:""});case x.Set:return new ut({value:n,name:""});case x.Choice:return new Zn({value:n,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(e,t){return this.items.set(e,t),this}findParentSchema(e){const t=Object.getPrototypeOf(e);return t?this.items.get(t)||this.findParentSchema(t):null}}const Le=new wf,E=r=>e=>{let t;Le.has(e)?t=Le.get(e):(t=Le.createDefault(e),Le.set(e,t)),Object.assign(t,r)},l=r=>(e,t)=>{let i;Le.has(e.constructor)?i=Le.get(e.constructor):(i=Le.createDefault(e.constructor),Le.set(e.constructor,i));const n=Object.assign({},r);if(typeof n.type=="number"&&!n.converter){const s=Qn(r.type);if(!s)throw new Error(`Cannot get default converter for property '${t}' of ${e.constructor.name}`);n.converter=s}i.items[t]=n};class ac extends Error{constructor(){super(...arguments),this.schemas=[]}}class Sf{static parse(e,t){const i=Jt(e);if(i.result.error)throw new Error(i.result.error);return this.fromASN(i.result,t)}static fromASN(e,t){var i;try{if(dt(t))return new t().fromASN(e);const n=Le.get(t);Le.cache(t);let s=n.schema;if(e.constructor===Te&&n.type!==x.Choice){s=new Te({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:n.schema.valueBlock.value});for(const f in n.items)delete e[f]}const c=_t({},e,s);if(!c.verified)throw new ac(`Data does not match to ${t.name} ASN1 schema. ${c.result.error}`);const u=new t;if(sc(t)){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 f=n.itemType;if(typeof f=="number"){const d=Qn(f);if(!d)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);return t.from(e.valueBlock.value,v=>d.fromASN(v))}else return t.from(e.valueBlock.value,d=>this.fromASN(d,f))}for(const f in n.items){const d=c.result[f];if(!d)continue;const v=n.items[f],y=v.type;if(typeof y=="number"||dt(y)){const z=(i=v.converter)!==null&&i!==void 0?i:dt(y)?new y:null;if(!z)throw new Error("Converter is empty");if(v.repeated)if(v.implicit){const O=v.repeated==="sequence"?lt:ut,p=new O;p.valueBlock=d.valueBlock;const m=Jt(p.toBER(!1));if(m.offset===-1)throw new Error(`Cannot parse the child item. ${m.result.error}`);if(!("value"in m.result.valueBlock&&Array.isArray(m.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const S=m.result.valueBlock.value;u[f]=Array.from(S,w=>z.fromASN(w))}else u[f]=Array.from(d,O=>z.fromASN(O));else{let O=d;if(v.implicit){let p;if(dt(y))p=new y().toSchema("");else{const m=h[y],S=nc[m];if(!S)throw new Error(`Cannot get '${m}' class from asn1js module`);p=new S}p.valueBlock=O.valueBlock,O=Jt(p.toBER(!1)).result}u[f]=z.fromASN(O)}}else if(v.repeated){if(!Array.isArray(d))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");u[f]=Array.from(d,z=>this.fromASN(z,y))}else u[f]=this.fromASN(d,y)}return u}catch(n){throw n instanceof ac&&n.schemas.push(t.name),n}}}class Xn{static serialize(e){return e instanceof Se?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&dt(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const t=e.constructor,i=Le.get(t);Le.cache(t);let n=[];if(i.itemType){if(!Array.isArray(e))throw new TypeError("Parameter 1 should be type of Array.");if(typeof i.itemType=="number"){const c=Qn(i.itemType);if(!c)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);n=e.map(u=>c.toASN(u))}else n=e.map(c=>this.toAsnItem({type:i.itemType},"[]",t,c))}else for(const c in i.items){const u=i.items[c],f=e[c];if(f===void 0||u.defaultValue===f||typeof u.defaultValue=="object"&&typeof f=="object"&&bf(this.serialize(u.defaultValue),this.serialize(f)))continue;const d=Xn.toAsnItem(u,c,t,f);if(typeof u.context=="number")if(u.implicit)if(!u.repeated&&(typeof u.type=="number"||dt(u.type))){const v={};v.valueHex=d instanceof Nt?d.valueBeforeDecodeView:d.valueBlock.toBER(),n.push(new Cr({optional:u.optional,idBlock:{tagClass:3,tagNumber:u.context},...v}))}else n.push(new Te({optional:u.optional,idBlock:{tagClass:3,tagNumber:u.context},value:d.valueBlock.value}));else n.push(new Te({optional:u.optional,idBlock:{tagClass:3,tagNumber:u.context},value:[d]}));else u.repeated?n=n.concat(d):n.push(d)}let s;switch(i.type){case x.Sequence:s=new lt({value:n});break;case x.Set:s=new ut({value:n});break;case x.Choice:if(!n[0])throw new Error(`Schema '${t.name}' has wrong data. Choice cannot be empty.`);s=n[0];break}return s}static toAsnItem(e,t,i,n){let s;if(typeof e.type=="number"){const c=e.converter;if(!c)throw new Error(`Property '${t}' doesn't have converter for type ${h[e.type]} in schema '${i.name}'`);if(e.repeated){if(!Array.isArray(n))throw new TypeError("Parameter 'objProp' should be type of Array.");const u=Array.from(n,d=>c.toASN(d)),f=e.repeated==="sequence"?lt:ut;s=new f({value:u})}else s=c.toASN(n)}else if(e.repeated){if(!Array.isArray(n))throw new TypeError("Parameter 'objProp' should be type of Array.");const c=Array.from(n,f=>this.toASN(f)),u=e.repeated==="sequence"?lt:ut;s=new u({value:c})}else s=this.toASN(n);return s}}class ne extends Array{constructor(e=[]){if(typeof e=="number")super(e);else{super();for(const t of e)this.push(t)}}}class F{static serialize(e){return Xn.serialize(e)}static parse(e,t){return Sf.parse(e,t)}static toString(e){const t=_.isBufferSource(e)?_.toArrayBuffer(e):F.serialize(e),i=Jt(t);if(i.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${i.result.error}`);return i.result.toString()}}function a(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var u=r.length-1;u>=0;u--)(c=r[u])&&(s=(n<3?c(s):n>3?c(e,t,s):c(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}typeof SuppressedError=="function"&&SuppressedError;var cc={exports:{}};(function(r){(function(e){const t="(0?\\d+|0x[a-f0-9]+)",i={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},n=new RegExp("^0[0-7]+$","i"),s=new RegExp("^0x[a-f0-9]+$","i"),c="%[0-9a-z]{1,}",u="(?:[0-9a-f]+::?)+",f={zoneIndex:new RegExp(c,"i"),native:new RegExp(`^(::)?(${u})?([0-9a-f]+)?(::)?(${c})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${c})?)$`,"i"),transitional:new RegExp(`^((?:${u})|(?:::)(?:${u})?)${t}\\.${t}\\.${t}\\.${t}(${c})?$`,"i")};function d(p,m){if(p.indexOf("::")!==p.lastIndexOf("::"))return null;let S=0,w=-1,I=(p.match(f.zoneIndex)||[])[0],k,B;for(I&&(I=I.substring(1),p=p.replace(/%.+$/,""));(w=p.indexOf(":",w+1))>=0;)S++;if(p.substr(0,2)==="::"&&S--,p.substr(-2,2)==="::"&&S--,S>m)return null;for(B=m-S,k=":";B--;)k+="0:";return p=p.replace("::",k),p[0]===":"&&(p=p.slice(1)),p[p.length-1]===":"&&(p=p.slice(0,-1)),m=function(){const Z=p.split(":"),se=[];for(let D=0;D<Z.length;D++)se.push(parseInt(Z[D],16));return se}(),{parts:m,zoneId:I}}function v(p,m,S,w){if(p.length!==m.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let I=0,k;for(;w>0;){if(k=S-w,k<0&&(k=0),p[I]>>k!==m[I]>>k)return!1;w-=S,I+=1}return!0}function y(p){if(s.test(p))return parseInt(p,16);if(p[0]==="0"&&!isNaN(parseInt(p[1],10))){if(n.test(p))return parseInt(p,8);throw new Error(`ipaddr: cannot parse ${p} as octal`)}return parseInt(p,10)}function z(p,m){for(;p.length<m;)p=`0${p}`;return p}const O={};O.IPv4=function(){function p(m){if(m.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let S,w;for(S=0;S<m.length;S++)if(w=m[S],!(0<=w&&w<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=m}return p.prototype.SpecialRanges={unspecified:[[new p([0,0,0,0]),8]],broadcast:[[new p([255,255,255,255]),32]],multicast:[[new p([224,0,0,0]),4]],linkLocal:[[new p([169,254,0,0]),16]],loopback:[[new p([127,0,0,0]),8]],carrierGradeNat:[[new p([100,64,0,0]),10]],private:[[new p([10,0,0,0]),8],[new p([172,16,0,0]),12],[new p([192,168,0,0]),16]],reserved:[[new p([192,0,0,0]),24],[new p([192,0,2,0]),24],[new p([192,88,99,0]),24],[new p([198,18,0,0]),15],[new p([198,51,100,0]),24],[new p([203,0,113,0]),24],[new p([240,0,0,0]),4]]},p.prototype.kind=function(){return"ipv4"},p.prototype.match=function(m,S){let w;if(S===void 0&&(w=m,m=w[0],S=w[1]),m.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return v(this.octets,m.octets,8,S)},p.prototype.prefixLengthFromSubnetMask=function(){let m=0,S=!1;const w={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let I,k,B;for(I=3;I>=0;I-=1)if(k=this.octets[I],k in w){if(B=w[k],S&&B!==0)return null;B!==8&&(S=!0),m+=B}else return null;return 32-m},p.prototype.range=function(){return O.subnetMatch(this,this.SpecialRanges)},p.prototype.toByteArray=function(){return this.octets.slice(0)},p.prototype.toIPv4MappedAddress=function(){return O.IPv6.parse(`::ffff:${this.toString()}`)},p.prototype.toNormalizedString=function(){return this.toString()},p.prototype.toString=function(){return this.octets.join(".")},p}(),O.IPv4.broadcastAddressFromCIDR=function(p){try{const m=this.parseCIDR(p),S=m[0].toByteArray(),w=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),I=[];let k=0;for(;k<4;)I.push(parseInt(S[k],10)|parseInt(w[k],10)^255),k++;return new this(I)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},O.IPv4.isIPv4=function(p){return this.parser(p)!==null},O.IPv4.isValid=function(p){try{return new this(this.parser(p)),!0}catch{return!1}},O.IPv4.isValidFourPartDecimal=function(p){return!!(O.IPv4.isValid(p)&&p.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},O.IPv4.networkAddressFromCIDR=function(p){let m,S,w,I,k;try{for(m=this.parseCIDR(p),w=m[0].toByteArray(),k=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),I=[],S=0;S<4;)I.push(parseInt(w[S],10)&parseInt(k[S],10)),S++;return new this(I)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},O.IPv4.parse=function(p){const m=this.parser(p);if(m===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(m)},O.IPv4.parseCIDR=function(p){let m;if(m=p.match(/^(.+)\/(\d+)$/)){const S=parseInt(m[2]);if(S>=0&&S<=32){const w=[this.parse(m[1]),S];return Object.defineProperty(w,"toString",{value:function(){return this.join("/")}}),w}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},O.IPv4.parser=function(p){let m,S,w;if(m=p.match(i.fourOctet))return function(){const I=m.slice(1,6),k=[];for(let B=0;B<I.length;B++)S=I[B],k.push(y(S));return k}();if(m=p.match(i.longValue)){if(w=y(m[1]),w>4294967295||w<0)throw new Error("ipaddr: address outside defined range");return function(){const I=[];let k;for(k=0;k<=24;k+=8)I.push(w>>k&255);return I}().reverse()}else return(m=p.match(i.twoOctet))?function(){const I=m.slice(1,4),k=[];if(w=y(I[1]),w>16777215||w<0)throw new Error("ipaddr: address outside defined range");return k.push(y(I[0])),k.push(w>>16&255),k.push(w>>8&255),k.push(w&255),k}():(m=p.match(i.threeOctet))?function(){const I=m.slice(1,5),k=[];if(w=y(I[2]),w>65535||w<0)throw new Error("ipaddr: address outside defined range");return k.push(y(I[0])),k.push(y(I[1])),k.push(w>>8&255),k.push(w&255),k}():null},O.IPv4.subnetMaskFromPrefixLength=function(p){if(p=parseInt(p),p<0||p>32)throw new Error("ipaddr: invalid IPv4 prefix length");const m=[0,0,0,0];let S=0;const w=Math.floor(p/8);for(;S<w;)m[S]=255,S++;return w<4&&(m[w]=Math.pow(2,p%8)-1<<8-p%8),new this(m)},O.IPv6=function(){function p(m,S){let w,I;if(m.length===16)for(this.parts=[],w=0;w<=14;w+=2)this.parts.push(m[w]<<8|m[w+1]);else if(m.length===8)this.parts=m;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(w=0;w<this.parts.length;w++)if(I=this.parts[w],!(0<=I&&I<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");S&&(this.zoneId=S)}return p.prototype.SpecialRanges={unspecified:[new p([0,0,0,0,0,0,0,0]),128],linkLocal:[new p([65152,0,0,0,0,0,0,0]),10],multicast:[new p([65280,0,0,0,0,0,0,0]),8],loopback:[new p([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new p([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new p([0,0,0,0,0,65535,0,0]),96],rfc6145:[new p([0,0,0,0,65535,0,0,0]),96],rfc6052:[new p([100,65435,0,0,0,0,0,0]),96],"6to4":[new p([8194,0,0,0,0,0,0,0]),16],teredo:[new p([8193,0,0,0,0,0,0,0]),32],reserved:[[new p([8193,3512,0,0,0,0,0,0]),32]],benchmarking:[new p([8193,2,0,0,0,0,0,0]),48],amt:[new p([8193,3,0,0,0,0,0,0]),32],as112v6:[new p([8193,4,274,0,0,0,0,0]),48],deprecated:[new p([8193,16,0,0,0,0,0,0]),28],orchid2:[new p([8193,32,0,0,0,0,0,0]),28]},p.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},p.prototype.kind=function(){return"ipv6"},p.prototype.match=function(m,S){let w;if(S===void 0&&(w=m,m=w[0],S=w[1]),m.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return v(this.parts,m.parts,16,S)},p.prototype.prefixLengthFromSubnetMask=function(){let m=0,S=!1;const w={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let I,k;for(let B=7;B>=0;B-=1)if(I=this.parts[B],I in w){if(k=w[I],S&&k!==0)return null;k!==16&&(S=!0),m+=k}else return null;return 128-m},p.prototype.range=function(){return O.subnetMatch(this,this.SpecialRanges)},p.prototype.toByteArray=function(){let m;const S=[],w=this.parts;for(let I=0;I<w.length;I++)m=w[I],S.push(m>>8),S.push(m&255);return S},p.prototype.toFixedLengthString=function(){const m=(function(){const w=[];for(let I=0;I<this.parts.length;I++)w.push(z(this.parts[I].toString(16),4));return w}).call(this).join(":");let S="";return this.zoneId&&(S=`%${this.zoneId}`),m+S},p.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const m=this.parts.slice(-2),S=m[0],w=m[1];return new O.IPv4([S>>8,S&255,w>>8,w&255])},p.prototype.toNormalizedString=function(){const m=(function(){const w=[];for(let I=0;I<this.parts.length;I++)w.push(this.parts[I].toString(16));return w}).call(this).join(":");let S="";return this.zoneId&&(S=`%${this.zoneId}`),m+S},p.prototype.toRFC5952String=function(){const m=/((^|:)(0(:|$)){2,})/g,S=this.toNormalizedString();let w=0,I=-1,k;for(;k=m.exec(S);)k[0].length>I&&(w=k.index,I=k[0].length);return I<0?S:`${S.substring(0,w)}::${S.substring(w+I)}`},p.prototype.toString=function(){return this.toRFC5952String()},p}(),O.IPv6.broadcastAddressFromCIDR=function(p){try{const m=this.parseCIDR(p),S=m[0].toByteArray(),w=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),I=[];let k=0;for(;k<16;)I.push(parseInt(S[k],10)|parseInt(w[k],10)^255),k++;return new this(I)}catch(m){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${m})`)}},O.IPv6.isIPv6=function(p){return this.parser(p)!==null},O.IPv6.isValid=function(p){if(typeof p=="string"&&p.indexOf(":")===-1)return!1;try{const m=this.parser(p);return new this(m.parts,m.zoneId),!0}catch{return!1}},O.IPv6.networkAddressFromCIDR=function(p){let m,S,w,I,k;try{for(m=this.parseCIDR(p),w=m[0].toByteArray(),k=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),I=[],S=0;S<16;)I.push(parseInt(w[S],10)&parseInt(k[S],10)),S++;return new this(I)}catch(B){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${B})`)}},O.IPv6.parse=function(p){const m=this.parser(p);if(m.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(m.parts,m.zoneId)},O.IPv6.parseCIDR=function(p){let m,S,w;if((S=p.match(/^(.+)\/(\d+)$/))&&(m=parseInt(S[2]),m>=0&&m<=128))return w=[this.parse(S[1]),m],Object.defineProperty(w,"toString",{value:function(){return this.join("/")}}),w;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},O.IPv6.parser=function(p){let m,S,w,I,k,B;if(w=p.match(f.deprecatedTransitional))return this.parser(`::ffff:${w[1]}`);if(f.native.test(p))return d(p,8);if((w=p.match(f.transitional))&&(B=w[6]||"",m=d(w[1].slice(0,-1)+B,6),m.parts)){for(k=[parseInt(w[2]),parseInt(w[3]),parseInt(w[4]),parseInt(w[5])],S=0;S<k.length;S++)if(I=k[S],!(0<=I&&I<=255))return null;return m.parts.push(k[0]<<8|k[1]),m.parts.push(k[2]<<8|k[3]),{parts:m.parts,zoneId:m.zoneId}}return null},O.IPv6.subnetMaskFromPrefixLength=function(p){if(p=parseInt(p),p<0||p>128)throw new Error("ipaddr: invalid IPv6 prefix length");const m=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let S=0;const w=Math.floor(p/8);for(;S<w;)m[S]=255,S++;return w<16&&(m[w]=Math.pow(2,p%8)-1<<8-p%8),new this(m)},O.fromByteArray=function(p){const m=p.length;if(m===4)return new O.IPv4(p);if(m===16)return new O.IPv6(p);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},O.isValid=function(p){return O.IPv6.isValid(p)||O.IPv4.isValid(p)},O.parse=function(p){if(O.IPv6.isValid(p))return O.IPv6.parse(p);if(O.IPv4.isValid(p))return O.IPv4.parse(p);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},O.parseCIDR=function(p){try{return O.IPv6.parseCIDR(p)}catch{try{return O.IPv4.parseCIDR(p)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},O.process=function(p){const m=this.parse(p);return m.kind()==="ipv6"&&m.isIPv4MappedAddress()?m.toIPv4Address():m},O.subnetMatch=function(p,m,S){let w,I,k,B;S==null&&(S="unicast");for(I in m)if(Object.prototype.hasOwnProperty.call(m,I)){for(k=m[I],k[0]&&!(k[0]instanceof Array)&&(k=[k]),w=0;w<k.length;w++)if(B=k[w],p.kind()===B[0].kind()&&p.match.apply(p,B))return I}return S},r.exports?r.exports=O:e.ipaddr=O})(Pn)})(cc);var lc=cc.exports;class uc{static decodeIP(e){if(e.length===64&&parseInt(e,16)===0)return"::/0";if(e.length!==16)return e;const t=parseInt(e.slice(8),16).toString(2).split("").reduce((n,s)=>n+ +s,0);let i=e.slice(0,8).replace(/(.{2})/g,n=>`${parseInt(n,16)}.`);return i=i.slice(0,-1),`${i}/${t}`}static toString(e){if(e.byteLength===4||e.byteLength===16){const t=new Uint8Array(e);return lc.fromByteArray(Array.from(t)).toString()}return this.decodeIP(M.ToHex(e))}static fromString(e){const t=lc.parse(e);return new Uint8Array(t.toByteArray()).buffer}}var eo,to,ro;let Ae=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};a([l({type:h.TeletexString})],Ae.prototype,"teletexString",void 0),a([l({type:h.PrintableString})],Ae.prototype,"printableString",void 0),a([l({type:h.UniversalString})],Ae.prototype,"universalString",void 0),a([l({type:h.Utf8String})],Ae.prototype,"utf8String",void 0),a([l({type:h.BmpString})],Ae.prototype,"bmpString",void 0),Ae=a([E({type:x.Choice})],Ae);let Yt=class extends Ae{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?M.ToHex(this.anyValue):super.toString())}};a([l({type:h.IA5String})],Yt.prototype,"ia5String",void 0),a([l({type:h.Any})],Yt.prototype,"anyValue",void 0),Yt=a([E({type:x.Choice})],Yt);class Ir{constructor(e={}){this.type="",this.value=new Yt,Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Ir.prototype,"type",void 0),a([l({type:Yt})],Ir.prototype,"value",void 0);let Zt=eo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,eo.prototype)}};Zt=eo=a([E({type:x.Set,itemType:Ir})],Zt);let io=to=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,to.prototype)}};io=to=a([E({type:x.Sequence,itemType:Zt})],io);let ge=ro=class extends io{constructor(e){super(e),Object.setPrototypeOf(this,ro.prototype)}};ge=ro=a([E({type:x.Sequence})],ge);const Af={fromASN:r=>uc.toString(Ci.fromASN(r)),toASN:r=>Ci.toASN(uc.fromString(r))};class Nr{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Nr.prototype,"typeId",void 0),a([l({type:h.Any,context:0})],Nr.prototype,"value",void 0);class no{constructor(e={}){this.partyName=new Ae,Object.assign(this,e)}}a([l({type:Ae,optional:!0,context:0,implicit:!0})],no.prototype,"nameAssigner",void 0),a([l({type:Ae,context:1,implicit:!0})],no.prototype,"partyName",void 0);let Q=class{constructor(e={}){Object.assign(this,e)}};a([l({type:Nr,context:0,implicit:!0})],Q.prototype,"otherName",void 0),a([l({type:h.IA5String,context:1,implicit:!0})],Q.prototype,"rfc822Name",void 0),a([l({type:h.IA5String,context:2,implicit:!0})],Q.prototype,"dNSName",void 0),a([l({type:h.Any,context:3,implicit:!0})],Q.prototype,"x400Address",void 0),a([l({type:ge,context:4,implicit:!1})],Q.prototype,"directoryName",void 0),a([l({type:no,context:5})],Q.prototype,"ediPartyName",void 0),a([l({type:h.IA5String,context:6,implicit:!0})],Q.prototype,"uniformResourceIdentifier",void 0),a([l({type:h.OctetString,context:7,implicit:!0,converter:Af})],Q.prototype,"iPAddress",void 0),a([l({type:h.ObjectIdentifier,context:8,implicit:!0})],Q.prototype,"registeredID",void 0),Q=a([E({type:x.Choice})],Q);const Qt="1.3.6.1.5.5.7.3",jt="2.5.29";var oo;class Bi{constructor(e={}){this.accessMethod="",this.accessLocation=new Q,Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Bi.prototype,"accessMethod",void 0),a([l({type:Q})],Bi.prototype,"accessLocation",void 0);let fc=oo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,oo.prototype)}};fc=oo=a([E({type:x.Sequence,itemType:Bi})],fc);const so=`${jt}.35`;class ao extends ie{}class Pt{constructor(e={}){e&&Object.assign(this,e)}}a([l({type:ao,context:0,optional:!0,implicit:!0})],Pt.prototype,"keyIdentifier",void 0),a([l({type:Q,context:1,optional:!0,implicit:!0,repeated:"sequence"})],Pt.prototype,"authorityCertIssuer",void 0),a([l({type:h.Integer,context:2,optional:!0,implicit:!0,converter:ue})],Pt.prototype,"authorityCertSerialNumber",void 0);const dc=`${jt}.19`;class Ei{constructor(e={}){this.cA=!1,Object.assign(this,e)}}a([l({type:h.Boolean,defaultValue:!1})],Ei.prototype,"cA",void 0),a([l({type:h.Integer,optional:!0})],Ei.prototype,"pathLenConstraint",void 0);var co;let Ie=co=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,co.prototype)}};Ie=co=a([E({type:x.Sequence,itemType:Q})],Ie);var lo;let pc=lo=class extends Ie{constructor(e){super(e),Object.setPrototypeOf(this,lo.prototype)}};pc=lo=a([E({type:x.Sequence})],pc);var uo;const hc=`${jt}.32`;let pt=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};a([l({type:h.IA5String})],pt.prototype,"ia5String",void 0),a([l({type:h.VisibleString})],pt.prototype,"visibleString",void 0),a([l({type:h.BmpString})],pt.prototype,"bmpString",void 0),a([l({type:h.Utf8String})],pt.prototype,"utf8String",void 0),pt=a([E({type:x.Choice})],pt);class fo{constructor(e={}){this.organization=new pt,this.noticeNumbers=[],Object.assign(this,e)}}a([l({type:pt})],fo.prototype,"organization",void 0),a([l({type:h.Integer,repeated:"sequence"})],fo.prototype,"noticeNumbers",void 0);class po{constructor(e={}){Object.assign(this,e)}}a([l({type:fo,optional:!0})],po.prototype,"noticeRef",void 0),a([l({type:pt,optional:!0})],po.prototype,"explicitText",void 0);let Ii=class{constructor(e={}){Object.assign(this,e)}};a([l({type:h.IA5String})],Ii.prototype,"cPSuri",void 0),a([l({type:po})],Ii.prototype,"userNotice",void 0),Ii=a([E({type:x.Choice})],Ii);class ho{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],ho.prototype,"policyQualifierId",void 0),a([l({type:h.Any})],ho.prototype,"qualifier",void 0);class Ni{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Ni.prototype,"policyIdentifier",void 0),a([l({type:ho,repeated:"sequence",optional:!0})],Ni.prototype,"policyQualifiers",void 0);let Oi=uo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,uo.prototype)}};Oi=uo=a([E({type:x.Sequence,itemType:Ni})],Oi);let Ti=class{constructor(e=0){this.value=e}};a([l({type:h.Integer})],Ti.prototype,"value",void 0),Ti=a([E({type:x.Choice})],Ti);let yc=class extends Ti{};yc=a([E({type:x.Choice})],yc);var yo,ze;(function(r){r[r.unused=1]="unused",r[r.keyCompromise=2]="keyCompromise",r[r.cACompromise=4]="cACompromise",r[r.affiliationChanged=8]="affiliationChanged",r[r.superseded=16]="superseded",r[r.cessationOfOperation=32]="cessationOfOperation",r[r.certificateHold=64]="certificateHold",r[r.privilegeWithdrawn=128]="privilegeWithdrawn",r[r.aACompromise=256]="aACompromise"})(ze||(ze={}));class gc extends xi{toJSON(){const e=[],t=this.toNumber();return t&ze.aACompromise&&e.push("aACompromise"),t&ze.affiliationChanged&&e.push("affiliationChanged"),t&ze.cACompromise&&e.push("cACompromise"),t&ze.certificateHold&&e.push("certificateHold"),t&ze.cessationOfOperation&&e.push("cessationOfOperation"),t&ze.keyCompromise&&e.push("keyCompromise"),t&ze.privilegeWithdrawn&&e.push("privilegeWithdrawn"),t&ze.superseded&&e.push("superseded"),t&ze.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let Xt=class{constructor(e={}){Object.assign(this,e)}};a([l({type:Q,context:0,repeated:"sequence",implicit:!0})],Xt.prototype,"fullName",void 0),a([l({type:Zt,context:1,implicit:!0})],Xt.prototype,"nameRelativeToCRLIssuer",void 0),Xt=a([E({type:x.Choice})],Xt);class Or{constructor(e={}){Object.assign(this,e)}}a([l({type:Xt,context:0,optional:!0})],Or.prototype,"distributionPoint",void 0),a([l({type:gc,context:1,optional:!0,implicit:!0})],Or.prototype,"reasons",void 0),a([l({type:Q,context:2,optional:!0,repeated:"sequence",implicit:!0})],Or.prototype,"cRLIssuer",void 0);let go=yo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,yo.prototype)}};go=yo=a([E({type:x.Sequence,itemType:Or})],go);var mo;let mc=mo=class extends go{constructor(e){super(e),Object.setPrototypeOf(this,mo.prototype)}};mc=mo=a([E({type:x.Sequence,itemType:Or})],mc);class Ce{constructor(e={}){this.onlyContainsUserCerts=Ce.ONLY,this.onlyContainsCACerts=Ce.ONLY,this.indirectCRL=Ce.ONLY,this.onlyContainsAttributeCerts=Ce.ONLY,Object.assign(this,e)}}Ce.ONLY=!1,a([l({type:Xt,context:0,optional:!0})],Ce.prototype,"distributionPoint",void 0),a([l({type:h.Boolean,context:1,defaultValue:Ce.ONLY,implicit:!0})],Ce.prototype,"onlyContainsUserCerts",void 0),a([l({type:h.Boolean,context:2,defaultValue:Ce.ONLY,implicit:!0})],Ce.prototype,"onlyContainsCACerts",void 0),a([l({type:gc,context:3,optional:!0,implicit:!0})],Ce.prototype,"onlySomeReasons",void 0),a([l({type:h.Boolean,context:4,defaultValue:Ce.ONLY,implicit:!0})],Ce.prototype,"indirectCRL",void 0),a([l({type:h.Boolean,context:5,defaultValue:Ce.ONLY,implicit:!0})],Ce.prototype,"onlyContainsAttributeCerts",void 0);var Tr;(function(r){r[r.unspecified=0]="unspecified",r[r.keyCompromise=1]="keyCompromise",r[r.cACompromise=2]="cACompromise",r[r.affiliationChanged=3]="affiliationChanged",r[r.superseded=4]="superseded",r[r.cessationOfOperation=5]="cessationOfOperation",r[r.certificateHold=6]="certificateHold",r[r.removeFromCRL=8]="removeFromCRL",r[r.privilegeWithdrawn=9]="privilegeWithdrawn",r[r.aACompromise=10]="aACompromise"})(Tr||(Tr={}));let vo=class{constructor(e=Tr.unspecified){this.reason=Tr.unspecified,this.reason=e}toJSON(){return Tr[this.reason]}toString(){return this.toJSON()}};a([l({type:h.Enumerated})],vo.prototype,"reason",void 0),vo=a([E({type:x.Choice})],vo);var bo;const vc=`${jt}.37`;let Vi=bo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,bo.prototype)}};Vi=bo=a([E({type:x.Sequence,itemType:h.ObjectIdentifier})],Vi);const kf=`${Qt}.1`,xf=`${Qt}.2`,Cf=`${Qt}.3`,Bf=`${Qt}.4`,Ef=`${Qt}.8`,If=`${Qt}.9`;let wo=class{constructor(e=new ArrayBuffer(0)){this.value=e}};a([l({type:h.Integer,converter:ue})],wo.prototype,"value",void 0),wo=a([E({type:x.Choice})],wo);let So=class{constructor(e){this.value=new Date,e&&(this.value=e)}};a([l({type:h.GeneralizedTime})],So.prototype,"value",void 0),So=a([E({type:x.Choice})],So);var Ao;let bc=Ao=class extends Ie{constructor(e){super(e),Object.setPrototypeOf(this,Ao.prototype)}};bc=Ao=a([E({type:x.Sequence})],bc);const wc=`${jt}.15`;var We;(function(r){r[r.digitalSignature=1]="digitalSignature",r[r.nonRepudiation=2]="nonRepudiation",r[r.keyEncipherment=4]="keyEncipherment",r[r.dataEncipherment=8]="dataEncipherment",r[r.keyAgreement=16]="keyAgreement",r[r.keyCertSign=32]="keyCertSign",r[r.cRLSign=64]="cRLSign",r[r.encipherOnly=128]="encipherOnly",r[r.decipherOnly=256]="decipherOnly"})(We||(We={}));class ko extends xi{toJSON(){const e=this.toNumber(),t=[];return e&We.cRLSign&&t.push("crlSign"),e&We.dataEncipherment&&t.push("dataEncipherment"),e&We.decipherOnly&&t.push("decipherOnly"),e&We.digitalSignature&&t.push("digitalSignature"),e&We.encipherOnly&&t.push("encipherOnly"),e&We.keyAgreement&&t.push("keyAgreement"),e&We.keyCertSign&&t.push("keyCertSign"),e&We.keyEncipherment&&t.push("keyEncipherment"),e&We.nonRepudiation&&t.push("nonRepudiation"),t}toString(){return`[${this.toJSON().join(", ")}]`}}var xo;class _i{constructor(e={}){this.base=new Q,this.minimum=0,Object.assign(this,e)}}a([l({type:Q})],_i.prototype,"base",void 0),a([l({type:h.Integer,context:0,defaultValue:0,implicit:!0})],_i.prototype,"minimum",void 0),a([l({type:h.Integer,context:1,optional:!0,implicit:!0})],_i.prototype,"maximum",void 0);let ji=xo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,xo.prototype)}};ji=xo=a([E({type:x.Sequence,itemType:_i})],ji);class Sc{constructor(e={}){Object.assign(this,e)}}a([l({type:ji,context:0,optional:!0,implicit:!0})],Sc.prototype,"permittedSubtrees",void 0),a([l({type:ji,context:1,optional:!0,implicit:!0})],Sc.prototype,"excludedSubtrees",void 0);class Ac{constructor(e={}){Object.assign(this,e)}}a([l({type:h.Integer,context:0,implicit:!0,optional:!0,converter:ue})],Ac.prototype,"requireExplicitPolicy",void 0),a([l({type:h.Integer,context:1,implicit:!0,optional:!0,converter:ue})],Ac.prototype,"inhibitPolicyMapping",void 0);var Co;class Bo{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Bo.prototype,"issuerDomainPolicy",void 0),a([l({type:h.ObjectIdentifier})],Bo.prototype,"subjectDomainPolicy",void 0);let kc=Co=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Co.prototype)}};kc=Co=a([E({type:x.Sequence,itemType:Bo})],kc);var Eo;const xc=`${jt}.17`;let Io=Eo=class extends Ie{constructor(e){super(e),Object.setPrototypeOf(this,Eo.prototype)}};Io=Eo=a([E({type:x.Sequence})],Io);let ht=class{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};a([l({type:h.ObjectIdentifier})],ht.prototype,"type",void 0),a([l({type:h.Any,repeated:"set"})],ht.prototype,"values",void 0);var No;let Cc=No=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,No.prototype)}};Cc=No=a([E({type:x.Sequence,itemType:ht})],Cc);const Bc=`${jt}.14`;class At extends ao{}class Ec{constructor(e={}){Object.assign(this,e)}}a([l({type:h.GeneralizedTime,context:0,implicit:!0,optional:!0})],Ec.prototype,"notBefore",void 0),a([l({type:h.GeneralizedTime,context:1,implicit:!0,optional:!0})],Ec.prototype,"notAfter",void 0);var Vr;(function(r){r[r.keyUpdateAllowed=1]="keyUpdateAllowed",r[r.newExtensions=2]="newExtensions",r[r.pKIXCertificate=4]="pKIXCertificate"})(Vr||(Vr={}));class Ic extends xi{toJSON(){const e=[],t=this.toNumber();return t&Vr.pKIXCertificate&&e.push("pKIXCertificate"),t&Vr.newExtensions&&e.push("newExtensions"),t&Vr.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class Nc{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new Ic,Object.assign(this,e)}}a([l({type:h.GeneralString})],Nc.prototype,"entrustVers",void 0),a([l({type:Ic})],Nc.prototype,"entrustInfoFlags",void 0);var Oo;let Oc=Oo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Oo.prototype)}};Oc=Oo=a([E({type:x.Sequence,itemType:Bi})],Oc);class U{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof U&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&ia(e.parameters,this.parameters)||e.parameters===this.parameters)}}a([l({type:h.ObjectIdentifier})],U.prototype,"algorithm",void 0),a([l({type:h.Any,optional:!0})],U.prototype,"parameters",void 0);class yt{constructor(e={}){this.algorithm=new U,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:U})],yt.prototype,"algorithm",void 0),a([l({type:h.BitString})],yt.prototype,"subjectPublicKey",void 0);let ke=class{constructor(e){if(e)if(typeof e=="string"||typeof e=="number"||e instanceof Date){const t=new Date(e);t.getUTCFullYear()>2049?this.generalTime=t:this.utcTime=t}else Object.assign(this,e)}getTime(){const e=this.utcTime||this.generalTime;if(!e)throw new Error("Cannot get time from CHOICE object");return e}};a([l({type:h.UTCTime})],ke.prototype,"utcTime",void 0),a([l({type:h.GeneralizedTime})],ke.prototype,"generalTime",void 0),ke=a([E({type:x.Choice})],ke);class Pi{constructor(e){this.notBefore=new ke(new Date),this.notAfter=new ke(new Date),e&&(this.notBefore=new ke(e.notBefore),this.notAfter=new ke(e.notAfter))}}a([l({type:ke})],Pi.prototype,"notBefore",void 0),a([l({type:ke})],Pi.prototype,"notAfter",void 0);var To;let Je=class Nu{constructor(e={}){this.extnID="",this.critical=Nu.CRITICAL,this.extnValue=new ie,Object.assign(this,e)}};Je.CRITICAL=!1,a([l({type:h.ObjectIdentifier})],Je.prototype,"extnID",void 0),a([l({type:h.Boolean,defaultValue:Je.CRITICAL})],Je.prototype,"critical",void 0),a([l({type:ie})],Je.prototype,"extnValue",void 0);let Dt=To=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,To.prototype)}};Dt=To=a([E({type:x.Sequence,itemType:Je})],Dt);var er;(function(r){r[r.v1=0]="v1",r[r.v2=1]="v2",r[r.v3=2]="v3"})(er||(er={}));class Fe{constructor(e={}){this.version=er.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new U,this.issuer=new ge,this.validity=new Pi,this.subject=new ge,this.subjectPublicKeyInfo=new yt,Object.assign(this,e)}}a([l({type:h.Integer,context:0,defaultValue:er.v1})],Fe.prototype,"version",void 0),a([l({type:h.Integer,converter:ue})],Fe.prototype,"serialNumber",void 0),a([l({type:U})],Fe.prototype,"signature",void 0),a([l({type:ge})],Fe.prototype,"issuer",void 0),a([l({type:Pi})],Fe.prototype,"validity",void 0),a([l({type:ge})],Fe.prototype,"subject",void 0),a([l({type:yt})],Fe.prototype,"subjectPublicKeyInfo",void 0),a([l({type:h.BitString,context:1,implicit:!0,optional:!0})],Fe.prototype,"issuerUniqueID",void 0),a([l({type:h.BitString,context:2,implicit:!0,optional:!0})],Fe.prototype,"subjectUniqueID",void 0),a([l({type:Dt,context:3,optional:!0})],Fe.prototype,"extensions",void 0);class tr{constructor(e={}){this.tbsCertificate=new Fe,this.signatureAlgorithm=new U,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:Fe})],tr.prototype,"tbsCertificate",void 0),a([l({type:U})],tr.prototype,"signatureAlgorithm",void 0),a([l({type:h.BitString})],tr.prototype,"signatureValue",void 0);class Di{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new ke,Object.assign(this,e)}}a([l({type:h.Integer,converter:ue})],Di.prototype,"userCertificate",void 0),a([l({type:ke})],Di.prototype,"revocationDate",void 0),a([l({type:Je,optional:!0,repeated:"sequence"})],Di.prototype,"crlEntryExtensions",void 0);class gt{constructor(e={}){this.signature=new U,this.issuer=new ge,this.thisUpdate=new ke,Object.assign(this,e)}}a([l({type:h.Integer,optional:!0})],gt.prototype,"version",void 0),a([l({type:U})],gt.prototype,"signature",void 0),a([l({type:ge})],gt.prototype,"issuer",void 0),a([l({type:ke})],gt.prototype,"thisUpdate",void 0),a([l({type:ke,optional:!0})],gt.prototype,"nextUpdate",void 0),a([l({type:Di,repeated:"sequence",optional:!0})],gt.prototype,"revokedCertificates",void 0),a([l({type:Je,optional:!0,context:0,repeated:"sequence"})],gt.prototype,"crlExtensions",void 0);let Vo=class{constructor(e={}){this.tbsCertList=new gt,this.signatureAlgorithm=new U,this.signature=new ArrayBuffer(0),Object.assign(this,e)}};a([l({type:gt})],Vo.prototype,"tbsCertList",void 0),a([l({type:U})],Vo.prototype,"signatureAlgorithm",void 0),a([l({type:h.BitString})],Vo.prototype,"signature",void 0);class rr{constructor(e={}){this.issuer=new ge,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:ge})],rr.prototype,"issuer",void 0),a([l({type:h.Integer,converter:ue})],rr.prototype,"serialNumber",void 0);let ir=class{constructor(e={}){Object.assign(this,e)}};a([l({type:At,context:0,implicit:!0})],ir.prototype,"subjectKeyIdentifier",void 0),a([l({type:rr})],ir.prototype,"issuerAndSerialNumber",void 0),ir=a([E({type:x.Choice})],ir);var mt;(function(r){r[r.v0=0]="v0",r[r.v1=1]="v1",r[r.v2=2]="v2",r[r.v3=3]="v3",r[r.v4=4]="v4",r[r.v5=5]="v5"})(mt||(mt={}));let _r=class extends U{};_r=a([E({type:x.Sequence})],_r);let Ri=class extends U{};Ri=a([E({type:x.Sequence})],Ri);let rt=class extends U{};rt=a([E({type:x.Sequence})],rt);let Mi=class extends U{};Mi=a([E({type:x.Sequence})],Mi);let Tc=class extends U{};Tc=a([E({type:x.Sequence})],Tc);let _o=class extends U{};_o=a([E({type:x.Sequence})],_o);let nr=class{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};a([l({type:h.ObjectIdentifier})],nr.prototype,"attrType",void 0),a([l({type:h.Any,repeated:"set"})],nr.prototype,"attrValues",void 0);var jo;class it{constructor(e={}){this.version=mt.v0,this.sid=new ir,this.digestAlgorithm=new _r,this.signatureAlgorithm=new Ri,this.signature=new ie,Object.assign(this,e)}}a([l({type:h.Integer})],it.prototype,"version",void 0),a([l({type:ir})],it.prototype,"sid",void 0),a([l({type:_r})],it.prototype,"digestAlgorithm",void 0),a([l({type:nr,repeated:"set",context:0,implicit:!0,optional:!0})],it.prototype,"signedAttrs",void 0),a([l({type:Ri})],it.prototype,"signatureAlgorithm",void 0),a([l({type:ie})],it.prototype,"signature",void 0),a([l({type:nr,repeated:"set",context:1,implicit:!0,optional:!0})],it.prototype,"unsignedAttrs",void 0);let $i=jo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,jo.prototype)}};$i=jo=a([E({type:x.Set,itemType:it})],$i);let Vc=class extends ke{};Vc=a([E({type:x.Choice})],Vc);let _c=class extends it{};_c=a([E({type:x.Sequence})],_c);class Po{constructor(e={}){this.acIssuer=new Q,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}a([l({type:Q})],Po.prototype,"acIssuer",void 0),a([l({type:h.Integer})],Po.prototype,"acSerial",void 0),a([l({type:ht,repeated:"sequence"})],Po.prototype,"attrs",void 0);var Do;let Ui=Do=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Do.prototype)}};Ui=Do=a([E({type:x.Sequence,itemType:h.ObjectIdentifier})],Ui);class Hi{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}a([l({type:h.Integer,optional:!0})],Hi.prototype,"pathLenConstraint",void 0),a([l({type:Ui,implicit:!0,context:0,optional:!0})],Hi.prototype,"permittedAttrs",void 0),a([l({type:Ui,implicit:!0,context:1,optional:!0})],Hi.prototype,"excludedAttrs",void 0),a([l({type:h.Boolean,defaultValue:!0})],Hi.prototype,"permitUnSpecified",void 0);class Rt{constructor(e={}){this.issuer=new Ie,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:Ie})],Rt.prototype,"issuer",void 0),a([l({type:h.Integer,converter:ue})],Rt.prototype,"serial",void 0),a([l({type:h.BitString,optional:!0})],Rt.prototype,"issuerUID",void 0);var Ro;(function(r){r[r.publicKey=0]="publicKey",r[r.publicKeyCert=1]="publicKeyCert",r[r.otherObjectTypes=2]="otherObjectTypes"})(Ro||(Ro={}));class Mt{constructor(e={}){this.digestedObjectType=Ro.publicKey,this.digestAlgorithm=new U,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.Enumerated})],Mt.prototype,"digestedObjectType",void 0),a([l({type:h.ObjectIdentifier,optional:!0})],Mt.prototype,"otherObjectTypeID",void 0),a([l({type:U})],Mt.prototype,"digestAlgorithm",void 0),a([l({type:h.BitString})],Mt.prototype,"objectDigest",void 0);class Li{constructor(e={}){Object.assign(this,e)}}a([l({type:Ie,optional:!0})],Li.prototype,"issuerName",void 0),a([l({type:Rt,context:0,implicit:!0,optional:!0})],Li.prototype,"baseCertificateID",void 0),a([l({type:Mt,context:1,implicit:!0,optional:!0})],Li.prototype,"objectDigestInfo",void 0);let or=class{constructor(e={}){Object.assign(this,e)}};a([l({type:Q,repeated:"sequence"})],or.prototype,"v1Form",void 0),a([l({type:Li,context:0,implicit:!0})],or.prototype,"v2Form",void 0),or=a([E({type:x.Choice})],or);class Fi{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}a([l({type:h.GeneralizedTime})],Fi.prototype,"notBeforeTime",void 0),a([l({type:h.GeneralizedTime})],Fi.prototype,"notAfterTime",void 0);class jr{constructor(e={}){Object.assign(this,e)}}a([l({type:Rt,implicit:!0,context:0,optional:!0})],jr.prototype,"baseCertificateID",void 0),a([l({type:Ie,implicit:!0,context:1,optional:!0})],jr.prototype,"entityName",void 0),a([l({type:Mt,implicit:!0,context:2,optional:!0})],jr.prototype,"objectDigestInfo",void 0);var Mo;(function(r){r[r.v2=1]="v2"})(Mo||(Mo={}));class Ye{constructor(e={}){this.version=Mo.v2,this.holder=new jr,this.issuer=new or,this.signature=new U,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new Fi,this.attributes=[],Object.assign(this,e)}}a([l({type:h.Integer})],Ye.prototype,"version",void 0),a([l({type:jr})],Ye.prototype,"holder",void 0),a([l({type:or})],Ye.prototype,"issuer",void 0),a([l({type:U})],Ye.prototype,"signature",void 0),a([l({type:h.Integer,converter:ue})],Ye.prototype,"serialNumber",void 0),a([l({type:Fi})],Ye.prototype,"attrCertValidityPeriod",void 0),a([l({type:ht,repeated:"sequence"})],Ye.prototype,"attributes",void 0),a([l({type:h.BitString,optional:!0})],Ye.prototype,"issuerUniqueID",void 0),a([l({type:Dt,optional:!0})],Ye.prototype,"extensions",void 0);class Ki{constructor(e={}){this.acinfo=new Ye,this.signatureAlgorithm=new U,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:Ye})],Ki.prototype,"acinfo",void 0),a([l({type:U})],Ki.prototype,"signatureAlgorithm",void 0),a([l({type:h.BitString})],Ki.prototype,"signatureValue",void 0);var qi;(function(r){r[r.unmarked=1]="unmarked",r[r.unclassified=2]="unclassified",r[r.restricted=4]="restricted",r[r.confidential=8]="confidential",r[r.secret=16]="secret",r[r.topSecret=32]="topSecret"})(qi||(qi={}));class $o extends xi{}class Uo{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier,implicit:!0,context:0})],Uo.prototype,"type",void 0),a([l({type:h.Any,implicit:!0,context:1})],Uo.prototype,"value",void 0);class Ho{constructor(e={}){this.policyId="",this.classList=new $o(qi.unclassified),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Ho.prototype,"policyId",void 0),a([l({type:$o,defaultValue:new $o(qi.unclassified)})],Ho.prototype,"classList",void 0),a([l({type:Uo,repeated:"set"})],Ho.prototype,"securityCategories",void 0);class Gi{constructor(e={}){Object.assign(this,e)}}a([l({type:ie})],Gi.prototype,"cotets",void 0),a([l({type:h.ObjectIdentifier})],Gi.prototype,"oid",void 0),a([l({type:h.Utf8String})],Gi.prototype,"string",void 0);class jc{constructor(e={}){this.values=[],Object.assign(this,e)}}a([l({type:Ie,implicit:!0,context:0,optional:!0})],jc.prototype,"policyAuthority",void 0),a([l({type:Gi,repeated:"sequence"})],jc.prototype,"values",void 0);var Lo;class zi{constructor(e={}){this.targetCertificate=new Rt,Object.assign(this,e)}}a([l({type:Rt})],zi.prototype,"targetCertificate",void 0),a([l({type:Q,optional:!0})],zi.prototype,"targetName",void 0),a([l({type:Mt,optional:!0})],zi.prototype,"certDigestInfo",void 0);let sr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:Q,context:0,implicit:!0})],sr.prototype,"targetName",void 0),a([l({type:Q,context:1,implicit:!0})],sr.prototype,"targetGroup",void 0),a([l({type:zi,context:2,implicit:!0})],sr.prototype,"targetCert",void 0),sr=a([E({type:x.Choice})],sr);let Fo=Lo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Lo.prototype)}};Fo=Lo=a([E({type:x.Sequence,itemType:sr})],Fo);var Ko;let Pc=Ko=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Ko.prototype)}};Pc=Ko=a([E({type:x.Sequence,itemType:Fo})],Pc);class Dc{constructor(e={}){Object.assign(this,e)}}a([l({type:Ie,implicit:!0,context:0,optional:!0})],Dc.prototype,"roleAuthority",void 0),a([l({type:Q,implicit:!0,context:1})],Dc.prototype,"roleName",void 0);class qo{constructor(e={}){this.service=new Q,this.ident=new Q,Object.assign(this,e)}}a([l({type:Q})],qo.prototype,"service",void 0),a([l({type:Q})],qo.prototype,"ident",void 0),a([l({type:ie,optional:!0})],qo.prototype,"authInfo",void 0);var Go;class zo{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],zo.prototype,"otherCertFormat",void 0),a([l({type:h.Any})],zo.prototype,"otherCert",void 0);let ar=class{constructor(e={}){Object.assign(this,e)}};a([l({type:tr})],ar.prototype,"certificate",void 0),a([l({type:Ki,context:2,implicit:!0})],ar.prototype,"v2AttrCert",void 0),a([l({type:zo,context:3,implicit:!0})],ar.prototype,"other",void 0),ar=a([E({type:x.Choice})],ar);let Wi=Go=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Go.prototype)}};Wi=Go=a([E({type:x.Set,itemType:ar})],Wi);class cr{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],cr.prototype,"contentType",void 0),a([l({type:h.Any,context:0})],cr.prototype,"content",void 0);let Pr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:ie})],Pr.prototype,"single",void 0),a([l({type:h.Any})],Pr.prototype,"any",void 0),Pr=a([E({type:x.Choice})],Pr);class Ji{constructor(e={}){this.eContentType="",Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Ji.prototype,"eContentType",void 0),a([l({type:Pr,context:0,optional:!0})],Ji.prototype,"eContent",void 0);let Dr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:ie,context:0,implicit:!0,optional:!0})],Dr.prototype,"value",void 0),a([l({type:ie,converter:nf,context:0,implicit:!0,optional:!0,repeated:"sequence"})],Dr.prototype,"constructedValue",void 0),Dr=a([E({type:x.Choice})],Dr);class Rr{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new Mi,Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Rr.prototype,"contentType",void 0),a([l({type:Mi})],Rr.prototype,"contentEncryptionAlgorithm",void 0),a([l({type:Dr,optional:!0})],Rr.prototype,"encryptedContent",void 0);class Yi{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Yi.prototype,"keyAttrId",void 0),a([l({type:h.Any,optional:!0})],Yi.prototype,"keyAttr",void 0);var Wo;class Zi{constructor(e={}){this.subjectKeyIdentifier=new At,Object.assign(this,e)}}a([l({type:At})],Zi.prototype,"subjectKeyIdentifier",void 0),a([l({type:h.GeneralizedTime,optional:!0})],Zi.prototype,"date",void 0),a([l({type:Yi,optional:!0})],Zi.prototype,"other",void 0);let lr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:Zi,context:0,implicit:!0,optional:!0})],lr.prototype,"rKeyId",void 0),a([l({type:rr,optional:!0})],lr.prototype,"issuerAndSerialNumber",void 0),lr=a([E({type:x.Choice})],lr);class Jo{constructor(e={}){this.rid=new lr,this.encryptedKey=new ie,Object.assign(this,e)}}a([l({type:lr})],Jo.prototype,"rid",void 0),a([l({type:ie})],Jo.prototype,"encryptedKey",void 0);let Qi=Wo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Wo.prototype)}};Qi=Wo=a([E({type:x.Sequence,itemType:Jo})],Qi);class Yo{constructor(e={}){this.algorithm=new U,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:U})],Yo.prototype,"algorithm",void 0),a([l({type:h.BitString})],Yo.prototype,"publicKey",void 0);let $t=class{constructor(e={}){Object.assign(this,e)}};a([l({type:At,context:0,implicit:!0,optional:!0})],$t.prototype,"subjectKeyIdentifier",void 0),a([l({type:Yo,context:1,implicit:!0,optional:!0})],$t.prototype,"originatorKey",void 0),a([l({type:rr,optional:!0})],$t.prototype,"issuerAndSerialNumber",void 0),$t=a([E({type:x.Choice})],$t);class ur{constructor(e={}){this.version=mt.v3,this.originator=new $t,this.keyEncryptionAlgorithm=new rt,this.recipientEncryptedKeys=new Qi,Object.assign(this,e)}}a([l({type:h.Integer})],ur.prototype,"version",void 0),a([l({type:$t,context:0})],ur.prototype,"originator",void 0),a([l({type:ie,context:1,optional:!0})],ur.prototype,"ukm",void 0),a([l({type:rt})],ur.prototype,"keyEncryptionAlgorithm",void 0),a([l({type:Qi})],ur.prototype,"recipientEncryptedKeys",void 0);let fr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:At,context:0,implicit:!0})],fr.prototype,"subjectKeyIdentifier",void 0),a([l({type:rr})],fr.prototype,"issuerAndSerialNumber",void 0),fr=a([E({type:x.Choice})],fr);class Mr{constructor(e={}){this.version=mt.v0,this.rid=new fr,this.keyEncryptionAlgorithm=new rt,this.encryptedKey=new ie,Object.assign(this,e)}}a([l({type:h.Integer})],Mr.prototype,"version",void 0),a([l({type:fr})],Mr.prototype,"rid",void 0),a([l({type:rt})],Mr.prototype,"keyEncryptionAlgorithm",void 0),a([l({type:ie})],Mr.prototype,"encryptedKey",void 0);class $r{constructor(e={}){this.keyIdentifier=new ie,Object.assign(this,e)}}a([l({type:ie})],$r.prototype,"keyIdentifier",void 0),a([l({type:h.GeneralizedTime,optional:!0})],$r.prototype,"date",void 0),a([l({type:Yi,optional:!0})],$r.prototype,"other",void 0);class Ur{constructor(e={}){this.version=mt.v4,this.kekid=new $r,this.keyEncryptionAlgorithm=new rt,this.encryptedKey=new ie,Object.assign(this,e)}}a([l({type:h.Integer})],Ur.prototype,"version",void 0),a([l({type:$r})],Ur.prototype,"kekid",void 0),a([l({type:rt})],Ur.prototype,"keyEncryptionAlgorithm",void 0),a([l({type:ie})],Ur.prototype,"encryptedKey",void 0);class Hr{constructor(e={}){this.version=mt.v0,this.keyEncryptionAlgorithm=new rt,this.encryptedKey=new ie,Object.assign(this,e)}}a([l({type:h.Integer})],Hr.prototype,"version",void 0),a([l({type:_o,context:0,optional:!0})],Hr.prototype,"keyDerivationAlgorithm",void 0),a([l({type:rt})],Hr.prototype,"keyEncryptionAlgorithm",void 0),a([l({type:ie})],Hr.prototype,"encryptedKey",void 0);class Zo{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Zo.prototype,"oriType",void 0),a([l({type:h.Any})],Zo.prototype,"oriValue",void 0);let kt=class{constructor(e={}){Object.assign(this,e)}};a([l({type:Mr,optional:!0})],kt.prototype,"ktri",void 0),a([l({type:ur,context:1,implicit:!0,optional:!0})],kt.prototype,"kari",void 0),a([l({type:Ur,context:2,implicit:!0,optional:!0})],kt.prototype,"kekri",void 0),a([l({type:Hr,context:3,implicit:!0,optional:!0})],kt.prototype,"pwri",void 0),a([l({type:Zo,context:4,implicit:!0,optional:!0})],kt.prototype,"ori",void 0),kt=a([E({type:x.Choice})],kt);var Qo;let Xi=Qo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Qo.prototype)}};Xi=Qo=a([E({type:x.Set,itemType:kt})],Xi);var Xo;class en{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],en.prototype,"otherRevInfoFormat",void 0),a([l({type:h.Any})],en.prototype,"otherRevInfo",void 0);let Lr=class{constructor(e={}){this.other=new en,Object.assign(this,e)}};a([l({type:en,context:1,implicit:!0})],Lr.prototype,"other",void 0),Lr=a([E({type:x.Choice})],Lr);let es=Xo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Xo.prototype)}};es=Xo=a([E({type:x.Set,itemType:Lr})],es);class ts{constructor(e={}){Object.assign(this,e)}}a([l({type:Wi,context:0,implicit:!0,optional:!0})],ts.prototype,"certs",void 0),a([l({type:es,context:1,implicit:!0,optional:!0})],ts.prototype,"crls",void 0);var rs;let is=rs=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,rs.prototype)}};is=rs=a([E({type:x.Set,itemType:nr})],is);class Fr{constructor(e={}){this.version=mt.v0,this.recipientInfos=new Xi,this.encryptedContentInfo=new Rr,Object.assign(this,e)}}a([l({type:h.Integer})],Fr.prototype,"version",void 0),a([l({type:ts,context:0,implicit:!0,optional:!0})],Fr.prototype,"originatorInfo",void 0),a([l({type:Xi})],Fr.prototype,"recipientInfos",void 0),a([l({type:Rr})],Fr.prototype,"encryptedContentInfo",void 0),a([l({type:is,context:1,implicit:!0,optional:!0})],Fr.prototype,"unprotectedAttrs",void 0);const Nf="1.2.840.113549.1.7.2";var ns;let tn=ns=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,ns.prototype)}};tn=ns=a([E({type:x.Set,itemType:_r})],tn);class dr{constructor(e={}){this.version=mt.v0,this.digestAlgorithms=new tn,this.encapContentInfo=new Ji,this.signerInfos=new $i,Object.assign(this,e)}}a([l({type:h.Integer})],dr.prototype,"version",void 0),a([l({type:tn})],dr.prototype,"digestAlgorithms",void 0),a([l({type:Ji})],dr.prototype,"encapContentInfo",void 0),a([l({type:Wi,context:0,implicit:!0,optional:!0})],dr.prototype,"certificates",void 0),a([l({type:Lr,context:1,implicit:!0,optional:!0})],dr.prototype,"crls",void 0),a([l({type:$i})],dr.prototype,"signerInfos",void 0);const Kr="1.2.840.10045.2.1",os="1.2.840.10045.4.1",Rc="1.2.840.10045.4.3.1",ss="1.2.840.10045.4.3.2",as="1.2.840.10045.4.3.3",cs="1.2.840.10045.4.3.4",Mc="1.2.840.10045.3.1.7",$c="1.3.132.0.34",Uc="1.3.132.0.35";function qr(r){return new U({algorithm:r})}const Of=qr(os);qr(Rc);const Tf=qr(ss),Vf=qr(as),_f=qr(cs);let pr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:h.ObjectIdentifier})],pr.prototype,"namedCurve",void 0),pr=a([E({type:x.Choice})],pr);class rn{constructor(e={}){this.version=1,this.privateKey=new ie,Object.assign(this,e)}}a([l({type:h.Integer})],rn.prototype,"version",void 0),a([l({type:ie})],rn.prototype,"privateKey",void 0),a([l({type:pr,context:0,optional:!0})],rn.prototype,"parameters",void 0),a([l({type:h.BitString,context:1,optional:!0})],rn.prototype,"publicKey",void 0);class nn{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.Integer,converter:ue})],nn.prototype,"r",void 0),a([l({type:h.Integer,converter:ue})],nn.prototype,"s",void 0);const Ve="1.2.840.113549.1.1",hr=`${Ve}.1`,jf=`${Ve}.7`,Pf=`${Ve}.9`,Df=`${Ve}.10`,Rf=`${Ve}.2`,Mf=`${Ve}.4`,on=`${Ve}.5`,$f=`${Ve}.14`,ls=`${Ve}.11`,sn=`${Ve}.12`,an=`${Ve}.13`,Hc=`${Ve}.15`,Lc=`${Ve}.16`,Fc="1.3.14.3.2.26",Kc="2.16.840.1.101.3.4.2.4",qc="2.16.840.1.101.3.4.2.1",Gc="2.16.840.1.101.3.4.2.2",zc="2.16.840.1.101.3.4.2.3",Uf="2.16.840.1.101.3.4.2.5",Hf="2.16.840.1.101.3.4.2.6",Lf="1.2.840.113549.2.2",Ff="1.2.840.113549.2.5",us=`${Ve}.8`;function me(r){return new U({algorithm:r,parameters:null})}me(Lf),me(Ff);const Ut=me(Fc);me(Kc),me(qc),me(Gc),me(zc),me(Uf),me(Hf);const Wc=new U({algorithm:us,parameters:F.serialize(Ut)}),Jc=new U({algorithm:Pf,parameters:F.serialize(Ci.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});me(hr),me(Rf),me(Mf),me(on),me(Hc),me(Lc),me(sn),me(an),me(Hc),me(Lc);class cn{constructor(e={}){this.hashAlgorithm=new U(Ut),this.maskGenAlgorithm=new U({algorithm:us,parameters:F.serialize(Ut)}),this.pSourceAlgorithm=new U(Jc),Object.assign(this,e)}}a([l({type:U,context:0,defaultValue:Ut})],cn.prototype,"hashAlgorithm",void 0),a([l({type:U,context:1,defaultValue:Wc})],cn.prototype,"maskGenAlgorithm",void 0),a([l({type:U,context:2,defaultValue:Jc})],cn.prototype,"pSourceAlgorithm",void 0),new U({algorithm:jf,parameters:F.serialize(new cn)});class Gr{constructor(e={}){this.hashAlgorithm=new U(Ut),this.maskGenAlgorithm=new U({algorithm:us,parameters:F.serialize(Ut)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}}a([l({type:U,context:0,defaultValue:Ut})],Gr.prototype,"hashAlgorithm",void 0),a([l({type:U,context:1,defaultValue:Wc})],Gr.prototype,"maskGenAlgorithm",void 0),a([l({type:h.Integer,context:2,defaultValue:20})],Gr.prototype,"saltLength",void 0),a([l({type:h.Integer,context:3,defaultValue:1})],Gr.prototype,"trailerField",void 0),new U({algorithm:Df,parameters:F.serialize(new Gr)});class ln{constructor(e={}){this.digestAlgorithm=new U,this.digest=new ie,Object.assign(this,e)}}a([l({type:U})],ln.prototype,"digestAlgorithm",void 0),a([l({type:ie})],ln.prototype,"digest",void 0);var fs;class un{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.Integer,converter:ue})],un.prototype,"prime",void 0),a([l({type:h.Integer,converter:ue})],un.prototype,"exponent",void 0),a([l({type:h.Integer,converter:ue})],un.prototype,"coefficient",void 0);let ds=fs=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,fs.prototype)}};ds=fs=a([E({type:x.Sequence,itemType:un})],ds);class nt{constructor(e={}){this.version=0,this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),this.privateExponent=new ArrayBuffer(0),this.prime1=new ArrayBuffer(0),this.prime2=new ArrayBuffer(0),this.exponent1=new ArrayBuffer(0),this.exponent2=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.Integer})],nt.prototype,"version",void 0),a([l({type:h.Integer,converter:ue})],nt.prototype,"modulus",void 0),a([l({type:h.Integer,converter:ue})],nt.prototype,"publicExponent",void 0),a([l({type:h.Integer,converter:ue})],nt.prototype,"privateExponent",void 0),a([l({type:h.Integer,converter:ue})],nt.prototype,"prime1",void 0),a([l({type:h.Integer,converter:ue})],nt.prototype,"prime2",void 0),a([l({type:h.Integer,converter:ue})],nt.prototype,"exponent1",void 0),a([l({type:h.Integer,converter:ue})],nt.prototype,"exponent2",void 0),a([l({type:h.Integer,converter:ue})],nt.prototype,"coefficient",void 0),a([l({type:ds,optional:!0})],nt.prototype,"otherPrimeInfos",void 0);class ps{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.Integer,converter:ue})],ps.prototype,"modulus",void 0),a([l({type:h.Integer,converter:ue})],ps.prototype,"publicExponent",void 0);var hs;(function(r){r[r.Transient=0]="Transient",r[r.Singleton=1]="Singleton",r[r.ResolutionScoped=2]="ResolutionScoped",r[r.ContainerScoped=3]="ContainerScoped"})(hs||(hs={}));const _e=hs;/*! *****************************************************************************
|
|
75
|
+
`)}`:`${t} :`}}ha=Te,P.Constructed=ha,Te.NAME="CONSTRUCTED";class ya extends Ee{fromBER(e,t,i){return t}toBER(e){return Ge}}ya.override="EndOfContentValueBlock";var ga;class Hn extends Ae{constructor(e={}){super(e,ya),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}ga=Hn,P.EndOfContent=ga,Hn.NAME=xr;var ma;class Nt extends Ae{constructor(e={}){super(e,Ee),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,i){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=i,t+i>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+i}toBER(e,t){const i=new ArrayBuffer(2);if(!e){const n=new Uint8Array(i);n[0]=5,n[1]=0}return t&&t.write(i),i}onAsciiEncoding(){return`${this.constructor.NAME}`}}ma=Nt,P.Null=ma,Nt.NAME="NULL";class ba extends et(Ee){constructor({value:e,...t}={}){super(t),t.valueHex?this.valueHexView=_.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}fromBER(e,t,i){const n=_.toUint8Array(e);return ct(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,na.call(this),this.blockLength=i,t+i):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}ba.NAME="BooleanValueBlock";var va;let li=class extends Ae{constructor(e={}){super(e,ba),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};va=li,P.Boolean=va,li.NAME="BOOLEAN";class wa extends et(At){constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,i){let n=0;if(this.isConstructed){if(this.isHexOnly=!1,n=At.prototype.fromBER.call(this,e,t,i),n===-1)return n;for(let s=0;s<this.value.length;s++){const c=this.value[s].constructor.NAME;if(c===xr){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(c!==aa)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,n=super.fromBER(e,t,i),this.blockLength=i;return n}toBER(e,t){return this.isConstructed?At.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}wa.NAME="OctetStringValueBlock";var Aa;let Ot=class Iu extends Ae{constructor({idBlock:e={},lenBlock:t={},...i}={}){var n,s;(n=i.isConstructed)!==null&&n!==void 0||(i.isConstructed=!!(!((s=i.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:i.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!i.isIndefiniteForm},...i},wa),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,i){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,i===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){const s=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(t,t+i);try{if(s.byteLength){const c=zt(s,0,s.byteLength);c.offset!==-1&&c.offset===i&&(this.valueBlock.value=[c.result])}}catch{}}return super.fromBER(e,t,i)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?Te.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${M.ToHex(this.valueBlock.valueHexView)}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const e=[];for(const t of this.valueBlock.value)t instanceof Iu&&e.push(t.valueBlock.valueHexView);return _.concat(e)}};Aa=Ot,P.OctetString=Aa,Ot.NAME=aa;class Sa extends et(At){constructor({unusedBits:e=0,isConstructed:t=!1,...i}={}){super(i),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,i){if(!i)return t;let n=-1;if(this.isConstructed){if(n=At.prototype.fromBER.call(this,e,t,i),n===-1)return n;for(const u of this.value){const f=u.constructor.NAME;if(f===xr){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(f!==ca)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const d=u.valueBlock;if(this.unusedBits>0&&d.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=d.unusedBits}return n}const s=_.toUint8Array(e);if(!ct(this,s,t,i))return-1;const c=s.subarray(t,t+i);if(this.unusedBits=c[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const u=c.subarray(1);try{if(u.byteLength){const f=zt(u,0,u.byteLength);f.offset!==-1&&f.offset===i-1&&(this.value=[f.result])}}catch{}}return this.valueHexView=c.subarray(1),this.blockLength=c.length,t+i}toBER(e,t){if(this.isConstructed)return At.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return Ge;const i=new Uint8Array(this.valueHexView.length+1);return i[0]=this.unusedBits,i.set(this.valueHexView,1),i.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}Sa.NAME="BitStringValueBlock";var ka;let Tt=class extends Ae{constructor({idBlock:e={},lenBlock:t={},...i}={}){var n,s;(n=i.isConstructed)!==null&&n!==void 0||(i.isConstructed=!!(!((s=i.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:i.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!i.isIndefiniteForm},...i},Sa),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,i){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Te.prototype.onAsciiEncoding.call(this);{const e=[],t=this.valueBlock.valueHexView;for(const n of t)e.push(n.toString(2).padStart(8,"0"));const i=e.join("");return`${this.constructor.NAME} : ${i.substring(0,i.length-this.valueBlock.unusedBits)}`}}};ka=Tt,P.BitString=ka,Tt.NAME=ca;var xa;function Wu(r,e){const t=new Uint8Array([0]),i=new Uint8Array(r),n=new Uint8Array(e);let s=i.slice(0);const c=s.length-1,u=n.slice(0),f=u.length-1;let d=0;const b=f<c?c:f;let y=0;for(let W=b;W>=0;W--,y++){switch(!0){case y<u.length:d=s[c-y]+u[f-y]+t[0];break;default:d=s[c-y]+t[0]}switch(t[0]=d/10,!0){case y>=s.length:s=Rn(new Uint8Array([d%10]),s);break;default:s[c-y]=d%10}}return t[0]>0&&(s=Rn(t,s)),s}function Ca(r){if(r>=kr.length)for(let e=kr.length;e<=r;e++){const t=new Uint8Array([0]);let i=kr[e-1].slice(0);for(let n=i.length-1;n>=0;n--){const s=new Uint8Array([(i[n]<<1)+t[0]]);t[0]=s[0]/10,i[n]=s[0]%10}t[0]>0&&(i=Rn(t,i)),kr.push(i)}return kr[r]}function zu(r,e){let t=0;const i=new Uint8Array(r),n=new Uint8Array(e),s=i.slice(0),c=s.length-1,u=n.slice(0),f=u.length-1;let d,b=0;for(let y=f;y>=0;y--,b++)switch(d=s[c-b]-u[f-b]-t,!0){case d<0:t=1,s[c-b]=d+10;break;default:t=0,s[c-b]=d}if(t>0)for(let y=c-f+1;y>=0;y--,b++)if(d=s[c-b]-t,d<0)t=1,s[c-b]=d+10;else{t=0,s[c-b]=d;break}return s.slice()}class Ln extends et(Ee){constructor({value:e,...t}={}){super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}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=na.call(this)))}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(Pu(e))}get valueDec(){return this._valueDec}fromDER(e,t,i,n=0){const s=this.fromBER(e,t,i);if(s===-1)return s;const c=this.valueHexView;return c[0]===0&&c[1]&128?this.valueHexView=c.subarray(1):n!==0&&c.length<n&&(n-c.length>1&&(n=c.length+1),this.valueHexView=c.subarray(n-c.length)),s}toDER(e=!1){const t=this.valueHexView;switch(!0){case(t[0]&128)!==0:{const i=new Uint8Array(this.valueHexView.length+1);i[0]=0,i.set(t,1),this.valueHexView=i}break;case(t[0]===0&&(t[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,t,i){const n=super.fromBER(e,t,i);return n===-1||this.setValueHex(),n}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=this.valueHexView.length*8-1;let t=new Uint8Array(this.valueHexView.length*8/3),i=0,n;const s=this.valueHexView;let c="",u=!1;for(let f=s.byteLength-1;f>=0;f--){n=s[f];for(let d=0;d<8;d++){if((n&1)===1)switch(i){case e:t=zu(Ca(i),t),c="-";break;default:t=Wu(t,Ca(i))}i++,n>>=1}}for(let f=0;f<t.length;f++)t[f]&&(u=!0),u&&(c+=oa.charAt(t[f]));return u===!1&&(c+=oa.charAt(0)),c}}xa=Ln,Ln.NAME="IntegerValueBlock",Object.defineProperty(xa.prototype,"valueHex",{set:function(r){this.valueHexView=new Uint8Array(r),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var Ba;class tt extends Ae{constructor(e={}){super(e,Ln),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return si(),BigInt(this.valueBlock.toString())}static fromBigInt(e){si();const t=BigInt(e),i=new ai,n=t.toString(16).replace(/^-/,""),s=new Uint8Array(M.FromHex(n));if(t<0){const u=new Uint8Array(s.length+(s[0]&128?1:0));u[0]|=128;const d=BigInt(`0x${M.ToHex(u)}`)+t,b=_.toUint8Array(M.FromHex(d.toString(16)));b[0]|=128,i.write(b)}else s[0]&128&&i.write(new Uint8Array([0])),i.write(s);return new tt({valueHex:i.final()})}convertToDER(){const e=new tt({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new tt({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}Ba=tt,P.Integer=Ba,tt.NAME="INTEGER";var Ea;class ui extends tt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}Ea=ui,P.Enumerated=Ea,ui.NAME="ENUMERATED";class Fn extends et(Ee){constructor({valueDec:e=-1,isFirstSid:t=!1,...i}={}){super(i),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,i){if(!i)return t;const n=_.toUint8Array(e);if(!ct(this,n,t,i))return-1;const s=n.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let u=0;u<i&&(this.valueHexView[u]=s[u]&127,this.blockLength++,!!(s[u]&128));u++);const c=new Uint8Array(this.blockLength);for(let u=0;u<this.blockLength;u++)c[u]=this.valueHexView[u];return this.valueHexView=c,s[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Wt(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){si();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;const i=new Uint8Array(t.length/7);for(let n=0;n<i.length;n++)i[n]=parseInt(t.slice(n*7,n*7+7),2)+(n+1<i.length?128:0);this.fromBER(i.buffer,0,i.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const n=this.valueHexView,s=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength-1;c++)s[c]=n[c]|128;return s[this.blockLength-1]=n[this.blockLength-1],s.buffer}const t=Et(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",Ge;const i=new Uint8Array(t.byteLength);if(!e){const n=new Uint8Array(t),s=t.byteLength-1;for(let c=0;c<s;c++)i[c]=n[c]|128;i[s]=n[s]}return i}toString(){let e="";if(this.isHexOnly)e=M.ToHex(this.valueHexView);else if(this.isFirstSid){let t=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",t-=40):(e="2.",t-=80),e+=t.toString()}else e=this.valueDec.toString();return e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}}Fn.NAME="sidBlock";class Ia extends Ee{constructor({value:e=Oe,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let n=t;for(;i>0;){const s=new Fn;if(n=s.fromBER(e,n,i),n===-1)return this.blockLength=0,this.error=s.error,n;this.value.length===0&&(s.isFirstSid=!0),this.blockLength+=s.blockLength,i-=s.blockLength,this.value.push(s)}return n}toBER(e){const t=[];for(let i=0;i<this.value.length;i++){const n=this.value[i].toBER(e);if(n.byteLength===0)return this.error=this.value[i].error,Ge;t.push(n)}return Mn(t)}fromString(e){this.value=[];let t=0,i=0,n="",s=!1;do if(i=e.indexOf(".",t),i===-1?n=e.substring(t):n=e.substring(t,i),t=i+1,s){const c=this.value[0];let u=0;switch(c.valueDec){case 0:break;case 1:u=40;break;case 2:u=80;break;default:this.value=[];return}const f=parseInt(n,10);if(isNaN(f))return;c.valueDec=f+u,s=!1}else{const c=new Fn;if(n>Number.MAX_SAFE_INTEGER){si();const u=BigInt(n);c.valueBigInt=u}else if(c.valueDec=parseInt(n,10),isNaN(c.valueDec))return;this.value.length||(c.isFirstSid=!0,s=!0),this.value.push(c)}while(i!==-1)}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let n=this.value[i].toString();i!==0&&(e=`${e}.`),t?(n=`{${n}}`,this.value[i].isFirstSid?e=`2.{${n} - 80}`:e+=n):e+=n}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}Ia.NAME="ObjectIdentifierValueBlock";var Na;class fi extends Ae{constructor(e={}){super(e,Ia),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}Na=fi,P.ObjectIdentifier=Na,fi.NAME="OBJECT IDENTIFIER";class Kn extends et(It){constructor({valueDec:e=0,...t}={}){super(t),this.valueDec=e}fromBER(e,t,i){if(i===0)return t;const n=_.toUint8Array(e);if(!ct(this,n,t,i))return-1;const s=n.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let u=0;u<i&&(this.valueHexView[u]=s[u]&127,this.blockLength++,!!(s[u]&128));u++);const c=new Uint8Array(this.blockLength);for(let u=0;u<this.blockLength;u++)c[u]=this.valueHexView[u];return this.valueHexView=c,s[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Wt(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const n=this.valueHexView,s=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength-1;c++)s[c]=n[c]|128;return s[this.blockLength-1]=n[this.blockLength-1],s.buffer}const t=Et(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",Ge;const i=new Uint8Array(t.byteLength);if(!e){const n=new Uint8Array(t),s=t.byteLength-1;for(let c=0;c<s;c++)i[c]=n[c]|128;i[s]=n[s]}return i.buffer}toString(){let e="";return this.isHexOnly?e=M.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}Kn.NAME="relativeSidBlock";class Oa extends Ee{constructor({value:e=Oe,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let n=t;for(;i>0;){const s=new Kn;if(n=s.fromBER(e,n,i),n===-1)return this.blockLength=0,this.error=s.error,n;this.blockLength+=s.blockLength,i-=s.blockLength,this.value.push(s)}return n}toBER(e,t){const i=[];for(let n=0;n<this.value.length;n++){const s=this.value[n].toBER(e);if(s.byteLength===0)return this.error=this.value[n].error,Ge;i.push(s)}return Mn(i)}fromString(e){this.value=[];let t=0,i=0,n="";do{i=e.indexOf(".",t),i===-1?n=e.substring(t):n=e.substring(t,i),t=i+1;const s=new Kn;if(s.valueDec=parseInt(n,10),isNaN(s.valueDec))return!0;this.value.push(s)}while(i!==-1);return!0}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let n=this.value[i].toString();i!==0&&(e=`${e}.`),t&&(n=`{${n}}`),e+=n}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}Oa.NAME="RelativeObjectIdentifierValueBlock";var Ta;class qn extends Ae{constructor(e={}){super(e,Oa),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}Ta=qn,P.RelativeObjectIdentifier=Ta,qn.NAME="RelativeObjectIdentifier";var Va;class lt extends Te{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}Va=lt,P.Sequence=Va,lt.NAME="SEQUENCE";var _a;let ut=class extends Te{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};_a=ut,P.Set=_a,ut.NAME="SET";class ja extends et(Ee){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=Oe}toJSON(){return{...super.toJSON(),value:this.value}}}ja.NAME="StringValueBlock";class Pa extends ja{}Pa.NAME="SimpleStringValueBlock";class Re extends Un{constructor({...e}={}){super(e,Pa)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,_.toUint8Array(e))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(t);for(let n=0;n<t;n++)i[n]=e.charCodeAt(n);this.valueBlock.value=e}}Re.NAME="SIMPLE STRING";class Da extends Re{fromBuffer(e){this.valueBlock.valueHexView=_.toUint8Array(e);try{this.valueBlock.value=M.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=M.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(M.FromUtf8String(e)),this.valueBlock.value=e}}Da.NAME="Utf8StringValueBlock";var Ra;class ft extends Da{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}Ra=ft,P.Utf8String=Ra,ft.NAME="UTF8String";class Ma extends Re{fromBuffer(e){this.valueBlock.value=M.ToUtf16String(e),this.valueBlock.valueHexView=_.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(M.FromUtf16String(e))}}Ma.NAME="BmpStringValueBlock";var $a;class di extends Ma{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}$a=di,P.BmpString=$a,di.NAME="BMPString";class Ua extends Re{fromBuffer(e){const t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),i=new Uint8Array(t);for(let n=0;n<i.length;n+=4)i[n]=i[n+3],i[n+1]=i[n+2],i[n+2]=0,i[n+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(t*4);for(let n=0;n<t;n++){const s=Et(e.charCodeAt(n),8),c=new Uint8Array(s);if(c.length>4)continue;const u=4-c.length;for(let f=c.length-1;f>=0;f--)i[n*4+f+u]=c[f]}this.valueBlock.value=e}}Ua.NAME="UniversalStringValueBlock";var Ha;class pi extends Ua{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}Ha=pi,P.UniversalString=Ha,pi.NAME="UniversalString";var La;class hi extends Re{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}La=hi,P.NumericString=La,hi.NAME="NumericString";var Fa;class yi extends Re{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}Fa=yi,P.PrintableString=Fa,yi.NAME="PrintableString";var Ka;class gi extends Re{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}Ka=gi,P.TeletexString=Ka,gi.NAME="TeletexString";var qa;class mi extends Re{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}qa=mi,P.VideotexString=qa,mi.NAME="VideotexString";var Ga;class bi extends Re{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}Ga=bi,P.IA5String=Ga,bi.NAME="IA5String";var Wa;class vi extends Re{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}Wa=vi,P.GraphicString=Wa,vi.NAME="GraphicString";var za;class Br extends Re{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}za=Br,P.VisibleString=za,Br.NAME="VisibleString";var Ja;class wi extends Re{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}Ja=wi,P.GeneralString=Ja,wi.NAME="GeneralString";var Ya;class Ai extends Re{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}Ya=Ai,P.CharacterString=Ya,Ai.NAME="CharacterString";var Za;class Er extends Br{constructor({value:e,valueDate:t,...i}={}){if(super(i),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let n=0;n<e.length;n++)this.valueBlock.valueHexView[n]=e.charCodeAt(n)}t&&(this.fromDate(t),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,_.toUint8Array(e)))}toBuffer(){const e=this.toString(),t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let n=0;n<e.length;n++)i[n]=e.charCodeAt(n);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){const i=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(i===null){this.error="Wrong input string for conversion";return}const n=parseInt(i[1],10);n>=50?this.year=1900+n:this.year=2e3+n,this.month=parseInt(i[2],10),this.day=parseInt(i[3],10),this.hour=parseInt(i[4],10),this.minute=parseInt(i[5],10),this.second=parseInt(i[6],10)}toString(e="iso"){if(e==="iso"){const t=new Array(7);return t[0]=De(this.year<2e3?this.year-1900:this.year-2e3,2),t[1]=De(this.month,2),t[2]=De(this.day,2),t[3]=De(this.hour,2),t[4]=De(this.minute,2),t[5]=De(this.second,2),t[6]="Z",t.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}Za=Er,P.UTCTime=Za,Er.NAME="UTCTime";var Qa;class Si extends Er{constructor(e={}){var t;super(e),(t=this.millisecond)!==null&&t!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(e){let t=!1,i="",n="",s=0,c,u=0,f=0;if(e[e.length-1]==="Z")i=e.substring(0,e.length-1),t=!0;else{const y=new Number(e[e.length-1]);if(isNaN(y.valueOf()))throw new Error("Wrong input string for conversion");i=e}if(t){if(i.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(i.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let y=1,W=i.indexOf("+"),O="";if(W===-1&&(W=i.indexOf("-"),y=-1),W!==-1){if(O=i.substring(W+1),i=i.substring(0,W),O.length!==2&&O.length!==4)throw new Error("Wrong input string for conversion");let p=parseInt(O.substring(0,2),10);if(isNaN(p.valueOf()))throw new Error("Wrong input string for conversion");if(u=y*p,O.length===4){if(p=parseInt(O.substring(2,4),10),isNaN(p.valueOf()))throw new Error("Wrong input string for conversion");f=y*p}}}let d=i.indexOf(".");if(d===-1&&(d=i.indexOf(",")),d!==-1){const y=new Number(`0${i.substring(d)}`);if(isNaN(y.valueOf()))throw new Error("Wrong input string for conversion");s=y.valueOf(),n=i.substring(0,d)}else n=i;switch(!0){case n.length===8:if(c=/(\d{4})(\d{2})(\d{2})/ig,d!==-1)throw new Error("Wrong input string for conversion");break;case n.length===10:if(c=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let y=60*s;this.minute=Math.floor(y),y=60*(y-this.minute),this.second=Math.floor(y),y=1e3*(y-this.second),this.millisecond=Math.floor(y)}break;case n.length===12:if(c=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let y=60*s;this.second=Math.floor(y),y=1e3*(y-this.second),this.millisecond=Math.floor(y)}break;case n.length===14:if(c=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){const y=1e3*s;this.millisecond=Math.floor(y)}break;default:throw new Error("Wrong input string for conversion")}const b=c.exec(n);if(b===null)throw new Error("Wrong input string for conversion");for(let y=1;y<b.length;y++)switch(y){case 1:this.year=parseInt(b[y],10);break;case 2:this.month=parseInt(b[y],10);break;case 3:this.day=parseInt(b[y],10);break;case 4:this.hour=parseInt(b[y],10)+u;break;case 5:this.minute=parseInt(b[y],10)+f;break;case 6:this.second=parseInt(b[y],10);break;default:throw new Error("Wrong input string for conversion")}if(t===!1){const y=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=y.getUTCFullYear(),this.month=y.getUTCMonth(),this.day=y.getUTCDay(),this.hour=y.getUTCHours(),this.minute=y.getUTCMinutes(),this.second=y.getUTCSeconds(),this.millisecond=y.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){const t=[];return t.push(De(this.year,4)),t.push(De(this.month,2)),t.push(De(this.day,2)),t.push(De(this.hour,2)),t.push(De(this.minute,2)),t.push(De(this.second,2)),this.millisecond!==0&&(t.push("."),t.push(De(this.millisecond,3))),t.push("Z"),t.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}Qa=Si,P.GeneralizedTime=Qa,Si.NAME="GeneralizedTime";var Xa;class Gn extends ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}Xa=Gn,P.DATE=Xa,Gn.NAME="DATE";var ec;class Wn extends ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}ec=Wn,P.TimeOfDay=ec,Wn.NAME="TimeOfDay";var tc;class zn extends ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}tc=zn,P.DateTime=tc,zn.NAME="DateTime";var rc;class Jn extends ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}rc=Jn,P.Duration=rc,Jn.NAME="Duration";var ic;class Yn extends ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}ic=Yn,P.TIME=ic,Yn.NAME="TIME";class Vt{constructor({name:e=Oe,optional:t=!1}={}){this.name=e,this.optional=t}}class Zn extends Vt{constructor({value:e=[],...t}={}){super(t),this.value=e}}class ki extends Vt{constructor({value:e=new Vt,local:t=!1,...i}={}){super(i),this.value=e,this.local=t}}class Ju{constructor({data:e=ci}={}){this.dataView=_.toUint8Array(e)}get data(){return this.dataView.slice().buffer}set data(e){this.dataView=_.toUint8Array(e)}fromBER(e,t,i){const n=t+i;return this.dataView=_.toUint8Array(e).subarray(t,n),n}toBER(e){return this.dataView.slice().buffer}}function _t(r,e,t){if(t instanceof Zn){for(let s=0;s<t.value.length;s++)if(_t(r,e,t.value[s]).verified)return{verified:!0,result:r};{const s={verified:!1,result:{error:"Wrong values for Choice type"}};return t.hasOwnProperty($n)&&(s.name=t.name),s}}if(t instanceof Vt)return t.hasOwnProperty($n)&&(r[t.name]=e),{verified:!0,result:r};if(!(r instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Mu in t))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Lu in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Fu in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const i=t.idBlock.toBER(!1);if(i.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(t.idBlock.fromBER(i,0,i.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(t.idBlock.hasOwnProperty($u)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(Uu)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(Hu)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:r};if(!(Ru in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:r};if(t.idBlock.isHexOnly){if(!(sa in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const s=t.idBlock.valueHexView,c=e.idBlock.valueHexView;if(s.length!==c.length)return{verified:!1,result:r};for(let u=0;u<s.length;u++)if(s[u]!==c[1])return{verified:!1,result:r}}if(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Oe),t.name&&(r[t.name]=e)),t instanceof P.Constructed){let s=0,c={verified:!1,result:{error:"Unknown error"}},u=t.valueBlock.value.length;if(u>0&&t.valueBlock.value[0]instanceof ki&&(u=e.valueBlock.value.length),u===0)return{verified:!0,result:r};if(e.valueBlock.value.length===0&&t.valueBlock.value.length!==0){let f=!0;for(let d=0;d<t.valueBlock.value.length;d++)f=f&&(t.valueBlock.value[d].optional||!1);return f?{verified:!0,result:r}:(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Oe),t.name&&delete r[t.name]),r.error="Inconsistent object length",{verified:!1,result:r})}for(let f=0;f<u;f++)if(f-s>=e.valueBlock.value.length){if(t.valueBlock.value[f].optional===!1){const d={verified:!1,result:r};return r.error="Inconsistent length between ASN.1 data and schema",t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Oe),t.name&&(delete r[t.name],d.name=t.name)),d}}else if(t.valueBlock.value[0]instanceof ki){if(c=_t(r,e.valueBlock.value[f],t.valueBlock.value[0].value),c.verified===!1)if(t.valueBlock.value[0].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Oe),t.name&&delete r[t.name]),c;if($n in t.valueBlock.value[0]&&t.valueBlock.value[0].name.length>0){let d={};Ku in t.valueBlock.value[0]&&t.valueBlock.value[0].local?d=e:d=r,typeof d[t.valueBlock.value[0].name]>"u"&&(d[t.valueBlock.value[0].name]=[]),d[t.valueBlock.value[0].name].push(e.valueBlock.value[f])}}else if(c=_t(r,e.valueBlock.value[f-s],t.valueBlock.value[f]),c.verified===!1)if(t.valueBlock.value[f].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Oe),t.name&&delete r[t.name]),c;if(c.verified===!1){const f={verified:!1,result:r};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Oe),t.name&&(delete r[t.name],f.name=t.name)),f}return{verified:!0,result:r}}if(t.primitiveSchema&&sa in e.valueBlock){const s=zt(e.valueBlock.valueHexView);if(s.offset===-1){const c={verified:!1,result:s.result};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Oe),t.name&&(delete r[t.name],c.name=t.name)),c}return _t(r,s.result,t.primitiveSchema)}return{verified:!0,result:r}}function Yu(r,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const t=zt(_.toUint8Array(r));return t.offset===-1?{verified:!1,result:t.result}:_t(t.result,t.result,e)}const nc=Object.freeze(Object.defineProperty({__proto__:null,Any:Vt,BaseBlock:Ae,BaseStringBlock:Un,BitString:Tt,BmpString:di,Boolean:li,CharacterString:Ai,Choice:Zn,Constructed:Te,DATE:Gn,DateTime:zn,Duration:Jn,EndOfContent:Hn,Enumerated:ui,GeneralString:wi,GeneralizedTime:Si,GraphicString:vi,HexBlock:et,IA5String:bi,Integer:tt,Null:Nt,NumericString:hi,ObjectIdentifier:fi,OctetString:Ot,Primitive:Cr,PrintableString:yi,RawData:Ju,RelativeObjectIdentifier:qn,Repeated:ki,Sequence:lt,Set:ut,TIME:Yn,TeletexString:gi,TimeOfDay:Wn,UTCTime:Er,UniversalString:pi,Utf8String:ft,ValueBlock:Ee,VideotexString:mi,ViewWriter:ai,VisibleString:Br,compareSchema:_t,fromBER:Jt,verifySchema:Yu},Symbol.toStringTag,{value:"Module"}));var x;(function(r){r[r.Sequence=0]="Sequence",r[r.Set=1]="Set",r[r.Choice=2]="Choice"})(x||(x={}));var h;(function(r){r[r.Any=1]="Any",r[r.Boolean=2]="Boolean",r[r.OctetString=3]="OctetString",r[r.BitString=4]="BitString",r[r.Integer=5]="Integer",r[r.Enumerated=6]="Enumerated",r[r.ObjectIdentifier=7]="ObjectIdentifier",r[r.Utf8String=8]="Utf8String",r[r.BmpString=9]="BmpString",r[r.UniversalString=10]="UniversalString",r[r.NumericString=11]="NumericString",r[r.PrintableString=12]="PrintableString",r[r.TeletexString=13]="TeletexString",r[r.VideotexString=14]="VideotexString",r[r.IA5String=15]="IA5String",r[r.GraphicString=16]="GraphicString",r[r.VisibleString=17]="VisibleString",r[r.GeneralString=18]="GeneralString",r[r.CharacterString=19]="CharacterString",r[r.UTCTime=20]="UTCTime",r[r.GeneralizedTime=21]="GeneralizedTime",r[r.DATE=22]="DATE",r[r.TimeOfDay=23]="TimeOfDay",r[r.DateTime=24]="DateTime",r[r.Duration=25]="Duration",r[r.TIME=26]="TIME",r[r.Null=27]="Null"})(h||(h={}));class xi{constructor(e,t=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(_.isBufferSource(e))this.unusedBits=t,this.value=_.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof Tt))throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=e.valueBlock.unusedBits,this.value=e.valueBlock.valueHex,this}toASN(){return new Tt({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new Tt({name:e})}toNumber(){let e="";const t=new Uint8Array(this.value);for(const i of t)e+=i.toString(2).padStart(8,"0");return e=e.split("").reverse().join(""),this.unusedBits&&(e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(e,2)}fromNumber(e){let t=e.toString(2);const i=t.length+7>>3;this.unusedBits=(i<<3)-t.length;const n=new Uint8Array(i);t=t.padStart(i<<3,"0").split("").reverse().join("");let s=0;for(;s<i;)n[s]=parseInt(t.slice(s<<3,(s<<3)+8),2),s++;this.value=n.buffer}}class ie{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):_.isBufferSource(e)?this.buffer=_.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof Ot))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new Ot({valueHex:this.buffer})}toSchema(e){return new Ot({name:e})}}const Zu={fromASN:r=>r instanceof Nt?null:r.valueBeforeDecodeView,toASN:r=>{if(r===null)return new Nt;const e=Jt(r);if(e.result.error)throw new Error(e.result.error);return e.result}},Qu={fromASN:r=>r.valueBlock.valueHexView.byteLength>=4?r.valueBlock.toString():r.valueBlock.valueDec,toASN:r=>new tt({value:+r})},Xu={fromASN:r=>r.valueBlock.valueDec,toASN:r=>new ui({value:r})},ue={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new tt({valueHex:r})},ef={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new Tt({valueHex:r})},tf={fromASN:r=>r.valueBlock.toString(),toASN:r=>new fi({value:r})},rf={fromASN:r=>r.valueBlock.value,toASN:r=>new li({value:r})},Ci={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new Ot({valueHex:r})},nf={fromASN:r=>new ie(r.getValue()),toASN:r=>r.toASN()};function He(r){return{fromASN:e=>e.valueBlock.value,toASN:e=>new r({value:e})}}const oc=He(ft),of=He(di),sf=He(pi),af=He(hi),cf=He(yi),lf=He(gi),uf=He(mi),ff=He(bi),df=He(vi),pf=He(Br),hf=He(wi),yf=He(Ai),gf={fromASN:r=>r.toDate(),toASN:r=>new Er({valueDate:r})},mf={fromASN:r=>r.toDate(),toASN:r=>new Si({valueDate:r})},bf={fromASN:()=>null,toASN:()=>new Nt};function Qn(r){switch(r){case h.Any:return Zu;case h.BitString:return ef;case h.BmpString:return of;case h.Boolean:return rf;case h.CharacterString:return yf;case h.Enumerated:return Xu;case h.GeneralString:return hf;case h.GeneralizedTime:return mf;case h.GraphicString:return df;case h.IA5String:return ff;case h.Integer:return Qu;case h.Null:return bf;case h.NumericString:return af;case h.ObjectIdentifier:return tf;case h.OctetString:return Ci;case h.PrintableString:return cf;case h.TeletexString:return lf;case h.UTCTime:return gf;case h.UniversalString:return sf;case h.Utf8String:return oc;case h.VideotexString:return uf;case h.VisibleString:return pf;default:return null}}function dt(r){return typeof r=="function"&&r.prototype?r.prototype.toASN&&r.prototype.fromASN?!0:dt(r.prototype):!!(r&&typeof r=="object"&&"toASN"in r&&"fromASN"in r)}function sc(r){var e;if(r){const t=Object.getPrototypeOf(r);return((e=t==null?void 0:t.prototype)===null||e===void 0?void 0:e.constructor)===Array?!0:sc(t)}return!1}function vf(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;const t=new Uint8Array(r),i=new Uint8Array(e);for(let n=0;n<r.byteLength;n++)if(t[n]!==i[n])return!1;return!0}class wf{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e,t=!1){const i=this.items.get(e);if(!i)throw new Error(`Cannot get schema for '${e.prototype.constructor.name}' target`);if(t&&!i.schema)throw new Error(`Schema '${e.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return i}cache(e){const t=this.get(e);t.schema||(t.schema=this.create(e,!0))}createDefault(e){const t={type:x.Sequence,items:{}},i=this.findParentSchema(e);return i&&(Object.assign(t,i),t.items=Object.assign({},t.items,i.items)),t}create(e,t){const i=this.items.get(e)||this.createDefault(e),n=[];for(const s in i.items){const c=i.items[s],u=t?s:"";let f;if(typeof c.type=="number"){const b=h[c.type],y=nc[b];if(!y)throw new Error(`Cannot get ASN1 class by name '${b}'`);f=new y({name:u})}else dt(c.type)?f=new c.type().toSchema(u):c.optional?this.get(c.type).type===x.Choice?f=new Vt({name:u}):(f=this.create(c.type,!1),f.name=u):f=new Vt({name:u});const d=!!c.optional||c.defaultValue!==void 0;if(c.repeated){f.name="";const b=c.repeated==="set"?ut:lt;f=new b({name:"",value:[new ki({name:u,value:f})]})}if(c.context!==null&&c.context!==void 0)if(c.implicit)if(typeof c.type=="number"||dt(c.type)){const b=c.repeated?Te:Cr;n.push(new b({name:u,optional:d,idBlock:{tagClass:3,tagNumber:c.context}}))}else{this.cache(c.type);const b=!!c.repeated;let y=b?f:this.get(c.type,!0).schema;y="valueBlock"in y?y.valueBlock.value:y.value,n.push(new Te({name:b?"":u,optional:d,idBlock:{tagClass:3,tagNumber:c.context},value:y}))}else n.push(new Te({optional:d,idBlock:{tagClass:3,tagNumber:c.context},value:[f]}));else f.optional=d,n.push(f)}switch(i.type){case x.Sequence:return new lt({value:n,name:""});case x.Set:return new ut({value:n,name:""});case x.Choice:return new Zn({value:n,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(e,t){return this.items.set(e,t),this}findParentSchema(e){const t=Object.getPrototypeOf(e);return t?this.items.get(t)||this.findParentSchema(t):null}}const Le=new wf,E=r=>e=>{let t;Le.has(e)?t=Le.get(e):(t=Le.createDefault(e),Le.set(e,t)),Object.assign(t,r)},l=r=>(e,t)=>{let i;Le.has(e.constructor)?i=Le.get(e.constructor):(i=Le.createDefault(e.constructor),Le.set(e.constructor,i));const n=Object.assign({},r);if(typeof n.type=="number"&&!n.converter){const s=Qn(r.type);if(!s)throw new Error(`Cannot get default converter for property '${t}' of ${e.constructor.name}`);n.converter=s}i.items[t]=n};class ac extends Error{constructor(){super(...arguments),this.schemas=[]}}class Af{static parse(e,t){const i=Jt(e);if(i.result.error)throw new Error(i.result.error);return this.fromASN(i.result,t)}static fromASN(e,t){var i;try{if(dt(t))return new t().fromASN(e);const n=Le.get(t);Le.cache(t);let s=n.schema;if(e.constructor===Te&&n.type!==x.Choice){s=new Te({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:n.schema.valueBlock.value});for(const f in n.items)delete e[f]}const c=_t({},e,s);if(!c.verified)throw new ac(`Data does not match to ${t.name} ASN1 schema. ${c.result.error}`);const u=new t;if(sc(t)){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 f=n.itemType;if(typeof f=="number"){const d=Qn(f);if(!d)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);return t.from(e.valueBlock.value,b=>d.fromASN(b))}else return t.from(e.valueBlock.value,d=>this.fromASN(d,f))}for(const f in n.items){const d=c.result[f];if(!d)continue;const b=n.items[f],y=b.type;if(typeof y=="number"||dt(y)){const W=(i=b.converter)!==null&&i!==void 0?i:dt(y)?new y:null;if(!W)throw new Error("Converter is empty");if(b.repeated)if(b.implicit){const O=b.repeated==="sequence"?lt:ut,p=new O;p.valueBlock=d.valueBlock;const m=Jt(p.toBER(!1));if(m.offset===-1)throw new Error(`Cannot parse the child item. ${m.result.error}`);if(!("value"in m.result.valueBlock&&Array.isArray(m.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const A=m.result.valueBlock.value;u[f]=Array.from(A,w=>W.fromASN(w))}else u[f]=Array.from(d,O=>W.fromASN(O));else{let O=d;if(b.implicit){let p;if(dt(y))p=new y().toSchema("");else{const m=h[y],A=nc[m];if(!A)throw new Error(`Cannot get '${m}' class from asn1js module`);p=new A}p.valueBlock=O.valueBlock,O=Jt(p.toBER(!1)).result}u[f]=W.fromASN(O)}}else if(b.repeated){if(!Array.isArray(d))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");u[f]=Array.from(d,W=>this.fromASN(W,y))}else u[f]=this.fromASN(d,y)}return u}catch(n){throw n instanceof ac&&n.schemas.push(t.name),n}}}class Xn{static serialize(e){return e instanceof Ae?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&dt(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const t=e.constructor,i=Le.get(t);Le.cache(t);let n=[];if(i.itemType){if(!Array.isArray(e))throw new TypeError("Parameter 1 should be type of Array.");if(typeof i.itemType=="number"){const c=Qn(i.itemType);if(!c)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);n=e.map(u=>c.toASN(u))}else n=e.map(c=>this.toAsnItem({type:i.itemType},"[]",t,c))}else for(const c in i.items){const u=i.items[c],f=e[c];if(f===void 0||u.defaultValue===f||typeof u.defaultValue=="object"&&typeof f=="object"&&vf(this.serialize(u.defaultValue),this.serialize(f)))continue;const d=Xn.toAsnItem(u,c,t,f);if(typeof u.context=="number")if(u.implicit)if(!u.repeated&&(typeof u.type=="number"||dt(u.type))){const b={};b.valueHex=d instanceof Nt?d.valueBeforeDecodeView:d.valueBlock.toBER(),n.push(new Cr({optional:u.optional,idBlock:{tagClass:3,tagNumber:u.context},...b}))}else n.push(new Te({optional:u.optional,idBlock:{tagClass:3,tagNumber:u.context},value:d.valueBlock.value}));else n.push(new Te({optional:u.optional,idBlock:{tagClass:3,tagNumber:u.context},value:[d]}));else u.repeated?n=n.concat(d):n.push(d)}let s;switch(i.type){case x.Sequence:s=new lt({value:n});break;case x.Set:s=new ut({value:n});break;case x.Choice:if(!n[0])throw new Error(`Schema '${t.name}' has wrong data. Choice cannot be empty.`);s=n[0];break}return s}static toAsnItem(e,t,i,n){let s;if(typeof e.type=="number"){const c=e.converter;if(!c)throw new Error(`Property '${t}' doesn't have converter for type ${h[e.type]} in schema '${i.name}'`);if(e.repeated){if(!Array.isArray(n))throw new TypeError("Parameter 'objProp' should be type of Array.");const u=Array.from(n,d=>c.toASN(d)),f=e.repeated==="sequence"?lt:ut;s=new f({value:u})}else s=c.toASN(n)}else if(e.repeated){if(!Array.isArray(n))throw new TypeError("Parameter 'objProp' should be type of Array.");const c=Array.from(n,f=>this.toASN(f)),u=e.repeated==="sequence"?lt:ut;s=new u({value:c})}else s=this.toASN(n);return s}}class ne extends Array{constructor(e=[]){if(typeof e=="number")super(e);else{super();for(const t of e)this.push(t)}}}class F{static serialize(e){return Xn.serialize(e)}static parse(e,t){return Af.parse(e,t)}static toString(e){const t=_.isBufferSource(e)?_.toArrayBuffer(e):F.serialize(e),i=Jt(t);if(i.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${i.result.error}`);return i.result.toString()}}function a(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var u=r.length-1;u>=0;u--)(c=r[u])&&(s=(n<3?c(s):n>3?c(e,t,s):c(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}typeof SuppressedError=="function"&&SuppressedError;var cc={exports:{}};(function(r){(function(e){const t="(0?\\d+|0x[a-f0-9]+)",i={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},n=new RegExp("^0[0-7]+$","i"),s=new RegExp("^0x[a-f0-9]+$","i"),c="%[0-9a-z]{1,}",u="(?:[0-9a-f]+::?)+",f={zoneIndex:new RegExp(c,"i"),native:new RegExp(`^(::)?(${u})?([0-9a-f]+)?(::)?(${c})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${c})?)$`,"i"),transitional:new RegExp(`^((?:${u})|(?:::)(?:${u})?)${t}\\.${t}\\.${t}\\.${t}(${c})?$`,"i")};function d(p,m){if(p.indexOf("::")!==p.lastIndexOf("::"))return null;let A=0,w=-1,I=(p.match(f.zoneIndex)||[])[0],k,B;for(I&&(I=I.substring(1),p=p.replace(/%.+$/,""));(w=p.indexOf(":",w+1))>=0;)A++;if(p.substr(0,2)==="::"&&A--,p.substr(-2,2)==="::"&&A--,A>m)return null;for(B=m-A,k=":";B--;)k+="0:";return p=p.replace("::",k),p[0]===":"&&(p=p.slice(1)),p[p.length-1]===":"&&(p=p.slice(0,-1)),m=function(){const Z=p.split(":"),se=[];for(let D=0;D<Z.length;D++)se.push(parseInt(Z[D],16));return se}(),{parts:m,zoneId:I}}function b(p,m,A,w){if(p.length!==m.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let I=0,k;for(;w>0;){if(k=A-w,k<0&&(k=0),p[I]>>k!==m[I]>>k)return!1;w-=A,I+=1}return!0}function y(p){if(s.test(p))return parseInt(p,16);if(p[0]==="0"&&!isNaN(parseInt(p[1],10))){if(n.test(p))return parseInt(p,8);throw new Error(`ipaddr: cannot parse ${p} as octal`)}return parseInt(p,10)}function W(p,m){for(;p.length<m;)p=`0${p}`;return p}const O={};O.IPv4=function(){function p(m){if(m.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let A,w;for(A=0;A<m.length;A++)if(w=m[A],!(0<=w&&w<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=m}return p.prototype.SpecialRanges={unspecified:[[new p([0,0,0,0]),8]],broadcast:[[new p([255,255,255,255]),32]],multicast:[[new p([224,0,0,0]),4]],linkLocal:[[new p([169,254,0,0]),16]],loopback:[[new p([127,0,0,0]),8]],carrierGradeNat:[[new p([100,64,0,0]),10]],private:[[new p([10,0,0,0]),8],[new p([172,16,0,0]),12],[new p([192,168,0,0]),16]],reserved:[[new p([192,0,0,0]),24],[new p([192,0,2,0]),24],[new p([192,88,99,0]),24],[new p([198,18,0,0]),15],[new p([198,51,100,0]),24],[new p([203,0,113,0]),24],[new p([240,0,0,0]),4]]},p.prototype.kind=function(){return"ipv4"},p.prototype.match=function(m,A){let w;if(A===void 0&&(w=m,m=w[0],A=w[1]),m.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return b(this.octets,m.octets,8,A)},p.prototype.prefixLengthFromSubnetMask=function(){let m=0,A=!1;const w={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let I,k,B;for(I=3;I>=0;I-=1)if(k=this.octets[I],k in w){if(B=w[k],A&&B!==0)return null;B!==8&&(A=!0),m+=B}else return null;return 32-m},p.prototype.range=function(){return O.subnetMatch(this,this.SpecialRanges)},p.prototype.toByteArray=function(){return this.octets.slice(0)},p.prototype.toIPv4MappedAddress=function(){return O.IPv6.parse(`::ffff:${this.toString()}`)},p.prototype.toNormalizedString=function(){return this.toString()},p.prototype.toString=function(){return this.octets.join(".")},p}(),O.IPv4.broadcastAddressFromCIDR=function(p){try{const m=this.parseCIDR(p),A=m[0].toByteArray(),w=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),I=[];let k=0;for(;k<4;)I.push(parseInt(A[k],10)|parseInt(w[k],10)^255),k++;return new this(I)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},O.IPv4.isIPv4=function(p){return this.parser(p)!==null},O.IPv4.isValid=function(p){try{return new this(this.parser(p)),!0}catch{return!1}},O.IPv4.isValidFourPartDecimal=function(p){return!!(O.IPv4.isValid(p)&&p.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},O.IPv4.networkAddressFromCIDR=function(p){let m,A,w,I,k;try{for(m=this.parseCIDR(p),w=m[0].toByteArray(),k=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),I=[],A=0;A<4;)I.push(parseInt(w[A],10)&parseInt(k[A],10)),A++;return new this(I)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},O.IPv4.parse=function(p){const m=this.parser(p);if(m===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(m)},O.IPv4.parseCIDR=function(p){let m;if(m=p.match(/^(.+)\/(\d+)$/)){const A=parseInt(m[2]);if(A>=0&&A<=32){const w=[this.parse(m[1]),A];return Object.defineProperty(w,"toString",{value:function(){return this.join("/")}}),w}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},O.IPv4.parser=function(p){let m,A,w;if(m=p.match(i.fourOctet))return function(){const I=m.slice(1,6),k=[];for(let B=0;B<I.length;B++)A=I[B],k.push(y(A));return k}();if(m=p.match(i.longValue)){if(w=y(m[1]),w>4294967295||w<0)throw new Error("ipaddr: address outside defined range");return function(){const I=[];let k;for(k=0;k<=24;k+=8)I.push(w>>k&255);return I}().reverse()}else return(m=p.match(i.twoOctet))?function(){const I=m.slice(1,4),k=[];if(w=y(I[1]),w>16777215||w<0)throw new Error("ipaddr: address outside defined range");return k.push(y(I[0])),k.push(w>>16&255),k.push(w>>8&255),k.push(w&255),k}():(m=p.match(i.threeOctet))?function(){const I=m.slice(1,5),k=[];if(w=y(I[2]),w>65535||w<0)throw new Error("ipaddr: address outside defined range");return k.push(y(I[0])),k.push(y(I[1])),k.push(w>>8&255),k.push(w&255),k}():null},O.IPv4.subnetMaskFromPrefixLength=function(p){if(p=parseInt(p),p<0||p>32)throw new Error("ipaddr: invalid IPv4 prefix length");const m=[0,0,0,0];let A=0;const w=Math.floor(p/8);for(;A<w;)m[A]=255,A++;return w<4&&(m[w]=Math.pow(2,p%8)-1<<8-p%8),new this(m)},O.IPv6=function(){function p(m,A){let w,I;if(m.length===16)for(this.parts=[],w=0;w<=14;w+=2)this.parts.push(m[w]<<8|m[w+1]);else if(m.length===8)this.parts=m;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(w=0;w<this.parts.length;w++)if(I=this.parts[w],!(0<=I&&I<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");A&&(this.zoneId=A)}return p.prototype.SpecialRanges={unspecified:[new p([0,0,0,0,0,0,0,0]),128],linkLocal:[new p([65152,0,0,0,0,0,0,0]),10],multicast:[new p([65280,0,0,0,0,0,0,0]),8],loopback:[new p([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new p([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new p([0,0,0,0,0,65535,0,0]),96],rfc6145:[new p([0,0,0,0,65535,0,0,0]),96],rfc6052:[new p([100,65435,0,0,0,0,0,0]),96],"6to4":[new p([8194,0,0,0,0,0,0,0]),16],teredo:[new p([8193,0,0,0,0,0,0,0]),32],reserved:[[new p([8193,3512,0,0,0,0,0,0]),32]],benchmarking:[new p([8193,2,0,0,0,0,0,0]),48],amt:[new p([8193,3,0,0,0,0,0,0]),32],as112v6:[new p([8193,4,274,0,0,0,0,0]),48],deprecated:[new p([8193,16,0,0,0,0,0,0]),28],orchid2:[new p([8193,32,0,0,0,0,0,0]),28]},p.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},p.prototype.kind=function(){return"ipv6"},p.prototype.match=function(m,A){let w;if(A===void 0&&(w=m,m=w[0],A=w[1]),m.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return b(this.parts,m.parts,16,A)},p.prototype.prefixLengthFromSubnetMask=function(){let m=0,A=!1;const w={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let I,k;for(let B=7;B>=0;B-=1)if(I=this.parts[B],I in w){if(k=w[I],A&&k!==0)return null;k!==16&&(A=!0),m+=k}else return null;return 128-m},p.prototype.range=function(){return O.subnetMatch(this,this.SpecialRanges)},p.prototype.toByteArray=function(){let m;const A=[],w=this.parts;for(let I=0;I<w.length;I++)m=w[I],A.push(m>>8),A.push(m&255);return A},p.prototype.toFixedLengthString=function(){const m=(function(){const w=[];for(let I=0;I<this.parts.length;I++)w.push(W(this.parts[I].toString(16),4));return w}).call(this).join(":");let A="";return this.zoneId&&(A=`%${this.zoneId}`),m+A},p.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const m=this.parts.slice(-2),A=m[0],w=m[1];return new O.IPv4([A>>8,A&255,w>>8,w&255])},p.prototype.toNormalizedString=function(){const m=(function(){const w=[];for(let I=0;I<this.parts.length;I++)w.push(this.parts[I].toString(16));return w}).call(this).join(":");let A="";return this.zoneId&&(A=`%${this.zoneId}`),m+A},p.prototype.toRFC5952String=function(){const m=/((^|:)(0(:|$)){2,})/g,A=this.toNormalizedString();let w=0,I=-1,k;for(;k=m.exec(A);)k[0].length>I&&(w=k.index,I=k[0].length);return I<0?A:`${A.substring(0,w)}::${A.substring(w+I)}`},p.prototype.toString=function(){return this.toRFC5952String()},p}(),O.IPv6.broadcastAddressFromCIDR=function(p){try{const m=this.parseCIDR(p),A=m[0].toByteArray(),w=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),I=[];let k=0;for(;k<16;)I.push(parseInt(A[k],10)|parseInt(w[k],10)^255),k++;return new this(I)}catch(m){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${m})`)}},O.IPv6.isIPv6=function(p){return this.parser(p)!==null},O.IPv6.isValid=function(p){if(typeof p=="string"&&p.indexOf(":")===-1)return!1;try{const m=this.parser(p);return new this(m.parts,m.zoneId),!0}catch{return!1}},O.IPv6.networkAddressFromCIDR=function(p){let m,A,w,I,k;try{for(m=this.parseCIDR(p),w=m[0].toByteArray(),k=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),I=[],A=0;A<16;)I.push(parseInt(w[A],10)&parseInt(k[A],10)),A++;return new this(I)}catch(B){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${B})`)}},O.IPv6.parse=function(p){const m=this.parser(p);if(m.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(m.parts,m.zoneId)},O.IPv6.parseCIDR=function(p){let m,A,w;if((A=p.match(/^(.+)\/(\d+)$/))&&(m=parseInt(A[2]),m>=0&&m<=128))return w=[this.parse(A[1]),m],Object.defineProperty(w,"toString",{value:function(){return this.join("/")}}),w;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},O.IPv6.parser=function(p){let m,A,w,I,k,B;if(w=p.match(f.deprecatedTransitional))return this.parser(`::ffff:${w[1]}`);if(f.native.test(p))return d(p,8);if((w=p.match(f.transitional))&&(B=w[6]||"",m=d(w[1].slice(0,-1)+B,6),m.parts)){for(k=[parseInt(w[2]),parseInt(w[3]),parseInt(w[4]),parseInt(w[5])],A=0;A<k.length;A++)if(I=k[A],!(0<=I&&I<=255))return null;return m.parts.push(k[0]<<8|k[1]),m.parts.push(k[2]<<8|k[3]),{parts:m.parts,zoneId:m.zoneId}}return null},O.IPv6.subnetMaskFromPrefixLength=function(p){if(p=parseInt(p),p<0||p>128)throw new Error("ipaddr: invalid IPv6 prefix length");const m=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let A=0;const w=Math.floor(p/8);for(;A<w;)m[A]=255,A++;return w<16&&(m[w]=Math.pow(2,p%8)-1<<8-p%8),new this(m)},O.fromByteArray=function(p){const m=p.length;if(m===4)return new O.IPv4(p);if(m===16)return new O.IPv6(p);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},O.isValid=function(p){return O.IPv6.isValid(p)||O.IPv4.isValid(p)},O.parse=function(p){if(O.IPv6.isValid(p))return O.IPv6.parse(p);if(O.IPv4.isValid(p))return O.IPv4.parse(p);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},O.parseCIDR=function(p){try{return O.IPv6.parseCIDR(p)}catch{try{return O.IPv4.parseCIDR(p)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},O.process=function(p){const m=this.parse(p);return m.kind()==="ipv6"&&m.isIPv4MappedAddress()?m.toIPv4Address():m},O.subnetMatch=function(p,m,A){let w,I,k,B;A==null&&(A="unicast");for(I in m)if(Object.prototype.hasOwnProperty.call(m,I)){for(k=m[I],k[0]&&!(k[0]instanceof Array)&&(k=[k]),w=0;w<k.length;w++)if(B=k[w],p.kind()===B[0].kind()&&p.match.apply(p,B))return I}return A},r.exports?r.exports=O:e.ipaddr=O})(Pn)})(cc);var lc=cc.exports;class uc{static decodeIP(e){if(e.length===64&&parseInt(e,16)===0)return"::/0";if(e.length!==16)return e;const t=parseInt(e.slice(8),16).toString(2).split("").reduce((n,s)=>n+ +s,0);let i=e.slice(0,8).replace(/(.{2})/g,n=>`${parseInt(n,16)}.`);return i=i.slice(0,-1),`${i}/${t}`}static toString(e){if(e.byteLength===4||e.byteLength===16){const t=new Uint8Array(e);return lc.fromByteArray(Array.from(t)).toString()}return this.decodeIP(M.ToHex(e))}static fromString(e){const t=lc.parse(e);return new Uint8Array(t.toByteArray()).buffer}}var eo,to,ro;let Se=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};a([l({type:h.TeletexString})],Se.prototype,"teletexString",void 0),a([l({type:h.PrintableString})],Se.prototype,"printableString",void 0),a([l({type:h.UniversalString})],Se.prototype,"universalString",void 0),a([l({type:h.Utf8String})],Se.prototype,"utf8String",void 0),a([l({type:h.BmpString})],Se.prototype,"bmpString",void 0),Se=a([E({type:x.Choice})],Se);let Yt=class extends Se{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?M.ToHex(this.anyValue):super.toString())}};a([l({type:h.IA5String})],Yt.prototype,"ia5String",void 0),a([l({type:h.Any})],Yt.prototype,"anyValue",void 0),Yt=a([E({type:x.Choice})],Yt);class Ir{constructor(e={}){this.type="",this.value=new Yt,Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Ir.prototype,"type",void 0),a([l({type:Yt})],Ir.prototype,"value",void 0);let Zt=eo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,eo.prototype)}};Zt=eo=a([E({type:x.Set,itemType:Ir})],Zt);let io=to=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,to.prototype)}};io=to=a([E({type:x.Sequence,itemType:Zt})],io);let ge=ro=class extends io{constructor(e){super(e),Object.setPrototypeOf(this,ro.prototype)}};ge=ro=a([E({type:x.Sequence})],ge);const Sf={fromASN:r=>uc.toString(Ci.fromASN(r)),toASN:r=>Ci.toASN(uc.fromString(r))};class Nr{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Nr.prototype,"typeId",void 0),a([l({type:h.Any,context:0})],Nr.prototype,"value",void 0);class no{constructor(e={}){this.partyName=new Se,Object.assign(this,e)}}a([l({type:Se,optional:!0,context:0,implicit:!0})],no.prototype,"nameAssigner",void 0),a([l({type:Se,context:1,implicit:!0})],no.prototype,"partyName",void 0);let Q=class{constructor(e={}){Object.assign(this,e)}};a([l({type:Nr,context:0,implicit:!0})],Q.prototype,"otherName",void 0),a([l({type:h.IA5String,context:1,implicit:!0})],Q.prototype,"rfc822Name",void 0),a([l({type:h.IA5String,context:2,implicit:!0})],Q.prototype,"dNSName",void 0),a([l({type:h.Any,context:3,implicit:!0})],Q.prototype,"x400Address",void 0),a([l({type:ge,context:4,implicit:!1})],Q.prototype,"directoryName",void 0),a([l({type:no,context:5})],Q.prototype,"ediPartyName",void 0),a([l({type:h.IA5String,context:6,implicit:!0})],Q.prototype,"uniformResourceIdentifier",void 0),a([l({type:h.OctetString,context:7,implicit:!0,converter:Sf})],Q.prototype,"iPAddress",void 0),a([l({type:h.ObjectIdentifier,context:8,implicit:!0})],Q.prototype,"registeredID",void 0),Q=a([E({type:x.Choice})],Q);const Qt="1.3.6.1.5.5.7.3",jt="2.5.29";var oo;class Bi{constructor(e={}){this.accessMethod="",this.accessLocation=new Q,Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Bi.prototype,"accessMethod",void 0),a([l({type:Q})],Bi.prototype,"accessLocation",void 0);let fc=oo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,oo.prototype)}};fc=oo=a([E({type:x.Sequence,itemType:Bi})],fc);const so=`${jt}.35`;class ao extends ie{}class Pt{constructor(e={}){e&&Object.assign(this,e)}}a([l({type:ao,context:0,optional:!0,implicit:!0})],Pt.prototype,"keyIdentifier",void 0),a([l({type:Q,context:1,optional:!0,implicit:!0,repeated:"sequence"})],Pt.prototype,"authorityCertIssuer",void 0),a([l({type:h.Integer,context:2,optional:!0,implicit:!0,converter:ue})],Pt.prototype,"authorityCertSerialNumber",void 0);const dc=`${jt}.19`;class Ei{constructor(e={}){this.cA=!1,Object.assign(this,e)}}a([l({type:h.Boolean,defaultValue:!1})],Ei.prototype,"cA",void 0),a([l({type:h.Integer,optional:!0})],Ei.prototype,"pathLenConstraint",void 0);var co;let Ie=co=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,co.prototype)}};Ie=co=a([E({type:x.Sequence,itemType:Q})],Ie);var lo;let pc=lo=class extends Ie{constructor(e){super(e),Object.setPrototypeOf(this,lo.prototype)}};pc=lo=a([E({type:x.Sequence})],pc);var uo;const hc=`${jt}.32`;let pt=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};a([l({type:h.IA5String})],pt.prototype,"ia5String",void 0),a([l({type:h.VisibleString})],pt.prototype,"visibleString",void 0),a([l({type:h.BmpString})],pt.prototype,"bmpString",void 0),a([l({type:h.Utf8String})],pt.prototype,"utf8String",void 0),pt=a([E({type:x.Choice})],pt);class fo{constructor(e={}){this.organization=new pt,this.noticeNumbers=[],Object.assign(this,e)}}a([l({type:pt})],fo.prototype,"organization",void 0),a([l({type:h.Integer,repeated:"sequence"})],fo.prototype,"noticeNumbers",void 0);class po{constructor(e={}){Object.assign(this,e)}}a([l({type:fo,optional:!0})],po.prototype,"noticeRef",void 0),a([l({type:pt,optional:!0})],po.prototype,"explicitText",void 0);let Ii=class{constructor(e={}){Object.assign(this,e)}};a([l({type:h.IA5String})],Ii.prototype,"cPSuri",void 0),a([l({type:po})],Ii.prototype,"userNotice",void 0),Ii=a([E({type:x.Choice})],Ii);class ho{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],ho.prototype,"policyQualifierId",void 0),a([l({type:h.Any})],ho.prototype,"qualifier",void 0);class Ni{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Ni.prototype,"policyIdentifier",void 0),a([l({type:ho,repeated:"sequence",optional:!0})],Ni.prototype,"policyQualifiers",void 0);let Oi=uo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,uo.prototype)}};Oi=uo=a([E({type:x.Sequence,itemType:Ni})],Oi);let Ti=class{constructor(e=0){this.value=e}};a([l({type:h.Integer})],Ti.prototype,"value",void 0),Ti=a([E({type:x.Choice})],Ti);let yc=class extends Ti{};yc=a([E({type:x.Choice})],yc);var yo,We;(function(r){r[r.unused=1]="unused",r[r.keyCompromise=2]="keyCompromise",r[r.cACompromise=4]="cACompromise",r[r.affiliationChanged=8]="affiliationChanged",r[r.superseded=16]="superseded",r[r.cessationOfOperation=32]="cessationOfOperation",r[r.certificateHold=64]="certificateHold",r[r.privilegeWithdrawn=128]="privilegeWithdrawn",r[r.aACompromise=256]="aACompromise"})(We||(We={}));class gc extends xi{toJSON(){const e=[],t=this.toNumber();return t&We.aACompromise&&e.push("aACompromise"),t&We.affiliationChanged&&e.push("affiliationChanged"),t&We.cACompromise&&e.push("cACompromise"),t&We.certificateHold&&e.push("certificateHold"),t&We.cessationOfOperation&&e.push("cessationOfOperation"),t&We.keyCompromise&&e.push("keyCompromise"),t&We.privilegeWithdrawn&&e.push("privilegeWithdrawn"),t&We.superseded&&e.push("superseded"),t&We.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let Xt=class{constructor(e={}){Object.assign(this,e)}};a([l({type:Q,context:0,repeated:"sequence",implicit:!0})],Xt.prototype,"fullName",void 0),a([l({type:Zt,context:1,implicit:!0})],Xt.prototype,"nameRelativeToCRLIssuer",void 0),Xt=a([E({type:x.Choice})],Xt);class Or{constructor(e={}){Object.assign(this,e)}}a([l({type:Xt,context:0,optional:!0})],Or.prototype,"distributionPoint",void 0),a([l({type:gc,context:1,optional:!0,implicit:!0})],Or.prototype,"reasons",void 0),a([l({type:Q,context:2,optional:!0,repeated:"sequence",implicit:!0})],Or.prototype,"cRLIssuer",void 0);let go=yo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,yo.prototype)}};go=yo=a([E({type:x.Sequence,itemType:Or})],go);var mo;let mc=mo=class extends go{constructor(e){super(e),Object.setPrototypeOf(this,mo.prototype)}};mc=mo=a([E({type:x.Sequence,itemType:Or})],mc);class Ce{constructor(e={}){this.onlyContainsUserCerts=Ce.ONLY,this.onlyContainsCACerts=Ce.ONLY,this.indirectCRL=Ce.ONLY,this.onlyContainsAttributeCerts=Ce.ONLY,Object.assign(this,e)}}Ce.ONLY=!1,a([l({type:Xt,context:0,optional:!0})],Ce.prototype,"distributionPoint",void 0),a([l({type:h.Boolean,context:1,defaultValue:Ce.ONLY,implicit:!0})],Ce.prototype,"onlyContainsUserCerts",void 0),a([l({type:h.Boolean,context:2,defaultValue:Ce.ONLY,implicit:!0})],Ce.prototype,"onlyContainsCACerts",void 0),a([l({type:gc,context:3,optional:!0,implicit:!0})],Ce.prototype,"onlySomeReasons",void 0),a([l({type:h.Boolean,context:4,defaultValue:Ce.ONLY,implicit:!0})],Ce.prototype,"indirectCRL",void 0),a([l({type:h.Boolean,context:5,defaultValue:Ce.ONLY,implicit:!0})],Ce.prototype,"onlyContainsAttributeCerts",void 0);var Tr;(function(r){r[r.unspecified=0]="unspecified",r[r.keyCompromise=1]="keyCompromise",r[r.cACompromise=2]="cACompromise",r[r.affiliationChanged=3]="affiliationChanged",r[r.superseded=4]="superseded",r[r.cessationOfOperation=5]="cessationOfOperation",r[r.certificateHold=6]="certificateHold",r[r.removeFromCRL=8]="removeFromCRL",r[r.privilegeWithdrawn=9]="privilegeWithdrawn",r[r.aACompromise=10]="aACompromise"})(Tr||(Tr={}));let bo=class{constructor(e=Tr.unspecified){this.reason=Tr.unspecified,this.reason=e}toJSON(){return Tr[this.reason]}toString(){return this.toJSON()}};a([l({type:h.Enumerated})],bo.prototype,"reason",void 0),bo=a([E({type:x.Choice})],bo);var vo;const bc=`${jt}.37`;let Vi=vo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,vo.prototype)}};Vi=vo=a([E({type:x.Sequence,itemType:h.ObjectIdentifier})],Vi);const kf=`${Qt}.1`,xf=`${Qt}.2`,Cf=`${Qt}.3`,Bf=`${Qt}.4`,Ef=`${Qt}.8`,If=`${Qt}.9`;let wo=class{constructor(e=new ArrayBuffer(0)){this.value=e}};a([l({type:h.Integer,converter:ue})],wo.prototype,"value",void 0),wo=a([E({type:x.Choice})],wo);let Ao=class{constructor(e){this.value=new Date,e&&(this.value=e)}};a([l({type:h.GeneralizedTime})],Ao.prototype,"value",void 0),Ao=a([E({type:x.Choice})],Ao);var So;let vc=So=class extends Ie{constructor(e){super(e),Object.setPrototypeOf(this,So.prototype)}};vc=So=a([E({type:x.Sequence})],vc);const wc=`${jt}.15`;var ze;(function(r){r[r.digitalSignature=1]="digitalSignature",r[r.nonRepudiation=2]="nonRepudiation",r[r.keyEncipherment=4]="keyEncipherment",r[r.dataEncipherment=8]="dataEncipherment",r[r.keyAgreement=16]="keyAgreement",r[r.keyCertSign=32]="keyCertSign",r[r.cRLSign=64]="cRLSign",r[r.encipherOnly=128]="encipherOnly",r[r.decipherOnly=256]="decipherOnly"})(ze||(ze={}));class ko extends xi{toJSON(){const e=this.toNumber(),t=[];return e&ze.cRLSign&&t.push("crlSign"),e&ze.dataEncipherment&&t.push("dataEncipherment"),e&ze.decipherOnly&&t.push("decipherOnly"),e&ze.digitalSignature&&t.push("digitalSignature"),e&ze.encipherOnly&&t.push("encipherOnly"),e&ze.keyAgreement&&t.push("keyAgreement"),e&ze.keyCertSign&&t.push("keyCertSign"),e&ze.keyEncipherment&&t.push("keyEncipherment"),e&ze.nonRepudiation&&t.push("nonRepudiation"),t}toString(){return`[${this.toJSON().join(", ")}]`}}var xo;class _i{constructor(e={}){this.base=new Q,this.minimum=0,Object.assign(this,e)}}a([l({type:Q})],_i.prototype,"base",void 0),a([l({type:h.Integer,context:0,defaultValue:0,implicit:!0})],_i.prototype,"minimum",void 0),a([l({type:h.Integer,context:1,optional:!0,implicit:!0})],_i.prototype,"maximum",void 0);let ji=xo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,xo.prototype)}};ji=xo=a([E({type:x.Sequence,itemType:_i})],ji);class Ac{constructor(e={}){Object.assign(this,e)}}a([l({type:ji,context:0,optional:!0,implicit:!0})],Ac.prototype,"permittedSubtrees",void 0),a([l({type:ji,context:1,optional:!0,implicit:!0})],Ac.prototype,"excludedSubtrees",void 0);class Sc{constructor(e={}){Object.assign(this,e)}}a([l({type:h.Integer,context:0,implicit:!0,optional:!0,converter:ue})],Sc.prototype,"requireExplicitPolicy",void 0),a([l({type:h.Integer,context:1,implicit:!0,optional:!0,converter:ue})],Sc.prototype,"inhibitPolicyMapping",void 0);var Co;class Bo{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Bo.prototype,"issuerDomainPolicy",void 0),a([l({type:h.ObjectIdentifier})],Bo.prototype,"subjectDomainPolicy",void 0);let kc=Co=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Co.prototype)}};kc=Co=a([E({type:x.Sequence,itemType:Bo})],kc);var Eo;const xc=`${jt}.17`;let Io=Eo=class extends Ie{constructor(e){super(e),Object.setPrototypeOf(this,Eo.prototype)}};Io=Eo=a([E({type:x.Sequence})],Io);let ht=class{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};a([l({type:h.ObjectIdentifier})],ht.prototype,"type",void 0),a([l({type:h.Any,repeated:"set"})],ht.prototype,"values",void 0);var No;let Cc=No=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,No.prototype)}};Cc=No=a([E({type:x.Sequence,itemType:ht})],Cc);const Bc=`${jt}.14`;class St extends ao{}class Ec{constructor(e={}){Object.assign(this,e)}}a([l({type:h.GeneralizedTime,context:0,implicit:!0,optional:!0})],Ec.prototype,"notBefore",void 0),a([l({type:h.GeneralizedTime,context:1,implicit:!0,optional:!0})],Ec.prototype,"notAfter",void 0);var Vr;(function(r){r[r.keyUpdateAllowed=1]="keyUpdateAllowed",r[r.newExtensions=2]="newExtensions",r[r.pKIXCertificate=4]="pKIXCertificate"})(Vr||(Vr={}));class Ic extends xi{toJSON(){const e=[],t=this.toNumber();return t&Vr.pKIXCertificate&&e.push("pKIXCertificate"),t&Vr.newExtensions&&e.push("newExtensions"),t&Vr.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class Nc{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new Ic,Object.assign(this,e)}}a([l({type:h.GeneralString})],Nc.prototype,"entrustVers",void 0),a([l({type:Ic})],Nc.prototype,"entrustInfoFlags",void 0);var Oo;let Oc=Oo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Oo.prototype)}};Oc=Oo=a([E({type:x.Sequence,itemType:Bi})],Oc);class U{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof U&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&ia(e.parameters,this.parameters)||e.parameters===this.parameters)}}a([l({type:h.ObjectIdentifier})],U.prototype,"algorithm",void 0),a([l({type:h.Any,optional:!0})],U.prototype,"parameters",void 0);class yt{constructor(e={}){this.algorithm=new U,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:U})],yt.prototype,"algorithm",void 0),a([l({type:h.BitString})],yt.prototype,"subjectPublicKey",void 0);let ke=class{constructor(e){if(e)if(typeof e=="string"||typeof e=="number"||e instanceof Date){const t=new Date(e);t.getUTCFullYear()>2049?this.generalTime=t:this.utcTime=t}else Object.assign(this,e)}getTime(){const e=this.utcTime||this.generalTime;if(!e)throw new Error("Cannot get time from CHOICE object");return e}};a([l({type:h.UTCTime})],ke.prototype,"utcTime",void 0),a([l({type:h.GeneralizedTime})],ke.prototype,"generalTime",void 0),ke=a([E({type:x.Choice})],ke);class Pi{constructor(e){this.notBefore=new ke(new Date),this.notAfter=new ke(new Date),e&&(this.notBefore=new ke(e.notBefore),this.notAfter=new ke(e.notAfter))}}a([l({type:ke})],Pi.prototype,"notBefore",void 0),a([l({type:ke})],Pi.prototype,"notAfter",void 0);var To;let Je=class Nu{constructor(e={}){this.extnID="",this.critical=Nu.CRITICAL,this.extnValue=new ie,Object.assign(this,e)}};Je.CRITICAL=!1,a([l({type:h.ObjectIdentifier})],Je.prototype,"extnID",void 0),a([l({type:h.Boolean,defaultValue:Je.CRITICAL})],Je.prototype,"critical",void 0),a([l({type:ie})],Je.prototype,"extnValue",void 0);let Dt=To=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,To.prototype)}};Dt=To=a([E({type:x.Sequence,itemType:Je})],Dt);var er;(function(r){r[r.v1=0]="v1",r[r.v2=1]="v2",r[r.v3=2]="v3"})(er||(er={}));class Fe{constructor(e={}){this.version=er.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new U,this.issuer=new ge,this.validity=new Pi,this.subject=new ge,this.subjectPublicKeyInfo=new yt,Object.assign(this,e)}}a([l({type:h.Integer,context:0,defaultValue:er.v1})],Fe.prototype,"version",void 0),a([l({type:h.Integer,converter:ue})],Fe.prototype,"serialNumber",void 0),a([l({type:U})],Fe.prototype,"signature",void 0),a([l({type:ge})],Fe.prototype,"issuer",void 0),a([l({type:Pi})],Fe.prototype,"validity",void 0),a([l({type:ge})],Fe.prototype,"subject",void 0),a([l({type:yt})],Fe.prototype,"subjectPublicKeyInfo",void 0),a([l({type:h.BitString,context:1,implicit:!0,optional:!0})],Fe.prototype,"issuerUniqueID",void 0),a([l({type:h.BitString,context:2,implicit:!0,optional:!0})],Fe.prototype,"subjectUniqueID",void 0),a([l({type:Dt,context:3,optional:!0})],Fe.prototype,"extensions",void 0);class tr{constructor(e={}){this.tbsCertificate=new Fe,this.signatureAlgorithm=new U,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:Fe})],tr.prototype,"tbsCertificate",void 0),a([l({type:U})],tr.prototype,"signatureAlgorithm",void 0),a([l({type:h.BitString})],tr.prototype,"signatureValue",void 0);class Di{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new ke,Object.assign(this,e)}}a([l({type:h.Integer,converter:ue})],Di.prototype,"userCertificate",void 0),a([l({type:ke})],Di.prototype,"revocationDate",void 0),a([l({type:Je,optional:!0,repeated:"sequence"})],Di.prototype,"crlEntryExtensions",void 0);class gt{constructor(e={}){this.signature=new U,this.issuer=new ge,this.thisUpdate=new ke,Object.assign(this,e)}}a([l({type:h.Integer,optional:!0})],gt.prototype,"version",void 0),a([l({type:U})],gt.prototype,"signature",void 0),a([l({type:ge})],gt.prototype,"issuer",void 0),a([l({type:ke})],gt.prototype,"thisUpdate",void 0),a([l({type:ke,optional:!0})],gt.prototype,"nextUpdate",void 0),a([l({type:Di,repeated:"sequence",optional:!0})],gt.prototype,"revokedCertificates",void 0),a([l({type:Je,optional:!0,context:0,repeated:"sequence"})],gt.prototype,"crlExtensions",void 0);let Vo=class{constructor(e={}){this.tbsCertList=new gt,this.signatureAlgorithm=new U,this.signature=new ArrayBuffer(0),Object.assign(this,e)}};a([l({type:gt})],Vo.prototype,"tbsCertList",void 0),a([l({type:U})],Vo.prototype,"signatureAlgorithm",void 0),a([l({type:h.BitString})],Vo.prototype,"signature",void 0);class rr{constructor(e={}){this.issuer=new ge,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:ge})],rr.prototype,"issuer",void 0),a([l({type:h.Integer,converter:ue})],rr.prototype,"serialNumber",void 0);let ir=class{constructor(e={}){Object.assign(this,e)}};a([l({type:St,context:0,implicit:!0})],ir.prototype,"subjectKeyIdentifier",void 0),a([l({type:rr})],ir.prototype,"issuerAndSerialNumber",void 0),ir=a([E({type:x.Choice})],ir);var mt;(function(r){r[r.v0=0]="v0",r[r.v1=1]="v1",r[r.v2=2]="v2",r[r.v3=3]="v3",r[r.v4=4]="v4",r[r.v5=5]="v5"})(mt||(mt={}));let _r=class extends U{};_r=a([E({type:x.Sequence})],_r);let Ri=class extends U{};Ri=a([E({type:x.Sequence})],Ri);let rt=class extends U{};rt=a([E({type:x.Sequence})],rt);let Mi=class extends U{};Mi=a([E({type:x.Sequence})],Mi);let Tc=class extends U{};Tc=a([E({type:x.Sequence})],Tc);let _o=class extends U{};_o=a([E({type:x.Sequence})],_o);let nr=class{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};a([l({type:h.ObjectIdentifier})],nr.prototype,"attrType",void 0),a([l({type:h.Any,repeated:"set"})],nr.prototype,"attrValues",void 0);var jo;class it{constructor(e={}){this.version=mt.v0,this.sid=new ir,this.digestAlgorithm=new _r,this.signatureAlgorithm=new Ri,this.signature=new ie,Object.assign(this,e)}}a([l({type:h.Integer})],it.prototype,"version",void 0),a([l({type:ir})],it.prototype,"sid",void 0),a([l({type:_r})],it.prototype,"digestAlgorithm",void 0),a([l({type:nr,repeated:"set",context:0,implicit:!0,optional:!0})],it.prototype,"signedAttrs",void 0),a([l({type:Ri})],it.prototype,"signatureAlgorithm",void 0),a([l({type:ie})],it.prototype,"signature",void 0),a([l({type:nr,repeated:"set",context:1,implicit:!0,optional:!0})],it.prototype,"unsignedAttrs",void 0);let $i=jo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,jo.prototype)}};$i=jo=a([E({type:x.Set,itemType:it})],$i);let Vc=class extends ke{};Vc=a([E({type:x.Choice})],Vc);let _c=class extends it{};_c=a([E({type:x.Sequence})],_c);class Po{constructor(e={}){this.acIssuer=new Q,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}a([l({type:Q})],Po.prototype,"acIssuer",void 0),a([l({type:h.Integer})],Po.prototype,"acSerial",void 0),a([l({type:ht,repeated:"sequence"})],Po.prototype,"attrs",void 0);var Do;let Ui=Do=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Do.prototype)}};Ui=Do=a([E({type:x.Sequence,itemType:h.ObjectIdentifier})],Ui);class Hi{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}a([l({type:h.Integer,optional:!0})],Hi.prototype,"pathLenConstraint",void 0),a([l({type:Ui,implicit:!0,context:0,optional:!0})],Hi.prototype,"permittedAttrs",void 0),a([l({type:Ui,implicit:!0,context:1,optional:!0})],Hi.prototype,"excludedAttrs",void 0),a([l({type:h.Boolean,defaultValue:!0})],Hi.prototype,"permitUnSpecified",void 0);class Rt{constructor(e={}){this.issuer=new Ie,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:Ie})],Rt.prototype,"issuer",void 0),a([l({type:h.Integer,converter:ue})],Rt.prototype,"serial",void 0),a([l({type:h.BitString,optional:!0})],Rt.prototype,"issuerUID",void 0);var Ro;(function(r){r[r.publicKey=0]="publicKey",r[r.publicKeyCert=1]="publicKeyCert",r[r.otherObjectTypes=2]="otherObjectTypes"})(Ro||(Ro={}));class Mt{constructor(e={}){this.digestedObjectType=Ro.publicKey,this.digestAlgorithm=new U,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.Enumerated})],Mt.prototype,"digestedObjectType",void 0),a([l({type:h.ObjectIdentifier,optional:!0})],Mt.prototype,"otherObjectTypeID",void 0),a([l({type:U})],Mt.prototype,"digestAlgorithm",void 0),a([l({type:h.BitString})],Mt.prototype,"objectDigest",void 0);class Li{constructor(e={}){Object.assign(this,e)}}a([l({type:Ie,optional:!0})],Li.prototype,"issuerName",void 0),a([l({type:Rt,context:0,implicit:!0,optional:!0})],Li.prototype,"baseCertificateID",void 0),a([l({type:Mt,context:1,implicit:!0,optional:!0})],Li.prototype,"objectDigestInfo",void 0);let or=class{constructor(e={}){Object.assign(this,e)}};a([l({type:Q,repeated:"sequence"})],or.prototype,"v1Form",void 0),a([l({type:Li,context:0,implicit:!0})],or.prototype,"v2Form",void 0),or=a([E({type:x.Choice})],or);class Fi{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}a([l({type:h.GeneralizedTime})],Fi.prototype,"notBeforeTime",void 0),a([l({type:h.GeneralizedTime})],Fi.prototype,"notAfterTime",void 0);class jr{constructor(e={}){Object.assign(this,e)}}a([l({type:Rt,implicit:!0,context:0,optional:!0})],jr.prototype,"baseCertificateID",void 0),a([l({type:Ie,implicit:!0,context:1,optional:!0})],jr.prototype,"entityName",void 0),a([l({type:Mt,implicit:!0,context:2,optional:!0})],jr.prototype,"objectDigestInfo",void 0);var Mo;(function(r){r[r.v2=1]="v2"})(Mo||(Mo={}));class Ye{constructor(e={}){this.version=Mo.v2,this.holder=new jr,this.issuer=new or,this.signature=new U,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new Fi,this.attributes=[],Object.assign(this,e)}}a([l({type:h.Integer})],Ye.prototype,"version",void 0),a([l({type:jr})],Ye.prototype,"holder",void 0),a([l({type:or})],Ye.prototype,"issuer",void 0),a([l({type:U})],Ye.prototype,"signature",void 0),a([l({type:h.Integer,converter:ue})],Ye.prototype,"serialNumber",void 0),a([l({type:Fi})],Ye.prototype,"attrCertValidityPeriod",void 0),a([l({type:ht,repeated:"sequence"})],Ye.prototype,"attributes",void 0),a([l({type:h.BitString,optional:!0})],Ye.prototype,"issuerUniqueID",void 0),a([l({type:Dt,optional:!0})],Ye.prototype,"extensions",void 0);class Ki{constructor(e={}){this.acinfo=new Ye,this.signatureAlgorithm=new U,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:Ye})],Ki.prototype,"acinfo",void 0),a([l({type:U})],Ki.prototype,"signatureAlgorithm",void 0),a([l({type:h.BitString})],Ki.prototype,"signatureValue",void 0);var qi;(function(r){r[r.unmarked=1]="unmarked",r[r.unclassified=2]="unclassified",r[r.restricted=4]="restricted",r[r.confidential=8]="confidential",r[r.secret=16]="secret",r[r.topSecret=32]="topSecret"})(qi||(qi={}));class $o extends xi{}class Uo{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier,implicit:!0,context:0})],Uo.prototype,"type",void 0),a([l({type:h.Any,implicit:!0,context:1})],Uo.prototype,"value",void 0);class Ho{constructor(e={}){this.policyId="",this.classList=new $o(qi.unclassified),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Ho.prototype,"policyId",void 0),a([l({type:$o,defaultValue:new $o(qi.unclassified)})],Ho.prototype,"classList",void 0),a([l({type:Uo,repeated:"set"})],Ho.prototype,"securityCategories",void 0);class Gi{constructor(e={}){Object.assign(this,e)}}a([l({type:ie})],Gi.prototype,"cotets",void 0),a([l({type:h.ObjectIdentifier})],Gi.prototype,"oid",void 0),a([l({type:h.Utf8String})],Gi.prototype,"string",void 0);class jc{constructor(e={}){this.values=[],Object.assign(this,e)}}a([l({type:Ie,implicit:!0,context:0,optional:!0})],jc.prototype,"policyAuthority",void 0),a([l({type:Gi,repeated:"sequence"})],jc.prototype,"values",void 0);var Lo;class Wi{constructor(e={}){this.targetCertificate=new Rt,Object.assign(this,e)}}a([l({type:Rt})],Wi.prototype,"targetCertificate",void 0),a([l({type:Q,optional:!0})],Wi.prototype,"targetName",void 0),a([l({type:Mt,optional:!0})],Wi.prototype,"certDigestInfo",void 0);let sr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:Q,context:0,implicit:!0})],sr.prototype,"targetName",void 0),a([l({type:Q,context:1,implicit:!0})],sr.prototype,"targetGroup",void 0),a([l({type:Wi,context:2,implicit:!0})],sr.prototype,"targetCert",void 0),sr=a([E({type:x.Choice})],sr);let Fo=Lo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Lo.prototype)}};Fo=Lo=a([E({type:x.Sequence,itemType:sr})],Fo);var Ko;let Pc=Ko=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Ko.prototype)}};Pc=Ko=a([E({type:x.Sequence,itemType:Fo})],Pc);class Dc{constructor(e={}){Object.assign(this,e)}}a([l({type:Ie,implicit:!0,context:0,optional:!0})],Dc.prototype,"roleAuthority",void 0),a([l({type:Q,implicit:!0,context:1})],Dc.prototype,"roleName",void 0);class qo{constructor(e={}){this.service=new Q,this.ident=new Q,Object.assign(this,e)}}a([l({type:Q})],qo.prototype,"service",void 0),a([l({type:Q})],qo.prototype,"ident",void 0),a([l({type:ie,optional:!0})],qo.prototype,"authInfo",void 0);var Go;class Wo{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Wo.prototype,"otherCertFormat",void 0),a([l({type:h.Any})],Wo.prototype,"otherCert",void 0);let ar=class{constructor(e={}){Object.assign(this,e)}};a([l({type:tr})],ar.prototype,"certificate",void 0),a([l({type:Ki,context:2,implicit:!0})],ar.prototype,"v2AttrCert",void 0),a([l({type:Wo,context:3,implicit:!0})],ar.prototype,"other",void 0),ar=a([E({type:x.Choice})],ar);let zi=Go=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Go.prototype)}};zi=Go=a([E({type:x.Set,itemType:ar})],zi);class cr{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],cr.prototype,"contentType",void 0),a([l({type:h.Any,context:0})],cr.prototype,"content",void 0);let Pr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:ie})],Pr.prototype,"single",void 0),a([l({type:h.Any})],Pr.prototype,"any",void 0),Pr=a([E({type:x.Choice})],Pr);class Ji{constructor(e={}){this.eContentType="",Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Ji.prototype,"eContentType",void 0),a([l({type:Pr,context:0,optional:!0})],Ji.prototype,"eContent",void 0);let Dr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:ie,context:0,implicit:!0,optional:!0})],Dr.prototype,"value",void 0),a([l({type:ie,converter:nf,context:0,implicit:!0,optional:!0,repeated:"sequence"})],Dr.prototype,"constructedValue",void 0),Dr=a([E({type:x.Choice})],Dr);class Rr{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new Mi,Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Rr.prototype,"contentType",void 0),a([l({type:Mi})],Rr.prototype,"contentEncryptionAlgorithm",void 0),a([l({type:Dr,optional:!0})],Rr.prototype,"encryptedContent",void 0);class Yi{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Yi.prototype,"keyAttrId",void 0),a([l({type:h.Any,optional:!0})],Yi.prototype,"keyAttr",void 0);var zo;class Zi{constructor(e={}){this.subjectKeyIdentifier=new St,Object.assign(this,e)}}a([l({type:St})],Zi.prototype,"subjectKeyIdentifier",void 0),a([l({type:h.GeneralizedTime,optional:!0})],Zi.prototype,"date",void 0),a([l({type:Yi,optional:!0})],Zi.prototype,"other",void 0);let lr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:Zi,context:0,implicit:!0,optional:!0})],lr.prototype,"rKeyId",void 0),a([l({type:rr,optional:!0})],lr.prototype,"issuerAndSerialNumber",void 0),lr=a([E({type:x.Choice})],lr);class Jo{constructor(e={}){this.rid=new lr,this.encryptedKey=new ie,Object.assign(this,e)}}a([l({type:lr})],Jo.prototype,"rid",void 0),a([l({type:ie})],Jo.prototype,"encryptedKey",void 0);let Qi=zo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,zo.prototype)}};Qi=zo=a([E({type:x.Sequence,itemType:Jo})],Qi);class Yo{constructor(e={}){this.algorithm=new U,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:U})],Yo.prototype,"algorithm",void 0),a([l({type:h.BitString})],Yo.prototype,"publicKey",void 0);let $t=class{constructor(e={}){Object.assign(this,e)}};a([l({type:St,context:0,implicit:!0,optional:!0})],$t.prototype,"subjectKeyIdentifier",void 0),a([l({type:Yo,context:1,implicit:!0,optional:!0})],$t.prototype,"originatorKey",void 0),a([l({type:rr,optional:!0})],$t.prototype,"issuerAndSerialNumber",void 0),$t=a([E({type:x.Choice})],$t);class ur{constructor(e={}){this.version=mt.v3,this.originator=new $t,this.keyEncryptionAlgorithm=new rt,this.recipientEncryptedKeys=new Qi,Object.assign(this,e)}}a([l({type:h.Integer})],ur.prototype,"version",void 0),a([l({type:$t,context:0})],ur.prototype,"originator",void 0),a([l({type:ie,context:1,optional:!0})],ur.prototype,"ukm",void 0),a([l({type:rt})],ur.prototype,"keyEncryptionAlgorithm",void 0),a([l({type:Qi})],ur.prototype,"recipientEncryptedKeys",void 0);let fr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:St,context:0,implicit:!0})],fr.prototype,"subjectKeyIdentifier",void 0),a([l({type:rr})],fr.prototype,"issuerAndSerialNumber",void 0),fr=a([E({type:x.Choice})],fr);class Mr{constructor(e={}){this.version=mt.v0,this.rid=new fr,this.keyEncryptionAlgorithm=new rt,this.encryptedKey=new ie,Object.assign(this,e)}}a([l({type:h.Integer})],Mr.prototype,"version",void 0),a([l({type:fr})],Mr.prototype,"rid",void 0),a([l({type:rt})],Mr.prototype,"keyEncryptionAlgorithm",void 0),a([l({type:ie})],Mr.prototype,"encryptedKey",void 0);class $r{constructor(e={}){this.keyIdentifier=new ie,Object.assign(this,e)}}a([l({type:ie})],$r.prototype,"keyIdentifier",void 0),a([l({type:h.GeneralizedTime,optional:!0})],$r.prototype,"date",void 0),a([l({type:Yi,optional:!0})],$r.prototype,"other",void 0);class Ur{constructor(e={}){this.version=mt.v4,this.kekid=new $r,this.keyEncryptionAlgorithm=new rt,this.encryptedKey=new ie,Object.assign(this,e)}}a([l({type:h.Integer})],Ur.prototype,"version",void 0),a([l({type:$r})],Ur.prototype,"kekid",void 0),a([l({type:rt})],Ur.prototype,"keyEncryptionAlgorithm",void 0),a([l({type:ie})],Ur.prototype,"encryptedKey",void 0);class Hr{constructor(e={}){this.version=mt.v0,this.keyEncryptionAlgorithm=new rt,this.encryptedKey=new ie,Object.assign(this,e)}}a([l({type:h.Integer})],Hr.prototype,"version",void 0),a([l({type:_o,context:0,optional:!0})],Hr.prototype,"keyDerivationAlgorithm",void 0),a([l({type:rt})],Hr.prototype,"keyEncryptionAlgorithm",void 0),a([l({type:ie})],Hr.prototype,"encryptedKey",void 0);class Zo{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Zo.prototype,"oriType",void 0),a([l({type:h.Any})],Zo.prototype,"oriValue",void 0);let kt=class{constructor(e={}){Object.assign(this,e)}};a([l({type:Mr,optional:!0})],kt.prototype,"ktri",void 0),a([l({type:ur,context:1,implicit:!0,optional:!0})],kt.prototype,"kari",void 0),a([l({type:Ur,context:2,implicit:!0,optional:!0})],kt.prototype,"kekri",void 0),a([l({type:Hr,context:3,implicit:!0,optional:!0})],kt.prototype,"pwri",void 0),a([l({type:Zo,context:4,implicit:!0,optional:!0})],kt.prototype,"ori",void 0),kt=a([E({type:x.Choice})],kt);var Qo;let Xi=Qo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Qo.prototype)}};Xi=Qo=a([E({type:x.Set,itemType:kt})],Xi);var Xo;class en{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],en.prototype,"otherRevInfoFormat",void 0),a([l({type:h.Any})],en.prototype,"otherRevInfo",void 0);let Lr=class{constructor(e={}){this.other=new en,Object.assign(this,e)}};a([l({type:en,context:1,implicit:!0})],Lr.prototype,"other",void 0),Lr=a([E({type:x.Choice})],Lr);let es=Xo=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Xo.prototype)}};es=Xo=a([E({type:x.Set,itemType:Lr})],es);class ts{constructor(e={}){Object.assign(this,e)}}a([l({type:zi,context:0,implicit:!0,optional:!0})],ts.prototype,"certs",void 0),a([l({type:es,context:1,implicit:!0,optional:!0})],ts.prototype,"crls",void 0);var rs;let is=rs=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,rs.prototype)}};is=rs=a([E({type:x.Set,itemType:nr})],is);class Fr{constructor(e={}){this.version=mt.v0,this.recipientInfos=new Xi,this.encryptedContentInfo=new Rr,Object.assign(this,e)}}a([l({type:h.Integer})],Fr.prototype,"version",void 0),a([l({type:ts,context:0,implicit:!0,optional:!0})],Fr.prototype,"originatorInfo",void 0),a([l({type:Xi})],Fr.prototype,"recipientInfos",void 0),a([l({type:Rr})],Fr.prototype,"encryptedContentInfo",void 0),a([l({type:is,context:1,implicit:!0,optional:!0})],Fr.prototype,"unprotectedAttrs",void 0);const Nf="1.2.840.113549.1.7.2";var ns;let tn=ns=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,ns.prototype)}};tn=ns=a([E({type:x.Set,itemType:_r})],tn);class dr{constructor(e={}){this.version=mt.v0,this.digestAlgorithms=new tn,this.encapContentInfo=new Ji,this.signerInfos=new $i,Object.assign(this,e)}}a([l({type:h.Integer})],dr.prototype,"version",void 0),a([l({type:tn})],dr.prototype,"digestAlgorithms",void 0),a([l({type:Ji})],dr.prototype,"encapContentInfo",void 0),a([l({type:zi,context:0,implicit:!0,optional:!0})],dr.prototype,"certificates",void 0),a([l({type:Lr,context:1,implicit:!0,optional:!0})],dr.prototype,"crls",void 0),a([l({type:$i})],dr.prototype,"signerInfos",void 0);const Kr="1.2.840.10045.2.1",os="1.2.840.10045.4.1",Rc="1.2.840.10045.4.3.1",ss="1.2.840.10045.4.3.2",as="1.2.840.10045.4.3.3",cs="1.2.840.10045.4.3.4",Mc="1.2.840.10045.3.1.7",$c="1.3.132.0.34",Uc="1.3.132.0.35";function qr(r){return new U({algorithm:r})}const Of=qr(os);qr(Rc);const Tf=qr(ss),Vf=qr(as),_f=qr(cs);let pr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:h.ObjectIdentifier})],pr.prototype,"namedCurve",void 0),pr=a([E({type:x.Choice})],pr);class rn{constructor(e={}){this.version=1,this.privateKey=new ie,Object.assign(this,e)}}a([l({type:h.Integer})],rn.prototype,"version",void 0),a([l({type:ie})],rn.prototype,"privateKey",void 0),a([l({type:pr,context:0,optional:!0})],rn.prototype,"parameters",void 0),a([l({type:h.BitString,context:1,optional:!0})],rn.prototype,"publicKey",void 0);class nn{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.Integer,converter:ue})],nn.prototype,"r",void 0),a([l({type:h.Integer,converter:ue})],nn.prototype,"s",void 0);const Ve="1.2.840.113549.1.1",hr=`${Ve}.1`,jf=`${Ve}.7`,Pf=`${Ve}.9`,Df=`${Ve}.10`,Rf=`${Ve}.2`,Mf=`${Ve}.4`,on=`${Ve}.5`,$f=`${Ve}.14`,ls=`${Ve}.11`,sn=`${Ve}.12`,an=`${Ve}.13`,Hc=`${Ve}.15`,Lc=`${Ve}.16`,Fc="1.3.14.3.2.26",Kc="2.16.840.1.101.3.4.2.4",qc="2.16.840.1.101.3.4.2.1",Gc="2.16.840.1.101.3.4.2.2",Wc="2.16.840.1.101.3.4.2.3",Uf="2.16.840.1.101.3.4.2.5",Hf="2.16.840.1.101.3.4.2.6",Lf="1.2.840.113549.2.2",Ff="1.2.840.113549.2.5",us=`${Ve}.8`;function me(r){return new U({algorithm:r,parameters:null})}me(Lf),me(Ff);const Ut=me(Fc);me(Kc),me(qc),me(Gc),me(Wc),me(Uf),me(Hf);const zc=new U({algorithm:us,parameters:F.serialize(Ut)}),Jc=new U({algorithm:Pf,parameters:F.serialize(Ci.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});me(hr),me(Rf),me(Mf),me(on),me(Hc),me(Lc),me(sn),me(an),me(Hc),me(Lc);class cn{constructor(e={}){this.hashAlgorithm=new U(Ut),this.maskGenAlgorithm=new U({algorithm:us,parameters:F.serialize(Ut)}),this.pSourceAlgorithm=new U(Jc),Object.assign(this,e)}}a([l({type:U,context:0,defaultValue:Ut})],cn.prototype,"hashAlgorithm",void 0),a([l({type:U,context:1,defaultValue:zc})],cn.prototype,"maskGenAlgorithm",void 0),a([l({type:U,context:2,defaultValue:Jc})],cn.prototype,"pSourceAlgorithm",void 0),new U({algorithm:jf,parameters:F.serialize(new cn)});class Gr{constructor(e={}){this.hashAlgorithm=new U(Ut),this.maskGenAlgorithm=new U({algorithm:us,parameters:F.serialize(Ut)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}}a([l({type:U,context:0,defaultValue:Ut})],Gr.prototype,"hashAlgorithm",void 0),a([l({type:U,context:1,defaultValue:zc})],Gr.prototype,"maskGenAlgorithm",void 0),a([l({type:h.Integer,context:2,defaultValue:20})],Gr.prototype,"saltLength",void 0),a([l({type:h.Integer,context:3,defaultValue:1})],Gr.prototype,"trailerField",void 0),new U({algorithm:Df,parameters:F.serialize(new Gr)});class ln{constructor(e={}){this.digestAlgorithm=new U,this.digest=new ie,Object.assign(this,e)}}a([l({type:U})],ln.prototype,"digestAlgorithm",void 0),a([l({type:ie})],ln.prototype,"digest",void 0);var fs;class un{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.Integer,converter:ue})],un.prototype,"prime",void 0),a([l({type:h.Integer,converter:ue})],un.prototype,"exponent",void 0),a([l({type:h.Integer,converter:ue})],un.prototype,"coefficient",void 0);let ds=fs=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,fs.prototype)}};ds=fs=a([E({type:x.Sequence,itemType:un})],ds);class nt{constructor(e={}){this.version=0,this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),this.privateExponent=new ArrayBuffer(0),this.prime1=new ArrayBuffer(0),this.prime2=new ArrayBuffer(0),this.exponent1=new ArrayBuffer(0),this.exponent2=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.Integer})],nt.prototype,"version",void 0),a([l({type:h.Integer,converter:ue})],nt.prototype,"modulus",void 0),a([l({type:h.Integer,converter:ue})],nt.prototype,"publicExponent",void 0),a([l({type:h.Integer,converter:ue})],nt.prototype,"privateExponent",void 0),a([l({type:h.Integer,converter:ue})],nt.prototype,"prime1",void 0),a([l({type:h.Integer,converter:ue})],nt.prototype,"prime2",void 0),a([l({type:h.Integer,converter:ue})],nt.prototype,"exponent1",void 0),a([l({type:h.Integer,converter:ue})],nt.prototype,"exponent2",void 0),a([l({type:h.Integer,converter:ue})],nt.prototype,"coefficient",void 0),a([l({type:ds,optional:!0})],nt.prototype,"otherPrimeInfos",void 0);class ps{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.Integer,converter:ue})],ps.prototype,"modulus",void 0),a([l({type:h.Integer,converter:ue})],ps.prototype,"publicExponent",void 0);var hs;(function(r){r[r.Transient=0]="Transient",r[r.Singleton=1]="Singleton",r[r.ResolutionScoped=2]="ResolutionScoped",r[r.ContainerScoped=3]="ContainerScoped"})(hs||(hs={}));const _e=hs;/*! *****************************************************************************
|
|
76
76
|
Copyright (c) Microsoft Corporation.
|
|
77
77
|
|
|
78
78
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -85,9 +85,9 @@ ${e.join(`
|
|
|
85
85
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
86
86
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
87
87
|
PERFORMANCE OF THIS SOFTWARE.
|
|
88
|
-
***************************************************************************** */var ys=function(r,e){return ys=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},ys(r,e)};function gs(r,e){ys(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function Kf(r,e,t,i){function n(s){return s instanceof t?s:new t(function(c){c(s)})}return new(t||(t=Promise))(function(s,c){function u(
|
|
88
|
+
***************************************************************************** */var ys=function(r,e){return ys=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},ys(r,e)};function gs(r,e){ys(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function Kf(r,e,t,i){function n(s){return s instanceof t?s:new t(function(c){c(s)})}return new(t||(t=Promise))(function(s,c){function u(b){try{d(i.next(b))}catch(y){c(y)}}function f(b){try{d(i.throw(b))}catch(y){c(y)}}function d(b){b.done?s(b.value):n(b.value).then(u,f)}d((i=i.apply(r,e||[])).next())})}function qf(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(d){return function(b){return f([d,b])}}function f(d){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=d[0]&2?n.return:d[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,d[1])).done)return s;switch(n=0,s&&(d=[d[0]&2,s.value]),d[0]){case 0:case 1:s=d;break;case 4:return t.label++,{value:d[1],done:!1};case 5:t.label++,n=d[1],d=[0];continue;case 7:d=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(d[0]===6||d[0]===2)){t=0;continue}if(d[0]===3&&(!s||d[1]>s[0]&&d[1]<s[3])){t.label=d[1];break}if(d[0]===6&&t.label<s[1]){t.label=s[1],s=d;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(d);break}s[2]&&t.ops.pop(),t.trys.pop();continue}d=e.call(r,t)}catch(b){d=[6,b],n=0}finally{i=s=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function fn(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function dn(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(u){c={error:u}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s}function Ht(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(dn(arguments[e]));return r}var Gf="injectionTokens";function Wf(r){var e=Reflect.getMetadata("design:paramtypes",r)||[],t=Reflect.getOwnMetadata(Gf,r)||{};return Object.keys(t).forEach(function(i){e[+i]=t[i]}),e}function Yc(r){return!!r.useClass}function ms(r){return!!r.useFactory}var Zc=function(){function r(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return r.prototype.createProxy=function(e){var t=this,i={},n=!1,s,c=function(){return n||(s=e(t.wrap()),n=!0),s};return new Proxy(i,this.createHandler(c))},r.prototype.createHandler=function(e){var t={},i=function(n){t[n]=function(){for(var s=[],c=0;c<arguments.length;c++)s[c]=arguments[c];s[0]=e();var u=Reflect[n];return u.apply(void 0,Ht(s))}};return this.reflectMethods.forEach(i),t},r}();function yr(r){return typeof r=="string"||typeof r=="symbol"}function zf(r){return typeof r=="object"&&"token"in r&&"multiple"in r}function Qc(r){return typeof r=="object"&&"token"in r&&"transform"in r}function Jf(r){return typeof r=="function"||r instanceof Zc}function pn(r){return!!r.useToken}function hn(r){return r.useValue!=null}function Yf(r){return Yc(r)||hn(r)||pn(r)||ms(r)}var bs=function(){function r(){this._registryMap=new Map}return r.prototype.entries=function(){return this._registryMap.entries()},r.prototype.getAll=function(e){return this.ensure(e),this._registryMap.get(e)},r.prototype.get=function(e){this.ensure(e);var t=this._registryMap.get(e);return t[t.length-1]||null},r.prototype.set=function(e,t){this.ensure(e),this._registryMap.get(e).push(t)},r.prototype.setAll=function(e,t){this._registryMap.set(e,t)},r.prototype.has=function(e){return this.ensure(e),this._registryMap.get(e).length>0},r.prototype.clear=function(){this._registryMap.clear()},r.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},r}(),Zf=function(r){gs(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(bs),Xc=function(){function r(){this.scopedResolutions=new Map}return r}();function Qf(r,e){if(r===null)return"at position #"+e;var t=r.split(",")[e].trim();return'"'+t+'" at position #'+e}function Xf(r,e,t){return t===void 0&&(t=" "),Ht([r],e.message.split(`
|
|
89
89
|
`).map(function(i){return t+i})).join(`
|
|
90
|
-
`)}function ed(r,e,t){var i=dn(r.toString().match(/constructor\(([\w, ]+)\)/)||[],2),n=i[1],s=n===void 0?null:n,c=Qf(s,e);return Xf("Cannot inject the dependency "+c+' of "'+r.name+'" constructor. Reason:',t)}function td(r){if(typeof r.dispose!="function")return!1;var e=r.dispose;return!(e.length>0)}var rd=function(r){gs(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(vs),id=function(r){gs(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(vs),nd=function(){function r(){this.preResolution=new rd,this.postResolution=new id}return r}(),el=new Map,od=function(){function r(e){this.parent=e,this._registry=new Zf,this.interceptors=new nd,this.disposed=!1,this.disposables=new Set}return r.prototype.register=function(e,t,i){i===void 0&&(i={lifecycle:_e.Transient}),this.ensureNotDisposed();var n;if(Yf(t)?n=t:n={useClass:t},pn(n))for(var s=[e],c=n;c!=null;){var u=c.useToken;if(s.includes(u))throw new Error("Token registration cycle detected! "+Ht(s,[u]).join(" -> "));s.push(u);var f=this._registry.get(u);f&&pn(f.provider)?c=f.provider:c=null}if((i.lifecycle===_e.Singleton||i.lifecycle==_e.ContainerScoped||i.lifecycle==_e.ResolutionScoped)&&(hn(n)||ms(n)))throw new Error('Cannot use lifecycle "'+_e[i.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:n,options:i}),this},r.prototype.registerType=function(e,t){return this.ensureNotDisposed(),yr(t)?this.register(e,{useToken:t}):this.register(e,{useClass:t})},r.prototype.registerInstance=function(e,t){return this.ensureNotDisposed(),this.register(e,{useValue:t})},r.prototype.registerSingleton=function(e,t){if(this.ensureNotDisposed(),yr(e)){if(yr(t))return this.register(e,{useToken:t},{lifecycle:_e.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:_e.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var i=e;return t&&!yr(t)&&(i=t),this.register(e,{useClass:i},{lifecycle:_e.Singleton})},r.prototype.resolve=function(e,t){t===void 0&&(t=new Xc),this.ensureNotDisposed();var i=this.getRegistration(e);if(!i&&yr(e))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(Jf(e)){var 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.")},r.prototype.executePreResolutionInterceptor=function(e,t){var i,n;if(this.interceptors.preResolution.has(e)){var s=[];try{for(var c=fn(this.interceptors.preResolution.getAll(e)),u=c.next();!u.done;u=c.next()){var f=u.value;f.options.frequency!="Once"&&s.push(f),f.callback(e,t)}}catch(d){i={error:d}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(i)throw i.error}}this.interceptors.preResolution.setAll(e,s)}},r.prototype.executePostResolutionInterceptor=function(e,t,i){var n,s;if(this.interceptors.postResolution.has(e)){var c=[];try{for(var u=fn(this.interceptors.postResolution.getAll(e)),f=u.next();!f.done;f=u.next()){var d=f.value;d.options.frequency!="Once"&&c.push(d),d.callback(e,t,i)}}catch(v){n={error:v}}finally{try{f&&!f.done&&(s=u.return)&&s.call(u)}finally{if(n)throw n.error}}this.interceptors.postResolution.setAll(e,c)}},r.prototype.resolveRegistration=function(e,t){if(this.ensureNotDisposed(),e.options.lifecycle===_e.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);var i=e.options.lifecycle===_e.Singleton,n=e.options.lifecycle===_e.ContainerScoped,s=i||n,c;return hn(e.provider)?c=e.provider.useValue:pn(e.provider)?c=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):Yc(e.provider)?c=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):ms(e.provider)?c=e.provider.useFactory(this):c=this.construct(e.provider,t),e.options.lifecycle===_e.ResolutionScoped&&t.scopedResolutions.set(e,c),c},r.prototype.resolveAll=function(e,t){var i=this;t===void 0&&(t=new Xc),this.ensureNotDisposed();var n=this.getAllRegistrations(e);if(!n&&yr(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"All"),n){var s=n.map(function(u){return i.resolveRegistration(u,t)});return this.executePostResolutionInterceptor(e,s,"All"),s}var c=[this.construct(e,t)];return this.executePostResolutionInterceptor(e,c,"All"),c},r.prototype.isRegistered=function(e,t){return t===void 0&&(t=!1),this.ensureNotDisposed(),this._registry.has(e)||t&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},r.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},r.prototype.clearInstances=function(){var e,t;this.ensureNotDisposed();try{for(var i=fn(this._registry.entries()),n=i.next();!n.done;n=i.next()){var s=dn(n.value,2),c=s[0],u=s[1];this._registry.setAll(c,u.filter(function(f){return!hn(f.provider)}).map(function(f){return f.instance=void 0,f}))}}catch(f){e={error:f}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},r.prototype.createChildContainer=function(){var e,t;this.ensureNotDisposed();var i=new r(this);try{for(var n=fn(this._registry.entries()),s=n.next();!s.done;s=n.next()){var c=dn(s.value,2),u=c[0],f=c[1];f.some(function(d){var v=d.options;return v.lifecycle===_e.ContainerScoped})&&i._registry.setAll(u,f.map(function(d){return d.options.lifecycle===_e.ContainerScoped?{provider:d.provider,options:d.options}:d}))}}catch(d){e={error:d}}finally{try{s&&!s.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return i},r.prototype.beforeResolution=function(e,t,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:t,options:i})},r.prototype.afterResolution=function(e,t,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:t,options:i})},r.prototype.dispose=function(){return Kf(this,void 0,void 0,function(){var e;return qf(this,function(t){switch(t.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(i){var n=i.dispose();n&&e.push(n)}),[4,Promise.all(e)];case 1:return t.sent(),[2]}})})},r.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},r.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},r.prototype.construct=function(e,t){var i=this;if(e instanceof Zc)return e.createProxy(function(s){return i.resolve(s,t)});var n=function(){var s=el.get(e);if(!s||s.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var c=s.map(i.resolveParams(t,e));return new(e.bind.apply(e,Ht([void 0],c)))}();return td(n)&&this.disposables.add(n),n},r.prototype.resolveParams=function(e,t){var i=this;return function(n,s){var c,u,f;try{return Wf(n)?Qc(n)?n.multiple?(c=i.resolve(n.transform)).transform.apply(c,Ht([i.resolveAll(n.token)],n.transformArgs)):(u=i.resolve(n.transform)).transform.apply(u,Ht([i.resolve(n.token,e)],n.transformArgs)):n.multiple?i.resolveAll(n.token):i.resolve(n.token,e):Qc(n)?(f=i.resolve(n.transform,e)).transform.apply(f,Ht([i.resolve(n.token,e)],n.transformArgs)):i.resolve(n,e)}catch(d){throw new Error(ed(t,s,d))}}},r.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},r}(),Ke=new od;function bs(){return function(r){el.set(r,zf(r))}}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var ws;class yn{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}}a([l({type:h.ObjectIdentifier})],yn.prototype,"attrId",void 0),a([l({type:h.Any,repeated:"set"})],yn.prototype,"attrValues",void 0);let tl=ws=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,ws.prototype)}};tl=ws=a([E({type:x.Sequence,itemType:yn})],tl);var Ss;let rl=Ss=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Ss.prototype)}};rl=Ss=a([E({type:x.Sequence,itemType:cr})],rl);class il{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],il.prototype,"certId",void 0),a([l({type:h.Any,context:0})],il.prototype,"certValue",void 0);class nl{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],nl.prototype,"crlId",void 0),a([l({type:h.Any,context:0})],nl.prototype,"crltValue",void 0);class ol extends ie{}let gn=class{constructor(e={}){this.encryptionAlgorithm=new U,this.encryptedData=new ol,Object.assign(this,e)}};a([l({type:U})],gn.prototype,"encryptionAlgorithm",void 0),a([l({type:ol})],gn.prototype,"encryptedData",void 0);var As,ks;(function(r){r[r.v1=0]="v1"})(ks||(ks={}));class sl extends ie{}let xs=As=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,As.prototype)}};xs=As=a([E({type:x.Sequence,itemType:ht})],xs);class zr{constructor(e={}){this.version=ks.v1,this.privateKeyAlgorithm=new U,this.privateKey=new sl,Object.assign(this,e)}}a([l({type:h.Integer})],zr.prototype,"version",void 0),a([l({type:U})],zr.prototype,"privateKeyAlgorithm",void 0),a([l({type:sl})],zr.prototype,"privateKey",void 0),a([l({type:xs,implicit:!0,context:0,optional:!0})],zr.prototype,"attributes",void 0);let al=class extends zr{};al=a([E({type:x.Sequence})],al);let cl=class extends gn{};cl=a([E({type:x.Sequence})],cl);class ll{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],ll.prototype,"secretTypeId",void 0),a([l({type:h.Any,context:0})],ll.prototype,"secretValue",void 0);class Wr{constructor(e={}){this.mac=new ln,this.macSalt=new ie,this.iterations=1,Object.assign(this,e)}}a([l({type:ln})],Wr.prototype,"mac",void 0),a([l({type:ie})],Wr.prototype,"macSalt",void 0),a([l({type:h.Integer,defaultValue:1})],Wr.prototype,"iterations",void 0);class mn{constructor(e={}){this.version=3,this.authSafe=new cr,this.macData=new Wr,Object.assign(this,e)}}a([l({type:h.Integer})],mn.prototype,"version",void 0),a([l({type:cr})],mn.prototype,"authSafe",void 0),a([l({type:Wr,optional:!0})],mn.prototype,"macData",void 0);var Cs;class vn{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],vn.prototype,"bagId",void 0),a([l({type:h.Any,context:0})],vn.prototype,"bagValue",void 0),a([l({type:yn,repeated:"set",optional:!0})],vn.prototype,"bagAttributes",void 0);let ul=Cs=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Cs.prototype)}};ul=Cs=a([E({type:x.Sequence,itemType:vn})],ul);var Bs,Es,Is;const fl="1.2.840.113549.1.9",dl=`${fl}.7`,Ns=`${fl}.14`;let bn=class extends Ae{constructor(e={}){super(e)}toString(){return this.ia5String||super.toString()}};a([l({type:h.IA5String})],bn.prototype,"ia5String",void 0),bn=a([E({type:x.Choice})],bn);let pl=class extends cr{};pl=a([E({type:x.Sequence})],pl);let hl=class extends mn{};hl=a([E({type:x.Sequence})],hl);let yl=class extends gn{};yl=a([E({type:x.Sequence})],yl);let Os=class{constructor(e=""){this.value=e}toString(){return this.value}};a([l({type:h.IA5String})],Os.prototype,"value",void 0),Os=a([E({type:x.Choice})],Os);let gl=class extends bn{};gl=a([E({type:x.Choice})],gl);let ml=class extends Ae{};ml=a([E({type:x.Choice})],ml);let Ts=class{constructor(e=new Date){this.value=e}};a([l({type:h.GeneralizedTime})],Ts.prototype,"value",void 0),Ts=a([E({type:x.Choice})],Ts);let vl=class extends Ae{};vl=a([E({type:x.Choice})],vl);let Vs=class{constructor(e="M"){this.value=e}toString(){return this.value}};a([l({type:h.PrintableString})],Vs.prototype,"value",void 0),Vs=a([E({type:x.Choice})],Vs);let wn=class{constructor(e=""){this.value=e}toString(){return this.value}};a([l({type:h.PrintableString})],wn.prototype,"value",void 0),wn=a([E({type:x.Choice})],wn);let bl=class extends wn{};bl=a([E({type:x.Choice})],bl);let wl=class extends Ae{};wl=a([E({type:x.Choice})],wl);let _s=class{constructor(e=""){this.value=e}toString(){return this.value}};a([l({type:h.ObjectIdentifier})],_s.prototype,"value",void 0),_s=a([E({type:x.Choice})],_s);let Sl=class extends ke{};Sl=a([E({type:x.Choice})],Sl);let js=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};a([l({type:h.Integer})],js.prototype,"value",void 0),js=a([E({type:x.Choice})],js);let Al=class extends it{};Al=a([E({type:x.Sequence})],Al);let Sn=class extends Ae{};Sn=a([E({type:x.Choice})],Sn);let kl=Bs=class extends Dt{constructor(e){super(e),Object.setPrototypeOf(this,Bs.prototype)}};kl=Bs=a([E({type:x.Sequence})],kl);let xl=Es=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Es.prototype)}};xl=Es=a([E({type:x.Set,itemType:nr})],xl);let Ps=class{constructor(e=""){this.value=e}toString(){return this.value}};a([l({type:h.BmpString})],Ps.prototype,"value",void 0),Ps=a([E({type:x.Choice})],Ps);let Ds=class extends U{};Ds=a([E({type:x.Sequence})],Ds);let Cl=Is=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Is.prototype)}};Cl=Is=a([E({type:x.Sequence,itemType:Ds})],Cl);var Rs;let An=Rs=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Rs.prototype)}};An=Rs=a([E({type:x.Sequence,itemType:ht})],An);class gr{constructor(e={}){this.version=0,this.subject=new ge,this.subjectPKInfo=new yt,this.attributes=new An,Object.assign(this,e)}}a([l({type:h.Integer})],gr.prototype,"version",void 0),a([l({type:ge})],gr.prototype,"subject",void 0),a([l({type:yt})],gr.prototype,"subjectPKInfo",void 0),a([l({type:An,implicit:!0,context:0})],gr.prototype,"attributes",void 0);class Jr{constructor(e={}){this.certificationRequestInfo=new gr,this.signatureAlgorithm=new U,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:gr})],Jr.prototype,"certificationRequestInfo",void 0),a([l({type:U})],Jr.prototype,"signatureAlgorithm",void 0),a([l({type:h.BitString})],Jr.prototype,"signature",void 0);/*!
|
|
90
|
+
`)}function ed(r,e,t){var i=dn(r.toString().match(/constructor\(([\w, ]+)\)/)||[],2),n=i[1],s=n===void 0?null:n,c=Qf(s,e);return Xf("Cannot inject the dependency "+c+' of "'+r.name+'" constructor. Reason:',t)}function td(r){if(typeof r.dispose!="function")return!1;var e=r.dispose;return!(e.length>0)}var rd=function(r){gs(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(bs),id=function(r){gs(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(bs),nd=function(){function r(){this.preResolution=new rd,this.postResolution=new id}return r}(),el=new Map,od=function(){function r(e){this.parent=e,this._registry=new Zf,this.interceptors=new nd,this.disposed=!1,this.disposables=new Set}return r.prototype.register=function(e,t,i){i===void 0&&(i={lifecycle:_e.Transient}),this.ensureNotDisposed();var n;if(Yf(t)?n=t:n={useClass:t},pn(n))for(var s=[e],c=n;c!=null;){var u=c.useToken;if(s.includes(u))throw new Error("Token registration cycle detected! "+Ht(s,[u]).join(" -> "));s.push(u);var f=this._registry.get(u);f&&pn(f.provider)?c=f.provider:c=null}if((i.lifecycle===_e.Singleton||i.lifecycle==_e.ContainerScoped||i.lifecycle==_e.ResolutionScoped)&&(hn(n)||ms(n)))throw new Error('Cannot use lifecycle "'+_e[i.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:n,options:i}),this},r.prototype.registerType=function(e,t){return this.ensureNotDisposed(),yr(t)?this.register(e,{useToken:t}):this.register(e,{useClass:t})},r.prototype.registerInstance=function(e,t){return this.ensureNotDisposed(),this.register(e,{useValue:t})},r.prototype.registerSingleton=function(e,t){if(this.ensureNotDisposed(),yr(e)){if(yr(t))return this.register(e,{useToken:t},{lifecycle:_e.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:_e.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var i=e;return t&&!yr(t)&&(i=t),this.register(e,{useClass:i},{lifecycle:_e.Singleton})},r.prototype.resolve=function(e,t){t===void 0&&(t=new Xc),this.ensureNotDisposed();var i=this.getRegistration(e);if(!i&&yr(e))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(Jf(e)){var 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.")},r.prototype.executePreResolutionInterceptor=function(e,t){var i,n;if(this.interceptors.preResolution.has(e)){var s=[];try{for(var c=fn(this.interceptors.preResolution.getAll(e)),u=c.next();!u.done;u=c.next()){var f=u.value;f.options.frequency!="Once"&&s.push(f),f.callback(e,t)}}catch(d){i={error:d}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(i)throw i.error}}this.interceptors.preResolution.setAll(e,s)}},r.prototype.executePostResolutionInterceptor=function(e,t,i){var n,s;if(this.interceptors.postResolution.has(e)){var c=[];try{for(var u=fn(this.interceptors.postResolution.getAll(e)),f=u.next();!f.done;f=u.next()){var d=f.value;d.options.frequency!="Once"&&c.push(d),d.callback(e,t,i)}}catch(b){n={error:b}}finally{try{f&&!f.done&&(s=u.return)&&s.call(u)}finally{if(n)throw n.error}}this.interceptors.postResolution.setAll(e,c)}},r.prototype.resolveRegistration=function(e,t){if(this.ensureNotDisposed(),e.options.lifecycle===_e.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);var i=e.options.lifecycle===_e.Singleton,n=e.options.lifecycle===_e.ContainerScoped,s=i||n,c;return hn(e.provider)?c=e.provider.useValue:pn(e.provider)?c=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):Yc(e.provider)?c=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):ms(e.provider)?c=e.provider.useFactory(this):c=this.construct(e.provider,t),e.options.lifecycle===_e.ResolutionScoped&&t.scopedResolutions.set(e,c),c},r.prototype.resolveAll=function(e,t){var i=this;t===void 0&&(t=new Xc),this.ensureNotDisposed();var n=this.getAllRegistrations(e);if(!n&&yr(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"All"),n){var s=n.map(function(u){return i.resolveRegistration(u,t)});return this.executePostResolutionInterceptor(e,s,"All"),s}var c=[this.construct(e,t)];return this.executePostResolutionInterceptor(e,c,"All"),c},r.prototype.isRegistered=function(e,t){return t===void 0&&(t=!1),this.ensureNotDisposed(),this._registry.has(e)||t&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},r.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},r.prototype.clearInstances=function(){var e,t;this.ensureNotDisposed();try{for(var i=fn(this._registry.entries()),n=i.next();!n.done;n=i.next()){var s=dn(n.value,2),c=s[0],u=s[1];this._registry.setAll(c,u.filter(function(f){return!hn(f.provider)}).map(function(f){return f.instance=void 0,f}))}}catch(f){e={error:f}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},r.prototype.createChildContainer=function(){var e,t;this.ensureNotDisposed();var i=new r(this);try{for(var n=fn(this._registry.entries()),s=n.next();!s.done;s=n.next()){var c=dn(s.value,2),u=c[0],f=c[1];f.some(function(d){var b=d.options;return b.lifecycle===_e.ContainerScoped})&&i._registry.setAll(u,f.map(function(d){return d.options.lifecycle===_e.ContainerScoped?{provider:d.provider,options:d.options}:d}))}}catch(d){e={error:d}}finally{try{s&&!s.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return i},r.prototype.beforeResolution=function(e,t,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:t,options:i})},r.prototype.afterResolution=function(e,t,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:t,options:i})},r.prototype.dispose=function(){return Kf(this,void 0,void 0,function(){var e;return qf(this,function(t){switch(t.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(i){var n=i.dispose();n&&e.push(n)}),[4,Promise.all(e)];case 1:return t.sent(),[2]}})})},r.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},r.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},r.prototype.construct=function(e,t){var i=this;if(e instanceof Zc)return e.createProxy(function(s){return i.resolve(s,t)});var n=function(){var s=el.get(e);if(!s||s.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var c=s.map(i.resolveParams(t,e));return new(e.bind.apply(e,Ht([void 0],c)))}();return td(n)&&this.disposables.add(n),n},r.prototype.resolveParams=function(e,t){var i=this;return function(n,s){var c,u,f;try{return zf(n)?Qc(n)?n.multiple?(c=i.resolve(n.transform)).transform.apply(c,Ht([i.resolveAll(n.token)],n.transformArgs)):(u=i.resolve(n.transform)).transform.apply(u,Ht([i.resolve(n.token,e)],n.transformArgs)):n.multiple?i.resolveAll(n.token):i.resolve(n.token,e):Qc(n)?(f=i.resolve(n.transform,e)).transform.apply(f,Ht([i.resolve(n.token,e)],n.transformArgs)):i.resolve(n,e)}catch(d){throw new Error(ed(t,s,d))}}},r.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},r}(),Ke=new od;function vs(){return function(r){el.set(r,Wf(r))}}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var ws;class yn{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}}a([l({type:h.ObjectIdentifier})],yn.prototype,"attrId",void 0),a([l({type:h.Any,repeated:"set"})],yn.prototype,"attrValues",void 0);let tl=ws=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,ws.prototype)}};tl=ws=a([E({type:x.Sequence,itemType:yn})],tl);var As;let rl=As=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,As.prototype)}};rl=As=a([E({type:x.Sequence,itemType:cr})],rl);class il{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],il.prototype,"certId",void 0),a([l({type:h.Any,context:0})],il.prototype,"certValue",void 0);class nl{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],nl.prototype,"crlId",void 0),a([l({type:h.Any,context:0})],nl.prototype,"crltValue",void 0);class ol extends ie{}let gn=class{constructor(e={}){this.encryptionAlgorithm=new U,this.encryptedData=new ol,Object.assign(this,e)}};a([l({type:U})],gn.prototype,"encryptionAlgorithm",void 0),a([l({type:ol})],gn.prototype,"encryptedData",void 0);var Ss,ks;(function(r){r[r.v1=0]="v1"})(ks||(ks={}));class sl extends ie{}let xs=Ss=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Ss.prototype)}};xs=Ss=a([E({type:x.Sequence,itemType:ht})],xs);class Wr{constructor(e={}){this.version=ks.v1,this.privateKeyAlgorithm=new U,this.privateKey=new sl,Object.assign(this,e)}}a([l({type:h.Integer})],Wr.prototype,"version",void 0),a([l({type:U})],Wr.prototype,"privateKeyAlgorithm",void 0),a([l({type:sl})],Wr.prototype,"privateKey",void 0),a([l({type:xs,implicit:!0,context:0,optional:!0})],Wr.prototype,"attributes",void 0);let al=class extends Wr{};al=a([E({type:x.Sequence})],al);let cl=class extends gn{};cl=a([E({type:x.Sequence})],cl);class ll{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],ll.prototype,"secretTypeId",void 0),a([l({type:h.Any,context:0})],ll.prototype,"secretValue",void 0);class zr{constructor(e={}){this.mac=new ln,this.macSalt=new ie,this.iterations=1,Object.assign(this,e)}}a([l({type:ln})],zr.prototype,"mac",void 0),a([l({type:ie})],zr.prototype,"macSalt",void 0),a([l({type:h.Integer,defaultValue:1})],zr.prototype,"iterations",void 0);class mn{constructor(e={}){this.version=3,this.authSafe=new cr,this.macData=new zr,Object.assign(this,e)}}a([l({type:h.Integer})],mn.prototype,"version",void 0),a([l({type:cr})],mn.prototype,"authSafe",void 0),a([l({type:zr,optional:!0})],mn.prototype,"macData",void 0);var Cs;class bn{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],bn.prototype,"bagId",void 0),a([l({type:h.Any,context:0})],bn.prototype,"bagValue",void 0),a([l({type:yn,repeated:"set",optional:!0})],bn.prototype,"bagAttributes",void 0);let ul=Cs=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Cs.prototype)}};ul=Cs=a([E({type:x.Sequence,itemType:bn})],ul);var Bs,Es,Is;const fl="1.2.840.113549.1.9",dl=`${fl}.7`,Ns=`${fl}.14`;let vn=class extends Se{constructor(e={}){super(e)}toString(){return this.ia5String||super.toString()}};a([l({type:h.IA5String})],vn.prototype,"ia5String",void 0),vn=a([E({type:x.Choice})],vn);let pl=class extends cr{};pl=a([E({type:x.Sequence})],pl);let hl=class extends mn{};hl=a([E({type:x.Sequence})],hl);let yl=class extends gn{};yl=a([E({type:x.Sequence})],yl);let Os=class{constructor(e=""){this.value=e}toString(){return this.value}};a([l({type:h.IA5String})],Os.prototype,"value",void 0),Os=a([E({type:x.Choice})],Os);let gl=class extends vn{};gl=a([E({type:x.Choice})],gl);let ml=class extends Se{};ml=a([E({type:x.Choice})],ml);let Ts=class{constructor(e=new Date){this.value=e}};a([l({type:h.GeneralizedTime})],Ts.prototype,"value",void 0),Ts=a([E({type:x.Choice})],Ts);let bl=class extends Se{};bl=a([E({type:x.Choice})],bl);let Vs=class{constructor(e="M"){this.value=e}toString(){return this.value}};a([l({type:h.PrintableString})],Vs.prototype,"value",void 0),Vs=a([E({type:x.Choice})],Vs);let wn=class{constructor(e=""){this.value=e}toString(){return this.value}};a([l({type:h.PrintableString})],wn.prototype,"value",void 0),wn=a([E({type:x.Choice})],wn);let vl=class extends wn{};vl=a([E({type:x.Choice})],vl);let wl=class extends Se{};wl=a([E({type:x.Choice})],wl);let _s=class{constructor(e=""){this.value=e}toString(){return this.value}};a([l({type:h.ObjectIdentifier})],_s.prototype,"value",void 0),_s=a([E({type:x.Choice})],_s);let Al=class extends ke{};Al=a([E({type:x.Choice})],Al);let js=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};a([l({type:h.Integer})],js.prototype,"value",void 0),js=a([E({type:x.Choice})],js);let Sl=class extends it{};Sl=a([E({type:x.Sequence})],Sl);let An=class extends Se{};An=a([E({type:x.Choice})],An);let kl=Bs=class extends Dt{constructor(e){super(e),Object.setPrototypeOf(this,Bs.prototype)}};kl=Bs=a([E({type:x.Sequence})],kl);let xl=Es=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Es.prototype)}};xl=Es=a([E({type:x.Set,itemType:nr})],xl);let Ps=class{constructor(e=""){this.value=e}toString(){return this.value}};a([l({type:h.BmpString})],Ps.prototype,"value",void 0),Ps=a([E({type:x.Choice})],Ps);let Ds=class extends U{};Ds=a([E({type:x.Sequence})],Ds);let Cl=Is=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Is.prototype)}};Cl=Is=a([E({type:x.Sequence,itemType:Ds})],Cl);var Rs;let Sn=Rs=class extends ne{constructor(e){super(e),Object.setPrototypeOf(this,Rs.prototype)}};Sn=Rs=a([E({type:x.Sequence,itemType:ht})],Sn);class gr{constructor(e={}){this.version=0,this.subject=new ge,this.subjectPKInfo=new yt,this.attributes=new Sn,Object.assign(this,e)}}a([l({type:h.Integer})],gr.prototype,"version",void 0),a([l({type:ge})],gr.prototype,"subject",void 0),a([l({type:yt})],gr.prototype,"subjectPKInfo",void 0),a([l({type:Sn,implicit:!0,context:0})],gr.prototype,"attributes",void 0);class Jr{constructor(e={}){this.certificationRequestInfo=new gr,this.signatureAlgorithm=new U,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:gr})],Jr.prototype,"certificationRequestInfo",void 0),a([l({type:U})],Jr.prototype,"signatureAlgorithm",void 0),a([l({type:h.BitString})],Jr.prototype,"signature",void 0);/*!
|
|
91
91
|
* MIT License
|
|
92
92
|
*
|
|
93
93
|
* Copyright (c) Peculiar Ventures. All rights reserved.
|
|
@@ -110,8 +110,8 @@ ${e.join(`
|
|
|
110
110
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
111
111
|
* SOFTWARE.
|
|
112
112
|
*
|
|
113
|
-
*/const kn="crypto.algorithm";class sd{getAlgorithms(){return Ke.resolveAll(kn)}toAsnAlgorithm(e){({...e});for(const t of this.getAlgorithms()){const i=t.toAsnAlgorithm(e);if(i)return i}if(/^[0-9.]+$/.test(e.name)){const t=new U({algorithm:e.name});if("parameters"in e){const i=e;t.parameters=i.parameters}return t}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(e){for(const i of this.getAlgorithms()){const n=i.toWebAlgorithm(e);if(n)return n}return{name:e.algorithm,parameters:e.parameters}}}const xn="crypto.algorithmProvider";Ke.registerSingleton(xn,sd);var Cn;const je="1.3.36.3.3.2.8.1.1",Bl=`${je}.1`,El=`${je}.2`,Il=`${je}.3`,Nl=`${je}.4`,Ol=`${je}.5`,Tl=`${je}.6`,Vl=`${je}.7`,_l=`${je}.8`,jl=`${je}.9`,Pl=`${je}.10`,Dl=`${je}.11`,Rl=`${je}.12`,Ml=`${je}.13`,$l=`${je}.14`,Ul="brainpoolP160r1",Hl="brainpoolP160t1",Ll="brainpoolP192r1",Fl="brainpoolP192t1",Kl="brainpoolP224r1",ql="brainpoolP224t1",Gl="brainpoolP256r1",
|
|
114
|
-
`)}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,t=0){const i=[];let n=this.pad(t++),s="";const c=e[oe.VALUE];c&&(s=` ${c}`),i.push(`${n}${e[oe.NAME]}:${s}`),n=this.pad(t);for(const u in e){if(typeof u=="symbol")continue;const f=e[u],d=u?`${u}: `:"";if(typeof f=="string"||typeof f=="number"||typeof f=="boolean")i.push(`${n}${d}${f}`);else if(f instanceof Date)i.push(`${n}${d}${f.toUTCString()}`);else if(Array.isArray(f))for(const
|
|
115
|
-
`).replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1"),c===this.getName("E")||c===this.getName("DC")?
|
|
113
|
+
*/const kn="crypto.algorithm";class sd{getAlgorithms(){return Ke.resolveAll(kn)}toAsnAlgorithm(e){({...e});for(const t of this.getAlgorithms()){const i=t.toAsnAlgorithm(e);if(i)return i}if(/^[0-9.]+$/.test(e.name)){const t=new U({algorithm:e.name});if("parameters"in e){const i=e;t.parameters=i.parameters}return t}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(e){for(const i of this.getAlgorithms()){const n=i.toWebAlgorithm(e);if(n)return n}return{name:e.algorithm,parameters:e.parameters}}}const xn="crypto.algorithmProvider";Ke.registerSingleton(xn,sd);var Cn;const je="1.3.36.3.3.2.8.1.1",Bl=`${je}.1`,El=`${je}.2`,Il=`${je}.3`,Nl=`${je}.4`,Ol=`${je}.5`,Tl=`${je}.6`,Vl=`${je}.7`,_l=`${je}.8`,jl=`${je}.9`,Pl=`${je}.10`,Dl=`${je}.11`,Rl=`${je}.12`,Ml=`${je}.13`,$l=`${je}.14`,Ul="brainpoolP160r1",Hl="brainpoolP160t1",Ll="brainpoolP192r1",Fl="brainpoolP192t1",Kl="brainpoolP224r1",ql="brainpoolP224t1",Gl="brainpoolP256r1",Wl="brainpoolP256t1",zl="brainpoolP320r1",Jl="brainpoolP320t1",Yl="brainpoolP384r1",Zl="brainpoolP384t1",Ql="brainpoolP512r1",Xl="brainpoolP512t1",fe="ECDSA";let Yr=Cn=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case fe.toLowerCase():if("hash"in e)switch((typeof e.hash=="string"?e.hash:e.hash.name).toLowerCase()){case"sha-1":return Of;case"sha-256":return Tf;case"sha-384":return Vf;case"sha-512":return _f}else if("namedCurve"in e){let t="";switch(e.namedCurve){case"P-256":t=Mc;break;case"K-256":t=Cn.SECP256K1;break;case"P-384":t=$c;break;case"P-521":t=Uc;break;case Ul:t=Bl;break;case Hl:t=El;break;case Ll:t=Il;break;case Fl:t=Nl;break;case Kl:t=Ol;break;case ql:t=Tl;break;case Gl:t=Vl;break;case Wl:t=_l;break;case zl:t=jl;break;case Jl:t=Pl;break;case Yl:t=Dl;break;case Zl:t=Rl;break;case Ql:t=Ml;break;case Xl:t=$l;break}if(t)return new U({algorithm:Kr,parameters:F.serialize(new pr({namedCurve:t}))})}}return null}toWebAlgorithm(e){switch(e.algorithm){case os:return{name:fe,hash:{name:"SHA-1"}};case ss:return{name:fe,hash:{name:"SHA-256"}};case as:return{name:fe,hash:{name:"SHA-384"}};case cs:return{name:fe,hash:{name:"SHA-512"}};case Kr:{if(!e.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(F.parse(e.parameters,pr).namedCurve){case Mc:return{name:fe,namedCurve:"P-256"};case Cn.SECP256K1:return{name:fe,namedCurve:"K-256"};case $c:return{name:fe,namedCurve:"P-384"};case Uc:return{name:fe,namedCurve:"P-521"};case Bl:return{name:fe,namedCurve:Ul};case El:return{name:fe,namedCurve:Hl};case Il:return{name:fe,namedCurve:Ll};case Nl:return{name:fe,namedCurve:Fl};case Ol:return{name:fe,namedCurve:Kl};case Tl:return{name:fe,namedCurve:ql};case Vl:return{name:fe,namedCurve:Gl};case _l:return{name:fe,namedCurve:Wl};case jl:return{name:fe,namedCurve:zl};case Pl:return{name:fe,namedCurve:Jl};case Dl:return{name:fe,namedCurve:Yl};case Rl:return{name:fe,namedCurve:Zl};case Ml:return{name:fe,namedCurve:Ql};case $l:return{name:fe,namedCurve:Xl}}}}return null}};Yr.SECP256K1="1.3.132.0.10",Yr=Cn=a([vs()],Yr),Ke.registerSingleton(kn,Yr);const eu=Symbol("name"),tu=Symbol("value");class oe{constructor(e,t={},i=""){this[eu]=e,this[tu]=i;for(const n in t)this[n]=t[n]}}oe.NAME=eu,oe.VALUE=tu;class ad{static toTextObject(e){const t=new oe("Algorithm Identifier",{},xt.toString(e.algorithm));if(e.parameters)switch(e.algorithm){case Kr:{const i=new Yr().toWebAlgorithm(e);i&&"namedCurve"in i?t["Named Curve"]=i.namedCurve:t.Parameters=e.parameters;break}default:t.Parameters=e.parameters}return t}}class xt{static toString(e){const t=this.items[e];return t||e}}xt.items={[Fc]:"sha1",[Kc]:"sha224",[qc]:"sha256",[Gc]:"sha384",[Wc]:"sha512",[hr]:"rsaEncryption",[on]:"sha1WithRSAEncryption",[$f]:"sha224WithRSAEncryption",[ls]:"sha256WithRSAEncryption",[sn]:"sha384WithRSAEncryption",[an]:"sha512WithRSAEncryption",[Kr]:"ecPublicKey",[os]:"ecdsaWithSHA1",[Rc]:"ecdsaWithSHA224",[ss]:"ecdsaWithSHA256",[as]:"ecdsaWithSHA384",[cs]:"ecdsaWithSHA512",[kf]:"TLS WWW server authentication",[xf]:"TLS WWW client authentication",[Cf]:"Code Signing",[Bf]:"E-mail Protection",[Ef]:"Time Stamping",[If]:"OCSP Signing",[Nf]:"Signed Data"};class Lt{static serialize(e){return this.serializeObj(e).join(`
|
|
114
|
+
`)}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,t=0){const i=[];let n=this.pad(t++),s="";const c=e[oe.VALUE];c&&(s=` ${c}`),i.push(`${n}${e[oe.NAME]}:${s}`),n=this.pad(t);for(const u in e){if(typeof u=="symbol")continue;const f=e[u],d=u?`${u}: `:"";if(typeof f=="string"||typeof f=="number"||typeof f=="boolean")i.push(`${n}${d}${f}`);else if(f instanceof Date)i.push(`${n}${d}${f.toUTCString()}`);else if(Array.isArray(f))for(const b of f)b[oe.NAME]=u,i.push(...this.serializeObj(b,t));else if(f instanceof oe)f[oe.NAME]=u,i.push(...this.serializeObj(f,t));else if(_.isBufferSource(f))u?(i.push(`${n}${d}`),i.push(...this.serializeBufferSource(f,t+1))):i.push(...this.serializeBufferSource(f,t));else if("toTextObject"in f){const b=f.toTextObject();b[oe.NAME]=u,i.push(...this.serializeObj(b,t))}else throw new TypeError("Cannot serialize data in text format. Unsupported type.")}return i}static serializeBufferSource(e,t=0){const i=this.pad(t),n=_.toUint8Array(e),s=[];for(let c=0;c<n.length;){const u=[];for(let f=0;f<16&&c<n.length;f++){f===8&&u.push("");const d=n[c++].toString(16).padStart(2,"0");u.push(d)}s.push(`${i}${u.join(" ")}`)}return s}static serializeAlgorithm(e){return this.algorithmSerializer.toTextObject(e)}}Lt.oidSerializer=xt,Lt.algorithmSerializer=ad;class Ct{constructor(...e){if(e.length===1){const t=e[0];this.rawData=F.serialize(t),this.onInit(t)}else{const t=F.parse(e[0],e[1]);this.rawData=_.toArrayBuffer(e[0]),this.onInit(t)}}equal(e){return e instanceof Ct?ia(e.rawData,this.rawData):!1}toString(e="text"){switch(e){case"asn":return F.toString(this.rawData);case"text":return Lt.serialize(this.toTextObject());case"hex":return M.ToHex(this.rawData);case"base64":return M.ToBase64(this.rawData);case"base64url":return M.ToBase64Url(this.rawData);default:throw TypeError("Argument 'format' is unsupported value")}}getTextName(){return this.constructor.NAME}toTextObject(){const e=this.toTextObjectEmpty();return e[""]=this.rawData,e}toTextObjectEmpty(e){return new oe(this.getTextName(),{},e)}}Ct.NAME="ASN";class ot extends Ct{constructor(...e){let t;_.isBufferSource(e[0])?t=_.toArrayBuffer(e[0]):t=F.serialize(new Je({extnID:e[0],critical:e[1],extnValue:new ie(_.toArrayBuffer(e[2]))})),super(t,Je)}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[oe.NAME]===ot.NAME&&(e[oe.NAME]=xt.toString(this.type)),e}}var ru;class Ft{static isCryptoKeyPair(e){return e&&e.privateKey&&e.publicKey}static isCryptoKey(e){return e&&e.usages&&e.type&&e.algorithm&&e.extractable!==void 0}constructor(){this.items=new Map,this[ru]="CryptoProvider",typeof self<"u"&&typeof crypto<"u"&&this.set(Ft.DEFAULT,crypto)}clear(){this.items.clear()}delete(e){return this.items.delete(e)}forEach(e,t){return this.items.forEach(e,t)}has(e){return this.items.has(e)}get size(){return this.items.size}entries(){return this.items.entries()}keys(){return this.items.keys()}values(){return this.items.values()}[Symbol.iterator](){return this.items[Symbol.iterator]()}get(e=Ft.DEFAULT){const t=this.items.get(e.toLowerCase());if(!t)throw new Error(`Cannot get Crypto by name '${e}'`);return t}set(e,t){if(typeof e=="string"){if(!t)throw new TypeError("Argument 'value' is required");this.items.set(e.toLowerCase(),t)}else this.items.set(Ft.DEFAULT,e);return this}}ru=Symbol.toStringTag,Ft.DEFAULT="default";const Me=new Ft,cd=/^[0-2](?:\.[1-9][0-9]*)+$/;function ld(r){return new RegExp(cd).test(r)}class iu{constructor(e={}){this.items={};for(const t in e)this.register(t,e[t])}get(e){return this.items[e]||null}findId(e){return ld(e)?e:this.get(e)}register(e,t){this.items[e]=t,this.items[t]=e}}const Pe=new iu;Pe.register("CN","2.5.4.3"),Pe.register("L","2.5.4.7"),Pe.register("ST","2.5.4.8"),Pe.register("O","2.5.4.10"),Pe.register("OU","2.5.4.11"),Pe.register("C","2.5.4.6"),Pe.register("DC","0.9.2342.19200300.100.1.25"),Pe.register("E","1.2.840.113549.1.9.1"),Pe.register("G","2.5.4.42"),Pe.register("I","2.5.4.43"),Pe.register("SN","2.5.4.4"),Pe.register("T","2.5.4.12");function ud(r,e){return`\\${M.ToHex(M.FromUtf8String(e)).toUpperCase()}`}function fd(r){return r.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,ud)}class Bt{static isASCII(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>255)return!1;return!0}static isPrintableString(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/g.test(e)}constructor(e,t={}){this.extraNames=new iu,this.asn=new ge;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const n=t[i];this.extraNames.register(i,n)}typeof e=="string"?this.asn=this.fromString(e):e instanceof ge?this.asn=e:_.isBufferSource(e)?this.asn=F.parse(e,ge):this.asn=this.fromJSON(e)}getField(e){const t=this.extraNames.findId(e)||Pe.findId(e),i=[];for(const n of this.asn)for(const s of n)s.type===t&&i.push(s.value.toString());return i}getName(e){return this.extraNames.get(e)||Pe.get(e)}toString(){return this.asn.map(e=>e.map(t=>{const i=this.getName(t.type)||t.type,n=t.value.anyValue?`#${M.ToHex(t.value.anyValue)}`:fd(t.value.toString());return`${i}=${n}`}).join("+")).join(", ")}toJSON(){var e;const t=[];for(const i of this.asn){const n={};for(const s of i){const c=this.getName(s.type)||s.type;(e=n[c])!==null&&e!==void 0||(n[c]=[]),n[c].push(s.value.anyValue?`#${M.ToHex(s.value.anyValue)}`:s.value.toString())}t.push(n)}return t}fromString(e){const t=new ge,i=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let n=null,s=",";for(;n=i.exec(`${e},`);){let[,c,u]=n;const f=u[u.length-1];(f===","||f==="+")&&(u=u.slice(0,u.length-1),n[3]=f);const d=n[3];if(/[\d.]+/.test(c)||(c=this.getName(c)||""),!c)throw new Error(`Cannot get OID for name type '${c}'`);const b=new Ir({type:c});if(u.charAt(0)==="#")b.value.anyValue=M.FromHex(u.slice(1));else{const y=/"(.*?[^\\])?"/.exec(u);y&&(u=y[1]),u=u.replace(/\\0a/ig,`
|
|
115
|
+
`).replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1"),c===this.getName("E")||c===this.getName("DC")?b.value.ia5String=u:Bt.isPrintableString(u)?b.value.printableString=u:b.value.utf8String=u}s==="+"?t[t.length-1].push(b):t.push(new Zt([b])),s=d}return t}fromJSON(e){const t=new ge;for(const i of e){const n=new Zt;for(const s in i){let c=s;if(/[\d.]+/.test(s)||(c=this.getName(s)||""),!c)throw new Error(`Cannot get OID for name type '${s}'`);const u=i[s];for(const f of u){const d=new Ir({type:c});if(typeof f=="object")for(const b in f)switch(b){case"ia5String":d.value.ia5String=f[b];break;case"utf8String":d.value.utf8String=f[b];break;case"universalString":d.value.universalString=f[b];break;case"bmpString":d.value.bmpString=f[b];break;case"printableString":d.value.printableString=f[b];break}else f[0]==="#"?d.value.anyValue=M.FromHex(f.slice(1)):c===this.getName("E")||c===this.getName("DC")?d.value.ia5String=f:d.value.printableString=f;n.push(d)}}t.push(n)}return t}toArrayBuffer(){return F.serialize(this.asn)}async getThumbprint(...e){var t;let i,n="SHA-1";return e.length>=1&&!(!((t=e[0])===null||t===void 0)&&t.subtle)?(n=e[0]||n,i=e[1]||Me.get()):i=e[0]||Me.get(),await i.subtle.digest(n,this.toArrayBuffer())}}const nu="Cannot initialize GeneralName from ASN.1 data.",ou=`${nu} Unsupported string format in use.`,dd=`${nu} Value doesn't match to GUID regular expression.`,su=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,au="1.3.6.1.4.1.311.25.1",cu="1.3.6.1.4.1.311.20.2.3",Ms="dns",$s="dn",Us="email",Hs="ip",Ls="url",Fs="guid",Ks="upn",Bn="id";class lu extends Ct{constructor(...e){let t;if(e.length===2)switch(e[0]){case $s:{const i=new Bt(e[1]).toArrayBuffer(),n=F.parse(i,ge);t=new Q({directoryName:n});break}case Ms:t=new Q({dNSName:e[1]});break;case Us:t=new Q({rfc822Name:e[1]});break;case Fs:{const i=new RegExp(su,"i").exec(e[1]);if(!i)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const n=i.slice(1).map((s,c)=>c<3?M.ToHex(new Uint8Array(M.FromHex(s)).reverse()):s).join("");t=new Q({otherName:new Nr({typeId:au,value:F.serialize(new ie(M.FromHex(n)))})});break}case Hs:t=new Q({iPAddress:e[1]});break;case Bn:t=new Q({registeredID:e[1]});break;case Ks:{t=new Q({otherName:new Nr({typeId:cu,value:F.serialize(oc.toASN(e[1]))})});break}case Ls:t=new Q({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else _.isBufferSource(e[0])?t=F.parse(e[0],Q):t=e[0];super(t)}onInit(e){if(e.dNSName!=null)this.type=Ms,this.value=e.dNSName;else if(e.rfc822Name!=null)this.type=Us,this.value=e.rfc822Name;else if(e.iPAddress!=null)this.type=Hs,this.value=e.iPAddress;else if(e.uniformResourceIdentifier!=null)this.type=Ls,this.value=e.uniformResourceIdentifier;else if(e.registeredID!=null)this.type=Bn,this.value=e.registeredID;else if(e.directoryName!=null)this.type=$s,this.value=new Bt(e.directoryName).toString();else if(e.otherName!=null)if(e.otherName.typeId===au){this.type=Fs;const t=F.parse(e.otherName.value,ie),i=new RegExp(su,"i").exec(M.ToHex(t));if(!i)throw new Error(dd);this.value=i.slice(1).map((n,s)=>s<3?M.ToHex(new Uint8Array(M.FromHex(n)).reverse()):n).join("-")}else if(e.otherName.typeId===cu)this.type=Ks,this.value=F.parse(e.otherName.value,Se).toString();else throw new Error(ou);else throw new Error(ou)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case $s:case Ms:case Fs:case Hs:case Bn:case Ks:case Ls:e=this.type.toUpperCase();break;case Us:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let t=this.value;return this.type===Bn&&(t=xt.toString(t)),new oe(e,void 0,t)}}class Zr extends Ct{constructor(e){let t;if(e instanceof Ie)t=e;else if(Array.isArray(e)){const i=[];for(const n of e)if(n instanceof Q)i.push(n);else{const s=F.parse(new lu(n.type,n.value).rawData,Q);i.push(s)}t=new Ie(i)}else if(_.isBufferSource(e))t=F.parse(e,Ie);else throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");super(t)}onInit(e){const t=[];for(const i of e){let n=null;try{n=new lu(i)}catch{continue}t.push(n)}this.items=t}toJSON(){return this.items.map(e=>e.toJSON())}toTextObject(){const e=super.toTextObjectEmpty();for(const t of this.items){const i=t.toTextObject();let n=e[i[oe.NAME]];Array.isArray(n)||(n=[],e[i[oe.NAME]]=n),n.push(i)}return e}}Zr.NAME="GeneralNames";const Qr="-{5}",Xr="\\n",pd=`[^${Xr}]+`,hd=`${Qr}BEGIN (${pd}(?=${Qr}))${Qr}`,yd=`${Qr}END \\1${Qr}`,mr="\\n",gd=`[^:${Xr}]+`,md=`(?:[^${Xr}]+${mr}(?: +[^${Xr}]+${mr})*)`,bd=`(?:[a-zA-Z0-9=+/]+${mr})+`,uu=`${hd}${mr}(?:((?:${gd}: ${md})+))?${mr}?(${bd})${yd}`;class $e{static isPem(e){return typeof e=="string"&&new RegExp(uu,"g").test(e)}static decodeWithHeaders(e){e=e.replace(/\r/g,"");const t=new RegExp(uu,"g"),i=[];let n=null;for(;n=t.exec(e);){const s=n[3].replace(new RegExp(`[${Xr}]+`,"g"),""),c={type:n[1],headers:[],rawData:M.FromBase64(s)},u=n[2];if(u){const f=u.split(new RegExp(mr,"g"));let d=null;for(const b of f){const[y,W]=b.split(/:(.*)/);if(W===void 0){if(!d)throw new Error("Cannot parse PEM string. Incorrect header value");d.value+=y.trim()}else d&&c.headers.push(d),d={key:y,value:W.trim()}}d&&c.headers.push(d)}i.push(c)}return i}static decode(e){return this.decodeWithHeaders(e).map(i=>i.rawData)}static decodeFirst(e){const t=this.decode(e);if(!t.length)throw new RangeError("PEM string doesn't contain any objects");return t[0]}static encode(e,t){if(Array.isArray(e)){const i=new Array;return t?e.forEach(n=>{if(!_.isBufferSource(n))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:_.toArrayBuffer(n)}))}):e.forEach(n=>{if(!("type"in n))throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");i.push(this.encodeStruct(n))}),i.join(`
|
|
116
116
|
`)}else{if(!t)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:t,rawData:_.toArrayBuffer(e)})}}static encodeStruct(e){var t;const i=e.type.toLocaleUpperCase(),n=[];if(n.push(`-----BEGIN ${i}-----`),!((t=e.headers)===null||t===void 0)&&t.length){for(const d of e.headers)n.push(`${d.key}: ${d.value}`);n.push("")}const s=M.ToBase64(e.rawData);let c,u=0;const f=Array();for(;u<s.length&&(s.length-u<64?c=s.substring(u):(c=s.substring(u,u+64),u+=64),c.length!==0);)if(f.push(c),c.length<64)break;return n.push(...f),n.push(`-----END ${i}-----`),n.join(`
|
|
117
|
-
`)}}$e.CertificateTag="CERTIFICATE",$e.CrlTag="CRL",$e.CertificateRequestTag="CERTIFICATE REQUEST",$e.PublicKeyTag="PUBLIC KEY",$e.PrivateKeyTag="PRIVATE KEY";class vt extends Ct{static isAsnEncoded(e){return _.isBufferSource(e)||typeof e=="string"}static toArrayBuffer(e){if(typeof e=="string"){if($e.isPem(e))return $e.decode(e)[0];if(M.isHex(e))return M.FromHex(e);if(M.isBase64(e))return M.FromBase64(e);if(M.isBase64Url(e))return M.FromBase64Url(e);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}else{const t=M.ToBinary(e);return $e.isPem(t)?$e.decode(t)[0]:M.isHex(t)?M.FromHex(t):M.isBase64(t)?M.FromBase64(t):M.isBase64Url(t)?M.FromBase64Url(t):_.toArrayBuffer(e)}}constructor(...e){vt.isAsnEncoded(e[0])?super(vt.toArrayBuffer(e[0]),e[1]):super(e[0])}toString(e="pem"){switch(e){case"pem":return $e.encode(this.rawData,this.tag);default:return super.toString(e)}}}class Kt extends vt{constructor(e){vt.isAsnEncoded(e)?super(e,yt):super(e),this.tag=$e.PublicKeyTag}async export(...e){let t,i=["verify"],n={hash:"SHA-256",...this.algorithm};return e.length>1?(n=e[0]||n,i=e[1]||i,t=e[2]||Me.get()):t=e[0]||Me.get(),t.subtle.importKey("spki",this.rawData,n,!0,i)}onInit(e){const t=Ke.resolve(xn),i=this.algorithm=t.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case hr:{const n=F.parse(e.subjectPublicKey,ps),s=_.toUint8Array(n.modulus);i.publicExponent=_.toUint8Array(n.publicExponent),i.modulusLength=(s[0]?s:s.slice(1)).byteLength<<3;break}}}async getThumbprint(...e){var t;let i,n="SHA-1";return e.length>=1&&!(!((t=e[0])===null||t===void 0)&&t.subtle)?(n=e[0]||n,i=e[1]||Me.get()):i=e[0]||Me.get(),await i.subtle.digest(n,this.rawData)}async getKeyIdentifier(e){e||(e=Me.get());const t=F.parse(this.rawData,yt);return await e.subtle.digest("SHA-1",t.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),t=F.parse(this.rawData,yt);switch(e.Algorithm=Lt.serializeAlgorithm(t.algorithm),t.algorithm.algorithm){case Kr:e["EC Point"]=t.subjectPublicKey;break;case hr:default:e["Raw Data"]=t.subjectPublicKey}return e}}class st{static register(e,t){this.items.set(e,t)}static create(e){const t=new ot(e),i=this.items.get(t.type);return i?new i(e):t}}st.items=new Map;const En="crypto.signatureFormatter";class bd{toAsnSignature(e,t){return _.toArrayBuffer(t)}toWebSignature(e,t){return _.toArrayBuffer(t)}}class In extends vt{constructor(e){vt.isAsnEncoded(e)?super(e,tr):super(e),this.tag=$e.CertificateTag}onInit(e){const t=e.tbsCertificate;this.tbs=F.serialize(t),this.serialNumber=M.ToHex(t.serialNumber),this.subjectName=new Bt(t.subject),this.subject=new Bt(t.subject).toString(),this.issuerName=new Bt(t.issuer),this.issuer=this.issuerName.toString();const i=Ke.resolve(xn);this.signatureAlgorithm=i.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signatureValue;const n=t.validity.notBefore.utcTime||t.validity.notBefore.generalTime;if(!n)throw new Error("Cannot get 'notBefore' value");this.notBefore=n;const s=t.validity.notAfter.utcTime||t.validity.notAfter.generalTime;if(!s)throw new Error("Cannot get 'notAfter' value");this.notAfter=s,this.extensions=[],t.extensions&&(this.extensions=t.extensions.map(c=>st.create(F.serialize(c)))),this.publicKey=new Kt(t.subjectPublicKeyInfo)}getExtension(e){for(const t of this.extensions)if(typeof e=="string"){if(t.type===e)return t}else if(t instanceof e)return t;return null}getExtensions(e){return this.extensions.filter(t=>typeof e=="string"?t.type===e:t instanceof e)}async verify(e={},t=Me.get()){let i,n;const s=e.publicKey;try{if(!s)i={...this.publicKey.algorithm,...this.signatureAlgorithm},n=await this.publicKey.export(i,["verify"],t);else if("publicKey"in s)i={...s.publicKey.algorithm,...this.signatureAlgorithm},n=await s.publicKey.export(i,["verify"],t);else if(s instanceof Kt)i={...s.algorithm,...this.signatureAlgorithm},n=await s.export(i,["verify"],t);else if(_.isBufferSource(s)){const d=new Kt(s);i={...d.algorithm,...this.signatureAlgorithm},n=await d.export(i,["verify"],t)}else i={...s.algorithm,...this.signatureAlgorithm},n=s}catch{return!1}const c=Ke.resolveAll(En).reverse();let u=null;for(const d of c)if(u=d.toWebSignature(i,this.signature),u)break;if(!u)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const f=await t.subtle.verify(this.signatureAlgorithm,n,u,this.tbs);if(e.signatureOnly)return f;{const v=(e.date||new Date).getTime();return f&&this.notBefore.getTime()<v&&v<this.notAfter.getTime()}}async getThumbprint(...e){let t,i="SHA-1";return e[0]&&(e[0].subtle?t=e[0]:(i=e[0]||i,t=e[1])),t??(t=Me.get()),await t.subtle.digest(i,this.rawData)}async isSelfSigned(e=Me.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){const e=this.toTextObjectEmpty(),t=F.parse(this.rawData,tr),i=t.tbsCertificate,n=new oe("",{Version:`${er[i.version]} (${i.version})`,"Serial Number":i.serialNumber,"Signature Algorithm":Lt.serializeAlgorithm(i.signature),Issuer:this.issuer,Validity:new oe("",{"Not Before":i.validity.notBefore.getTime(),"Not After":i.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(i.issuerUniqueID&&(n["Issuer Unique ID"]=i.issuerUniqueID),i.subjectUniqueID&&(n["Subject Unique ID"]=i.subjectUniqueID),this.extensions.length){const s=new oe("");for(const c of this.extensions){const u=c.toTextObject();s[u[oe.NAME]]=u}n.Extensions=s}return e.Data=n,e.Signature=new oe("",{Algorithm:Lt.serializeAlgorithm(t.signatureAlgorithm),"":t.signatureValue}),e}}In.NAME="Certificate";class ei extends ot{static async create(e,t=!1,i=Me.get()){if(e instanceof In||Ft.isCryptoKey(e)){const n=e instanceof In?await e.publicKey.export(i):e,s=await i.subtle.exportKey("spki",n),u=await new Kt(s).getKeyIdentifier(i);return new ei(M.ToHex(u),t)}else return new ei(e,t)}constructor(...e){if(_.isBufferSource(e[0]))super(e[0]);else if(typeof e[0]=="string"){const t=new Pt({keyIdentifier:new ao(M.FromHex(e[0]))});super(so,e[1],F.serialize(t))}else{const t=e[0],i=t.name instanceof Zr?F.parse(t.name.rawData,Ie):t.name,n=new Pt({authorityCertIssuer:i,authorityCertSerialNumber:M.FromHex(t.serialNumber)});super(so,e[1],F.serialize(n))}}onInit(e){super.onInit(e);const t=F.parse(e.extnValue,Pt);t.keyIdentifier&&(this.keyId=M.ToHex(t.keyIdentifier)),t.authorityCertIssuer&&t.authorityCertSerialNumber&&(this.certId={name:t.authorityCertIssuer,serialNumber:M.ToHex(t.authorityCertSerialNumber)})}toTextObject(){const e=this.toTextObjectWithoutValue(),t=F.parse(this.value,Pt);return t.authorityCertIssuer&&(e["Authority Issuer"]=new Zr(t.authorityCertIssuer).toTextObject()),t.authorityCertSerialNumber&&(e["Authority Serial Number"]=t.authorityCertSerialNumber),t.keyIdentifier&&(e[""]=t.keyIdentifier),e}}ei.NAME="Authority Key Identifier";class fu extends ot{constructor(...e){if(_.isBufferSource(e[0])){super(e[0]);const t=F.parse(this.value,Ei);this.ca=t.cA,this.pathLength=t.pathLenConstraint}else{const t=new Ei({cA:e[0],pathLenConstraint:e[1]});super(dc,e[2],F.serialize(t)),this.ca=e[0],this.pathLength=e[1]}}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ca&&(e.CA=this.ca),this.pathLength!==void 0&&(e["Path Length"]=this.pathLength),e}}fu.NAME="Basic Constraints";var du;(function(r){r.serverAuth="1.3.6.1.5.5.7.3.1",r.clientAuth="1.3.6.1.5.5.7.3.2",r.codeSigning="1.3.6.1.5.5.7.3.3",r.emailProtection="1.3.6.1.5.5.7.3.4",r.timeStamping="1.3.6.1.5.5.7.3.8",r.ocspSigning="1.3.6.1.5.5.7.3.9"})(du||(du={}));class pu extends ot{constructor(...e){if(_.isBufferSource(e[0])){super(e[0]);const t=F.parse(this.value,Vi);this.usages=t.map(i=>i)}else{const t=new Vi(e[0]);super(vc,e[1],F.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(t=>xt.toString(t)).join(", "),e}}pu.NAME="Extended Key Usages";var qs;(function(r){r[r.digitalSignature=1]="digitalSignature",r[r.nonRepudiation=2]="nonRepudiation",r[r.keyEncipherment=4]="keyEncipherment",r[r.dataEncipherment=8]="dataEncipherment",r[r.keyAgreement=16]="keyAgreement",r[r.keyCertSign=32]="keyCertSign",r[r.cRLSign=64]="cRLSign",r[r.encipherOnly=128]="encipherOnly",r[r.decipherOnly=256]="decipherOnly"})(qs||(qs={}));class Gs extends ot{constructor(...e){if(_.isBufferSource(e[0])){super(e[0]);const t=F.parse(this.value,ko);this.usages=t.toNumber()}else{const t=new ko(e[0]);super(wc,e[1],F.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=F.parse(this.value,ko);return e[""]=t.toJSON().join(", "),e}}Gs.NAME="Key Usages";class Nn extends ot{static async create(e,t=!1,i=Me.get()){let n;e instanceof Kt?n=e.rawData:"publicKey"in e?n=e.publicKey.rawData:_.isBufferSource(e)?n=e:n=await i.subtle.exportKey("spki",e);const c=await new Kt(n).getKeyIdentifier(i);return new Nn(M.ToHex(c),t)}constructor(...e){if(_.isBufferSource(e[0])){super(e[0]);const t=F.parse(this.value,At);this.keyId=M.ToHex(t)}else{const t=typeof e[0]=="string"?M.FromHex(e[0]):e[0],i=new At(t);super(Bc,e[1],F.serialize(i)),this.keyId=M.ToHex(t)}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=F.parse(this.value,At);return e[""]=t,e}}Nn.NAME="Subject Key Identifier";class zs extends ot{constructor(...e){_.isBufferSource(e[0])?super(e[0]):super(xc,e[1],new Zr(e[0]||[]).rawData)}onInit(e){super.onInit(e);const t=F.parse(e.extnValue,Io);this.names=new Zr(t)}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.names.toTextObject();for(const i in t)e[i]=t[i];return e}}zs.NAME="Subject Alternative Name";class hu extends ot{constructor(...e){var t;if(_.isBufferSource(e[0])){super(e[0]);const i=F.parse(this.value,Oi);this.policies=i.map(n=>n.policyIdentifier)}else{const i=e[0],n=(t=e[1])!==null&&t!==void 0?t:!1,s=new Oi(i.map(c=>new Ni({policyIdentifier:c})));super(hc,n,F.serialize(s)),this.policies=i}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(t=>new oe("",{},xt.toString(t))),e}}hu.NAME="Certificate Policies",st.register(hc,hu);class vr extends Ct{constructor(...e){let t;if(_.isBufferSource(e[0]))t=_.toArrayBuffer(e[0]);else{const i=e[0],n=Array.isArray(e[1])?e[1].map(s=>_.toArrayBuffer(s)):[];t=F.serialize(new ht({type:i,values:n}))}super(t,ht)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Value=this.values.map(t=>new oe("",{"":t})),e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty();return e[oe.NAME]===vr.NAME&&(e[oe.NAME]=xt.toString(this.type)),e}}vr.NAME="Attribute";class yu extends vr{constructor(...e){var t;if(_.isBufferSource(e[0]))super(e[0]);else{const i=new Sn({printableString:e[0]});super(dl,[F.serialize(i)])}(t=this.password)!==null&&t!==void 0||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){const t=F.parse(this.values[0],Sn);this.password=t.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[oe.VALUE]=this.password,e}}yu.NAME="Challenge Password";class Ws extends vr{constructor(...e){var t;if(_.isBufferSource(e[0]))super(e[0]);else{const i=e[0],n=new Dt;for(const s of i)n.push(F.parse(s.rawData,Je));super(Ns,[F.serialize(n)])}(t=this.items)!==null&&t!==void 0||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){const t=F.parse(this.values[0],Dt);this.items=t.map(i=>st.create(F.serialize(i)))}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.items.map(i=>i.toTextObject());for(const i of t)e[i[oe.NAME]]=i;return e}}Ws.NAME="Extensions";class On{static register(e,t){this.items.set(e,t)}static create(e){const t=new vr(e),i=this.items.get(t.type);return i?new i(e):t}}On.items=new Map;let Js=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if("hash"in e){let t;if(typeof e.hash=="string")t=e.hash;else if(e.hash&&typeof e.hash=="object"&&"name"in e.hash&&typeof e.hash.name=="string")t=e.hash.name.toUpperCase();else throw new Error("Cannot get hash algorithm name");switch(t.toLowerCase()){case"sha-1":return new U({algorithm:on,parameters:null});case"sha-256":return new U({algorithm:ls,parameters:null});case"sha-384":return new U({algorithm:sn,parameters:null});case"sha-512":return new U({algorithm:an,parameters:null})}}else return new U({algorithm:hr,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case hr:return{name:"RSASSA-PKCS1-v1_5"};case on:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case ls:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case sn:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case an:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}}}return null}};Js=a([bs()],Js),Ke.registerSingleton(kn,Js);class qe{addPadding(e,t){const i=_.toUint8Array(t),n=new Uint8Array(e);return n.set(i,e-i.length),n}removePadding(e,t=!1){let i=_.toUint8Array(e);for(let n=0;n<i.length;n++)if(i[n]){i=i.slice(n);break}if(t&&i[0]>127){const n=new Uint8Array(i.length+1);return n.set(i,1),n.buffer}return i.buffer}toAsnSignature(e,t){if(e.name==="ECDSA"){const i=e.namedCurve,n=qe.namedCurveSize.get(i)||qe.defaultNamedCurveSize,s=new nn,c=_.toUint8Array(t);return s.r=this.removePadding(c.slice(0,n),!0),s.s=this.removePadding(c.slice(n,n+n),!0),F.serialize(s)}return null}toWebSignature(e,t){if(e.name==="ECDSA"){const i=F.parse(t,nn),n=e.namedCurve,s=qe.namedCurveSize.get(n)||qe.defaultNamedCurveSize,c=this.addPadding(s,this.removePadding(i.r)),u=this.addPadding(s,this.removePadding(i.s));return ju(c,u)}return null}}qe.namedCurveSize=new Map,qe.defaultNamedCurveSize=32;const gu="1.3.101.110",mu="1.3.101.111",vu="1.3.101.112",bu="1.3.101.113";let Ys=class{toAsnAlgorithm(e){let t=null;switch(e.name.toLowerCase()){case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":t=vu;break;case"ed448":t=bu;break}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":t=gu;break;case"x448":t=mu;break}}return t?new U({algorithm:t}):null}toWebAlgorithm(e){switch(e.algorithm){case vu:return{name:"EdDSA",namedCurve:"Ed25519"};case bu:return{name:"EdDSA",namedCurve:"Ed448"};case gu:return{name:"ECDH-ES",namedCurve:"X25519"};case mu:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};Ys=a([bs()],Ys),Ke.registerSingleton(kn,Ys);class wd extends vt{constructor(e){vt.isAsnEncoded(e)?super(e,Jr):super(e),this.tag=$e.CertificateRequestTag}onInit(e){this.tbs=F.serialize(e.certificationRequestInfo),this.publicKey=new Kt(e.certificationRequestInfo.subjectPKInfo);const t=Ke.resolve(xn);this.signatureAlgorithm=t.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signature,this.attributes=e.certificationRequestInfo.attributes.map(n=>On.create(F.serialize(n)));const i=this.getAttribute(Ns);this.extensions=[],i instanceof Ws&&(this.extensions=i.items),this.subjectName=new Bt(e.certificationRequestInfo.subject),this.subject=this.subjectName.toString()}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=Me.get()){const t={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(t,["verify"],e),n=Ke.resolveAll(En).reverse();let s=null;for(const u of n)if(s=u.toWebSignature(t,this.signature),s)break;if(!s)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await e.subtle.verify(this.signatureAlgorithm,i,s,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),t=F.parse(this.rawData,Jr),i=t.certificationRequestInfo,n=new oe("",{Version:`${er[i.version]} (${i.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const s=new oe("");for(const c of this.attributes){const u=c.toTextObject();s[u[oe.NAME]]=u}n.Attributes=s}return e.Data=n,e.Signature=new oe("",{Algorithm:Lt.serializeAlgorithm(t.signatureAlgorithm),"":t.signature}),e}}wd.NAME="PKCS#10 Certificate Request";var wu;(function(r){r[r.unspecified=0]="unspecified",r[r.keyCompromise=1]="keyCompromise",r[r.cACompromise=2]="cACompromise",r[r.affiliationChanged=3]="affiliationChanged",r[r.superseded=4]="superseded",r[r.cessationOfOperation=5]="cessationOfOperation",r[r.certificateHold=6]="certificateHold",r[r.removeFromCRL=8]="removeFromCRL",r[r.privilegeWithdrawn=9]="privilegeWithdrawn",r[r.aACompromise=10]="aACompromise"})(wu||(wu={})),st.register(dc,fu),st.register(vc,pu),st.register(wc,Gs),st.register(Bc,Nn),st.register(so,ei),st.register(xc,zs),On.register(dl,yu),On.register(Ns,Ws),Ke.registerSingleton(En,bd),Ke.registerSingleton(En,qe),qe.namedCurveSize.set("P-256",32),qe.namedCurveSize.set("K-256",32),qe.namedCurveSize.set("P-384",48),qe.namedCurveSize.set("P-521",66);function Su(){return{parseMetaCertificateData:e=>{if(/{vault:\/\/.*}/g.test(e))throw new Error("not a X.509 certificate");const t=new In(e),i={subject:t.subjectName.toString(),issuer:t.issuer,notAfter:t.notAfter};for(const n of t.extensions)if(n instanceof zs){const s=n.names.toJSON(),u=Object.entries(s).map(f=>({type:f[1].type,value:f[1].value})).reduce((f,d)=>{const v=d.type,y=f[v]??[];return{...f,[v]:[...y,d.value]}},{});for(const f in u)i.subjectAltName=`${f}=${u[f].join(", ")}`}else if(n instanceof Gs){const s=Object.values(qs),c=Array(s.length/2).fill(null).reduce((u,f,d)=>{const v=s[s.length/2+d];if(n.usages&v){const y=s[d];u.push(y)}return u},[]);i.keyUsage=c}return i}}}function Sd(){const r=Su(),e=o.ref({}),t=n=>{if(!(n.id in e.value))try{e.value[n.id]=r.parseMetaCertificateData(n.cert)}catch{e.value[n.id]=void 0}return e.value[n.id]};return{certificateDataCache:e,getCertificateData:n=>{const s=t(n);return{schemaIssuer:(s==null?void 0:s.issuer)||"",schemaSubject:(s==null?void 0:s.subject)||"",schemaExpiry:(s==null?void 0:s.notAfter)instanceof Date?s.notAfter.getTime()/1e3:0,schemaSanNames:(s==null?void 0:s.subjectAltName)||"",schemaKeyUsages:(s==null?void 0:s.keyUsage)||[]}}}}const Ad={certificates:{title:"Certificates",list:{toolbar_actions:{new_certificate:"New Certificate"},table_headers:{subject:"Subject",expiry:"Expiry",san:"SAN",cert:"Cert",tags:"Tags",issuer:"Issuer",snis:"SNIs"},empty_state:{title:"Configure a New Certificate",description:"Certificates handle SSL/TLS termination for encrypted requests."}},form:{sections:{ssl:{title:"SSL Key Pair",description:"The PEM-encoded public certificate chain and private key of the SSL key pair and the alternate."},general:{title:"General Information",description:"General information will help identify and manage this key."}},fields:{cert:{label:"Cert",tooltip:"PEM-encoded public certificate chain of the SSL key pair. This field is {emphasis}, which means it can be securely stored as a secret in a vault. References must follow a specific format.",emphasis:"referenceable"},key:{label:"Key",tooltip:"PEM-encoded private key of the SSL key pair. This field is {emphasis}, which means it can be securely stored as a secret in a vault. References must follow a specific format.",emphasis:"referenceable"},cert_alt:{label:"Cert Alt",tooltip:"PEM-encoded public certificate chain of the alternate SSL key pair. This should only be set if you have both RSA and ECDSA types of certificate available and would like Kong to prefer serving using ECDSA certs when client advertises support for it. This field is {emphasis}, which means it can be securely stored as a secret in a vault. References must follow a specific format.",emphasis:"referenceable"},key_alt:{label:"Key Alt",tooltip:"PEM-encoded private key of the alternate SSL key pair. This should only be set if you have both RSA and ECDSA types of certificate available and would like Kong to prefer serving using ECDSA certs when client advertises support for it. This field is {emphasis}, which means it can be securely stored as a secret in a vault. References must follow a specific format.",emphasis:"referenceable"},snis:{label:"SNIs",placeholder:"Enter an SNI",add:"Add an SNI",tooltip:"Zero or more hostnames to associate with this certificate as SNIs",editingTip:"To manage SNIs for this certificate, click {link}.",editingTipLink:"here"},tags:{label:"Tags",placeholder:"Enter a list of tags separated by comma",help:"e.g. tag1, tag2, tag3",tooltip:"An optional set of strings for grouping and filtering, separated by commas."}}},actions:{create:"New Certificate",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",addSni:"Add to New SNI",delete:"Delete",clear:"Clear",view:"View Details"},search:{placeholder:"Filter by exact ID"},delete:{title:"Delete a Certificate",description:"Your organization's original certificate {bolded-text}.",boldedText:"will not be affected",description2:"This action cannot be reversed so make sure to check the certificate usage before deleting."},errors:{general:"Certificates could not be retrieved",delete:"The certificate could not be deleted at this time",copy:"Failed to copy to clipboard"},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard"}},"ca-certificates":{title:"CA Certificates",list:{toolbar_actions:{new_ca_certificate:"New CA Certificate"},table_headers:{issuer:"Issuer",expiry:"Expiry",tags:"Tags"},empty_state:{title:"Configure a New CA Certificate",description:"CA certificates validate client or server certificates."}},form:{sections:{cert:{title:"Public Certificate",description:"The PEM-encoded public certificate of the CA and it’s SHA256 hex digest."},general:{title:"General Information",description:"General information will help identify and manage this key."}},fields:{cert:{label:"Cert",tooltip:"PEM-encoded public certificate of the CA."},cert_digest:{label:"Cert Digest",tooltip:"SHA256 hex digest of the public certificate"},tags:{label:"Tags",placeholder:"Enter a list of tags separated by comma",help:"e.g. tag1, tag2, tag3",tooltip:"An optional set of strings for grouping and filtering, separated by commas."}}},actions:{create:"New CA Certificate",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",delete:"Delete",clear:"Clear",view:"View Details"},search:{placeholder:"Filter by exact ID"},delete:{title:"Delete a CA Certificate",description:"Your organization's original certificate {bolded-text}.",boldedText:"will not be affected",description2:"This action cannot be reversed so make sure to check the certificate usage before deleting."},errors:{general:"CA Certificates could not be retrieved",delete:"The CA Certificate could not be deleted at this time",copy:"Failed to copy to clipboard"},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard"}},general:{"key-usages":{KEY_USAGE_TYPE_KEY_CERT_SIGN:"keyCertSign",KEY_USAGE_TYPE_CRL_SIGN:"cRLSign",KEY_USAGE_TYPE_ENCIPHER_ONLY:"encipherOnly",KEY_USAGE_TYPE_DIGITAL_SIGNATURE:"digitalSignature",KEY_USAGE_TYPE_KEY_ENCIPHERMENT:"keyEncipherment",KEY_USAGE_TYPE_DATA_ENCIPHERMENT:"dataEncipherment",KEY_USAGE_TYPE_KEY_AGREEMENT:"keyAgreement",KEY_USAGE_TYPE_CONTENT_COMMITMENT:"nonRepudiation"}}};function kd(){const r=ea.createI18n("en-us",Ad);return{i18n:r,i18nT:ea.i18nTComponent(r)}}const Ze={useCertificate:Sd,useI18n:kd,useX509:Su},Tn="/v2/control-planes/{controlPlaneId}/core-entities",Vn="/{workspace}",ti={list:{konnect:`${Tn}/certificates`,kongManager:`${Vn}/certificates`},form:{konnect:{create:`${Tn}/certificates`,edit:`${Tn}/certificates/{id}`,validate:`${Tn}/v1/schemas/json/certificate/validate`},kongManager:{create:`${Vn}/certificates`,edit:`${Vn}/certificates/{id}`,validate:`${Vn}/schemas/certificates/validate`}}},xd={class:"kong-ui-entities-certificates-list"},Cd={key:0},Bd={key:1},Ed={key:0},Id={key:1},Nd={key:0},Od={key:1},Td={key:1},Vd={key:1},_d=o.defineComponent({__name:"CertificateList",props:{config:{type:Object,required:!0,validator:r=>!(!r||!["konnect","kongManager"].includes(r==null?void 0:r.app)||!r.createRoute||!r.getViewRoute||!r.getEditRoute||r.app==="kongManager"&&!r.isExactMatch&&!r.filterSchema)},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canCreateSni:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},canRetrieve:{type:Function,required:!1,default:async()=>!0},useActionOutside:{type:Boolean,default:!1}},emits:["error","copy:success","copy:error","delete:success"],setup(r,{emit:e}){var J;const t=e,i=r,{i18n:{t:n,formatUnixTimeStamp:s},i18nT:c}=Ze.useI18n(),u=ni.useRouter(),{axiosInstance:f}=T.useAxios((J=i.config)==null?void 0:J.axiosRequestConfig),d=o.ref(1),v=o.computed(()=>i.config.app!=="kongManager"||!!i.config.disableSorting),z={subject:{label:n("certificates.list.table_headers.subject"),hidable:!1},expiry:{label:n("certificates.list.table_headers.expiry")},san:{label:n("certificates.list.table_headers.san")},cert:{label:n("certificates.list.table_headers.cert")},tags:{label:n("certificates.list.table_headers.tags"),sortable:!0}},O=o.computed(()=>{var H,ae;let R=`${i.config.apiBaseUrl}${ti.list[i.config.app]}`;return i.config.app==="konnect"?R=R.replace(/{controlPlaneId}/gi,((H=i.config)==null?void 0:H.controlPlaneId)||""):i.config.app==="kongManager"&&(R=R.replace(/\/{workspace}/gi,(ae=i.config)!=null&&ae.workspace?`/${i.config.workspace}`:"")),R}),p=o.ref(""),m=o.computed(()=>{const R=i.config.app==="konnect"||i.config.isExactMatch;return R?{isExactMatch:R,placeholder:n("certificates.search.placeholder")}:{isExactMatch:R,schema:i.config.filterSchema}}),{fetcher:S,fetcherState:w}=T.useFetcher(i.config,O.value),I=()=>{p.value=""},k=()=>{d.value++},B=o.ref(null),Z=(R,H)=>{const ae=R.id;if(!H(ae)){t("copy:error",{entity:R,field:"id",message:n("certificates.errors.copy")});return}t("copy:success",{entity:R,field:"id",message:n("certificates.copy.success",{val:ae})})},se=(R,H)=>{const ae=JSON.stringify(R);if(!H(ae)){t("copy:error",{entity:R,message:n("certificates.errors.copy")});return}t("copy:success",{entity:R,message:n("certificates.copy.success_brief")})},D=async R=>{var ae;await((ae=i.canRetrieve)==null?void 0:ae.call(i,R))&&u.push(i.config.getViewRoute(R.id))},C=R=>({label:n("certificates.actions.view"),to:i.config.getViewRoute(R)}),j=R=>({label:n("certificates.actions.edit"),to:i.config.getEditRoute(R)}),de=R=>{if(i.config.getCreateSniRoute)return{label:n("certificates.actions.addSni"),to:i.config.getCreateSniRoute(R)}},re=o.ref(void 0),Be=o.ref(!1),ce=o.ref(!1),pe=o.ref(""),at=T.useDeleteUrlBuilder(i.config,O.value),{certificateDataCache:ee,getCertificateData:bt}=Ze.useCertificate(),br=R=>{re.value=R,Be.value=!0},wr=()=>{Be.value=!1},Gt=async()=>{var R,H,ae;if((R=re.value)!=null&&R.id){ce.value=!0;try{await f.delete(at(re.value.id)),ce.value=!1,Be.value=!1,d.value++,t("delete:success",re.value)}catch(Ne){pe.value=((ae=(H=Ne.response)==null?void 0:H.data)==null?void 0:ae.message)||Ne.message||n("certificates.errors.delete"),t("error",Ne)}finally{ce.value=!1}}},wt=o.ref(!1);o.watch(w,R=>{var H,ae,Ne,Ue;if(Array.isArray((H=R==null?void 0:R.response)==null?void 0:H.data)&&(wt.value=R.response.data.length>0),R.status===T.FetcherStatus.Error){B.value={title:n("certificates.errors.general")},(Ue=(Ne=(ae=R.error)==null?void 0:ae.response)==null?void 0:Ne.data)!=null&&Ue.message&&(B.value.message=R.error.response.data.message),t("error",R.error);return}ee.value={},B.value=null});const W=o.ref({ctaPath:i.config.createRoute,ctaText:void 0,message:`${n("certificates.list.empty_state.description")}${i.config.additionMessageForEmptyState?` ${i.config.additionMessageForEmptyState}`:""}`,title:n("certificates.title")});return o.onBeforeMount(async()=>{await i.canCreate()&&(W.value.title=n("certificates.list.empty_state.title"),W.value.ctaText=n("certificates.actions.create"))}),(R,H)=>{const ae=o.resolveComponent("KButton"),Ne=o.resolveComponent("KCopy"),Ue=o.resolveComponent("KBadge"),Sr=o.resolveComponent("KTruncate"),Y=o.resolveComponent("KDropdownItem"),ve=o.resolveComponent("KClipboardProvider");return o.openBlock(),o.createElementBlock("div",xd,[o.createVNode(o.unref(T.EntityBaseTable),{"cache-identifier":r.cacheIdentifier,"disable-pagination-page-jump":"","disable-sorting":v.value,"empty-state-options":W.value,"enable-entity-actions":"","error-message":B.value,fetcher:o.unref(S),"fetcher-cache-key":d.value,"pagination-type":"offset","preferences-storage-key":"kong-ui-entities-certificates-list",query:p.value,"table-headers":o.unref(z),"use-action-outside":r.useActionOutside,onClearSearchInput:I,"onClick:row":H[2]||(H[2]=q=>D(q)),onSort:k},{"toolbar-filter":o.withCtx(()=>[o.createVNode(o.unref(T.EntityFilter),{modelValue:p.value,"onUpdate:modelValue":H[0]||(H[0]=q=>p.value=q),config:m.value},null,8,["modelValue","config"])]),"toolbar-button":o.withCtx(()=>[(o.openBlock(),o.createBlock(o.Teleport,{disabled:!r.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[o.createVNode(o.unref(T.PermissionsWrapper),{"auth-function":()=>r.canCreate()},{default:o.withCtx(()=>[o.withDirectives(o.createVNode(ae,{appearance:"primary","data-testid":"toolbar-add-certificate",size:"large",to:r.config.createRoute},{default:o.withCtx(()=>[o.createVNode(o.unref(oi.AddIcon)),o.createTextVNode(" "+o.toDisplayString(o.unref(n)("certificates.list.toolbar_actions.new_certificate")),1)]),_:1},8,["to"]),[[o.vShow,wt.value]])]),_:1},8,["auth-function"])],8,["disabled"]))]),subject:o.withCtx(({row:q})=>{var be;return[r.config.app==="konnect"?(o.openBlock(),o.createElementBlock("b",Cd,o.toDisplayString((be=q==null?void 0:q.metadata)!=null&&be.subject?q.metadata.subject:"-"),1)):(o.openBlock(),o.createElementBlock("b",Bd,o.toDisplayString(o.unref(bt)(q).schemaSubject||"-"),1))]}),expiry:o.withCtx(({row:q})=>{var be;return[r.config.app==="konnect"?(o.openBlock(),o.createElementBlock("span",Ed,o.toDisplayString((be=q==null?void 0:q.metadata)!=null&&be.expiry?o.unref(s)(q.metadata.expiry):"-"),1)):(o.openBlock(),o.createElementBlock("span",Id,o.toDisplayString(o.unref(bt)(q).schemaExpiry?o.unref(s)(o.unref(bt)(q).schemaExpiry):"-"),1))]}),san:o.withCtx(({row:q})=>{var be;return[r.config.app==="konnect"?(o.openBlock(),o.createElementBlock("span",Nd,o.toDisplayString((be=q==null?void 0:q.metadata)!=null&&be.dns_names?`dns=${q.metadata.dns_names.join(", ")}`:"-"),1)):(o.openBlock(),o.createElementBlock("span",Od,o.toDisplayString(o.unref(bt)(q).schemaSanNames||"-"),1))]}),cert:o.withCtx(({row:q})=>[q!=null&&q.cert?(o.openBlock(),o.createBlock(Ne,{key:0,"data-testid":"copy-certificate-cert",text:q.cert,truncate:""},null,8,["text"])):(o.openBlock(),o.createElementBlock("span",Td,"-"))]),tags:o.withCtx(({row:q})=>{var be;return[((be=q==null?void 0:q.tags)==null?void 0:be.length)>0?(o.openBlock(),o.createBlock(Sr,{key:0},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(q==null?void 0:q.tags,Ar=>(o.openBlock(),o.createBlock(Ue,{key:Ar,onClick:H[1]||(H[1]=o.withModifiers(()=>{},["stop"]))},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(Ar),1)]),_:2},1024))),128))]),_:2},1024)):(o.openBlock(),o.createElementBlock("span",Vd,"-"))]}),actions:o.withCtx(({row:q})=>[o.createVNode(ve,null,{default:o.withCtx(({copyToClipboard:be})=>[o.createVNode(Y,{"data-testid":"action-entity-copy-id",onClick:Ar=>Z(q,be)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("certificates.actions.copy_id")),1)]),_:2},1032,["onClick"])]),_:2},1024),o.createVNode(ve,null,{default:o.withCtx(({copyToClipboard:be})=>[o.createVNode(Y,{"data-testid":"action-entity-copy-json",onClick:Ar=>se(q,be)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("certificates.actions.copy_json")),1)]),_:2},1032,["onClick"])]),_:2},1024),o.createVNode(o.unref(T.PermissionsWrapper),{"auth-function":()=>r.canRetrieve(q)},{default:o.withCtx(()=>[o.createVNode(Y,{"data-testid":"action-entity-view","has-divider":"",item:C(q.id)},null,8,["item"])]),_:2},1032,["auth-function"]),o.createVNode(o.unref(T.PermissionsWrapper),{"auth-function":()=>r.canEdit(q)},{default:o.withCtx(()=>[o.createVNode(Y,{"data-testid":"action-entity-edit",item:j(q.id)},null,8,["item"])]),_:2},1032,["auth-function"]),r.config.getCreateSniRoute?(o.openBlock(),o.createBlock(o.unref(T.PermissionsWrapper),{key:0,"auth-function":()=>r.canCreateSni()},{default:o.withCtx(()=>[o.createVNode(Y,{"data-testid":"action-entity-add-sni",item:de(q.id)},null,8,["item"])]),_:2},1032,["auth-function"])):o.createCommentVNode("",!0),o.createVNode(o.unref(T.PermissionsWrapper),{"auth-function":()=>r.canDelete(q)},{default:o.withCtx(()=>[o.createVNode(Y,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:be=>br(q)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("certificates.actions.delete")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"])]),_:1},8,["cache-identifier","disable-sorting","empty-state-options","error-message","fetcher","fetcher-cache-key","query","table-headers","use-action-outside"]),o.createVNode(o.unref(T.EntityDeleteModal),{"action-pending":ce.value,"entity-type":o.unref(T.EntityTypes).Certificate,error:pe.value,title:o.unref(n)("certificates.delete.title"),visible:Be.value,onCancel:wr,onProceed:Gt},{description:o.withCtx(()=>[o.createVNode(o.unref(c),{keypath:"certificates.delete.description",scope:"global"},{"bolded-text":o.withCtx(()=>[o.createElementVNode("b",null,o.toDisplayString(o.unref(n)("certificates.delete.boldedText")),1)]),_:1}),o.createElementVNode("p",null,o.toDisplayString(o.unref(n)("certificates.delete.description2")),1)]),_:1},8,["action-pending","entity-type","error","title","visible"])])}}}),qt=(r,e)=>{const t=r.__vccOpts||r;for(const[i,n]of e)t[i]=n;return t},jd=qt(_d,[["__scopeId","data-v-8059a087"]]),Pd="#d60027",Dd={class:"sni-field-container"},Rd={key:1,class:"sni-field-controls-container"},Md={key:0},$d=qt(o.defineComponent({__name:"CertificateFormSniField",props:{isEditing:{type:Boolean,default:!1},modelValue:{type:Array,required:!0},sniListRoute:{type:Object,required:!0}},emits:["add","remove","update:modelValue"],setup(r,{emit:e}){const t=r,i=e,{i18nT:n,i18n:{t:s}}=Ze.useI18n(),c=o.ref([]);return o.watch(t.modelValue,u=>{c.value=[...u]},{immediate:!0,deep:!0}),o.watch(c,u=>{i("update:modelValue",u)},{deep:!0}),(u,f)=>{const d=o.resolveComponent("KLabel"),v=o.resolveComponent("KInput"),y=o.resolveComponent("KButton"),z=o.resolveComponent("router-link");return o.openBlock(),o.createElementBlock("div",Dd,[o.createVNode(d,{info:o.unref(s)("certificates.form.fields.snis.tooltip")},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s)("certificates.form.fields.snis.label")),1)]),_:1},8,["info"]),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(c.value,(O,p)=>(o.openBlock(),o.createElementBlock("div",{key:p,class:"sni-field-input"},[!r.isEditing||c.value[p]?(o.openBlock(),o.createBlock(v,{key:0,modelValue:c.value[p],"onUpdate:modelValue":m=>c.value[p]=m,modelModifiers:{trim:!0},"data-testid":`sni-field-input-${p+1}`,disabled:r.isEditing,placeholder:o.unref(s)("certificates.form.fields.snis.placeholder")},null,8,["modelValue","onUpdate:modelValue","data-testid","disabled","placeholder"])):o.createCommentVNode("",!0),r.isEditing?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Rd,[o.createVNode(y,{appearance:"tertiary",class:"remove-button","data-testid":"remove-sni",icon:"",onClick:m=>u.$emit("remove",p)},{default:o.withCtx(()=>[o.createVNode(o.unref(oi.TrashIcon),{color:o.unref(Pd)},null,8,["color"])]),_:2},1032,["onClick"]),o.createVNode(y,{appearance:"tertiary","data-testid":"add-sni",disabled:p!==c.value.length-1,icon:"",onClick:f[0]||(f[0]=m=>u.$emit("add"))},{default:o.withCtx(()=>[o.createVNode(o.unref(oi.AddIcon))]),_:2},1032,["disabled"])]))]))),128)),c.value.length===0?(o.openBlock(),o.createElementBlock("div",Md,[o.createVNode(y,{onClick:f[1]||(f[1]=O=>u.$emit("add"))},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s)("certificates.form.fields.snis.add")),1)]),_:1})])):o.createCommentVNode("",!0),r.isEditing?(o.openBlock(),o.createBlock(o.unref(n),{key:1,keypath:"certificates.form.fields.snis.editingTip"},{link:o.withCtx(()=>[o.createVNode(z,{to:r.sniListRoute},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s)("certificates.form.fields.snis.editingTipLink")),1)]),_:1},8,["to"])]),_:1})):o.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-543a45f0"]]),Ud={class:"kong-ui-entities-certificates-form"},Hd=qt(o.defineComponent({__name:"CertificateForm",props:{config:{type:Object,required:!0,validator:r=>!(!r||!["konnect","kongManager"].includes(r==null?void 0:r.app)||r.app==="konnect"&&!r.controlPlaneId||r.app==="kongManager"&&typeof r.workspace!="string"||!r.cancelRoute)},certificateId:{type:String,required:!1,default:""},showSnisField:{type:Boolean,required:!1,default:!1},enableTerraform:{type:Boolean,default:!1}},emits:["update","error","loading"],setup(r,{emit:e}){var se;const t=e,i=r,n=ni.useRouter(),{i18nT:s,i18n:{t:c}}=Ze.useI18n(),{getMessageFromError:u}=T.useErrors(),{axiosInstance:f}=T.useAxios((se=i.config)==null?void 0:se.axiosRequestConfig),d=o.computed(()=>ti.form[i.config.app].edit),v=o.computed(()=>i.certificateId?T.EntityBaseFormType.Edit:T.EntityBaseFormType.Create),y=o.reactive({fields:{cert:"",key:"",certAlt:"",keyAlt:"",snis:[""],tags:""},isReadonly:!1,errorMessage:""}),z=o.reactive({cert:"",key:"",certAlt:"",keyAlt:"",snis:[""],tags:""}),O=o.computed(()=>(v.value===T.EntityBaseFormType.Create||JSON.stringify(y.fields)!==JSON.stringify(z))&&!!y.fields.cert&&!!y.fields.key),p=D=>{var C,j;y.fields.cert=(D==null?void 0:D.cert)||"",y.fields.key=(D==null?void 0:D.key)||"",y.fields.certAlt=(D==null?void 0:D.cert_alt)||"",y.fields.keyAlt=(D==null?void 0:D.key_alt)||"",y.fields.snis=(C=D==null?void 0:D.snis)!=null&&C.length?D.snis:[""],y.fields.tags=((j=D==null?void 0:D.tags)==null?void 0:j.join(", "))||"",Object.assign(z,y.fields)},m=()=>{n.push(i.config.cancelRoute)},S=()=>{y.fields.snis.push("")},w=D=>{y.fields.snis.splice(D,1)},I=o.computed(()=>{var C,j;let D=`${i.config.apiBaseUrl}${ti.form[i.config.app].validate}`;return i.config.app==="konnect"?D=D.replace(/{controlPlaneId}/gi,((C=i.config)==null?void 0:C.controlPlaneId)||""):i.config.app==="kongManager"&&(D=D.replace(/\/{workspace}/gi,(j=i.config)!=null&&j.workspace?`/${i.config.workspace}`:"")),D=D.replace(/{id}/gi,i.certificateId),D}),k=o.computed(()=>{var C,j;let D=`${i.config.apiBaseUrl}${ti.form[i.config.app][v.value]}`;return i.config.app==="konnect"?D=D.replace(/{controlPlaneId}/gi,((C=i.config)==null?void 0:C.controlPlaneId)||""):i.config.app==="kongManager"&&(D=D.replace(/\/{workspace}/gi,(j=i.config)!=null&&j.workspace?`/${i.config.workspace}`:"")),D=D.replace(/{id}/gi,i.certificateId),D}),B=o.computed(()=>{var D,C;return{cert:y.fields.cert,key:y.fields.key,cert_alt:y.fields.certAlt||null,key_alt:y.fields.keyAlt||null,...i.showSnisField?{snis:y.fields.snis.filter(Boolean)}:{},tags:(C=(D=y.fields.tags.split(","))==null?void 0:D.map(j=>String(j||"").trim()))==null?void 0:C.filter(j=>j!=="")}}),Z=async()=>{var D,C,j,de,re,Be,ce,pe,at;try{y.isReadonly=!0;let ee;await f.post(I.value,B.value),v.value==="create"?ee=await f.post(k.value,B.value):v.value==="edit"&&(ee=((D=i.config)==null?void 0:D.app)==="konnect"?await f.put(k.value,B.value):await f.patch(k.value,B.value)),y.fields.cert=((C=ee==null?void 0:ee.data)==null?void 0:C.cert)||"",y.fields.key=((j=ee==null?void 0:ee.data)==null?void 0:j.key)||"",y.fields.certAlt=((de=ee==null?void 0:ee.data)==null?void 0:de.cert_alt)||"",y.fields.keyAlt=((re=ee==null?void 0:ee.data)==null?void 0:re.key_alt)||"",y.fields.snis=(ce=(Be=ee==null?void 0:ee.data)==null?void 0:Be.snis)!=null&&ce.length?ee.data.snis:[""],y.fields.tags=((at=(pe=ee==null?void 0:ee.data)==null?void 0:pe.tags)==null?void 0:at.join(", "))||"",Object.assign(z,y.fields),t("update",ee==null?void 0:ee.data)}catch(ee){y.errorMessage=u(ee),t("error",ee)}finally{y.isReadonly=!1}};return(D,C)=>{const j=o.resolveComponent("KTextArea"),de=o.resolveComponent("KInput");return o.openBlock(),o.createElementBlock("div",Ud,[o.createVNode(o.unref(T.EntityBaseForm),{"can-submit":O.value,config:r.config,"edit-id":r.certificateId,"enable-terraform":r.enableTerraform,"entity-type":o.unref(T.SupportedEntityType).Certificate,"error-message":y.errorMessage,"fetch-url":d.value,"form-fields":B.value,"is-readonly":y.isReadonly,onCancel:m,"onFetch:error":C[7]||(C[7]=re=>D.$emit("error",re)),"onFetch:success":p,onLoading:C[8]||(C[8]=re=>D.$emit("loading",re)),onSubmit:Z},{default:o.withCtx(()=>[o.createVNode(o.unref(T.EntityFormSection),{description:o.unref(c)("certificates.form.sections.ssl.description"),title:o.unref(c)("certificates.form.sections.ssl.title")},{default:o.withCtx(()=>[o.createVNode(j,{modelValue:y.fields.cert,"onUpdate:modelValue":C[0]||(C[0]=re=>y.fields.cert=re),modelModifiers:{trim:!0},"character-limit":!1,class:"certificate-form-textarea","data-testid":"certificate-form-cert",label:o.unref(c)("certificates.form.fields.cert.label"),readonly:y.isReadonly,required:""},{"label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(s),{keypath:"certificates.form.fields.cert.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("em",null,o.toDisplayString(o.unref(c)("certificates.form.fields.cert.emphasis")),1)]),_:1})]),_:1},8,["modelValue","label","readonly"]),o.createVNode(j,{modelValue:y.fields.key,"onUpdate:modelValue":C[1]||(C[1]=re=>y.fields.key=re),modelModifiers:{trim:!0},"character-limit":!1,class:"certificate-form-textarea","data-testid":"certificate-form-key",label:o.unref(c)("certificates.form.fields.key.label"),readonly:y.isReadonly,required:""},{"label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(s),{keypath:"certificates.form.fields.key.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("em",null,o.toDisplayString(o.unref(c)("certificates.form.fields.key.emphasis")),1)]),_:1})]),_:1},8,["modelValue","label","readonly"]),o.createVNode(j,{modelValue:y.fields.certAlt,"onUpdate:modelValue":C[2]||(C[2]=re=>y.fields.certAlt=re),modelModifiers:{trim:!0},"character-limit":!1,class:"certificate-form-textarea","data-testid":"certificate-form-cert-alt",label:o.unref(c)("certificates.form.fields.cert_alt.label"),readonly:y.isReadonly},{"label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(s),{keypath:"certificates.form.fields.cert_alt.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("em",null,o.toDisplayString(o.unref(c)("certificates.form.fields.cert_alt.emphasis")),1)]),_:1})]),_:1},8,["modelValue","label","readonly"]),o.createVNode(j,{modelValue:y.fields.keyAlt,"onUpdate:modelValue":C[3]||(C[3]=re=>y.fields.keyAlt=re),modelModifiers:{trim:!0},"character-limit":!1,class:"certificate-form-textarea","data-testid":"certificate-form-key-alt",label:o.unref(c)("certificates.form.fields.key_alt.label"),readonly:y.isReadonly},{"label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(s),{keypath:"certificates.form.fields.key_alt.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("em",null,o.toDisplayString(o.unref(c)("certificates.form.fields.key_alt.emphasis")),1)]),_:1})]),_:1},8,["modelValue","label","readonly"]),r.showSnisField&&r.config.sniListRoute?(o.openBlock(),o.createBlock($d,{key:0,modelValue:y.fields.snis,"onUpdate:modelValue":C[4]||(C[4]=re=>y.fields.snis=re),"is-editing":v.value===o.unref(T.EntityBaseFormType).Edit,"sni-list-route":r.config.sniListRoute,onAdd:S,onRemove:C[5]||(C[5]=re=>w(re))},null,8,["modelValue","is-editing","sni-list-route"])):o.createCommentVNode("",!0)]),_:1},8,["description","title"]),o.createVNode(o.unref(T.EntityFormSection),{description:o.unref(c)("certificates.form.sections.general.description"),title:o.unref(c)("certificates.form.sections.general.title")},{default:o.withCtx(()=>[o.createVNode(de,{modelValue:y.fields.tags,"onUpdate:modelValue":C[6]||(C[6]=re=>y.fields.tags=re),modelModifiers:{trim:!0},autocomplete:"off","data-testid":"certificate-form-tags",help:o.unref(c)("certificates.form.fields.tags.help"),label:o.unref(c)("certificates.form.fields.tags.label"),"label-attributes":{info:o.unref(c)("certificates.form.fields.tags.tooltip")},placeholder:o.unref(c)("certificates.form.fields.tags.placeholder"),readonly:y.isReadonly,type:"text"},null,8,["modelValue","help","label","label-attributes","placeholder","readonly"])]),_:1},8,["description","title"])]),_:1},8,["can-submit","config","edit-id","enable-terraform","entity-type","error-message","fetch-url","form-fields","is-readonly"])])}}}),[["__scopeId","data-v-1f98afe8"]]),_n="/v2/control-planes/{controlPlaneId}/core-entities",jn="/{workspace}",ri={list:{konnect:`${_n}/ca_certificates`,kongManager:`${jn}/ca_certificates`},form:{konnect:{create:`${_n}/ca_certificates`,edit:`${_n}/ca_certificates/{id}`,validate:`${_n}/v1/schemas/json/ca-certificate/validate`},kongManager:{create:`${jn}/ca_certificates`,edit:`${jn}/ca_certificates/{id}`,validate:`${jn}/schemas/ca_certificates/validate`}}},Ld={class:"kong-ui-ca-certificate-entity-config-card"},Fd={key:0},Kd=qt(o.defineComponent({__name:"CACertificateConfigCard",props:{config:{type:Object,required:!0,validator:r=>!(!r||!["konnect","kongManager"].includes(r==null?void 0:r.app)||r.app==="konnect"&&!r.controlPlaneId||r.app==="kongManager"&&typeof r.workspace!="string"||!r.entityId)},configCardDoc:{type:String,default:"",required:!1},hideTitle:{type:Boolean,default:!1},enableTerraform:{type:Boolean,default:!1}},emits:["loading","fetch:error","fetch:success"],setup(r,{emit:e}){const t=["dns_names","san_names","subject"],i=e,n=r,{i18n:{t:s,formatUnixTimeStamp:c}}=Ze.useI18n(),{convertKeyToTitle:u}=T.useStringHelpers(),{getPropValue:f}=T.useHelpers(),{getCertificateData:d}=Ze.useCertificate(),v=o.computed(()=>ri.form[n.config.app].edit),y=o.ref(),z=o.computed(()=>{if(y.value)return d(y.value)}),O=o.computed(()=>{var k;return((k=z.value)==null?void 0:k.schemaIssuer)||""}),p=o.computed(()=>{var k,B;return(k=z.value)!=null&&k.schemaExpiry?c((B=z.value)==null?void 0:B.schemaExpiry):""}),m=o.computed(()=>{var k;return((k=z.value)==null?void 0:k.schemaKeyUsages)||[]}),S=(k,B)=>{const Z=f("rowValue",B);if(k==="expiry")return p.value;if(k==="key_usages")return m.value;if(Z)return Z[k]},w=k=>{y.value=k,i("fetch:success",k)},I=o.ref({id:{},updated_at:{},created_at:{},cert:{section:T.ConfigurationSchemaSection.Basic,label:s("ca-certificates.form.fields.cert.label"),tooltip:s("ca-certificates.form.fields.cert.tooltip"),order:5},cert_digest:{section:T.ConfigurationSchemaSection.Basic,label:s("ca-certificates.form.fields.cert_digest.label"),tooltip:s("ca-certificates.form.fields.cert_digest.tooltip"),order:6},metadata:{section:T.ConfigurationSchemaSection.Basic,type:T.ConfigurationSchemaType.Json,order:7},...n.config.app==="kongManager"&&{expiry:{label:s("certificates.list.table_headers.expiry"),section:T.ConfigurationSchemaSection.Basic,order:1.7,forceShow:!0},issuer:{section:T.ConfigurationSchemaSection.Basic,order:1.5,forceShow:!0},key_usages:{section:T.ConfigurationSchemaSection.Basic,forceShow:!0}},tags:{tooltip:s("ca-certificates.form.fields.tags.tooltip")}});return(k,B)=>{const Z=o.resolveComponent("KCodeBlock"),se=o.resolveComponent("KLabel"),D=o.resolveComponent("KBadge");return o.openBlock(),o.createElementBlock("div",Ld,[o.createVNode(o.unref(T.EntityBaseConfigCard),{config:r.config,"config-card-doc":r.configCardDoc,"config-schema":I.value,"enable-terraform":r.enableTerraform,"entity-type":o.unref(T.SupportedEntityType).CaCertificate,"fetch-url":v.value,"hide-title":r.hideTitle,"onFetch:error":B[0]||(B[0]=C=>k.$emit("fetch:error",C)),"onFetch:success":w,onLoading:B[1]||(B[1]=C=>k.$emit("loading",C))},{cert:o.withCtx(C=>[o.unref(f)("rowValue",C)?(o.openBlock(),o.createBlock(Z,{key:0,id:`ca-cert-${r.config.entityId}-cert-codeblock`,code:o.unref(f)("rowValue",C),language:"plaintext","single-line":""},null,8,["id","code"])):o.createCommentVNode("",!0)]),"metadata-label":o.withCtx(()=>[o.createVNode(se,{class:"metadata-label"},{default:o.withCtx(()=>[o.createTextVNode(" Metadata ")]),_:1})]),metadata:o.withCtx(C=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Object.keys(o.unref(f)("rowValue",C)).filter(j=>!t.includes(j)),j=>(o.openBlock(),o.createBlock(o.unref(T.ConfigCardItem),{key:j,"data-testid":`ca-cert-metadata-${j}`,item:{key:j,label:o.unref(u)(j),value:S(j,C),type:j==="key_usages"?o.unref(T.ConfigurationSchemaType).BadgeTag:o.unref(T.ConfigurationSchemaType).Text}},null,8,["data-testid","item"]))),128))]),expiry:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(p.value||"–"),1)]),issuer:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.value||"–"),1)]),key_usages:o.withCtx(()=>[m.value.length?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Fd,o.toDisplayString("–"))),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(m.value,(C,j)=>(o.openBlock(),o.createBlock(D,{key:`key_usages-badge-tag-${j}`,class:"config-badge","data-testid":`key_usages-badge-tag-${j}`,tooltip:C,"truncation-tooltip":""},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(C),1)]),_:2},1032,["data-testid","tooltip"]))),128))]),_:1},8,["config","config-card-doc","config-schema","enable-terraform","entity-type","fetch-url","hide-title"])])}}}),[["__scopeId","data-v-46ffa2f8"]]),qd={class:"kong-ui-entities-ca-certificates-list"},Gd={key:0},zd={key:1},Wd={key:0},Jd={key:1},Yd={key:1},Zd=qt(o.defineComponent({__name:"CACertificateList",props:{config:{type:Object,required:!0,validator:r=>!(!r||!["konnect","kongManager"].includes(r==null?void 0:r.app)||!r.createRoute||!r.getViewRoute||!r.getEditRoute||r.app==="kongManager"&&!r.isExactMatch&&!r.filterSchema)},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},canRetrieve:{type:Function,required:!1,default:async()=>!0},useActionOutside:{type:Boolean,default:!1}},emits:["error","copy:success","copy:error","delete:success"],setup(r,{emit:e}){var W;const t=e,i=r,{i18n:{t:n,formatUnixTimeStamp:s},i18nT:c}=Ze.useI18n(),u=ni.useRouter(),{axiosInstance:f}=T.useAxios((W=i.config)==null?void 0:W.axiosRequestConfig),d=o.ref(1),v=o.computed(()=>i.config.app!=="kongManager"||!!i.config.disableSorting),z={issuer:{label:n("ca-certificates.list.table_headers.issuer"),hidable:!1},expiry:{label:n("ca-certificates.list.table_headers.expiry")},tags:{label:n("ca-certificates.list.table_headers.tags"),sortable:!0}},O=o.computed(()=>{var R,H;let J=`${i.config.apiBaseUrl}${ri.list[i.config.app]}`;return i.config.app==="konnect"?J=J.replace(/{controlPlaneId}/gi,((R=i.config)==null?void 0:R.controlPlaneId)||""):i.config.app==="kongManager"&&(J=J.replace(/\/{workspace}/gi,(H=i.config)!=null&&H.workspace?`/${i.config.workspace}`:"")),J}),p=o.ref(""),m=o.computed(()=>{const J=i.config.app==="konnect"||i.config.isExactMatch;return J?{isExactMatch:J,placeholder:n("ca-certificates.search.placeholder")}:{isExactMatch:J,schema:i.config.filterSchema}}),{fetcher:S,fetcherState:w}=T.useFetcher(i.config,O.value),I=()=>{p.value=""},k=()=>{d.value++},B=o.ref(null),Z=(J,R)=>{const H=J.id;if(!R(H)){t("copy:error",{entity:J,field:"id",message:n("ca-certificates.errors.copy")});return}t("copy:success",{entity:J,field:"id",message:n("ca-certificates.copy.success",{val:H})})},se=(J,R)=>{const H=JSON.stringify(J);if(!R(H)){t("copy:error",{entity:J,message:n("ca-certificates.errors.copy")});return}t("copy:success",{entity:J,message:n("ca-certificates.copy.success_brief")})},D=async J=>{var H;await((H=i.canRetrieve)==null?void 0:H.call(i,J))&&u.push(i.config.getViewRoute(J.id))},C=J=>({label:n("ca-certificates.actions.view"),to:i.config.getViewRoute(J)}),j=J=>({label:n("ca-certificates.actions.edit"),to:i.config.getEditRoute(J)}),de=o.ref(void 0),re=o.ref(!1),Be=o.ref(!1),ce=o.ref(""),pe=T.useDeleteUrlBuilder(i.config,O.value),{certificateDataCache:at,getCertificateData:ee}=Ze.useCertificate(),bt=J=>{de.value=J,re.value=!0},br=()=>{re.value=!1},wr=async()=>{var J,R,H;if((J=de.value)!=null&&J.id){Be.value=!0;try{await f.delete(pe(de.value.id)),Be.value=!1,re.value=!1,d.value++,t("delete:success",de.value)}catch(ae){ce.value=((H=(R=ae.response)==null?void 0:R.data)==null?void 0:H.message)||ae.message||n("ca-certificates.errors.delete"),t("error",ae)}finally{Be.value=!1}}},Gt=o.ref(!1);o.watch(w,J=>{var R,H,ae,Ne;if(Array.isArray((R=J==null?void 0:J.response)==null?void 0:R.data)&&(Gt.value=J.response.data.length>0),J.status===T.FetcherStatus.Error){B.value={title:n("ca-certificates.errors.general")},(Ne=(ae=(H=J.error)==null?void 0:H.response)==null?void 0:ae.data)!=null&&Ne.message&&(B.value.message=J.error.response.data.message),t("error",J.error);return}at.value={},B.value=null});const wt=o.ref({ctaPath:i.config.createRoute,ctaText:void 0,message:`${n("ca-certificates.list.empty_state.description")}${i.config.additionMessageForEmptyState?` ${i.config.additionMessageForEmptyState}`:""}`,title:n("ca-certificates.title")});return o.onBeforeMount(async()=>{await i.canCreate()&&(wt.value.title=n("ca-certificates.list.empty_state.title"),wt.value.ctaText=n("ca-certificates.actions.create"))}),(J,R)=>{const H=o.resolveComponent("KButton"),ae=o.resolveComponent("KBadge"),Ne=o.resolveComponent("KTruncate"),Ue=o.resolveComponent("KDropdownItem"),Sr=o.resolveComponent("KClipboardProvider");return o.openBlock(),o.createElementBlock("div",qd,[o.createVNode(o.unref(T.EntityBaseTable),{"cache-identifier":r.cacheIdentifier,"disable-pagination-page-jump":"","disable-sorting":v.value,"empty-state-options":wt.value,"enable-entity-actions":"","error-message":B.value,fetcher:o.unref(S),"fetcher-cache-key":d.value,"pagination-type":"offset","preferences-storage-key":"kong-ui-entities-ca-certificates-list",query:p.value,"table-headers":o.unref(z),"use-action-outside":r.useActionOutside,onClearSearchInput:I,"onClick:row":R[2]||(R[2]=Y=>D(Y)),onSort:k},{"toolbar-filter":o.withCtx(()=>[o.createVNode(o.unref(T.EntityFilter),{modelValue:p.value,"onUpdate:modelValue":R[0]||(R[0]=Y=>p.value=Y),config:m.value},null,8,["modelValue","config"])]),"toolbar-button":o.withCtx(()=>[(o.openBlock(),o.createBlock(o.Teleport,{disabled:!r.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[o.createVNode(o.unref(T.PermissionsWrapper),{"auth-function":()=>r.canCreate()},{default:o.withCtx(()=>[o.withDirectives(o.createVNode(H,{appearance:"primary","data-testid":"toolbar-add-ca-certificate",size:"large",to:r.config.createRoute},{default:o.withCtx(()=>[o.createVNode(o.unref(oi.AddIcon)),o.createTextVNode(" "+o.toDisplayString(o.unref(n)("ca-certificates.list.toolbar_actions.new_ca_certificate")),1)]),_:1},8,["to"]),[[o.vShow,Gt.value]])]),_:1},8,["auth-function"])],8,["disabled"]))]),issuer:o.withCtx(({row:Y})=>{var ve;return[r.config.app==="konnect"?(o.openBlock(),o.createElementBlock("b",Gd,o.toDisplayString((ve=Y==null?void 0:Y.metadata)!=null&&ve.issuer?Y.metadata.issuer:"-"),1)):(o.openBlock(),o.createElementBlock("b",zd,o.toDisplayString(o.unref(ee)(Y).schemaIssuer||"-"),1))]}),expiry:o.withCtx(({row:Y})=>{var ve;return[r.config.app==="konnect"?(o.openBlock(),o.createElementBlock("span",Wd,o.toDisplayString((ve=Y==null?void 0:Y.metadata)!=null&&ve.expiry?o.unref(s)(Y.metadata.expiry):"-"),1)):(o.openBlock(),o.createElementBlock("span",Jd,o.toDisplayString(o.unref(ee)(Y).schemaExpiry?o.unref(s)(o.unref(ee)(Y).schemaExpiry):"-"),1))]}),tags:o.withCtx(({row:Y})=>{var ve;return[((ve=Y==null?void 0:Y.tags)==null?void 0:ve.length)>0?(o.openBlock(),o.createBlock(Ne,{key:0},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Y==null?void 0:Y.tags,q=>(o.openBlock(),o.createBlock(ae,{key:q,onClick:R[1]||(R[1]=o.withModifiers(()=>{},["stop"]))},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(q),1)]),_:2},1024))),128))]),_:2},1024)):(o.openBlock(),o.createElementBlock("span",Yd,"-"))]}),actions:o.withCtx(({row:Y})=>[o.createVNode(Sr,null,{default:o.withCtx(({copyToClipboard:ve})=>[o.createVNode(Ue,{"data-testid":"action-entity-copy-id",onClick:q=>Z(Y,ve)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("ca-certificates.actions.copy_id")),1)]),_:2},1032,["onClick"])]),_:2},1024),o.createVNode(Sr,null,{default:o.withCtx(({copyToClipboard:ve})=>[o.createVNode(Ue,{"data-testid":"action-entity-copy-json",onClick:q=>se(Y,ve)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("ca-certificates.actions.copy_json")),1)]),_:2},1032,["onClick"])]),_:2},1024),o.createVNode(o.unref(T.PermissionsWrapper),{"auth-function":()=>r.canRetrieve(Y)},{default:o.withCtx(()=>[o.createVNode(Ue,{"data-testid":"action-entity-view","has-divider":"",item:C(Y.id)},null,8,["item"])]),_:2},1032,["auth-function"]),o.createVNode(o.unref(T.PermissionsWrapper),{"auth-function":()=>r.canEdit(Y)},{default:o.withCtx(()=>[o.createVNode(Ue,{"data-testid":"action-entity-edit",item:j(Y.id)},null,8,["item"])]),_:2},1032,["auth-function"]),o.createVNode(o.unref(T.PermissionsWrapper),{"auth-function":()=>r.canDelete(Y)},{default:o.withCtx(()=>[o.createVNode(Ue,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:ve=>bt(Y)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("ca-certificates.actions.delete")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"])]),_:1},8,["cache-identifier","disable-sorting","empty-state-options","error-message","fetcher","fetcher-cache-key","query","table-headers","use-action-outside"]),o.createVNode(o.unref(T.EntityDeleteModal),{"action-pending":Be.value,"entity-type":o.unref(T.EntityTypes).CACertificate,error:ce.value,title:o.unref(n)("ca-certificates.delete.title"),visible:re.value,onCancel:br,onProceed:wr},{description:o.withCtx(()=>[o.createVNode(o.unref(c),{keypath:"ca-certificates.delete.description",scope:"global"},{"bolded-text":o.withCtx(()=>[o.createElementVNode("b",null,o.toDisplayString(o.unref(n)("ca-certificates.delete.boldedText")),1)]),_:1}),o.createElementVNode("p",null,o.toDisplayString(o.unref(n)("ca-certificates.delete.description2")),1)]),_:1},8,["action-pending","entity-type","error","title","visible"])])}}}),[["__scopeId","data-v-8620b081"]]),Qd={class:"kong-ui-entities-ca-certificates-form"},Xd=qt(o.defineComponent({__name:"CACertificateForm",props:{config:{type:Object,required:!0,validator:r=>!(!r||!["konnect","kongManager"].includes(r==null?void 0:r.app)||r.app==="konnect"&&!r.controlPlaneId||r.app==="kongManager"&&typeof r.workspace!="string"||!r.cancelRoute)},certificateId:{type:String,required:!1,default:""},enableTerraform:{type:Boolean,default:!1}},emits:["update","error","loading"],setup(r,{emit:e}){var k;const t=e,i=r,n=ni.useRouter(),{i18n:{t:s}}=Ze.useI18n(),{getMessageFromError:c}=T.useErrors(),{axiosInstance:u}=T.useAxios((k=i.config)==null?void 0:k.axiosRequestConfig),f=o.computed(()=>ri.form[i.config.app].edit),d=o.computed(()=>i.certificateId?T.EntityBaseFormType.Edit:T.EntityBaseFormType.Create),v=o.reactive({fields:{cert:"",certDigest:"",tags:""},isReadonly:!1,errorMessage:""}),y=o.reactive({cert:"",certDigest:"",tags:""}),z=o.computed(()=>(d.value===T.EntityBaseFormType.Create||JSON.stringify(v.fields)!==JSON.stringify(y))&&!!v.fields.cert),O=B=>{var Z;v.fields.cert=(B==null?void 0:B.cert)||"",v.fields.certDigest=(B==null?void 0:B.cert_digest)||"",v.fields.tags=((Z=B==null?void 0:B.tags)==null?void 0:Z.join(", "))||"",Object.assign(y,v.fields)},p=()=>{n.push(i.config.cancelRoute)},m=o.computed(()=>{var Z,se;let B=`${i.config.apiBaseUrl}${ri.form[i.config.app].validate}`;return i.config.app==="konnect"?B=B.replace(/{controlPlaneId}/gi,((Z=i.config)==null?void 0:Z.controlPlaneId)||""):i.config.app==="kongManager"&&(B=B.replace(/\/{workspace}/gi,(se=i.config)!=null&&se.workspace?`/${i.config.workspace}`:"")),B=B.replace(/{id}/gi,i.certificateId),B}),S=o.computed(()=>{var Z,se;let B=`${i.config.apiBaseUrl}${ri.form[i.config.app][d.value]}`;return i.config.app==="konnect"?B=B.replace(/{controlPlaneId}/gi,((Z=i.config)==null?void 0:Z.controlPlaneId)||""):i.config.app==="kongManager"&&(B=B.replace(/\/{workspace}/gi,(se=i.config)!=null&&se.workspace?`/${i.config.workspace}`:"")),B=B.replace(/{id}/gi,i.certificateId),B}),w=o.computed(()=>{var B,Z;return{cert:v.fields.cert,cert_digest:v.fields.certDigest||null,tags:(Z=(B=v.fields.tags.split(","))==null?void 0:B.map(se=>String(se||"").trim()))==null?void 0:Z.filter(se=>se!=="")}}),I=async()=>{var B,Z,se,D,C;try{v.isReadonly=!0;let j;await u.post(m.value,w.value),d.value==="create"?j=await u.post(S.value,w.value):d.value==="edit"&&(j=((B=i.config)==null?void 0:B.app)==="konnect"?await u.put(S.value,w.value):await u.patch(S.value,w.value)),v.fields.cert=((Z=j==null?void 0:j.data)==null?void 0:Z.cert)||"",v.fields.certDigest=((se=j==null?void 0:j.data)==null?void 0:se.cert_digest)||"",v.fields.tags=((C=(D=j==null?void 0:j.data)==null?void 0:D.tags)==null?void 0:C.join(", "))||"",Object.assign(y,v.fields),t("update",j==null?void 0:j.data)}catch(j){v.errorMessage=c(j),t("error",j)}finally{v.isReadonly=!1}};return(B,Z)=>{const se=o.resolveComponent("KTextArea"),D=o.resolveComponent("KInput");return o.openBlock(),o.createElementBlock("div",Qd,[o.createVNode(o.unref(T.EntityBaseForm),{"can-submit":z.value,config:r.config,"edit-id":r.certificateId,"enable-terraform":r.enableTerraform,"entity-type":o.unref(T.SupportedEntityType).CaCertificate,"error-message":v.errorMessage,"fetch-url":f.value,"form-fields":w.value,"is-readonly":v.isReadonly,onCancel:p,"onFetch:error":Z[3]||(Z[3]=C=>B.$emit("error",C)),"onFetch:success":O,onLoading:Z[4]||(Z[4]=C=>B.$emit("loading",C)),onSubmit:I},{default:o.withCtx(()=>[o.createVNode(o.unref(T.EntityFormSection),{description:o.unref(s)("ca-certificates.form.sections.cert.description"),title:o.unref(s)("ca-certificates.form.sections.cert.title")},{default:o.withCtx(()=>[o.createVNode(se,{modelValue:v.fields.cert,"onUpdate:modelValue":Z[0]||(Z[0]=C=>v.fields.cert=C),modelModifiers:{trim:!0},"character-limit":!1,class:"certificate-form-textarea","data-testid":"ca-certificate-form-cert",label:o.unref(s)("ca-certificates.form.fields.cert.label"),"label-attributes":{info:o.unref(s)("ca-certificates.form.fields.cert.tooltip")},readonly:v.isReadonly,required:""},null,8,["modelValue","label","label-attributes","readonly"]),o.createVNode(D,{modelValue:v.fields.certDigest,"onUpdate:modelValue":Z[1]||(Z[1]=C=>v.fields.certDigest=C),modelModifiers:{trim:!0},autocomplete:"off","data-testid":"ca-certificate-form-cert-digest",label:o.unref(s)("ca-certificates.form.fields.cert_digest.label"),readonly:v.isReadonly,type:"text"},null,8,["modelValue","label","readonly"])]),_:1},8,["description","title"]),o.createVNode(o.unref(T.EntityFormSection),{description:o.unref(s)("ca-certificates.form.sections.general.description"),title:o.unref(s)("ca-certificates.form.sections.general.title")},{default:o.withCtx(()=>[o.createVNode(D,{modelValue:v.fields.tags,"onUpdate:modelValue":Z[2]||(Z[2]=C=>v.fields.tags=C),modelModifiers:{trim:!0},autocomplete:"off","data-testid":"ca-certificate-form-tags",help:o.unref(s)("ca-certificates.form.fields.tags.help"),label:o.unref(s)("ca-certificates.form.fields.tags.label"),"label-attributes":{info:o.unref(s)("ca-certificates.form.fields.tags.tooltip")},placeholder:o.unref(s)("ca-certificates.form.fields.tags.placeholder"),readonly:v.isReadonly,type:"text"},null,8,["modelValue","help","label","label-attributes","placeholder","readonly"])]),_:1},8,["description","title"])]),_:1},8,["can-submit","config","edit-id","enable-terraform","entity-type","error-message","fetch-url","form-fields","is-readonly"])])}}}),[["__scopeId","data-v-b74c6273"]]),ep={class:"kong-ui-certificate-entity-config-card"},tp={key:0},rp=qt(o.defineComponent({__name:"CertificateConfigCard",props:{config:{type:Object,required:!0,validator:r=>!(!r||!["konnect","kongManager"].includes(r==null?void 0:r.app)||r.app==="konnect"&&!r.controlPlaneId||r.app==="kongManager"&&typeof r.workspace!="string"||!r.entityId)},configCardDoc:{type:String,default:"",required:!1},hideTitle:{type:Boolean,default:!1},enableTerraform:{type:Boolean,default:!1}},emits:["loading","fetch:error","fetch:success"],setup(r,{emit:e}){const t=e,i=r,{i18n:{t:n,formatUnixTimeStamp:s},i18nT:c}=Ze.useI18n(),{convertKeyToTitle:u}=T.useStringHelpers(),{getPropValue:f}=T.useHelpers(),{getCertificateData:d}=Ze.useCertificate(),v=o.computed(()=>ti.form[i.config.app].edit),y=o.ref(),z=o.ref({id:{},cert:{section:T.ConfigurationSchemaSection.Basic},key:{section:T.ConfigurationSchemaSection.Basic,type:T.ConfigurationSchemaType.Redacted},metadata:{section:T.ConfigurationSchemaSection.Basic,type:T.ConfigurationSchemaType.Json},snis:{section:T.ConfigurationSchemaSection.Basic,type:T.ConfigurationSchemaType.BadgeTag,label:n("certificates.list.table_headers.snis")},updated_at:{},created_at:{},tags:{tooltip:n("certificates.form.fields.tags.tooltip")},...i.config.app==="kongManager"&&{expiry:{section:T.ConfigurationSchemaSection.Basic,label:n("certificates.list.table_headers.expiry"),forceShow:!0},issuer:{section:T.ConfigurationSchemaSection.Basic,label:n("certificates.list.table_headers.issuer"),forceShow:!0},san_names:{section:T.ConfigurationSchemaSection.Basic,label:n("certificates.list.table_headers.san"),forceShow:!0},subject:{section:T.ConfigurationSchemaSection.Basic,label:n("certificates.list.table_headers.subject"),forceShow:!0},key_usages:{forceShow:!0}},cert_alt:{section:T.ConfigurationSchemaSection.Advanced},key_alt:{section:T.ConfigurationSchemaSection.Advanced,type:T.ConfigurationSchemaType.Redacted}}),O=C=>{y.value=C,t("fetch:success",C)},p=(C,j)=>{const de=f("rowValue",j);if(C==="expiry")return S.value;if(C==="key_usages")return B.value;if(C==="san_names")return I.value;if(de)return de[C]},m=o.computed(()=>{if(y.value)return d(y.value)}),S=o.computed(()=>{var C,j;return(C=m.value)!=null&&C.schemaExpiry?s((j=m.value)==null?void 0:j.schemaExpiry):""}),w=o.computed(()=>{var C;return((C=m.value)==null?void 0:C.schemaIssuer)||""}),I=o.computed(()=>{var C;return((C=m.value)==null?void 0:C.schemaSanNames)||""}),k=o.computed(()=>{var C;return((C=m.value)==null?void 0:C.schemaSubject)||""}),B=o.computed(()=>{var C;return((C=m.value)==null?void 0:C.schemaKeyUsages)||[]}),Z=o.computed(()=>{var C,j;return((j=(C=y==null?void 0:y.value)==null?void 0:C.snis)==null?void 0:j.length)>0}),se=o.computed(()=>{var C;return!!((C=y==null?void 0:y.value)!=null&&C.cert_alt)}),D=C=>{var j,de;return C==="san_names"?n("certificates.list.table_headers.san"):((de=(j=z.value)==null?void 0:j[C])==null?void 0:de.label)||u(C)};return(C,j)=>{const de=o.resolveComponent("KCodeBlock"),re=o.resolveComponent("KLabel"),Be=o.resolveComponent("KBadge");return o.openBlock(),o.createElementBlock("div",ep,[o.createVNode(o.unref(T.EntityBaseConfigCard),{config:r.config,"config-card-doc":r.configCardDoc,"config-schema":z.value,"enable-terraform":r.enableTerraform,"entity-type":o.unref(T.SupportedEntityType).Certificate,"fetch-url":v.value,"hide-title":r.hideTitle,"onFetch:error":j[0]||(j[0]=ce=>C.$emit("fetch:error",ce)),"onFetch:success":O,onLoading:j[1]||(j[1]=ce=>C.$emit("loading",ce))},o.createSlots({"cert-label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(c),{keypath:"certificates.form.fields.cert.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("i",null,o.toDisplayString(o.unref(n)("certificates.form.fields.cert.emphasis")),1)]),_:1})]),cert:o.withCtx(ce=>[o.unref(f)("rowValue",ce)?(o.openBlock(),o.createBlock(de,{key:0,id:`certificate-${r.config.entityId}-cert-codeblock`,code:o.unref(f)("rowValue",ce),language:"plaintext","single-line":""},null,8,["id","code"])):o.createCommentVNode("",!0)]),"key-label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(c),{keypath:"certificates.form.fields.key.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("i",null,o.toDisplayString(o.unref(n)("certificates.form.fields.key.emphasis")),1)]),_:1})]),"metadata-label":o.withCtx(()=>[o.createVNode(re,{class:"metadata-label"},{default:o.withCtx(()=>[o.createTextVNode(" Metadata ")]),_:1})]),metadata:o.withCtx(ce=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Object.keys(o.unref(f)("rowValue",ce)),pe=>(o.openBlock(),o.createBlock(o.unref(T.ConfigCardItem),{key:pe,item:{key:pe,value:p(pe,ce),label:D(pe),type:pe==="key_usages"||pe==="snis"||pe==="dns_names"?o.unref(T.ConfigurationSchemaType).BadgeTag:o.unref(T.ConfigurationSchemaType).Text}},null,8,["item"]))),128))]),expiry:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(S.value||"–"),1)]),issuer:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(w.value||"–"),1)]),san_names:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(I.value||"–"),1)]),subject:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(k.value||"–"),1)]),"cert_alt-label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(c),{keypath:"certificates.form.fields.cert_alt.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("i",null,o.toDisplayString(o.unref(n)("certificates.form.fields.cert_alt.emphasis")),1)]),_:1})]),"key_alt-label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(c),{keypath:"certificates.form.fields.key_alt.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("i",null,o.toDisplayString(o.unref(n)("certificates.form.fields.key_alt.emphasis")),1)]),_:1})]),key_usages:o.withCtx(()=>[B.value.length?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",tp,o.toDisplayString("–"))),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(B.value,(ce,pe)=>(o.openBlock(),o.createBlock(Be,{key:`key_usages-badge-tag-${pe}`,class:"config-badge","data-testid":`key_usages-badge-tag-${pe}`,tooltip:ce,"truncation-tooltip":""},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(ce),1)]),_:2},1032,["data-testid","tooltip"]))),128))]),_:2},[Z.value?void 0:{name:"snis",fn:o.withCtx(()=>[o.createTextVNode(" – ")]),key:"0"},se.value?{name:"cert_alt",fn:o.withCtx(ce=>[o.createTextVNode(" > "),o.unref(f)("rowValue",ce)?(o.openBlock(),o.createBlock(de,{key:0,id:`certificate-${r.config.entityId}-cert-alt-codeblock`,code:o.unref(f)("rowValue",ce),language:"plaintext","single-line":""},null,8,["id","code"])):o.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["config","config-card-doc","config-schema","enable-terraform","entity-type","fetch-url","hide-title"])])}}}),[["__scopeId","data-v-c65f3278"]]);xe.CACertificateConfigCard=Kd,xe.CACertificateForm=Xd,xe.CACertificateList=Zd,xe.CertificateConfigCard=rp,xe.CertificateForm=Hd,xe.CertificateList=jd,Object.defineProperty(xe,Symbol.toStringTag,{value:"Module"})});
|
|
117
|
+
`)}}$e.CertificateTag="CERTIFICATE",$e.CrlTag="CRL",$e.CertificateRequestTag="CERTIFICATE REQUEST",$e.PublicKeyTag="PUBLIC KEY",$e.PrivateKeyTag="PRIVATE KEY";class bt extends Ct{static isAsnEncoded(e){return _.isBufferSource(e)||typeof e=="string"}static toArrayBuffer(e){if(typeof e=="string"){if($e.isPem(e))return $e.decode(e)[0];if(M.isHex(e))return M.FromHex(e);if(M.isBase64(e))return M.FromBase64(e);if(M.isBase64Url(e))return M.FromBase64Url(e);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}else{const t=M.ToBinary(e);return $e.isPem(t)?$e.decode(t)[0]:M.isHex(t)?M.FromHex(t):M.isBase64(t)?M.FromBase64(t):M.isBase64Url(t)?M.FromBase64Url(t):_.toArrayBuffer(e)}}constructor(...e){bt.isAsnEncoded(e[0])?super(bt.toArrayBuffer(e[0]),e[1]):super(e[0])}toString(e="pem"){switch(e){case"pem":return $e.encode(this.rawData,this.tag);default:return super.toString(e)}}}class Kt extends bt{constructor(e){bt.isAsnEncoded(e)?super(e,yt):super(e),this.tag=$e.PublicKeyTag}async export(...e){let t,i=["verify"],n={hash:"SHA-256",...this.algorithm};return e.length>1?(n=e[0]||n,i=e[1]||i,t=e[2]||Me.get()):t=e[0]||Me.get(),t.subtle.importKey("spki",this.rawData,n,!0,i)}onInit(e){const t=Ke.resolve(xn),i=this.algorithm=t.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case hr:{const n=F.parse(e.subjectPublicKey,ps),s=_.toUint8Array(n.modulus);i.publicExponent=_.toUint8Array(n.publicExponent),i.modulusLength=(s[0]?s:s.slice(1)).byteLength<<3;break}}}async getThumbprint(...e){var t;let i,n="SHA-1";return e.length>=1&&!(!((t=e[0])===null||t===void 0)&&t.subtle)?(n=e[0]||n,i=e[1]||Me.get()):i=e[0]||Me.get(),await i.subtle.digest(n,this.rawData)}async getKeyIdentifier(e){e||(e=Me.get());const t=F.parse(this.rawData,yt);return await e.subtle.digest("SHA-1",t.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),t=F.parse(this.rawData,yt);switch(e.Algorithm=Lt.serializeAlgorithm(t.algorithm),t.algorithm.algorithm){case Kr:e["EC Point"]=t.subjectPublicKey;break;case hr:default:e["Raw Data"]=t.subjectPublicKey}return e}}class st{static register(e,t){this.items.set(e,t)}static create(e){const t=new ot(e),i=this.items.get(t.type);return i?new i(e):t}}st.items=new Map;const En="crypto.signatureFormatter";class vd{toAsnSignature(e,t){return _.toArrayBuffer(t)}toWebSignature(e,t){return _.toArrayBuffer(t)}}class In extends bt{constructor(e){bt.isAsnEncoded(e)?super(e,tr):super(e),this.tag=$e.CertificateTag}onInit(e){const t=e.tbsCertificate;this.tbs=F.serialize(t),this.serialNumber=M.ToHex(t.serialNumber),this.subjectName=new Bt(t.subject),this.subject=new Bt(t.subject).toString(),this.issuerName=new Bt(t.issuer),this.issuer=this.issuerName.toString();const i=Ke.resolve(xn);this.signatureAlgorithm=i.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signatureValue;const n=t.validity.notBefore.utcTime||t.validity.notBefore.generalTime;if(!n)throw new Error("Cannot get 'notBefore' value");this.notBefore=n;const s=t.validity.notAfter.utcTime||t.validity.notAfter.generalTime;if(!s)throw new Error("Cannot get 'notAfter' value");this.notAfter=s,this.extensions=[],t.extensions&&(this.extensions=t.extensions.map(c=>st.create(F.serialize(c)))),this.publicKey=new Kt(t.subjectPublicKeyInfo)}getExtension(e){for(const t of this.extensions)if(typeof e=="string"){if(t.type===e)return t}else if(t instanceof e)return t;return null}getExtensions(e){return this.extensions.filter(t=>typeof e=="string"?t.type===e:t instanceof e)}async verify(e={},t=Me.get()){let i,n;const s=e.publicKey;try{if(!s)i={...this.publicKey.algorithm,...this.signatureAlgorithm},n=await this.publicKey.export(i,["verify"],t);else if("publicKey"in s)i={...s.publicKey.algorithm,...this.signatureAlgorithm},n=await s.publicKey.export(i,["verify"],t);else if(s instanceof Kt)i={...s.algorithm,...this.signatureAlgorithm},n=await s.export(i,["verify"],t);else if(_.isBufferSource(s)){const d=new Kt(s);i={...d.algorithm,...this.signatureAlgorithm},n=await d.export(i,["verify"],t)}else i={...s.algorithm,...this.signatureAlgorithm},n=s}catch{return!1}const c=Ke.resolveAll(En).reverse();let u=null;for(const d of c)if(u=d.toWebSignature(i,this.signature),u)break;if(!u)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const f=await t.subtle.verify(this.signatureAlgorithm,n,u,this.tbs);if(e.signatureOnly)return f;{const b=(e.date||new Date).getTime();return f&&this.notBefore.getTime()<b&&b<this.notAfter.getTime()}}async getThumbprint(...e){let t,i="SHA-1";return e[0]&&(e[0].subtle?t=e[0]:(i=e[0]||i,t=e[1])),t??(t=Me.get()),await t.subtle.digest(i,this.rawData)}async isSelfSigned(e=Me.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){const e=this.toTextObjectEmpty(),t=F.parse(this.rawData,tr),i=t.tbsCertificate,n=new oe("",{Version:`${er[i.version]} (${i.version})`,"Serial Number":i.serialNumber,"Signature Algorithm":Lt.serializeAlgorithm(i.signature),Issuer:this.issuer,Validity:new oe("",{"Not Before":i.validity.notBefore.getTime(),"Not After":i.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(i.issuerUniqueID&&(n["Issuer Unique ID"]=i.issuerUniqueID),i.subjectUniqueID&&(n["Subject Unique ID"]=i.subjectUniqueID),this.extensions.length){const s=new oe("");for(const c of this.extensions){const u=c.toTextObject();s[u[oe.NAME]]=u}n.Extensions=s}return e.Data=n,e.Signature=new oe("",{Algorithm:Lt.serializeAlgorithm(t.signatureAlgorithm),"":t.signatureValue}),e}}In.NAME="Certificate";class ei extends ot{static async create(e,t=!1,i=Me.get()){if(e instanceof In||Ft.isCryptoKey(e)){const n=e instanceof In?await e.publicKey.export(i):e,s=await i.subtle.exportKey("spki",n),u=await new Kt(s).getKeyIdentifier(i);return new ei(M.ToHex(u),t)}else return new ei(e,t)}constructor(...e){if(_.isBufferSource(e[0]))super(e[0]);else if(typeof e[0]=="string"){const t=new Pt({keyIdentifier:new ao(M.FromHex(e[0]))});super(so,e[1],F.serialize(t))}else{const t=e[0],i=t.name instanceof Zr?F.parse(t.name.rawData,Ie):t.name,n=new Pt({authorityCertIssuer:i,authorityCertSerialNumber:M.FromHex(t.serialNumber)});super(so,e[1],F.serialize(n))}}onInit(e){super.onInit(e);const t=F.parse(e.extnValue,Pt);t.keyIdentifier&&(this.keyId=M.ToHex(t.keyIdentifier)),t.authorityCertIssuer&&t.authorityCertSerialNumber&&(this.certId={name:t.authorityCertIssuer,serialNumber:M.ToHex(t.authorityCertSerialNumber)})}toTextObject(){const e=this.toTextObjectWithoutValue(),t=F.parse(this.value,Pt);return t.authorityCertIssuer&&(e["Authority Issuer"]=new Zr(t.authorityCertIssuer).toTextObject()),t.authorityCertSerialNumber&&(e["Authority Serial Number"]=t.authorityCertSerialNumber),t.keyIdentifier&&(e[""]=t.keyIdentifier),e}}ei.NAME="Authority Key Identifier";class fu extends ot{constructor(...e){if(_.isBufferSource(e[0])){super(e[0]);const t=F.parse(this.value,Ei);this.ca=t.cA,this.pathLength=t.pathLenConstraint}else{const t=new Ei({cA:e[0],pathLenConstraint:e[1]});super(dc,e[2],F.serialize(t)),this.ca=e[0],this.pathLength=e[1]}}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ca&&(e.CA=this.ca),this.pathLength!==void 0&&(e["Path Length"]=this.pathLength),e}}fu.NAME="Basic Constraints";var du;(function(r){r.serverAuth="1.3.6.1.5.5.7.3.1",r.clientAuth="1.3.6.1.5.5.7.3.2",r.codeSigning="1.3.6.1.5.5.7.3.3",r.emailProtection="1.3.6.1.5.5.7.3.4",r.timeStamping="1.3.6.1.5.5.7.3.8",r.ocspSigning="1.3.6.1.5.5.7.3.9"})(du||(du={}));class pu extends ot{constructor(...e){if(_.isBufferSource(e[0])){super(e[0]);const t=F.parse(this.value,Vi);this.usages=t.map(i=>i)}else{const t=new Vi(e[0]);super(bc,e[1],F.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(t=>xt.toString(t)).join(", "),e}}pu.NAME="Extended Key Usages";var qs;(function(r){r[r.digitalSignature=1]="digitalSignature",r[r.nonRepudiation=2]="nonRepudiation",r[r.keyEncipherment=4]="keyEncipherment",r[r.dataEncipherment=8]="dataEncipherment",r[r.keyAgreement=16]="keyAgreement",r[r.keyCertSign=32]="keyCertSign",r[r.cRLSign=64]="cRLSign",r[r.encipherOnly=128]="encipherOnly",r[r.decipherOnly=256]="decipherOnly"})(qs||(qs={}));class Gs extends ot{constructor(...e){if(_.isBufferSource(e[0])){super(e[0]);const t=F.parse(this.value,ko);this.usages=t.toNumber()}else{const t=new ko(e[0]);super(wc,e[1],F.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=F.parse(this.value,ko);return e[""]=t.toJSON().join(", "),e}}Gs.NAME="Key Usages";class Nn extends ot{static async create(e,t=!1,i=Me.get()){let n;e instanceof Kt?n=e.rawData:"publicKey"in e?n=e.publicKey.rawData:_.isBufferSource(e)?n=e:n=await i.subtle.exportKey("spki",e);const c=await new Kt(n).getKeyIdentifier(i);return new Nn(M.ToHex(c),t)}constructor(...e){if(_.isBufferSource(e[0])){super(e[0]);const t=F.parse(this.value,St);this.keyId=M.ToHex(t)}else{const t=typeof e[0]=="string"?M.FromHex(e[0]):e[0],i=new St(t);super(Bc,e[1],F.serialize(i)),this.keyId=M.ToHex(t)}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=F.parse(this.value,St);return e[""]=t,e}}Nn.NAME="Subject Key Identifier";class Ws extends ot{constructor(...e){_.isBufferSource(e[0])?super(e[0]):super(xc,e[1],new Zr(e[0]||[]).rawData)}onInit(e){super.onInit(e);const t=F.parse(e.extnValue,Io);this.names=new Zr(t)}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.names.toTextObject();for(const i in t)e[i]=t[i];return e}}Ws.NAME="Subject Alternative Name";class hu extends ot{constructor(...e){var t;if(_.isBufferSource(e[0])){super(e[0]);const i=F.parse(this.value,Oi);this.policies=i.map(n=>n.policyIdentifier)}else{const i=e[0],n=(t=e[1])!==null&&t!==void 0?t:!1,s=new Oi(i.map(c=>new Ni({policyIdentifier:c})));super(hc,n,F.serialize(s)),this.policies=i}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(t=>new oe("",{},xt.toString(t))),e}}hu.NAME="Certificate Policies",st.register(hc,hu);class br extends Ct{constructor(...e){let t;if(_.isBufferSource(e[0]))t=_.toArrayBuffer(e[0]);else{const i=e[0],n=Array.isArray(e[1])?e[1].map(s=>_.toArrayBuffer(s)):[];t=F.serialize(new ht({type:i,values:n}))}super(t,ht)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Value=this.values.map(t=>new oe("",{"":t})),e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty();return e[oe.NAME]===br.NAME&&(e[oe.NAME]=xt.toString(this.type)),e}}br.NAME="Attribute";class yu extends br{constructor(...e){var t;if(_.isBufferSource(e[0]))super(e[0]);else{const i=new An({printableString:e[0]});super(dl,[F.serialize(i)])}(t=this.password)!==null&&t!==void 0||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){const t=F.parse(this.values[0],An);this.password=t.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[oe.VALUE]=this.password,e}}yu.NAME="Challenge Password";class zs extends br{constructor(...e){var t;if(_.isBufferSource(e[0]))super(e[0]);else{const i=e[0],n=new Dt;for(const s of i)n.push(F.parse(s.rawData,Je));super(Ns,[F.serialize(n)])}(t=this.items)!==null&&t!==void 0||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){const t=F.parse(this.values[0],Dt);this.items=t.map(i=>st.create(F.serialize(i)))}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.items.map(i=>i.toTextObject());for(const i of t)e[i[oe.NAME]]=i;return e}}zs.NAME="Extensions";class On{static register(e,t){this.items.set(e,t)}static create(e){const t=new br(e),i=this.items.get(t.type);return i?new i(e):t}}On.items=new Map;let Js=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if("hash"in e){let t;if(typeof e.hash=="string")t=e.hash;else if(e.hash&&typeof e.hash=="object"&&"name"in e.hash&&typeof e.hash.name=="string")t=e.hash.name.toUpperCase();else throw new Error("Cannot get hash algorithm name");switch(t.toLowerCase()){case"sha-1":return new U({algorithm:on,parameters:null});case"sha-256":return new U({algorithm:ls,parameters:null});case"sha-384":return new U({algorithm:sn,parameters:null});case"sha-512":return new U({algorithm:an,parameters:null})}}else return new U({algorithm:hr,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case hr:return{name:"RSASSA-PKCS1-v1_5"};case on:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case ls:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case sn:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case an:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}}}return null}};Js=a([vs()],Js),Ke.registerSingleton(kn,Js);class qe{addPadding(e,t){const i=_.toUint8Array(t),n=new Uint8Array(e);return n.set(i,e-i.length),n}removePadding(e,t=!1){let i=_.toUint8Array(e);for(let n=0;n<i.length;n++)if(i[n]){i=i.slice(n);break}if(t&&i[0]>127){const n=new Uint8Array(i.length+1);return n.set(i,1),n.buffer}return i.buffer}toAsnSignature(e,t){if(e.name==="ECDSA"){const i=e.namedCurve,n=qe.namedCurveSize.get(i)||qe.defaultNamedCurveSize,s=new nn,c=_.toUint8Array(t);return s.r=this.removePadding(c.slice(0,n),!0),s.s=this.removePadding(c.slice(n,n+n),!0),F.serialize(s)}return null}toWebSignature(e,t){if(e.name==="ECDSA"){const i=F.parse(t,nn),n=e.namedCurve,s=qe.namedCurveSize.get(n)||qe.defaultNamedCurveSize,c=this.addPadding(s,this.removePadding(i.r)),u=this.addPadding(s,this.removePadding(i.s));return ju(c,u)}return null}}qe.namedCurveSize=new Map,qe.defaultNamedCurveSize=32;const gu="1.3.101.110",mu="1.3.101.111",bu="1.3.101.112",vu="1.3.101.113";let Ys=class{toAsnAlgorithm(e){let t=null;switch(e.name.toLowerCase()){case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":t=bu;break;case"ed448":t=vu;break}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":t=gu;break;case"x448":t=mu;break}}return t?new U({algorithm:t}):null}toWebAlgorithm(e){switch(e.algorithm){case bu:return{name:"EdDSA",namedCurve:"Ed25519"};case vu:return{name:"EdDSA",namedCurve:"Ed448"};case gu:return{name:"ECDH-ES",namedCurve:"X25519"};case mu:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};Ys=a([vs()],Ys),Ke.registerSingleton(kn,Ys);class wd extends bt{constructor(e){bt.isAsnEncoded(e)?super(e,Jr):super(e),this.tag=$e.CertificateRequestTag}onInit(e){this.tbs=F.serialize(e.certificationRequestInfo),this.publicKey=new Kt(e.certificationRequestInfo.subjectPKInfo);const t=Ke.resolve(xn);this.signatureAlgorithm=t.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signature,this.attributes=e.certificationRequestInfo.attributes.map(n=>On.create(F.serialize(n)));const i=this.getAttribute(Ns);this.extensions=[],i instanceof zs&&(this.extensions=i.items),this.subjectName=new Bt(e.certificationRequestInfo.subject),this.subject=this.subjectName.toString()}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=Me.get()){const t={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(t,["verify"],e),n=Ke.resolveAll(En).reverse();let s=null;for(const u of n)if(s=u.toWebSignature(t,this.signature),s)break;if(!s)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await e.subtle.verify(this.signatureAlgorithm,i,s,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),t=F.parse(this.rawData,Jr),i=t.certificationRequestInfo,n=new oe("",{Version:`${er[i.version]} (${i.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const s=new oe("");for(const c of this.attributes){const u=c.toTextObject();s[u[oe.NAME]]=u}n.Attributes=s}return e.Data=n,e.Signature=new oe("",{Algorithm:Lt.serializeAlgorithm(t.signatureAlgorithm),"":t.signature}),e}}wd.NAME="PKCS#10 Certificate Request";var wu;(function(r){r[r.unspecified=0]="unspecified",r[r.keyCompromise=1]="keyCompromise",r[r.cACompromise=2]="cACompromise",r[r.affiliationChanged=3]="affiliationChanged",r[r.superseded=4]="superseded",r[r.cessationOfOperation=5]="cessationOfOperation",r[r.certificateHold=6]="certificateHold",r[r.removeFromCRL=8]="removeFromCRL",r[r.privilegeWithdrawn=9]="privilegeWithdrawn",r[r.aACompromise=10]="aACompromise"})(wu||(wu={})),st.register(dc,fu),st.register(bc,pu),st.register(wc,Gs),st.register(Bc,Nn),st.register(so,ei),st.register(xc,Ws),On.register(dl,yu),On.register(Ns,zs),Ke.registerSingleton(En,vd),Ke.registerSingleton(En,qe),qe.namedCurveSize.set("P-256",32),qe.namedCurveSize.set("K-256",32),qe.namedCurveSize.set("P-384",48),qe.namedCurveSize.set("P-521",66);function Au(){return{parseMetaCertificateData:e=>{if(/{vault:\/\/.*}/g.test(e))throw new Error("not a X.509 certificate");const t=new In(e),i={subject:t.subjectName.toString(),issuer:t.issuer,notAfter:t.notAfter};for(const n of t.extensions)if(n instanceof Ws){const s=n.names.toJSON(),u=Object.entries(s).map(f=>({type:f[1].type,value:f[1].value})).reduce((f,d)=>{const b=d.type,y=f[b]??[];return{...f,[b]:[...y,d.value]}},{});for(const f in u)i.subjectAltName=`${f}=${u[f].join(", ")}`}else if(n instanceof Gs){const s=Object.values(qs),c=Array(s.length/2).fill(null).reduce((u,f,d)=>{const b=s[s.length/2+d];if(n.usages&b){const y=s[d];u.push(y)}return u},[]);i.keyUsage=c}return i}}}function Ad(){const r=Au(),e=o.ref({}),t=n=>{if(!(n.id in e.value))try{e.value[n.id]=r.parseMetaCertificateData(n.cert)}catch{e.value[n.id]=void 0}return e.value[n.id]};return{certificateDataCache:e,getCertificateData:n=>{const s=t(n);return{schemaIssuer:(s==null?void 0:s.issuer)||"",schemaSubject:(s==null?void 0:s.subject)||"",schemaExpiry:(s==null?void 0:s.notAfter)instanceof Date?s.notAfter.getTime()/1e3:0,schemaSanNames:(s==null?void 0:s.subjectAltName)||"",schemaKeyUsages:(s==null?void 0:s.keyUsage)||[]}}}}const Sd={certificates:{title:"Certificates",list:{toolbar_actions:{new_certificate:"New Certificate"},table_headers:{subject:"Subject",expiry:"Expiry",san:"SAN",cert:"Cert",tags:"Tags",issuer:"Issuer",snis:"SNIs"},empty_state:{title:"Configure a New Certificate",description:"Certificates handle SSL/TLS termination for encrypted requests."}},form:{sections:{ssl:{title:"SSL Key Pair",description:"The PEM-encoded public certificate chain and private key of the SSL key pair and the alternate."},general:{title:"General Information",description:"General information will help identify and manage this key."}},fields:{cert:{label:"Cert",tooltip:"PEM-encoded public certificate chain of the SSL key pair. This field is {emphasis}, which means it can be securely stored as a secret in a vault. References must follow a specific format.",emphasis:"referenceable"},key:{label:"Key",tooltip:"PEM-encoded private key of the SSL key pair. This field is {emphasis}, which means it can be securely stored as a secret in a vault. References must follow a specific format.",emphasis:"referenceable"},cert_alt:{label:"Cert Alt",tooltip:"PEM-encoded public certificate chain of the alternate SSL key pair. This should only be set if you have both RSA and ECDSA types of certificate available and would like Kong to prefer serving using ECDSA certs when client advertises support for it. This field is {emphasis}, which means it can be securely stored as a secret in a vault. References must follow a specific format.",emphasis:"referenceable"},key_alt:{label:"Key Alt",tooltip:"PEM-encoded private key of the alternate SSL key pair. This should only be set if you have both RSA and ECDSA types of certificate available and would like Kong to prefer serving using ECDSA certs when client advertises support for it. This field is {emphasis}, which means it can be securely stored as a secret in a vault. References must follow a specific format.",emphasis:"referenceable"},snis:{label:"SNIs",placeholder:"Enter an SNI",add:"Add an SNI",tooltip:"Zero or more hostnames to associate with this certificate as SNIs",editingTip:"To manage SNIs for this certificate, click {link}.",editingTipLink:"here"},tags:{label:"Tags",placeholder:"Enter a list of tags separated by comma",help:"e.g. tag1, tag2, tag3",tooltip:"An optional set of strings for grouping and filtering, separated by commas."}}},actions:{create:"New Certificate",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",addSni:"Add to New SNI",delete:"Delete",clear:"Clear",view:"View Details"},search:{placeholder:"Filter by exact ID"},delete:{title:"Delete a Certificate",description:"Your organization's original certificate {bolded-text}.",boldedText:"will not be affected",description2:"This action cannot be reversed so make sure to check the certificate usage before deleting."},errors:{general:"Certificates could not be retrieved",delete:"The certificate could not be deleted at this time",copy:"Failed to copy to clipboard"},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard"}},"ca-certificates":{title:"CA Certificates",list:{toolbar_actions:{new_ca_certificate:"New CA Certificate"},table_headers:{issuer:"Issuer",expiry:"Expiry",tags:"Tags"},empty_state:{title:"Configure a New CA Certificate",description:"CA certificates validate client or server certificates."}},form:{sections:{cert:{title:"Public Certificate",description:"The PEM-encoded public certificate of the CA and it’s SHA256 hex digest."},general:{title:"General Information",description:"General information will help identify and manage this key."}},fields:{cert:{label:"Cert",tooltip:"PEM-encoded public certificate of the CA."},cert_digest:{label:"Cert Digest",tooltip:"SHA256 hex digest of the public certificate"},tags:{label:"Tags",placeholder:"Enter a list of tags separated by comma",help:"e.g. tag1, tag2, tag3",tooltip:"An optional set of strings for grouping and filtering, separated by commas."}}},actions:{create:"New CA Certificate",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",delete:"Delete",clear:"Clear",view:"View Details"},search:{placeholder:"Filter by exact ID"},delete:{title:"Delete a CA Certificate",description:"Your organization's original certificate {bolded-text}.",boldedText:"will not be affected",description2:"This action cannot be reversed so make sure to check the certificate usage before deleting."},errors:{general:"CA Certificates could not be retrieved",delete:"The CA Certificate could not be deleted at this time",copy:"Failed to copy to clipboard"},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard"}},general:{"key-usages":{KEY_USAGE_TYPE_KEY_CERT_SIGN:"keyCertSign",KEY_USAGE_TYPE_CRL_SIGN:"cRLSign",KEY_USAGE_TYPE_ENCIPHER_ONLY:"encipherOnly",KEY_USAGE_TYPE_DIGITAL_SIGNATURE:"digitalSignature",KEY_USAGE_TYPE_KEY_ENCIPHERMENT:"keyEncipherment",KEY_USAGE_TYPE_DATA_ENCIPHERMENT:"dataEncipherment",KEY_USAGE_TYPE_KEY_AGREEMENT:"keyAgreement",KEY_USAGE_TYPE_CONTENT_COMMITMENT:"nonRepudiation"}}};function kd(){const r=ea.createI18n("en-us",Sd);return{i18n:r,i18nT:ea.i18nTComponent(r)}}const Ze={useCertificate:Ad,useI18n:kd,useX509:Au},Tn="/v2/control-planes/{controlPlaneId}/core-entities",Vn="/{workspace}",ti={list:{konnect:`${Tn}/certificates`,kongManager:`${Vn}/certificates`},form:{konnect:{create:`${Tn}/certificates`,edit:`${Tn}/certificates/{id}`,validate:`${Tn}/v1/schemas/json/certificate/validate`},kongManager:{create:`${Vn}/certificates`,edit:`${Vn}/certificates/{id}`,validate:`${Vn}/schemas/certificates/validate`}}},xd={class:"kong-ui-entities-certificates-list"},Cd={key:0},Bd={key:1},Ed={key:0},Id={key:1},Nd={key:0},Od={key:1},Td={key:1},Vd={key:1},_d=o.defineComponent({__name:"CertificateList",props:{config:{type:Object,required:!0,validator:r=>!(!r||!["konnect","kongManager"].includes(r==null?void 0:r.app)||!r.createRoute||!r.getViewRoute||!r.getEditRoute||r.app==="kongManager"&&!r.isExactMatch&&!r.filterSchema)},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canCreateSni:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},canRetrieve:{type:Function,required:!1,default:async()=>!0},useActionOutside:{type:Boolean,default:!1}},emits:["error","copy:success","copy:error","delete:success"],setup(r,{emit:e}){var J;const t=e,i=r,{i18n:{t:n,formatUnixTimeStamp:s},i18nT:c}=Ze.useI18n(),u=ni.useRouter(),{axiosInstance:f}=T.useAxios((J=i.config)==null?void 0:J.axiosRequestConfig),d=o.ref(1),b=o.computed(()=>i.config.app!=="kongManager"||!!i.config.disableSorting),W={subject:{label:n("certificates.list.table_headers.subject"),hidable:!1},expiry:{label:n("certificates.list.table_headers.expiry")},san:{label:n("certificates.list.table_headers.san")},cert:{label:n("certificates.list.table_headers.cert")},tags:{label:n("certificates.list.table_headers.tags"),sortable:!0}},O=o.computed(()=>{var H,ae;let R=`${i.config.apiBaseUrl}${ti.list[i.config.app]}`;return i.config.app==="konnect"?R=R.replace(/{controlPlaneId}/gi,((H=i.config)==null?void 0:H.controlPlaneId)||""):i.config.app==="kongManager"&&(R=R.replace(/\/{workspace}/gi,(ae=i.config)!=null&&ae.workspace?`/${i.config.workspace}`:"")),R}),p=o.ref(""),m=o.computed(()=>{const R=i.config.app==="konnect"||i.config.isExactMatch;return R?{isExactMatch:R,placeholder:n("certificates.search.placeholder")}:{isExactMatch:R,schema:i.config.filterSchema}}),{fetcher:A,fetcherState:w}=T.useFetcher(i.config,O.value),I=()=>{p.value=""},k=()=>{d.value++},B=o.ref(null),Z=(R,H)=>{const ae=R.id;if(!H(ae)){t("copy:error",{entity:R,field:"id",message:n("certificates.errors.copy")});return}t("copy:success",{entity:R,field:"id",message:n("certificates.copy.success",{val:ae})})},se=(R,H)=>{const ae=JSON.stringify(R);if(!H(ae)){t("copy:error",{entity:R,message:n("certificates.errors.copy")});return}t("copy:success",{entity:R,message:n("certificates.copy.success_brief")})},D=async R=>{var ae;await((ae=i.canRetrieve)==null?void 0:ae.call(i,R))&&u.push(i.config.getViewRoute(R.id))},C=R=>({label:n("certificates.actions.view"),to:i.config.getViewRoute(R)}),j=R=>({label:n("certificates.actions.edit"),to:i.config.getEditRoute(R)}),de=R=>{if(i.config.getCreateSniRoute)return{label:n("certificates.actions.addSni"),to:i.config.getCreateSniRoute(R)}},re=o.ref(void 0),Be=o.ref(!1),ce=o.ref(!1),pe=o.ref(""),at=T.useDeleteUrlBuilder(i.config,O.value),{certificateDataCache:ee,getCertificateData:vt}=Ze.useCertificate(),vr=R=>{re.value=R,Be.value=!0},wr=()=>{Be.value=!1},Gt=async()=>{var R,H,ae;if((R=re.value)!=null&&R.id){ce.value=!0;try{await f.delete(at(re.value.id)),ce.value=!1,Be.value=!1,d.value++,t("delete:success",re.value)}catch(Ne){pe.value=((ae=(H=Ne.response)==null?void 0:H.data)==null?void 0:ae.message)||Ne.message||n("certificates.errors.delete"),t("error",Ne)}finally{ce.value=!1}}},wt=o.ref(!1);o.watch(w,R=>{var H,ae,Ne,Ue;if(Array.isArray((H=R==null?void 0:R.response)==null?void 0:H.data)&&(wt.value=R.response.data.length>0),R.status===T.FetcherStatus.Error){B.value={title:n("certificates.errors.general")},(Ue=(Ne=(ae=R.error)==null?void 0:ae.response)==null?void 0:Ne.data)!=null&&Ue.message&&(B.value.message=R.error.response.data.message),t("error",R.error);return}ee.value={},B.value=null});const z=o.ref({ctaPath:i.config.createRoute,ctaText:void 0,message:`${n("certificates.list.empty_state.description")}${i.config.additionMessageForEmptyState?` ${i.config.additionMessageForEmptyState}`:""}`,title:n("certificates.title")});return o.onBeforeMount(async()=>{await i.canCreate()&&(z.value.title=n("certificates.list.empty_state.title"),z.value.ctaText=n("certificates.actions.create"))}),(R,H)=>{const ae=o.resolveComponent("KButton"),Ne=o.resolveComponent("KCopy"),Ue=o.resolveComponent("KBadge"),Ar=o.resolveComponent("KTruncate"),Y=o.resolveComponent("KDropdownItem"),be=o.resolveComponent("KClipboardProvider");return o.openBlock(),o.createElementBlock("div",xd,[o.createVNode(o.unref(T.EntityBaseTable),{"cache-identifier":r.cacheIdentifier,"disable-pagination-page-jump":"","disable-sorting":b.value,"empty-state-options":z.value,"enable-entity-actions":"","error-message":B.value,fetcher:o.unref(A),"fetcher-cache-key":d.value,"pagination-type":"offset","preferences-storage-key":"kong-ui-entities-certificates-list",query:p.value,"table-headers":o.unref(W),"use-action-outside":r.useActionOutside,onClearSearchInput:I,"onClick:row":H[2]||(H[2]=q=>D(q)),onSort:k},{"toolbar-filter":o.withCtx(()=>[o.createVNode(o.unref(T.EntityFilter),{modelValue:p.value,"onUpdate:modelValue":H[0]||(H[0]=q=>p.value=q),config:m.value},null,8,["modelValue","config"])]),"toolbar-button":o.withCtx(()=>[(o.openBlock(),o.createBlock(o.Teleport,{disabled:!r.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[o.createVNode(o.unref(T.PermissionsWrapper),{"auth-function":()=>r.canCreate()},{default:o.withCtx(()=>[o.withDirectives(o.createVNode(ae,{appearance:"primary","data-testid":"toolbar-add-certificate",size:"large",to:r.config.createRoute},{default:o.withCtx(()=>[o.createVNode(o.unref(oi.AddIcon)),o.createTextVNode(" "+o.toDisplayString(o.unref(n)("certificates.list.toolbar_actions.new_certificate")),1)]),_:1},8,["to"]),[[o.vShow,wt.value]])]),_:1},8,["auth-function"])],8,["disabled"]))]),subject:o.withCtx(({row:q})=>{var ve;return[r.config.app==="konnect"?(o.openBlock(),o.createElementBlock("b",Cd,o.toDisplayString((ve=q==null?void 0:q.metadata)!=null&&ve.subject?q.metadata.subject:"-"),1)):(o.openBlock(),o.createElementBlock("b",Bd,o.toDisplayString(o.unref(vt)(q).schemaSubject||"-"),1))]}),expiry:o.withCtx(({row:q})=>{var ve;return[r.config.app==="konnect"?(o.openBlock(),o.createElementBlock("span",Ed,o.toDisplayString((ve=q==null?void 0:q.metadata)!=null&&ve.expiry?o.unref(s)(q.metadata.expiry):"-"),1)):(o.openBlock(),o.createElementBlock("span",Id,o.toDisplayString(o.unref(vt)(q).schemaExpiry?o.unref(s)(o.unref(vt)(q).schemaExpiry):"-"),1))]}),san:o.withCtx(({row:q})=>{var ve;return[r.config.app==="konnect"?(o.openBlock(),o.createElementBlock("span",Nd,o.toDisplayString((ve=q==null?void 0:q.metadata)!=null&&ve.dns_names?`dns=${q.metadata.dns_names.join(", ")}`:"-"),1)):(o.openBlock(),o.createElementBlock("span",Od,o.toDisplayString(o.unref(vt)(q).schemaSanNames||"-"),1))]}),cert:o.withCtx(({row:q})=>[q!=null&&q.cert?(o.openBlock(),o.createBlock(Ne,{key:0,"data-testid":"copy-certificate-cert",text:q.cert,truncate:""},null,8,["text"])):(o.openBlock(),o.createElementBlock("span",Td,"-"))]),tags:o.withCtx(({row:q})=>{var ve;return[((ve=q==null?void 0:q.tags)==null?void 0:ve.length)>0?(o.openBlock(),o.createBlock(Ar,{key:0},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(q==null?void 0:q.tags,Sr=>(o.openBlock(),o.createBlock(Ue,{key:Sr,onClick:H[1]||(H[1]=o.withModifiers(()=>{},["stop"]))},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(Sr),1)]),_:2},1024))),128))]),_:2},1024)):(o.openBlock(),o.createElementBlock("span",Vd,"-"))]}),actions:o.withCtx(({row:q})=>[o.createVNode(be,null,{default:o.withCtx(({copyToClipboard:ve})=>[o.createVNode(Y,{"data-testid":"action-entity-copy-id",onClick:Sr=>Z(q,ve)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("certificates.actions.copy_id")),1)]),_:2},1032,["onClick"])]),_:2},1024),o.createVNode(be,null,{default:o.withCtx(({copyToClipboard:ve})=>[o.createVNode(Y,{"data-testid":"action-entity-copy-json",onClick:Sr=>se(q,ve)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("certificates.actions.copy_json")),1)]),_:2},1032,["onClick"])]),_:2},1024),o.createVNode(o.unref(T.PermissionsWrapper),{"auth-function":()=>r.canRetrieve(q)},{default:o.withCtx(()=>[o.createVNode(Y,{"data-testid":"action-entity-view","has-divider":"",item:C(q.id)},null,8,["item"])]),_:2},1032,["auth-function"]),o.createVNode(o.unref(T.PermissionsWrapper),{"auth-function":()=>r.canEdit(q)},{default:o.withCtx(()=>[o.createVNode(Y,{"data-testid":"action-entity-edit",item:j(q.id)},null,8,["item"])]),_:2},1032,["auth-function"]),r.config.getCreateSniRoute?(o.openBlock(),o.createBlock(o.unref(T.PermissionsWrapper),{key:0,"auth-function":()=>r.canCreateSni()},{default:o.withCtx(()=>[o.createVNode(Y,{"data-testid":"action-entity-add-sni",item:de(q.id)},null,8,["item"])]),_:2},1032,["auth-function"])):o.createCommentVNode("",!0),o.createVNode(o.unref(T.PermissionsWrapper),{"auth-function":()=>r.canDelete(q)},{default:o.withCtx(()=>[o.createVNode(Y,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:ve=>vr(q)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("certificates.actions.delete")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"])]),_:1},8,["cache-identifier","disable-sorting","empty-state-options","error-message","fetcher","fetcher-cache-key","query","table-headers","use-action-outside"]),o.createVNode(o.unref(T.EntityDeleteModal),{"action-pending":ce.value,"entity-type":o.unref(T.EntityTypes).Certificate,error:pe.value,title:o.unref(n)("certificates.delete.title"),visible:Be.value,onCancel:wr,onProceed:Gt},{description:o.withCtx(()=>[o.createVNode(o.unref(c),{keypath:"certificates.delete.description",scope:"global"},{"bolded-text":o.withCtx(()=>[o.createElementVNode("b",null,o.toDisplayString(o.unref(n)("certificates.delete.boldedText")),1)]),_:1}),o.createElementVNode("p",null,o.toDisplayString(o.unref(n)("certificates.delete.description2")),1)]),_:1},8,["action-pending","entity-type","error","title","visible"])])}}}),qt=(r,e)=>{const t=r.__vccOpts||r;for(const[i,n]of e)t[i]=n;return t},jd=qt(_d,[["__scopeId","data-v-8059a087"]]),Pd="#d60027",Dd={class:"sni-field-container"},Rd={key:1,class:"sni-field-controls-container"},Md={key:0},$d=qt(o.defineComponent({__name:"CertificateFormSniField",props:{isEditing:{type:Boolean,default:!1},modelValue:{type:Array,required:!0},sniListRoute:{type:Object,required:!0}},emits:["add","remove","update:modelValue"],setup(r,{emit:e}){const t=r,i=e,{i18nT:n,i18n:{t:s}}=Ze.useI18n(),c=o.ref([]);return o.watch(t.modelValue,u=>{c.value=[...u]},{immediate:!0,deep:!0}),o.watch(c,u=>{i("update:modelValue",u)},{deep:!0}),(u,f)=>{const d=o.resolveComponent("KLabel"),b=o.resolveComponent("KInput"),y=o.resolveComponent("KButton"),W=o.resolveComponent("router-link");return o.openBlock(),o.createElementBlock("div",Dd,[o.createVNode(d,{info:o.unref(s)("certificates.form.fields.snis.tooltip")},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s)("certificates.form.fields.snis.label")),1)]),_:1},8,["info"]),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(c.value,(O,p)=>(o.openBlock(),o.createElementBlock("div",{key:p,class:"sni-field-input"},[!r.isEditing||c.value[p]?(o.openBlock(),o.createBlock(b,{key:0,modelValue:c.value[p],"onUpdate:modelValue":m=>c.value[p]=m,modelModifiers:{trim:!0},"data-testid":`sni-field-input-${p+1}`,disabled:r.isEditing,placeholder:o.unref(s)("certificates.form.fields.snis.placeholder")},null,8,["modelValue","onUpdate:modelValue","data-testid","disabled","placeholder"])):o.createCommentVNode("",!0),r.isEditing?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Rd,[o.createVNode(y,{appearance:"tertiary",class:"remove-button","data-testid":"remove-sni",icon:"",onClick:m=>u.$emit("remove",p)},{default:o.withCtx(()=>[o.createVNode(o.unref(oi.TrashIcon),{color:o.unref(Pd)},null,8,["color"])]),_:2},1032,["onClick"]),o.createVNode(y,{appearance:"tertiary","data-testid":"add-sni",disabled:p!==c.value.length-1,icon:"",onClick:f[0]||(f[0]=m=>u.$emit("add"))},{default:o.withCtx(()=>[o.createVNode(o.unref(oi.AddIcon))]),_:2},1032,["disabled"])]))]))),128)),c.value.length===0?(o.openBlock(),o.createElementBlock("div",Md,[o.createVNode(y,{onClick:f[1]||(f[1]=O=>u.$emit("add"))},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s)("certificates.form.fields.snis.add")),1)]),_:1})])):o.createCommentVNode("",!0),r.isEditing?(o.openBlock(),o.createBlock(o.unref(n),{key:1,keypath:"certificates.form.fields.snis.editingTip"},{link:o.withCtx(()=>[o.createVNode(W,{to:r.sniListRoute},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s)("certificates.form.fields.snis.editingTipLink")),1)]),_:1},8,["to"])]),_:1})):o.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-543a45f0"]]),Ud={class:"kong-ui-entities-certificates-form"},Hd=qt(o.defineComponent({__name:"CertificateForm",props:{config:{type:Object,required:!0,validator:r=>!(!r||!["konnect","kongManager"].includes(r==null?void 0:r.app)||r.app==="konnect"&&!r.controlPlaneId||r.app==="kongManager"&&typeof r.workspace!="string"||!r.cancelRoute)},certificateId:{type:String,required:!1,default:""},showSnisField:{type:Boolean,required:!1,default:!1},enableTerraform:{type:Boolean,default:!1}},emits:["update","error","loading"],setup(r,{emit:e}){var se;const t=e,i=r,n=ni.useRouter(),{i18nT:s,i18n:{t:c}}=Ze.useI18n(),{getMessageFromError:u}=T.useErrors(),{axiosInstance:f}=T.useAxios((se=i.config)==null?void 0:se.axiosRequestConfig),d=o.computed(()=>ti.form[i.config.app].edit),b=o.computed(()=>i.certificateId?T.EntityBaseFormType.Edit:T.EntityBaseFormType.Create),y=o.reactive({fields:{cert:"",key:"",certAlt:"",keyAlt:"",snis:[""],tags:""},isReadonly:!1,errorMessage:""}),W=o.reactive({cert:"",key:"",certAlt:"",keyAlt:"",snis:[""],tags:""}),O=o.computed(()=>(b.value===T.EntityBaseFormType.Create||JSON.stringify(y.fields)!==JSON.stringify(W))&&!!y.fields.cert&&!!y.fields.key),p=D=>{var C,j;y.fields.cert=(D==null?void 0:D.cert)||"",y.fields.key=(D==null?void 0:D.key)||"",y.fields.certAlt=(D==null?void 0:D.cert_alt)||"",y.fields.keyAlt=(D==null?void 0:D.key_alt)||"",y.fields.snis=(C=D==null?void 0:D.snis)!=null&&C.length?D.snis:[""],y.fields.tags=((j=D==null?void 0:D.tags)==null?void 0:j.join(", "))||"",Object.assign(W,y.fields)},m=()=>{n.push(i.config.cancelRoute)},A=()=>{y.fields.snis.push("")},w=D=>{y.fields.snis.splice(D,1)},I=o.computed(()=>{var C,j;let D=`${i.config.apiBaseUrl}${ti.form[i.config.app].validate}`;return i.config.app==="konnect"?D=D.replace(/{controlPlaneId}/gi,((C=i.config)==null?void 0:C.controlPlaneId)||""):i.config.app==="kongManager"&&(D=D.replace(/\/{workspace}/gi,(j=i.config)!=null&&j.workspace?`/${i.config.workspace}`:"")),D=D.replace(/{id}/gi,i.certificateId),D}),k=o.computed(()=>{var C,j;let D=`${i.config.apiBaseUrl}${ti.form[i.config.app][b.value]}`;return i.config.app==="konnect"?D=D.replace(/{controlPlaneId}/gi,((C=i.config)==null?void 0:C.controlPlaneId)||""):i.config.app==="kongManager"&&(D=D.replace(/\/{workspace}/gi,(j=i.config)!=null&&j.workspace?`/${i.config.workspace}`:"")),D=D.replace(/{id}/gi,i.certificateId),D}),B=o.computed(()=>{var D,C;return{cert:y.fields.cert,key:y.fields.key,cert_alt:y.fields.certAlt||null,key_alt:y.fields.keyAlt||null,...i.showSnisField?{snis:y.fields.snis.filter(Boolean)}:{},tags:(C=(D=y.fields.tags.split(","))==null?void 0:D.map(j=>String(j||"").trim()))==null?void 0:C.filter(j=>j!=="")}}),Z=async()=>{var D,C,j,de,re,Be,ce,pe,at;try{y.isReadonly=!0;let ee;await f.post(I.value,B.value),b.value==="create"?ee=await f.post(k.value,B.value):b.value==="edit"&&(ee=((D=i.config)==null?void 0:D.app)==="konnect"?await f.put(k.value,B.value):await f.patch(k.value,B.value)),y.fields.cert=((C=ee==null?void 0:ee.data)==null?void 0:C.cert)||"",y.fields.key=((j=ee==null?void 0:ee.data)==null?void 0:j.key)||"",y.fields.certAlt=((de=ee==null?void 0:ee.data)==null?void 0:de.cert_alt)||"",y.fields.keyAlt=((re=ee==null?void 0:ee.data)==null?void 0:re.key_alt)||"",y.fields.snis=(ce=(Be=ee==null?void 0:ee.data)==null?void 0:Be.snis)!=null&&ce.length?ee.data.snis:[""],y.fields.tags=((at=(pe=ee==null?void 0:ee.data)==null?void 0:pe.tags)==null?void 0:at.join(", "))||"",Object.assign(W,y.fields),t("update",ee==null?void 0:ee.data)}catch(ee){y.errorMessage=u(ee),t("error",ee)}finally{y.isReadonly=!1}};return(D,C)=>{const j=o.resolveComponent("KTextArea"),de=o.resolveComponent("KInput");return o.openBlock(),o.createElementBlock("div",Ud,[o.createVNode(o.unref(T.EntityBaseForm),{"can-submit":O.value,config:r.config,"edit-id":r.certificateId,"enable-terraform":r.enableTerraform,"entity-type":o.unref(T.SupportedEntityType).Certificate,"error-message":y.errorMessage,"fetch-url":d.value,"form-fields":B.value,"is-readonly":y.isReadonly,onCancel:m,"onFetch:error":C[7]||(C[7]=re=>D.$emit("error",re)),"onFetch:success":p,onLoading:C[8]||(C[8]=re=>D.$emit("loading",re)),onSubmit:Z},{default:o.withCtx(()=>[o.createVNode(o.unref(T.EntityFormSection),{description:o.unref(c)("certificates.form.sections.ssl.description"),title:o.unref(c)("certificates.form.sections.ssl.title")},{default:o.withCtx(()=>[o.createVNode(j,{modelValue:y.fields.cert,"onUpdate:modelValue":C[0]||(C[0]=re=>y.fields.cert=re),modelModifiers:{trim:!0},"character-limit":!1,class:"certificate-form-textarea","data-testid":"certificate-form-cert",label:o.unref(c)("certificates.form.fields.cert.label"),"label-attributes":{tooltipAttributes:{maxWidth:"400"}},readonly:y.isReadonly,required:""},{"label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(s),{keypath:"certificates.form.fields.cert.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("em",null,o.toDisplayString(o.unref(c)("certificates.form.fields.cert.emphasis")),1)]),_:1})]),_:1},8,["modelValue","label","readonly"]),o.createVNode(j,{modelValue:y.fields.key,"onUpdate:modelValue":C[1]||(C[1]=re=>y.fields.key=re),modelModifiers:{trim:!0},"character-limit":!1,class:"certificate-form-textarea","data-testid":"certificate-form-key",label:o.unref(c)("certificates.form.fields.key.label"),"label-attributes":{tooltipAttributes:{maxWidth:"400"}},readonly:y.isReadonly,required:""},{"label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(s),{keypath:"certificates.form.fields.key.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("em",null,o.toDisplayString(o.unref(c)("certificates.form.fields.key.emphasis")),1)]),_:1})]),_:1},8,["modelValue","label","readonly"]),o.createVNode(j,{modelValue:y.fields.certAlt,"onUpdate:modelValue":C[2]||(C[2]=re=>y.fields.certAlt=re),modelModifiers:{trim:!0},"character-limit":!1,class:"certificate-form-textarea","data-testid":"certificate-form-cert-alt",label:o.unref(c)("certificates.form.fields.cert_alt.label"),"label-attributes":{tooltipAttributes:{maxWidth:"400"}},readonly:y.isReadonly},{"label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(s),{keypath:"certificates.form.fields.cert_alt.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("em",null,o.toDisplayString(o.unref(c)("certificates.form.fields.cert_alt.emphasis")),1)]),_:1})]),_:1},8,["modelValue","label","readonly"]),o.createVNode(j,{modelValue:y.fields.keyAlt,"onUpdate:modelValue":C[3]||(C[3]=re=>y.fields.keyAlt=re),modelModifiers:{trim:!0},"character-limit":!1,class:"certificate-form-textarea","data-testid":"certificate-form-key-alt",label:o.unref(c)("certificates.form.fields.key_alt.label"),"label-attributes":{tooltipAttributes:{maxWidth:"400"}},readonly:y.isReadonly},{"label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(s),{keypath:"certificates.form.fields.key_alt.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("em",null,o.toDisplayString(o.unref(c)("certificates.form.fields.key_alt.emphasis")),1)]),_:1})]),_:1},8,["modelValue","label","readonly"]),r.showSnisField&&r.config.sniListRoute?(o.openBlock(),o.createBlock($d,{key:0,modelValue:y.fields.snis,"onUpdate:modelValue":C[4]||(C[4]=re=>y.fields.snis=re),"is-editing":b.value===o.unref(T.EntityBaseFormType).Edit,"sni-list-route":r.config.sniListRoute,onAdd:A,onRemove:C[5]||(C[5]=re=>w(re))},null,8,["modelValue","is-editing","sni-list-route"])):o.createCommentVNode("",!0)]),_:1},8,["description","title"]),o.createVNode(o.unref(T.EntityFormSection),{description:o.unref(c)("certificates.form.sections.general.description"),title:o.unref(c)("certificates.form.sections.general.title")},{default:o.withCtx(()=>[o.createVNode(de,{modelValue:y.fields.tags,"onUpdate:modelValue":C[6]||(C[6]=re=>y.fields.tags=re),modelModifiers:{trim:!0},autocomplete:"off","data-testid":"certificate-form-tags",help:o.unref(c)("certificates.form.fields.tags.help"),label:o.unref(c)("certificates.form.fields.tags.label"),"label-attributes":{info:o.unref(c)("certificates.form.fields.tags.tooltip"),tooltipAttributes:{maxWidth:"400"}},placeholder:o.unref(c)("certificates.form.fields.tags.placeholder"),readonly:y.isReadonly,type:"text"},null,8,["modelValue","help","label","label-attributes","placeholder","readonly"])]),_:1},8,["description","title"])]),_:1},8,["can-submit","config","edit-id","enable-terraform","entity-type","error-message","fetch-url","form-fields","is-readonly"])])}}}),[["__scopeId","data-v-db6ee71c"]]),_n="/v2/control-planes/{controlPlaneId}/core-entities",jn="/{workspace}",ri={list:{konnect:`${_n}/ca_certificates`,kongManager:`${jn}/ca_certificates`},form:{konnect:{create:`${_n}/ca_certificates`,edit:`${_n}/ca_certificates/{id}`,validate:`${_n}/v1/schemas/json/ca-certificate/validate`},kongManager:{create:`${jn}/ca_certificates`,edit:`${jn}/ca_certificates/{id}`,validate:`${jn}/schemas/ca_certificates/validate`}}},Ld={class:"kong-ui-ca-certificate-entity-config-card"},Fd={key:0},Kd=qt(o.defineComponent({__name:"CACertificateConfigCard",props:{config:{type:Object,required:!0,validator:r=>!(!r||!["konnect","kongManager"].includes(r==null?void 0:r.app)||r.app==="konnect"&&!r.controlPlaneId||r.app==="kongManager"&&typeof r.workspace!="string"||!r.entityId)},configCardDoc:{type:String,default:"",required:!1},hideTitle:{type:Boolean,default:!1},enableTerraform:{type:Boolean,default:!1}},emits:["loading","fetch:error","fetch:success"],setup(r,{emit:e}){const t=["dns_names","san_names","subject"],i=e,n=r,{i18n:{t:s,formatUnixTimeStamp:c}}=Ze.useI18n(),{convertKeyToTitle:u}=T.useStringHelpers(),{getPropValue:f}=T.useHelpers(),{getCertificateData:d}=Ze.useCertificate(),b=o.computed(()=>ri.form[n.config.app].edit),y=o.ref(),W=o.computed(()=>{if(y.value)return d(y.value)}),O=o.computed(()=>{var k;return((k=W.value)==null?void 0:k.schemaIssuer)||""}),p=o.computed(()=>{var k,B;return(k=W.value)!=null&&k.schemaExpiry?c((B=W.value)==null?void 0:B.schemaExpiry):""}),m=o.computed(()=>{var k;return((k=W.value)==null?void 0:k.schemaKeyUsages)||[]}),A=(k,B)=>{const Z=f("rowValue",B);if(k==="expiry")return p.value;if(k==="key_usages")return m.value;if(Z)return Z[k]},w=k=>{y.value=k,i("fetch:success",k)},I=o.ref({id:{},updated_at:{},created_at:{},cert:{section:T.ConfigurationSchemaSection.Basic,label:s("ca-certificates.form.fields.cert.label"),tooltip:s("ca-certificates.form.fields.cert.tooltip"),order:5},cert_digest:{section:T.ConfigurationSchemaSection.Basic,label:s("ca-certificates.form.fields.cert_digest.label"),tooltip:s("ca-certificates.form.fields.cert_digest.tooltip"),order:6},metadata:{section:T.ConfigurationSchemaSection.Basic,type:T.ConfigurationSchemaType.Json,order:7},...n.config.app==="kongManager"&&{expiry:{label:s("certificates.list.table_headers.expiry"),section:T.ConfigurationSchemaSection.Basic,order:1.7,forceShow:!0},issuer:{section:T.ConfigurationSchemaSection.Basic,order:1.5,forceShow:!0},key_usages:{section:T.ConfigurationSchemaSection.Basic,forceShow:!0}},tags:{tooltip:s("ca-certificates.form.fields.tags.tooltip")}});return(k,B)=>{const Z=o.resolveComponent("KCodeBlock"),se=o.resolveComponent("KLabel"),D=o.resolveComponent("KBadge");return o.openBlock(),o.createElementBlock("div",Ld,[o.createVNode(o.unref(T.EntityBaseConfigCard),{config:r.config,"config-card-doc":r.configCardDoc,"config-schema":I.value,"enable-terraform":r.enableTerraform,"entity-type":o.unref(T.SupportedEntityType).CaCertificate,"fetch-url":b.value,"hide-title":r.hideTitle,"onFetch:error":B[0]||(B[0]=C=>k.$emit("fetch:error",C)),"onFetch:success":w,onLoading:B[1]||(B[1]=C=>k.$emit("loading",C))},{cert:o.withCtx(C=>[o.unref(f)("rowValue",C)?(o.openBlock(),o.createBlock(Z,{key:0,id:`ca-cert-${r.config.entityId}-cert-codeblock`,code:o.unref(f)("rowValue",C),language:"plaintext","single-line":""},null,8,["id","code"])):o.createCommentVNode("",!0)]),"metadata-label":o.withCtx(()=>[o.createVNode(se,{class:"metadata-label"},{default:o.withCtx(()=>[o.createTextVNode(" Metadata ")]),_:1})]),metadata:o.withCtx(C=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Object.keys(o.unref(f)("rowValue",C)).filter(j=>!t.includes(j)),j=>(o.openBlock(),o.createBlock(o.unref(T.ConfigCardItem),{key:j,"data-testid":`ca-cert-metadata-${j}`,item:{key:j,label:o.unref(u)(j),value:A(j,C),type:j==="key_usages"?o.unref(T.ConfigurationSchemaType).BadgeTag:o.unref(T.ConfigurationSchemaType).Text}},null,8,["data-testid","item"]))),128))]),expiry:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(p.value||"–"),1)]),issuer:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.value||"–"),1)]),key_usages:o.withCtx(()=>[m.value.length?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Fd,o.toDisplayString("–"))),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(m.value,(C,j)=>(o.openBlock(),o.createBlock(D,{key:`key_usages-badge-tag-${j}`,class:"config-badge","data-testid":`key_usages-badge-tag-${j}`,tooltip:C,"truncation-tooltip":""},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(C),1)]),_:2},1032,["data-testid","tooltip"]))),128))]),_:1},8,["config","config-card-doc","config-schema","enable-terraform","entity-type","fetch-url","hide-title"])])}}}),[["__scopeId","data-v-46ffa2f8"]]),qd={class:"kong-ui-entities-ca-certificates-list"},Gd={key:0},Wd={key:1},zd={key:0},Jd={key:1},Yd={key:1},Zd=qt(o.defineComponent({__name:"CACertificateList",props:{config:{type:Object,required:!0,validator:r=>!(!r||!["konnect","kongManager"].includes(r==null?void 0:r.app)||!r.createRoute||!r.getViewRoute||!r.getEditRoute||r.app==="kongManager"&&!r.isExactMatch&&!r.filterSchema)},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},canRetrieve:{type:Function,required:!1,default:async()=>!0},useActionOutside:{type:Boolean,default:!1}},emits:["error","copy:success","copy:error","delete:success"],setup(r,{emit:e}){var z;const t=e,i=r,{i18n:{t:n,formatUnixTimeStamp:s},i18nT:c}=Ze.useI18n(),u=ni.useRouter(),{axiosInstance:f}=T.useAxios((z=i.config)==null?void 0:z.axiosRequestConfig),d=o.ref(1),b=o.computed(()=>i.config.app!=="kongManager"||!!i.config.disableSorting),W={issuer:{label:n("ca-certificates.list.table_headers.issuer"),hidable:!1},expiry:{label:n("ca-certificates.list.table_headers.expiry")},tags:{label:n("ca-certificates.list.table_headers.tags"),sortable:!0}},O=o.computed(()=>{var R,H;let J=`${i.config.apiBaseUrl}${ri.list[i.config.app]}`;return i.config.app==="konnect"?J=J.replace(/{controlPlaneId}/gi,((R=i.config)==null?void 0:R.controlPlaneId)||""):i.config.app==="kongManager"&&(J=J.replace(/\/{workspace}/gi,(H=i.config)!=null&&H.workspace?`/${i.config.workspace}`:"")),J}),p=o.ref(""),m=o.computed(()=>{const J=i.config.app==="konnect"||i.config.isExactMatch;return J?{isExactMatch:J,placeholder:n("ca-certificates.search.placeholder")}:{isExactMatch:J,schema:i.config.filterSchema}}),{fetcher:A,fetcherState:w}=T.useFetcher(i.config,O.value),I=()=>{p.value=""},k=()=>{d.value++},B=o.ref(null),Z=(J,R)=>{const H=J.id;if(!R(H)){t("copy:error",{entity:J,field:"id",message:n("ca-certificates.errors.copy")});return}t("copy:success",{entity:J,field:"id",message:n("ca-certificates.copy.success",{val:H})})},se=(J,R)=>{const H=JSON.stringify(J);if(!R(H)){t("copy:error",{entity:J,message:n("ca-certificates.errors.copy")});return}t("copy:success",{entity:J,message:n("ca-certificates.copy.success_brief")})},D=async J=>{var H;await((H=i.canRetrieve)==null?void 0:H.call(i,J))&&u.push(i.config.getViewRoute(J.id))},C=J=>({label:n("ca-certificates.actions.view"),to:i.config.getViewRoute(J)}),j=J=>({label:n("ca-certificates.actions.edit"),to:i.config.getEditRoute(J)}),de=o.ref(void 0),re=o.ref(!1),Be=o.ref(!1),ce=o.ref(""),pe=T.useDeleteUrlBuilder(i.config,O.value),{certificateDataCache:at,getCertificateData:ee}=Ze.useCertificate(),vt=J=>{de.value=J,re.value=!0},vr=()=>{re.value=!1},wr=async()=>{var J,R,H;if((J=de.value)!=null&&J.id){Be.value=!0;try{await f.delete(pe(de.value.id)),Be.value=!1,re.value=!1,d.value++,t("delete:success",de.value)}catch(ae){ce.value=((H=(R=ae.response)==null?void 0:R.data)==null?void 0:H.message)||ae.message||n("ca-certificates.errors.delete"),t("error",ae)}finally{Be.value=!1}}},Gt=o.ref(!1);o.watch(w,J=>{var R,H,ae,Ne;if(Array.isArray((R=J==null?void 0:J.response)==null?void 0:R.data)&&(Gt.value=J.response.data.length>0),J.status===T.FetcherStatus.Error){B.value={title:n("ca-certificates.errors.general")},(Ne=(ae=(H=J.error)==null?void 0:H.response)==null?void 0:ae.data)!=null&&Ne.message&&(B.value.message=J.error.response.data.message),t("error",J.error);return}at.value={},B.value=null});const wt=o.ref({ctaPath:i.config.createRoute,ctaText:void 0,message:`${n("ca-certificates.list.empty_state.description")}${i.config.additionMessageForEmptyState?` ${i.config.additionMessageForEmptyState}`:""}`,title:n("ca-certificates.title")});return o.onBeforeMount(async()=>{await i.canCreate()&&(wt.value.title=n("ca-certificates.list.empty_state.title"),wt.value.ctaText=n("ca-certificates.actions.create"))}),(J,R)=>{const H=o.resolveComponent("KButton"),ae=o.resolveComponent("KBadge"),Ne=o.resolveComponent("KTruncate"),Ue=o.resolveComponent("KDropdownItem"),Ar=o.resolveComponent("KClipboardProvider");return o.openBlock(),o.createElementBlock("div",qd,[o.createVNode(o.unref(T.EntityBaseTable),{"cache-identifier":r.cacheIdentifier,"disable-pagination-page-jump":"","disable-sorting":b.value,"empty-state-options":wt.value,"enable-entity-actions":"","error-message":B.value,fetcher:o.unref(A),"fetcher-cache-key":d.value,"pagination-type":"offset","preferences-storage-key":"kong-ui-entities-ca-certificates-list",query:p.value,"table-headers":o.unref(W),"use-action-outside":r.useActionOutside,onClearSearchInput:I,"onClick:row":R[2]||(R[2]=Y=>D(Y)),onSort:k},{"toolbar-filter":o.withCtx(()=>[o.createVNode(o.unref(T.EntityFilter),{modelValue:p.value,"onUpdate:modelValue":R[0]||(R[0]=Y=>p.value=Y),config:m.value},null,8,["modelValue","config"])]),"toolbar-button":o.withCtx(()=>[(o.openBlock(),o.createBlock(o.Teleport,{disabled:!r.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[o.createVNode(o.unref(T.PermissionsWrapper),{"auth-function":()=>r.canCreate()},{default:o.withCtx(()=>[o.withDirectives(o.createVNode(H,{appearance:"primary","data-testid":"toolbar-add-ca-certificate",size:"large",to:r.config.createRoute},{default:o.withCtx(()=>[o.createVNode(o.unref(oi.AddIcon)),o.createTextVNode(" "+o.toDisplayString(o.unref(n)("ca-certificates.list.toolbar_actions.new_ca_certificate")),1)]),_:1},8,["to"]),[[o.vShow,Gt.value]])]),_:1},8,["auth-function"])],8,["disabled"]))]),issuer:o.withCtx(({row:Y})=>{var be;return[r.config.app==="konnect"?(o.openBlock(),o.createElementBlock("b",Gd,o.toDisplayString((be=Y==null?void 0:Y.metadata)!=null&&be.issuer?Y.metadata.issuer:"-"),1)):(o.openBlock(),o.createElementBlock("b",Wd,o.toDisplayString(o.unref(ee)(Y).schemaIssuer||"-"),1))]}),expiry:o.withCtx(({row:Y})=>{var be;return[r.config.app==="konnect"?(o.openBlock(),o.createElementBlock("span",zd,o.toDisplayString((be=Y==null?void 0:Y.metadata)!=null&&be.expiry?o.unref(s)(Y.metadata.expiry):"-"),1)):(o.openBlock(),o.createElementBlock("span",Jd,o.toDisplayString(o.unref(ee)(Y).schemaExpiry?o.unref(s)(o.unref(ee)(Y).schemaExpiry):"-"),1))]}),tags:o.withCtx(({row:Y})=>{var be;return[((be=Y==null?void 0:Y.tags)==null?void 0:be.length)>0?(o.openBlock(),o.createBlock(Ne,{key:0},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Y==null?void 0:Y.tags,q=>(o.openBlock(),o.createBlock(ae,{key:q,onClick:R[1]||(R[1]=o.withModifiers(()=>{},["stop"]))},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(q),1)]),_:2},1024))),128))]),_:2},1024)):(o.openBlock(),o.createElementBlock("span",Yd,"-"))]}),actions:o.withCtx(({row:Y})=>[o.createVNode(Ar,null,{default:o.withCtx(({copyToClipboard:be})=>[o.createVNode(Ue,{"data-testid":"action-entity-copy-id",onClick:q=>Z(Y,be)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("ca-certificates.actions.copy_id")),1)]),_:2},1032,["onClick"])]),_:2},1024),o.createVNode(Ar,null,{default:o.withCtx(({copyToClipboard:be})=>[o.createVNode(Ue,{"data-testid":"action-entity-copy-json",onClick:q=>se(Y,be)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("ca-certificates.actions.copy_json")),1)]),_:2},1032,["onClick"])]),_:2},1024),o.createVNode(o.unref(T.PermissionsWrapper),{"auth-function":()=>r.canRetrieve(Y)},{default:o.withCtx(()=>[o.createVNode(Ue,{"data-testid":"action-entity-view","has-divider":"",item:C(Y.id)},null,8,["item"])]),_:2},1032,["auth-function"]),o.createVNode(o.unref(T.PermissionsWrapper),{"auth-function":()=>r.canEdit(Y)},{default:o.withCtx(()=>[o.createVNode(Ue,{"data-testid":"action-entity-edit",item:j(Y.id)},null,8,["item"])]),_:2},1032,["auth-function"]),o.createVNode(o.unref(T.PermissionsWrapper),{"auth-function":()=>r.canDelete(Y)},{default:o.withCtx(()=>[o.createVNode(Ue,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:be=>vt(Y)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("ca-certificates.actions.delete")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"])]),_:1},8,["cache-identifier","disable-sorting","empty-state-options","error-message","fetcher","fetcher-cache-key","query","table-headers","use-action-outside"]),o.createVNode(o.unref(T.EntityDeleteModal),{"action-pending":Be.value,"entity-type":o.unref(T.EntityTypes).CACertificate,error:ce.value,title:o.unref(n)("ca-certificates.delete.title"),visible:re.value,onCancel:vr,onProceed:wr},{description:o.withCtx(()=>[o.createVNode(o.unref(c),{keypath:"ca-certificates.delete.description",scope:"global"},{"bolded-text":o.withCtx(()=>[o.createElementVNode("b",null,o.toDisplayString(o.unref(n)("ca-certificates.delete.boldedText")),1)]),_:1}),o.createElementVNode("p",null,o.toDisplayString(o.unref(n)("ca-certificates.delete.description2")),1)]),_:1},8,["action-pending","entity-type","error","title","visible"])])}}}),[["__scopeId","data-v-8620b081"]]),Qd={class:"kong-ui-entities-ca-certificates-form"},Xd=qt(o.defineComponent({__name:"CACertificateForm",props:{config:{type:Object,required:!0,validator:r=>!(!r||!["konnect","kongManager"].includes(r==null?void 0:r.app)||r.app==="konnect"&&!r.controlPlaneId||r.app==="kongManager"&&typeof r.workspace!="string"||!r.cancelRoute)},certificateId:{type:String,required:!1,default:""},enableTerraform:{type:Boolean,default:!1}},emits:["update","error","loading"],setup(r,{emit:e}){var k;const t=e,i=r,n=ni.useRouter(),{i18n:{t:s}}=Ze.useI18n(),{getMessageFromError:c}=T.useErrors(),{axiosInstance:u}=T.useAxios((k=i.config)==null?void 0:k.axiosRequestConfig),f=o.computed(()=>ri.form[i.config.app].edit),d=o.computed(()=>i.certificateId?T.EntityBaseFormType.Edit:T.EntityBaseFormType.Create),b=o.reactive({fields:{cert:"",certDigest:"",tags:""},isReadonly:!1,errorMessage:""}),y=o.reactive({cert:"",certDigest:"",tags:""}),W=o.computed(()=>(d.value===T.EntityBaseFormType.Create||JSON.stringify(b.fields)!==JSON.stringify(y))&&!!b.fields.cert),O=B=>{var Z;b.fields.cert=(B==null?void 0:B.cert)||"",b.fields.certDigest=(B==null?void 0:B.cert_digest)||"",b.fields.tags=((Z=B==null?void 0:B.tags)==null?void 0:Z.join(", "))||"",Object.assign(y,b.fields)},p=()=>{n.push(i.config.cancelRoute)},m=o.computed(()=>{var Z,se;let B=`${i.config.apiBaseUrl}${ri.form[i.config.app].validate}`;return i.config.app==="konnect"?B=B.replace(/{controlPlaneId}/gi,((Z=i.config)==null?void 0:Z.controlPlaneId)||""):i.config.app==="kongManager"&&(B=B.replace(/\/{workspace}/gi,(se=i.config)!=null&&se.workspace?`/${i.config.workspace}`:"")),B=B.replace(/{id}/gi,i.certificateId),B}),A=o.computed(()=>{var Z,se;let B=`${i.config.apiBaseUrl}${ri.form[i.config.app][d.value]}`;return i.config.app==="konnect"?B=B.replace(/{controlPlaneId}/gi,((Z=i.config)==null?void 0:Z.controlPlaneId)||""):i.config.app==="kongManager"&&(B=B.replace(/\/{workspace}/gi,(se=i.config)!=null&&se.workspace?`/${i.config.workspace}`:"")),B=B.replace(/{id}/gi,i.certificateId),B}),w=o.computed(()=>{var B,Z;return{cert:b.fields.cert,cert_digest:b.fields.certDigest||null,tags:(Z=(B=b.fields.tags.split(","))==null?void 0:B.map(se=>String(se||"").trim()))==null?void 0:Z.filter(se=>se!=="")}}),I=async()=>{var B,Z,se,D,C;try{b.isReadonly=!0;let j;await u.post(m.value,w.value),d.value==="create"?j=await u.post(A.value,w.value):d.value==="edit"&&(j=((B=i.config)==null?void 0:B.app)==="konnect"?await u.put(A.value,w.value):await u.patch(A.value,w.value)),b.fields.cert=((Z=j==null?void 0:j.data)==null?void 0:Z.cert)||"",b.fields.certDigest=((se=j==null?void 0:j.data)==null?void 0:se.cert_digest)||"",b.fields.tags=((C=(D=j==null?void 0:j.data)==null?void 0:D.tags)==null?void 0:C.join(", "))||"",Object.assign(y,b.fields),t("update",j==null?void 0:j.data)}catch(j){b.errorMessage=c(j),t("error",j)}finally{b.isReadonly=!1}};return(B,Z)=>{const se=o.resolveComponent("KTextArea"),D=o.resolveComponent("KInput");return o.openBlock(),o.createElementBlock("div",Qd,[o.createVNode(o.unref(T.EntityBaseForm),{"can-submit":W.value,config:r.config,"edit-id":r.certificateId,"enable-terraform":r.enableTerraform,"entity-type":o.unref(T.SupportedEntityType).CaCertificate,"error-message":b.errorMessage,"fetch-url":f.value,"form-fields":w.value,"is-readonly":b.isReadonly,onCancel:p,"onFetch:error":Z[3]||(Z[3]=C=>B.$emit("error",C)),"onFetch:success":O,onLoading:Z[4]||(Z[4]=C=>B.$emit("loading",C)),onSubmit:I},{default:o.withCtx(()=>[o.createVNode(o.unref(T.EntityFormSection),{description:o.unref(s)("ca-certificates.form.sections.cert.description"),title:o.unref(s)("ca-certificates.form.sections.cert.title")},{default:o.withCtx(()=>[o.createVNode(se,{modelValue:b.fields.cert,"onUpdate:modelValue":Z[0]||(Z[0]=C=>b.fields.cert=C),modelModifiers:{trim:!0},"character-limit":!1,class:"certificate-form-textarea","data-testid":"ca-certificate-form-cert",label:o.unref(s)("ca-certificates.form.fields.cert.label"),"label-attributes":{info:o.unref(s)("ca-certificates.form.fields.cert.tooltip"),tooltipAttributes:{maxWidth:"400"}},readonly:b.isReadonly,required:""},null,8,["modelValue","label","label-attributes","readonly"]),o.createVNode(D,{modelValue:b.fields.certDigest,"onUpdate:modelValue":Z[1]||(Z[1]=C=>b.fields.certDigest=C),modelModifiers:{trim:!0},autocomplete:"off","data-testid":"ca-certificate-form-cert-digest",label:o.unref(s)("ca-certificates.form.fields.cert_digest.label"),readonly:b.isReadonly,type:"text"},null,8,["modelValue","label","readonly"])]),_:1},8,["description","title"]),o.createVNode(o.unref(T.EntityFormSection),{description:o.unref(s)("ca-certificates.form.sections.general.description"),title:o.unref(s)("ca-certificates.form.sections.general.title")},{default:o.withCtx(()=>[o.createVNode(D,{modelValue:b.fields.tags,"onUpdate:modelValue":Z[2]||(Z[2]=C=>b.fields.tags=C),modelModifiers:{trim:!0},autocomplete:"off","data-testid":"ca-certificate-form-tags",help:o.unref(s)("ca-certificates.form.fields.tags.help"),label:o.unref(s)("ca-certificates.form.fields.tags.label"),"label-attributes":{info:o.unref(s)("ca-certificates.form.fields.tags.tooltip"),tooltipAttributes:{maxWidth:"400"}},placeholder:o.unref(s)("ca-certificates.form.fields.tags.placeholder"),readonly:b.isReadonly,type:"text"},null,8,["modelValue","help","label","label-attributes","placeholder","readonly"])]),_:1},8,["description","title"])]),_:1},8,["can-submit","config","edit-id","enable-terraform","entity-type","error-message","fetch-url","form-fields","is-readonly"])])}}}),[["__scopeId","data-v-1ee1bc34"]]),ep={class:"kong-ui-certificate-entity-config-card"},tp={key:0},rp=qt(o.defineComponent({__name:"CertificateConfigCard",props:{config:{type:Object,required:!0,validator:r=>!(!r||!["konnect","kongManager"].includes(r==null?void 0:r.app)||r.app==="konnect"&&!r.controlPlaneId||r.app==="kongManager"&&typeof r.workspace!="string"||!r.entityId)},configCardDoc:{type:String,default:"",required:!1},hideTitle:{type:Boolean,default:!1},enableTerraform:{type:Boolean,default:!1}},emits:["loading","fetch:error","fetch:success"],setup(r,{emit:e}){const t=e,i=r,{i18n:{t:n,formatUnixTimeStamp:s},i18nT:c}=Ze.useI18n(),{convertKeyToTitle:u}=T.useStringHelpers(),{getPropValue:f}=T.useHelpers(),{getCertificateData:d}=Ze.useCertificate(),b=o.computed(()=>ti.form[i.config.app].edit),y=o.ref(),W=o.ref({id:{},cert:{section:T.ConfigurationSchemaSection.Basic},key:{section:T.ConfigurationSchemaSection.Basic,type:T.ConfigurationSchemaType.Redacted},metadata:{section:T.ConfigurationSchemaSection.Basic,type:T.ConfigurationSchemaType.Json},snis:{section:T.ConfigurationSchemaSection.Basic,type:T.ConfigurationSchemaType.BadgeTag,label:n("certificates.list.table_headers.snis")},updated_at:{},created_at:{},tags:{tooltip:n("certificates.form.fields.tags.tooltip")},...i.config.app==="kongManager"&&{expiry:{section:T.ConfigurationSchemaSection.Basic,label:n("certificates.list.table_headers.expiry"),forceShow:!0},issuer:{section:T.ConfigurationSchemaSection.Basic,label:n("certificates.list.table_headers.issuer"),forceShow:!0},san_names:{section:T.ConfigurationSchemaSection.Basic,label:n("certificates.list.table_headers.san"),forceShow:!0},subject:{section:T.ConfigurationSchemaSection.Basic,label:n("certificates.list.table_headers.subject"),forceShow:!0},key_usages:{forceShow:!0}},cert_alt:{section:T.ConfigurationSchemaSection.Advanced},key_alt:{section:T.ConfigurationSchemaSection.Advanced,type:T.ConfigurationSchemaType.Redacted}}),O=C=>{y.value=C,t("fetch:success",C)},p=(C,j)=>{const de=f("rowValue",j);if(C==="expiry")return A.value;if(C==="key_usages")return B.value;if(C==="san_names")return I.value;if(de)return de[C]},m=o.computed(()=>{if(y.value)return d(y.value)}),A=o.computed(()=>{var C,j;return(C=m.value)!=null&&C.schemaExpiry?s((j=m.value)==null?void 0:j.schemaExpiry):""}),w=o.computed(()=>{var C;return((C=m.value)==null?void 0:C.schemaIssuer)||""}),I=o.computed(()=>{var C;return((C=m.value)==null?void 0:C.schemaSanNames)||""}),k=o.computed(()=>{var C;return((C=m.value)==null?void 0:C.schemaSubject)||""}),B=o.computed(()=>{var C;return((C=m.value)==null?void 0:C.schemaKeyUsages)||[]}),Z=o.computed(()=>{var C,j;return((j=(C=y==null?void 0:y.value)==null?void 0:C.snis)==null?void 0:j.length)>0}),se=o.computed(()=>{var C;return!!((C=y==null?void 0:y.value)!=null&&C.cert_alt)}),D=C=>{var j,de;return C==="san_names"?n("certificates.list.table_headers.san"):((de=(j=W.value)==null?void 0:j[C])==null?void 0:de.label)||u(C)};return(C,j)=>{const de=o.resolveComponent("KCodeBlock"),re=o.resolveComponent("KLabel"),Be=o.resolveComponent("KBadge");return o.openBlock(),o.createElementBlock("div",ep,[o.createVNode(o.unref(T.EntityBaseConfigCard),{config:r.config,"config-card-doc":r.configCardDoc,"config-schema":W.value,"enable-terraform":r.enableTerraform,"entity-type":o.unref(T.SupportedEntityType).Certificate,"fetch-url":b.value,"hide-title":r.hideTitle,"onFetch:error":j[0]||(j[0]=ce=>C.$emit("fetch:error",ce)),"onFetch:success":O,onLoading:j[1]||(j[1]=ce=>C.$emit("loading",ce))},o.createSlots({"cert-label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(c),{keypath:"certificates.form.fields.cert.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("i",null,o.toDisplayString(o.unref(n)("certificates.form.fields.cert.emphasis")),1)]),_:1})]),cert:o.withCtx(ce=>[o.unref(f)("rowValue",ce)?(o.openBlock(),o.createBlock(de,{key:0,id:`certificate-${r.config.entityId}-cert-codeblock`,code:o.unref(f)("rowValue",ce),language:"plaintext","single-line":""},null,8,["id","code"])):o.createCommentVNode("",!0)]),"key-label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(c),{keypath:"certificates.form.fields.key.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("i",null,o.toDisplayString(o.unref(n)("certificates.form.fields.key.emphasis")),1)]),_:1})]),"metadata-label":o.withCtx(()=>[o.createVNode(re,{class:"metadata-label"},{default:o.withCtx(()=>[o.createTextVNode(" Metadata ")]),_:1})]),metadata:o.withCtx(ce=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Object.keys(o.unref(f)("rowValue",ce)),pe=>(o.openBlock(),o.createBlock(o.unref(T.ConfigCardItem),{key:pe,item:{key:pe,value:p(pe,ce),label:D(pe),type:pe==="key_usages"||pe==="snis"||pe==="dns_names"?o.unref(T.ConfigurationSchemaType).BadgeTag:o.unref(T.ConfigurationSchemaType).Text}},null,8,["item"]))),128))]),expiry:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(A.value||"–"),1)]),issuer:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(w.value||"–"),1)]),san_names:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(I.value||"–"),1)]),subject:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(k.value||"–"),1)]),"cert_alt-label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(c),{keypath:"certificates.form.fields.cert_alt.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("i",null,o.toDisplayString(o.unref(n)("certificates.form.fields.cert_alt.emphasis")),1)]),_:1})]),"key_alt-label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(c),{keypath:"certificates.form.fields.key_alt.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("i",null,o.toDisplayString(o.unref(n)("certificates.form.fields.key_alt.emphasis")),1)]),_:1})]),key_usages:o.withCtx(()=>[B.value.length?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",tp,o.toDisplayString("–"))),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(B.value,(ce,pe)=>(o.openBlock(),o.createBlock(Be,{key:`key_usages-badge-tag-${pe}`,class:"config-badge","data-testid":`key_usages-badge-tag-${pe}`,tooltip:ce,"truncation-tooltip":""},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(ce),1)]),_:2},1032,["data-testid","tooltip"]))),128))]),_:2},[Z.value?void 0:{name:"snis",fn:o.withCtx(()=>[o.createTextVNode(" – ")]),key:"0"},se.value?{name:"cert_alt",fn:o.withCtx(ce=>[o.createTextVNode(" > "),o.unref(f)("rowValue",ce)?(o.openBlock(),o.createBlock(de,{key:0,id:`certificate-${r.config.entityId}-cert-alt-codeblock`,code:o.unref(f)("rowValue",ce),language:"plaintext","single-line":""},null,8,["id","code"])):o.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["config","config-card-doc","config-schema","enable-terraform","entity-type","fetch-url","hide-title"])])}}}),[["__scopeId","data-v-c65f3278"]]);xe.CACertificateConfigCard=Kd,xe.CACertificateForm=Xd,xe.CACertificateList=Zd,xe.CertificateConfigCard=rp,xe.CertificateForm=Hd,xe.CertificateList=jd,Object.defineProperty(xe,Symbol.toStringTag,{value:"Module"})});
|