@opensecret/react 0.3.5 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(Je,We){typeof exports=="object"&&typeof module<"u"?We(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],We):(Je=typeof globalThis<"u"?globalThis:Je||self,We(Je.OpenSecretReact={},Je.React))})(this,function(Je,We){"use strict";var bm=Object.defineProperty;var q0=Je=>{throw TypeError(Je)};var xm=(Je,We,Ot)=>We in Je?bm(Je,We,{enumerable:!0,configurable:!0,writable:!0,value:Ot}):Je[We]=Ot;var Ze=(Je,We,Ot)=>xm(Je,typeof We!="symbol"?We+"":We,Ot),Sf=(Je,We,Ot)=>We.has(Je)||q0("Cannot "+Ot);var M=(Je,We,Ot)=>(Sf(Je,We,"read from private field"),Ot?Ot.call(Je):We.get(Je)),or=(Je,We,Ot)=>We.has(Je)?q0("Cannot add the same private member more than once"):We instanceof WeakSet?We.add(Je):We.set(Je,Ot),jt=(Je,We,Ot,Wi)=>(Sf(Je,We,"write to private field"),Wi?Wi.call(Je,Ot):We.set(Je,Ot),Ot),$e=(Je,We,Ot)=>(Sf(Je,We,"access private method"),Ot);var Y0=(Je,We,Ot,Wi)=>({set _(Mc){jt(Je,We,Mc,Ot)},get _(){return M(Je,We,Wi)}});var Oo,Un,dn,ii,Jt,Ar,Mt,si,tt,Ki,$c,Ef,bn,xn,Br,Xr,Xt,$r,Qt,Zi,kf,Ro,pn,fr,yn,Dc,Q0,Z0,W0;var Ot=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wi(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Mc(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}var Vc={exports:{}},ks={};/**
1
+ (function(Xe,qe){typeof exports=="object"&&typeof module<"u"?qe(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],qe):(Xe=typeof globalThis<"u"?globalThis:Xe||self,qe(Xe.OpenSecretReact={},Xe.React))})(this,function(Xe,qe){"use strict";var bm=Object.defineProperty;var Z0=Xe=>{throw TypeError(Xe)};var xm=(Xe,qe,Ot)=>qe in Xe?bm(Xe,qe,{enumerable:!0,configurable:!0,writable:!0,value:Ot}):Xe[qe]=Ot;var We=(Xe,qe,Ot)=>xm(Xe,typeof qe!="symbol"?qe+"":qe,Ot),_f=(Xe,qe,Ot)=>qe.has(Xe)||Z0("Cannot "+Ot);var M=(Xe,qe,Ot)=>(_f(Xe,qe,"read from private field"),Ot?Ot.call(Xe):qe.get(Xe)),or=(Xe,qe,Ot)=>qe.has(Xe)?Z0("Cannot add the same private member more than once"):qe instanceof WeakSet?qe.add(Xe):qe.set(Xe,Ot),jt=(Xe,qe,Ot,Wi)=>(_f(Xe,qe,"write to private field"),Wi?Wi.call(Xe,Ot):qe.set(Xe,Ot),Ot),Me=(Xe,qe,Ot)=>(_f(Xe,qe,"access private method"),Ot);var W0=(Xe,qe,Ot,Wi)=>({set _(Mc){jt(Xe,qe,Mc,Ot)},get _(){return M(Xe,qe,Wi)}});var Oo,Un,dn,ii,Jt,Ar,Mt,si,rt,Ki,$c,Ef,bn,xn,Br,Xr,Xt,$r,Qt,Zi,kf,Ro,pn,fr,yn,Dc,J0,z0,K0;var Ot=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wi(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Mc(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}var Vc={exports:{}},ks={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var If;function ey(){if(If)return ks;If=1;var r=We,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(c,u,d){var b,S={},Y=null,$=null;d!==void 0&&(Y=""+d),u.key!==void 0&&(Y=""+u.key),u.ref!==void 0&&($=u.ref);for(b in u)n.call(u,b)&&!s.hasOwnProperty(b)&&(S[b]=u[b]);if(c&&c.defaultProps)for(b in u=c.defaultProps,u)S[b]===void 0&&(S[b]=u[b]);return{$$typeof:e,type:c,key:Y,ref:$,props:S,_owner:i.current}}return ks.Fragment=t,ks.jsx=o,ks.jsxs=o,ks}var Is={};/**
9
+ */var If;function X0(){if(If)return ks;If=1;var r=qe,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(c,u,d){var b,_={},q=null,$=null;d!==void 0&&(q=""+d),u.key!==void 0&&(q=""+u.key),u.ref!==void 0&&($=u.ref);for(b in u)n.call(u,b)&&!s.hasOwnProperty(b)&&(_[b]=u[b]);if(c&&c.defaultProps)for(b in u=c.defaultProps,u)_[b]===void 0&&(_[b]=u[b]);return{$$typeof:e,type:c,key:q,ref:$,props:_,_owner:i.current}}return ks.Fragment=t,ks.jsx=o,ks.jsxs=o,ks}var Is={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,20 +14,20 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Cf;function ty(){return Cf||(Cf=1,process.env.NODE_ENV!=="production"&&function(){var r=We,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),$=Symbol.for("react.offscreen"),w=Symbol.iterator,E="@@iterator";function B(h){if(h===null||typeof h!="object")return null;var m=w&&h[w]||h[E];return typeof m=="function"?m:null}var I=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function R(h){{for(var m=arguments.length,_=new Array(m>1?m-1:0),N=1;N<m;N++)_[N-1]=arguments[N];P("error",h,_)}}function P(h,m,_){{var N=I.ReactDebugCurrentFrame,W=N.getStackAddendum();W!==""&&(m+="%s",_=_.concat([W]));var F=_.map(function(ye){return String(ye)});F.unshift("Warning: "+m),Function.prototype.apply.call(console[h],console,F)}}var K=!1,de=!1,le=!1,pe=!1,Re=!1,st;st=Symbol.for("react.module.reference");function dt(h){return!!(typeof h=="string"||typeof h=="function"||h===n||h===s||Re||h===i||h===d||h===b||pe||h===$||K||de||le||typeof h=="object"&&h!==null&&(h.$$typeof===Y||h.$$typeof===S||h.$$typeof===o||h.$$typeof===c||h.$$typeof===u||h.$$typeof===st||h.getModuleId!==void 0))}function St(h,m,_){var N=h.displayName;if(N)return N;var W=m.displayName||m.name||"";return W!==""?_+"("+W+")":_}function Et(h){return h.displayName||"Context"}function lt(h){if(h==null)return null;if(typeof h.tag=="number"&&R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof h=="function")return h.displayName||h.name||null;if(typeof h=="string")return h;switch(h){case n:return"Fragment";case t:return"Portal";case s:return"Profiler";case i:return"StrictMode";case d:return"Suspense";case b:return"SuspenseList"}if(typeof h=="object")switch(h.$$typeof){case c:var m=h;return Et(m)+".Consumer";case o:var _=h;return Et(_._context)+".Provider";case u:return St(h,h.render,"ForwardRef");case S:var N=h.displayName||null;return N!==null?N:lt(h.type)||"Memo";case Y:{var W=h,F=W._payload,ye=W._init;try{return lt(ye(F))}catch{return null}}}return null}var yt=Object.assign,Xe=0,ze,oe,Te,pt,It,Ct,ue;function et(){}et.__reactDisabledLog=!0;function gt(){{if(Xe===0){ze=console.log,oe=console.info,Te=console.warn,pt=console.error,It=console.group,Ct=console.groupCollapsed,ue=console.groupEnd;var h={configurable:!0,enumerable:!0,value:et,writable:!0};Object.defineProperties(console,{info:h,log:h,warn:h,error:h,group:h,groupCollapsed:h,groupEnd:h})}Xe++}}function ee(){{if(Xe--,Xe===0){var h={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:yt({},h,{value:ze}),info:yt({},h,{value:oe}),warn:yt({},h,{value:Te}),error:yt({},h,{value:pt}),group:yt({},h,{value:It}),groupCollapsed:yt({},h,{value:Ct}),groupEnd:yt({},h,{value:ue})})}Xe<0&&R("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ot=I.ReactCurrentDispatcher,Bt;function gn(h,m,_){{if(Bt===void 0)try{throw Error()}catch(W){var N=W.stack.trim().match(/\n( *(at )?)/);Bt=N&&N[1]||""}return`
18
- `+Bt+h}}var vn=!1,Ht;{var Vi=typeof WeakMap=="function"?WeakMap:Map;Ht=new Vi}function Mr(h,m){if(!h||vn)return"";{var _=Ht.get(h);if(_!==void 0)return _}var N;vn=!0;var W=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var F;F=ot.current,ot.current=null,gt();try{if(m){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(Se){N=Se}Reflect.construct(h,[],ye)}else{try{ye.call()}catch(Se){N=Se}h.call(ye.prototype)}}else{try{throw Error()}catch(Se){N=Se}h()}}catch(Se){if(Se&&N&&typeof Se.stack=="string"){for(var L=Se.stack.split(`
19
- `),be=N.stack.split(`
20
- `),ge=L.length-1,xe=be.length-1;ge>=1&&xe>=0&&L[ge]!==be[xe];)xe--;for(;ge>=1&&xe>=0;ge--,xe--)if(L[ge]!==be[xe]){if(ge!==1||xe!==1)do if(ge--,xe--,xe<0||L[ge]!==be[xe]){var Ce=`
21
- `+L[ge].replace(" at new "," at ");return h.displayName&&Ce.includes("<anonymous>")&&(Ce=Ce.replace("<anonymous>",h.displayName)),typeof h=="function"&&Ht.set(h,Ce),Ce}while(ge>=1&&xe>=0);break}}}finally{vn=!1,ot.current=F,ee(),Error.prepareStackTrace=W}var Be=h?h.displayName||h.name:"",Oe=Be?gn(Be):"";return typeof h=="function"&&Ht.set(h,Oe),Oe}function Li(h,m,_){return Mr(h,!1)}function To(h){var m=h.prototype;return!!(m&&m.isReactComponent)}function mn(h,m,_){if(h==null)return"";if(typeof h=="function")return Mr(h,To(h));if(typeof h=="string")return gn(h);switch(h){case d:return gn("Suspense");case b:return gn("SuspenseList")}if(typeof h=="object")switch(h.$$typeof){case u:return Li(h.render);case S:return mn(h.type,m,_);case Y:{var N=h,W=N._payload,F=N._init;try{return mn(F(W),m,_)}catch{}}}return""}var wn=Object.prototype.hasOwnProperty,ai={},ci=I.ReactDebugCurrentFrame;function hr(h){if(h){var m=h._owner,_=mn(h.type,h._source,m?m.type:null);ci.setExtraStackFrame(_)}else ci.setExtraStackFrame(null)}function Dn(h,m,_,N,W){{var F=Function.call.bind(wn);for(var ye in h)if(F(h,ye)){var L=void 0;try{if(typeof h[ye]!="function"){var be=Error((N||"React class")+": "+_+" type `"+ye+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof h[ye]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw be.name="Invariant Violation",be}L=h[ye](m,ye,N,_,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ge){L=ge}L&&!(L instanceof Error)&&(hr(W),R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",N||"React class",_,ye,typeof L),hr(null)),L instanceof Error&&!(L.message in ai)&&(ai[L.message]=!0,hr(W),R("Failed %s type: %s",_,L.message),hr(null))}}}var li=Array.isArray;function $n(h){return li(h)}function Hi(h){{var m=typeof Symbol=="function"&&Symbol.toStringTag,_=m&&h[Symbol.toStringTag]||h.constructor.name||"Object";return _}}function ui(h){try{return fi(h),!1}catch{return!0}}function fi(h){return""+h}function Or(h){if(ui(h))return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Hi(h)),fi(h)}var Qr=I.ReactCurrentOwner,Fi={key:!0,ref:!0,__self:!0,__source:!0},Gi,hi,k;k={};function C(h){if(wn.call(h,"ref")){var m=Object.getOwnPropertyDescriptor(h,"ref").get;if(m&&m.isReactWarning)return!1}return h.ref!==void 0}function j(h){if(wn.call(h,"key")){var m=Object.getOwnPropertyDescriptor(h,"key").get;if(m&&m.isReactWarning)return!1}return h.key!==void 0}function q(h,m){if(typeof h.ref=="string"&&Qr.current&&m&&Qr.current.stateNode!==m){var _=lt(Qr.current.type);k[_]||(R('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',lt(Qr.current.type),h.ref),k[_]=!0)}}function Ee(h,m){{var _=function(){Gi||(Gi=!0,R("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};_.isReactWarning=!0,Object.defineProperty(h,"key",{get:_,configurable:!0})}}function xt(h,m){{var _=function(){hi||(hi=!0,R("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};_.isReactWarning=!0,Object.defineProperty(h,"ref",{get:_,configurable:!0})}}var At=function(h,m,_,N,W,F,ye){var L={$$typeof:e,type:h,key:m,ref:_,props:ye,_owner:F};return L._store={},Object.defineProperty(L._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(L,"_self",{configurable:!1,enumerable:!1,writable:!1,value:N}),Object.defineProperty(L,"_source",{configurable:!1,enumerable:!1,writable:!1,value:W}),Object.freeze&&(Object.freeze(L.props),Object.freeze(L)),L};function Ue(h,m,_,N,W){{var F,ye={},L=null,be=null;_!==void 0&&(Or(_),L=""+_),j(m)&&(Or(m.key),L=""+m.key),C(m)&&(be=m.ref,q(m,W));for(F in m)wn.call(m,F)&&!Fi.hasOwnProperty(F)&&(ye[F]=m[F]);if(h&&h.defaultProps){var ge=h.defaultProps;for(F in ge)ye[F]===void 0&&(ye[F]=ge[F])}if(L||be){var xe=typeof h=="function"?h.displayName||h.name||"Unknown":h;L&&Ee(ye,xe),be&&xt(ye,xe)}return At(h,L,be,W,N,Qr.current,ye)}}var X=I.ReactCurrentOwner,te=I.ReactDebugCurrentFrame;function re(h){if(h){var m=h._owner,_=mn(h.type,h._source,m?m.type:null);te.setExtraStackFrame(_)}else te.setExtraStackFrame(null)}var me;me=!1;function Ve(h){return typeof h=="object"&&h!==null&&h.$$typeof===e}function Qe(){{if(X.current){var h=lt(X.current.type);if(h)return`
17
+ */var Cf;function Q0(){return Cf||(Cf=1,process.env.NODE_ENV!=="production"&&function(){var r=qe,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),$=Symbol.for("react.offscreen"),w=Symbol.iterator,E="@@iterator";function B(h){if(h===null||typeof h!="object")return null;var m=w&&h[w]||h[E];return typeof m=="function"?m:null}var I=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function R(h){{for(var m=arguments.length,S=new Array(m>1?m-1:0),N=1;N<m;N++)S[N-1]=arguments[N];U("error",h,S)}}function U(h,m,S){{var N=I.ReactDebugCurrentFrame,Z=N.getStackAddendum();Z!==""&&(m+="%s",S=S.concat([Z]));var F=S.map(function(ye){return String(ye)});F.unshift("Warning: "+m),Function.prototype.apply.call(console[h],console,F)}}var fe=!1,oe=!1,ce=!1,X=!1,me=!1,$e;$e=Symbol.for("react.module.reference");function ot(h){return!!(typeof h=="string"||typeof h=="function"||h===n||h===s||me||h===i||h===d||h===b||X||h===$||fe||oe||ce||typeof h=="object"&&h!==null&&(h.$$typeof===q||h.$$typeof===_||h.$$typeof===o||h.$$typeof===c||h.$$typeof===u||h.$$typeof===$e||h.getModuleId!==void 0))}function _t(h,m,S){var N=h.displayName;if(N)return N;var Z=m.displayName||m.name||"";return Z!==""?S+"("+Z+")":S}function Et(h){return h.displayName||"Context"}function ut(h){if(h==null)return null;if(typeof h.tag=="number"&&R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof h=="function")return h.displayName||h.name||null;if(typeof h=="string")return h;switch(h){case n:return"Fragment";case t:return"Portal";case s:return"Profiler";case i:return"StrictMode";case d:return"Suspense";case b:return"SuspenseList"}if(typeof h=="object")switch(h.$$typeof){case c:var m=h;return Et(m)+".Consumer";case o:var S=h;return Et(S._context)+".Provider";case u:return _t(h,h.render,"ForwardRef");case _:var N=h.displayName||null;return N!==null?N:ut(h.type)||"Memo";case q:{var Z=h,F=Z._payload,ye=Z._init;try{return ut(ye(F))}catch{return null}}}return null}var yt=Object.assign,Qe=0,Ke,ae,Ne,pt,It,Ct,he;function tt(){}tt.__reactDisabledLog=!0;function gt(){{if(Qe===0){Ke=console.log,ae=console.info,Ne=console.warn,pt=console.error,It=console.group,Ct=console.groupCollapsed,he=console.groupEnd;var h={configurable:!0,enumerable:!0,value:tt,writable:!0};Object.defineProperties(console,{info:h,log:h,warn:h,error:h,group:h,groupCollapsed:h,groupEnd:h})}Qe++}}function ee(){{if(Qe--,Qe===0){var h={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:yt({},h,{value:Ke}),info:yt({},h,{value:ae}),warn:yt({},h,{value:Ne}),error:yt({},h,{value:pt}),group:yt({},h,{value:It}),groupCollapsed:yt({},h,{value:Ct}),groupEnd:yt({},h,{value:he})})}Qe<0&&R("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var at=I.ReactCurrentDispatcher,Bt;function gn(h,m,S){{if(Bt===void 0)try{throw Error()}catch(Z){var N=Z.stack.trim().match(/\n( *(at )?)/);Bt=N&&N[1]||""}return`
18
+ `+Bt+h}}var vn=!1,Ht;{var Vi=typeof WeakMap=="function"?WeakMap:Map;Ht=new Vi}function Mr(h,m){if(!h||vn)return"";{var S=Ht.get(h);if(S!==void 0)return S}var N;vn=!0;var Z=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var F;F=at.current,at.current=null,gt();try{if(m){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(Ee){N=Ee}Reflect.construct(h,[],ye)}else{try{ye.call()}catch(Ee){N=Ee}h.call(ye.prototype)}}else{try{throw Error()}catch(Ee){N=Ee}h()}}catch(Ee){if(Ee&&N&&typeof Ee.stack=="string"){for(var L=Ee.stack.split(`
19
+ `),xe=N.stack.split(`
20
+ `),ge=L.length-1,Ae=xe.length-1;ge>=1&&Ae>=0&&L[ge]!==xe[Ae];)Ae--;for(;ge>=1&&Ae>=0;ge--,Ae--)if(L[ge]!==xe[Ae]){if(ge!==1||Ae!==1)do if(ge--,Ae--,Ae<0||L[ge]!==xe[Ae]){var Be=`
21
+ `+L[ge].replace(" at new "," at ");return h.displayName&&Be.includes("<anonymous>")&&(Be=Be.replace("<anonymous>",h.displayName)),typeof h=="function"&&Ht.set(h,Be),Be}while(ge>=1&&Ae>=0);break}}}finally{vn=!1,at.current=F,ee(),Error.prepareStackTrace=Z}var Oe=h?h.displayName||h.name:"",Te=Oe?gn(Oe):"";return typeof h=="function"&&Ht.set(h,Te),Te}function Li(h,m,S){return Mr(h,!1)}function To(h){var m=h.prototype;return!!(m&&m.isReactComponent)}function mn(h,m,S){if(h==null)return"";if(typeof h=="function")return Mr(h,To(h));if(typeof h=="string")return gn(h);switch(h){case d:return gn("Suspense");case b:return gn("SuspenseList")}if(typeof h=="object")switch(h.$$typeof){case u:return Li(h.render);case _:return mn(h.type,m,S);case q:{var N=h,Z=N._payload,F=N._init;try{return mn(F(Z),m,S)}catch{}}}return""}var wn=Object.prototype.hasOwnProperty,ai={},ci=I.ReactDebugCurrentFrame;function hr(h){if(h){var m=h._owner,S=mn(h.type,h._source,m?m.type:null);ci.setExtraStackFrame(S)}else ci.setExtraStackFrame(null)}function Dn(h,m,S,N,Z){{var F=Function.call.bind(wn);for(var ye in h)if(F(h,ye)){var L=void 0;try{if(typeof h[ye]!="function"){var xe=Error((N||"React class")+": "+S+" type `"+ye+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof h[ye]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw xe.name="Invariant Violation",xe}L=h[ye](m,ye,N,S,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ge){L=ge}L&&!(L instanceof Error)&&(hr(Z),R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",N||"React class",S,ye,typeof L),hr(null)),L instanceof Error&&!(L.message in ai)&&(ai[L.message]=!0,hr(Z),R("Failed %s type: %s",S,L.message),hr(null))}}}var li=Array.isArray;function $n(h){return li(h)}function Hi(h){{var m=typeof Symbol=="function"&&Symbol.toStringTag,S=m&&h[Symbol.toStringTag]||h.constructor.name||"Object";return S}}function ui(h){try{return fi(h),!1}catch{return!0}}function fi(h){return""+h}function Or(h){if(ui(h))return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Hi(h)),fi(h)}var Qr=I.ReactCurrentOwner,Fi={key:!0,ref:!0,__self:!0,__source:!0},Gi,hi,k;k={};function C(h){if(wn.call(h,"ref")){var m=Object.getOwnPropertyDescriptor(h,"ref").get;if(m&&m.isReactWarning)return!1}return h.ref!==void 0}function j(h){if(wn.call(h,"key")){var m=Object.getOwnPropertyDescriptor(h,"key").get;if(m&&m.isReactWarning)return!1}return h.key!==void 0}function W(h,m){if(typeof h.ref=="string"&&Qr.current&&m&&Qr.current.stateNode!==m){var S=ut(Qr.current.type);k[S]||(R('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',ut(Qr.current.type),h.ref),k[S]=!0)}}function ke(h,m){{var S=function(){Gi||(Gi=!0,R("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};S.isReactWarning=!0,Object.defineProperty(h,"key",{get:S,configurable:!0})}}function xt(h,m){{var S=function(){hi||(hi=!0,R("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};S.isReactWarning=!0,Object.defineProperty(h,"ref",{get:S,configurable:!0})}}var At=function(h,m,S,N,Z,F,ye){var L={$$typeof:e,type:h,key:m,ref:S,props:ye,_owner:F};return L._store={},Object.defineProperty(L._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(L,"_self",{configurable:!1,enumerable:!1,writable:!1,value:N}),Object.defineProperty(L,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Z}),Object.freeze&&(Object.freeze(L.props),Object.freeze(L)),L};function Ue(h,m,S,N,Z){{var F,ye={},L=null,xe=null;S!==void 0&&(Or(S),L=""+S),j(m)&&(Or(m.key),L=""+m.key),C(m)&&(xe=m.ref,W(m,Z));for(F in m)wn.call(m,F)&&!Fi.hasOwnProperty(F)&&(ye[F]=m[F]);if(h&&h.defaultProps){var ge=h.defaultProps;for(F in ge)ye[F]===void 0&&(ye[F]=ge[F])}if(L||xe){var Ae=typeof h=="function"?h.displayName||h.name||"Unknown":h;L&&ke(ye,Ae),xe&&xt(ye,Ae)}return At(h,L,xe,Z,N,Qr.current,ye)}}var J=I.ReactCurrentOwner,te=I.ReactDebugCurrentFrame;function re(h){if(h){var m=h._owner,S=mn(h.type,h._source,m?m.type:null);te.setExtraStackFrame(S)}else te.setExtraStackFrame(null)}var we;we=!1;function Le(h){return typeof h=="object"&&h!==null&&h.$$typeof===e}function et(){{if(J.current){var h=ut(J.current.type);if(h)return`
22
22
 
23
- Check the render method of \``+h+"`."}return""}}function vt(h){return""}var Vt={};function di(h){{var m=Qe();if(!m){var _=typeof h=="string"?h:h.displayName||h.name;_&&(m=`
23
+ Check the render method of \``+h+"`."}return""}}function vt(h){return""}var Vt={};function di(h){{var m=et();if(!m){var S=typeof h=="string"?h:h.displayName||h.name;S&&(m=`
24
24
 
25
- Check the top-level render call using <`+_+">.")}return m}}function pi(h,m){{if(!h._store||h._store.validated||h.key!=null)return;h._store.validated=!0;var _=di(m);if(Vt[_])return;Vt[_]=!0;var N="";h&&h._owner&&h._owner!==X.current&&(N=" It was passed a child from "+lt(h._owner.type)+"."),re(h),R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',_,N),re(null)}}function zi(h,m){{if(typeof h!="object")return;if($n(h))for(var _=0;_<h.length;_++){var N=h[_];Ve(N)&&pi(N,m)}else if(Ve(h))h._store&&(h._store.validated=!0);else if(h){var W=B(h);if(typeof W=="function"&&W!==h.entries)for(var F=W.call(h),ye;!(ye=F.next()).done;)Ve(ye.value)&&pi(ye.value,m)}}}function _f(h){{var m=h.type;if(m==null||typeof m=="string")return;var _;if(typeof m=="function")_=m.propTypes;else if(typeof m=="object"&&(m.$$typeof===u||m.$$typeof===S))_=m.propTypes;else return;if(_){var N=lt(m);Dn(_,h.props,"prop",N,h)}else if(m.PropTypes!==void 0&&!me){me=!0;var W=lt(m);R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",W||"Unknown")}typeof m.getDefaultProps=="function"&&!m.getDefaultProps.isReactClassApproved&&R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function dr(h){{for(var m=Object.keys(h.props),_=0;_<m.length;_++){var N=m[_];if(N!=="children"&&N!=="key"){re(h),R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",N),re(null);break}}h.ref!==null&&(re(h),R("Invalid attribute `ref` supplied to `React.Fragment`."),re(null))}}var No={};function l(h,m,_,N,W,F){{var ye=dt(h);if(!ye){var L="";(h===void 0||typeof h=="object"&&h!==null&&Object.keys(h).length===0)&&(L+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var be=vt();be?L+=be:L+=Qe();var ge;h===null?ge="null":$n(h)?ge="array":h!==void 0&&h.$$typeof===e?(ge="<"+(lt(h.type)||"Unknown")+" />",L=" Did you accidentally export a JSX literal instead of a component?"):ge=typeof h,R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ge,L)}var xe=Ue(h,m,_,W,F);if(xe==null)return xe;if(ye){var Ce=m.children;if(Ce!==void 0)if(N)if($n(Ce)){for(var Be=0;Be<Ce.length;Be++)zi(Ce[Be],h);Object.freeze&&Object.freeze(Ce)}else R("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else zi(Ce,h)}if(wn.call(m,"key")){var Oe=lt(h),Se=Object.keys(m).filter(function(se){return se!=="key"}),fe=Se.length>0?"{key: someKey, "+Se.join(": ..., ")+": ...}":"{key: someKey}";if(!No[Oe+fe]){var ke=Se.length>0?"{"+Se.join(": ..., ")+": ...}":"{}";R(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+S+">.")}return m}}function pi(h,m){{if(!h._store||h._store.validated||h.key!=null)return;h._store.validated=!0;var S=di(m);if(Vt[S])return;Vt[S]=!0;var N="";h&&h._owner&&h._owner!==J.current&&(N=" It was passed a child from "+ut(h._owner.type)+"."),re(h),R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',S,N),re(null)}}function zi(h,m){{if(typeof h!="object")return;if($n(h))for(var S=0;S<h.length;S++){var N=h[S];Le(N)&&pi(N,m)}else if(Le(h))h._store&&(h._store.validated=!0);else if(h){var Z=B(h);if(typeof Z=="function"&&Z!==h.entries)for(var F=Z.call(h),ye;!(ye=F.next()).done;)Le(ye.value)&&pi(ye.value,m)}}}function Sf(h){{var m=h.type;if(m==null||typeof m=="string")return;var S;if(typeof m=="function")S=m.propTypes;else if(typeof m=="object"&&(m.$$typeof===u||m.$$typeof===_))S=m.propTypes;else return;if(S){var N=ut(m);Dn(S,h.props,"prop",N,h)}else if(m.PropTypes!==void 0&&!we){we=!0;var Z=ut(m);R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Z||"Unknown")}typeof m.getDefaultProps=="function"&&!m.getDefaultProps.isReactClassApproved&&R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function dr(h){{for(var m=Object.keys(h.props),S=0;S<m.length;S++){var N=m[S];if(N!=="children"&&N!=="key"){re(h),R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",N),re(null);break}}h.ref!==null&&(re(h),R("Invalid attribute `ref` supplied to `React.Fragment`."),re(null))}}var No={};function l(h,m,S,N,Z,F){{var ye=ot(h);if(!ye){var L="";(h===void 0||typeof h=="object"&&h!==null&&Object.keys(h).length===0)&&(L+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var xe=vt();xe?L+=xe:L+=et();var ge;h===null?ge="null":$n(h)?ge="array":h!==void 0&&h.$$typeof===e?(ge="<"+(ut(h.type)||"Unknown")+" />",L=" Did you accidentally export a JSX literal instead of a component?"):ge=typeof h,R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ge,L)}var Ae=Ue(h,m,S,Z,F);if(Ae==null)return Ae;if(ye){var Be=m.children;if(Be!==void 0)if(N)if($n(Be)){for(var Oe=0;Oe<Be.length;Oe++)zi(Be[Oe],h);Object.freeze&&Object.freeze(Be)}else R("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else zi(Be,h)}if(wn.call(m,"key")){var Te=ut(h),Ee=Object.keys(m).filter(function(se){return se!=="key"}),de=Ee.length>0?"{key: someKey, "+Ee.join(": ..., ")+": ...}":"{key: someKey}";if(!No[Te+de]){var Ie=Ee.length>0?"{"+Ee.join(": ..., ")+": ...}":"{}";R(`A props object containing a "key" prop is being spread into JSX:
26
26
  let props = %s;
27
27
  <%s {...props} />
28
28
  React keys must be passed directly to JSX without using spread:
29
29
  let props = %s;
30
- <%s key={someKey} {...props} />`,fe,Oe,ke,Oe),No[Oe+fe]=!0}}return h===n?dr(xe):_f(xe),xe}}function y(h,m,_){return l(h,m,_,!0)}function p(h,m,_){return l(h,m,_,!1)}var a=p,v=y;Is.Fragment=n,Is.jsx=a,Is.jsxs=v}()),Is}process.env.NODE_ENV==="production"?Vc.exports=ey():Vc.exports=ty();var ry=Vc.exports;const pr=256;class ny{constructor(e="="){Ze(this,"_paddingCharacter");this._paddingCharacter=e}encodedLength(e){return this._paddingCharacter?(e+2)/3*4|0:(e*8+5)/6|0}encode(e){let t="",n=0;for(;n<e.length-2;n+=3){let s=e[n]<<16|e[n+1]<<8|e[n+2];t+=this._encodeByte(s>>>3*6&63),t+=this._encodeByte(s>>>2*6&63),t+=this._encodeByte(s>>>1*6&63),t+=this._encodeByte(s>>>0*6&63)}const i=e.length-n;if(i>0){let s=e[n]<<16|(i===2?e[n+1]<<8:0);t+=this._encodeByte(s>>>3*6&63),t+=this._encodeByte(s>>>2*6&63),i===2?t+=this._encodeByte(s>>>1*6&63):t+=this._paddingCharacter||"",t+=this._paddingCharacter||""}return t}maxDecodedLength(e){return this._paddingCharacter?e/4*3|0:(e*6+7)/8|0}decodedLength(e){return this.maxDecodedLength(e.length-this._getPaddingLength(e))}decode(e){if(e.length===0)return new Uint8Array(0);const t=this._getPaddingLength(e),n=e.length-t,i=new Uint8Array(this.maxDecodedLength(n));let s=0,o=0,c=0,u=0,d=0,b=0,S=0;for(;o<n-4;o+=4)u=this._decodeChar(e.charCodeAt(o+0)),d=this._decodeChar(e.charCodeAt(o+1)),b=this._decodeChar(e.charCodeAt(o+2)),S=this._decodeChar(e.charCodeAt(o+3)),i[s++]=u<<2|d>>>4,i[s++]=d<<4|b>>>2,i[s++]=b<<6|S,c|=u&pr,c|=d&pr,c|=b&pr,c|=S&pr;if(o<n-1&&(u=this._decodeChar(e.charCodeAt(o)),d=this._decodeChar(e.charCodeAt(o+1)),i[s++]=u<<2|d>>>4,c|=u&pr,c|=d&pr),o<n-2&&(b=this._decodeChar(e.charCodeAt(o+2)),i[s++]=d<<4|b>>>2,c|=b&pr),o<n-3&&(S=this._decodeChar(e.charCodeAt(o+3)),i[s++]=b<<6|S,c|=S&pr),c!==0)throw new Error("Base64Coder: incorrect characters for decoding");return i}_encodeByte(e){let t=e;return t+=65,t+=25-e>>>8&6,t+=51-e>>>8&-75,t+=61-e>>>8&-15,t+=62-e>>>8&3,String.fromCharCode(t)}_decodeChar(e){let t=pr;return t+=(42-e&e-44)>>>8&-pr+e-43+62,t+=(46-e&e-48)>>>8&-pr+e-47+63,t+=(47-e&e-58)>>>8&-pr+e-48+52,t+=(64-e&e-91)>>>8&-pr+e-65+0,t+=(96-e&e-123)>>>8&-pr+e-97+26,t}_getPaddingLength(e){let t=0;if(this._paddingCharacter){for(let n=e.length-1;n>=0&&e[n]===this._paddingCharacter;n--)t++;if(e.length<4||t>2)throw new Error("Base64Coder: incorrect padding")}return t}}const Bf=new ny;function Vr(r){return Bf.encode(r)}function Cs(r){return Bf.decode(r)}function Kt(r,e=new Uint8Array(4),t=0){return e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}function Of(r,e=new Uint8Array(8),t=0){return Kt(r>>>0,e,t),Kt(r/4294967296>>>0,e,t+4),e}function Tr(r){for(let e=0;e<r.length;e++)r[e]=0;return r}const iy=20;function sy(r,e,t){let n=1634760805,i=857760878,s=2036477234,o=1797285236,c=t[3]<<24|t[2]<<16|t[1]<<8|t[0],u=t[7]<<24|t[6]<<16|t[5]<<8|t[4],d=t[11]<<24|t[10]<<16|t[9]<<8|t[8],b=t[15]<<24|t[14]<<16|t[13]<<8|t[12],S=t[19]<<24|t[18]<<16|t[17]<<8|t[16],Y=t[23]<<24|t[22]<<16|t[21]<<8|t[20],$=t[27]<<24|t[26]<<16|t[25]<<8|t[24],w=t[31]<<24|t[30]<<16|t[29]<<8|t[28],E=e[3]<<24|e[2]<<16|e[1]<<8|e[0],B=e[7]<<24|e[6]<<16|e[5]<<8|e[4],I=e[11]<<24|e[10]<<16|e[9]<<8|e[8],R=e[15]<<24|e[14]<<16|e[13]<<8|e[12],P=n,K=i,de=s,le=o,pe=c,Re=u,st=d,dt=b,St=S,Et=Y,lt=$,yt=w,Xe=E,ze=B,oe=I,Te=R;for(let pt=0;pt<iy;pt+=2)P=P+pe|0,Xe^=P,Xe=Xe>>>16|Xe<<16,St=St+Xe|0,pe^=St,pe=pe>>>20|pe<<12,K=K+Re|0,ze^=K,ze=ze>>>16|ze<<16,Et=Et+ze|0,Re^=Et,Re=Re>>>20|Re<<12,de=de+st|0,oe^=de,oe=oe>>>16|oe<<16,lt=lt+oe|0,st^=lt,st=st>>>20|st<<12,le=le+dt|0,Te^=le,Te=Te>>>16|Te<<16,yt=yt+Te|0,dt^=yt,dt=dt>>>20|dt<<12,de=de+st|0,oe^=de,oe=oe>>>24|oe<<8,lt=lt+oe|0,st^=lt,st=st>>>25|st<<7,le=le+dt|0,Te^=le,Te=Te>>>24|Te<<8,yt=yt+Te|0,dt^=yt,dt=dt>>>25|dt<<7,K=K+Re|0,ze^=K,ze=ze>>>24|ze<<8,Et=Et+ze|0,Re^=Et,Re=Re>>>25|Re<<7,P=P+pe|0,Xe^=P,Xe=Xe>>>24|Xe<<8,St=St+Xe|0,pe^=St,pe=pe>>>25|pe<<7,P=P+Re|0,Te^=P,Te=Te>>>16|Te<<16,lt=lt+Te|0,Re^=lt,Re=Re>>>20|Re<<12,K=K+st|0,Xe^=K,Xe=Xe>>>16|Xe<<16,yt=yt+Xe|0,st^=yt,st=st>>>20|st<<12,de=de+dt|0,ze^=de,ze=ze>>>16|ze<<16,St=St+ze|0,dt^=St,dt=dt>>>20|dt<<12,le=le+pe|0,oe^=le,oe=oe>>>16|oe<<16,Et=Et+oe|0,pe^=Et,pe=pe>>>20|pe<<12,de=de+dt|0,ze^=de,ze=ze>>>24|ze<<8,St=St+ze|0,dt^=St,dt=dt>>>25|dt<<7,le=le+pe|0,oe^=le,oe=oe>>>24|oe<<8,Et=Et+oe|0,pe^=Et,pe=pe>>>25|pe<<7,K=K+st|0,Xe^=K,Xe=Xe>>>24|Xe<<8,yt=yt+Xe|0,st^=yt,st=st>>>25|st<<7,P=P+Re|0,Te^=P,Te=Te>>>24|Te<<8,lt=lt+Te|0,Re^=lt,Re=Re>>>25|Re<<7;Kt(P+n|0,r,0),Kt(K+i|0,r,4),Kt(de+s|0,r,8),Kt(le+o|0,r,12),Kt(pe+c|0,r,16),Kt(Re+u|0,r,20),Kt(st+d|0,r,24),Kt(dt+b|0,r,28),Kt(St+S|0,r,32),Kt(Et+Y|0,r,36),Kt(lt+$|0,r,40),Kt(yt+w|0,r,44),Kt(Xe+E|0,r,48),Kt(ze+B|0,r,52),Kt(oe+I|0,r,56),Kt(Te+R|0,r,60)}function Lc(r,e,t,n,i=0){if(r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<t.length)throw new Error("ChaCha: destination is shorter than source");let s,o;if(i===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=new Uint8Array(16),o=s.length-e.length,s.set(e,o)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,o=i}const c=new Uint8Array(64);for(let u=0;u<t.length;u+=64){sy(c,s,r);for(let d=u;d<u+64&&d<t.length;d++)n[d]=t[d]^c[d-u];oy(s,0,o)}return Tr(c),i===0&&Tr(s),n}function Tf(r,e,t,n=0){return Tr(t),Lc(r,e,t,t,n)}function oy(r,e,t){let n=1;for(;t--;)n=n+(r[e]&255)|0,r[e]=n&255,n>>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}function ay(r,e){if(r.length!==e.length)return 0;let t=0;for(let n=0;n<r.length;n++)t|=r[n]^e[n];return 1&t-1>>>8}function cy(r,e){return r.length===0||e.length===0?!1:ay(r,e)!==0}const ly=16;class uy{constructor(e){Ze(this,"digestLength",ly);Ze(this,"_buffer",new Uint8Array(16));Ze(this,"_r",new Uint16Array(10));Ze(this,"_h",new Uint16Array(10));Ze(this,"_pad",new Uint16Array(8));Ze(this,"_leftover",0);Ze(this,"_fin",0);Ze(this,"_finished",!1);let t=e[0]|e[1]<<8;this._r[0]=t&8191;let n=e[2]|e[3]<<8;this._r[1]=(t>>>13|n<<3)&8191;let i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;let s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;let o=e[8]|e[9]<<8;this._r[4]=(s>>>4|o<<12)&255,this._r[5]=o>>>1&8190;let c=e[10]|e[11]<<8;this._r[6]=(o>>>14|c<<2)&8191;let u=e[12]|e[13]<<8;this._r[7]=(c>>>11|u<<5)&8065;let d=e[14]|e[15]<<8;this._r[8]=(u>>>8|d<<8)&8191,this._r[9]=d>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}_blocks(e,t,n){let i=this._fin?0:2048,s=this._h[0],o=this._h[1],c=this._h[2],u=this._h[3],d=this._h[4],b=this._h[5],S=this._h[6],Y=this._h[7],$=this._h[8],w=this._h[9],E=this._r[0],B=this._r[1],I=this._r[2],R=this._r[3],P=this._r[4],K=this._r[5],de=this._r[6],le=this._r[7],pe=this._r[8],Re=this._r[9];for(;n>=16;){let st=e[t+0]|e[t+1]<<8;s+=st&8191;let dt=e[t+2]|e[t+3]<<8;o+=(st>>>13|dt<<3)&8191;let St=e[t+4]|e[t+5]<<8;c+=(dt>>>10|St<<6)&8191;let Et=e[t+6]|e[t+7]<<8;u+=(St>>>7|Et<<9)&8191;let lt=e[t+8]|e[t+9]<<8;d+=(Et>>>4|lt<<12)&8191,b+=lt>>>1&8191;let yt=e[t+10]|e[t+11]<<8;S+=(lt>>>14|yt<<2)&8191;let Xe=e[t+12]|e[t+13]<<8;Y+=(yt>>>11|Xe<<5)&8191;let ze=e[t+14]|e[t+15]<<8;$+=(Xe>>>8|ze<<8)&8191,w+=ze>>>5|i;let oe=0,Te=oe;Te+=s*E,Te+=o*(5*Re),Te+=c*(5*pe),Te+=u*(5*le),Te+=d*(5*de),oe=Te>>>13,Te&=8191,Te+=b*(5*K),Te+=S*(5*P),Te+=Y*(5*R),Te+=$*(5*I),Te+=w*(5*B),oe+=Te>>>13,Te&=8191;let pt=oe;pt+=s*B,pt+=o*E,pt+=c*(5*Re),pt+=u*(5*pe),pt+=d*(5*le),oe=pt>>>13,pt&=8191,pt+=b*(5*de),pt+=S*(5*K),pt+=Y*(5*P),pt+=$*(5*R),pt+=w*(5*I),oe+=pt>>>13,pt&=8191;let It=oe;It+=s*I,It+=o*B,It+=c*E,It+=u*(5*Re),It+=d*(5*pe),oe=It>>>13,It&=8191,It+=b*(5*le),It+=S*(5*de),It+=Y*(5*K),It+=$*(5*P),It+=w*(5*R),oe+=It>>>13,It&=8191;let Ct=oe;Ct+=s*R,Ct+=o*I,Ct+=c*B,Ct+=u*E,Ct+=d*(5*Re),oe=Ct>>>13,Ct&=8191,Ct+=b*(5*pe),Ct+=S*(5*le),Ct+=Y*(5*de),Ct+=$*(5*K),Ct+=w*(5*P),oe+=Ct>>>13,Ct&=8191;let ue=oe;ue+=s*P,ue+=o*R,ue+=c*I,ue+=u*B,ue+=d*E,oe=ue>>>13,ue&=8191,ue+=b*(5*Re),ue+=S*(5*pe),ue+=Y*(5*le),ue+=$*(5*de),ue+=w*(5*K),oe+=ue>>>13,ue&=8191;let et=oe;et+=s*K,et+=o*P,et+=c*R,et+=u*I,et+=d*B,oe=et>>>13,et&=8191,et+=b*E,et+=S*(5*Re),et+=Y*(5*pe),et+=$*(5*le),et+=w*(5*de),oe+=et>>>13,et&=8191;let gt=oe;gt+=s*de,gt+=o*K,gt+=c*P,gt+=u*R,gt+=d*I,oe=gt>>>13,gt&=8191,gt+=b*B,gt+=S*E,gt+=Y*(5*Re),gt+=$*(5*pe),gt+=w*(5*le),oe+=gt>>>13,gt&=8191;let ee=oe;ee+=s*le,ee+=o*de,ee+=c*K,ee+=u*P,ee+=d*R,oe=ee>>>13,ee&=8191,ee+=b*I,ee+=S*B,ee+=Y*E,ee+=$*(5*Re),ee+=w*(5*pe),oe+=ee>>>13,ee&=8191;let ot=oe;ot+=s*pe,ot+=o*le,ot+=c*de,ot+=u*K,ot+=d*P,oe=ot>>>13,ot&=8191,ot+=b*R,ot+=S*I,ot+=Y*B,ot+=$*E,ot+=w*(5*Re),oe+=ot>>>13,ot&=8191;let Bt=oe;Bt+=s*Re,Bt+=o*pe,Bt+=c*le,Bt+=u*de,Bt+=d*K,oe=Bt>>>13,Bt&=8191,Bt+=b*P,Bt+=S*R,Bt+=Y*I,Bt+=$*B,Bt+=w*E,oe+=Bt>>>13,Bt&=8191,oe=(oe<<2)+oe|0,oe=oe+Te|0,Te=oe&8191,oe=oe>>>13,pt+=oe,s=Te,o=pt,c=It,u=Ct,d=ue,b=et,S=gt,Y=ee,$=ot,w=Bt,t+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=c,this._h[3]=u,this._h[4]=d,this._h[5]=b,this._h[6]=S,this._h[7]=Y,this._h[8]=$,this._h[9]=w}finish(e,t=0){const n=new Uint16Array(10);let i,s,o,c;if(this._leftover){for(c=this._leftover,this._buffer[c++]=1;c<16;c++)this._buffer[c]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,c=2;c<10;c++)this._h[c]+=i,i=this._h[c]>>>13,this._h[c]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,c=1;c<10;c++)n[c]=this._h[c]+i,i=n[c]>>>13,n[c]&=8191;for(n[9]-=8192,s=(i^1)-1,c=0;c<10;c++)n[c]&=s;for(s=~s,c=0;c<10;c++)this._h[c]=this._h[c]&s|n[c];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,o=this._h[0]+this._pad[0],this._h[0]=o&65535,c=1;c<8;c++)o=(this._h[c]+this._pad[c]|0)+(o>>>16)|0,this._h[c]=o&65535;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this}update(e){let t=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(let s=0;s<i;s++)this._buffer[this._leftover+s]=e[t+s];if(n-=i,t+=i,this._leftover+=i,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(n>=16&&(i=n-n%16,this._blocks(e,t,i),t+=i,n-=i),n){for(let s=0;s<n;s++)this._buffer[this._leftover+s]=e[t+s];this._leftover+=n}return this}digest(){if(this._finished)throw new Error("Poly1305 was finished");let e=new Uint8Array(16);return this.finish(e),e}clean(){return Tr(this._buffer),Tr(this._r),Tr(this._h),Tr(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this}}const fy=32,hy=12,dy=16,Nf=new Uint8Array(16);class Hc{constructor(e){Ze(this,"nonceLength",hy);Ze(this,"tagLength",dy);Ze(this,"_key");if(e.length!==fy)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}seal(e,t,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");const s=new Uint8Array(16);s.set(e,s.length-e.length);const o=new Uint8Array(32);Tf(this._key,s,o,4);const c=t.length+this.tagLength;let u;if(i){if(i.length!==c)throw new Error("ChaCha20Poly1305: incorrect destination length");u=i}else u=new Uint8Array(c);return Lc(this._key,s,t,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),o,u.subarray(0,u.length-this.tagLength),n),Tr(s),u}open(e,t,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length<this.tagLength)return null;const s=new Uint8Array(16);s.set(e,s.length-e.length);const o=new Uint8Array(32);Tf(this._key,s,o,4);const c=new Uint8Array(this.tagLength);if(this._authenticate(c,o,t.subarray(0,t.length-this.tagLength),n),!cy(c,t.subarray(t.length-this.tagLength,t.length)))return null;const u=t.length-this.tagLength;let d;if(i){if(i.length!==u)throw new Error("ChaCha20Poly1305: incorrect destination length");d=i}else d=new Uint8Array(u);return Lc(this._key,s,t.subarray(0,t.length-this.tagLength),d,4),Tr(s),d}clean(){return Tr(this._key),this}_authenticate(e,t,n,i){const s=new uy(t);i&&(s.update(i),i.length%16>0&&s.update(Nf.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(Nf.subarray(n.length%16));const o=new Uint8Array(8);i&&Of(i.length,o),s.update(o),Of(n.length,o),s.update(o);const c=s.digest();for(let u=0;u<c.length;u++)e[u]=c[u];s.clean(),Tr(c),Tr(o)}}const Rf=65536;class py{constructor(){Ze(this,"isAvailable",!1);Ze(this,"isInstantiated",!1);typeof crypto<"u"&&"getRandomValues"in crypto&&(this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");const t=new Uint8Array(e);for(let n=0;n<t.length;n+=Rf)crypto.getRandomValues(t.subarray(n,n+Math.min(t.length-n,Rf)));return t}}const yy=new py;function gy(r,e=yy){return e.randomBytes(r)}function jf(r,e){const t=new Hc(r),n=gy(12),s=new TextEncoder().encode(e),o=t.seal(n,s),c=new Uint8Array(n.length+o.length);return c.set(n),c.set(o,n.length),Vr(c)}function Pf(r,e){const t=new Hc(r),n=Cs(e),i=12,s=n.slice(0,i),o=n.slice(i),c=t.open(s,o);if(!c)throw new Error("Decryption failed");return new TextDecoder().decode(c)}/*! *****************************************************************************
30
+ <%s key={someKey} {...props} />`,de,Te,Ie,Te),No[Te+de]=!0}}return h===n?dr(Ae):Sf(Ae),Ae}}function y(h,m,S){return l(h,m,S,!0)}function p(h,m,S){return l(h,m,S,!1)}var a=p,v=y;Is.Fragment=n,Is.jsx=a,Is.jsxs=v}()),Is}process.env.NODE_ENV==="production"?Vc.exports=X0():Vc.exports=Q0();var ey=Vc.exports;const pr=256;class ty{constructor(e="="){We(this,"_paddingCharacter");this._paddingCharacter=e}encodedLength(e){return this._paddingCharacter?(e+2)/3*4|0:(e*8+5)/6|0}encode(e){let t="",n=0;for(;n<e.length-2;n+=3){let s=e[n]<<16|e[n+1]<<8|e[n+2];t+=this._encodeByte(s>>>3*6&63),t+=this._encodeByte(s>>>2*6&63),t+=this._encodeByte(s>>>1*6&63),t+=this._encodeByte(s>>>0*6&63)}const i=e.length-n;if(i>0){let s=e[n]<<16|(i===2?e[n+1]<<8:0);t+=this._encodeByte(s>>>3*6&63),t+=this._encodeByte(s>>>2*6&63),i===2?t+=this._encodeByte(s>>>1*6&63):t+=this._paddingCharacter||"",t+=this._paddingCharacter||""}return t}maxDecodedLength(e){return this._paddingCharacter?e/4*3|0:(e*6+7)/8|0}decodedLength(e){return this.maxDecodedLength(e.length-this._getPaddingLength(e))}decode(e){if(e.length===0)return new Uint8Array(0);const t=this._getPaddingLength(e),n=e.length-t,i=new Uint8Array(this.maxDecodedLength(n));let s=0,o=0,c=0,u=0,d=0,b=0,_=0;for(;o<n-4;o+=4)u=this._decodeChar(e.charCodeAt(o+0)),d=this._decodeChar(e.charCodeAt(o+1)),b=this._decodeChar(e.charCodeAt(o+2)),_=this._decodeChar(e.charCodeAt(o+3)),i[s++]=u<<2|d>>>4,i[s++]=d<<4|b>>>2,i[s++]=b<<6|_,c|=u&pr,c|=d&pr,c|=b&pr,c|=_&pr;if(o<n-1&&(u=this._decodeChar(e.charCodeAt(o)),d=this._decodeChar(e.charCodeAt(o+1)),i[s++]=u<<2|d>>>4,c|=u&pr,c|=d&pr),o<n-2&&(b=this._decodeChar(e.charCodeAt(o+2)),i[s++]=d<<4|b>>>2,c|=b&pr),o<n-3&&(_=this._decodeChar(e.charCodeAt(o+3)),i[s++]=b<<6|_,c|=_&pr),c!==0)throw new Error("Base64Coder: incorrect characters for decoding");return i}_encodeByte(e){let t=e;return t+=65,t+=25-e>>>8&6,t+=51-e>>>8&-75,t+=61-e>>>8&-15,t+=62-e>>>8&3,String.fromCharCode(t)}_decodeChar(e){let t=pr;return t+=(42-e&e-44)>>>8&-pr+e-43+62,t+=(46-e&e-48)>>>8&-pr+e-47+63,t+=(47-e&e-58)>>>8&-pr+e-48+52,t+=(64-e&e-91)>>>8&-pr+e-65+0,t+=(96-e&e-123)>>>8&-pr+e-97+26,t}_getPaddingLength(e){let t=0;if(this._paddingCharacter){for(let n=e.length-1;n>=0&&e[n]===this._paddingCharacter;n--)t++;if(e.length<4||t>2)throw new Error("Base64Coder: incorrect padding")}return t}}const Bf=new ty;function Vr(r){return Bf.encode(r)}function Cs(r){return Bf.decode(r)}function Kt(r,e=new Uint8Array(4),t=0){return e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}function Of(r,e=new Uint8Array(8),t=0){return Kt(r>>>0,e,t),Kt(r/4294967296>>>0,e,t+4),e}function Tr(r){for(let e=0;e<r.length;e++)r[e]=0;return r}const ry=20;function ny(r,e,t){let n=1634760805,i=857760878,s=2036477234,o=1797285236,c=t[3]<<24|t[2]<<16|t[1]<<8|t[0],u=t[7]<<24|t[6]<<16|t[5]<<8|t[4],d=t[11]<<24|t[10]<<16|t[9]<<8|t[8],b=t[15]<<24|t[14]<<16|t[13]<<8|t[12],_=t[19]<<24|t[18]<<16|t[17]<<8|t[16],q=t[23]<<24|t[22]<<16|t[21]<<8|t[20],$=t[27]<<24|t[26]<<16|t[25]<<8|t[24],w=t[31]<<24|t[30]<<16|t[29]<<8|t[28],E=e[3]<<24|e[2]<<16|e[1]<<8|e[0],B=e[7]<<24|e[6]<<16|e[5]<<8|e[4],I=e[11]<<24|e[10]<<16|e[9]<<8|e[8],R=e[15]<<24|e[14]<<16|e[13]<<8|e[12],U=n,fe=i,oe=s,ce=o,X=c,me=u,$e=d,ot=b,_t=_,Et=q,ut=$,yt=w,Qe=E,Ke=B,ae=I,Ne=R;for(let pt=0;pt<ry;pt+=2)U=U+X|0,Qe^=U,Qe=Qe>>>16|Qe<<16,_t=_t+Qe|0,X^=_t,X=X>>>20|X<<12,fe=fe+me|0,Ke^=fe,Ke=Ke>>>16|Ke<<16,Et=Et+Ke|0,me^=Et,me=me>>>20|me<<12,oe=oe+$e|0,ae^=oe,ae=ae>>>16|ae<<16,ut=ut+ae|0,$e^=ut,$e=$e>>>20|$e<<12,ce=ce+ot|0,Ne^=ce,Ne=Ne>>>16|Ne<<16,yt=yt+Ne|0,ot^=yt,ot=ot>>>20|ot<<12,oe=oe+$e|0,ae^=oe,ae=ae>>>24|ae<<8,ut=ut+ae|0,$e^=ut,$e=$e>>>25|$e<<7,ce=ce+ot|0,Ne^=ce,Ne=Ne>>>24|Ne<<8,yt=yt+Ne|0,ot^=yt,ot=ot>>>25|ot<<7,fe=fe+me|0,Ke^=fe,Ke=Ke>>>24|Ke<<8,Et=Et+Ke|0,me^=Et,me=me>>>25|me<<7,U=U+X|0,Qe^=U,Qe=Qe>>>24|Qe<<8,_t=_t+Qe|0,X^=_t,X=X>>>25|X<<7,U=U+me|0,Ne^=U,Ne=Ne>>>16|Ne<<16,ut=ut+Ne|0,me^=ut,me=me>>>20|me<<12,fe=fe+$e|0,Qe^=fe,Qe=Qe>>>16|Qe<<16,yt=yt+Qe|0,$e^=yt,$e=$e>>>20|$e<<12,oe=oe+ot|0,Ke^=oe,Ke=Ke>>>16|Ke<<16,_t=_t+Ke|0,ot^=_t,ot=ot>>>20|ot<<12,ce=ce+X|0,ae^=ce,ae=ae>>>16|ae<<16,Et=Et+ae|0,X^=Et,X=X>>>20|X<<12,oe=oe+ot|0,Ke^=oe,Ke=Ke>>>24|Ke<<8,_t=_t+Ke|0,ot^=_t,ot=ot>>>25|ot<<7,ce=ce+X|0,ae^=ce,ae=ae>>>24|ae<<8,Et=Et+ae|0,X^=Et,X=X>>>25|X<<7,fe=fe+$e|0,Qe^=fe,Qe=Qe>>>24|Qe<<8,yt=yt+Qe|0,$e^=yt,$e=$e>>>25|$e<<7,U=U+me|0,Ne^=U,Ne=Ne>>>24|Ne<<8,ut=ut+Ne|0,me^=ut,me=me>>>25|me<<7;Kt(U+n|0,r,0),Kt(fe+i|0,r,4),Kt(oe+s|0,r,8),Kt(ce+o|0,r,12),Kt(X+c|0,r,16),Kt(me+u|0,r,20),Kt($e+d|0,r,24),Kt(ot+b|0,r,28),Kt(_t+_|0,r,32),Kt(Et+q|0,r,36),Kt(ut+$|0,r,40),Kt(yt+w|0,r,44),Kt(Qe+E|0,r,48),Kt(Ke+B|0,r,52),Kt(ae+I|0,r,56),Kt(Ne+R|0,r,60)}function Lc(r,e,t,n,i=0){if(r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<t.length)throw new Error("ChaCha: destination is shorter than source");let s,o;if(i===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=new Uint8Array(16),o=s.length-e.length,s.set(e,o)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,o=i}const c=new Uint8Array(64);for(let u=0;u<t.length;u+=64){ny(c,s,r);for(let d=u;d<u+64&&d<t.length;d++)n[d]=t[d]^c[d-u];iy(s,0,o)}return Tr(c),i===0&&Tr(s),n}function Tf(r,e,t,n=0){return Tr(t),Lc(r,e,t,t,n)}function iy(r,e,t){let n=1;for(;t--;)n=n+(r[e]&255)|0,r[e]=n&255,n>>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}function sy(r,e){if(r.length!==e.length)return 0;let t=0;for(let n=0;n<r.length;n++)t|=r[n]^e[n];return 1&t-1>>>8}function oy(r,e){return r.length===0||e.length===0?!1:sy(r,e)!==0}const ay=16;class cy{constructor(e){We(this,"digestLength",ay);We(this,"_buffer",new Uint8Array(16));We(this,"_r",new Uint16Array(10));We(this,"_h",new Uint16Array(10));We(this,"_pad",new Uint16Array(8));We(this,"_leftover",0);We(this,"_fin",0);We(this,"_finished",!1);let t=e[0]|e[1]<<8;this._r[0]=t&8191;let n=e[2]|e[3]<<8;this._r[1]=(t>>>13|n<<3)&8191;let i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;let s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;let o=e[8]|e[9]<<8;this._r[4]=(s>>>4|o<<12)&255,this._r[5]=o>>>1&8190;let c=e[10]|e[11]<<8;this._r[6]=(o>>>14|c<<2)&8191;let u=e[12]|e[13]<<8;this._r[7]=(c>>>11|u<<5)&8065;let d=e[14]|e[15]<<8;this._r[8]=(u>>>8|d<<8)&8191,this._r[9]=d>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}_blocks(e,t,n){let i=this._fin?0:2048,s=this._h[0],o=this._h[1],c=this._h[2],u=this._h[3],d=this._h[4],b=this._h[5],_=this._h[6],q=this._h[7],$=this._h[8],w=this._h[9],E=this._r[0],B=this._r[1],I=this._r[2],R=this._r[3],U=this._r[4],fe=this._r[5],oe=this._r[6],ce=this._r[7],X=this._r[8],me=this._r[9];for(;n>=16;){let $e=e[t+0]|e[t+1]<<8;s+=$e&8191;let ot=e[t+2]|e[t+3]<<8;o+=($e>>>13|ot<<3)&8191;let _t=e[t+4]|e[t+5]<<8;c+=(ot>>>10|_t<<6)&8191;let Et=e[t+6]|e[t+7]<<8;u+=(_t>>>7|Et<<9)&8191;let ut=e[t+8]|e[t+9]<<8;d+=(Et>>>4|ut<<12)&8191,b+=ut>>>1&8191;let yt=e[t+10]|e[t+11]<<8;_+=(ut>>>14|yt<<2)&8191;let Qe=e[t+12]|e[t+13]<<8;q+=(yt>>>11|Qe<<5)&8191;let Ke=e[t+14]|e[t+15]<<8;$+=(Qe>>>8|Ke<<8)&8191,w+=Ke>>>5|i;let ae=0,Ne=ae;Ne+=s*E,Ne+=o*(5*me),Ne+=c*(5*X),Ne+=u*(5*ce),Ne+=d*(5*oe),ae=Ne>>>13,Ne&=8191,Ne+=b*(5*fe),Ne+=_*(5*U),Ne+=q*(5*R),Ne+=$*(5*I),Ne+=w*(5*B),ae+=Ne>>>13,Ne&=8191;let pt=ae;pt+=s*B,pt+=o*E,pt+=c*(5*me),pt+=u*(5*X),pt+=d*(5*ce),ae=pt>>>13,pt&=8191,pt+=b*(5*oe),pt+=_*(5*fe),pt+=q*(5*U),pt+=$*(5*R),pt+=w*(5*I),ae+=pt>>>13,pt&=8191;let It=ae;It+=s*I,It+=o*B,It+=c*E,It+=u*(5*me),It+=d*(5*X),ae=It>>>13,It&=8191,It+=b*(5*ce),It+=_*(5*oe),It+=q*(5*fe),It+=$*(5*U),It+=w*(5*R),ae+=It>>>13,It&=8191;let Ct=ae;Ct+=s*R,Ct+=o*I,Ct+=c*B,Ct+=u*E,Ct+=d*(5*me),ae=Ct>>>13,Ct&=8191,Ct+=b*(5*X),Ct+=_*(5*ce),Ct+=q*(5*oe),Ct+=$*(5*fe),Ct+=w*(5*U),ae+=Ct>>>13,Ct&=8191;let he=ae;he+=s*U,he+=o*R,he+=c*I,he+=u*B,he+=d*E,ae=he>>>13,he&=8191,he+=b*(5*me),he+=_*(5*X),he+=q*(5*ce),he+=$*(5*oe),he+=w*(5*fe),ae+=he>>>13,he&=8191;let tt=ae;tt+=s*fe,tt+=o*U,tt+=c*R,tt+=u*I,tt+=d*B,ae=tt>>>13,tt&=8191,tt+=b*E,tt+=_*(5*me),tt+=q*(5*X),tt+=$*(5*ce),tt+=w*(5*oe),ae+=tt>>>13,tt&=8191;let gt=ae;gt+=s*oe,gt+=o*fe,gt+=c*U,gt+=u*R,gt+=d*I,ae=gt>>>13,gt&=8191,gt+=b*B,gt+=_*E,gt+=q*(5*me),gt+=$*(5*X),gt+=w*(5*ce),ae+=gt>>>13,gt&=8191;let ee=ae;ee+=s*ce,ee+=o*oe,ee+=c*fe,ee+=u*U,ee+=d*R,ae=ee>>>13,ee&=8191,ee+=b*I,ee+=_*B,ee+=q*E,ee+=$*(5*me),ee+=w*(5*X),ae+=ee>>>13,ee&=8191;let at=ae;at+=s*X,at+=o*ce,at+=c*oe,at+=u*fe,at+=d*U,ae=at>>>13,at&=8191,at+=b*R,at+=_*I,at+=q*B,at+=$*E,at+=w*(5*me),ae+=at>>>13,at&=8191;let Bt=ae;Bt+=s*me,Bt+=o*X,Bt+=c*ce,Bt+=u*oe,Bt+=d*fe,ae=Bt>>>13,Bt&=8191,Bt+=b*U,Bt+=_*R,Bt+=q*I,Bt+=$*B,Bt+=w*E,ae+=Bt>>>13,Bt&=8191,ae=(ae<<2)+ae|0,ae=ae+Ne|0,Ne=ae&8191,ae=ae>>>13,pt+=ae,s=Ne,o=pt,c=It,u=Ct,d=he,b=tt,_=gt,q=ee,$=at,w=Bt,t+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=c,this._h[3]=u,this._h[4]=d,this._h[5]=b,this._h[6]=_,this._h[7]=q,this._h[8]=$,this._h[9]=w}finish(e,t=0){const n=new Uint16Array(10);let i,s,o,c;if(this._leftover){for(c=this._leftover,this._buffer[c++]=1;c<16;c++)this._buffer[c]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,c=2;c<10;c++)this._h[c]+=i,i=this._h[c]>>>13,this._h[c]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,c=1;c<10;c++)n[c]=this._h[c]+i,i=n[c]>>>13,n[c]&=8191;for(n[9]-=8192,s=(i^1)-1,c=0;c<10;c++)n[c]&=s;for(s=~s,c=0;c<10;c++)this._h[c]=this._h[c]&s|n[c];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,o=this._h[0]+this._pad[0],this._h[0]=o&65535,c=1;c<8;c++)o=(this._h[c]+this._pad[c]|0)+(o>>>16)|0,this._h[c]=o&65535;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this}update(e){let t=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(let s=0;s<i;s++)this._buffer[this._leftover+s]=e[t+s];if(n-=i,t+=i,this._leftover+=i,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(n>=16&&(i=n-n%16,this._blocks(e,t,i),t+=i,n-=i),n){for(let s=0;s<n;s++)this._buffer[this._leftover+s]=e[t+s];this._leftover+=n}return this}digest(){if(this._finished)throw new Error("Poly1305 was finished");let e=new Uint8Array(16);return this.finish(e),e}clean(){return Tr(this._buffer),Tr(this._r),Tr(this._h),Tr(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this}}const ly=32,uy=12,fy=16,Nf=new Uint8Array(16);class Hc{constructor(e){We(this,"nonceLength",uy);We(this,"tagLength",fy);We(this,"_key");if(e.length!==ly)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}seal(e,t,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");const s=new Uint8Array(16);s.set(e,s.length-e.length);const o=new Uint8Array(32);Tf(this._key,s,o,4);const c=t.length+this.tagLength;let u;if(i){if(i.length!==c)throw new Error("ChaCha20Poly1305: incorrect destination length");u=i}else u=new Uint8Array(c);return Lc(this._key,s,t,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),o,u.subarray(0,u.length-this.tagLength),n),Tr(s),u}open(e,t,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length<this.tagLength)return null;const s=new Uint8Array(16);s.set(e,s.length-e.length);const o=new Uint8Array(32);Tf(this._key,s,o,4);const c=new Uint8Array(this.tagLength);if(this._authenticate(c,o,t.subarray(0,t.length-this.tagLength),n),!oy(c,t.subarray(t.length-this.tagLength,t.length)))return null;const u=t.length-this.tagLength;let d;if(i){if(i.length!==u)throw new Error("ChaCha20Poly1305: incorrect destination length");d=i}else d=new Uint8Array(u);return Lc(this._key,s,t.subarray(0,t.length-this.tagLength),d,4),Tr(s),d}clean(){return Tr(this._key),this}_authenticate(e,t,n,i){const s=new cy(t);i&&(s.update(i),i.length%16>0&&s.update(Nf.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(Nf.subarray(n.length%16));const o=new Uint8Array(8);i&&Of(i.length,o),s.update(o),Of(n.length,o),s.update(o);const c=s.digest();for(let u=0;u<c.length;u++)e[u]=c[u];s.clean(),Tr(c),Tr(o)}}const Rf=65536;class hy{constructor(){We(this,"isAvailable",!1);We(this,"isInstantiated",!1);typeof crypto<"u"&&"getRandomValues"in crypto&&(this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");const t=new Uint8Array(e);for(let n=0;n<t.length;n+=Rf)crypto.getRandomValues(t.subarray(n,n+Math.min(t.length-n,Rf)));return t}}const dy=new hy;function py(r,e=dy){return e.randomBytes(r)}function jf(r,e){const t=new Hc(r),n=py(12),s=new TextEncoder().encode(e),o=t.seal(n,s),c=new Uint8Array(n.length+o.length);return c.set(n),c.set(o,n.length),Vr(c)}function Pf(r,e){const t=new Hc(r),n=Cs(e),i=12,s=n.slice(0,i),o=n.slice(i),c=t.open(s,o);if(!c)throw new Error("Decryption failed");return new TextDecoder().decode(c)}/*! *****************************************************************************
31
31
  Copyright (C) Microsoft. All rights reserved.
32
32
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
33
33
  this file except in compliance with the License. You may obtain a copy of the
@@ -40,7 +40,7 @@ React keys must be passed directly to JSX without using spread:
40
40
 
41
41
  See the Apache Version 2.0 License for specific language governing permissions
42
42
  and limitations under the License.
43
- ***************************************************************************** */var Uf;(function(r){(function(e){var t=typeof globalThis=="object"?globalThis:typeof Ot=="object"?Ot:typeof self=="object"?self:typeof this=="object"?this:c(),n=i(r);typeof t.Reflect<"u"&&(n=i(t.Reflect,n)),e(n,t),typeof t.Reflect>"u"&&(t.Reflect=r);function i(u,d){return function(b,S){Object.defineProperty(u,b,{configurable:!0,writable:!0,value:S}),d&&d(b,S)}}function s(){try{return Function("return this;")()}catch{}}function o(){try{return(0,eval)("(function() { return this; })()")}catch{}}function c(){return s()||o()}})(function(e,t){var n=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",s=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",o=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",u={__proto__:[]}instanceof Array,d=!c&&!u,b={create:c?function(){return hi(Object.create(null))}:u?function(){return hi({__proto__:null})}:function(){return hi({})},has:d?function(k,C){return n.call(k,C)}:function(k,C){return C in k},get:d?function(k,C){return n.call(k,C)?k[C]:void 0}:function(k,C){return k[C]}},S=Object.getPrototypeOf(Function),Y=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:Qr(),$=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Fi(),w=typeof WeakMap=="function"?WeakMap:Gi(),E=i?Symbol.for("@reflect-metadata:registry"):void 0,B=Hi(),I=ui(B);function R(k,C,j,q){if(ue(j)){if(!Vi(k))throw new TypeError;if(!Li(C))throw new TypeError;return Et(k,C)}else{if(!Vi(k))throw new TypeError;if(!ee(C))throw new TypeError;if(!ee(q)&&!ue(q)&&!et(q))throw new TypeError;return et(q)&&(q=void 0),j=Ht(j),lt(k,C,j,q)}}e("decorate",R);function P(k,C){function j(q,Ee){if(!ee(q))throw new TypeError;if(!ue(Ee)&&!To(Ee))throw new TypeError;Te(k,C,q,Ee)}return j}e("metadata",P);function K(k,C,j,q){if(!ee(j))throw new TypeError;return ue(q)||(q=Ht(q)),Te(k,C,j,q)}e("defineMetadata",K);function de(k,C,j){if(!ee(C))throw new TypeError;return ue(j)||(j=Ht(j)),yt(k,C,j)}e("hasMetadata",de);function le(k,C,j){if(!ee(C))throw new TypeError;return ue(j)||(j=Ht(j)),Xe(k,C,j)}e("hasOwnMetadata",le);function pe(k,C,j){if(!ee(C))throw new TypeError;return ue(j)||(j=Ht(j)),ze(k,C,j)}e("getMetadata",pe);function Re(k,C,j){if(!ee(C))throw new TypeError;return ue(j)||(j=Ht(j)),oe(k,C,j)}e("getOwnMetadata",Re);function st(k,C){if(!ee(k))throw new TypeError;return ue(C)||(C=Ht(C)),pt(k,C)}e("getMetadataKeys",st);function dt(k,C){if(!ee(k))throw new TypeError;return ue(C)||(C=Ht(C)),It(k,C)}e("getOwnMetadataKeys",dt);function St(k,C,j){if(!ee(C))throw new TypeError;if(ue(j)||(j=Ht(j)),!ee(C))throw new TypeError;ue(j)||(j=Ht(j));var q=Or(C,j,!1);return ue(q)?!1:q.OrdinaryDeleteMetadata(k,C,j)}e("deleteMetadata",St);function Et(k,C){for(var j=k.length-1;j>=0;--j){var q=k[j],Ee=q(C);if(!ue(Ee)&&!et(Ee)){if(!Li(Ee))throw new TypeError;C=Ee}}return C}function lt(k,C,j,q){for(var Ee=k.length-1;Ee>=0;--Ee){var xt=k[Ee],At=xt(C,j,q);if(!ue(At)&&!et(At)){if(!ee(At))throw new TypeError;q=At}}return q}function yt(k,C,j){var q=Xe(k,C,j);if(q)return!0;var Ee=li(C);return et(Ee)?!1:yt(k,Ee,j)}function Xe(k,C,j){var q=Or(C,j,!1);return ue(q)?!1:gn(q.OrdinaryHasOwnMetadata(k,C,j))}function ze(k,C,j){var q=Xe(k,C,j);if(q)return oe(k,C,j);var Ee=li(C);if(!et(Ee))return ze(k,Ee,j)}function oe(k,C,j){var q=Or(C,j,!1);if(!ue(q))return q.OrdinaryGetOwnMetadata(k,C,j)}function Te(k,C,j,q){var Ee=Or(j,q,!0);Ee.OrdinaryDefineOwnMetadata(k,C,j,q)}function pt(k,C){var j=It(k,C),q=li(k);if(q===null)return j;var Ee=pt(q,C);if(Ee.length<=0)return j;if(j.length<=0)return Ee;for(var xt=new $,At=[],Ue=0,X=j;Ue<X.length;Ue++){var te=X[Ue],re=xt.has(te);re||(xt.add(te),At.push(te))}for(var me=0,Ve=Ee;me<Ve.length;me++){var te=Ve[me],re=xt.has(te);re||(xt.add(te),At.push(te))}return At}function It(k,C){var j=Or(k,C,!1);return j?j.OrdinaryOwnMetadataKeys(k,C):[]}function Ct(k){if(k===null)return 1;switch(typeof k){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return k===null?1:6;default:return 6}}function ue(k){return k===void 0}function et(k){return k===null}function gt(k){return typeof k=="symbol"}function ee(k){return typeof k=="object"?k!==null:typeof k=="function"}function ot(k,C){switch(Ct(k)){case 0:return k;case 1:return k;case 2:return k;case 3:return k;case 4:return k;case 5:return k}var j="string",q=wn(k,s);if(q!==void 0){var Ee=q.call(k,j);if(ee(Ee))throw new TypeError;return Ee}return Bt(k)}function Bt(k,C){var j,q;{var Ee=k.toString;if(Mr(Ee)){var q=Ee.call(k);if(!ee(q))return q}var j=k.valueOf;if(Mr(j)){var q=j.call(k);if(!ee(q))return q}}throw new TypeError}function gn(k){return!!k}function vn(k){return""+k}function Ht(k){var C=ot(k);return gt(C)?C:vn(C)}function Vi(k){return Array.isArray?Array.isArray(k):k instanceof Object?k instanceof Array:Object.prototype.toString.call(k)==="[object Array]"}function Mr(k){return typeof k=="function"}function Li(k){return typeof k=="function"}function To(k){switch(Ct(k)){case 3:return!0;case 4:return!0;default:return!1}}function mn(k,C){return k===C||k!==k&&C!==C}function wn(k,C){var j=k[C];if(j!=null){if(!Mr(j))throw new TypeError;return j}}function ai(k){var C=wn(k,o);if(!Mr(C))throw new TypeError;var j=C.call(k);if(!ee(j))throw new TypeError;return j}function ci(k){return k.value}function hr(k){var C=k.next();return C.done?!1:C}function Dn(k){var C=k.return;C&&C.call(k)}function li(k){var C=Object.getPrototypeOf(k);if(typeof k!="function"||k===S||C!==S)return C;var j=k.prototype,q=j&&Object.getPrototypeOf(j);if(q==null||q===Object.prototype)return C;var Ee=q.constructor;return typeof Ee!="function"||Ee===k?C:Ee}function $n(){var k;!ue(E)&&typeof t.Reflect<"u"&&!(E in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(k=fi(t.Reflect));var C,j,q,Ee=new w,xt={registerProvider:At,getProvider:X,setProvider:re};return xt;function At(me){if(!Object.isExtensible(xt))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case k===me:break;case ue(C):C=me;break;case C===me:break;case ue(j):j=me;break;case j===me:break;default:q===void 0&&(q=new $),q.add(me);break}}function Ue(me,Ve){if(!ue(C)){if(C.isProviderFor(me,Ve))return C;if(!ue(j)){if(j.isProviderFor(me,Ve))return C;if(!ue(q))for(var Qe=ai(q);;){var vt=hr(Qe);if(!vt)return;var Vt=ci(vt);if(Vt.isProviderFor(me,Ve))return Dn(Qe),Vt}}}if(!ue(k)&&k.isProviderFor(me,Ve))return k}function X(me,Ve){var Qe=Ee.get(me),vt;return ue(Qe)||(vt=Qe.get(Ve)),ue(vt)&&(vt=Ue(me,Ve),ue(vt)||(ue(Qe)&&(Qe=new Y,Ee.set(me,Qe)),Qe.set(Ve,vt))),vt}function te(me){if(ue(me))throw new TypeError;return C===me||j===me||!ue(q)&&q.has(me)}function re(me,Ve,Qe){if(!te(Qe))throw new Error("Metadata provider not registered.");var vt=X(me,Ve);if(vt!==Qe){if(!ue(vt))return!1;var Vt=Ee.get(me);ue(Vt)&&(Vt=new Y,Ee.set(me,Vt)),Vt.set(Ve,Qe)}return!0}}function Hi(){var k;return!ue(E)&&ee(t.Reflect)&&Object.isExtensible(t.Reflect)&&(k=t.Reflect[E]),ue(k)&&(k=$n()),!ue(E)&&ee(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,E,{enumerable:!1,configurable:!1,writable:!1,value:k}),k}function ui(k){var C=new w,j={isProviderFor:function(te,re){var me=C.get(te);return ue(me)?!1:me.has(re)},OrdinaryDefineOwnMetadata:At,OrdinaryHasOwnMetadata:Ee,OrdinaryGetOwnMetadata:xt,OrdinaryOwnMetadataKeys:Ue,OrdinaryDeleteMetadata:X};return B.registerProvider(j),j;function q(te,re,me){var Ve=C.get(te),Qe=!1;if(ue(Ve)){if(!me)return;Ve=new Y,C.set(te,Ve),Qe=!0}var vt=Ve.get(re);if(ue(vt)){if(!me)return;if(vt=new Y,Ve.set(re,vt),!k.setProvider(te,re,j))throw Ve.delete(re),Qe&&C.delete(te),new Error("Wrong provider for target.")}return vt}function Ee(te,re,me){var Ve=q(re,me,!1);return ue(Ve)?!1:gn(Ve.has(te))}function xt(te,re,me){var Ve=q(re,me,!1);if(!ue(Ve))return Ve.get(te)}function At(te,re,me,Ve){var Qe=q(me,Ve,!0);Qe.set(te,re)}function Ue(te,re){var me=[],Ve=q(te,re,!1);if(ue(Ve))return me;for(var Qe=Ve.keys(),vt=ai(Qe),Vt=0;;){var di=hr(vt);if(!di)return me.length=Vt,me;var pi=ci(di);try{me[Vt]=pi}catch(zi){try{Dn(vt)}finally{throw zi}}Vt++}}function X(te,re,me){var Ve=q(re,me,!1);if(ue(Ve)||!Ve.delete(te))return!1;if(Ve.size===0){var Qe=C.get(re);ue(Qe)||(Qe.delete(me),Qe.size===0&&C.delete(Qe))}return!0}}function fi(k){var C=k.defineMetadata,j=k.hasOwnMetadata,q=k.getOwnMetadata,Ee=k.getOwnMetadataKeys,xt=k.deleteMetadata,At=new w,Ue={isProviderFor:function(X,te){var re=At.get(X);return!ue(re)&&re.has(te)?!0:Ee(X,te).length?(ue(re)&&(re=new $,At.set(X,re)),re.add(te),!0):!1},OrdinaryDefineOwnMetadata:C,OrdinaryHasOwnMetadata:j,OrdinaryGetOwnMetadata:q,OrdinaryOwnMetadataKeys:Ee,OrdinaryDeleteMetadata:xt};return Ue}function Or(k,C,j){var q=B.getProvider(k,C);if(!ue(q))return q;if(j){if(B.setProvider(k,C,I))return I;throw new Error("Illegal state.")}}function Qr(){var k={},C=[],j=function(){function Ue(X,te,re){this._index=0,this._keys=X,this._values=te,this._selector=re}return Ue.prototype["@@iterator"]=function(){return this},Ue.prototype[o]=function(){return this},Ue.prototype.next=function(){var X=this._index;if(X>=0&&X<this._keys.length){var te=this._selector(this._keys[X],this._values[X]);return X+1>=this._keys.length?(this._index=-1,this._keys=C,this._values=C):this._index++,{value:te,done:!1}}return{value:void 0,done:!0}},Ue.prototype.throw=function(X){throw this._index>=0&&(this._index=-1,this._keys=C,this._values=C),X},Ue.prototype.return=function(X){return this._index>=0&&(this._index=-1,this._keys=C,this._values=C),{value:X,done:!0}},Ue}(),q=function(){function Ue(){this._keys=[],this._values=[],this._cacheKey=k,this._cacheIndex=-2}return Object.defineProperty(Ue.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),Ue.prototype.has=function(X){return this._find(X,!1)>=0},Ue.prototype.get=function(X){var te=this._find(X,!1);return te>=0?this._values[te]:void 0},Ue.prototype.set=function(X,te){var re=this._find(X,!0);return this._values[re]=te,this},Ue.prototype.delete=function(X){var te=this._find(X,!1);if(te>=0){for(var re=this._keys.length,me=te+1;me<re;me++)this._keys[me-1]=this._keys[me],this._values[me-1]=this._values[me];return this._keys.length--,this._values.length--,mn(X,this._cacheKey)&&(this._cacheKey=k,this._cacheIndex=-2),!0}return!1},Ue.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=k,this._cacheIndex=-2},Ue.prototype.keys=function(){return new j(this._keys,this._values,Ee)},Ue.prototype.values=function(){return new j(this._keys,this._values,xt)},Ue.prototype.entries=function(){return new j(this._keys,this._values,At)},Ue.prototype["@@iterator"]=function(){return this.entries()},Ue.prototype[o]=function(){return this.entries()},Ue.prototype._find=function(X,te){if(!mn(this._cacheKey,X)){this._cacheIndex=-1;for(var re=0;re<this._keys.length;re++)if(mn(this._keys[re],X)){this._cacheIndex=re;break}}return this._cacheIndex<0&&te&&(this._cacheIndex=this._keys.length,this._keys.push(X),this._values.push(void 0)),this._cacheIndex},Ue}();return q;function Ee(Ue,X){return Ue}function xt(Ue,X){return X}function At(Ue,X){return[Ue,X]}}function Fi(){var k=function(){function C(){this._map=new Y}return Object.defineProperty(C.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),C.prototype.has=function(j){return this._map.has(j)},C.prototype.add=function(j){return this._map.set(j,j),this},C.prototype.delete=function(j){return this._map.delete(j)},C.prototype.clear=function(){this._map.clear()},C.prototype.keys=function(){return this._map.keys()},C.prototype.values=function(){return this._map.keys()},C.prototype.entries=function(){return this._map.entries()},C.prototype["@@iterator"]=function(){return this.keys()},C.prototype[o]=function(){return this.keys()},C}();return k}function Gi(){var k=16,C=b.create(),j=q();return function(){function X(){this._key=q()}return X.prototype.has=function(te){var re=Ee(te,!1);return re!==void 0?b.has(re,this._key):!1},X.prototype.get=function(te){var re=Ee(te,!1);return re!==void 0?b.get(re,this._key):void 0},X.prototype.set=function(te,re){var me=Ee(te,!0);return me[this._key]=re,this},X.prototype.delete=function(te){var re=Ee(te,!1);return re!==void 0?delete re[this._key]:!1},X.prototype.clear=function(){this._key=q()},X}();function q(){var X;do X="@@WeakMap@@"+Ue();while(b.has(C,X));return C[X]=!0,X}function Ee(X,te){if(!n.call(X,j)){if(!te)return;Object.defineProperty(X,j,{value:b.create()})}return X[j]}function xt(X,te){for(var re=0;re<te;++re)X[re]=Math.random()*255|0;return X}function At(X){if(typeof Uint8Array=="function"){var te=new Uint8Array(X);return typeof crypto<"u"?crypto.getRandomValues(te):typeof msCrypto<"u"?msCrypto.getRandomValues(te):xt(te,X),te}return xt(new Array(X),X)}function Ue(){var X=At(k);X[6]=X[6]&79|64,X[8]=X[8]&191|128;for(var te="",re=0;re<k;++re){var me=X[re];(re===4||re===6||re===8)&&(te+="-"),me<16&&(te+="0"),te+=me.toString(16).toLowerCase()}return te}}function hi(k){return k.__=void 0,delete k.__,k}})})(Uf||(Uf={}));/*!
43
+ ***************************************************************************** */var Uf;(function(r){(function(e){var t=typeof globalThis=="object"?globalThis:typeof Ot=="object"?Ot:typeof self=="object"?self:typeof this=="object"?this:c(),n=i(r);typeof t.Reflect<"u"&&(n=i(t.Reflect,n)),e(n,t),typeof t.Reflect>"u"&&(t.Reflect=r);function i(u,d){return function(b,_){Object.defineProperty(u,b,{configurable:!0,writable:!0,value:_}),d&&d(b,_)}}function s(){try{return Function("return this;")()}catch{}}function o(){try{return(0,eval)("(function() { return this; })()")}catch{}}function c(){return s()||o()}})(function(e,t){var n=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",s=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",o=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",u={__proto__:[]}instanceof Array,d=!c&&!u,b={create:c?function(){return hi(Object.create(null))}:u?function(){return hi({__proto__:null})}:function(){return hi({})},has:d?function(k,C){return n.call(k,C)}:function(k,C){return C in k},get:d?function(k,C){return n.call(k,C)?k[C]:void 0}:function(k,C){return k[C]}},_=Object.getPrototypeOf(Function),q=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:Qr(),$=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Fi(),w=typeof WeakMap=="function"?WeakMap:Gi(),E=i?Symbol.for("@reflect-metadata:registry"):void 0,B=Hi(),I=ui(B);function R(k,C,j,W){if(he(j)){if(!Vi(k))throw new TypeError;if(!Li(C))throw new TypeError;return Et(k,C)}else{if(!Vi(k))throw new TypeError;if(!ee(C))throw new TypeError;if(!ee(W)&&!he(W)&&!tt(W))throw new TypeError;return tt(W)&&(W=void 0),j=Ht(j),ut(k,C,j,W)}}e("decorate",R);function U(k,C){function j(W,ke){if(!ee(W))throw new TypeError;if(!he(ke)&&!To(ke))throw new TypeError;Ne(k,C,W,ke)}return j}e("metadata",U);function fe(k,C,j,W){if(!ee(j))throw new TypeError;return he(W)||(W=Ht(W)),Ne(k,C,j,W)}e("defineMetadata",fe);function oe(k,C,j){if(!ee(C))throw new TypeError;return he(j)||(j=Ht(j)),yt(k,C,j)}e("hasMetadata",oe);function ce(k,C,j){if(!ee(C))throw new TypeError;return he(j)||(j=Ht(j)),Qe(k,C,j)}e("hasOwnMetadata",ce);function X(k,C,j){if(!ee(C))throw new TypeError;return he(j)||(j=Ht(j)),Ke(k,C,j)}e("getMetadata",X);function me(k,C,j){if(!ee(C))throw new TypeError;return he(j)||(j=Ht(j)),ae(k,C,j)}e("getOwnMetadata",me);function $e(k,C){if(!ee(k))throw new TypeError;return he(C)||(C=Ht(C)),pt(k,C)}e("getMetadataKeys",$e);function ot(k,C){if(!ee(k))throw new TypeError;return he(C)||(C=Ht(C)),It(k,C)}e("getOwnMetadataKeys",ot);function _t(k,C,j){if(!ee(C))throw new TypeError;if(he(j)||(j=Ht(j)),!ee(C))throw new TypeError;he(j)||(j=Ht(j));var W=Or(C,j,!1);return he(W)?!1:W.OrdinaryDeleteMetadata(k,C,j)}e("deleteMetadata",_t);function Et(k,C){for(var j=k.length-1;j>=0;--j){var W=k[j],ke=W(C);if(!he(ke)&&!tt(ke)){if(!Li(ke))throw new TypeError;C=ke}}return C}function ut(k,C,j,W){for(var ke=k.length-1;ke>=0;--ke){var xt=k[ke],At=xt(C,j,W);if(!he(At)&&!tt(At)){if(!ee(At))throw new TypeError;W=At}}return W}function yt(k,C,j){var W=Qe(k,C,j);if(W)return!0;var ke=li(C);return tt(ke)?!1:yt(k,ke,j)}function Qe(k,C,j){var W=Or(C,j,!1);return he(W)?!1:gn(W.OrdinaryHasOwnMetadata(k,C,j))}function Ke(k,C,j){var W=Qe(k,C,j);if(W)return ae(k,C,j);var ke=li(C);if(!tt(ke))return Ke(k,ke,j)}function ae(k,C,j){var W=Or(C,j,!1);if(!he(W))return W.OrdinaryGetOwnMetadata(k,C,j)}function Ne(k,C,j,W){var ke=Or(j,W,!0);ke.OrdinaryDefineOwnMetadata(k,C,j,W)}function pt(k,C){var j=It(k,C),W=li(k);if(W===null)return j;var ke=pt(W,C);if(ke.length<=0)return j;if(j.length<=0)return ke;for(var xt=new $,At=[],Ue=0,J=j;Ue<J.length;Ue++){var te=J[Ue],re=xt.has(te);re||(xt.add(te),At.push(te))}for(var we=0,Le=ke;we<Le.length;we++){var te=Le[we],re=xt.has(te);re||(xt.add(te),At.push(te))}return At}function It(k,C){var j=Or(k,C,!1);return j?j.OrdinaryOwnMetadataKeys(k,C):[]}function Ct(k){if(k===null)return 1;switch(typeof k){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return k===null?1:6;default:return 6}}function he(k){return k===void 0}function tt(k){return k===null}function gt(k){return typeof k=="symbol"}function ee(k){return typeof k=="object"?k!==null:typeof k=="function"}function at(k,C){switch(Ct(k)){case 0:return k;case 1:return k;case 2:return k;case 3:return k;case 4:return k;case 5:return k}var j="string",W=wn(k,s);if(W!==void 0){var ke=W.call(k,j);if(ee(ke))throw new TypeError;return ke}return Bt(k)}function Bt(k,C){var j,W;{var ke=k.toString;if(Mr(ke)){var W=ke.call(k);if(!ee(W))return W}var j=k.valueOf;if(Mr(j)){var W=j.call(k);if(!ee(W))return W}}throw new TypeError}function gn(k){return!!k}function vn(k){return""+k}function Ht(k){var C=at(k);return gt(C)?C:vn(C)}function Vi(k){return Array.isArray?Array.isArray(k):k instanceof Object?k instanceof Array:Object.prototype.toString.call(k)==="[object Array]"}function Mr(k){return typeof k=="function"}function Li(k){return typeof k=="function"}function To(k){switch(Ct(k)){case 3:return!0;case 4:return!0;default:return!1}}function mn(k,C){return k===C||k!==k&&C!==C}function wn(k,C){var j=k[C];if(j!=null){if(!Mr(j))throw new TypeError;return j}}function ai(k){var C=wn(k,o);if(!Mr(C))throw new TypeError;var j=C.call(k);if(!ee(j))throw new TypeError;return j}function ci(k){return k.value}function hr(k){var C=k.next();return C.done?!1:C}function Dn(k){var C=k.return;C&&C.call(k)}function li(k){var C=Object.getPrototypeOf(k);if(typeof k!="function"||k===_||C!==_)return C;var j=k.prototype,W=j&&Object.getPrototypeOf(j);if(W==null||W===Object.prototype)return C;var ke=W.constructor;return typeof ke!="function"||ke===k?C:ke}function $n(){var k;!he(E)&&typeof t.Reflect<"u"&&!(E in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(k=fi(t.Reflect));var C,j,W,ke=new w,xt={registerProvider:At,getProvider:J,setProvider:re};return xt;function At(we){if(!Object.isExtensible(xt))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case k===we:break;case he(C):C=we;break;case C===we:break;case he(j):j=we;break;case j===we:break;default:W===void 0&&(W=new $),W.add(we);break}}function Ue(we,Le){if(!he(C)){if(C.isProviderFor(we,Le))return C;if(!he(j)){if(j.isProviderFor(we,Le))return C;if(!he(W))for(var et=ai(W);;){var vt=hr(et);if(!vt)return;var Vt=ci(vt);if(Vt.isProviderFor(we,Le))return Dn(et),Vt}}}if(!he(k)&&k.isProviderFor(we,Le))return k}function J(we,Le){var et=ke.get(we),vt;return he(et)||(vt=et.get(Le)),he(vt)&&(vt=Ue(we,Le),he(vt)||(he(et)&&(et=new q,ke.set(we,et)),et.set(Le,vt))),vt}function te(we){if(he(we))throw new TypeError;return C===we||j===we||!he(W)&&W.has(we)}function re(we,Le,et){if(!te(et))throw new Error("Metadata provider not registered.");var vt=J(we,Le);if(vt!==et){if(!he(vt))return!1;var Vt=ke.get(we);he(Vt)&&(Vt=new q,ke.set(we,Vt)),Vt.set(Le,et)}return!0}}function Hi(){var k;return!he(E)&&ee(t.Reflect)&&Object.isExtensible(t.Reflect)&&(k=t.Reflect[E]),he(k)&&(k=$n()),!he(E)&&ee(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,E,{enumerable:!1,configurable:!1,writable:!1,value:k}),k}function ui(k){var C=new w,j={isProviderFor:function(te,re){var we=C.get(te);return he(we)?!1:we.has(re)},OrdinaryDefineOwnMetadata:At,OrdinaryHasOwnMetadata:ke,OrdinaryGetOwnMetadata:xt,OrdinaryOwnMetadataKeys:Ue,OrdinaryDeleteMetadata:J};return B.registerProvider(j),j;function W(te,re,we){var Le=C.get(te),et=!1;if(he(Le)){if(!we)return;Le=new q,C.set(te,Le),et=!0}var vt=Le.get(re);if(he(vt)){if(!we)return;if(vt=new q,Le.set(re,vt),!k.setProvider(te,re,j))throw Le.delete(re),et&&C.delete(te),new Error("Wrong provider for target.")}return vt}function ke(te,re,we){var Le=W(re,we,!1);return he(Le)?!1:gn(Le.has(te))}function xt(te,re,we){var Le=W(re,we,!1);if(!he(Le))return Le.get(te)}function At(te,re,we,Le){var et=W(we,Le,!0);et.set(te,re)}function Ue(te,re){var we=[],Le=W(te,re,!1);if(he(Le))return we;for(var et=Le.keys(),vt=ai(et),Vt=0;;){var di=hr(vt);if(!di)return we.length=Vt,we;var pi=ci(di);try{we[Vt]=pi}catch(zi){try{Dn(vt)}finally{throw zi}}Vt++}}function J(te,re,we){var Le=W(re,we,!1);if(he(Le)||!Le.delete(te))return!1;if(Le.size===0){var et=C.get(re);he(et)||(et.delete(we),et.size===0&&C.delete(et))}return!0}}function fi(k){var C=k.defineMetadata,j=k.hasOwnMetadata,W=k.getOwnMetadata,ke=k.getOwnMetadataKeys,xt=k.deleteMetadata,At=new w,Ue={isProviderFor:function(J,te){var re=At.get(J);return!he(re)&&re.has(te)?!0:ke(J,te).length?(he(re)&&(re=new $,At.set(J,re)),re.add(te),!0):!1},OrdinaryDefineOwnMetadata:C,OrdinaryHasOwnMetadata:j,OrdinaryGetOwnMetadata:W,OrdinaryOwnMetadataKeys:ke,OrdinaryDeleteMetadata:xt};return Ue}function Or(k,C,j){var W=B.getProvider(k,C);if(!he(W))return W;if(j){if(B.setProvider(k,C,I))return I;throw new Error("Illegal state.")}}function Qr(){var k={},C=[],j=function(){function Ue(J,te,re){this._index=0,this._keys=J,this._values=te,this._selector=re}return Ue.prototype["@@iterator"]=function(){return this},Ue.prototype[o]=function(){return this},Ue.prototype.next=function(){var J=this._index;if(J>=0&&J<this._keys.length){var te=this._selector(this._keys[J],this._values[J]);return J+1>=this._keys.length?(this._index=-1,this._keys=C,this._values=C):this._index++,{value:te,done:!1}}return{value:void 0,done:!0}},Ue.prototype.throw=function(J){throw this._index>=0&&(this._index=-1,this._keys=C,this._values=C),J},Ue.prototype.return=function(J){return this._index>=0&&(this._index=-1,this._keys=C,this._values=C),{value:J,done:!0}},Ue}(),W=function(){function Ue(){this._keys=[],this._values=[],this._cacheKey=k,this._cacheIndex=-2}return Object.defineProperty(Ue.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),Ue.prototype.has=function(J){return this._find(J,!1)>=0},Ue.prototype.get=function(J){var te=this._find(J,!1);return te>=0?this._values[te]:void 0},Ue.prototype.set=function(J,te){var re=this._find(J,!0);return this._values[re]=te,this},Ue.prototype.delete=function(J){var te=this._find(J,!1);if(te>=0){for(var re=this._keys.length,we=te+1;we<re;we++)this._keys[we-1]=this._keys[we],this._values[we-1]=this._values[we];return this._keys.length--,this._values.length--,mn(J,this._cacheKey)&&(this._cacheKey=k,this._cacheIndex=-2),!0}return!1},Ue.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=k,this._cacheIndex=-2},Ue.prototype.keys=function(){return new j(this._keys,this._values,ke)},Ue.prototype.values=function(){return new j(this._keys,this._values,xt)},Ue.prototype.entries=function(){return new j(this._keys,this._values,At)},Ue.prototype["@@iterator"]=function(){return this.entries()},Ue.prototype[o]=function(){return this.entries()},Ue.prototype._find=function(J,te){if(!mn(this._cacheKey,J)){this._cacheIndex=-1;for(var re=0;re<this._keys.length;re++)if(mn(this._keys[re],J)){this._cacheIndex=re;break}}return this._cacheIndex<0&&te&&(this._cacheIndex=this._keys.length,this._keys.push(J),this._values.push(void 0)),this._cacheIndex},Ue}();return W;function ke(Ue,J){return Ue}function xt(Ue,J){return J}function At(Ue,J){return[Ue,J]}}function Fi(){var k=function(){function C(){this._map=new q}return Object.defineProperty(C.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),C.prototype.has=function(j){return this._map.has(j)},C.prototype.add=function(j){return this._map.set(j,j),this},C.prototype.delete=function(j){return this._map.delete(j)},C.prototype.clear=function(){this._map.clear()},C.prototype.keys=function(){return this._map.keys()},C.prototype.values=function(){return this._map.keys()},C.prototype.entries=function(){return this._map.entries()},C.prototype["@@iterator"]=function(){return this.keys()},C.prototype[o]=function(){return this.keys()},C}();return k}function Gi(){var k=16,C=b.create(),j=W();return function(){function J(){this._key=W()}return J.prototype.has=function(te){var re=ke(te,!1);return re!==void 0?b.has(re,this._key):!1},J.prototype.get=function(te){var re=ke(te,!1);return re!==void 0?b.get(re,this._key):void 0},J.prototype.set=function(te,re){var we=ke(te,!0);return we[this._key]=re,this},J.prototype.delete=function(te){var re=ke(te,!1);return re!==void 0?delete re[this._key]:!1},J.prototype.clear=function(){this._key=W()},J}();function W(){var J;do J="@@WeakMap@@"+Ue();while(b.has(C,J));return C[J]=!0,J}function ke(J,te){if(!n.call(J,j)){if(!te)return;Object.defineProperty(J,j,{value:b.create()})}return J[j]}function xt(J,te){for(var re=0;re<te;++re)J[re]=Math.random()*255|0;return J}function At(J){if(typeof Uint8Array=="function"){var te=new Uint8Array(J);return typeof crypto<"u"?crypto.getRandomValues(te):typeof msCrypto<"u"?msCrypto.getRandomValues(te):xt(te,J),te}return xt(new Array(J),J)}function Ue(){var J=At(k);J[6]=J[6]&79|64,J[8]=J[8]&191|128;for(var te="",re=0;re<k;++re){var we=J[re];(re===4||re===6||re===8)&&(te+="-"),we<16&&(te+="0"),te+=we.toString(16).toLowerCase()}return te}}function hi(k){return k.__=void 0,delete k.__,k}})})(Uf||(Uf={}));/*!
44
44
  * MIT License
45
45
  *
46
46
  * Copyright (c) 2017-2022 Peculiar Ventures, LLC
@@ -63,9 +63,9 @@ React keys must be passed directly to JSX without using spread:
63
63
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
64
64
  * SOFTWARE.
65
65
  *
66
- */const vy="[object ArrayBuffer]";class Q{static isArrayBuffer(e){return Object.prototype.toString.call(e)===vy}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 n=Q.toUint8Array(e),i=Q.toUint8Array(t);if(n.length!==i.byteLength)return!1;for(let s=0;s<n.length;s++)if(n[s]!==i[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 n=0;for(const o of t)n+=o.byteLength;const i=new Uint8Array(n);let s=0;for(const o of t){const c=this.toUint8Array(o);i.set(c,s),s+=c.length}return e[e.length-1]instanceof Function?this.toView(i,e[e.length-1]):i.buffer}}const Fc="string",my=/^[0-9a-f]+$/i,wy=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,by=/^[a-zA-Z0-9-_]+$/;class Df{static fromString(e){const t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n.buffer}static toString(e){const t=Q.toUint8Array(e);let n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);return decodeURIComponent(escape(n))}}class en{static toString(e,t=!1){const n=Q.toArrayBuffer(e),i=new DataView(n);let s="";for(let o=0;o<n.byteLength;o+=2){const c=i.getUint16(o,t);s+=String.fromCharCode(c)}return s}static fromString(e,t=!1){const n=new ArrayBuffer(e.length*2),i=new DataView(n);for(let s=0;s<e.length;s++)i.setUint16(s*2,e.charCodeAt(s),t);return n}}class ve{static isHex(e){return typeof e===Fc&&my.test(e)}static isBase64(e){return typeof e===Fc&&wy.test(e)}static isBase64Url(e){return typeof e===Fc&&by.test(e)}static ToString(e,t="utf8"){const n=Q.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);case"utf16le":return en.toString(n,!0);case"utf16":case"utf16be":return en.toString(n);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return en.fromString(e,!0);case"utf16":case"utf16be":return en.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){const t=Q.toUint8Array(e);if(typeof btoa<"u"){const n=this.ToString(t,"binary");return btoa(n)}else return Buffer.from(t).toString("base64")}static FromBase64(e){const t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!ve.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(!ve.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=ve.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return Df.fromString(e);case"utf16":case"utf16be":return en.fromString(e);case"utf16le":case"usc2":return en.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=ve.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return Df.toString(e);case"utf16":case"utf16be":return en.toString(e);case"utf16le":case"usc2":return en.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){const t=e.length,n=new Uint8Array(t);for(let i=0;i<t;i++)n[i]=e.charCodeAt(i);return n.buffer}static ToBinary(e){const t=Q.toUint8Array(e);let n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return n}static ToHex(e){const t=Q.toUint8Array(e);let n="";const i=t.length;for(let s=0;s<i;s++){const o=t[s];o<16&&(n+="0"),n+=o.toString(16)}return n}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!ve.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);const n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i=i+2){const s=t.slice(i,i+2);n[i/2]=parseInt(s,16)}return n.buffer}static ToUtf16String(e,t=!1){return en.toString(e,t)}static FromUtf16String(e,t=!1){return en.fromString(e,t)}static Base64Padding(e){const t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}static formatString(e){return(e==null?void 0:e.replace(/[\n\r\t ]/g,""))||""}}ve.DEFAULT_UTF8_ENCODING="utf8";function xy(...r){const e=r.map(i=>i.byteLength).reduce((i,s)=>i+s),t=new Uint8Array(e);let n=0;return r.map(i=>new Uint8Array(i)).forEach(i=>{for(const s of i)t[n++]=s}),t.buffer}function jo(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;const t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<r.byteLength;i++)if(t[i]!==n[i])return!1;return!0}/*!
66
+ */const yy="[object ArrayBuffer]";class Q{static isArrayBuffer(e){return Object.prototype.toString.call(e)===yy}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 n=Q.toUint8Array(e),i=Q.toUint8Array(t);if(n.length!==i.byteLength)return!1;for(let s=0;s<n.length;s++)if(n[s]!==i[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 n=0;for(const o of t)n+=o.byteLength;const i=new Uint8Array(n);let s=0;for(const o of t){const c=this.toUint8Array(o);i.set(c,s),s+=c.length}return e[e.length-1]instanceof Function?this.toView(i,e[e.length-1]):i.buffer}}const Fc="string",gy=/^[0-9a-f]+$/i,vy=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,my=/^[a-zA-Z0-9-_]+$/;class Df{static fromString(e){const t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n.buffer}static toString(e){const t=Q.toUint8Array(e);let n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);return decodeURIComponent(escape(n))}}class en{static toString(e,t=!1){const n=Q.toArrayBuffer(e),i=new DataView(n);let s="";for(let o=0;o<n.byteLength;o+=2){const c=i.getUint16(o,t);s+=String.fromCharCode(c)}return s}static fromString(e,t=!1){const n=new ArrayBuffer(e.length*2),i=new DataView(n);for(let s=0;s<e.length;s++)i.setUint16(s*2,e.charCodeAt(s),t);return n}}class ve{static isHex(e){return typeof e===Fc&&gy.test(e)}static isBase64(e){return typeof e===Fc&&vy.test(e)}static isBase64Url(e){return typeof e===Fc&&my.test(e)}static ToString(e,t="utf8"){const n=Q.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);case"utf16le":return en.toString(n,!0);case"utf16":case"utf16be":return en.toString(n);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return en.fromString(e,!0);case"utf16":case"utf16be":return en.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){const t=Q.toUint8Array(e);if(typeof btoa<"u"){const n=this.ToString(t,"binary");return btoa(n)}else return Buffer.from(t).toString("base64")}static FromBase64(e){const t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!ve.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(!ve.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=ve.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return Df.fromString(e);case"utf16":case"utf16be":return en.fromString(e);case"utf16le":case"usc2":return en.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=ve.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return Df.toString(e);case"utf16":case"utf16be":return en.toString(e);case"utf16le":case"usc2":return en.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){const t=e.length,n=new Uint8Array(t);for(let i=0;i<t;i++)n[i]=e.charCodeAt(i);return n.buffer}static ToBinary(e){const t=Q.toUint8Array(e);let n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return n}static ToHex(e){const t=Q.toUint8Array(e);let n="";const i=t.length;for(let s=0;s<i;s++){const o=t[s];o<16&&(n+="0"),n+=o.toString(16)}return n}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!ve.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);const n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i=i+2){const s=t.slice(i,i+2);n[i/2]=parseInt(s,16)}return n.buffer}static ToUtf16String(e,t=!1){return en.toString(e,t)}static FromUtf16String(e,t=!1){return en.fromString(e,t)}static Base64Padding(e){const t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}static formatString(e){return(e==null?void 0:e.replace(/[\n\r\t ]/g,""))||""}}ve.DEFAULT_UTF8_ENCODING="utf8";function wy(...r){const e=r.map(i=>i.byteLength).reduce((i,s)=>i+s),t=new Uint8Array(e);let n=0;return r.map(i=>new Uint8Array(i)).forEach(i=>{for(const s of i)t[n++]=s}),t.buffer}function jo(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;const t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<r.byteLength;i++)if(t[i]!==n[i])return!1;return!0}/*!
67
67
  Copyright (c) Peculiar Ventures, LLC
68
- */function qi(r,e){let t=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)t+=r[r.length-1-n]*Math.pow(2,e*n);return t}function yi(r,e,t=-1){const n=t;let i=r,s=0,o=Math.pow(2,e);for(let c=1;c<8;c++){if(r<o){let u;if(n<0)u=new ArrayBuffer(c),s=c;else{if(n<c)return new ArrayBuffer(0);u=new ArrayBuffer(n),s=n}const d=new Uint8Array(u);for(let b=c-1;b>=0;b--){const S=Math.pow(2,b*e);d[s-b-1]=Math.floor(i/S),i-=d[s-b-1]*S}return u}o*=Math.pow(2,e)}return new ArrayBuffer(0)}function Gc(...r){let e=0,t=0;for(const s of r)e+=s.length;const n=new ArrayBuffer(e),i=new Uint8Array(n);for(const s of r)i.set(s,t),t+=s.length;return i}function $f(){const r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const c=r[0]===255&&r[1]&128,u=r[0]===0&&(r[1]&128)===0;(c||u)&&this.warnings.push("Needlessly long format")}const e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let c=0;c<this.valueHex.byteLength;c++)t[c]=0;t[0]=r[0]&128;const n=qi(t,8),i=new ArrayBuffer(this.valueHex.byteLength),s=new Uint8Array(i);for(let c=0;c<this.valueHex.byteLength;c++)s[c]=r[c];return s[0]&=127,qi(s,8)-n}function Ay(r){const e=r<0?r*-1:r;let t=128;for(let n=1;n<8;n++){if(e<=t){if(r<0){const o=t-e,c=yi(o,8,n),u=new Uint8Array(c);return u[0]|=128,c}let i=yi(e,8,n),s=new Uint8Array(i);if(s[0]&128){const o=i.slice(0),c=new Uint8Array(o);i=new ArrayBuffer(i.byteLength+1),s=new Uint8Array(i);for(let u=0;u<o.byteLength;u++)s[u+1]=c[u];s[0]=0}return i}t*=Math.pow(2,8)}return new ArrayBuffer(0)}function _y(r,e){if(r.byteLength!==e.byteLength)return!1;const t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<t.length;i++)if(t[i]!==n[i])return!1;return!0}function _r(r,e){const t=r.toString(10);if(e<t.length)return"";const n=e-t.length,i=new Array(n);for(let o=0;o<n;o++)i[o]="0";return i.join("").concat(t)}/*!
68
+ */function qi(r,e){let t=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)t+=r[r.length-1-n]*Math.pow(2,e*n);return t}function yi(r,e,t=-1){const n=t;let i=r,s=0,o=Math.pow(2,e);for(let c=1;c<8;c++){if(r<o){let u;if(n<0)u=new ArrayBuffer(c),s=c;else{if(n<c)return new ArrayBuffer(0);u=new ArrayBuffer(n),s=n}const d=new Uint8Array(u);for(let b=c-1;b>=0;b--){const _=Math.pow(2,b*e);d[s-b-1]=Math.floor(i/_),i-=d[s-b-1]*_}return u}o*=Math.pow(2,e)}return new ArrayBuffer(0)}function Gc(...r){let e=0,t=0;for(const s of r)e+=s.length;const n=new ArrayBuffer(e),i=new Uint8Array(n);for(const s of r)i.set(s,t),t+=s.length;return i}function $f(){const r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const c=r[0]===255&&r[1]&128,u=r[0]===0&&(r[1]&128)===0;(c||u)&&this.warnings.push("Needlessly long format")}const e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let c=0;c<this.valueHex.byteLength;c++)t[c]=0;t[0]=r[0]&128;const n=qi(t,8),i=new ArrayBuffer(this.valueHex.byteLength),s=new Uint8Array(i);for(let c=0;c<this.valueHex.byteLength;c++)s[c]=r[c];return s[0]&=127,qi(s,8)-n}function by(r){const e=r<0?r*-1:r;let t=128;for(let n=1;n<8;n++){if(e<=t){if(r<0){const o=t-e,c=yi(o,8,n),u=new Uint8Array(c);return u[0]|=128,c}let i=yi(e,8,n),s=new Uint8Array(i);if(s[0]&128){const o=i.slice(0),c=new Uint8Array(o);i=new ArrayBuffer(i.byteLength+1),s=new Uint8Array(i);for(let u=0;u<o.byteLength;u++)s[u+1]=c[u];s[0]=0}return i}t*=Math.pow(2,8)}return new ArrayBuffer(0)}function xy(r,e){if(r.byteLength!==e.byteLength)return!1;const t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<t.length;i++)if(t[i]!==n[i])return!1;return!0}function Sr(r,e){const t=r.toString(10);if(e<t.length)return"";const n=e-t.length,i=new Array(n);for(let o=0;o<n;o++)i[o]="0";return i.join("").concat(t)}/*!
69
69
  * Copyright (c) 2014, GMO GlobalSign
70
70
  * Copyright (c) 2015-2022, Peculiar Ventures
71
71
  * All rights reserved.
@@ -97,11 +97,11 @@ React keys must be passed directly to JSX without using spread:
97
97
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
98
98
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
99
99
  *
100
- */function Po(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function zc(r){let e=0,t=0;for(let i=0;i<r.length;i++){const s=r[i];e+=s.byteLength}const n=new Uint8Array(e);for(let i=0;i<r.length;i++){const s=r[i];n.set(new Uint8Array(s),t),t+=s.byteLength}return n.buffer}function An(r,e,t,n){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-n<0?(r.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(r.error="Wrong parameter: inputBuffer has zero length",!1):(r.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}class Uo{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return zc(this.items)}}const Bs=[new Uint8Array([1])],Mf="0123456789",Kc="name",Vf="valueHexView",Sy="isHexOnly",Ey="idBlock",ky="tagClass",Iy="tagNumber",Cy="isConstructed",By="fromBER",Oy="toBER",Ty="local",yr="",Lr=new ArrayBuffer(0),Do=new Uint8Array(0),Os="EndOfContent",Lf="OCTET STRING",Hf="BIT STRING";function tn(r){var e;return e=class extends r{constructor(...n){var i;super(...n);const s=n[0]||{};this.isHexOnly=(i=s.isHexOnly)!==null&&i!==void 0?i:!1,this.valueHexView=s.valueHex?Q.toUint8Array(s.valueHex):Do}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}fromBER(n,i,s){const o=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!An(this,o,i,s))return-1;const c=i+s;return this.valueHexView=o.subarray(i,c),this.valueHexView.length?(this.blockLength=s,c):(this.warnings.push("Zero buffer length"),i)}toBER(n=!1){return this.isHexOnly?n?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",Lr)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:ve.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}class gi{constructor({blockLength:e=0,error:t=yr,warnings:n=[],valueBeforeDecode:i=Do}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=Q.toUint8Array(i)}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:ve.ToHex(this.valueBeforeDecodeView)}}}gi.NAME="baseBlock";class ar extends gi{fromBER(e,t,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}ar.NAME="valueBlock";class Ff extends tn(gi){constructor({idBlock:e={}}={}){var t,n,i,s;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?Q.toUint8Array(e.valueHex):Do,this.tagClass=(n=e.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(i=e.tagNumber)!==null&&i!==void 0?i:-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",Lr}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){const i=new Uint8Array(1);if(!e){let s=this.tagNumber;s&=31,t|=s,i[0]=t}return i.buffer}if(!this.isHexOnly){const i=yi(this.tagNumber,7),s=new Uint8Array(i),o=i.byteLength,c=new Uint8Array(o+1);if(c[0]=t|31,!e){for(let u=0;u<o-1;u++)c[u+1]=s[u]|128;c[o]=s[o-1]}return c.buffer}const n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=t|31,!e){const i=this.valueHexView;for(let s=0;s<i.length-1;s++)n[s+1]=i[s]|128;n[this.valueHexView.byteLength]=i[i.length-1]}return n.buffer}fromBER(e,t,n){const i=Q.toUint8Array(e);if(!An(this,i,t,n))return-1;const s=i.subarray(t,t+n);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 c=s[0]&31;if(c!==31)this.tagNumber=c,this.blockLength=1;else{let u=1,d=this.valueHexView=new Uint8Array(255),b=255;for(;s[u]&128;){if(d[u-1]=s[u]&127,u++,u>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(u===b){b+=255;const Y=new Uint8Array(b);for(let $=0;$<d.length;$++)Y[$]=d[$];d=this.valueHexView=new Uint8Array(b)}}this.blockLength=u+1,d[u-1]=s[u]&127;const S=new Uint8Array(u);for(let Y=0;Y<u;Y++)S[Y]=d[Y];d=this.valueHexView=new Uint8Array(u),d.set(S),this.blockLength<=9?this.tagNumber=qi(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}}}Ff.NAME="identificationBlock";class Gf extends gi{constructor({lenBlock:e={}}={}){var t,n,i;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(n=e.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(i=e.length)!==null&&i!==void 0?i:0}fromBER(e,t,n){const i=Q.toUint8Array(e);if(!An(this,i,t,n))return-1;const s=i.subarray(t,t+n);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 o=s[0]&127;if(o>8)return this.error="Too big integer",-1;if(o+1>s.length)return this.error="End of input reached before message was fully decoded",-1;const c=t+1,u=i.subarray(c,c+o);return u[o-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=qi(u,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=o+1,t+this.blockLength}toBER(e=!1){let t,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=128),t;if(this.longFormUsed){const i=yi(this.length,8);if(i.byteLength>127)return this.error="Too big length",Lr;if(t=new ArrayBuffer(i.byteLength+1),e)return t;const s=new Uint8Array(i);n=new Uint8Array(t),n[0]=i.byteLength|128;for(let o=0;o<i.byteLength;o++)n[o+1]=s[o];return t}return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}Gf.NAME="lengthBlock";const he={};class Zt extends gi{constructor({name:e=yr,optional:t=!1,primitiveSchema:n,...i}={},s){super(i),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new Ff(i),this.lenBlock=new Gf(i),this.valueBlock=s?new s(i):new ar(i)}fromBER(e,t,n){const i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(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),i)}toBER(e,t){const n=t||new Uo;t||zf(this);const i=this.idBlock.toBER(e);if(n.write(i),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{const s=this.valueBlock.toBER(e);this.lenBlock.length=s.byteLength;const o=this.lenBlock.toBER(e);n.write(o),n.write(s)}return t?Lr:n.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():ve.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${ve.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;const t=this.toBER(),n=e.toBER();return _y(t,n)}}Zt.NAME="BaseBlock";function zf(r){if(r instanceof he.Constructed)for(const e of r.valueBlock.value)zf(e)&&(r.lenBlock.isIndefiniteForm=!0);return!!r.lenBlock.isIndefiniteForm}class Zc extends Zt{constructor({value:e=yr,...t}={},n){super(t,n),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,n){const i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(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),i)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}Zc.NAME="BaseStringBlock";class Kf extends tn(ar){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}}Kf.NAME="PrimitiveValueBlock";var Zf;class Ts extends Zt{constructor(e={}){super(e,Kf),this.idBlock.isConstructed=!1}}Zf=Ts,he.Primitive=Zf,Ts.NAME="PRIMITIVE";function Ny(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 Yi(r,e=0,t=r.length){const n=e;let i=new Zt({},ar);const s=new gi;if(!An(s,r,e,t))return i.error=s.error,{offset:-1,result:i};if(!r.subarray(e,e+t).length)return i.error="Zero buffer length",{offset:-1,result:i};let c=i.idBlock.fromBER(r,e,t);if(i.idBlock.warnings.length&&i.warnings.concat(i.idBlock.warnings),c===-1)return i.error=i.idBlock.error,{offset:-1,result:i};if(e=c,t-=i.idBlock.blockLength,c=i.lenBlock.fromBER(r,e,t),i.lenBlock.warnings.length&&i.warnings.concat(i.lenBlock.warnings),c===-1)return i.error=i.lenBlock.error,{offset:-1,result:i};if(e=c,t-=i.lenBlock.blockLength,!i.idBlock.isConstructed&&i.lenBlock.isIndefiniteForm)return i.error="Indefinite length form used for primitive encoding form",{offset:-1,result:i};let u=Zt;switch(i.idBlock.tagClass){case 1:if(i.idBlock.tagNumber>=37&&i.idBlock.isHexOnly===!1)return i.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:i};switch(i.idBlock.tagNumber){case 0:if(i.idBlock.isConstructed&&i.lenBlock.length>0)return i.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:i};u=he.EndOfContent;break;case 1:u=he.Boolean;break;case 2:u=he.Integer;break;case 3:u=he.BitString;break;case 4:u=he.OctetString;break;case 5:u=he.Null;break;case 6:u=he.ObjectIdentifier;break;case 10:u=he.Enumerated;break;case 12:u=he.Utf8String;break;case 13:u=he.RelativeObjectIdentifier;break;case 14:u=he.TIME;break;case 15:return i.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:i};case 16:u=he.Sequence;break;case 17:u=he.Set;break;case 18:u=he.NumericString;break;case 19:u=he.PrintableString;break;case 20:u=he.TeletexString;break;case 21:u=he.VideotexString;break;case 22:u=he.IA5String;break;case 23:u=he.UTCTime;break;case 24:u=he.GeneralizedTime;break;case 25:u=he.GraphicString;break;case 26:u=he.VisibleString;break;case 27:u=he.GeneralString;break;case 28:u=he.UniversalString;break;case 29:u=he.CharacterString;break;case 30:u=he.BmpString;break;case 31:u=he.DATE;break;case 32:u=he.TimeOfDay;break;case 33:u=he.DateTime;break;case 34:u=he.Duration;break;default:{const d=i.idBlock.isConstructed?new he.Constructed:new he.Primitive;d.idBlock=i.idBlock,d.lenBlock=i.lenBlock,d.warnings=i.warnings,i=d}}break;case 2:case 3:case 4:default:u=i.idBlock.isConstructed?he.Constructed:he.Primitive}return i=Ny(i,u),c=i.fromBER(r,e,i.lenBlock.isIndefiniteForm?t:i.lenBlock.length),i.valueBeforeDecodeView=r.subarray(n,n+i.blockLength),{offset:c,result:i}}function Ji(r){if(!r.byteLength){const e=new Zt({},ar);return e.error="Input buffer has zero length",{offset:-1,result:e}}return Yi(Q.toUint8Array(r).slice(),0,r.byteLength)}function Ry(r,e){return r?1:e}class Mn extends ar{constructor({value:e=[],isIndefiniteForm:t=!1,...n}={}){super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){const i=Q.toUint8Array(e);if(!An(this,i,t,n))return-1;if(this.valueBeforeDecodeView=i.subarray(t,t+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let s=t;for(;Ry(this.isIndefiniteForm,n)>0;){const o=Yi(i,s,n);if(o.offset===-1)return this.error=o.result.error,this.warnings.concat(o.result.warnings),-1;if(s=o.offset,this.blockLength+=o.result.blockLength,n-=o.result.blockLength,this.value.push(o.result),this.isIndefiniteForm&&o.result.constructor.NAME===Os)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===Os?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(e,t){const n=t||new Uo;for(let i=0;i<this.value.length;i++)this.value[i].toBER(e,n);return t?Lr:n.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const t of this.value)e.value.push(t.toJSON());return e}}Mn.NAME="ConstructedValueBlock";var Wf;class gr extends Zt{constructor(e={}){super(e,Mn),this.idBlock.isConstructed=!0}fromBER(e,t,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(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),i)}onAsciiEncoding(){const e=[];for(const n of this.valueBlock.value)e.push(n.toString("ascii").split(`
100
+ */function Po(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function zc(r){let e=0,t=0;for(let i=0;i<r.length;i++){const s=r[i];e+=s.byteLength}const n=new Uint8Array(e);for(let i=0;i<r.length;i++){const s=r[i];n.set(new Uint8Array(s),t),t+=s.byteLength}return n.buffer}function An(r,e,t,n){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-n<0?(r.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(r.error="Wrong parameter: inputBuffer has zero length",!1):(r.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}class Uo{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return zc(this.items)}}const Bs=[new Uint8Array([1])],Mf="0123456789",Kc="name",Vf="valueHexView",Ay="isHexOnly",Sy="idBlock",_y="tagClass",Ey="tagNumber",ky="isConstructed",Iy="fromBER",Cy="toBER",By="local",yr="",Lr=new ArrayBuffer(0),Do=new Uint8Array(0),Os="EndOfContent",Lf="OCTET STRING",Hf="BIT STRING";function tn(r){var e;return e=class extends r{constructor(...n){var i;super(...n);const s=n[0]||{};this.isHexOnly=(i=s.isHexOnly)!==null&&i!==void 0?i:!1,this.valueHexView=s.valueHex?Q.toUint8Array(s.valueHex):Do}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}fromBER(n,i,s){const o=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!An(this,o,i,s))return-1;const c=i+s;return this.valueHexView=o.subarray(i,c),this.valueHexView.length?(this.blockLength=s,c):(this.warnings.push("Zero buffer length"),i)}toBER(n=!1){return this.isHexOnly?n?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",Lr)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:ve.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}class gi{constructor({blockLength:e=0,error:t=yr,warnings:n=[],valueBeforeDecode:i=Do}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=Q.toUint8Array(i)}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:ve.ToHex(this.valueBeforeDecodeView)}}}gi.NAME="baseBlock";class ar extends gi{fromBER(e,t,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}ar.NAME="valueBlock";class Ff extends tn(gi){constructor({idBlock:e={}}={}){var t,n,i,s;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?Q.toUint8Array(e.valueHex):Do,this.tagClass=(n=e.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(i=e.tagNumber)!==null&&i!==void 0?i:-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",Lr}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){const i=new Uint8Array(1);if(!e){let s=this.tagNumber;s&=31,t|=s,i[0]=t}return i.buffer}if(!this.isHexOnly){const i=yi(this.tagNumber,7),s=new Uint8Array(i),o=i.byteLength,c=new Uint8Array(o+1);if(c[0]=t|31,!e){for(let u=0;u<o-1;u++)c[u+1]=s[u]|128;c[o]=s[o-1]}return c.buffer}const n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=t|31,!e){const i=this.valueHexView;for(let s=0;s<i.length-1;s++)n[s+1]=i[s]|128;n[this.valueHexView.byteLength]=i[i.length-1]}return n.buffer}fromBER(e,t,n){const i=Q.toUint8Array(e);if(!An(this,i,t,n))return-1;const s=i.subarray(t,t+n);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 c=s[0]&31;if(c!==31)this.tagNumber=c,this.blockLength=1;else{let u=1,d=this.valueHexView=new Uint8Array(255),b=255;for(;s[u]&128;){if(d[u-1]=s[u]&127,u++,u>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(u===b){b+=255;const q=new Uint8Array(b);for(let $=0;$<d.length;$++)q[$]=d[$];d=this.valueHexView=new Uint8Array(b)}}this.blockLength=u+1,d[u-1]=s[u]&127;const _=new Uint8Array(u);for(let q=0;q<u;q++)_[q]=d[q];d=this.valueHexView=new Uint8Array(u),d.set(_),this.blockLength<=9?this.tagNumber=qi(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}}}Ff.NAME="identificationBlock";class Gf extends gi{constructor({lenBlock:e={}}={}){var t,n,i;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(n=e.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(i=e.length)!==null&&i!==void 0?i:0}fromBER(e,t,n){const i=Q.toUint8Array(e);if(!An(this,i,t,n))return-1;const s=i.subarray(t,t+n);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 o=s[0]&127;if(o>8)return this.error="Too big integer",-1;if(o+1>s.length)return this.error="End of input reached before message was fully decoded",-1;const c=t+1,u=i.subarray(c,c+o);return u[o-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=qi(u,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=o+1,t+this.blockLength}toBER(e=!1){let t,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=128),t;if(this.longFormUsed){const i=yi(this.length,8);if(i.byteLength>127)return this.error="Too big length",Lr;if(t=new ArrayBuffer(i.byteLength+1),e)return t;const s=new Uint8Array(i);n=new Uint8Array(t),n[0]=i.byteLength|128;for(let o=0;o<i.byteLength;o++)n[o+1]=s[o];return t}return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}Gf.NAME="lengthBlock";const pe={};class Zt extends gi{constructor({name:e=yr,optional:t=!1,primitiveSchema:n,...i}={},s){super(i),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new Ff(i),this.lenBlock=new Gf(i),this.valueBlock=s?new s(i):new ar(i)}fromBER(e,t,n){const i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(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),i)}toBER(e,t){const n=t||new Uo;t||zf(this);const i=this.idBlock.toBER(e);if(n.write(i),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{const s=this.valueBlock.toBER(e);this.lenBlock.length=s.byteLength;const o=this.lenBlock.toBER(e);n.write(o),n.write(s)}return t?Lr:n.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():ve.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${ve.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;const t=this.toBER(),n=e.toBER();return xy(t,n)}}Zt.NAME="BaseBlock";function zf(r){if(r instanceof pe.Constructed)for(const e of r.valueBlock.value)zf(e)&&(r.lenBlock.isIndefiniteForm=!0);return!!r.lenBlock.isIndefiniteForm}class Zc extends Zt{constructor({value:e=yr,...t}={},n){super(t,n),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,n){const i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(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),i)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}Zc.NAME="BaseStringBlock";class Kf extends tn(ar){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}}Kf.NAME="PrimitiveValueBlock";var Zf;class Ts extends Zt{constructor(e={}){super(e,Kf),this.idBlock.isConstructed=!1}}Zf=Ts,pe.Primitive=Zf,Ts.NAME="PRIMITIVE";function Oy(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 Yi(r,e=0,t=r.length){const n=e;let i=new Zt({},ar);const s=new gi;if(!An(s,r,e,t))return i.error=s.error,{offset:-1,result:i};if(!r.subarray(e,e+t).length)return i.error="Zero buffer length",{offset:-1,result:i};let c=i.idBlock.fromBER(r,e,t);if(i.idBlock.warnings.length&&i.warnings.concat(i.idBlock.warnings),c===-1)return i.error=i.idBlock.error,{offset:-1,result:i};if(e=c,t-=i.idBlock.blockLength,c=i.lenBlock.fromBER(r,e,t),i.lenBlock.warnings.length&&i.warnings.concat(i.lenBlock.warnings),c===-1)return i.error=i.lenBlock.error,{offset:-1,result:i};if(e=c,t-=i.lenBlock.blockLength,!i.idBlock.isConstructed&&i.lenBlock.isIndefiniteForm)return i.error="Indefinite length form used for primitive encoding form",{offset:-1,result:i};let u=Zt;switch(i.idBlock.tagClass){case 1:if(i.idBlock.tagNumber>=37&&i.idBlock.isHexOnly===!1)return i.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:i};switch(i.idBlock.tagNumber){case 0:if(i.idBlock.isConstructed&&i.lenBlock.length>0)return i.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:i};u=pe.EndOfContent;break;case 1:u=pe.Boolean;break;case 2:u=pe.Integer;break;case 3:u=pe.BitString;break;case 4:u=pe.OctetString;break;case 5:u=pe.Null;break;case 6:u=pe.ObjectIdentifier;break;case 10:u=pe.Enumerated;break;case 12:u=pe.Utf8String;break;case 13:u=pe.RelativeObjectIdentifier;break;case 14:u=pe.TIME;break;case 15:return i.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:i};case 16:u=pe.Sequence;break;case 17:u=pe.Set;break;case 18:u=pe.NumericString;break;case 19:u=pe.PrintableString;break;case 20:u=pe.TeletexString;break;case 21:u=pe.VideotexString;break;case 22:u=pe.IA5String;break;case 23:u=pe.UTCTime;break;case 24:u=pe.GeneralizedTime;break;case 25:u=pe.GraphicString;break;case 26:u=pe.VisibleString;break;case 27:u=pe.GeneralString;break;case 28:u=pe.UniversalString;break;case 29:u=pe.CharacterString;break;case 30:u=pe.BmpString;break;case 31:u=pe.DATE;break;case 32:u=pe.TimeOfDay;break;case 33:u=pe.DateTime;break;case 34:u=pe.Duration;break;default:{const d=i.idBlock.isConstructed?new pe.Constructed:new pe.Primitive;d.idBlock=i.idBlock,d.lenBlock=i.lenBlock,d.warnings=i.warnings,i=d}}break;case 2:case 3:case 4:default:u=i.idBlock.isConstructed?pe.Constructed:pe.Primitive}return i=Oy(i,u),c=i.fromBER(r,e,i.lenBlock.isIndefiniteForm?t:i.lenBlock.length),i.valueBeforeDecodeView=r.subarray(n,n+i.blockLength),{offset:c,result:i}}function Ji(r){if(!r.byteLength){const e=new Zt({},ar);return e.error="Input buffer has zero length",{offset:-1,result:e}}return Yi(Q.toUint8Array(r).slice(),0,r.byteLength)}function Ty(r,e){return r?1:e}class Mn extends ar{constructor({value:e=[],isIndefiniteForm:t=!1,...n}={}){super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){const i=Q.toUint8Array(e);if(!An(this,i,t,n))return-1;if(this.valueBeforeDecodeView=i.subarray(t,t+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let s=t;for(;Ty(this.isIndefiniteForm,n)>0;){const o=Yi(i,s,n);if(o.offset===-1)return this.error=o.result.error,this.warnings.concat(o.result.warnings),-1;if(s=o.offset,this.blockLength+=o.result.blockLength,n-=o.result.blockLength,this.value.push(o.result),this.isIndefiniteForm&&o.result.constructor.NAME===Os)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===Os?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(e,t){const n=t||new Uo;for(let i=0;i<this.value.length;i++)this.value[i].toBER(e,n);return t?Lr:n.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const t of this.value)e.value.push(t.toJSON());return e}}Mn.NAME="ConstructedValueBlock";var Wf;class gr extends Zt{constructor(e={}){super(e,Mn),this.idBlock.isConstructed=!0}fromBER(e,t,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(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),i)}onAsciiEncoding(){const e=[];for(const n of this.valueBlock.value)e.push(n.toString("ascii").split(`
101
101
  `).map(i=>` ${i}`).join(`
102
102
  `));const t=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :
103
103
  ${e.join(`
104
- `)}`:`${t} :`}}Wf=gr,he.Constructed=Wf,gr.NAME="CONSTRUCTED";class qf extends ar{fromBER(e,t,n){return t}toBER(e){return Lr}}qf.override="EndOfContentValueBlock";var Yf;class Wc extends Zt{constructor(e={}){super(e,qf),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}Yf=Wc,he.EndOfContent=Yf,Wc.NAME=Os;var Jf;class vi extends Zt{constructor(e={}){super(e,ar),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,n){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+=n,t+n>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+n}toBER(e,t){const n=new ArrayBuffer(2);if(!e){const i=new Uint8Array(n);i[0]=5,i[1]=0}return t&&t.write(n),n}onAsciiEncoding(){return`${this.constructor.NAME}`}}Jf=vi,he.Null=Jf,vi.NAME="NULL";class Xf extends tn(ar){constructor({value:e,...t}={}){super(t),t.valueHex?this.valueHexView=Q.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,n){const i=Q.toUint8Array(e);return An(this,i,t,n)?(this.valueHexView=i.subarray(t,t+n),n>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,$f.call(this),this.blockLength=n,t+n):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}Xf.NAME="BooleanValueBlock";var Qf;let $o=class extends Zt{constructor(e={}){super(e,Xf),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}`}};Qf=$o,he.Boolean=Qf,$o.NAME="BOOLEAN";class eh extends tn(Mn){constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,n){let i=0;if(this.isConstructed){if(this.isHexOnly=!1,i=Mn.prototype.fromBER.call(this,e,t,n),i===-1)return i;for(let s=0;s<this.value.length;s++){const o=this.value[s].constructor.NAME;if(o===Os){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(o!==Lf)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,i=super.fromBER(e,t,n),this.blockLength=n;return i}toBER(e,t){return this.isConstructed?Mn.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}eh.NAME="OctetStringValueBlock";var th;let mi=class J0 extends Zt{constructor({idBlock:e={},lenBlock:t={},...n}={}){var i,s;(i=n.isConstructed)!==null&&i!==void 0||(n.isConstructed=!!(!((s=n.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:n.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!n.isIndefiniteForm},...n},eh),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,n){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,n===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+n);try{if(s.byteLength){const o=Yi(s,0,s.byteLength);o.offset!==-1&&o.offset===n&&(this.valueBlock.value=[o.result])}}catch{}}return super.fromBER(e,t,n)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?gr.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${ve.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 J0&&e.push(t.valueBlock.valueHexView);return Q.concat(e)}};th=mi,he.OctetString=th,mi.NAME=Lf;class rh extends tn(Mn){constructor({unusedBits:e=0,isConstructed:t=!1,...n}={}){super(n),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,n){if(!n)return t;let i=-1;if(this.isConstructed){if(i=Mn.prototype.fromBER.call(this,e,t,n),i===-1)return i;for(const c of this.value){const u=c.constructor.NAME;if(u===Os){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(u!==Hf)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const d=c.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 i}const s=Q.toUint8Array(e);if(!An(this,s,t,n))return-1;const o=s.subarray(t,t+n);if(this.unusedBits=o[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const c=o.subarray(1);try{if(c.byteLength){const u=Yi(c,0,c.byteLength);u.offset!==-1&&u.offset===n-1&&(this.value=[u.result])}}catch{}}return this.valueHexView=o.subarray(1),this.blockLength=o.length,t+n}toBER(e,t){if(this.isConstructed)return Mn.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return Lr;const n=new Uint8Array(this.valueHexView.length+1);return n[0]=this.unusedBits,n.set(this.valueHexView,1),n.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}rh.NAME="BitStringValueBlock";var nh;let wi=class extends Zt{constructor({idBlock:e={},lenBlock:t={},...n}={}){var i,s;(i=n.isConstructed)!==null&&i!==void 0||(n.isConstructed=!!(!((s=n.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:n.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!n.isIndefiniteForm},...n},rh),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,n){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,n)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return gr.prototype.onAsciiEncoding.call(this);{const e=[],t=this.valueBlock.valueHexView;for(const i of t)e.push(i.toString(2).padStart(8,"0"));const n=e.join("");return`${this.constructor.NAME} : ${n.substring(0,n.length-this.valueBlock.unusedBits)}`}}};nh=wi,he.BitString=nh,wi.NAME=Hf;var ih;function jy(r,e){const t=new Uint8Array([0]),n=new Uint8Array(r),i=new Uint8Array(e);let s=n.slice(0);const o=s.length-1,c=i.slice(0),u=c.length-1;let d=0;const b=u<o?o:u;let S=0;for(let Y=b;Y>=0;Y--,S++){switch(!0){case S<c.length:d=s[o-S]+c[u-S]+t[0];break;default:d=s[o-S]+t[0]}switch(t[0]=d/10,!0){case S>=s.length:s=Gc(new Uint8Array([d%10]),s);break;default:s[o-S]=d%10}}return t[0]>0&&(s=Gc(t,s)),s}function sh(r){if(r>=Bs.length)for(let e=Bs.length;e<=r;e++){const t=new Uint8Array([0]);let n=Bs[e-1].slice(0);for(let i=n.length-1;i>=0;i--){const s=new Uint8Array([(n[i]<<1)+t[0]]);t[0]=s[0]/10,n[i]=s[0]%10}t[0]>0&&(n=Gc(t,n)),Bs.push(n)}return Bs[r]}function Py(r,e){let t=0;const n=new Uint8Array(r),i=new Uint8Array(e),s=n.slice(0),o=s.length-1,c=i.slice(0),u=c.length-1;let d,b=0;for(let S=u;S>=0;S--,b++)switch(d=s[o-b]-c[u-b]-t,!0){case d<0:t=1,s[o-b]=d+10;break;default:t=0,s[o-b]=d}if(t>0)for(let S=o-u+1;S>=0;S--,b++)if(d=s[o-b]-t,d<0)t=1,s[o-b]=d+10;else{t=0,s[o-b]=d;break}return s.slice()}class qc extends tn(ar){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=$f.call(this)))}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(Ay(e))}get valueDec(){return this._valueDec}fromDER(e,t,n,i=0){const s=this.fromBER(e,t,n);if(s===-1)return s;const o=this.valueHexView;return o[0]===0&&o[1]&128?this.valueHexView=o.subarray(1):i!==0&&o.length<i&&(i-o.length>1&&(i=o.length+1),this.valueHexView=o.subarray(i-o.length)),s}toDER(e=!1){const t=this.valueHexView;switch(!0){case(t[0]&128)!==0:{const n=new Uint8Array(this.valueHexView.length+1);n[0]=0,n.set(t,1),this.valueHexView=n}break;case(t[0]===0&&(t[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,t,n){const i=super.fromBER(e,t,n);return i===-1||this.setValueHex(),i}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=this.valueHexView.length*8-1;let t=new Uint8Array(this.valueHexView.length*8/3),n=0,i;const s=this.valueHexView;let o="",c=!1;for(let u=s.byteLength-1;u>=0;u--){i=s[u];for(let d=0;d<8;d++){if((i&1)===1)switch(n){case e:t=Py(sh(n),t),o="-";break;default:t=jy(t,sh(n))}n++,i>>=1}}for(let u=0;u<t.length;u++)t[u]&&(c=!0),c&&(o+=Mf.charAt(t[u]));return c===!1&&(o+=Mf.charAt(0)),o}}ih=qc,qc.NAME="IntegerValueBlock",Object.defineProperty(ih.prototype,"valueHex",{set:function(r){this.valueHexView=new Uint8Array(r),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var oh;class rn extends Zt{constructor(e={}){super(e,qc),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return Po(),BigInt(this.valueBlock.toString())}static fromBigInt(e){Po();const t=BigInt(e),n=new Uo,i=t.toString(16).replace(/^-/,""),s=new Uint8Array(ve.FromHex(i));if(t<0){const c=new Uint8Array(s.length+(s[0]&128?1:0));c[0]|=128;const d=BigInt(`0x${ve.ToHex(c)}`)+t,b=Q.toUint8Array(ve.FromHex(d.toString(16)));b[0]|=128,n.write(b)}else s[0]&128&&n.write(new Uint8Array([0])),n.write(s);return new rn({valueHex:n.final()})}convertToDER(){const e=new rn({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new rn({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}oh=rn,he.Integer=oh,rn.NAME="INTEGER";var ah;class Mo extends rn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}ah=Mo,he.Enumerated=ah,Mo.NAME="ENUMERATED";class Yc extends tn(ar){constructor({valueDec:e=-1,isFirstSid:t=!1,...n}={}){super(n),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,n){if(!n)return t;const i=Q.toUint8Array(e);if(!An(this,i,t,n))return-1;const s=i.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let c=0;c<n&&(this.valueHexView[c]=s[c]&127,this.blockLength++,!!(s[c]&128));c++);const o=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)o[c]=this.valueHexView[c];return this.valueHexView=o,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=qi(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){Po();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;const n=new Uint8Array(t.length/7);for(let i=0;i<n.length;i++)n[i]=parseInt(t.slice(i*7,i*7+7),2)+(i+1<n.length?128:0);this.fromBER(n.buffer,0,n.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const i=this.valueHexView,s=new Uint8Array(this.blockLength);for(let o=0;o<this.blockLength-1;o++)s[o]=i[o]|128;return s[this.blockLength-1]=i[this.blockLength-1],s.buffer}const t=yi(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",Lr;const n=new Uint8Array(t.byteLength);if(!e){const i=new Uint8Array(t),s=t.byteLength-1;for(let o=0;o<s;o++)n[o]=i[o]|128;n[s]=i[s]}return n}toString(){let e="";if(this.isHexOnly)e=ve.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}}}Yc.NAME="sidBlock";class ch extends ar{constructor({value:e=yr,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let i=t;for(;n>0;){const s=new Yc;if(i=s.fromBER(e,i,n),i===-1)return this.blockLength=0,this.error=s.error,i;this.value.length===0&&(s.isFirstSid=!0),this.blockLength+=s.blockLength,n-=s.blockLength,this.value.push(s)}return i}toBER(e){const t=[];for(let n=0;n<this.value.length;n++){const i=this.value[n].toBER(e);if(i.byteLength===0)return this.error=this.value[n].error,Lr;t.push(i)}return zc(t)}fromString(e){this.value=[];let t=0,n=0,i="",s=!1;do if(n=e.indexOf(".",t),n===-1?i=e.substring(t):i=e.substring(t,n),t=n+1,s){const o=this.value[0];let c=0;switch(o.valueDec){case 0:break;case 1:c=40;break;case 2:c=80;break;default:this.value=[];return}const u=parseInt(i,10);if(isNaN(u))return;o.valueDec=u+c,s=!1}else{const o=new Yc;if(i>Number.MAX_SAFE_INTEGER){Po();const c=BigInt(i);o.valueBigInt=c}else if(o.valueDec=parseInt(i,10),isNaN(o.valueDec))return;this.value.length||(o.isFirstSid=!0,s=!0),this.value.push(o)}while(n!==-1)}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let i=this.value[n].toString();n!==0&&(e=`${e}.`),t?(i=`{${i}}`,this.value[n].isFirstSid?e=`2.{${i} - 80}`:e+=i):e+=i}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}}ch.NAME="ObjectIdentifierValueBlock";var lh;class Vo extends Zt{constructor(e={}){super(e,ch),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()}}}lh=Vo,he.ObjectIdentifier=lh,Vo.NAME="OBJECT IDENTIFIER";class Jc extends tn(gi){constructor({valueDec:e=0,...t}={}){super(t),this.valueDec=e}fromBER(e,t,n){if(n===0)return t;const i=Q.toUint8Array(e);if(!An(this,i,t,n))return-1;const s=i.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let c=0;c<n&&(this.valueHexView[c]=s[c]&127,this.blockLength++,!!(s[c]&128));c++);const o=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)o[c]=this.valueHexView[c];return this.valueHexView=o,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=qi(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 i=this.valueHexView,s=new Uint8Array(this.blockLength);for(let o=0;o<this.blockLength-1;o++)s[o]=i[o]|128;return s[this.blockLength-1]=i[this.blockLength-1],s.buffer}const t=yi(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",Lr;const n=new Uint8Array(t.byteLength);if(!e){const i=new Uint8Array(t),s=t.byteLength-1;for(let o=0;o<s;o++)n[o]=i[o]|128;n[s]=i[s]}return n.buffer}toString(){let e="";return this.isHexOnly?e=ve.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}Jc.NAME="relativeSidBlock";class uh extends ar{constructor({value:e=yr,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let i=t;for(;n>0;){const s=new Jc;if(i=s.fromBER(e,i,n),i===-1)return this.blockLength=0,this.error=s.error,i;this.blockLength+=s.blockLength,n-=s.blockLength,this.value.push(s)}return i}toBER(e,t){const n=[];for(let i=0;i<this.value.length;i++){const s=this.value[i].toBER(e);if(s.byteLength===0)return this.error=this.value[i].error,Lr;n.push(s)}return zc(n)}fromString(e){this.value=[];let t=0,n=0,i="";do{n=e.indexOf(".",t),n===-1?i=e.substring(t):i=e.substring(t,n),t=n+1;const s=new Jc;if(s.valueDec=parseInt(i,10),isNaN(s.valueDec))return!0;this.value.push(s)}while(n!==-1);return!0}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let i=this.value[n].toString();n!==0&&(e=`${e}.`),t&&(i=`{${i}}`),e+=i}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}}uh.NAME="RelativeObjectIdentifierValueBlock";var fh;class Xc extends Zt{constructor(e={}){super(e,uh),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()}}}fh=Xc,he.RelativeObjectIdentifier=fh,Xc.NAME="RelativeObjectIdentifier";var hh;class _n extends gr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}hh=_n,he.Sequence=hh,_n.NAME="SEQUENCE";var dh;let Sn=class extends gr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};dh=Sn,he.Set=dh,Sn.NAME="SET";class ph extends tn(ar){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=yr}toJSON(){return{...super.toJSON(),value:this.value}}}ph.NAME="StringValueBlock";class yh extends ph{}yh.NAME="SimpleStringValueBlock";class Sr extends Zc{constructor({...e}={}){super(e,yh)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,Q.toUint8Array(e))}fromString(e){const t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(t);for(let i=0;i<t;i++)n[i]=e.charCodeAt(i);this.valueBlock.value=e}}Sr.NAME="SIMPLE STRING";class gh extends Sr{fromBuffer(e){this.valueBlock.valueHexView=Q.toUint8Array(e);try{this.valueBlock.value=ve.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=ve.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(ve.FromUtf8String(e)),this.valueBlock.value=e}}gh.NAME="Utf8StringValueBlock";var vh;class En extends gh{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}vh=En,he.Utf8String=vh,En.NAME="UTF8String";class mh extends Sr{fromBuffer(e){this.valueBlock.value=ve.ToUtf16String(e),this.valueBlock.valueHexView=Q.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(ve.FromUtf16String(e))}}mh.NAME="BmpStringValueBlock";var wh;class Lo extends mh{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}wh=Lo,he.BmpString=wh,Lo.NAME="BMPString";class bh extends Sr{fromBuffer(e){const t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),n=new Uint8Array(t);for(let i=0;i<n.length;i+=4)n[i]=n[i+3],n[i+1]=n[i+2],n[i+2]=0,n[i+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){const t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(t*4);for(let i=0;i<t;i++){const s=yi(e.charCodeAt(i),8),o=new Uint8Array(s);if(o.length>4)continue;const c=4-o.length;for(let u=o.length-1;u>=0;u--)n[i*4+u+c]=o[u]}this.valueBlock.value=e}}bh.NAME="UniversalStringValueBlock";var xh;class Ho extends bh{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}xh=Ho,he.UniversalString=xh,Ho.NAME="UniversalString";var Ah;class Fo extends Sr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}Ah=Fo,he.NumericString=Ah,Fo.NAME="NumericString";var _h;class Go extends Sr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}_h=Go,he.PrintableString=_h,Go.NAME="PrintableString";var Sh;class zo extends Sr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}Sh=zo,he.TeletexString=Sh,zo.NAME="TeletexString";var Eh;class Ko extends Sr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}Eh=Ko,he.VideotexString=Eh,Ko.NAME="VideotexString";var kh;class Zo extends Sr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}kh=Zo,he.IA5String=kh,Zo.NAME="IA5String";var Ih;class Wo extends Sr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}Ih=Wo,he.GraphicString=Ih,Wo.NAME="GraphicString";var Ch;class Ns extends Sr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}Ch=Ns,he.VisibleString=Ch,Ns.NAME="VisibleString";var Bh;class qo extends Sr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}Bh=qo,he.GeneralString=Bh,qo.NAME="GeneralString";var Oh;class Yo extends Sr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}Oh=Yo,he.CharacterString=Oh,Yo.NAME="CharacterString";var Th;class Rs extends Ns{constructor({value:e,valueDate:t,...n}={}){if(super(n),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 i=0;i<e.length;i++)this.valueBlock.valueHexView[i]=e.charCodeAt(i)}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,Q.toUint8Array(e)))}toBuffer(){const e=this.toString(),t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let i=0;i<e.length;i++)n[i]=e.charCodeAt(i);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 n=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(n===null){this.error="Wrong input string for conversion";return}const i=parseInt(n[1],10);i>=50?this.year=1900+i:this.year=2e3+i,this.month=parseInt(n[2],10),this.day=parseInt(n[3],10),this.hour=parseInt(n[4],10),this.minute=parseInt(n[5],10),this.second=parseInt(n[6],10)}toString(e="iso"){if(e==="iso"){const t=new Array(7);return t[0]=_r(this.year<2e3?this.year-1900:this.year-2e3,2),t[1]=_r(this.month,2),t[2]=_r(this.day,2),t[3]=_r(this.hour,2),t[4]=_r(this.minute,2),t[5]=_r(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}}}Th=Rs,he.UTCTime=Th,Rs.NAME="UTCTime";var Nh;class Jo extends Rs{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,n="",i="",s=0,o,c=0,u=0;if(e[e.length-1]==="Z")n=e.substring(0,e.length-1),t=!0;else{const S=new Number(e[e.length-1]);if(isNaN(S.valueOf()))throw new Error("Wrong input string for conversion");n=e}if(t){if(n.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(n.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let S=1,Y=n.indexOf("+"),$="";if(Y===-1&&(Y=n.indexOf("-"),S=-1),Y!==-1){if($=n.substring(Y+1),n=n.substring(0,Y),$.length!==2&&$.length!==4)throw new Error("Wrong input string for conversion");let w=parseInt($.substring(0,2),10);if(isNaN(w.valueOf()))throw new Error("Wrong input string for conversion");if(c=S*w,$.length===4){if(w=parseInt($.substring(2,4),10),isNaN(w.valueOf()))throw new Error("Wrong input string for conversion");u=S*w}}}let d=n.indexOf(".");if(d===-1&&(d=n.indexOf(",")),d!==-1){const S=new Number(`0${n.substring(d)}`);if(isNaN(S.valueOf()))throw new Error("Wrong input string for conversion");s=S.valueOf(),i=n.substring(0,d)}else i=n;switch(!0){case i.length===8:if(o=/(\d{4})(\d{2})(\d{2})/ig,d!==-1)throw new Error("Wrong input string for conversion");break;case i.length===10:if(o=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let S=60*s;this.minute=Math.floor(S),S=60*(S-this.minute),this.second=Math.floor(S),S=1e3*(S-this.second),this.millisecond=Math.floor(S)}break;case i.length===12:if(o=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let S=60*s;this.second=Math.floor(S),S=1e3*(S-this.second),this.millisecond=Math.floor(S)}break;case i.length===14:if(o=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){const S=1e3*s;this.millisecond=Math.floor(S)}break;default:throw new Error("Wrong input string for conversion")}const b=o.exec(i);if(b===null)throw new Error("Wrong input string for conversion");for(let S=1;S<b.length;S++)switch(S){case 1:this.year=parseInt(b[S],10);break;case 2:this.month=parseInt(b[S],10);break;case 3:this.day=parseInt(b[S],10);break;case 4:this.hour=parseInt(b[S],10)+c;break;case 5:this.minute=parseInt(b[S],10)+u;break;case 6:this.second=parseInt(b[S],10);break;default:throw new Error("Wrong input string for conversion")}if(t===!1){const S=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=S.getUTCFullYear(),this.month=S.getUTCMonth(),this.day=S.getUTCDay(),this.hour=S.getUTCHours(),this.minute=S.getUTCMinutes(),this.second=S.getUTCSeconds(),this.millisecond=S.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){const t=[];return t.push(_r(this.year,4)),t.push(_r(this.month,2)),t.push(_r(this.day,2)),t.push(_r(this.hour,2)),t.push(_r(this.minute,2)),t.push(_r(this.second,2)),this.millisecond!==0&&(t.push("."),t.push(_r(this.millisecond,3))),t.push("Z"),t.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}Nh=Jo,he.GeneralizedTime=Nh,Jo.NAME="GeneralizedTime";var Rh;class Qc extends En{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}Rh=Qc,he.DATE=Rh,Qc.NAME="DATE";var jh;class el extends En{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}jh=el,he.TimeOfDay=jh,el.NAME="TimeOfDay";var Ph;class tl extends En{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}Ph=tl,he.DateTime=Ph,tl.NAME="DateTime";var Uh;class rl extends En{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}Uh=rl,he.Duration=Uh,rl.NAME="Duration";var Dh;class nl extends En{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}Dh=nl,he.TIME=Dh,nl.NAME="TIME";class bi{constructor({name:e=yr,optional:t=!1}={}){this.name=e,this.optional=t}}class il extends bi{constructor({value:e=[],...t}={}){super(t),this.value=e}}class Xo extends bi{constructor({value:e=new bi,local:t=!1,...n}={}){super(n),this.value=e,this.local=t}}class Uy{constructor({data:e=Do}={}){this.dataView=Q.toUint8Array(e)}get data(){return this.dataView.slice().buffer}set data(e){this.dataView=Q.toUint8Array(e)}fromBER(e,t,n){const i=t+n;return this.dataView=Q.toUint8Array(e).subarray(t,i),i}toBER(e){return this.dataView.slice().buffer}}function xi(r,e,t){if(t instanceof il){for(let s=0;s<t.value.length;s++)if(xi(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(Kc)&&(s.name=t.name),s}}if(t instanceof bi)return t.hasOwnProperty(Kc)&&(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(!(Ey in t))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(By in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Oy in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const n=t.idBlock.toBER(!1);if(n.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(t.idBlock.fromBER(n,0,n.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(t.idBlock.hasOwnProperty(ky)===!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(Iy)===!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(Cy)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:r};if(!(Sy 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(!(Vf in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const s=t.idBlock.valueHexView,o=e.idBlock.valueHexView;if(s.length!==o.length)return{verified:!1,result:r};for(let c=0;c<s.length;c++)if(s[c]!==o[1])return{verified:!1,result:r}}if(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,yr),t.name&&(r[t.name]=e)),t instanceof he.Constructed){let s=0,o={verified:!1,result:{error:"Unknown error"}},c=t.valueBlock.value.length;if(c>0&&t.valueBlock.value[0]instanceof Xo&&(c=e.valueBlock.value.length),c===0)return{verified:!0,result:r};if(e.valueBlock.value.length===0&&t.valueBlock.value.length!==0){let u=!0;for(let d=0;d<t.valueBlock.value.length;d++)u=u&&(t.valueBlock.value[d].optional||!1);return u?{verified:!0,result:r}:(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,yr),t.name&&delete r[t.name]),r.error="Inconsistent object length",{verified:!1,result:r})}for(let u=0;u<c;u++)if(u-s>=e.valueBlock.value.length){if(t.valueBlock.value[u].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,yr),t.name&&(delete r[t.name],d.name=t.name)),d}}else if(t.valueBlock.value[0]instanceof Xo){if(o=xi(r,e.valueBlock.value[u],t.valueBlock.value[0].value),o.verified===!1)if(t.valueBlock.value[0].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,yr),t.name&&delete r[t.name]),o;if(Kc in t.valueBlock.value[0]&&t.valueBlock.value[0].name.length>0){let d={};Ty 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[u])}}else if(o=xi(r,e.valueBlock.value[u-s],t.valueBlock.value[u]),o.verified===!1)if(t.valueBlock.value[u].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,yr),t.name&&delete r[t.name]),o;if(o.verified===!1){const u={verified:!1,result:r};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,yr),t.name&&(delete r[t.name],u.name=t.name)),u}return{verified:!0,result:r}}if(t.primitiveSchema&&Vf in e.valueBlock){const s=Yi(e.valueBlock.valueHexView);if(s.offset===-1){const o={verified:!1,result:s.result};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,yr),t.name&&(delete r[t.name],o.name=t.name)),o}return xi(r,s.result,t.primitiveSchema)}return{verified:!0,result:r}}function Dy(r,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const t=Yi(Q.toUint8Array(r));return t.offset===-1?{verified:!1,result:t.result}:xi(t.result,t.result,e)}const $h=Object.freeze(Object.defineProperty({__proto__:null,Any:bi,BaseBlock:Zt,BaseStringBlock:Zc,BitString:wi,BmpString:Lo,Boolean:$o,CharacterString:Yo,Choice:il,Constructed:gr,DATE:Qc,DateTime:tl,Duration:rl,EndOfContent:Wc,Enumerated:Mo,GeneralString:qo,GeneralizedTime:Jo,GraphicString:Wo,HexBlock:tn,IA5String:Zo,Integer:rn,Null:vi,NumericString:Fo,ObjectIdentifier:Vo,OctetString:mi,Primitive:Ts,PrintableString:Go,RawData:Uy,RelativeObjectIdentifier:Xc,Repeated:Xo,Sequence:_n,Set:Sn,TIME:nl,TeletexString:zo,TimeOfDay:el,UTCTime:Rs,UniversalString:Ho,Utf8String:En,ValueBlock:ar,VideotexString:Ko,ViewWriter:Uo,VisibleString:Ns,compareSchema:xi,fromBER:Ji,verifySchema:Dy},Symbol.toStringTag,{value:"Module"}));var V;(function(r){r[r.Sequence=0]="Sequence",r[r.Set=1]="Set",r[r.Choice=2]="Choice"})(V||(V={}));var A;(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"})(A||(A={}));class Qo{constructor(e,t=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(Q.isBufferSource(e))this.unusedBits=t,this.value=Q.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof wi))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 wi({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new wi({name:e})}toNumber(){let e="";const t=new Uint8Array(this.value);for(const n of t)e+=n.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 n=t.length+7>>3;this.unusedBits=(n<<3)-t.length;const i=new Uint8Array(n);t=t.padStart(n<<3,"0").split("").reverse().join("");let s=0;for(;s<n;)i[s]=parseInt(t.slice(s<<3,(s<<3)+8),2),s++;this.value=i.buffer}}class rt{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):Q.isBufferSource(e)?this.buffer=Q.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof mi))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new mi({valueHex:this.buffer})}toSchema(e){return new mi({name:e})}}const $y={fromASN:r=>r instanceof vi?null:r.valueBeforeDecodeView,toASN:r=>{if(r===null)return new vi;const e=Ji(r);if(e.result.error)throw new Error(e.result.error);return e.result}},My={fromASN:r=>r.valueBlock.valueHexView.byteLength>=4?r.valueBlock.toString():r.valueBlock.valueDec,toASN:r=>new rn({value:+r})},Vy={fromASN:r=>r.valueBlock.valueDec,toASN:r=>new Mo({value:r})},_t={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new rn({valueHex:r})},Ly={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new wi({valueHex:r})},Hy={fromASN:r=>r.valueBlock.toString(),toASN:r=>new Vo({value:r})},Fy={fromASN:r=>r.valueBlock.value,toASN:r=>new $o({value:r})},ea={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new mi({valueHex:r})},Gy={fromASN:r=>new rt(r.getValue()),toASN:r=>r.toASN()};function Nr(r){return{fromASN:e=>e.valueBlock.value,toASN:e=>new r({value:e})}}const Mh=Nr(En),zy=Nr(Lo),Ky=Nr(Ho),Zy=Nr(Fo),Wy=Nr(Go),qy=Nr(zo),Yy=Nr(Ko),Jy=Nr(Zo),Xy=Nr(Wo),Qy=Nr(Ns),eg=Nr(qo),tg=Nr(Yo),rg={fromASN:r=>r.toDate(),toASN:r=>new Rs({valueDate:r})},ng={fromASN:r=>r.toDate(),toASN:r=>new Jo({valueDate:r})},ig={fromASN:()=>null,toASN:()=>new vi};function sl(r){switch(r){case A.Any:return $y;case A.BitString:return Ly;case A.BmpString:return zy;case A.Boolean:return Fy;case A.CharacterString:return tg;case A.Enumerated:return Vy;case A.GeneralString:return eg;case A.GeneralizedTime:return ng;case A.GraphicString:return Xy;case A.IA5String:return Jy;case A.Integer:return My;case A.Null:return ig;case A.NumericString:return Zy;case A.ObjectIdentifier:return Hy;case A.OctetString:return ea;case A.PrintableString:return Wy;case A.TeletexString:return qy;case A.UTCTime:return rg;case A.UniversalString:return Ky;case A.Utf8String:return Mh;case A.VideotexString:return Yy;case A.VisibleString:return Qy;default:return null}}function kn(r){return typeof r=="function"&&r.prototype?r.prototype.toASN&&r.prototype.fromASN?!0:kn(r.prototype):!!(r&&typeof r=="object"&&"toASN"in r&&"fromASN"in r)}function Vh(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:Vh(t)}return!1}function sg(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;const t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<r.byteLength;i++)if(t[i]!==n[i])return!1;return!0}class og{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e,t=!1){const n=this.items.get(e);if(!n)throw new Error(`Cannot get schema for '${e.prototype.constructor.name}' target`);if(t&&!n.schema)throw new Error(`Schema '${e.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return n}cache(e){const t=this.get(e);t.schema||(t.schema=this.create(e,!0))}createDefault(e){const t={type:V.Sequence,items:{}},n=this.findParentSchema(e);return n&&(Object.assign(t,n),t.items=Object.assign({},t.items,n.items)),t}create(e,t){const n=this.items.get(e)||this.createDefault(e),i=[];for(const s in n.items){const o=n.items[s],c=t?s:"";let u;if(typeof o.type=="number"){const b=A[o.type],S=$h[b];if(!S)throw new Error(`Cannot get ASN1 class by name '${b}'`);u=new S({name:c})}else kn(o.type)?u=new o.type().toSchema(c):o.optional?this.get(o.type).type===V.Choice?u=new bi({name:c}):(u=this.create(o.type,!1),u.name=c):u=new bi({name:c});const d=!!o.optional||o.defaultValue!==void 0;if(o.repeated){u.name="";const b=o.repeated==="set"?Sn:_n;u=new b({name:"",value:[new Xo({name:c,value:u})]})}if(o.context!==null&&o.context!==void 0)if(o.implicit)if(typeof o.type=="number"||kn(o.type)){const b=o.repeated?gr:Ts;i.push(new b({name:c,optional:d,idBlock:{tagClass:3,tagNumber:o.context}}))}else{this.cache(o.type);const b=!!o.repeated;let S=b?u:this.get(o.type,!0).schema;S="valueBlock"in S?S.valueBlock.value:S.value,i.push(new gr({name:b?"":c,optional:d,idBlock:{tagClass:3,tagNumber:o.context},value:S}))}else i.push(new gr({optional:d,idBlock:{tagClass:3,tagNumber:o.context},value:[u]}));else u.optional=d,i.push(u)}switch(n.type){case V.Sequence:return new _n({value:i,name:""});case V.Set:return new Sn({value:i,name:""});case V.Choice:return new il({value:i,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 Rr=new og,z=r=>e=>{let t;Rr.has(e)?t=Rr.get(e):(t=Rr.createDefault(e),Rr.set(e,t)),Object.assign(t,r)},g=r=>(e,t)=>{let n;Rr.has(e.constructor)?n=Rr.get(e.constructor):(n=Rr.createDefault(e.constructor),Rr.set(e.constructor,n));const i=Object.assign({},r);if(typeof i.type=="number"&&!i.converter){const s=sl(r.type);if(!s)throw new Error(`Cannot get default converter for property '${t}' of ${e.constructor.name}`);i.converter=s}n.items[t]=i};class Lh extends Error{constructor(){super(...arguments),this.schemas=[]}}class ag{static parse(e,t){const n=Ji(e);if(n.result.error)throw new Error(n.result.error);return this.fromASN(n.result,t)}static fromASN(e,t){var n;try{if(kn(t))return new t().fromASN(e);const i=Rr.get(t);Rr.cache(t);let s=i.schema;if(e.constructor===gr&&i.type!==V.Choice){s=new gr({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:i.schema.valueBlock.value});for(const u in i.items)delete e[u]}const o=xi({},e,s);if(!o.verified)throw new Lh(`Data does not match to ${t.name} ASN1 schema. ${o.result.error}`);const c=new t;if(Vh(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 u=i.itemType;if(typeof u=="number"){const d=sl(u);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,u))}for(const u in i.items){const d=o.result[u];if(!d)continue;const b=i.items[u],S=b.type;if(typeof S=="number"||kn(S)){const Y=(n=b.converter)!==null&&n!==void 0?n:kn(S)?new S:null;if(!Y)throw new Error("Converter is empty");if(b.repeated)if(b.implicit){const $=b.repeated==="sequence"?_n:Sn,w=new $;w.valueBlock=d.valueBlock;const E=Ji(w.toBER(!1));if(E.offset===-1)throw new Error(`Cannot parse the child item. ${E.result.error}`);if(!("value"in E.result.valueBlock&&Array.isArray(E.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const B=E.result.valueBlock.value;c[u]=Array.from(B,I=>Y.fromASN(I))}else c[u]=Array.from(d,$=>Y.fromASN($));else{let $=d;if(b.implicit){let w;if(kn(S))w=new S().toSchema("");else{const E=A[S],B=$h[E];if(!B)throw new Error(`Cannot get '${E}' class from asn1js module`);w=new B}w.valueBlock=$.valueBlock,$=Ji(w.toBER(!1)).result}c[u]=Y.fromASN($)}}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.");c[u]=Array.from(d,Y=>this.fromASN(Y,S))}else c[u]=this.fromASN(d,S)}return c}catch(i){throw i instanceof Lh&&i.schemas.push(t.name),i}}}class ol{static serialize(e){return e instanceof Zt?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&kn(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const t=e.constructor,n=Rr.get(t);Rr.cache(t);let i=[];if(n.itemType){if(!Array.isArray(e))throw new TypeError("Parameter 1 should be type of Array.");if(typeof n.itemType=="number"){const o=sl(n.itemType);if(!o)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);i=e.map(c=>o.toASN(c))}else i=e.map(o=>this.toAsnItem({type:n.itemType},"[]",t,o))}else for(const o in n.items){const c=n.items[o],u=e[o];if(u===void 0||c.defaultValue===u||typeof c.defaultValue=="object"&&typeof u=="object"&&sg(this.serialize(c.defaultValue),this.serialize(u)))continue;const d=ol.toAsnItem(c,o,t,u);if(typeof c.context=="number")if(c.implicit)if(!c.repeated&&(typeof c.type=="number"||kn(c.type))){const b={};b.valueHex=d instanceof vi?d.valueBeforeDecodeView:d.valueBlock.toBER(),i.push(new Ts({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},...b}))}else i.push(new gr({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:d.valueBlock.value}));else i.push(new gr({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:[d]}));else c.repeated?i=i.concat(d):i.push(d)}let s;switch(n.type){case V.Sequence:s=new _n({value:i});break;case V.Set:s=new Sn({value:i});break;case V.Choice:if(!i[0])throw new Error(`Schema '${t.name}' has wrong data. Choice cannot be empty.`);s=i[0];break}return s}static toAsnItem(e,t,n,i){let s;if(typeof e.type=="number"){const o=e.converter;if(!o)throw new Error(`Property '${t}' doesn't have converter for type ${A[e.type]} in schema '${n.name}'`);if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const c=Array.from(i,d=>o.toASN(d)),u=e.repeated==="sequence"?_n:Sn;s=new u({value:c})}else s=o.toASN(i)}else if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const o=Array.from(i,u=>this.toASN(u)),c=e.repeated==="sequence"?_n:Sn;s=new c({value:o})}else s=this.toASN(i);return s}}class mt extends Array{constructor(e=[]){if(typeof e=="number")super(e);else{super();for(const t of e)this.push(t)}}}class J{static serialize(e){return ol.serialize(e)}static parse(e,t){return ag.parse(e,t)}static toString(e){const t=Q.isBufferSource(e)?Q.toArrayBuffer(e):J.serialize(e),n=Ji(t);if(n.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${n.result.error}`);return n.result.toString()}}function f(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(o=r[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s}typeof SuppressedError=="function"&&SuppressedError;var Hh={exports:{}};(function(r){(function(e){const t="(0?\\d+|0x[a-f0-9]+)",n={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")},i=new RegExp("^0[0-7]+$","i"),s=new RegExp("^0x[a-f0-9]+$","i"),o="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",u={zoneIndex:new RegExp(o,"i"),native:new RegExp(`^(::)?(${c})?([0-9a-f]+)?(::)?(${o})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${o})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${t}\\.${t}\\.${t}\\.${t}(${o})?$`,"i")};function d(w,E){if(w.indexOf("::")!==w.lastIndexOf("::"))return null;let B=0,I=-1,R=(w.match(u.zoneIndex)||[])[0],P,K;for(R&&(R=R.substring(1),w=w.replace(/%.+$/,""));(I=w.indexOf(":",I+1))>=0;)B++;if(w.substr(0,2)==="::"&&B--,w.substr(-2,2)==="::"&&B--,B>E)return null;for(K=E-B,P=":";K--;)P+="0:";return w=w.replace("::",P),w[0]===":"&&(w=w.slice(1)),w[w.length-1]===":"&&(w=w.slice(0,-1)),E=function(){const de=w.split(":"),le=[];for(let pe=0;pe<de.length;pe++)le.push(parseInt(de[pe],16));return le}(),{parts:E,zoneId:R}}function b(w,E,B,I){if(w.length!==E.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let R=0,P;for(;I>0;){if(P=B-I,P<0&&(P=0),w[R]>>P!==E[R]>>P)return!1;I-=B,R+=1}return!0}function S(w){if(s.test(w))return parseInt(w,16);if(w[0]==="0"&&!isNaN(parseInt(w[1],10))){if(i.test(w))return parseInt(w,8);throw new Error(`ipaddr: cannot parse ${w} as octal`)}return parseInt(w,10)}function Y(w,E){for(;w.length<E;)w=`0${w}`;return w}const $={};$.IPv4=function(){function w(E){if(E.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let B,I;for(B=0;B<E.length;B++)if(I=E[B],!(0<=I&&I<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=E}return w.prototype.SpecialRanges={unspecified:[[new w([0,0,0,0]),8]],broadcast:[[new w([255,255,255,255]),32]],multicast:[[new w([224,0,0,0]),4]],linkLocal:[[new w([169,254,0,0]),16]],loopback:[[new w([127,0,0,0]),8]],carrierGradeNat:[[new w([100,64,0,0]),10]],private:[[new w([10,0,0,0]),8],[new w([172,16,0,0]),12],[new w([192,168,0,0]),16]],reserved:[[new w([192,0,0,0]),24],[new w([192,0,2,0]),24],[new w([192,88,99,0]),24],[new w([198,18,0,0]),15],[new w([198,51,100,0]),24],[new w([203,0,113,0]),24],[new w([240,0,0,0]),4]],as112:[[new w([192,175,48,0]),24],[new w([192,31,196,0]),24]],amt:[[new w([192,52,193,0]),24]]},w.prototype.kind=function(){return"ipv4"},w.prototype.match=function(E,B){let I;if(B===void 0&&(I=E,E=I[0],B=I[1]),E.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return b(this.octets,E.octets,8,B)},w.prototype.prefixLengthFromSubnetMask=function(){let E=0,B=!1;const I={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let R,P,K;for(R=3;R>=0;R-=1)if(P=this.octets[R],P in I){if(K=I[P],B&&K!==0)return null;K!==8&&(B=!0),E+=K}else return null;return 32-E},w.prototype.range=function(){return $.subnetMatch(this,this.SpecialRanges)},w.prototype.toByteArray=function(){return this.octets.slice(0)},w.prototype.toIPv4MappedAddress=function(){return $.IPv6.parse(`::ffff:${this.toString()}`)},w.prototype.toNormalizedString=function(){return this.toString()},w.prototype.toString=function(){return this.octets.join(".")},w}(),$.IPv4.broadcastAddressFromCIDR=function(w){try{const E=this.parseCIDR(w),B=E[0].toByteArray(),I=this.subnetMaskFromPrefixLength(E[1]).toByteArray(),R=[];let P=0;for(;P<4;)R.push(parseInt(B[P],10)|parseInt(I[P],10)^255),P++;return new this(R)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},$.IPv4.isIPv4=function(w){return this.parser(w)!==null},$.IPv4.isValid=function(w){try{return new this(this.parser(w)),!0}catch{return!1}},$.IPv4.isValidCIDR=function(w){try{return this.parseCIDR(w),!0}catch{return!1}},$.IPv4.isValidFourPartDecimal=function(w){return!!($.IPv4.isValid(w)&&w.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},$.IPv4.networkAddressFromCIDR=function(w){let E,B,I,R,P;try{for(E=this.parseCIDR(w),I=E[0].toByteArray(),P=this.subnetMaskFromPrefixLength(E[1]).toByteArray(),R=[],B=0;B<4;)R.push(parseInt(I[B],10)&parseInt(P[B],10)),B++;return new this(R)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},$.IPv4.parse=function(w){const E=this.parser(w);if(E===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(E)},$.IPv4.parseCIDR=function(w){let E;if(E=w.match(/^(.+)\/(\d+)$/)){const B=parseInt(E[2]);if(B>=0&&B<=32){const I=[this.parse(E[1]),B];return Object.defineProperty(I,"toString",{value:function(){return this.join("/")}}),I}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},$.IPv4.parser=function(w){let E,B,I;if(E=w.match(n.fourOctet))return function(){const R=E.slice(1,6),P=[];for(let K=0;K<R.length;K++)B=R[K],P.push(S(B));return P}();if(E=w.match(n.longValue)){if(I=S(E[1]),I>4294967295||I<0)throw new Error("ipaddr: address outside defined range");return function(){const R=[];let P;for(P=0;P<=24;P+=8)R.push(I>>P&255);return R}().reverse()}else return(E=w.match(n.twoOctet))?function(){const R=E.slice(1,4),P=[];if(I=S(R[1]),I>16777215||I<0)throw new Error("ipaddr: address outside defined range");return P.push(S(R[0])),P.push(I>>16&255),P.push(I>>8&255),P.push(I&255),P}():(E=w.match(n.threeOctet))?function(){const R=E.slice(1,5),P=[];if(I=S(R[2]),I>65535||I<0)throw new Error("ipaddr: address outside defined range");return P.push(S(R[0])),P.push(S(R[1])),P.push(I>>8&255),P.push(I&255),P}():null},$.IPv4.subnetMaskFromPrefixLength=function(w){if(w=parseInt(w),w<0||w>32)throw new Error("ipaddr: invalid IPv4 prefix length");const E=[0,0,0,0];let B=0;const I=Math.floor(w/8);for(;B<I;)E[B]=255,B++;return I<4&&(E[I]=Math.pow(2,w%8)-1<<8-w%8),new this(E)},$.IPv6=function(){function w(E,B){let I,R;if(E.length===16)for(this.parts=[],I=0;I<=14;I+=2)this.parts.push(E[I]<<8|E[I+1]);else if(E.length===8)this.parts=E;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(I=0;I<this.parts.length;I++)if(R=this.parts[I],!(0<=R&&R<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");B&&(this.zoneId=B)}return w.prototype.SpecialRanges={unspecified:[new w([0,0,0,0,0,0,0,0]),128],linkLocal:[new w([65152,0,0,0,0,0,0,0]),10],multicast:[new w([65280,0,0,0,0,0,0,0]),8],loopback:[new w([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new w([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new w([0,0,0,0,0,65535,0,0]),96],discard:[new w([256,0,0,0,0,0,0,0]),64],rfc6145:[new w([0,0,0,0,65535,0,0,0]),96],rfc6052:[new w([100,65435,0,0,0,0,0,0]),96],"6to4":[new w([8194,0,0,0,0,0,0,0]),16],teredo:[new w([8193,0,0,0,0,0,0,0]),32],benchmarking:[new w([8193,2,0,0,0,0,0,0]),48],amt:[new w([8193,3,0,0,0,0,0,0]),32],as112v6:[[new w([8193,4,274,0,0,0,0,0]),48],[new w([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new w([8193,16,0,0,0,0,0,0]),28],orchid2:[new w([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new w([8193,48,0,0,0,0,0,0]),28],reserved:[[new w([8193,0,0,0,0,0,0,0]),23],[new w([8193,3512,0,0,0,0,0,0]),32]]},w.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},w.prototype.kind=function(){return"ipv6"},w.prototype.match=function(E,B){let I;if(B===void 0&&(I=E,E=I[0],B=I[1]),E.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return b(this.parts,E.parts,16,B)},w.prototype.prefixLengthFromSubnetMask=function(){let E=0,B=!1;const I={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 R,P;for(let K=7;K>=0;K-=1)if(R=this.parts[K],R in I){if(P=I[R],B&&P!==0)return null;P!==16&&(B=!0),E+=P}else return null;return 128-E},w.prototype.range=function(){return $.subnetMatch(this,this.SpecialRanges)},w.prototype.toByteArray=function(){let E;const B=[],I=this.parts;for(let R=0;R<I.length;R++)E=I[R],B.push(E>>8),B.push(E&255);return B},w.prototype.toFixedLengthString=function(){const E=(function(){const I=[];for(let R=0;R<this.parts.length;R++)I.push(Y(this.parts[R].toString(16),4));return I}).call(this).join(":");let B="";return this.zoneId&&(B=`%${this.zoneId}`),E+B},w.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const E=this.parts.slice(-2),B=E[0],I=E[1];return new $.IPv4([B>>8,B&255,I>>8,I&255])},w.prototype.toNormalizedString=function(){const E=(function(){const I=[];for(let R=0;R<this.parts.length;R++)I.push(this.parts[R].toString(16));return I}).call(this).join(":");let B="";return this.zoneId&&(B=`%${this.zoneId}`),E+B},w.prototype.toRFC5952String=function(){const E=/((^|:)(0(:|$)){2,})/g,B=this.toNormalizedString();let I=0,R=-1,P;for(;P=E.exec(B);)P[0].length>R&&(I=P.index,R=P[0].length);return R<0?B:`${B.substring(0,I)}::${B.substring(I+R)}`},w.prototype.toString=function(){return this.toRFC5952String()},w}(),$.IPv6.broadcastAddressFromCIDR=function(w){try{const E=this.parseCIDR(w),B=E[0].toByteArray(),I=this.subnetMaskFromPrefixLength(E[1]).toByteArray(),R=[];let P=0;for(;P<16;)R.push(parseInt(B[P],10)|parseInt(I[P],10)^255),P++;return new this(R)}catch(E){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${E})`)}},$.IPv6.isIPv6=function(w){return this.parser(w)!==null},$.IPv6.isValid=function(w){if(typeof w=="string"&&w.indexOf(":")===-1)return!1;try{const E=this.parser(w);return new this(E.parts,E.zoneId),!0}catch{return!1}},$.IPv6.isValidCIDR=function(w){if(typeof w=="string"&&w.indexOf(":")===-1)return!1;try{return this.parseCIDR(w),!0}catch{return!1}},$.IPv6.networkAddressFromCIDR=function(w){let E,B,I,R,P;try{for(E=this.parseCIDR(w),I=E[0].toByteArray(),P=this.subnetMaskFromPrefixLength(E[1]).toByteArray(),R=[],B=0;B<16;)R.push(parseInt(I[B],10)&parseInt(P[B],10)),B++;return new this(R)}catch(K){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${K})`)}},$.IPv6.parse=function(w){const E=this.parser(w);if(E.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(E.parts,E.zoneId)},$.IPv6.parseCIDR=function(w){let E,B,I;if((B=w.match(/^(.+)\/(\d+)$/))&&(E=parseInt(B[2]),E>=0&&E<=128))return I=[this.parse(B[1]),E],Object.defineProperty(I,"toString",{value:function(){return this.join("/")}}),I;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},$.IPv6.parser=function(w){let E,B,I,R,P,K;if(I=w.match(u.deprecatedTransitional))return this.parser(`::ffff:${I[1]}`);if(u.native.test(w))return d(w,8);if((I=w.match(u.transitional))&&(K=I[6]||"",E=I[1],I[1].endsWith("::")||(E=E.slice(0,-1)),E=d(E+K,6),E.parts)){for(P=[parseInt(I[2]),parseInt(I[3]),parseInt(I[4]),parseInt(I[5])],B=0;B<P.length;B++)if(R=P[B],!(0<=R&&R<=255))return null;return E.parts.push(P[0]<<8|P[1]),E.parts.push(P[2]<<8|P[3]),{parts:E.parts,zoneId:E.zoneId}}return null},$.IPv6.subnetMaskFromPrefixLength=function(w){if(w=parseInt(w),w<0||w>128)throw new Error("ipaddr: invalid IPv6 prefix length");const E=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let B=0;const I=Math.floor(w/8);for(;B<I;)E[B]=255,B++;return I<16&&(E[I]=Math.pow(2,w%8)-1<<8-w%8),new this(E)},$.fromByteArray=function(w){const E=w.length;if(E===4)return new $.IPv4(w);if(E===16)return new $.IPv6(w);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},$.isValid=function(w){return $.IPv6.isValid(w)||$.IPv4.isValid(w)},$.isValidCIDR=function(w){return $.IPv6.isValidCIDR(w)||$.IPv4.isValidCIDR(w)},$.parse=function(w){if($.IPv6.isValid(w))return $.IPv6.parse(w);if($.IPv4.isValid(w))return $.IPv4.parse(w);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},$.parseCIDR=function(w){try{return $.IPv6.parseCIDR(w)}catch{try{return $.IPv4.parseCIDR(w)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},$.process=function(w){const E=this.parse(w);return E.kind()==="ipv6"&&E.isIPv4MappedAddress()?E.toIPv4Address():E},$.subnetMatch=function(w,E,B){let I,R,P,K;B==null&&(B="unicast");for(R in E)if(Object.prototype.hasOwnProperty.call(E,R)){for(P=E[R],P[0]&&!(P[0]instanceof Array)&&(P=[P]),I=0;I<P.length;I++)if(K=P[I],w.kind()===K[0].kind()&&w.match.apply(w,K))return R}return B},r.exports?r.exports=$:e.ipaddr=$})(Ot)})(Hh);var Fh=Hh.exports;class Gh{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((i,s)=>i+ +s,0);let n=e.slice(0,8).replace(/(.{2})/g,i=>`${parseInt(i,16)}.`);return n=n.slice(0,-1),`${n}/${t}`}static toString(e){if(e.byteLength===4||e.byteLength===16){const t=new Uint8Array(e);return Fh.fromByteArray(Array.from(t)).toString()}return this.decodeIP(ve.ToHex(e))}static fromString(e){const t=Fh.parse(e);return new Uint8Array(t.toByteArray()).buffer}}var al,cl,ll;let Wt=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};f([g({type:A.TeletexString})],Wt.prototype,"teletexString",void 0),f([g({type:A.PrintableString})],Wt.prototype,"printableString",void 0),f([g({type:A.UniversalString})],Wt.prototype,"universalString",void 0),f([g({type:A.Utf8String})],Wt.prototype,"utf8String",void 0),f([g({type:A.BmpString})],Wt.prototype,"bmpString",void 0),Wt=f([z({type:V.Choice})],Wt);let Xi=class extends Wt{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?ve.ToHex(this.anyValue):super.toString())}};f([g({type:A.IA5String})],Xi.prototype,"ia5String",void 0),f([g({type:A.Any})],Xi.prototype,"anyValue",void 0),Xi=f([z({type:V.Choice})],Xi);class ta{constructor(e={}){this.type="",this.value=new Xi,Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],ta.prototype,"type",void 0),f([g({type:Xi})],ta.prototype,"value",void 0);let Qi=al=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,al.prototype)}};Qi=al=f([z({type:V.Set,itemType:ta})],Qi);let ul=cl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,cl.prototype)}};ul=cl=f([z({type:V.Sequence,itemType:Qi})],ul);let Ft=ll=class extends ul{constructor(e){super(e),Object.setPrototypeOf(this,ll.prototype)}};Ft=ll=f([z({type:V.Sequence})],Ft);const cg={fromASN:r=>Gh.toString(ea.fromASN(r)),toASN:r=>ea.toASN(Gh.fromString(r))};class js{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],js.prototype,"typeId",void 0),f([g({type:A.Any,context:0})],js.prototype,"value",void 0);class fl{constructor(e={}){this.partyName=new Wt,Object.assign(this,e)}}f([g({type:Wt,optional:!0,context:0,implicit:!0})],fl.prototype,"nameAssigner",void 0),f([g({type:Wt,context:1,implicit:!0})],fl.prototype,"partyName",void 0);let De=class{constructor(e={}){Object.assign(this,e)}};f([g({type:js,context:0,implicit:!0})],De.prototype,"otherName",void 0),f([g({type:A.IA5String,context:1,implicit:!0})],De.prototype,"rfc822Name",void 0),f([g({type:A.IA5String,context:2,implicit:!0})],De.prototype,"dNSName",void 0),f([g({type:A.Any,context:3,implicit:!0})],De.prototype,"x400Address",void 0),f([g({type:Ft,context:4,implicit:!1})],De.prototype,"directoryName",void 0),f([g({type:fl,context:5})],De.prototype,"ediPartyName",void 0),f([g({type:A.IA5String,context:6,implicit:!0})],De.prototype,"uniformResourceIdentifier",void 0),f([g({type:A.OctetString,context:7,implicit:!0,converter:cg})],De.prototype,"iPAddress",void 0),f([g({type:A.ObjectIdentifier,context:8,implicit:!0})],De.prototype,"registeredID",void 0),De=f([z({type:V.Choice})],De);const hl="1.3.6.1.5.5.7",lg=`${hl}.1`,es=`${hl}.3`,ra=`${hl}.48`,zh=`${ra}.1`,Kh=`${ra}.2`,Zh=`${ra}.3`,Wh=`${ra}.5`,Vn="2.5.29";var dl;const pl=`${lg}.1`;class Ps{constructor(e={}){this.accessMethod="",this.accessLocation=new De,Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],Ps.prototype,"accessMethod",void 0),f([g({type:De})],Ps.prototype,"accessLocation",void 0);let ts=dl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,dl.prototype)}};ts=dl=f([z({type:V.Sequence,itemType:Ps})],ts);const na=`${Vn}.35`;class yl extends rt{}class Ai{constructor(e={}){e&&Object.assign(this,e)}}f([g({type:yl,context:0,optional:!0,implicit:!0})],Ai.prototype,"keyIdentifier",void 0),f([g({type:De,context:1,optional:!0,implicit:!0,repeated:"sequence"})],Ai.prototype,"authorityCertIssuer",void 0),f([g({type:A.Integer,context:2,optional:!0,implicit:!0,converter:_t})],Ai.prototype,"authorityCertSerialNumber",void 0);const qh=`${Vn}.19`;class ia{constructor(e={}){this.cA=!1,Object.assign(this,e)}}f([g({type:A.Boolean,defaultValue:!1})],ia.prototype,"cA",void 0),f([g({type:A.Integer,optional:!0})],ia.prototype,"pathLenConstraint",void 0);var gl;let cr=gl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,gl.prototype)}};cr=gl=f([z({type:V.Sequence,itemType:De})],cr);var vl;let Yh=vl=class extends cr{constructor(e){super(e),Object.setPrototypeOf(this,vl.prototype)}};Yh=vl=f([z({type:V.Sequence})],Yh);var ml;const Jh=`${Vn}.32`;let In=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};f([g({type:A.IA5String})],In.prototype,"ia5String",void 0),f([g({type:A.VisibleString})],In.prototype,"visibleString",void 0),f([g({type:A.BmpString})],In.prototype,"bmpString",void 0),f([g({type:A.Utf8String})],In.prototype,"utf8String",void 0),In=f([z({type:V.Choice})],In);class wl{constructor(e={}){this.organization=new In,this.noticeNumbers=[],Object.assign(this,e)}}f([g({type:In})],wl.prototype,"organization",void 0),f([g({type:A.Integer,repeated:"sequence"})],wl.prototype,"noticeNumbers",void 0);class bl{constructor(e={}){Object.assign(this,e)}}f([g({type:wl,optional:!0})],bl.prototype,"noticeRef",void 0),f([g({type:In,optional:!0})],bl.prototype,"explicitText",void 0);let sa=class{constructor(e={}){Object.assign(this,e)}};f([g({type:A.IA5String})],sa.prototype,"cPSuri",void 0),f([g({type:bl})],sa.prototype,"userNotice",void 0),sa=f([z({type:V.Choice})],sa);class xl{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],xl.prototype,"policyQualifierId",void 0),f([g({type:A.Any})],xl.prototype,"qualifier",void 0);class oa{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],oa.prototype,"policyIdentifier",void 0),f([g({type:xl,repeated:"sequence",optional:!0})],oa.prototype,"policyQualifiers",void 0);let aa=ml=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,ml.prototype)}};aa=ml=f([z({type:V.Sequence,itemType:oa})],aa);let ca=class{constructor(e=0){this.value=e}};f([g({type:A.Integer})],ca.prototype,"value",void 0),ca=f([z({type:V.Choice})],ca);let Xh=class extends ca{};Xh=f([z({type:V.Choice})],Xh);var Al;const _l=`${Vn}.31`;var Hr;(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"})(Hr||(Hr={}));class Qh extends Qo{toJSON(){const e=[],t=this.toNumber();return t&Hr.aACompromise&&e.push("aACompromise"),t&Hr.affiliationChanged&&e.push("affiliationChanged"),t&Hr.cACompromise&&e.push("cACompromise"),t&Hr.certificateHold&&e.push("certificateHold"),t&Hr.cessationOfOperation&&e.push("cessationOfOperation"),t&Hr.keyCompromise&&e.push("keyCompromise"),t&Hr.privilegeWithdrawn&&e.push("privilegeWithdrawn"),t&Hr.superseded&&e.push("superseded"),t&Hr.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let _i=class{constructor(e={}){Object.assign(this,e)}};f([g({type:De,context:0,repeated:"sequence",implicit:!0})],_i.prototype,"fullName",void 0),f([g({type:Qi,context:1,implicit:!0})],_i.prototype,"nameRelativeToCRLIssuer",void 0),_i=f([z({type:V.Choice})],_i);class rs{constructor(e={}){Object.assign(this,e)}}f([g({type:_i,context:0,optional:!0})],rs.prototype,"distributionPoint",void 0),f([g({type:Qh,context:1,optional:!0,implicit:!0})],rs.prototype,"reasons",void 0),f([g({type:De,context:2,optional:!0,repeated:"sequence",implicit:!0})],rs.prototype,"cRLIssuer",void 0);let ns=Al=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Al.prototype)}};ns=Al=f([z({type:V.Sequence,itemType:rs})],ns);var Sl;let ed=Sl=class extends ns{constructor(e){super(e),Object.setPrototypeOf(this,Sl.prototype)}};ed=Sl=f([z({type:V.Sequence,itemType:rs})],ed);class er{constructor(e={}){this.onlyContainsUserCerts=er.ONLY,this.onlyContainsCACerts=er.ONLY,this.indirectCRL=er.ONLY,this.onlyContainsAttributeCerts=er.ONLY,Object.assign(this,e)}}er.ONLY=!1,f([g({type:_i,context:0,optional:!0})],er.prototype,"distributionPoint",void 0),f([g({type:A.Boolean,context:1,defaultValue:er.ONLY,implicit:!0})],er.prototype,"onlyContainsUserCerts",void 0),f([g({type:A.Boolean,context:2,defaultValue:er.ONLY,implicit:!0})],er.prototype,"onlyContainsCACerts",void 0),f([g({type:Qh,context:3,optional:!0,implicit:!0})],er.prototype,"onlySomeReasons",void 0),f([g({type:A.Boolean,context:4,defaultValue:er.ONLY,implicit:!0})],er.prototype,"indirectCRL",void 0),f([g({type:A.Boolean,context:5,defaultValue:er.ONLY,implicit:!0})],er.prototype,"onlyContainsAttributeCerts",void 0);var Us;(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"})(Us||(Us={}));let El=class{constructor(e=Us.unspecified){this.reason=Us.unspecified,this.reason=e}toJSON(){return Us[this.reason]}toString(){return this.toJSON()}};f([g({type:A.Enumerated})],El.prototype,"reason",void 0),El=f([z({type:V.Choice})],El);var kl;const td=`${Vn}.37`;let la=kl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,kl.prototype)}};la=kl=f([z({type:V.Sequence,itemType:A.ObjectIdentifier})],la);const ug=`${es}.1`,fg=`${es}.2`,hg=`${es}.3`,dg=`${es}.4`,pg=`${es}.8`,yg=`${es}.9`;let Il=class{constructor(e=new ArrayBuffer(0)){this.value=e}};f([g({type:A.Integer,converter:_t})],Il.prototype,"value",void 0),Il=f([z({type:V.Choice})],Il);let Cl=class{constructor(e){this.value=new Date,e&&(this.value=e)}};f([g({type:A.GeneralizedTime})],Cl.prototype,"value",void 0),Cl=f([z({type:V.Choice})],Cl);var Bl;let rd=Bl=class extends cr{constructor(e){super(e),Object.setPrototypeOf(this,Bl.prototype)}};rd=Bl=f([z({type:V.Sequence})],rd);const nd=`${Vn}.15`;var Fr;(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"})(Fr||(Fr={}));class Ol extends Qo{toJSON(){const e=this.toNumber(),t=[];return e&Fr.cRLSign&&t.push("crlSign"),e&Fr.dataEncipherment&&t.push("dataEncipherment"),e&Fr.decipherOnly&&t.push("decipherOnly"),e&Fr.digitalSignature&&t.push("digitalSignature"),e&Fr.encipherOnly&&t.push("encipherOnly"),e&Fr.keyAgreement&&t.push("keyAgreement"),e&Fr.keyCertSign&&t.push("keyCertSign"),e&Fr.keyEncipherment&&t.push("keyEncipherment"),e&Fr.nonRepudiation&&t.push("nonRepudiation"),t}toString(){return`[${this.toJSON().join(", ")}]`}}var Tl;class ua{constructor(e={}){this.base=new De,this.minimum=0,Object.assign(this,e)}}f([g({type:De})],ua.prototype,"base",void 0),f([g({type:A.Integer,context:0,defaultValue:0,implicit:!0})],ua.prototype,"minimum",void 0),f([g({type:A.Integer,context:1,optional:!0,implicit:!0})],ua.prototype,"maximum",void 0);let fa=Tl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Tl.prototype)}};fa=Tl=f([z({type:V.Sequence,itemType:ua})],fa);class id{constructor(e={}){Object.assign(this,e)}}f([g({type:fa,context:0,optional:!0,implicit:!0})],id.prototype,"permittedSubtrees",void 0),f([g({type:fa,context:1,optional:!0,implicit:!0})],id.prototype,"excludedSubtrees",void 0);class sd{constructor(e={}){Object.assign(this,e)}}f([g({type:A.Integer,context:0,implicit:!0,optional:!0,converter:_t})],sd.prototype,"requireExplicitPolicy",void 0),f([g({type:A.Integer,context:1,implicit:!0,optional:!0,converter:_t})],sd.prototype,"inhibitPolicyMapping",void 0);var Nl;class Rl{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],Rl.prototype,"issuerDomainPolicy",void 0),f([g({type:A.ObjectIdentifier})],Rl.prototype,"subjectDomainPolicy",void 0);let od=Nl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Nl.prototype)}};od=Nl=f([z({type:V.Sequence,itemType:Rl})],od);var jl;const Pl=`${Vn}.17`;let Ul=jl=class extends cr{constructor(e){super(e),Object.setPrototypeOf(this,jl.prototype)}};Ul=jl=f([z({type:V.Sequence})],Ul);let Cn=class{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};f([g({type:A.ObjectIdentifier})],Cn.prototype,"type",void 0),f([g({type:A.Any,repeated:"set"})],Cn.prototype,"values",void 0);var Dl;let ad=Dl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Dl.prototype)}};ad=Dl=f([z({type:V.Sequence,itemType:Cn})],ad);const $l=`${Vn}.14`;class Ln extends yl{}class cd{constructor(e={}){Object.assign(this,e)}}f([g({type:A.GeneralizedTime,context:0,implicit:!0,optional:!0})],cd.prototype,"notBefore",void 0),f([g({type:A.GeneralizedTime,context:1,implicit:!0,optional:!0})],cd.prototype,"notAfter",void 0);var Ds;(function(r){r[r.keyUpdateAllowed=1]="keyUpdateAllowed",r[r.newExtensions=2]="newExtensions",r[r.pKIXCertificate=4]="pKIXCertificate"})(Ds||(Ds={}));class ld extends Qo{toJSON(){const e=[],t=this.toNumber();return t&Ds.pKIXCertificate&&e.push("pKIXCertificate"),t&Ds.newExtensions&&e.push("newExtensions"),t&Ds.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class ud{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new ld,Object.assign(this,e)}}f([g({type:A.GeneralString})],ud.prototype,"entrustVers",void 0),f([g({type:ld})],ud.prototype,"entrustInfoFlags",void 0);var Ml;let fd=Ml=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Ml.prototype)}};fd=Ml=f([z({type:V.Sequence,itemType:Ps})],fd);class ae{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof ae&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&jo(e.parameters,this.parameters)||e.parameters===this.parameters)}}f([g({type:A.ObjectIdentifier})],ae.prototype,"algorithm",void 0),f([g({type:A.Any,optional:!0})],ae.prototype,"parameters",void 0);class nn{constructor(e={}){this.algorithm=new ae,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:ae})],nn.prototype,"algorithm",void 0),f([g({type:A.BitString})],nn.prototype,"subjectPublicKey",void 0);let qt=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}};f([g({type:A.UTCTime})],qt.prototype,"utcTime",void 0),f([g({type:A.GeneralizedTime})],qt.prototype,"generalTime",void 0),qt=f([z({type:V.Choice})],qt);class ha{constructor(e){this.notBefore=new qt(new Date),this.notAfter=new qt(new Date),e&&(this.notBefore=new qt(e.notBefore),this.notAfter=new qt(e.notAfter))}}f([g({type:qt})],ha.prototype,"notBefore",void 0),f([g({type:qt})],ha.prototype,"notAfter",void 0);var Vl;let Gr=class X0{constructor(e={}){this.extnID="",this.critical=X0.CRITICAL,this.extnValue=new rt,Object.assign(this,e)}};Gr.CRITICAL=!1,f([g({type:A.ObjectIdentifier})],Gr.prototype,"extnID",void 0),f([g({type:A.Boolean,defaultValue:Gr.CRITICAL})],Gr.prototype,"critical",void 0),f([g({type:rt})],Gr.prototype,"extnValue",void 0);let Si=Vl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Vl.prototype)}};Si=Vl=f([z({type:V.Sequence,itemType:Gr})],Si);var is;(function(r){r[r.v1=0]="v1",r[r.v2=1]="v2",r[r.v3=2]="v3"})(is||(is={}));class jr{constructor(e={}){this.version=is.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new ae,this.issuer=new Ft,this.validity=new ha,this.subject=new Ft,this.subjectPublicKeyInfo=new nn,Object.assign(this,e)}}f([g({type:A.Integer,context:0,defaultValue:is.v1})],jr.prototype,"version",void 0),f([g({type:A.Integer,converter:_t})],jr.prototype,"serialNumber",void 0),f([g({type:ae})],jr.prototype,"signature",void 0),f([g({type:Ft})],jr.prototype,"issuer",void 0),f([g({type:ha})],jr.prototype,"validity",void 0),f([g({type:Ft})],jr.prototype,"subject",void 0),f([g({type:nn})],jr.prototype,"subjectPublicKeyInfo",void 0),f([g({type:A.BitString,context:1,implicit:!0,optional:!0})],jr.prototype,"issuerUniqueID",void 0),f([g({type:A.BitString,context:2,implicit:!0,optional:!0})],jr.prototype,"subjectUniqueID",void 0),f([g({type:Si,context:3,optional:!0})],jr.prototype,"extensions",void 0);class Ei{constructor(e={}){this.tbsCertificate=new jr,this.signatureAlgorithm=new ae,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:jr})],Ei.prototype,"tbsCertificate",void 0),f([g({type:ae})],Ei.prototype,"signatureAlgorithm",void 0),f([g({type:A.BitString})],Ei.prototype,"signatureValue",void 0);class da{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new qt,Object.assign(this,e)}}f([g({type:A.Integer,converter:_t})],da.prototype,"userCertificate",void 0),f([g({type:qt})],da.prototype,"revocationDate",void 0),f([g({type:Gr,optional:!0,repeated:"sequence"})],da.prototype,"crlEntryExtensions",void 0);class Bn{constructor(e={}){this.signature=new ae,this.issuer=new Ft,this.thisUpdate=new qt,Object.assign(this,e)}}f([g({type:A.Integer,optional:!0})],Bn.prototype,"version",void 0),f([g({type:ae})],Bn.prototype,"signature",void 0),f([g({type:Ft})],Bn.prototype,"issuer",void 0),f([g({type:qt})],Bn.prototype,"thisUpdate",void 0),f([g({type:qt,optional:!0})],Bn.prototype,"nextUpdate",void 0),f([g({type:da,repeated:"sequence",optional:!0})],Bn.prototype,"revokedCertificates",void 0),f([g({type:Gr,optional:!0,context:0,repeated:"sequence"})],Bn.prototype,"crlExtensions",void 0);class Ll{constructor(e={}){this.tbsCertList=new Bn,this.signatureAlgorithm=new ae,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:Bn})],Ll.prototype,"tbsCertList",void 0),f([g({type:ae})],Ll.prototype,"signatureAlgorithm",void 0),f([g({type:A.BitString})],Ll.prototype,"signature",void 0);class ss{constructor(e={}){this.issuer=new Ft,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:Ft})],ss.prototype,"issuer",void 0),f([g({type:A.Integer,converter:_t})],ss.prototype,"serialNumber",void 0);let os=class{constructor(e={}){Object.assign(this,e)}};f([g({type:Ln,context:0,implicit:!0})],os.prototype,"subjectKeyIdentifier",void 0),f([g({type:ss})],os.prototype,"issuerAndSerialNumber",void 0),os=f([z({type:V.Choice})],os);var sn;(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"})(sn||(sn={}));let $s=class extends ae{};$s=f([z({type:V.Sequence})],$s);let pa=class extends ae{};pa=f([z({type:V.Sequence})],pa);let on=class extends ae{};on=f([z({type:V.Sequence})],on);let ya=class extends ae{};ya=f([z({type:V.Sequence})],ya);let hd=class extends ae{};hd=f([z({type:V.Sequence})],hd);let Hl=class extends ae{};Hl=f([z({type:V.Sequence})],Hl);let as=class{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};f([g({type:A.ObjectIdentifier})],as.prototype,"attrType",void 0),f([g({type:A.Any,repeated:"set"})],as.prototype,"attrValues",void 0);var Fl;class an{constructor(e={}){this.version=sn.v0,this.sid=new os,this.digestAlgorithm=new $s,this.signatureAlgorithm=new pa,this.signature=new rt,Object.assign(this,e)}}f([g({type:A.Integer})],an.prototype,"version",void 0),f([g({type:os})],an.prototype,"sid",void 0),f([g({type:$s})],an.prototype,"digestAlgorithm",void 0),f([g({type:as,repeated:"set",context:0,implicit:!0,optional:!0})],an.prototype,"signedAttrs",void 0),f([g({type:pa})],an.prototype,"signatureAlgorithm",void 0),f([g({type:rt})],an.prototype,"signature",void 0),f([g({type:as,repeated:"set",context:1,implicit:!0,optional:!0})],an.prototype,"unsignedAttrs",void 0);let ga=Fl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Fl.prototype)}};ga=Fl=f([z({type:V.Set,itemType:an})],ga);let dd=class extends qt{};dd=f([z({type:V.Choice})],dd);let pd=class extends an{};pd=f([z({type:V.Sequence})],pd);class Gl{constructor(e={}){this.acIssuer=new De,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}f([g({type:De})],Gl.prototype,"acIssuer",void 0),f([g({type:A.Integer})],Gl.prototype,"acSerial",void 0),f([g({type:Cn,repeated:"sequence"})],Gl.prototype,"attrs",void 0);var zl;let va=zl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,zl.prototype)}};va=zl=f([z({type:V.Sequence,itemType:A.ObjectIdentifier})],va);class ma{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}f([g({type:A.Integer,optional:!0})],ma.prototype,"pathLenConstraint",void 0),f([g({type:va,implicit:!0,context:0,optional:!0})],ma.prototype,"permittedAttrs",void 0),f([g({type:va,implicit:!0,context:1,optional:!0})],ma.prototype,"excludedAttrs",void 0),f([g({type:A.Boolean,defaultValue:!0})],ma.prototype,"permitUnSpecified",void 0);class ki{constructor(e={}){this.issuer=new cr,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:cr})],ki.prototype,"issuer",void 0),f([g({type:A.Integer,converter:_t})],ki.prototype,"serial",void 0),f([g({type:A.BitString,optional:!0})],ki.prototype,"issuerUID",void 0);var Kl;(function(r){r[r.publicKey=0]="publicKey",r[r.publicKeyCert=1]="publicKeyCert",r[r.otherObjectTypes=2]="otherObjectTypes"})(Kl||(Kl={}));class Ii{constructor(e={}){this.digestedObjectType=Kl.publicKey,this.digestAlgorithm=new ae,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.Enumerated})],Ii.prototype,"digestedObjectType",void 0),f([g({type:A.ObjectIdentifier,optional:!0})],Ii.prototype,"otherObjectTypeID",void 0),f([g({type:ae})],Ii.prototype,"digestAlgorithm",void 0),f([g({type:A.BitString})],Ii.prototype,"objectDigest",void 0);class wa{constructor(e={}){Object.assign(this,e)}}f([g({type:cr,optional:!0})],wa.prototype,"issuerName",void 0),f([g({type:ki,context:0,implicit:!0,optional:!0})],wa.prototype,"baseCertificateID",void 0),f([g({type:Ii,context:1,implicit:!0,optional:!0})],wa.prototype,"objectDigestInfo",void 0);let cs=class{constructor(e={}){Object.assign(this,e)}};f([g({type:De,repeated:"sequence"})],cs.prototype,"v1Form",void 0),f([g({type:wa,context:0,implicit:!0})],cs.prototype,"v2Form",void 0),cs=f([z({type:V.Choice})],cs);class ba{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}f([g({type:A.GeneralizedTime})],ba.prototype,"notBeforeTime",void 0),f([g({type:A.GeneralizedTime})],ba.prototype,"notAfterTime",void 0);class Ms{constructor(e={}){Object.assign(this,e)}}f([g({type:ki,implicit:!0,context:0,optional:!0})],Ms.prototype,"baseCertificateID",void 0),f([g({type:cr,implicit:!0,context:1,optional:!0})],Ms.prototype,"entityName",void 0),f([g({type:Ii,implicit:!0,context:2,optional:!0})],Ms.prototype,"objectDigestInfo",void 0);var Zl;(function(r){r[r.v2=1]="v2"})(Zl||(Zl={}));class zr{constructor(e={}){this.version=Zl.v2,this.holder=new Ms,this.issuer=new cs,this.signature=new ae,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new ba,this.attributes=[],Object.assign(this,e)}}f([g({type:A.Integer})],zr.prototype,"version",void 0),f([g({type:Ms})],zr.prototype,"holder",void 0),f([g({type:cs})],zr.prototype,"issuer",void 0),f([g({type:ae})],zr.prototype,"signature",void 0),f([g({type:A.Integer,converter:_t})],zr.prototype,"serialNumber",void 0),f([g({type:ba})],zr.prototype,"attrCertValidityPeriod",void 0),f([g({type:Cn,repeated:"sequence"})],zr.prototype,"attributes",void 0),f([g({type:A.BitString,optional:!0})],zr.prototype,"issuerUniqueID",void 0),f([g({type:Si,optional:!0})],zr.prototype,"extensions",void 0);class xa{constructor(e={}){this.acinfo=new zr,this.signatureAlgorithm=new ae,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:zr})],xa.prototype,"acinfo",void 0),f([g({type:ae})],xa.prototype,"signatureAlgorithm",void 0),f([g({type:A.BitString})],xa.prototype,"signatureValue",void 0);var Aa;(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"})(Aa||(Aa={}));class Wl extends Qo{}class ql{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier,implicit:!0,context:0})],ql.prototype,"type",void 0),f([g({type:A.Any,implicit:!0,context:1})],ql.prototype,"value",void 0);class Yl{constructor(e={}){this.policyId="",this.classList=new Wl(Aa.unclassified),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],Yl.prototype,"policyId",void 0),f([g({type:Wl,defaultValue:new Wl(Aa.unclassified)})],Yl.prototype,"classList",void 0),f([g({type:ql,repeated:"set"})],Yl.prototype,"securityCategories",void 0);class _a{constructor(e={}){Object.assign(this,e)}}f([g({type:rt})],_a.prototype,"cotets",void 0),f([g({type:A.ObjectIdentifier})],_a.prototype,"oid",void 0),f([g({type:A.Utf8String})],_a.prototype,"string",void 0);class yd{constructor(e={}){this.values=[],Object.assign(this,e)}}f([g({type:cr,implicit:!0,context:0,optional:!0})],yd.prototype,"policyAuthority",void 0),f([g({type:_a,repeated:"sequence"})],yd.prototype,"values",void 0);var Jl;class Sa{constructor(e={}){this.targetCertificate=new ki,Object.assign(this,e)}}f([g({type:ki})],Sa.prototype,"targetCertificate",void 0),f([g({type:De,optional:!0})],Sa.prototype,"targetName",void 0),f([g({type:Ii,optional:!0})],Sa.prototype,"certDigestInfo",void 0);let ls=class{constructor(e={}){Object.assign(this,e)}};f([g({type:De,context:0,implicit:!0})],ls.prototype,"targetName",void 0),f([g({type:De,context:1,implicit:!0})],ls.prototype,"targetGroup",void 0),f([g({type:Sa,context:2,implicit:!0})],ls.prototype,"targetCert",void 0),ls=f([z({type:V.Choice})],ls);let Xl=Jl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Jl.prototype)}};Xl=Jl=f([z({type:V.Sequence,itemType:ls})],Xl);var Ql;let gd=Ql=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Ql.prototype)}};gd=Ql=f([z({type:V.Sequence,itemType:Xl})],gd);class vd{constructor(e={}){Object.assign(this,e)}}f([g({type:cr,implicit:!0,context:0,optional:!0})],vd.prototype,"roleAuthority",void 0),f([g({type:De,implicit:!0,context:1})],vd.prototype,"roleName",void 0);class eu{constructor(e={}){this.service=new De,this.ident=new De,Object.assign(this,e)}}f([g({type:De})],eu.prototype,"service",void 0),f([g({type:De})],eu.prototype,"ident",void 0),f([g({type:rt,optional:!0})],eu.prototype,"authInfo",void 0);var tu;class ru{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],ru.prototype,"otherCertFormat",void 0),f([g({type:A.Any})],ru.prototype,"otherCert",void 0);let Ci=class{constructor(e={}){Object.assign(this,e)}};f([g({type:Ei})],Ci.prototype,"certificate",void 0),f([g({type:xa,context:2,implicit:!0})],Ci.prototype,"v2AttrCert",void 0),f([g({type:ru,context:3,implicit:!0})],Ci.prototype,"other",void 0),Ci=f([z({type:V.Choice})],Ci);let Vs=tu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,tu.prototype)}};Vs=tu=f([z({type:V.Set,itemType:Ci})],Vs);class On{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],On.prototype,"contentType",void 0),f([g({type:A.Any,context:0})],On.prototype,"content",void 0);let us=class{constructor(e={}){Object.assign(this,e)}};f([g({type:rt})],us.prototype,"single",void 0),f([g({type:A.Any})],us.prototype,"any",void 0),us=f([z({type:V.Choice})],us);class Ea{constructor(e={}){this.eContentType="",Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],Ea.prototype,"eContentType",void 0),f([g({type:us,context:0,optional:!0})],Ea.prototype,"eContent",void 0);let Ls=class{constructor(e={}){Object.assign(this,e)}};f([g({type:rt,context:0,implicit:!0,optional:!0})],Ls.prototype,"value",void 0),f([g({type:rt,converter:Gy,context:0,implicit:!0,optional:!0,repeated:"sequence"})],Ls.prototype,"constructedValue",void 0),Ls=f([z({type:V.Choice})],Ls);class Hs{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new ya,Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],Hs.prototype,"contentType",void 0),f([g({type:ya})],Hs.prototype,"contentEncryptionAlgorithm",void 0),f([g({type:Ls,optional:!0})],Hs.prototype,"encryptedContent",void 0);class ka{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],ka.prototype,"keyAttrId",void 0),f([g({type:A.Any,optional:!0})],ka.prototype,"keyAttr",void 0);var nu;class Ia{constructor(e={}){this.subjectKeyIdentifier=new Ln,Object.assign(this,e)}}f([g({type:Ln})],Ia.prototype,"subjectKeyIdentifier",void 0),f([g({type:A.GeneralizedTime,optional:!0})],Ia.prototype,"date",void 0),f([g({type:ka,optional:!0})],Ia.prototype,"other",void 0);let fs=class{constructor(e={}){Object.assign(this,e)}};f([g({type:Ia,context:0,implicit:!0,optional:!0})],fs.prototype,"rKeyId",void 0),f([g({type:ss,optional:!0})],fs.prototype,"issuerAndSerialNumber",void 0),fs=f([z({type:V.Choice})],fs);class iu{constructor(e={}){this.rid=new fs,this.encryptedKey=new rt,Object.assign(this,e)}}f([g({type:fs})],iu.prototype,"rid",void 0),f([g({type:rt})],iu.prototype,"encryptedKey",void 0);let Ca=nu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,nu.prototype)}};Ca=nu=f([z({type:V.Sequence,itemType:iu})],Ca);class su{constructor(e={}){this.algorithm=new ae,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:ae})],su.prototype,"algorithm",void 0),f([g({type:A.BitString})],su.prototype,"publicKey",void 0);let Bi=class{constructor(e={}){Object.assign(this,e)}};f([g({type:Ln,context:0,implicit:!0,optional:!0})],Bi.prototype,"subjectKeyIdentifier",void 0),f([g({type:su,context:1,implicit:!0,optional:!0})],Bi.prototype,"originatorKey",void 0),f([g({type:ss,optional:!0})],Bi.prototype,"issuerAndSerialNumber",void 0),Bi=f([z({type:V.Choice})],Bi);class hs{constructor(e={}){this.version=sn.v3,this.originator=new Bi,this.keyEncryptionAlgorithm=new on,this.recipientEncryptedKeys=new Ca,Object.assign(this,e)}}f([g({type:A.Integer})],hs.prototype,"version",void 0),f([g({type:Bi,context:0})],hs.prototype,"originator",void 0),f([g({type:rt,context:1,optional:!0})],hs.prototype,"ukm",void 0),f([g({type:on})],hs.prototype,"keyEncryptionAlgorithm",void 0),f([g({type:Ca})],hs.prototype,"recipientEncryptedKeys",void 0);let ds=class{constructor(e={}){Object.assign(this,e)}};f([g({type:Ln,context:0,implicit:!0})],ds.prototype,"subjectKeyIdentifier",void 0),f([g({type:ss})],ds.prototype,"issuerAndSerialNumber",void 0),ds=f([z({type:V.Choice})],ds);class Fs{constructor(e={}){this.version=sn.v0,this.rid=new ds,this.keyEncryptionAlgorithm=new on,this.encryptedKey=new rt,Object.assign(this,e)}}f([g({type:A.Integer})],Fs.prototype,"version",void 0),f([g({type:ds})],Fs.prototype,"rid",void 0),f([g({type:on})],Fs.prototype,"keyEncryptionAlgorithm",void 0),f([g({type:rt})],Fs.prototype,"encryptedKey",void 0);class Gs{constructor(e={}){this.keyIdentifier=new rt,Object.assign(this,e)}}f([g({type:rt})],Gs.prototype,"keyIdentifier",void 0),f([g({type:A.GeneralizedTime,optional:!0})],Gs.prototype,"date",void 0),f([g({type:ka,optional:!0})],Gs.prototype,"other",void 0);class zs{constructor(e={}){this.version=sn.v4,this.kekid=new Gs,this.keyEncryptionAlgorithm=new on,this.encryptedKey=new rt,Object.assign(this,e)}}f([g({type:A.Integer})],zs.prototype,"version",void 0),f([g({type:Gs})],zs.prototype,"kekid",void 0),f([g({type:on})],zs.prototype,"keyEncryptionAlgorithm",void 0),f([g({type:rt})],zs.prototype,"encryptedKey",void 0);class Ks{constructor(e={}){this.version=sn.v0,this.keyEncryptionAlgorithm=new on,this.encryptedKey=new rt,Object.assign(this,e)}}f([g({type:A.Integer})],Ks.prototype,"version",void 0),f([g({type:Hl,context:0,optional:!0})],Ks.prototype,"keyDerivationAlgorithm",void 0),f([g({type:on})],Ks.prototype,"keyEncryptionAlgorithm",void 0),f([g({type:rt})],Ks.prototype,"encryptedKey",void 0);class ou{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],ou.prototype,"oriType",void 0),f([g({type:A.Any})],ou.prototype,"oriValue",void 0);let Hn=class{constructor(e={}){Object.assign(this,e)}};f([g({type:Fs,optional:!0})],Hn.prototype,"ktri",void 0),f([g({type:hs,context:1,implicit:!0,optional:!0})],Hn.prototype,"kari",void 0),f([g({type:zs,context:2,implicit:!0,optional:!0})],Hn.prototype,"kekri",void 0),f([g({type:Ks,context:3,implicit:!0,optional:!0})],Hn.prototype,"pwri",void 0),f([g({type:ou,context:4,implicit:!0,optional:!0})],Hn.prototype,"ori",void 0),Hn=f([z({type:V.Choice})],Hn);var au;let Ba=au=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,au.prototype)}};Ba=au=f([z({type:V.Set,itemType:Hn})],Ba);var cu;class Oa{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],Oa.prototype,"otherRevInfoFormat",void 0),f([g({type:A.Any})],Oa.prototype,"otherRevInfo",void 0);let Ta=class{constructor(e={}){this.other=new Oa,Object.assign(this,e)}};f([g({type:Oa,context:1,implicit:!0})],Ta.prototype,"other",void 0),Ta=f([z({type:V.Choice})],Ta);let Na=cu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,cu.prototype)}};Na=cu=f([z({type:V.Set,itemType:Ta})],Na);class lu{constructor(e={}){Object.assign(this,e)}}f([g({type:Vs,context:0,implicit:!0,optional:!0})],lu.prototype,"certs",void 0),f([g({type:Na,context:1,implicit:!0,optional:!0})],lu.prototype,"crls",void 0);var uu;let fu=uu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,uu.prototype)}};fu=uu=f([z({type:V.Set,itemType:as})],fu);class Zs{constructor(e={}){this.version=sn.v0,this.recipientInfos=new Ba,this.encryptedContentInfo=new Hs,Object.assign(this,e)}}f([g({type:A.Integer})],Zs.prototype,"version",void 0),f([g({type:lu,context:0,implicit:!0,optional:!0})],Zs.prototype,"originatorInfo",void 0),f([g({type:Ba})],Zs.prototype,"recipientInfos",void 0),f([g({type:Hs})],Zs.prototype,"encryptedContentInfo",void 0),f([g({type:fu,context:1,implicit:!0,optional:!0})],Zs.prototype,"unprotectedAttrs",void 0);const gg="1.2.840.113549.1.7.1",hu="1.2.840.113549.1.7.2";var du;let Ra=du=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,du.prototype)}};Ra=du=f([z({type:V.Set,itemType:$s})],Ra);class Tn{constructor(e={}){this.version=sn.v0,this.digestAlgorithms=new Ra,this.encapContentInfo=new Ea,this.signerInfos=new ga,Object.assign(this,e)}}f([g({type:A.Integer})],Tn.prototype,"version",void 0),f([g({type:Ra})],Tn.prototype,"digestAlgorithms",void 0),f([g({type:Ea})],Tn.prototype,"encapContentInfo",void 0),f([g({type:Vs,context:0,implicit:!0,optional:!0})],Tn.prototype,"certificates",void 0),f([g({type:Na,context:1,implicit:!0,optional:!0})],Tn.prototype,"crls",void 0),f([g({type:ga})],Tn.prototype,"signerInfos",void 0);const Ws="1.2.840.10045.2.1",pu="1.2.840.10045.4.1",md="1.2.840.10045.4.3.1",yu="1.2.840.10045.4.3.2",gu="1.2.840.10045.4.3.3",vu="1.2.840.10045.4.3.4",wd="1.2.840.10045.3.1.7",bd="1.3.132.0.34",xd="1.3.132.0.35";function qs(r){return new ae({algorithm:r})}const vg=qs(pu);qs(md);const mg=qs(yu),wg=qs(gu),bg=qs(vu);let Ys=class{constructor(e={}){Object.assign(this,e)}};f([g({type:A.ObjectIdentifier})],Ys.prototype,"fieldType",void 0),f([g({type:A.Any})],Ys.prototype,"parameters",void 0),Ys=f([z({type:V.Sequence})],Ys);class xg extends rt{}let ps=class{constructor(e={}){Object.assign(this,e)}};f([g({type:A.OctetString})],ps.prototype,"a",void 0),f([g({type:A.OctetString})],ps.prototype,"b",void 0),f([g({type:A.BitString,optional:!0})],ps.prototype,"seed",void 0),ps=f([z({type:V.Sequence})],ps);var mu;(function(r){r[r.ecpVer1=1]="ecpVer1"})(mu||(mu={}));let Nn=class{constructor(e={}){this.version=mu.ecpVer1,Object.assign(this,e)}};f([g({type:A.Integer})],Nn.prototype,"version",void 0),f([g({type:Ys})],Nn.prototype,"fieldID",void 0),f([g({type:ps})],Nn.prototype,"curve",void 0),f([g({type:xg})],Nn.prototype,"base",void 0),f([g({type:A.Integer,converter:_t})],Nn.prototype,"order",void 0),f([g({type:A.Integer,optional:!0})],Nn.prototype,"cofactor",void 0),Nn=f([z({type:V.Sequence})],Nn);let Fn=class{constructor(e={}){Object.assign(this,e)}};f([g({type:A.ObjectIdentifier})],Fn.prototype,"namedCurve",void 0),f([g({type:A.Null})],Fn.prototype,"implicitCurve",void 0),f([g({type:Nn})],Fn.prototype,"specifiedCurve",void 0),Fn=f([z({type:V.Choice})],Fn);class ja{constructor(e={}){this.version=1,this.privateKey=new rt,Object.assign(this,e)}}f([g({type:A.Integer})],ja.prototype,"version",void 0),f([g({type:rt})],ja.prototype,"privateKey",void 0),f([g({type:Fn,context:0,optional:!0})],ja.prototype,"parameters",void 0),f([g({type:A.BitString,context:1,optional:!0})],ja.prototype,"publicKey",void 0);class Pa{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.Integer,converter:_t})],Pa.prototype,"r",void 0),f([g({type:A.Integer,converter:_t})],Pa.prototype,"s",void 0);const vr="1.2.840.113549.1.1",Oi=`${vr}.1`,Ag=`${vr}.7`,_g=`${vr}.9`,Js=`${vr}.10`,Sg=`${vr}.2`,Eg=`${vr}.4`,Ua=`${vr}.5`,kg=`${vr}.14`,wu=`${vr}.11`,Da=`${vr}.12`,$a=`${vr}.13`,Ad=`${vr}.15`,_d=`${vr}.16`,Ma="1.3.14.3.2.26",Sd="2.16.840.1.101.3.4.2.4",Va="2.16.840.1.101.3.4.2.1",La="2.16.840.1.101.3.4.2.2",Ha="2.16.840.1.101.3.4.2.3",Ig="2.16.840.1.101.3.4.2.5",Cg="2.16.840.1.101.3.4.2.6",Bg="1.2.840.113549.2.2",Og="1.2.840.113549.2.5",Fa=`${vr}.8`;function Gt(r){return new ae({algorithm:r,parameters:null})}Gt(Bg),Gt(Og);const Ti=Gt(Ma);Gt(Sd),Gt(Va),Gt(La),Gt(Ha),Gt(Ig),Gt(Cg);const Ed=new ae({algorithm:Fa,parameters:J.serialize(Ti)}),kd=new ae({algorithm:_g,parameters:J.serialize(ea.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});Gt(Oi),Gt(Sg),Gt(Eg),Gt(Ua),Gt(Ad),Gt(_d),Gt(Da),Gt($a),Gt(Ad),Gt(_d);class Ga{constructor(e={}){this.hashAlgorithm=new ae(Ti),this.maskGenAlgorithm=new ae({algorithm:Fa,parameters:J.serialize(Ti)}),this.pSourceAlgorithm=new ae(kd),Object.assign(this,e)}}f([g({type:ae,context:0,defaultValue:Ti})],Ga.prototype,"hashAlgorithm",void 0),f([g({type:ae,context:1,defaultValue:Ed})],Ga.prototype,"maskGenAlgorithm",void 0),f([g({type:ae,context:2,defaultValue:kd})],Ga.prototype,"pSourceAlgorithm",void 0),new ae({algorithm:Ag,parameters:J.serialize(new Ga)});class Ni{constructor(e={}){this.hashAlgorithm=new ae(Ti),this.maskGenAlgorithm=new ae({algorithm:Fa,parameters:J.serialize(Ti)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}}f([g({type:ae,context:0,defaultValue:Ti})],Ni.prototype,"hashAlgorithm",void 0),f([g({type:ae,context:1,defaultValue:Ed})],Ni.prototype,"maskGenAlgorithm",void 0),f([g({type:A.Integer,context:2,defaultValue:20})],Ni.prototype,"saltLength",void 0),f([g({type:A.Integer,context:3,defaultValue:1})],Ni.prototype,"trailerField",void 0),new ae({algorithm:Js,parameters:J.serialize(new Ni)});class za{constructor(e={}){this.digestAlgorithm=new ae,this.digest=new rt,Object.assign(this,e)}}f([g({type:ae})],za.prototype,"digestAlgorithm",void 0),f([g({type:rt})],za.prototype,"digest",void 0);var bu;class Ka{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.Integer,converter:_t})],Ka.prototype,"prime",void 0),f([g({type:A.Integer,converter:_t})],Ka.prototype,"exponent",void 0),f([g({type:A.Integer,converter:_t})],Ka.prototype,"coefficient",void 0);let xu=bu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,bu.prototype)}};xu=bu=f([z({type:V.Sequence,itemType:Ka})],xu);class cn{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)}}f([g({type:A.Integer})],cn.prototype,"version",void 0),f([g({type:A.Integer,converter:_t})],cn.prototype,"modulus",void 0),f([g({type:A.Integer,converter:_t})],cn.prototype,"publicExponent",void 0),f([g({type:A.Integer,converter:_t})],cn.prototype,"privateExponent",void 0),f([g({type:A.Integer,converter:_t})],cn.prototype,"prime1",void 0),f([g({type:A.Integer,converter:_t})],cn.prototype,"prime2",void 0),f([g({type:A.Integer,converter:_t})],cn.prototype,"exponent1",void 0),f([g({type:A.Integer,converter:_t})],cn.prototype,"exponent2",void 0),f([g({type:A.Integer,converter:_t})],cn.prototype,"coefficient",void 0),f([g({type:xu,optional:!0})],cn.prototype,"otherPrimeInfos",void 0);class Au{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.Integer,converter:_t})],Au.prototype,"modulus",void 0),f([g({type:A.Integer,converter:_t})],Au.prototype,"publicExponent",void 0);var _u;(function(r){r[r.Transient=0]="Transient",r[r.Singleton=1]="Singleton",r[r.ResolutionScoped=2]="ResolutionScoped",r[r.ContainerScoped=3]="ContainerScoped"})(_u||(_u={}));const mr=_u;/*! *****************************************************************************
104
+ `)}`:`${t} :`}}Wf=gr,pe.Constructed=Wf,gr.NAME="CONSTRUCTED";class qf extends ar{fromBER(e,t,n){return t}toBER(e){return Lr}}qf.override="EndOfContentValueBlock";var Yf;class Wc extends Zt{constructor(e={}){super(e,qf),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}Yf=Wc,pe.EndOfContent=Yf,Wc.NAME=Os;var Jf;class vi extends Zt{constructor(e={}){super(e,ar),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,n){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+=n,t+n>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+n}toBER(e,t){const n=new ArrayBuffer(2);if(!e){const i=new Uint8Array(n);i[0]=5,i[1]=0}return t&&t.write(n),n}onAsciiEncoding(){return`${this.constructor.NAME}`}}Jf=vi,pe.Null=Jf,vi.NAME="NULL";class Xf extends tn(ar){constructor({value:e,...t}={}){super(t),t.valueHex?this.valueHexView=Q.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,n){const i=Q.toUint8Array(e);return An(this,i,t,n)?(this.valueHexView=i.subarray(t,t+n),n>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,$f.call(this),this.blockLength=n,t+n):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}Xf.NAME="BooleanValueBlock";var Qf;let $o=class extends Zt{constructor(e={}){super(e,Xf),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}`}};Qf=$o,pe.Boolean=Qf,$o.NAME="BOOLEAN";class eh extends tn(Mn){constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,n){let i=0;if(this.isConstructed){if(this.isHexOnly=!1,i=Mn.prototype.fromBER.call(this,e,t,n),i===-1)return i;for(let s=0;s<this.value.length;s++){const o=this.value[s].constructor.NAME;if(o===Os){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(o!==Lf)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,i=super.fromBER(e,t,n),this.blockLength=n;return i}toBER(e,t){return this.isConstructed?Mn.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}eh.NAME="OctetStringValueBlock";var th;let mi=class q0 extends Zt{constructor({idBlock:e={},lenBlock:t={},...n}={}){var i,s;(i=n.isConstructed)!==null&&i!==void 0||(n.isConstructed=!!(!((s=n.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:n.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!n.isIndefiniteForm},...n},eh),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,n){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,n===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+n);try{if(s.byteLength){const o=Yi(s,0,s.byteLength);o.offset!==-1&&o.offset===n&&(this.valueBlock.value=[o.result])}}catch{}}return super.fromBER(e,t,n)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?gr.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${ve.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 q0&&e.push(t.valueBlock.valueHexView);return Q.concat(e)}};th=mi,pe.OctetString=th,mi.NAME=Lf;class rh extends tn(Mn){constructor({unusedBits:e=0,isConstructed:t=!1,...n}={}){super(n),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,n){if(!n)return t;let i=-1;if(this.isConstructed){if(i=Mn.prototype.fromBER.call(this,e,t,n),i===-1)return i;for(const c of this.value){const u=c.constructor.NAME;if(u===Os){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(u!==Hf)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const d=c.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 i}const s=Q.toUint8Array(e);if(!An(this,s,t,n))return-1;const o=s.subarray(t,t+n);if(this.unusedBits=o[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const c=o.subarray(1);try{if(c.byteLength){const u=Yi(c,0,c.byteLength);u.offset!==-1&&u.offset===n-1&&(this.value=[u.result])}}catch{}}return this.valueHexView=o.subarray(1),this.blockLength=o.length,t+n}toBER(e,t){if(this.isConstructed)return Mn.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return Lr;const n=new Uint8Array(this.valueHexView.length+1);return n[0]=this.unusedBits,n.set(this.valueHexView,1),n.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}rh.NAME="BitStringValueBlock";var nh;let wi=class extends Zt{constructor({idBlock:e={},lenBlock:t={},...n}={}){var i,s;(i=n.isConstructed)!==null&&i!==void 0||(n.isConstructed=!!(!((s=n.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:n.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!n.isIndefiniteForm},...n},rh),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,n){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,n)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return gr.prototype.onAsciiEncoding.call(this);{const e=[],t=this.valueBlock.valueHexView;for(const i of t)e.push(i.toString(2).padStart(8,"0"));const n=e.join("");return`${this.constructor.NAME} : ${n.substring(0,n.length-this.valueBlock.unusedBits)}`}}};nh=wi,pe.BitString=nh,wi.NAME=Hf;var ih;function Ny(r,e){const t=new Uint8Array([0]),n=new Uint8Array(r),i=new Uint8Array(e);let s=n.slice(0);const o=s.length-1,c=i.slice(0),u=c.length-1;let d=0;const b=u<o?o:u;let _=0;for(let q=b;q>=0;q--,_++){switch(!0){case _<c.length:d=s[o-_]+c[u-_]+t[0];break;default:d=s[o-_]+t[0]}switch(t[0]=d/10,!0){case _>=s.length:s=Gc(new Uint8Array([d%10]),s);break;default:s[o-_]=d%10}}return t[0]>0&&(s=Gc(t,s)),s}function sh(r){if(r>=Bs.length)for(let e=Bs.length;e<=r;e++){const t=new Uint8Array([0]);let n=Bs[e-1].slice(0);for(let i=n.length-1;i>=0;i--){const s=new Uint8Array([(n[i]<<1)+t[0]]);t[0]=s[0]/10,n[i]=s[0]%10}t[0]>0&&(n=Gc(t,n)),Bs.push(n)}return Bs[r]}function Ry(r,e){let t=0;const n=new Uint8Array(r),i=new Uint8Array(e),s=n.slice(0),o=s.length-1,c=i.slice(0),u=c.length-1;let d,b=0;for(let _=u;_>=0;_--,b++)switch(d=s[o-b]-c[u-b]-t,!0){case d<0:t=1,s[o-b]=d+10;break;default:t=0,s[o-b]=d}if(t>0)for(let _=o-u+1;_>=0;_--,b++)if(d=s[o-b]-t,d<0)t=1,s[o-b]=d+10;else{t=0,s[o-b]=d;break}return s.slice()}class qc extends tn(ar){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=$f.call(this)))}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(by(e))}get valueDec(){return this._valueDec}fromDER(e,t,n,i=0){const s=this.fromBER(e,t,n);if(s===-1)return s;const o=this.valueHexView;return o[0]===0&&o[1]&128?this.valueHexView=o.subarray(1):i!==0&&o.length<i&&(i-o.length>1&&(i=o.length+1),this.valueHexView=o.subarray(i-o.length)),s}toDER(e=!1){const t=this.valueHexView;switch(!0){case(t[0]&128)!==0:{const n=new Uint8Array(this.valueHexView.length+1);n[0]=0,n.set(t,1),this.valueHexView=n}break;case(t[0]===0&&(t[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,t,n){const i=super.fromBER(e,t,n);return i===-1||this.setValueHex(),i}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=this.valueHexView.length*8-1;let t=new Uint8Array(this.valueHexView.length*8/3),n=0,i;const s=this.valueHexView;let o="",c=!1;for(let u=s.byteLength-1;u>=0;u--){i=s[u];for(let d=0;d<8;d++){if((i&1)===1)switch(n){case e:t=Ry(sh(n),t),o="-";break;default:t=Ny(t,sh(n))}n++,i>>=1}}for(let u=0;u<t.length;u++)t[u]&&(c=!0),c&&(o+=Mf.charAt(t[u]));return c===!1&&(o+=Mf.charAt(0)),o}}ih=qc,qc.NAME="IntegerValueBlock",Object.defineProperty(ih.prototype,"valueHex",{set:function(r){this.valueHexView=new Uint8Array(r),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var oh;class rn extends Zt{constructor(e={}){super(e,qc),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return Po(),BigInt(this.valueBlock.toString())}static fromBigInt(e){Po();const t=BigInt(e),n=new Uo,i=t.toString(16).replace(/^-/,""),s=new Uint8Array(ve.FromHex(i));if(t<0){const c=new Uint8Array(s.length+(s[0]&128?1:0));c[0]|=128;const d=BigInt(`0x${ve.ToHex(c)}`)+t,b=Q.toUint8Array(ve.FromHex(d.toString(16)));b[0]|=128,n.write(b)}else s[0]&128&&n.write(new Uint8Array([0])),n.write(s);return new rn({valueHex:n.final()})}convertToDER(){const e=new rn({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new rn({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}oh=rn,pe.Integer=oh,rn.NAME="INTEGER";var ah;class Mo extends rn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}ah=Mo,pe.Enumerated=ah,Mo.NAME="ENUMERATED";class Yc extends tn(ar){constructor({valueDec:e=-1,isFirstSid:t=!1,...n}={}){super(n),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,n){if(!n)return t;const i=Q.toUint8Array(e);if(!An(this,i,t,n))return-1;const s=i.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let c=0;c<n&&(this.valueHexView[c]=s[c]&127,this.blockLength++,!!(s[c]&128));c++);const o=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)o[c]=this.valueHexView[c];return this.valueHexView=o,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=qi(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){Po();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;const n=new Uint8Array(t.length/7);for(let i=0;i<n.length;i++)n[i]=parseInt(t.slice(i*7,i*7+7),2)+(i+1<n.length?128:0);this.fromBER(n.buffer,0,n.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const i=this.valueHexView,s=new Uint8Array(this.blockLength);for(let o=0;o<this.blockLength-1;o++)s[o]=i[o]|128;return s[this.blockLength-1]=i[this.blockLength-1],s.buffer}const t=yi(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",Lr;const n=new Uint8Array(t.byteLength);if(!e){const i=new Uint8Array(t),s=t.byteLength-1;for(let o=0;o<s;o++)n[o]=i[o]|128;n[s]=i[s]}return n}toString(){let e="";if(this.isHexOnly)e=ve.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}}}Yc.NAME="sidBlock";class ch extends ar{constructor({value:e=yr,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let i=t;for(;n>0;){const s=new Yc;if(i=s.fromBER(e,i,n),i===-1)return this.blockLength=0,this.error=s.error,i;this.value.length===0&&(s.isFirstSid=!0),this.blockLength+=s.blockLength,n-=s.blockLength,this.value.push(s)}return i}toBER(e){const t=[];for(let n=0;n<this.value.length;n++){const i=this.value[n].toBER(e);if(i.byteLength===0)return this.error=this.value[n].error,Lr;t.push(i)}return zc(t)}fromString(e){this.value=[];let t=0,n=0,i="",s=!1;do if(n=e.indexOf(".",t),n===-1?i=e.substring(t):i=e.substring(t,n),t=n+1,s){const o=this.value[0];let c=0;switch(o.valueDec){case 0:break;case 1:c=40;break;case 2:c=80;break;default:this.value=[];return}const u=parseInt(i,10);if(isNaN(u))return;o.valueDec=u+c,s=!1}else{const o=new Yc;if(i>Number.MAX_SAFE_INTEGER){Po();const c=BigInt(i);o.valueBigInt=c}else if(o.valueDec=parseInt(i,10),isNaN(o.valueDec))return;this.value.length||(o.isFirstSid=!0,s=!0),this.value.push(o)}while(n!==-1)}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let i=this.value[n].toString();n!==0&&(e=`${e}.`),t?(i=`{${i}}`,this.value[n].isFirstSid?e=`2.{${i} - 80}`:e+=i):e+=i}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}}ch.NAME="ObjectIdentifierValueBlock";var lh;class Vo extends Zt{constructor(e={}){super(e,ch),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()}}}lh=Vo,pe.ObjectIdentifier=lh,Vo.NAME="OBJECT IDENTIFIER";class Jc extends tn(gi){constructor({valueDec:e=0,...t}={}){super(t),this.valueDec=e}fromBER(e,t,n){if(n===0)return t;const i=Q.toUint8Array(e);if(!An(this,i,t,n))return-1;const s=i.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let c=0;c<n&&(this.valueHexView[c]=s[c]&127,this.blockLength++,!!(s[c]&128));c++);const o=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)o[c]=this.valueHexView[c];return this.valueHexView=o,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=qi(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 i=this.valueHexView,s=new Uint8Array(this.blockLength);for(let o=0;o<this.blockLength-1;o++)s[o]=i[o]|128;return s[this.blockLength-1]=i[this.blockLength-1],s.buffer}const t=yi(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",Lr;const n=new Uint8Array(t.byteLength);if(!e){const i=new Uint8Array(t),s=t.byteLength-1;for(let o=0;o<s;o++)n[o]=i[o]|128;n[s]=i[s]}return n.buffer}toString(){let e="";return this.isHexOnly?e=ve.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}Jc.NAME="relativeSidBlock";class uh extends ar{constructor({value:e=yr,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let i=t;for(;n>0;){const s=new Jc;if(i=s.fromBER(e,i,n),i===-1)return this.blockLength=0,this.error=s.error,i;this.blockLength+=s.blockLength,n-=s.blockLength,this.value.push(s)}return i}toBER(e,t){const n=[];for(let i=0;i<this.value.length;i++){const s=this.value[i].toBER(e);if(s.byteLength===0)return this.error=this.value[i].error,Lr;n.push(s)}return zc(n)}fromString(e){this.value=[];let t=0,n=0,i="";do{n=e.indexOf(".",t),n===-1?i=e.substring(t):i=e.substring(t,n),t=n+1;const s=new Jc;if(s.valueDec=parseInt(i,10),isNaN(s.valueDec))return!0;this.value.push(s)}while(n!==-1);return!0}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let i=this.value[n].toString();n!==0&&(e=`${e}.`),t&&(i=`{${i}}`),e+=i}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}}uh.NAME="RelativeObjectIdentifierValueBlock";var fh;class Xc extends Zt{constructor(e={}){super(e,uh),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()}}}fh=Xc,pe.RelativeObjectIdentifier=fh,Xc.NAME="RelativeObjectIdentifier";var hh;class Sn extends gr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}hh=Sn,pe.Sequence=hh,Sn.NAME="SEQUENCE";var dh;let _n=class extends gr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};dh=_n,pe.Set=dh,_n.NAME="SET";class ph extends tn(ar){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=yr}toJSON(){return{...super.toJSON(),value:this.value}}}ph.NAME="StringValueBlock";class yh extends ph{}yh.NAME="SimpleStringValueBlock";class _r extends Zc{constructor({...e}={}){super(e,yh)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,Q.toUint8Array(e))}fromString(e){const t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(t);for(let i=0;i<t;i++)n[i]=e.charCodeAt(i);this.valueBlock.value=e}}_r.NAME="SIMPLE STRING";class gh extends _r{fromBuffer(e){this.valueBlock.valueHexView=Q.toUint8Array(e);try{this.valueBlock.value=ve.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=ve.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(ve.FromUtf8String(e)),this.valueBlock.value=e}}gh.NAME="Utf8StringValueBlock";var vh;class En extends gh{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}vh=En,pe.Utf8String=vh,En.NAME="UTF8String";class mh extends _r{fromBuffer(e){this.valueBlock.value=ve.ToUtf16String(e),this.valueBlock.valueHexView=Q.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(ve.FromUtf16String(e))}}mh.NAME="BmpStringValueBlock";var wh;class Lo extends mh{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}wh=Lo,pe.BmpString=wh,Lo.NAME="BMPString";class bh extends _r{fromBuffer(e){const t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),n=new Uint8Array(t);for(let i=0;i<n.length;i+=4)n[i]=n[i+3],n[i+1]=n[i+2],n[i+2]=0,n[i+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){const t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(t*4);for(let i=0;i<t;i++){const s=yi(e.charCodeAt(i),8),o=new Uint8Array(s);if(o.length>4)continue;const c=4-o.length;for(let u=o.length-1;u>=0;u--)n[i*4+u+c]=o[u]}this.valueBlock.value=e}}bh.NAME="UniversalStringValueBlock";var xh;class Ho extends bh{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}xh=Ho,pe.UniversalString=xh,Ho.NAME="UniversalString";var Ah;class Fo extends _r{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}Ah=Fo,pe.NumericString=Ah,Fo.NAME="NumericString";var Sh;class Go extends _r{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}Sh=Go,pe.PrintableString=Sh,Go.NAME="PrintableString";var _h;class zo extends _r{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}_h=zo,pe.TeletexString=_h,zo.NAME="TeletexString";var Eh;class Ko extends _r{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}Eh=Ko,pe.VideotexString=Eh,Ko.NAME="VideotexString";var kh;class Zo extends _r{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}kh=Zo,pe.IA5String=kh,Zo.NAME="IA5String";var Ih;class Wo extends _r{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}Ih=Wo,pe.GraphicString=Ih,Wo.NAME="GraphicString";var Ch;class Ns extends _r{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}Ch=Ns,pe.VisibleString=Ch,Ns.NAME="VisibleString";var Bh;class qo extends _r{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}Bh=qo,pe.GeneralString=Bh,qo.NAME="GeneralString";var Oh;class Yo extends _r{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}Oh=Yo,pe.CharacterString=Oh,Yo.NAME="CharacterString";var Th;class Rs extends Ns{constructor({value:e,valueDate:t,...n}={}){if(super(n),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 i=0;i<e.length;i++)this.valueBlock.valueHexView[i]=e.charCodeAt(i)}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,Q.toUint8Array(e)))}toBuffer(){const e=this.toString(),t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let i=0;i<e.length;i++)n[i]=e.charCodeAt(i);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 n=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(n===null){this.error="Wrong input string for conversion";return}const i=parseInt(n[1],10);i>=50?this.year=1900+i:this.year=2e3+i,this.month=parseInt(n[2],10),this.day=parseInt(n[3],10),this.hour=parseInt(n[4],10),this.minute=parseInt(n[5],10),this.second=parseInt(n[6],10)}toString(e="iso"){if(e==="iso"){const t=new Array(7);return t[0]=Sr(this.year<2e3?this.year-1900:this.year-2e3,2),t[1]=Sr(this.month,2),t[2]=Sr(this.day,2),t[3]=Sr(this.hour,2),t[4]=Sr(this.minute,2),t[5]=Sr(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}}}Th=Rs,pe.UTCTime=Th,Rs.NAME="UTCTime";var Nh;class Jo extends Rs{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,n="",i="",s=0,o,c=0,u=0;if(e[e.length-1]==="Z")n=e.substring(0,e.length-1),t=!0;else{const _=new Number(e[e.length-1]);if(isNaN(_.valueOf()))throw new Error("Wrong input string for conversion");n=e}if(t){if(n.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(n.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let _=1,q=n.indexOf("+"),$="";if(q===-1&&(q=n.indexOf("-"),_=-1),q!==-1){if($=n.substring(q+1),n=n.substring(0,q),$.length!==2&&$.length!==4)throw new Error("Wrong input string for conversion");let w=parseInt($.substring(0,2),10);if(isNaN(w.valueOf()))throw new Error("Wrong input string for conversion");if(c=_*w,$.length===4){if(w=parseInt($.substring(2,4),10),isNaN(w.valueOf()))throw new Error("Wrong input string for conversion");u=_*w}}}let d=n.indexOf(".");if(d===-1&&(d=n.indexOf(",")),d!==-1){const _=new Number(`0${n.substring(d)}`);if(isNaN(_.valueOf()))throw new Error("Wrong input string for conversion");s=_.valueOf(),i=n.substring(0,d)}else i=n;switch(!0){case i.length===8:if(o=/(\d{4})(\d{2})(\d{2})/ig,d!==-1)throw new Error("Wrong input string for conversion");break;case i.length===10:if(o=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let _=60*s;this.minute=Math.floor(_),_=60*(_-this.minute),this.second=Math.floor(_),_=1e3*(_-this.second),this.millisecond=Math.floor(_)}break;case i.length===12:if(o=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let _=60*s;this.second=Math.floor(_),_=1e3*(_-this.second),this.millisecond=Math.floor(_)}break;case i.length===14:if(o=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){const _=1e3*s;this.millisecond=Math.floor(_)}break;default:throw new Error("Wrong input string for conversion")}const b=o.exec(i);if(b===null)throw new Error("Wrong input string for conversion");for(let _=1;_<b.length;_++)switch(_){case 1:this.year=parseInt(b[_],10);break;case 2:this.month=parseInt(b[_],10);break;case 3:this.day=parseInt(b[_],10);break;case 4:this.hour=parseInt(b[_],10)+c;break;case 5:this.minute=parseInt(b[_],10)+u;break;case 6:this.second=parseInt(b[_],10);break;default:throw new Error("Wrong input string for conversion")}if(t===!1){const _=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=_.getUTCFullYear(),this.month=_.getUTCMonth(),this.day=_.getUTCDay(),this.hour=_.getUTCHours(),this.minute=_.getUTCMinutes(),this.second=_.getUTCSeconds(),this.millisecond=_.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){const t=[];return t.push(Sr(this.year,4)),t.push(Sr(this.month,2)),t.push(Sr(this.day,2)),t.push(Sr(this.hour,2)),t.push(Sr(this.minute,2)),t.push(Sr(this.second,2)),this.millisecond!==0&&(t.push("."),t.push(Sr(this.millisecond,3))),t.push("Z"),t.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}Nh=Jo,pe.GeneralizedTime=Nh,Jo.NAME="GeneralizedTime";var Rh;class Qc extends En{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}Rh=Qc,pe.DATE=Rh,Qc.NAME="DATE";var jh;class el extends En{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}jh=el,pe.TimeOfDay=jh,el.NAME="TimeOfDay";var Ph;class tl extends En{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}Ph=tl,pe.DateTime=Ph,tl.NAME="DateTime";var Uh;class rl extends En{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}Uh=rl,pe.Duration=Uh,rl.NAME="Duration";var Dh;class nl extends En{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}Dh=nl,pe.TIME=Dh,nl.NAME="TIME";class bi{constructor({name:e=yr,optional:t=!1}={}){this.name=e,this.optional=t}}class il extends bi{constructor({value:e=[],...t}={}){super(t),this.value=e}}class Xo extends bi{constructor({value:e=new bi,local:t=!1,...n}={}){super(n),this.value=e,this.local=t}}class jy{constructor({data:e=Do}={}){this.dataView=Q.toUint8Array(e)}get data(){return this.dataView.slice().buffer}set data(e){this.dataView=Q.toUint8Array(e)}fromBER(e,t,n){const i=t+n;return this.dataView=Q.toUint8Array(e).subarray(t,i),i}toBER(e){return this.dataView.slice().buffer}}function xi(r,e,t){if(t instanceof il){for(let s=0;s<t.value.length;s++)if(xi(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(Kc)&&(s.name=t.name),s}}if(t instanceof bi)return t.hasOwnProperty(Kc)&&(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(!(Sy in t))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Iy in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Cy in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const n=t.idBlock.toBER(!1);if(n.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(t.idBlock.fromBER(n,0,n.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(t.idBlock.hasOwnProperty(_y)===!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(Ey)===!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(ky)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:r};if(!(Ay 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(!(Vf in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const s=t.idBlock.valueHexView,o=e.idBlock.valueHexView;if(s.length!==o.length)return{verified:!1,result:r};for(let c=0;c<s.length;c++)if(s[c]!==o[1])return{verified:!1,result:r}}if(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,yr),t.name&&(r[t.name]=e)),t instanceof pe.Constructed){let s=0,o={verified:!1,result:{error:"Unknown error"}},c=t.valueBlock.value.length;if(c>0&&t.valueBlock.value[0]instanceof Xo&&(c=e.valueBlock.value.length),c===0)return{verified:!0,result:r};if(e.valueBlock.value.length===0&&t.valueBlock.value.length!==0){let u=!0;for(let d=0;d<t.valueBlock.value.length;d++)u=u&&(t.valueBlock.value[d].optional||!1);return u?{verified:!0,result:r}:(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,yr),t.name&&delete r[t.name]),r.error="Inconsistent object length",{verified:!1,result:r})}for(let u=0;u<c;u++)if(u-s>=e.valueBlock.value.length){if(t.valueBlock.value[u].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,yr),t.name&&(delete r[t.name],d.name=t.name)),d}}else if(t.valueBlock.value[0]instanceof Xo){if(o=xi(r,e.valueBlock.value[u],t.valueBlock.value[0].value),o.verified===!1)if(t.valueBlock.value[0].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,yr),t.name&&delete r[t.name]),o;if(Kc in t.valueBlock.value[0]&&t.valueBlock.value[0].name.length>0){let d={};By 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[u])}}else if(o=xi(r,e.valueBlock.value[u-s],t.valueBlock.value[u]),o.verified===!1)if(t.valueBlock.value[u].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,yr),t.name&&delete r[t.name]),o;if(o.verified===!1){const u={verified:!1,result:r};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,yr),t.name&&(delete r[t.name],u.name=t.name)),u}return{verified:!0,result:r}}if(t.primitiveSchema&&Vf in e.valueBlock){const s=Yi(e.valueBlock.valueHexView);if(s.offset===-1){const o={verified:!1,result:s.result};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,yr),t.name&&(delete r[t.name],o.name=t.name)),o}return xi(r,s.result,t.primitiveSchema)}return{verified:!0,result:r}}function Py(r,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const t=Yi(Q.toUint8Array(r));return t.offset===-1?{verified:!1,result:t.result}:xi(t.result,t.result,e)}const $h=Object.freeze(Object.defineProperty({__proto__:null,Any:bi,BaseBlock:Zt,BaseStringBlock:Zc,BitString:wi,BmpString:Lo,Boolean:$o,CharacterString:Yo,Choice:il,Constructed:gr,DATE:Qc,DateTime:tl,Duration:rl,EndOfContent:Wc,Enumerated:Mo,GeneralString:qo,GeneralizedTime:Jo,GraphicString:Wo,HexBlock:tn,IA5String:Zo,Integer:rn,Null:vi,NumericString:Fo,ObjectIdentifier:Vo,OctetString:mi,Primitive:Ts,PrintableString:Go,RawData:jy,RelativeObjectIdentifier:Xc,Repeated:Xo,Sequence:Sn,Set:_n,TIME:nl,TeletexString:zo,TimeOfDay:el,UTCTime:Rs,UniversalString:Ho,Utf8String:En,ValueBlock:ar,VideotexString:Ko,ViewWriter:Uo,VisibleString:Ns,compareSchema:xi,fromBER:Ji,verifySchema:Py},Symbol.toStringTag,{value:"Module"}));var V;(function(r){r[r.Sequence=0]="Sequence",r[r.Set=1]="Set",r[r.Choice=2]="Choice"})(V||(V={}));var A;(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"})(A||(A={}));class Qo{constructor(e,t=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(Q.isBufferSource(e))this.unusedBits=t,this.value=Q.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof wi))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 wi({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new wi({name:e})}toNumber(){let e="";const t=new Uint8Array(this.value);for(const n of t)e+=n.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 n=t.length+7>>3;this.unusedBits=(n<<3)-t.length;const i=new Uint8Array(n);t=t.padStart(n<<3,"0").split("").reverse().join("");let s=0;for(;s<n;)i[s]=parseInt(t.slice(s<<3,(s<<3)+8),2),s++;this.value=i.buffer}}class nt{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):Q.isBufferSource(e)?this.buffer=Q.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof mi))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new mi({valueHex:this.buffer})}toSchema(e){return new mi({name:e})}}const Uy={fromASN:r=>r instanceof vi?null:r.valueBeforeDecodeView,toASN:r=>{if(r===null)return new vi;const e=Ji(r);if(e.result.error)throw new Error(e.result.error);return e.result}},Dy={fromASN:r=>r.valueBlock.valueHexView.byteLength>=4?r.valueBlock.toString():r.valueBlock.valueDec,toASN:r=>new rn({value:+r})},$y={fromASN:r=>r.valueBlock.valueDec,toASN:r=>new Mo({value:r})},St={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new rn({valueHex:r})},My={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new wi({valueHex:r})},Vy={fromASN:r=>r.valueBlock.toString(),toASN:r=>new Vo({value:r})},Ly={fromASN:r=>r.valueBlock.value,toASN:r=>new $o({value:r})},ea={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new mi({valueHex:r})},Hy={fromASN:r=>new nt(r.getValue()),toASN:r=>r.toASN()};function Nr(r){return{fromASN:e=>e.valueBlock.value,toASN:e=>new r({value:e})}}const Mh=Nr(En),Fy=Nr(Lo),Gy=Nr(Ho),zy=Nr(Fo),Ky=Nr(Go),Zy=Nr(zo),Wy=Nr(Ko),qy=Nr(Zo),Yy=Nr(Wo),Jy=Nr(Ns),Xy=Nr(qo),Qy=Nr(Yo),eg={fromASN:r=>r.toDate(),toASN:r=>new Rs({valueDate:r})},tg={fromASN:r=>r.toDate(),toASN:r=>new Jo({valueDate:r})},rg={fromASN:()=>null,toASN:()=>new vi};function sl(r){switch(r){case A.Any:return Uy;case A.BitString:return My;case A.BmpString:return Fy;case A.Boolean:return Ly;case A.CharacterString:return Qy;case A.Enumerated:return $y;case A.GeneralString:return Xy;case A.GeneralizedTime:return tg;case A.GraphicString:return Yy;case A.IA5String:return qy;case A.Integer:return Dy;case A.Null:return rg;case A.NumericString:return zy;case A.ObjectIdentifier:return Vy;case A.OctetString:return ea;case A.PrintableString:return Ky;case A.TeletexString:return Zy;case A.UTCTime:return eg;case A.UniversalString:return Gy;case A.Utf8String:return Mh;case A.VideotexString:return Wy;case A.VisibleString:return Jy;default:return null}}function kn(r){return typeof r=="function"&&r.prototype?r.prototype.toASN&&r.prototype.fromASN?!0:kn(r.prototype):!!(r&&typeof r=="object"&&"toASN"in r&&"fromASN"in r)}function Vh(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:Vh(t)}return!1}function ng(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;const t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<r.byteLength;i++)if(t[i]!==n[i])return!1;return!0}class ig{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e,t=!1){const n=this.items.get(e);if(!n)throw new Error(`Cannot get schema for '${e.prototype.constructor.name}' target`);if(t&&!n.schema)throw new Error(`Schema '${e.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return n}cache(e){const t=this.get(e);t.schema||(t.schema=this.create(e,!0))}createDefault(e){const t={type:V.Sequence,items:{}},n=this.findParentSchema(e);return n&&(Object.assign(t,n),t.items=Object.assign({},t.items,n.items)),t}create(e,t){const n=this.items.get(e)||this.createDefault(e),i=[];for(const s in n.items){const o=n.items[s],c=t?s:"";let u;if(typeof o.type=="number"){const b=A[o.type],_=$h[b];if(!_)throw new Error(`Cannot get ASN1 class by name '${b}'`);u=new _({name:c})}else kn(o.type)?u=new o.type().toSchema(c):o.optional?this.get(o.type).type===V.Choice?u=new bi({name:c}):(u=this.create(o.type,!1),u.name=c):u=new bi({name:c});const d=!!o.optional||o.defaultValue!==void 0;if(o.repeated){u.name="";const b=o.repeated==="set"?_n:Sn;u=new b({name:"",value:[new Xo({name:c,value:u})]})}if(o.context!==null&&o.context!==void 0)if(o.implicit)if(typeof o.type=="number"||kn(o.type)){const b=o.repeated?gr:Ts;i.push(new b({name:c,optional:d,idBlock:{tagClass:3,tagNumber:o.context}}))}else{this.cache(o.type);const b=!!o.repeated;let _=b?u:this.get(o.type,!0).schema;_="valueBlock"in _?_.valueBlock.value:_.value,i.push(new gr({name:b?"":c,optional:d,idBlock:{tagClass:3,tagNumber:o.context},value:_}))}else i.push(new gr({optional:d,idBlock:{tagClass:3,tagNumber:o.context},value:[u]}));else u.optional=d,i.push(u)}switch(n.type){case V.Sequence:return new Sn({value:i,name:""});case V.Set:return new _n({value:i,name:""});case V.Choice:return new il({value:i,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 Rr=new ig,z=r=>e=>{let t;Rr.has(e)?t=Rr.get(e):(t=Rr.createDefault(e),Rr.set(e,t)),Object.assign(t,r)},g=r=>(e,t)=>{let n;Rr.has(e.constructor)?n=Rr.get(e.constructor):(n=Rr.createDefault(e.constructor),Rr.set(e.constructor,n));const i=Object.assign({},r);if(typeof i.type=="number"&&!i.converter){const s=sl(r.type);if(!s)throw new Error(`Cannot get default converter for property '${t}' of ${e.constructor.name}`);i.converter=s}n.items[t]=i};class Lh extends Error{constructor(){super(...arguments),this.schemas=[]}}class sg{static parse(e,t){const n=Ji(e);if(n.result.error)throw new Error(n.result.error);return this.fromASN(n.result,t)}static fromASN(e,t){var n;try{if(kn(t))return new t().fromASN(e);const i=Rr.get(t);Rr.cache(t);let s=i.schema;if(e.constructor===gr&&i.type!==V.Choice){s=new gr({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:i.schema.valueBlock.value});for(const u in i.items)delete e[u]}const o=xi({},e,s);if(!o.verified)throw new Lh(`Data does not match to ${t.name} ASN1 schema. ${o.result.error}`);const c=new t;if(Vh(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 u=i.itemType;if(typeof u=="number"){const d=sl(u);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,u))}for(const u in i.items){const d=o.result[u];if(!d)continue;const b=i.items[u],_=b.type;if(typeof _=="number"||kn(_)){const q=(n=b.converter)!==null&&n!==void 0?n:kn(_)?new _:null;if(!q)throw new Error("Converter is empty");if(b.repeated)if(b.implicit){const $=b.repeated==="sequence"?Sn:_n,w=new $;w.valueBlock=d.valueBlock;const E=Ji(w.toBER(!1));if(E.offset===-1)throw new Error(`Cannot parse the child item. ${E.result.error}`);if(!("value"in E.result.valueBlock&&Array.isArray(E.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const B=E.result.valueBlock.value;c[u]=Array.from(B,I=>q.fromASN(I))}else c[u]=Array.from(d,$=>q.fromASN($));else{let $=d;if(b.implicit){let w;if(kn(_))w=new _().toSchema("");else{const E=A[_],B=$h[E];if(!B)throw new Error(`Cannot get '${E}' class from asn1js module`);w=new B}w.valueBlock=$.valueBlock,$=Ji(w.toBER(!1)).result}c[u]=q.fromASN($)}}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.");c[u]=Array.from(d,q=>this.fromASN(q,_))}else c[u]=this.fromASN(d,_)}return c}catch(i){throw i instanceof Lh&&i.schemas.push(t.name),i}}}class ol{static serialize(e){return e instanceof Zt?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&kn(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const t=e.constructor,n=Rr.get(t);Rr.cache(t);let i=[];if(n.itemType){if(!Array.isArray(e))throw new TypeError("Parameter 1 should be type of Array.");if(typeof n.itemType=="number"){const o=sl(n.itemType);if(!o)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);i=e.map(c=>o.toASN(c))}else i=e.map(o=>this.toAsnItem({type:n.itemType},"[]",t,o))}else for(const o in n.items){const c=n.items[o],u=e[o];if(u===void 0||c.defaultValue===u||typeof c.defaultValue=="object"&&typeof u=="object"&&ng(this.serialize(c.defaultValue),this.serialize(u)))continue;const d=ol.toAsnItem(c,o,t,u);if(typeof c.context=="number")if(c.implicit)if(!c.repeated&&(typeof c.type=="number"||kn(c.type))){const b={};b.valueHex=d instanceof vi?d.valueBeforeDecodeView:d.valueBlock.toBER(),i.push(new Ts({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},...b}))}else i.push(new gr({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:d.valueBlock.value}));else i.push(new gr({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:[d]}));else c.repeated?i=i.concat(d):i.push(d)}let s;switch(n.type){case V.Sequence:s=new Sn({value:i});break;case V.Set:s=new _n({value:i});break;case V.Choice:if(!i[0])throw new Error(`Schema '${t.name}' has wrong data. Choice cannot be empty.`);s=i[0];break}return s}static toAsnItem(e,t,n,i){let s;if(typeof e.type=="number"){const o=e.converter;if(!o)throw new Error(`Property '${t}' doesn't have converter for type ${A[e.type]} in schema '${n.name}'`);if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const c=Array.from(i,d=>o.toASN(d)),u=e.repeated==="sequence"?Sn:_n;s=new u({value:c})}else s=o.toASN(i)}else if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const o=Array.from(i,u=>this.toASN(u)),c=e.repeated==="sequence"?Sn:_n;s=new c({value:o})}else s=this.toASN(i);return s}}class mt extends Array{constructor(e=[]){if(typeof e=="number")super(e);else{super();for(const t of e)this.push(t)}}}class Y{static serialize(e){return ol.serialize(e)}static parse(e,t){return sg.parse(e,t)}static toString(e){const t=Q.isBufferSource(e)?Q.toArrayBuffer(e):Y.serialize(e),n=Ji(t);if(n.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${n.result.error}`);return n.result.toString()}}function f(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(o=r[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s}typeof SuppressedError=="function"&&SuppressedError;var Hh={exports:{}};(function(r){(function(e){const t="(0?\\d+|0x[a-f0-9]+)",n={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")},i=new RegExp("^0[0-7]+$","i"),s=new RegExp("^0x[a-f0-9]+$","i"),o="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",u={zoneIndex:new RegExp(o,"i"),native:new RegExp(`^(::)?(${c})?([0-9a-f]+)?(::)?(${o})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${o})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${t}\\.${t}\\.${t}\\.${t}(${o})?$`,"i")};function d(w,E){if(w.indexOf("::")!==w.lastIndexOf("::"))return null;let B=0,I=-1,R=(w.match(u.zoneIndex)||[])[0],U,fe;for(R&&(R=R.substring(1),w=w.replace(/%.+$/,""));(I=w.indexOf(":",I+1))>=0;)B++;if(w.substr(0,2)==="::"&&B--,w.substr(-2,2)==="::"&&B--,B>E)return null;for(fe=E-B,U=":";fe--;)U+="0:";return w=w.replace("::",U),w[0]===":"&&(w=w.slice(1)),w[w.length-1]===":"&&(w=w.slice(0,-1)),E=function(){const oe=w.split(":"),ce=[];for(let X=0;X<oe.length;X++)ce.push(parseInt(oe[X],16));return ce}(),{parts:E,zoneId:R}}function b(w,E,B,I){if(w.length!==E.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let R=0,U;for(;I>0;){if(U=B-I,U<0&&(U=0),w[R]>>U!==E[R]>>U)return!1;I-=B,R+=1}return!0}function _(w){if(s.test(w))return parseInt(w,16);if(w[0]==="0"&&!isNaN(parseInt(w[1],10))){if(i.test(w))return parseInt(w,8);throw new Error(`ipaddr: cannot parse ${w} as octal`)}return parseInt(w,10)}function q(w,E){for(;w.length<E;)w=`0${w}`;return w}const $={};$.IPv4=function(){function w(E){if(E.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let B,I;for(B=0;B<E.length;B++)if(I=E[B],!(0<=I&&I<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=E}return w.prototype.SpecialRanges={unspecified:[[new w([0,0,0,0]),8]],broadcast:[[new w([255,255,255,255]),32]],multicast:[[new w([224,0,0,0]),4]],linkLocal:[[new w([169,254,0,0]),16]],loopback:[[new w([127,0,0,0]),8]],carrierGradeNat:[[new w([100,64,0,0]),10]],private:[[new w([10,0,0,0]),8],[new w([172,16,0,0]),12],[new w([192,168,0,0]),16]],reserved:[[new w([192,0,0,0]),24],[new w([192,0,2,0]),24],[new w([192,88,99,0]),24],[new w([198,18,0,0]),15],[new w([198,51,100,0]),24],[new w([203,0,113,0]),24],[new w([240,0,0,0]),4]],as112:[[new w([192,175,48,0]),24],[new w([192,31,196,0]),24]],amt:[[new w([192,52,193,0]),24]]},w.prototype.kind=function(){return"ipv4"},w.prototype.match=function(E,B){let I;if(B===void 0&&(I=E,E=I[0],B=I[1]),E.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return b(this.octets,E.octets,8,B)},w.prototype.prefixLengthFromSubnetMask=function(){let E=0,B=!1;const I={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let R,U,fe;for(R=3;R>=0;R-=1)if(U=this.octets[R],U in I){if(fe=I[U],B&&fe!==0)return null;fe!==8&&(B=!0),E+=fe}else return null;return 32-E},w.prototype.range=function(){return $.subnetMatch(this,this.SpecialRanges)},w.prototype.toByteArray=function(){return this.octets.slice(0)},w.prototype.toIPv4MappedAddress=function(){return $.IPv6.parse(`::ffff:${this.toString()}`)},w.prototype.toNormalizedString=function(){return this.toString()},w.prototype.toString=function(){return this.octets.join(".")},w}(),$.IPv4.broadcastAddressFromCIDR=function(w){try{const E=this.parseCIDR(w),B=E[0].toByteArray(),I=this.subnetMaskFromPrefixLength(E[1]).toByteArray(),R=[];let U=0;for(;U<4;)R.push(parseInt(B[U],10)|parseInt(I[U],10)^255),U++;return new this(R)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},$.IPv4.isIPv4=function(w){return this.parser(w)!==null},$.IPv4.isValid=function(w){try{return new this(this.parser(w)),!0}catch{return!1}},$.IPv4.isValidCIDR=function(w){try{return this.parseCIDR(w),!0}catch{return!1}},$.IPv4.isValidFourPartDecimal=function(w){return!!($.IPv4.isValid(w)&&w.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},$.IPv4.networkAddressFromCIDR=function(w){let E,B,I,R,U;try{for(E=this.parseCIDR(w),I=E[0].toByteArray(),U=this.subnetMaskFromPrefixLength(E[1]).toByteArray(),R=[],B=0;B<4;)R.push(parseInt(I[B],10)&parseInt(U[B],10)),B++;return new this(R)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},$.IPv4.parse=function(w){const E=this.parser(w);if(E===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(E)},$.IPv4.parseCIDR=function(w){let E;if(E=w.match(/^(.+)\/(\d+)$/)){const B=parseInt(E[2]);if(B>=0&&B<=32){const I=[this.parse(E[1]),B];return Object.defineProperty(I,"toString",{value:function(){return this.join("/")}}),I}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},$.IPv4.parser=function(w){let E,B,I;if(E=w.match(n.fourOctet))return function(){const R=E.slice(1,6),U=[];for(let fe=0;fe<R.length;fe++)B=R[fe],U.push(_(B));return U}();if(E=w.match(n.longValue)){if(I=_(E[1]),I>4294967295||I<0)throw new Error("ipaddr: address outside defined range");return function(){const R=[];let U;for(U=0;U<=24;U+=8)R.push(I>>U&255);return R}().reverse()}else return(E=w.match(n.twoOctet))?function(){const R=E.slice(1,4),U=[];if(I=_(R[1]),I>16777215||I<0)throw new Error("ipaddr: address outside defined range");return U.push(_(R[0])),U.push(I>>16&255),U.push(I>>8&255),U.push(I&255),U}():(E=w.match(n.threeOctet))?function(){const R=E.slice(1,5),U=[];if(I=_(R[2]),I>65535||I<0)throw new Error("ipaddr: address outside defined range");return U.push(_(R[0])),U.push(_(R[1])),U.push(I>>8&255),U.push(I&255),U}():null},$.IPv4.subnetMaskFromPrefixLength=function(w){if(w=parseInt(w),w<0||w>32)throw new Error("ipaddr: invalid IPv4 prefix length");const E=[0,0,0,0];let B=0;const I=Math.floor(w/8);for(;B<I;)E[B]=255,B++;return I<4&&(E[I]=Math.pow(2,w%8)-1<<8-w%8),new this(E)},$.IPv6=function(){function w(E,B){let I,R;if(E.length===16)for(this.parts=[],I=0;I<=14;I+=2)this.parts.push(E[I]<<8|E[I+1]);else if(E.length===8)this.parts=E;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(I=0;I<this.parts.length;I++)if(R=this.parts[I],!(0<=R&&R<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");B&&(this.zoneId=B)}return w.prototype.SpecialRanges={unspecified:[new w([0,0,0,0,0,0,0,0]),128],linkLocal:[new w([65152,0,0,0,0,0,0,0]),10],multicast:[new w([65280,0,0,0,0,0,0,0]),8],loopback:[new w([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new w([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new w([0,0,0,0,0,65535,0,0]),96],discard:[new w([256,0,0,0,0,0,0,0]),64],rfc6145:[new w([0,0,0,0,65535,0,0,0]),96],rfc6052:[new w([100,65435,0,0,0,0,0,0]),96],"6to4":[new w([8194,0,0,0,0,0,0,0]),16],teredo:[new w([8193,0,0,0,0,0,0,0]),32],benchmarking:[new w([8193,2,0,0,0,0,0,0]),48],amt:[new w([8193,3,0,0,0,0,0,0]),32],as112v6:[[new w([8193,4,274,0,0,0,0,0]),48],[new w([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new w([8193,16,0,0,0,0,0,0]),28],orchid2:[new w([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new w([8193,48,0,0,0,0,0,0]),28],reserved:[[new w([8193,0,0,0,0,0,0,0]),23],[new w([8193,3512,0,0,0,0,0,0]),32]]},w.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},w.prototype.kind=function(){return"ipv6"},w.prototype.match=function(E,B){let I;if(B===void 0&&(I=E,E=I[0],B=I[1]),E.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return b(this.parts,E.parts,16,B)},w.prototype.prefixLengthFromSubnetMask=function(){let E=0,B=!1;const I={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 R,U;for(let fe=7;fe>=0;fe-=1)if(R=this.parts[fe],R in I){if(U=I[R],B&&U!==0)return null;U!==16&&(B=!0),E+=U}else return null;return 128-E},w.prototype.range=function(){return $.subnetMatch(this,this.SpecialRanges)},w.prototype.toByteArray=function(){let E;const B=[],I=this.parts;for(let R=0;R<I.length;R++)E=I[R],B.push(E>>8),B.push(E&255);return B},w.prototype.toFixedLengthString=function(){const E=(function(){const I=[];for(let R=0;R<this.parts.length;R++)I.push(q(this.parts[R].toString(16),4));return I}).call(this).join(":");let B="";return this.zoneId&&(B=`%${this.zoneId}`),E+B},w.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const E=this.parts.slice(-2),B=E[0],I=E[1];return new $.IPv4([B>>8,B&255,I>>8,I&255])},w.prototype.toNormalizedString=function(){const E=(function(){const I=[];for(let R=0;R<this.parts.length;R++)I.push(this.parts[R].toString(16));return I}).call(this).join(":");let B="";return this.zoneId&&(B=`%${this.zoneId}`),E+B},w.prototype.toRFC5952String=function(){const E=/((^|:)(0(:|$)){2,})/g,B=this.toNormalizedString();let I=0,R=-1,U;for(;U=E.exec(B);)U[0].length>R&&(I=U.index,R=U[0].length);return R<0?B:`${B.substring(0,I)}::${B.substring(I+R)}`},w.prototype.toString=function(){return this.toRFC5952String()},w}(),$.IPv6.broadcastAddressFromCIDR=function(w){try{const E=this.parseCIDR(w),B=E[0].toByteArray(),I=this.subnetMaskFromPrefixLength(E[1]).toByteArray(),R=[];let U=0;for(;U<16;)R.push(parseInt(B[U],10)|parseInt(I[U],10)^255),U++;return new this(R)}catch(E){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${E})`)}},$.IPv6.isIPv6=function(w){return this.parser(w)!==null},$.IPv6.isValid=function(w){if(typeof w=="string"&&w.indexOf(":")===-1)return!1;try{const E=this.parser(w);return new this(E.parts,E.zoneId),!0}catch{return!1}},$.IPv6.isValidCIDR=function(w){if(typeof w=="string"&&w.indexOf(":")===-1)return!1;try{return this.parseCIDR(w),!0}catch{return!1}},$.IPv6.networkAddressFromCIDR=function(w){let E,B,I,R,U;try{for(E=this.parseCIDR(w),I=E[0].toByteArray(),U=this.subnetMaskFromPrefixLength(E[1]).toByteArray(),R=[],B=0;B<16;)R.push(parseInt(I[B],10)&parseInt(U[B],10)),B++;return new this(R)}catch(fe){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${fe})`)}},$.IPv6.parse=function(w){const E=this.parser(w);if(E.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(E.parts,E.zoneId)},$.IPv6.parseCIDR=function(w){let E,B,I;if((B=w.match(/^(.+)\/(\d+)$/))&&(E=parseInt(B[2]),E>=0&&E<=128))return I=[this.parse(B[1]),E],Object.defineProperty(I,"toString",{value:function(){return this.join("/")}}),I;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},$.IPv6.parser=function(w){let E,B,I,R,U,fe;if(I=w.match(u.deprecatedTransitional))return this.parser(`::ffff:${I[1]}`);if(u.native.test(w))return d(w,8);if((I=w.match(u.transitional))&&(fe=I[6]||"",E=I[1],I[1].endsWith("::")||(E=E.slice(0,-1)),E=d(E+fe,6),E.parts)){for(U=[parseInt(I[2]),parseInt(I[3]),parseInt(I[4]),parseInt(I[5])],B=0;B<U.length;B++)if(R=U[B],!(0<=R&&R<=255))return null;return E.parts.push(U[0]<<8|U[1]),E.parts.push(U[2]<<8|U[3]),{parts:E.parts,zoneId:E.zoneId}}return null},$.IPv6.subnetMaskFromPrefixLength=function(w){if(w=parseInt(w),w<0||w>128)throw new Error("ipaddr: invalid IPv6 prefix length");const E=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let B=0;const I=Math.floor(w/8);for(;B<I;)E[B]=255,B++;return I<16&&(E[I]=Math.pow(2,w%8)-1<<8-w%8),new this(E)},$.fromByteArray=function(w){const E=w.length;if(E===4)return new $.IPv4(w);if(E===16)return new $.IPv6(w);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},$.isValid=function(w){return $.IPv6.isValid(w)||$.IPv4.isValid(w)},$.isValidCIDR=function(w){return $.IPv6.isValidCIDR(w)||$.IPv4.isValidCIDR(w)},$.parse=function(w){if($.IPv6.isValid(w))return $.IPv6.parse(w);if($.IPv4.isValid(w))return $.IPv4.parse(w);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},$.parseCIDR=function(w){try{return $.IPv6.parseCIDR(w)}catch{try{return $.IPv4.parseCIDR(w)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},$.process=function(w){const E=this.parse(w);return E.kind()==="ipv6"&&E.isIPv4MappedAddress()?E.toIPv4Address():E},$.subnetMatch=function(w,E,B){let I,R,U,fe;B==null&&(B="unicast");for(R in E)if(Object.prototype.hasOwnProperty.call(E,R)){for(U=E[R],U[0]&&!(U[0]instanceof Array)&&(U=[U]),I=0;I<U.length;I++)if(fe=U[I],w.kind()===fe[0].kind()&&w.match.apply(w,fe))return R}return B},r.exports?r.exports=$:e.ipaddr=$})(Ot)})(Hh);var Fh=Hh.exports;class Gh{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((i,s)=>i+ +s,0);let n=e.slice(0,8).replace(/(.{2})/g,i=>`${parseInt(i,16)}.`);return n=n.slice(0,-1),`${n}/${t}`}static toString(e){if(e.byteLength===4||e.byteLength===16){const t=new Uint8Array(e);return Fh.fromByteArray(Array.from(t)).toString()}return this.decodeIP(ve.ToHex(e))}static fromString(e){const t=Fh.parse(e);return new Uint8Array(t.toByteArray()).buffer}}var al,cl,ll;let Wt=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};f([g({type:A.TeletexString})],Wt.prototype,"teletexString",void 0),f([g({type:A.PrintableString})],Wt.prototype,"printableString",void 0),f([g({type:A.UniversalString})],Wt.prototype,"universalString",void 0),f([g({type:A.Utf8String})],Wt.prototype,"utf8String",void 0),f([g({type:A.BmpString})],Wt.prototype,"bmpString",void 0),Wt=f([z({type:V.Choice})],Wt);let Xi=class extends Wt{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?ve.ToHex(this.anyValue):super.toString())}};f([g({type:A.IA5String})],Xi.prototype,"ia5String",void 0),f([g({type:A.Any})],Xi.prototype,"anyValue",void 0),Xi=f([z({type:V.Choice})],Xi);class ta{constructor(e={}){this.type="",this.value=new Xi,Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],ta.prototype,"type",void 0),f([g({type:Xi})],ta.prototype,"value",void 0);let Qi=al=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,al.prototype)}};Qi=al=f([z({type:V.Set,itemType:ta})],Qi);let ul=cl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,cl.prototype)}};ul=cl=f([z({type:V.Sequence,itemType:Qi})],ul);let Ft=ll=class extends ul{constructor(e){super(e),Object.setPrototypeOf(this,ll.prototype)}};Ft=ll=f([z({type:V.Sequence})],Ft);const og={fromASN:r=>Gh.toString(ea.fromASN(r)),toASN:r=>ea.toASN(Gh.fromString(r))};class js{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],js.prototype,"typeId",void 0),f([g({type:A.Any,context:0})],js.prototype,"value",void 0);class fl{constructor(e={}){this.partyName=new Wt,Object.assign(this,e)}}f([g({type:Wt,optional:!0,context:0,implicit:!0})],fl.prototype,"nameAssigner",void 0),f([g({type:Wt,context:1,implicit:!0})],fl.prototype,"partyName",void 0);let De=class{constructor(e={}){Object.assign(this,e)}};f([g({type:js,context:0,implicit:!0})],De.prototype,"otherName",void 0),f([g({type:A.IA5String,context:1,implicit:!0})],De.prototype,"rfc822Name",void 0),f([g({type:A.IA5String,context:2,implicit:!0})],De.prototype,"dNSName",void 0),f([g({type:A.Any,context:3,implicit:!0})],De.prototype,"x400Address",void 0),f([g({type:Ft,context:4,implicit:!1})],De.prototype,"directoryName",void 0),f([g({type:fl,context:5})],De.prototype,"ediPartyName",void 0),f([g({type:A.IA5String,context:6,implicit:!0})],De.prototype,"uniformResourceIdentifier",void 0),f([g({type:A.OctetString,context:7,implicit:!0,converter:og})],De.prototype,"iPAddress",void 0),f([g({type:A.ObjectIdentifier,context:8,implicit:!0})],De.prototype,"registeredID",void 0),De=f([z({type:V.Choice})],De);const hl="1.3.6.1.5.5.7",ag=`${hl}.1`,es=`${hl}.3`,ra=`${hl}.48`,zh=`${ra}.1`,Kh=`${ra}.2`,Zh=`${ra}.3`,Wh=`${ra}.5`,Vn="2.5.29";var dl;const pl=`${ag}.1`;class Ps{constructor(e={}){this.accessMethod="",this.accessLocation=new De,Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],Ps.prototype,"accessMethod",void 0),f([g({type:De})],Ps.prototype,"accessLocation",void 0);let ts=dl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,dl.prototype)}};ts=dl=f([z({type:V.Sequence,itemType:Ps})],ts);const na=`${Vn}.35`;class yl extends nt{}class Ai{constructor(e={}){e&&Object.assign(this,e)}}f([g({type:yl,context:0,optional:!0,implicit:!0})],Ai.prototype,"keyIdentifier",void 0),f([g({type:De,context:1,optional:!0,implicit:!0,repeated:"sequence"})],Ai.prototype,"authorityCertIssuer",void 0),f([g({type:A.Integer,context:2,optional:!0,implicit:!0,converter:St})],Ai.prototype,"authorityCertSerialNumber",void 0);const qh=`${Vn}.19`;class ia{constructor(e={}){this.cA=!1,Object.assign(this,e)}}f([g({type:A.Boolean,defaultValue:!1})],ia.prototype,"cA",void 0),f([g({type:A.Integer,optional:!0})],ia.prototype,"pathLenConstraint",void 0);var gl;let cr=gl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,gl.prototype)}};cr=gl=f([z({type:V.Sequence,itemType:De})],cr);var vl;let Yh=vl=class extends cr{constructor(e){super(e),Object.setPrototypeOf(this,vl.prototype)}};Yh=vl=f([z({type:V.Sequence})],Yh);var ml;const Jh=`${Vn}.32`;let In=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};f([g({type:A.IA5String})],In.prototype,"ia5String",void 0),f([g({type:A.VisibleString})],In.prototype,"visibleString",void 0),f([g({type:A.BmpString})],In.prototype,"bmpString",void 0),f([g({type:A.Utf8String})],In.prototype,"utf8String",void 0),In=f([z({type:V.Choice})],In);class wl{constructor(e={}){this.organization=new In,this.noticeNumbers=[],Object.assign(this,e)}}f([g({type:In})],wl.prototype,"organization",void 0),f([g({type:A.Integer,repeated:"sequence"})],wl.prototype,"noticeNumbers",void 0);class bl{constructor(e={}){Object.assign(this,e)}}f([g({type:wl,optional:!0})],bl.prototype,"noticeRef",void 0),f([g({type:In,optional:!0})],bl.prototype,"explicitText",void 0);let sa=class{constructor(e={}){Object.assign(this,e)}};f([g({type:A.IA5String})],sa.prototype,"cPSuri",void 0),f([g({type:bl})],sa.prototype,"userNotice",void 0),sa=f([z({type:V.Choice})],sa);class xl{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],xl.prototype,"policyQualifierId",void 0),f([g({type:A.Any})],xl.prototype,"qualifier",void 0);class oa{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],oa.prototype,"policyIdentifier",void 0),f([g({type:xl,repeated:"sequence",optional:!0})],oa.prototype,"policyQualifiers",void 0);let aa=ml=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,ml.prototype)}};aa=ml=f([z({type:V.Sequence,itemType:oa})],aa);let ca=class{constructor(e=0){this.value=e}};f([g({type:A.Integer})],ca.prototype,"value",void 0),ca=f([z({type:V.Choice})],ca);let Xh=class extends ca{};Xh=f([z({type:V.Choice})],Xh);var Al;const Sl=`${Vn}.31`;var Hr;(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"})(Hr||(Hr={}));class Qh extends Qo{toJSON(){const e=[],t=this.toNumber();return t&Hr.aACompromise&&e.push("aACompromise"),t&Hr.affiliationChanged&&e.push("affiliationChanged"),t&Hr.cACompromise&&e.push("cACompromise"),t&Hr.certificateHold&&e.push("certificateHold"),t&Hr.cessationOfOperation&&e.push("cessationOfOperation"),t&Hr.keyCompromise&&e.push("keyCompromise"),t&Hr.privilegeWithdrawn&&e.push("privilegeWithdrawn"),t&Hr.superseded&&e.push("superseded"),t&Hr.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let Si=class{constructor(e={}){Object.assign(this,e)}};f([g({type:De,context:0,repeated:"sequence",implicit:!0})],Si.prototype,"fullName",void 0),f([g({type:Qi,context:1,implicit:!0})],Si.prototype,"nameRelativeToCRLIssuer",void 0),Si=f([z({type:V.Choice})],Si);class rs{constructor(e={}){Object.assign(this,e)}}f([g({type:Si,context:0,optional:!0})],rs.prototype,"distributionPoint",void 0),f([g({type:Qh,context:1,optional:!0,implicit:!0})],rs.prototype,"reasons",void 0),f([g({type:De,context:2,optional:!0,repeated:"sequence",implicit:!0})],rs.prototype,"cRLIssuer",void 0);let ns=Al=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Al.prototype)}};ns=Al=f([z({type:V.Sequence,itemType:rs})],ns);var _l;let ed=_l=class extends ns{constructor(e){super(e),Object.setPrototypeOf(this,_l.prototype)}};ed=_l=f([z({type:V.Sequence,itemType:rs})],ed);class er{constructor(e={}){this.onlyContainsUserCerts=er.ONLY,this.onlyContainsCACerts=er.ONLY,this.indirectCRL=er.ONLY,this.onlyContainsAttributeCerts=er.ONLY,Object.assign(this,e)}}er.ONLY=!1,f([g({type:Si,context:0,optional:!0})],er.prototype,"distributionPoint",void 0),f([g({type:A.Boolean,context:1,defaultValue:er.ONLY,implicit:!0})],er.prototype,"onlyContainsUserCerts",void 0),f([g({type:A.Boolean,context:2,defaultValue:er.ONLY,implicit:!0})],er.prototype,"onlyContainsCACerts",void 0),f([g({type:Qh,context:3,optional:!0,implicit:!0})],er.prototype,"onlySomeReasons",void 0),f([g({type:A.Boolean,context:4,defaultValue:er.ONLY,implicit:!0})],er.prototype,"indirectCRL",void 0),f([g({type:A.Boolean,context:5,defaultValue:er.ONLY,implicit:!0})],er.prototype,"onlyContainsAttributeCerts",void 0);var Us;(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"})(Us||(Us={}));let El=class{constructor(e=Us.unspecified){this.reason=Us.unspecified,this.reason=e}toJSON(){return Us[this.reason]}toString(){return this.toJSON()}};f([g({type:A.Enumerated})],El.prototype,"reason",void 0),El=f([z({type:V.Choice})],El);var kl;const td=`${Vn}.37`;let la=kl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,kl.prototype)}};la=kl=f([z({type:V.Sequence,itemType:A.ObjectIdentifier})],la);const cg=`${es}.1`,lg=`${es}.2`,ug=`${es}.3`,fg=`${es}.4`,hg=`${es}.8`,dg=`${es}.9`;let Il=class{constructor(e=new ArrayBuffer(0)){this.value=e}};f([g({type:A.Integer,converter:St})],Il.prototype,"value",void 0),Il=f([z({type:V.Choice})],Il);let Cl=class{constructor(e){this.value=new Date,e&&(this.value=e)}};f([g({type:A.GeneralizedTime})],Cl.prototype,"value",void 0),Cl=f([z({type:V.Choice})],Cl);var Bl;let rd=Bl=class extends cr{constructor(e){super(e),Object.setPrototypeOf(this,Bl.prototype)}};rd=Bl=f([z({type:V.Sequence})],rd);const nd=`${Vn}.15`;var Fr;(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"})(Fr||(Fr={}));class Ol extends Qo{toJSON(){const e=this.toNumber(),t=[];return e&Fr.cRLSign&&t.push("crlSign"),e&Fr.dataEncipherment&&t.push("dataEncipherment"),e&Fr.decipherOnly&&t.push("decipherOnly"),e&Fr.digitalSignature&&t.push("digitalSignature"),e&Fr.encipherOnly&&t.push("encipherOnly"),e&Fr.keyAgreement&&t.push("keyAgreement"),e&Fr.keyCertSign&&t.push("keyCertSign"),e&Fr.keyEncipherment&&t.push("keyEncipherment"),e&Fr.nonRepudiation&&t.push("nonRepudiation"),t}toString(){return`[${this.toJSON().join(", ")}]`}}var Tl;class ua{constructor(e={}){this.base=new De,this.minimum=0,Object.assign(this,e)}}f([g({type:De})],ua.prototype,"base",void 0),f([g({type:A.Integer,context:0,defaultValue:0,implicit:!0})],ua.prototype,"minimum",void 0),f([g({type:A.Integer,context:1,optional:!0,implicit:!0})],ua.prototype,"maximum",void 0);let fa=Tl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Tl.prototype)}};fa=Tl=f([z({type:V.Sequence,itemType:ua})],fa);class id{constructor(e={}){Object.assign(this,e)}}f([g({type:fa,context:0,optional:!0,implicit:!0})],id.prototype,"permittedSubtrees",void 0),f([g({type:fa,context:1,optional:!0,implicit:!0})],id.prototype,"excludedSubtrees",void 0);class sd{constructor(e={}){Object.assign(this,e)}}f([g({type:A.Integer,context:0,implicit:!0,optional:!0,converter:St})],sd.prototype,"requireExplicitPolicy",void 0),f([g({type:A.Integer,context:1,implicit:!0,optional:!0,converter:St})],sd.prototype,"inhibitPolicyMapping",void 0);var Nl;class Rl{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],Rl.prototype,"issuerDomainPolicy",void 0),f([g({type:A.ObjectIdentifier})],Rl.prototype,"subjectDomainPolicy",void 0);let od=Nl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Nl.prototype)}};od=Nl=f([z({type:V.Sequence,itemType:Rl})],od);var jl;const Pl=`${Vn}.17`;let Ul=jl=class extends cr{constructor(e){super(e),Object.setPrototypeOf(this,jl.prototype)}};Ul=jl=f([z({type:V.Sequence})],Ul);let Cn=class{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};f([g({type:A.ObjectIdentifier})],Cn.prototype,"type",void 0),f([g({type:A.Any,repeated:"set"})],Cn.prototype,"values",void 0);var Dl;let ad=Dl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Dl.prototype)}};ad=Dl=f([z({type:V.Sequence,itemType:Cn})],ad);const $l=`${Vn}.14`;class Ln extends yl{}class cd{constructor(e={}){Object.assign(this,e)}}f([g({type:A.GeneralizedTime,context:0,implicit:!0,optional:!0})],cd.prototype,"notBefore",void 0),f([g({type:A.GeneralizedTime,context:1,implicit:!0,optional:!0})],cd.prototype,"notAfter",void 0);var Ds;(function(r){r[r.keyUpdateAllowed=1]="keyUpdateAllowed",r[r.newExtensions=2]="newExtensions",r[r.pKIXCertificate=4]="pKIXCertificate"})(Ds||(Ds={}));class ld extends Qo{toJSON(){const e=[],t=this.toNumber();return t&Ds.pKIXCertificate&&e.push("pKIXCertificate"),t&Ds.newExtensions&&e.push("newExtensions"),t&Ds.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class ud{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new ld,Object.assign(this,e)}}f([g({type:A.GeneralString})],ud.prototype,"entrustVers",void 0),f([g({type:ld})],ud.prototype,"entrustInfoFlags",void 0);var Ml;let fd=Ml=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Ml.prototype)}};fd=Ml=f([z({type:V.Sequence,itemType:Ps})],fd);class le{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof le&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&jo(e.parameters,this.parameters)||e.parameters===this.parameters)}}f([g({type:A.ObjectIdentifier})],le.prototype,"algorithm",void 0),f([g({type:A.Any,optional:!0})],le.prototype,"parameters",void 0);class nn{constructor(e={}){this.algorithm=new le,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:le})],nn.prototype,"algorithm",void 0),f([g({type:A.BitString})],nn.prototype,"subjectPublicKey",void 0);let qt=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}};f([g({type:A.UTCTime})],qt.prototype,"utcTime",void 0),f([g({type:A.GeneralizedTime})],qt.prototype,"generalTime",void 0),qt=f([z({type:V.Choice})],qt);class ha{constructor(e){this.notBefore=new qt(new Date),this.notAfter=new qt(new Date),e&&(this.notBefore=new qt(e.notBefore),this.notAfter=new qt(e.notAfter))}}f([g({type:qt})],ha.prototype,"notBefore",void 0),f([g({type:qt})],ha.prototype,"notAfter",void 0);var Vl;let Gr=class Y0{constructor(e={}){this.extnID="",this.critical=Y0.CRITICAL,this.extnValue=new nt,Object.assign(this,e)}};Gr.CRITICAL=!1,f([g({type:A.ObjectIdentifier})],Gr.prototype,"extnID",void 0),f([g({type:A.Boolean,defaultValue:Gr.CRITICAL})],Gr.prototype,"critical",void 0),f([g({type:nt})],Gr.prototype,"extnValue",void 0);let _i=Vl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Vl.prototype)}};_i=Vl=f([z({type:V.Sequence,itemType:Gr})],_i);var is;(function(r){r[r.v1=0]="v1",r[r.v2=1]="v2",r[r.v3=2]="v3"})(is||(is={}));class jr{constructor(e={}){this.version=is.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new le,this.issuer=new Ft,this.validity=new ha,this.subject=new Ft,this.subjectPublicKeyInfo=new nn,Object.assign(this,e)}}f([g({type:A.Integer,context:0,defaultValue:is.v1})],jr.prototype,"version",void 0),f([g({type:A.Integer,converter:St})],jr.prototype,"serialNumber",void 0),f([g({type:le})],jr.prototype,"signature",void 0),f([g({type:Ft})],jr.prototype,"issuer",void 0),f([g({type:ha})],jr.prototype,"validity",void 0),f([g({type:Ft})],jr.prototype,"subject",void 0),f([g({type:nn})],jr.prototype,"subjectPublicKeyInfo",void 0),f([g({type:A.BitString,context:1,implicit:!0,optional:!0})],jr.prototype,"issuerUniqueID",void 0),f([g({type:A.BitString,context:2,implicit:!0,optional:!0})],jr.prototype,"subjectUniqueID",void 0),f([g({type:_i,context:3,optional:!0})],jr.prototype,"extensions",void 0);class Ei{constructor(e={}){this.tbsCertificate=new jr,this.signatureAlgorithm=new le,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:jr})],Ei.prototype,"tbsCertificate",void 0),f([g({type:le})],Ei.prototype,"signatureAlgorithm",void 0),f([g({type:A.BitString})],Ei.prototype,"signatureValue",void 0);class da{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new qt,Object.assign(this,e)}}f([g({type:A.Integer,converter:St})],da.prototype,"userCertificate",void 0),f([g({type:qt})],da.prototype,"revocationDate",void 0),f([g({type:Gr,optional:!0,repeated:"sequence"})],da.prototype,"crlEntryExtensions",void 0);class Bn{constructor(e={}){this.signature=new le,this.issuer=new Ft,this.thisUpdate=new qt,Object.assign(this,e)}}f([g({type:A.Integer,optional:!0})],Bn.prototype,"version",void 0),f([g({type:le})],Bn.prototype,"signature",void 0),f([g({type:Ft})],Bn.prototype,"issuer",void 0),f([g({type:qt})],Bn.prototype,"thisUpdate",void 0),f([g({type:qt,optional:!0})],Bn.prototype,"nextUpdate",void 0),f([g({type:da,repeated:"sequence",optional:!0})],Bn.prototype,"revokedCertificates",void 0),f([g({type:Gr,optional:!0,context:0,repeated:"sequence"})],Bn.prototype,"crlExtensions",void 0);class Ll{constructor(e={}){this.tbsCertList=new Bn,this.signatureAlgorithm=new le,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:Bn})],Ll.prototype,"tbsCertList",void 0),f([g({type:le})],Ll.prototype,"signatureAlgorithm",void 0),f([g({type:A.BitString})],Ll.prototype,"signature",void 0);class ss{constructor(e={}){this.issuer=new Ft,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:Ft})],ss.prototype,"issuer",void 0),f([g({type:A.Integer,converter:St})],ss.prototype,"serialNumber",void 0);let os=class{constructor(e={}){Object.assign(this,e)}};f([g({type:Ln,context:0,implicit:!0})],os.prototype,"subjectKeyIdentifier",void 0),f([g({type:ss})],os.prototype,"issuerAndSerialNumber",void 0),os=f([z({type:V.Choice})],os);var sn;(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"})(sn||(sn={}));let $s=class extends le{};$s=f([z({type:V.Sequence})],$s);let pa=class extends le{};pa=f([z({type:V.Sequence})],pa);let on=class extends le{};on=f([z({type:V.Sequence})],on);let ya=class extends le{};ya=f([z({type:V.Sequence})],ya);let hd=class extends le{};hd=f([z({type:V.Sequence})],hd);let Hl=class extends le{};Hl=f([z({type:V.Sequence})],Hl);let as=class{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};f([g({type:A.ObjectIdentifier})],as.prototype,"attrType",void 0),f([g({type:A.Any,repeated:"set"})],as.prototype,"attrValues",void 0);var Fl;class an{constructor(e={}){this.version=sn.v0,this.sid=new os,this.digestAlgorithm=new $s,this.signatureAlgorithm=new pa,this.signature=new nt,Object.assign(this,e)}}f([g({type:A.Integer})],an.prototype,"version",void 0),f([g({type:os})],an.prototype,"sid",void 0),f([g({type:$s})],an.prototype,"digestAlgorithm",void 0),f([g({type:as,repeated:"set",context:0,implicit:!0,optional:!0})],an.prototype,"signedAttrs",void 0),f([g({type:pa})],an.prototype,"signatureAlgorithm",void 0),f([g({type:nt})],an.prototype,"signature",void 0),f([g({type:as,repeated:"set",context:1,implicit:!0,optional:!0})],an.prototype,"unsignedAttrs",void 0);let ga=Fl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Fl.prototype)}};ga=Fl=f([z({type:V.Set,itemType:an})],ga);let dd=class extends qt{};dd=f([z({type:V.Choice})],dd);let pd=class extends an{};pd=f([z({type:V.Sequence})],pd);class Gl{constructor(e={}){this.acIssuer=new De,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}f([g({type:De})],Gl.prototype,"acIssuer",void 0),f([g({type:A.Integer})],Gl.prototype,"acSerial",void 0),f([g({type:Cn,repeated:"sequence"})],Gl.prototype,"attrs",void 0);var zl;let va=zl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,zl.prototype)}};va=zl=f([z({type:V.Sequence,itemType:A.ObjectIdentifier})],va);class ma{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}f([g({type:A.Integer,optional:!0})],ma.prototype,"pathLenConstraint",void 0),f([g({type:va,implicit:!0,context:0,optional:!0})],ma.prototype,"permittedAttrs",void 0),f([g({type:va,implicit:!0,context:1,optional:!0})],ma.prototype,"excludedAttrs",void 0),f([g({type:A.Boolean,defaultValue:!0})],ma.prototype,"permitUnSpecified",void 0);class ki{constructor(e={}){this.issuer=new cr,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:cr})],ki.prototype,"issuer",void 0),f([g({type:A.Integer,converter:St})],ki.prototype,"serial",void 0),f([g({type:A.BitString,optional:!0})],ki.prototype,"issuerUID",void 0);var Kl;(function(r){r[r.publicKey=0]="publicKey",r[r.publicKeyCert=1]="publicKeyCert",r[r.otherObjectTypes=2]="otherObjectTypes"})(Kl||(Kl={}));class Ii{constructor(e={}){this.digestedObjectType=Kl.publicKey,this.digestAlgorithm=new le,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.Enumerated})],Ii.prototype,"digestedObjectType",void 0),f([g({type:A.ObjectIdentifier,optional:!0})],Ii.prototype,"otherObjectTypeID",void 0),f([g({type:le})],Ii.prototype,"digestAlgorithm",void 0),f([g({type:A.BitString})],Ii.prototype,"objectDigest",void 0);class wa{constructor(e={}){Object.assign(this,e)}}f([g({type:cr,optional:!0})],wa.prototype,"issuerName",void 0),f([g({type:ki,context:0,implicit:!0,optional:!0})],wa.prototype,"baseCertificateID",void 0),f([g({type:Ii,context:1,implicit:!0,optional:!0})],wa.prototype,"objectDigestInfo",void 0);let cs=class{constructor(e={}){Object.assign(this,e)}};f([g({type:De,repeated:"sequence"})],cs.prototype,"v1Form",void 0),f([g({type:wa,context:0,implicit:!0})],cs.prototype,"v2Form",void 0),cs=f([z({type:V.Choice})],cs);class ba{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}f([g({type:A.GeneralizedTime})],ba.prototype,"notBeforeTime",void 0),f([g({type:A.GeneralizedTime})],ba.prototype,"notAfterTime",void 0);class Ms{constructor(e={}){Object.assign(this,e)}}f([g({type:ki,implicit:!0,context:0,optional:!0})],Ms.prototype,"baseCertificateID",void 0),f([g({type:cr,implicit:!0,context:1,optional:!0})],Ms.prototype,"entityName",void 0),f([g({type:Ii,implicit:!0,context:2,optional:!0})],Ms.prototype,"objectDigestInfo",void 0);var Zl;(function(r){r[r.v2=1]="v2"})(Zl||(Zl={}));class zr{constructor(e={}){this.version=Zl.v2,this.holder=new Ms,this.issuer=new cs,this.signature=new le,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new ba,this.attributes=[],Object.assign(this,e)}}f([g({type:A.Integer})],zr.prototype,"version",void 0),f([g({type:Ms})],zr.prototype,"holder",void 0),f([g({type:cs})],zr.prototype,"issuer",void 0),f([g({type:le})],zr.prototype,"signature",void 0),f([g({type:A.Integer,converter:St})],zr.prototype,"serialNumber",void 0),f([g({type:ba})],zr.prototype,"attrCertValidityPeriod",void 0),f([g({type:Cn,repeated:"sequence"})],zr.prototype,"attributes",void 0),f([g({type:A.BitString,optional:!0})],zr.prototype,"issuerUniqueID",void 0),f([g({type:_i,optional:!0})],zr.prototype,"extensions",void 0);class xa{constructor(e={}){this.acinfo=new zr,this.signatureAlgorithm=new le,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:zr})],xa.prototype,"acinfo",void 0),f([g({type:le})],xa.prototype,"signatureAlgorithm",void 0),f([g({type:A.BitString})],xa.prototype,"signatureValue",void 0);var Aa;(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"})(Aa||(Aa={}));class Wl extends Qo{}class ql{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier,implicit:!0,context:0})],ql.prototype,"type",void 0),f([g({type:A.Any,implicit:!0,context:1})],ql.prototype,"value",void 0);class Yl{constructor(e={}){this.policyId="",this.classList=new Wl(Aa.unclassified),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],Yl.prototype,"policyId",void 0),f([g({type:Wl,defaultValue:new Wl(Aa.unclassified)})],Yl.prototype,"classList",void 0),f([g({type:ql,repeated:"set"})],Yl.prototype,"securityCategories",void 0);class Sa{constructor(e={}){Object.assign(this,e)}}f([g({type:nt})],Sa.prototype,"cotets",void 0),f([g({type:A.ObjectIdentifier})],Sa.prototype,"oid",void 0),f([g({type:A.Utf8String})],Sa.prototype,"string",void 0);class yd{constructor(e={}){this.values=[],Object.assign(this,e)}}f([g({type:cr,implicit:!0,context:0,optional:!0})],yd.prototype,"policyAuthority",void 0),f([g({type:Sa,repeated:"sequence"})],yd.prototype,"values",void 0);var Jl;class _a{constructor(e={}){this.targetCertificate=new ki,Object.assign(this,e)}}f([g({type:ki})],_a.prototype,"targetCertificate",void 0),f([g({type:De,optional:!0})],_a.prototype,"targetName",void 0),f([g({type:Ii,optional:!0})],_a.prototype,"certDigestInfo",void 0);let ls=class{constructor(e={}){Object.assign(this,e)}};f([g({type:De,context:0,implicit:!0})],ls.prototype,"targetName",void 0),f([g({type:De,context:1,implicit:!0})],ls.prototype,"targetGroup",void 0),f([g({type:_a,context:2,implicit:!0})],ls.prototype,"targetCert",void 0),ls=f([z({type:V.Choice})],ls);let Xl=Jl=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Jl.prototype)}};Xl=Jl=f([z({type:V.Sequence,itemType:ls})],Xl);var Ql;let gd=Ql=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Ql.prototype)}};gd=Ql=f([z({type:V.Sequence,itemType:Xl})],gd);class vd{constructor(e={}){Object.assign(this,e)}}f([g({type:cr,implicit:!0,context:0,optional:!0})],vd.prototype,"roleAuthority",void 0),f([g({type:De,implicit:!0,context:1})],vd.prototype,"roleName",void 0);class eu{constructor(e={}){this.service=new De,this.ident=new De,Object.assign(this,e)}}f([g({type:De})],eu.prototype,"service",void 0),f([g({type:De})],eu.prototype,"ident",void 0),f([g({type:nt,optional:!0})],eu.prototype,"authInfo",void 0);var tu;class ru{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],ru.prototype,"otherCertFormat",void 0),f([g({type:A.Any})],ru.prototype,"otherCert",void 0);let Ci=class{constructor(e={}){Object.assign(this,e)}};f([g({type:Ei})],Ci.prototype,"certificate",void 0),f([g({type:xa,context:2,implicit:!0})],Ci.prototype,"v2AttrCert",void 0),f([g({type:ru,context:3,implicit:!0})],Ci.prototype,"other",void 0),Ci=f([z({type:V.Choice})],Ci);let Vs=tu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,tu.prototype)}};Vs=tu=f([z({type:V.Set,itemType:Ci})],Vs);class On{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],On.prototype,"contentType",void 0),f([g({type:A.Any,context:0})],On.prototype,"content",void 0);let us=class{constructor(e={}){Object.assign(this,e)}};f([g({type:nt})],us.prototype,"single",void 0),f([g({type:A.Any})],us.prototype,"any",void 0),us=f([z({type:V.Choice})],us);class Ea{constructor(e={}){this.eContentType="",Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],Ea.prototype,"eContentType",void 0),f([g({type:us,context:0,optional:!0})],Ea.prototype,"eContent",void 0);let Ls=class{constructor(e={}){Object.assign(this,e)}};f([g({type:nt,context:0,implicit:!0,optional:!0})],Ls.prototype,"value",void 0),f([g({type:nt,converter:Hy,context:0,implicit:!0,optional:!0,repeated:"sequence"})],Ls.prototype,"constructedValue",void 0),Ls=f([z({type:V.Choice})],Ls);class Hs{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new ya,Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],Hs.prototype,"contentType",void 0),f([g({type:ya})],Hs.prototype,"contentEncryptionAlgorithm",void 0),f([g({type:Ls,optional:!0})],Hs.prototype,"encryptedContent",void 0);class ka{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],ka.prototype,"keyAttrId",void 0),f([g({type:A.Any,optional:!0})],ka.prototype,"keyAttr",void 0);var nu;class Ia{constructor(e={}){this.subjectKeyIdentifier=new Ln,Object.assign(this,e)}}f([g({type:Ln})],Ia.prototype,"subjectKeyIdentifier",void 0),f([g({type:A.GeneralizedTime,optional:!0})],Ia.prototype,"date",void 0),f([g({type:ka,optional:!0})],Ia.prototype,"other",void 0);let fs=class{constructor(e={}){Object.assign(this,e)}};f([g({type:Ia,context:0,implicit:!0,optional:!0})],fs.prototype,"rKeyId",void 0),f([g({type:ss,optional:!0})],fs.prototype,"issuerAndSerialNumber",void 0),fs=f([z({type:V.Choice})],fs);class iu{constructor(e={}){this.rid=new fs,this.encryptedKey=new nt,Object.assign(this,e)}}f([g({type:fs})],iu.prototype,"rid",void 0),f([g({type:nt})],iu.prototype,"encryptedKey",void 0);let Ca=nu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,nu.prototype)}};Ca=nu=f([z({type:V.Sequence,itemType:iu})],Ca);class su{constructor(e={}){this.algorithm=new le,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:le})],su.prototype,"algorithm",void 0),f([g({type:A.BitString})],su.prototype,"publicKey",void 0);let Bi=class{constructor(e={}){Object.assign(this,e)}};f([g({type:Ln,context:0,implicit:!0,optional:!0})],Bi.prototype,"subjectKeyIdentifier",void 0),f([g({type:su,context:1,implicit:!0,optional:!0})],Bi.prototype,"originatorKey",void 0),f([g({type:ss,optional:!0})],Bi.prototype,"issuerAndSerialNumber",void 0),Bi=f([z({type:V.Choice})],Bi);class hs{constructor(e={}){this.version=sn.v3,this.originator=new Bi,this.keyEncryptionAlgorithm=new on,this.recipientEncryptedKeys=new Ca,Object.assign(this,e)}}f([g({type:A.Integer})],hs.prototype,"version",void 0),f([g({type:Bi,context:0})],hs.prototype,"originator",void 0),f([g({type:nt,context:1,optional:!0})],hs.prototype,"ukm",void 0),f([g({type:on})],hs.prototype,"keyEncryptionAlgorithm",void 0),f([g({type:Ca})],hs.prototype,"recipientEncryptedKeys",void 0);let ds=class{constructor(e={}){Object.assign(this,e)}};f([g({type:Ln,context:0,implicit:!0})],ds.prototype,"subjectKeyIdentifier",void 0),f([g({type:ss})],ds.prototype,"issuerAndSerialNumber",void 0),ds=f([z({type:V.Choice})],ds);class Fs{constructor(e={}){this.version=sn.v0,this.rid=new ds,this.keyEncryptionAlgorithm=new on,this.encryptedKey=new nt,Object.assign(this,e)}}f([g({type:A.Integer})],Fs.prototype,"version",void 0),f([g({type:ds})],Fs.prototype,"rid",void 0),f([g({type:on})],Fs.prototype,"keyEncryptionAlgorithm",void 0),f([g({type:nt})],Fs.prototype,"encryptedKey",void 0);class Gs{constructor(e={}){this.keyIdentifier=new nt,Object.assign(this,e)}}f([g({type:nt})],Gs.prototype,"keyIdentifier",void 0),f([g({type:A.GeneralizedTime,optional:!0})],Gs.prototype,"date",void 0),f([g({type:ka,optional:!0})],Gs.prototype,"other",void 0);class zs{constructor(e={}){this.version=sn.v4,this.kekid=new Gs,this.keyEncryptionAlgorithm=new on,this.encryptedKey=new nt,Object.assign(this,e)}}f([g({type:A.Integer})],zs.prototype,"version",void 0),f([g({type:Gs})],zs.prototype,"kekid",void 0),f([g({type:on})],zs.prototype,"keyEncryptionAlgorithm",void 0),f([g({type:nt})],zs.prototype,"encryptedKey",void 0);class Ks{constructor(e={}){this.version=sn.v0,this.keyEncryptionAlgorithm=new on,this.encryptedKey=new nt,Object.assign(this,e)}}f([g({type:A.Integer})],Ks.prototype,"version",void 0),f([g({type:Hl,context:0,optional:!0})],Ks.prototype,"keyDerivationAlgorithm",void 0),f([g({type:on})],Ks.prototype,"keyEncryptionAlgorithm",void 0),f([g({type:nt})],Ks.prototype,"encryptedKey",void 0);class ou{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],ou.prototype,"oriType",void 0),f([g({type:A.Any})],ou.prototype,"oriValue",void 0);let Hn=class{constructor(e={}){Object.assign(this,e)}};f([g({type:Fs,optional:!0})],Hn.prototype,"ktri",void 0),f([g({type:hs,context:1,implicit:!0,optional:!0})],Hn.prototype,"kari",void 0),f([g({type:zs,context:2,implicit:!0,optional:!0})],Hn.prototype,"kekri",void 0),f([g({type:Ks,context:3,implicit:!0,optional:!0})],Hn.prototype,"pwri",void 0),f([g({type:ou,context:4,implicit:!0,optional:!0})],Hn.prototype,"ori",void 0),Hn=f([z({type:V.Choice})],Hn);var au;let Ba=au=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,au.prototype)}};Ba=au=f([z({type:V.Set,itemType:Hn})],Ba);var cu;class Oa{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],Oa.prototype,"otherRevInfoFormat",void 0),f([g({type:A.Any})],Oa.prototype,"otherRevInfo",void 0);let Ta=class{constructor(e={}){this.other=new Oa,Object.assign(this,e)}};f([g({type:Oa,context:1,implicit:!0})],Ta.prototype,"other",void 0),Ta=f([z({type:V.Choice})],Ta);let Na=cu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,cu.prototype)}};Na=cu=f([z({type:V.Set,itemType:Ta})],Na);class lu{constructor(e={}){Object.assign(this,e)}}f([g({type:Vs,context:0,implicit:!0,optional:!0})],lu.prototype,"certs",void 0),f([g({type:Na,context:1,implicit:!0,optional:!0})],lu.prototype,"crls",void 0);var uu;let fu=uu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,uu.prototype)}};fu=uu=f([z({type:V.Set,itemType:as})],fu);class Zs{constructor(e={}){this.version=sn.v0,this.recipientInfos=new Ba,this.encryptedContentInfo=new Hs,Object.assign(this,e)}}f([g({type:A.Integer})],Zs.prototype,"version",void 0),f([g({type:lu,context:0,implicit:!0,optional:!0})],Zs.prototype,"originatorInfo",void 0),f([g({type:Ba})],Zs.prototype,"recipientInfos",void 0),f([g({type:Hs})],Zs.prototype,"encryptedContentInfo",void 0),f([g({type:fu,context:1,implicit:!0,optional:!0})],Zs.prototype,"unprotectedAttrs",void 0);const pg="1.2.840.113549.1.7.1",hu="1.2.840.113549.1.7.2";var du;let Ra=du=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,du.prototype)}};Ra=du=f([z({type:V.Set,itemType:$s})],Ra);class Tn{constructor(e={}){this.version=sn.v0,this.digestAlgorithms=new Ra,this.encapContentInfo=new Ea,this.signerInfos=new ga,Object.assign(this,e)}}f([g({type:A.Integer})],Tn.prototype,"version",void 0),f([g({type:Ra})],Tn.prototype,"digestAlgorithms",void 0),f([g({type:Ea})],Tn.prototype,"encapContentInfo",void 0),f([g({type:Vs,context:0,implicit:!0,optional:!0})],Tn.prototype,"certificates",void 0),f([g({type:Na,context:1,implicit:!0,optional:!0})],Tn.prototype,"crls",void 0),f([g({type:ga})],Tn.prototype,"signerInfos",void 0);const Ws="1.2.840.10045.2.1",pu="1.2.840.10045.4.1",md="1.2.840.10045.4.3.1",yu="1.2.840.10045.4.3.2",gu="1.2.840.10045.4.3.3",vu="1.2.840.10045.4.3.4",wd="1.2.840.10045.3.1.7",bd="1.3.132.0.34",xd="1.3.132.0.35";function qs(r){return new le({algorithm:r})}const yg=qs(pu);qs(md);const gg=qs(yu),vg=qs(gu),mg=qs(vu);let Ys=class{constructor(e={}){Object.assign(this,e)}};f([g({type:A.ObjectIdentifier})],Ys.prototype,"fieldType",void 0),f([g({type:A.Any})],Ys.prototype,"parameters",void 0),Ys=f([z({type:V.Sequence})],Ys);class wg extends nt{}let ps=class{constructor(e={}){Object.assign(this,e)}};f([g({type:A.OctetString})],ps.prototype,"a",void 0),f([g({type:A.OctetString})],ps.prototype,"b",void 0),f([g({type:A.BitString,optional:!0})],ps.prototype,"seed",void 0),ps=f([z({type:V.Sequence})],ps);var mu;(function(r){r[r.ecpVer1=1]="ecpVer1"})(mu||(mu={}));let Nn=class{constructor(e={}){this.version=mu.ecpVer1,Object.assign(this,e)}};f([g({type:A.Integer})],Nn.prototype,"version",void 0),f([g({type:Ys})],Nn.prototype,"fieldID",void 0),f([g({type:ps})],Nn.prototype,"curve",void 0),f([g({type:wg})],Nn.prototype,"base",void 0),f([g({type:A.Integer,converter:St})],Nn.prototype,"order",void 0),f([g({type:A.Integer,optional:!0})],Nn.prototype,"cofactor",void 0),Nn=f([z({type:V.Sequence})],Nn);let Fn=class{constructor(e={}){Object.assign(this,e)}};f([g({type:A.ObjectIdentifier})],Fn.prototype,"namedCurve",void 0),f([g({type:A.Null})],Fn.prototype,"implicitCurve",void 0),f([g({type:Nn})],Fn.prototype,"specifiedCurve",void 0),Fn=f([z({type:V.Choice})],Fn);class ja{constructor(e={}){this.version=1,this.privateKey=new nt,Object.assign(this,e)}}f([g({type:A.Integer})],ja.prototype,"version",void 0),f([g({type:nt})],ja.prototype,"privateKey",void 0),f([g({type:Fn,context:0,optional:!0})],ja.prototype,"parameters",void 0),f([g({type:A.BitString,context:1,optional:!0})],ja.prototype,"publicKey",void 0);class Pa{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.Integer,converter:St})],Pa.prototype,"r",void 0),f([g({type:A.Integer,converter:St})],Pa.prototype,"s",void 0);const vr="1.2.840.113549.1.1",Oi=`${vr}.1`,bg=`${vr}.7`,xg=`${vr}.9`,Js=`${vr}.10`,Ag=`${vr}.2`,Sg=`${vr}.4`,Ua=`${vr}.5`,_g=`${vr}.14`,wu=`${vr}.11`,Da=`${vr}.12`,$a=`${vr}.13`,Ad=`${vr}.15`,Sd=`${vr}.16`,Ma="1.3.14.3.2.26",_d="2.16.840.1.101.3.4.2.4",Va="2.16.840.1.101.3.4.2.1",La="2.16.840.1.101.3.4.2.2",Ha="2.16.840.1.101.3.4.2.3",Eg="2.16.840.1.101.3.4.2.5",kg="2.16.840.1.101.3.4.2.6",Ig="1.2.840.113549.2.2",Cg="1.2.840.113549.2.5",Fa=`${vr}.8`;function Gt(r){return new le({algorithm:r,parameters:null})}Gt(Ig),Gt(Cg);const Ti=Gt(Ma);Gt(_d),Gt(Va),Gt(La),Gt(Ha),Gt(Eg),Gt(kg);const Ed=new le({algorithm:Fa,parameters:Y.serialize(Ti)}),kd=new le({algorithm:xg,parameters:Y.serialize(ea.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});Gt(Oi),Gt(Ag),Gt(Sg),Gt(Ua),Gt(Ad),Gt(Sd),Gt(Da),Gt($a),Gt(Ad),Gt(Sd);class Ga{constructor(e={}){this.hashAlgorithm=new le(Ti),this.maskGenAlgorithm=new le({algorithm:Fa,parameters:Y.serialize(Ti)}),this.pSourceAlgorithm=new le(kd),Object.assign(this,e)}}f([g({type:le,context:0,defaultValue:Ti})],Ga.prototype,"hashAlgorithm",void 0),f([g({type:le,context:1,defaultValue:Ed})],Ga.prototype,"maskGenAlgorithm",void 0),f([g({type:le,context:2,defaultValue:kd})],Ga.prototype,"pSourceAlgorithm",void 0),new le({algorithm:bg,parameters:Y.serialize(new Ga)});class Ni{constructor(e={}){this.hashAlgorithm=new le(Ti),this.maskGenAlgorithm=new le({algorithm:Fa,parameters:Y.serialize(Ti)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}}f([g({type:le,context:0,defaultValue:Ti})],Ni.prototype,"hashAlgorithm",void 0),f([g({type:le,context:1,defaultValue:Ed})],Ni.prototype,"maskGenAlgorithm",void 0),f([g({type:A.Integer,context:2,defaultValue:20})],Ni.prototype,"saltLength",void 0),f([g({type:A.Integer,context:3,defaultValue:1})],Ni.prototype,"trailerField",void 0),new le({algorithm:Js,parameters:Y.serialize(new Ni)});class za{constructor(e={}){this.digestAlgorithm=new le,this.digest=new nt,Object.assign(this,e)}}f([g({type:le})],za.prototype,"digestAlgorithm",void 0),f([g({type:nt})],za.prototype,"digest",void 0);var bu;class Ka{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.Integer,converter:St})],Ka.prototype,"prime",void 0),f([g({type:A.Integer,converter:St})],Ka.prototype,"exponent",void 0),f([g({type:A.Integer,converter:St})],Ka.prototype,"coefficient",void 0);let xu=bu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,bu.prototype)}};xu=bu=f([z({type:V.Sequence,itemType:Ka})],xu);class cn{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)}}f([g({type:A.Integer})],cn.prototype,"version",void 0),f([g({type:A.Integer,converter:St})],cn.prototype,"modulus",void 0),f([g({type:A.Integer,converter:St})],cn.prototype,"publicExponent",void 0),f([g({type:A.Integer,converter:St})],cn.prototype,"privateExponent",void 0),f([g({type:A.Integer,converter:St})],cn.prototype,"prime1",void 0),f([g({type:A.Integer,converter:St})],cn.prototype,"prime2",void 0),f([g({type:A.Integer,converter:St})],cn.prototype,"exponent1",void 0),f([g({type:A.Integer,converter:St})],cn.prototype,"exponent2",void 0),f([g({type:A.Integer,converter:St})],cn.prototype,"coefficient",void 0),f([g({type:xu,optional:!0})],cn.prototype,"otherPrimeInfos",void 0);class Au{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.Integer,converter:St})],Au.prototype,"modulus",void 0),f([g({type:A.Integer,converter:St})],Au.prototype,"publicExponent",void 0);var Su;(function(r){r[r.Transient=0]="Transient",r[r.Singleton=1]="Singleton",r[r.ResolutionScoped=2]="ResolutionScoped",r[r.ContainerScoped=3]="ContainerScoped"})(Su||(Su={}));const mr=Su;/*! *****************************************************************************
105
105
  Copyright (c) Microsoft Corporation.
106
106
 
107
107
  Permission to use, copy, modify, and/or distribute this software for any
@@ -114,9 +114,9 @@ ${e.join(`
114
114
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
115
115
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
116
116
  PERFORMANCE OF THIS SOFTWARE.
117
- ***************************************************************************** */var Su=function(r,e){return Su=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},Su(r,e)};function Eu(r,e){Su(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function Tg(r,e,t,n){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function c(b){try{d(n.next(b))}catch(S){o(S)}}function u(b){try{d(n.throw(b))}catch(S){o(S)}}function d(b){b.done?s(b.value):i(b.value).then(c,u)}d((n=n.apply(r,[])).next())})}function Ng(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(d){return function(b){return u([d,b])}}function u(d){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(s=d[0]&2?i.return:d[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,d[1])).done)return s;switch(i=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++,i=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],i=0}finally{n=s=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function Za(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Wa(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(c){o={error:c}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(o)throw o.error}}return s}function Ri(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(Wa(arguments[e]));return r}var Rg="injectionTokens";function jg(r){var e=Reflect.getMetadata("design:paramtypes",r)||[],t=Reflect.getOwnMetadata(Rg,r)||{};return Object.keys(t).forEach(function(n){e[+n]=t[n]}),e}function Id(r){return!!r.useClass}function ku(r){return!!r.useFactory}var Cd=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,n={},i=!1,s,o=function(){return i||(s=e(t.wrap()),i=!0),s};return new Proxy(n,this.createHandler(o))},r.prototype.createHandler=function(e){var t={},n=function(i){t[i]=function(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];s[0]=e();var c=Reflect[i];return c.apply(void 0,Ri(s))}};return this.reflectMethods.forEach(n),t},r}();function ys(r){return typeof r=="string"||typeof r=="symbol"}function Pg(r){return typeof r=="object"&&"token"in r&&"multiple"in r}function Bd(r){return typeof r=="object"&&"token"in r&&"transform"in r}function Ug(r){return typeof r=="function"||r instanceof Cd}function qa(r){return!!r.useToken}function Ya(r){return r.useValue!=null}function Dg(r){return Id(r)||Ya(r)||qa(r)||ku(r)}var Iu=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}(),$g=function(r){Eu(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(Iu),Od=function(){function r(){this.scopedResolutions=new Map}return r}();function Mg(r,e){if(r===null)return"at position #"+e;var t=r.split(",")[e].trim();return'"'+t+'" at position #'+e}function Vg(r,e,t){return t===void 0&&(t=" "),Ri([r],e.message.split(`
117
+ ***************************************************************************** */var _u=function(r,e){return _u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},_u(r,e)};function Eu(r,e){_u(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function Bg(r,e,t,n){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function c(b){try{d(n.next(b))}catch(_){o(_)}}function u(b){try{d(n.throw(b))}catch(_){o(_)}}function d(b){b.done?s(b.value):i(b.value).then(c,u)}d((n=n.apply(r,[])).next())})}function Og(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(d){return function(b){return u([d,b])}}function u(d){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(s=d[0]&2?i.return:d[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,d[1])).done)return s;switch(i=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++,i=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],i=0}finally{n=s=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function Za(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Wa(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(c){o={error:c}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(o)throw o.error}}return s}function Ri(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(Wa(arguments[e]));return r}var Tg="injectionTokens";function Ng(r){var e=Reflect.getMetadata("design:paramtypes",r)||[],t=Reflect.getOwnMetadata(Tg,r)||{};return Object.keys(t).forEach(function(n){e[+n]=t[n]}),e}function Id(r){return!!r.useClass}function ku(r){return!!r.useFactory}var Cd=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,n={},i=!1,s,o=function(){return i||(s=e(t.wrap()),i=!0),s};return new Proxy(n,this.createHandler(o))},r.prototype.createHandler=function(e){var t={},n=function(i){t[i]=function(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];s[0]=e();var c=Reflect[i];return c.apply(void 0,Ri(s))}};return this.reflectMethods.forEach(n),t},r}();function ys(r){return typeof r=="string"||typeof r=="symbol"}function Rg(r){return typeof r=="object"&&"token"in r&&"multiple"in r}function Bd(r){return typeof r=="object"&&"token"in r&&"transform"in r}function jg(r){return typeof r=="function"||r instanceof Cd}function qa(r){return!!r.useToken}function Ya(r){return r.useValue!=null}function Pg(r){return Id(r)||Ya(r)||qa(r)||ku(r)}var Iu=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}(),Ug=function(r){Eu(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(Iu),Od=function(){function r(){this.scopedResolutions=new Map}return r}();function Dg(r,e){if(r===null)return"at position #"+e;var t=r.split(",")[e].trim();return'"'+t+'" at position #'+e}function $g(r,e,t){return t===void 0&&(t=" "),Ri([r],e.message.split(`
118
118
  `).map(function(n){return t+n})).join(`
119
- `)}function Lg(r,e,t){var n=Wa(r.toString().match(/constructor\(([\w, ]+)\)/)||[],2),i=n[1],s=i===void 0?null:i,o=Mg(s,e);return Vg("Cannot inject the dependency "+o+' of "'+r.name+'" constructor. Reason:',t)}function Hg(r){if(typeof r.dispose!="function")return!1;var e=r.dispose;return!(e.length>0)}var Fg=function(r){Eu(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(Iu),Gg=function(r){Eu(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(Iu),zg=function(){function r(){this.preResolution=new Fg,this.postResolution=new Gg}return r}(),Td=new Map,Kg=function(){function r(e){this.parent=e,this._registry=new $g,this.interceptors=new zg,this.disposed=!1,this.disposables=new Set}return r.prototype.register=function(e,t,n){n===void 0&&(n={lifecycle:mr.Transient}),this.ensureNotDisposed();var i;if(Dg(t)?i=t:i={useClass:t},qa(i))for(var s=[e],o=i;o!=null;){var c=o.useToken;if(s.includes(c))throw new Error("Token registration cycle detected! "+Ri(s,[c]).join(" -> "));s.push(c);var u=this._registry.get(c);u&&qa(u.provider)?o=u.provider:o=null}if((n.lifecycle===mr.Singleton||n.lifecycle==mr.ContainerScoped||n.lifecycle==mr.ResolutionScoped)&&(Ya(i)||ku(i)))throw new Error('Cannot use lifecycle "'+mr[n.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:i,options:n}),this},r.prototype.registerType=function(e,t){return this.ensureNotDisposed(),ys(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(),ys(e)){if(ys(t))return this.register(e,{useToken:t},{lifecycle:mr.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:mr.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var n=e;return t&&!ys(t)&&(n=t),this.register(e,{useClass:n},{lifecycle:mr.Singleton})},r.prototype.resolve=function(e,t){t===void 0&&(t=new Od),this.ensureNotDisposed();var n=this.getRegistration(e);if(!n&&ys(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"Single"),n){var i=this.resolveRegistration(n,t);return this.executePostResolutionInterceptor(e,i,"Single"),i}if(Ug(e)){var i=this.construct(e,t);return this.executePostResolutionInterceptor(e,i,"Single"),i}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 n,i;if(this.interceptors.preResolution.has(e)){var s=[];try{for(var o=Za(this.interceptors.preResolution.getAll(e)),c=o.next();!c.done;c=o.next()){var u=c.value;u.options.frequency!="Once"&&s.push(u),u.callback(e,t)}}catch(d){n={error:d}}finally{try{c&&!c.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}this.interceptors.preResolution.setAll(e,s)}},r.prototype.executePostResolutionInterceptor=function(e,t,n){var i,s;if(this.interceptors.postResolution.has(e)){var o=[];try{for(var c=Za(this.interceptors.postResolution.getAll(e)),u=c.next();!u.done;u=c.next()){var d=u.value;d.options.frequency!="Once"&&o.push(d),d.callback(e,t,n)}}catch(b){i={error:b}}finally{try{u&&!u.done&&(s=c.return)&&s.call(c)}finally{if(i)throw i.error}}this.interceptors.postResolution.setAll(e,o)}},r.prototype.resolveRegistration=function(e,t){if(this.ensureNotDisposed(),e.options.lifecycle===mr.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);var n=e.options.lifecycle===mr.Singleton,i=e.options.lifecycle===mr.ContainerScoped,s=n||i,o;return Ya(e.provider)?o=e.provider.useValue:qa(e.provider)?o=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):Id(e.provider)?o=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):ku(e.provider)?o=e.provider.useFactory(this):o=this.construct(e.provider,t),e.options.lifecycle===mr.ResolutionScoped&&t.scopedResolutions.set(e,o),o},r.prototype.resolveAll=function(e,t){var n=this;t===void 0&&(t=new Od),this.ensureNotDisposed();var i=this.getAllRegistrations(e);if(!i&&ys(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"All"),i){var s=i.map(function(c){return n.resolveRegistration(c,t)});return this.executePostResolutionInterceptor(e,s,"All"),s}var o=[this.construct(e,t)];return this.executePostResolutionInterceptor(e,o,"All"),o},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 n=Za(this._registry.entries()),i=n.next();!i.done;i=n.next()){var s=Wa(i.value,2),o=s[0],c=s[1];this._registry.setAll(o,c.filter(function(u){return!Ya(u.provider)}).map(function(u){return u.instance=void 0,u}))}}catch(u){e={error:u}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},r.prototype.createChildContainer=function(){var e,t;this.ensureNotDisposed();var n=new r(this);try{for(var i=Za(this._registry.entries()),s=i.next();!s.done;s=i.next()){var o=Wa(s.value,2),c=o[0],u=o[1];u.some(function(d){var b=d.options;return b.lifecycle===mr.ContainerScoped})&&n._registry.setAll(c,u.map(function(d){return d.options.lifecycle===mr.ContainerScoped?{provider:d.provider,options:d.options}:d}))}}catch(d){e={error:d}}finally{try{s&&!s.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n},r.prototype.beforeResolution=function(e,t,n){n===void 0&&(n={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:t,options:n})},r.prototype.afterResolution=function(e,t,n){n===void 0&&(n={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:t,options:n})},r.prototype.dispose=function(){return Tg(this,void 0,void 0,function(){var e;return Ng(this,function(t){switch(t.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(n){var i=n.dispose();i&&e.push(i)}),[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 n=this;if(e instanceof Cd)return e.createProxy(function(s){return n.resolve(s,t)});var i=function(){var s=Td.get(e);if(!s||s.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var o=s.map(n.resolveParams(t,e));return new(e.bind.apply(e,Ri([void 0],o)))}();return Hg(i)&&this.disposables.add(i),i},r.prototype.resolveParams=function(e,t){var n=this;return function(i,s){var o,c,u;try{return Pg(i)?Bd(i)?i.multiple?(o=n.resolve(i.transform)).transform.apply(o,Ri([n.resolveAll(i.token)],i.transformArgs)):(c=n.resolve(i.transform)).transform.apply(c,Ri([n.resolve(i.token,e)],i.transformArgs)):i.multiple?n.resolveAll(i.token):n.resolve(i.token,e):Bd(i)?(u=n.resolve(i.transform,e)).transform.apply(u,Ri([n.resolve(i.token,e)],i.transformArgs)):n.resolve(i,e)}catch(d){throw new Error(Lg(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}(),lr=new Kg;function Ja(){return function(r){Td.set(r,jg(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 Cu;class Xa{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}}f([g({type:A.ObjectIdentifier})],Xa.prototype,"attrId",void 0),f([g({type:A.Any,repeated:"set"})],Xa.prototype,"attrValues",void 0);let Nd=Cu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Cu.prototype)}};Nd=Cu=f([z({type:V.Sequence,itemType:Xa})],Nd);var Bu;let Rd=Bu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Bu.prototype)}};Rd=Bu=f([z({type:V.Sequence,itemType:On})],Rd);class jd{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],jd.prototype,"certId",void 0),f([g({type:A.Any,context:0})],jd.prototype,"certValue",void 0);class Pd{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],Pd.prototype,"crlId",void 0),f([g({type:A.Any,context:0})],Pd.prototype,"crltValue",void 0);class Ud extends rt{}let Qa=class{constructor(e={}){this.encryptionAlgorithm=new ae,this.encryptedData=new Ud,Object.assign(this,e)}};f([g({type:ae})],Qa.prototype,"encryptionAlgorithm",void 0),f([g({type:Ud})],Qa.prototype,"encryptedData",void 0);var Ou,Tu;(function(r){r[r.v1=0]="v1"})(Tu||(Tu={}));class Dd extends rt{}let Nu=Ou=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Ou.prototype)}};Nu=Ou=f([z({type:V.Sequence,itemType:Cn})],Nu);class Xs{constructor(e={}){this.version=Tu.v1,this.privateKeyAlgorithm=new ae,this.privateKey=new Dd,Object.assign(this,e)}}f([g({type:A.Integer})],Xs.prototype,"version",void 0),f([g({type:ae})],Xs.prototype,"privateKeyAlgorithm",void 0),f([g({type:Dd})],Xs.prototype,"privateKey",void 0),f([g({type:Nu,implicit:!0,context:0,optional:!0})],Xs.prototype,"attributes",void 0);let $d=class extends Xs{};$d=f([z({type:V.Sequence})],$d);let Md=class extends Qa{};Md=f([z({type:V.Sequence})],Md);class Vd{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],Vd.prototype,"secretTypeId",void 0),f([g({type:A.Any,context:0})],Vd.prototype,"secretValue",void 0);class Qs{constructor(e={}){this.mac=new za,this.macSalt=new rt,this.iterations=1,Object.assign(this,e)}}f([g({type:za})],Qs.prototype,"mac",void 0),f([g({type:rt})],Qs.prototype,"macSalt",void 0),f([g({type:A.Integer,defaultValue:1})],Qs.prototype,"iterations",void 0);class ec{constructor(e={}){this.version=3,this.authSafe=new On,this.macData=new Qs,Object.assign(this,e)}}f([g({type:A.Integer})],ec.prototype,"version",void 0),f([g({type:On})],ec.prototype,"authSafe",void 0),f([g({type:Qs,optional:!0})],ec.prototype,"macData",void 0);var Ru;class tc{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],tc.prototype,"bagId",void 0),f([g({type:A.Any,context:0})],tc.prototype,"bagValue",void 0),f([g({type:Xa,repeated:"set",optional:!0})],tc.prototype,"bagAttributes",void 0);let Ld=Ru=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Ru.prototype)}};Ld=Ru=f([z({type:V.Sequence,itemType:tc})],Ld);var ju,Pu,Uu;const Hd="1.2.840.113549.1.9",Fd=`${Hd}.7`,Du=`${Hd}.14`;let rc=class extends Wt{constructor(e={}){super(e)}toString(){return this.ia5String||super.toString()}};f([g({type:A.IA5String})],rc.prototype,"ia5String",void 0),rc=f([z({type:V.Choice})],rc);let Gd=class extends On{};Gd=f([z({type:V.Sequence})],Gd);let zd=class extends ec{};zd=f([z({type:V.Sequence})],zd);let Kd=class extends Qa{};Kd=f([z({type:V.Sequence})],Kd);let $u=class{constructor(e=""){this.value=e}toString(){return this.value}};f([g({type:A.IA5String})],$u.prototype,"value",void 0),$u=f([z({type:V.Choice})],$u);let Zd=class extends rc{};Zd=f([z({type:V.Choice})],Zd);let Wd=class extends Wt{};Wd=f([z({type:V.Choice})],Wd);let Mu=class{constructor(e=new Date){this.value=e}};f([g({type:A.GeneralizedTime})],Mu.prototype,"value",void 0),Mu=f([z({type:V.Choice})],Mu);let qd=class extends Wt{};qd=f([z({type:V.Choice})],qd);let Vu=class{constructor(e="M"){this.value=e}toString(){return this.value}};f([g({type:A.PrintableString})],Vu.prototype,"value",void 0),Vu=f([z({type:V.Choice})],Vu);let nc=class{constructor(e=""){this.value=e}toString(){return this.value}};f([g({type:A.PrintableString})],nc.prototype,"value",void 0),nc=f([z({type:V.Choice})],nc);let Yd=class extends nc{};Yd=f([z({type:V.Choice})],Yd);let Jd=class extends Wt{};Jd=f([z({type:V.Choice})],Jd);let Lu=class{constructor(e=""){this.value=e}toString(){return this.value}};f([g({type:A.ObjectIdentifier})],Lu.prototype,"value",void 0),Lu=f([z({type:V.Choice})],Lu);let Xd=class extends qt{};Xd=f([z({type:V.Choice})],Xd);let Hu=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};f([g({type:A.Integer})],Hu.prototype,"value",void 0),Hu=f([z({type:V.Choice})],Hu);let Qd=class extends an{};Qd=f([z({type:V.Sequence})],Qd);let ic=class extends Wt{};ic=f([z({type:V.Choice})],ic);let ep=ju=class extends Si{constructor(e){super(e),Object.setPrototypeOf(this,ju.prototype)}};ep=ju=f([z({type:V.Sequence})],ep);let tp=Pu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Pu.prototype)}};tp=Pu=f([z({type:V.Set,itemType:as})],tp);let Fu=class{constructor(e=""){this.value=e}toString(){return this.value}};f([g({type:A.BmpString})],Fu.prototype,"value",void 0),Fu=f([z({type:V.Choice})],Fu);let Gu=class extends ae{};Gu=f([z({type:V.Sequence})],Gu);let rp=Uu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Uu.prototype)}};rp=Uu=f([z({type:V.Sequence,itemType:Gu})],rp);var zu;let sc=zu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,zu.prototype)}};sc=zu=f([z({type:V.Sequence,itemType:Cn})],sc);class gs{constructor(e={}){this.version=0,this.subject=new Ft,this.subjectPKInfo=new nn,this.attributes=new sc,Object.assign(this,e)}}f([g({type:A.Integer})],gs.prototype,"version",void 0),f([g({type:Ft})],gs.prototype,"subject",void 0),f([g({type:nn})],gs.prototype,"subjectPKInfo",void 0),f([g({type:sc,implicit:!0,context:0})],gs.prototype,"attributes",void 0);class eo{constructor(e={}){this.certificationRequestInfo=new gs,this.signatureAlgorithm=new ae,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:gs})],eo.prototype,"certificationRequestInfo",void 0),f([g({type:ae})],eo.prototype,"signatureAlgorithm",void 0),f([g({type:A.BitString})],eo.prototype,"signature",void 0);/*!
119
+ `)}function Mg(r,e,t){var n=Wa(r.toString().match(/constructor\(([\w, ]+)\)/)||[],2),i=n[1],s=i===void 0?null:i,o=Dg(s,e);return $g("Cannot inject the dependency "+o+' of "'+r.name+'" constructor. Reason:',t)}function Vg(r){if(typeof r.dispose!="function")return!1;var e=r.dispose;return!(e.length>0)}var Lg=function(r){Eu(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(Iu),Hg=function(r){Eu(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(Iu),Fg=function(){function r(){this.preResolution=new Lg,this.postResolution=new Hg}return r}(),Td=new Map,Gg=function(){function r(e){this.parent=e,this._registry=new Ug,this.interceptors=new Fg,this.disposed=!1,this.disposables=new Set}return r.prototype.register=function(e,t,n){n===void 0&&(n={lifecycle:mr.Transient}),this.ensureNotDisposed();var i;if(Pg(t)?i=t:i={useClass:t},qa(i))for(var s=[e],o=i;o!=null;){var c=o.useToken;if(s.includes(c))throw new Error("Token registration cycle detected! "+Ri(s,[c]).join(" -> "));s.push(c);var u=this._registry.get(c);u&&qa(u.provider)?o=u.provider:o=null}if((n.lifecycle===mr.Singleton||n.lifecycle==mr.ContainerScoped||n.lifecycle==mr.ResolutionScoped)&&(Ya(i)||ku(i)))throw new Error('Cannot use lifecycle "'+mr[n.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:i,options:n}),this},r.prototype.registerType=function(e,t){return this.ensureNotDisposed(),ys(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(),ys(e)){if(ys(t))return this.register(e,{useToken:t},{lifecycle:mr.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:mr.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var n=e;return t&&!ys(t)&&(n=t),this.register(e,{useClass:n},{lifecycle:mr.Singleton})},r.prototype.resolve=function(e,t){t===void 0&&(t=new Od),this.ensureNotDisposed();var n=this.getRegistration(e);if(!n&&ys(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"Single"),n){var i=this.resolveRegistration(n,t);return this.executePostResolutionInterceptor(e,i,"Single"),i}if(jg(e)){var i=this.construct(e,t);return this.executePostResolutionInterceptor(e,i,"Single"),i}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 n,i;if(this.interceptors.preResolution.has(e)){var s=[];try{for(var o=Za(this.interceptors.preResolution.getAll(e)),c=o.next();!c.done;c=o.next()){var u=c.value;u.options.frequency!="Once"&&s.push(u),u.callback(e,t)}}catch(d){n={error:d}}finally{try{c&&!c.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}this.interceptors.preResolution.setAll(e,s)}},r.prototype.executePostResolutionInterceptor=function(e,t,n){var i,s;if(this.interceptors.postResolution.has(e)){var o=[];try{for(var c=Za(this.interceptors.postResolution.getAll(e)),u=c.next();!u.done;u=c.next()){var d=u.value;d.options.frequency!="Once"&&o.push(d),d.callback(e,t,n)}}catch(b){i={error:b}}finally{try{u&&!u.done&&(s=c.return)&&s.call(c)}finally{if(i)throw i.error}}this.interceptors.postResolution.setAll(e,o)}},r.prototype.resolveRegistration=function(e,t){if(this.ensureNotDisposed(),e.options.lifecycle===mr.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);var n=e.options.lifecycle===mr.Singleton,i=e.options.lifecycle===mr.ContainerScoped,s=n||i,o;return Ya(e.provider)?o=e.provider.useValue:qa(e.provider)?o=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):Id(e.provider)?o=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):ku(e.provider)?o=e.provider.useFactory(this):o=this.construct(e.provider,t),e.options.lifecycle===mr.ResolutionScoped&&t.scopedResolutions.set(e,o),o},r.prototype.resolveAll=function(e,t){var n=this;t===void 0&&(t=new Od),this.ensureNotDisposed();var i=this.getAllRegistrations(e);if(!i&&ys(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"All"),i){var s=i.map(function(c){return n.resolveRegistration(c,t)});return this.executePostResolutionInterceptor(e,s,"All"),s}var o=[this.construct(e,t)];return this.executePostResolutionInterceptor(e,o,"All"),o},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 n=Za(this._registry.entries()),i=n.next();!i.done;i=n.next()){var s=Wa(i.value,2),o=s[0],c=s[1];this._registry.setAll(o,c.filter(function(u){return!Ya(u.provider)}).map(function(u){return u.instance=void 0,u}))}}catch(u){e={error:u}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},r.prototype.createChildContainer=function(){var e,t;this.ensureNotDisposed();var n=new r(this);try{for(var i=Za(this._registry.entries()),s=i.next();!s.done;s=i.next()){var o=Wa(s.value,2),c=o[0],u=o[1];u.some(function(d){var b=d.options;return b.lifecycle===mr.ContainerScoped})&&n._registry.setAll(c,u.map(function(d){return d.options.lifecycle===mr.ContainerScoped?{provider:d.provider,options:d.options}:d}))}}catch(d){e={error:d}}finally{try{s&&!s.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n},r.prototype.beforeResolution=function(e,t,n){n===void 0&&(n={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:t,options:n})},r.prototype.afterResolution=function(e,t,n){n===void 0&&(n={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:t,options:n})},r.prototype.dispose=function(){return Bg(this,void 0,void 0,function(){var e;return Og(this,function(t){switch(t.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(n){var i=n.dispose();i&&e.push(i)}),[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 n=this;if(e instanceof Cd)return e.createProxy(function(s){return n.resolve(s,t)});var i=function(){var s=Td.get(e);if(!s||s.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var o=s.map(n.resolveParams(t,e));return new(e.bind.apply(e,Ri([void 0],o)))}();return Vg(i)&&this.disposables.add(i),i},r.prototype.resolveParams=function(e,t){var n=this;return function(i,s){var o,c,u;try{return Rg(i)?Bd(i)?i.multiple?(o=n.resolve(i.transform)).transform.apply(o,Ri([n.resolveAll(i.token)],i.transformArgs)):(c=n.resolve(i.transform)).transform.apply(c,Ri([n.resolve(i.token,e)],i.transformArgs)):i.multiple?n.resolveAll(i.token):n.resolve(i.token,e):Bd(i)?(u=n.resolve(i.transform,e)).transform.apply(u,Ri([n.resolve(i.token,e)],i.transformArgs)):n.resolve(i,e)}catch(d){throw new Error(Mg(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}(),lr=new Gg;function Ja(){return function(r){Td.set(r,Ng(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 Cu;class Xa{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}}f([g({type:A.ObjectIdentifier})],Xa.prototype,"attrId",void 0),f([g({type:A.Any,repeated:"set"})],Xa.prototype,"attrValues",void 0);let Nd=Cu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Cu.prototype)}};Nd=Cu=f([z({type:V.Sequence,itemType:Xa})],Nd);var Bu;let Rd=Bu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Bu.prototype)}};Rd=Bu=f([z({type:V.Sequence,itemType:On})],Rd);class jd{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],jd.prototype,"certId",void 0),f([g({type:A.Any,context:0})],jd.prototype,"certValue",void 0);class Pd{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],Pd.prototype,"crlId",void 0),f([g({type:A.Any,context:0})],Pd.prototype,"crltValue",void 0);class Ud extends nt{}let Qa=class{constructor(e={}){this.encryptionAlgorithm=new le,this.encryptedData=new Ud,Object.assign(this,e)}};f([g({type:le})],Qa.prototype,"encryptionAlgorithm",void 0),f([g({type:Ud})],Qa.prototype,"encryptedData",void 0);var Ou,Tu;(function(r){r[r.v1=0]="v1"})(Tu||(Tu={}));class Dd extends nt{}let Nu=Ou=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Ou.prototype)}};Nu=Ou=f([z({type:V.Sequence,itemType:Cn})],Nu);class Xs{constructor(e={}){this.version=Tu.v1,this.privateKeyAlgorithm=new le,this.privateKey=new Dd,Object.assign(this,e)}}f([g({type:A.Integer})],Xs.prototype,"version",void 0),f([g({type:le})],Xs.prototype,"privateKeyAlgorithm",void 0),f([g({type:Dd})],Xs.prototype,"privateKey",void 0),f([g({type:Nu,implicit:!0,context:0,optional:!0})],Xs.prototype,"attributes",void 0);let $d=class extends Xs{};$d=f([z({type:V.Sequence})],$d);let Md=class extends Qa{};Md=f([z({type:V.Sequence})],Md);class Vd{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],Vd.prototype,"secretTypeId",void 0),f([g({type:A.Any,context:0})],Vd.prototype,"secretValue",void 0);class Qs{constructor(e={}){this.mac=new za,this.macSalt=new nt,this.iterations=1,Object.assign(this,e)}}f([g({type:za})],Qs.prototype,"mac",void 0),f([g({type:nt})],Qs.prototype,"macSalt",void 0),f([g({type:A.Integer,defaultValue:1})],Qs.prototype,"iterations",void 0);class ec{constructor(e={}){this.version=3,this.authSafe=new On,this.macData=new Qs,Object.assign(this,e)}}f([g({type:A.Integer})],ec.prototype,"version",void 0),f([g({type:On})],ec.prototype,"authSafe",void 0),f([g({type:Qs,optional:!0})],ec.prototype,"macData",void 0);var Ru;class tc{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:A.ObjectIdentifier})],tc.prototype,"bagId",void 0),f([g({type:A.Any,context:0})],tc.prototype,"bagValue",void 0),f([g({type:Xa,repeated:"set",optional:!0})],tc.prototype,"bagAttributes",void 0);let Ld=Ru=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Ru.prototype)}};Ld=Ru=f([z({type:V.Sequence,itemType:tc})],Ld);var ju,Pu,Uu;const Hd="1.2.840.113549.1.9",Fd=`${Hd}.7`,Du=`${Hd}.14`;let rc=class extends Wt{constructor(e={}){super(e)}toString(){return this.ia5String||super.toString()}};f([g({type:A.IA5String})],rc.prototype,"ia5String",void 0),rc=f([z({type:V.Choice})],rc);let Gd=class extends On{};Gd=f([z({type:V.Sequence})],Gd);let zd=class extends ec{};zd=f([z({type:V.Sequence})],zd);let Kd=class extends Qa{};Kd=f([z({type:V.Sequence})],Kd);let $u=class{constructor(e=""){this.value=e}toString(){return this.value}};f([g({type:A.IA5String})],$u.prototype,"value",void 0),$u=f([z({type:V.Choice})],$u);let Zd=class extends rc{};Zd=f([z({type:V.Choice})],Zd);let Wd=class extends Wt{};Wd=f([z({type:V.Choice})],Wd);let Mu=class{constructor(e=new Date){this.value=e}};f([g({type:A.GeneralizedTime})],Mu.prototype,"value",void 0),Mu=f([z({type:V.Choice})],Mu);let qd=class extends Wt{};qd=f([z({type:V.Choice})],qd);let Vu=class{constructor(e="M"){this.value=e}toString(){return this.value}};f([g({type:A.PrintableString})],Vu.prototype,"value",void 0),Vu=f([z({type:V.Choice})],Vu);let nc=class{constructor(e=""){this.value=e}toString(){return this.value}};f([g({type:A.PrintableString})],nc.prototype,"value",void 0),nc=f([z({type:V.Choice})],nc);let Yd=class extends nc{};Yd=f([z({type:V.Choice})],Yd);let Jd=class extends Wt{};Jd=f([z({type:V.Choice})],Jd);let Lu=class{constructor(e=""){this.value=e}toString(){return this.value}};f([g({type:A.ObjectIdentifier})],Lu.prototype,"value",void 0),Lu=f([z({type:V.Choice})],Lu);let Xd=class extends qt{};Xd=f([z({type:V.Choice})],Xd);let Hu=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};f([g({type:A.Integer})],Hu.prototype,"value",void 0),Hu=f([z({type:V.Choice})],Hu);let Qd=class extends an{};Qd=f([z({type:V.Sequence})],Qd);let ic=class extends Wt{};ic=f([z({type:V.Choice})],ic);let ep=ju=class extends _i{constructor(e){super(e),Object.setPrototypeOf(this,ju.prototype)}};ep=ju=f([z({type:V.Sequence})],ep);let tp=Pu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Pu.prototype)}};tp=Pu=f([z({type:V.Set,itemType:as})],tp);let Fu=class{constructor(e=""){this.value=e}toString(){return this.value}};f([g({type:A.BmpString})],Fu.prototype,"value",void 0),Fu=f([z({type:V.Choice})],Fu);let Gu=class extends le{};Gu=f([z({type:V.Sequence})],Gu);let rp=Uu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,Uu.prototype)}};rp=Uu=f([z({type:V.Sequence,itemType:Gu})],rp);var zu;let sc=zu=class extends mt{constructor(e){super(e),Object.setPrototypeOf(this,zu.prototype)}};sc=zu=f([z({type:V.Sequence,itemType:Cn})],sc);class gs{constructor(e={}){this.version=0,this.subject=new Ft,this.subjectPKInfo=new nn,this.attributes=new sc,Object.assign(this,e)}}f([g({type:A.Integer})],gs.prototype,"version",void 0),f([g({type:Ft})],gs.prototype,"subject",void 0),f([g({type:nn})],gs.prototype,"subjectPKInfo",void 0),f([g({type:sc,implicit:!0,context:0})],gs.prototype,"attributes",void 0);class eo{constructor(e={}){this.certificationRequestInfo=new gs,this.signatureAlgorithm=new le,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}f([g({type:gs})],eo.prototype,"certificationRequestInfo",void 0),f([g({type:le})],eo.prototype,"signatureAlgorithm",void 0),f([g({type:A.BitString})],eo.prototype,"signature",void 0);/*!
120
120
  * MIT License
121
121
  *
122
122
  * Copyright (c) Peculiar Ventures. All rights reserved.
@@ -139,24 +139,24 @@ ${e.join(`
139
139
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
140
140
  * SOFTWARE.
141
141
  *
142
- */const to="crypto.algorithm";class Zg{getAlgorithms(){return lr.resolveAll(to)}toAsnAlgorithm(e){({...e});for(const t of this.getAlgorithms()){const n=t.toAsnAlgorithm(e);if(n)return n}if(/^[0-9.]+$/.test(e.name)){const t=new ae({algorithm:e.name});if("parameters"in e){const n=e;t.parameters=n.parameters}return t}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(e){for(const n of this.getAlgorithms()){const i=n.toWebAlgorithm(e);if(i)return i}return{name:e.algorithm,parameters:e.parameters}}}const vs="crypto.algorithmProvider";lr.registerSingleton(vs,Zg);var oc;const wr="1.3.36.3.3.2.8.1.1",np=`${wr}.1`,ip=`${wr}.2`,sp=`${wr}.3`,op=`${wr}.4`,ap=`${wr}.5`,cp=`${wr}.6`,lp=`${wr}.7`,up=`${wr}.8`,fp=`${wr}.9`,hp=`${wr}.10`,dp=`${wr}.11`,pp=`${wr}.12`,yp=`${wr}.13`,gp=`${wr}.14`,vp="brainpoolP160r1",mp="brainpoolP160t1",wp="brainpoolP192r1",bp="brainpoolP192t1",xp="brainpoolP224r1",Ap="brainpoolP224t1",_p="brainpoolP256r1",Sp="brainpoolP256t1",Ep="brainpoolP320r1",kp="brainpoolP320t1",Ip="brainpoolP384r1",Cp="brainpoolP384t1",Bp="brainpoolP512r1",Op="brainpoolP512t1",Tt="ECDSA";let ro=oc=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case Tt.toLowerCase():if("hash"in e)switch((typeof e.hash=="string"?e.hash:e.hash.name).toLowerCase()){case"sha-1":return vg;case"sha-256":return mg;case"sha-384":return wg;case"sha-512":return bg}else if("namedCurve"in e){let t="";switch(e.namedCurve){case"P-256":t=wd;break;case"K-256":t=oc.SECP256K1;break;case"P-384":t=bd;break;case"P-521":t=xd;break;case vp:t=np;break;case mp:t=ip;break;case wp:t=sp;break;case bp:t=op;break;case xp:t=ap;break;case Ap:t=cp;break;case _p:t=lp;break;case Sp:t=up;break;case Ep:t=fp;break;case kp:t=hp;break;case Ip:t=dp;break;case Cp:t=pp;break;case Bp:t=yp;break;case Op:t=gp;break}if(t)return new ae({algorithm:Ws,parameters:J.serialize(new Fn({namedCurve:t}))})}}return null}toWebAlgorithm(e){switch(e.algorithm){case pu:return{name:Tt,hash:{name:"SHA-1"}};case yu:return{name:Tt,hash:{name:"SHA-256"}};case gu:return{name:Tt,hash:{name:"SHA-384"}};case vu:return{name:Tt,hash:{name:"SHA-512"}};case Ws:{if(!e.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(J.parse(e.parameters,Fn).namedCurve){case wd:return{name:Tt,namedCurve:"P-256"};case oc.SECP256K1:return{name:Tt,namedCurve:"K-256"};case bd:return{name:Tt,namedCurve:"P-384"};case xd:return{name:Tt,namedCurve:"P-521"};case np:return{name:Tt,namedCurve:vp};case ip:return{name:Tt,namedCurve:mp};case sp:return{name:Tt,namedCurve:wp};case op:return{name:Tt,namedCurve:bp};case ap:return{name:Tt,namedCurve:xp};case cp:return{name:Tt,namedCurve:Ap};case lp:return{name:Tt,namedCurve:_p};case up:return{name:Tt,namedCurve:Sp};case fp:return{name:Tt,namedCurve:Ep};case hp:return{name:Tt,namedCurve:kp};case dp:return{name:Tt,namedCurve:Ip};case pp:return{name:Tt,namedCurve:Cp};case yp:return{name:Tt,namedCurve:Bp};case gp:return{name:Tt,namedCurve:Op}}}}return null}};ro.SECP256K1="1.3.132.0.10",ro=oc=f([Ja()],ro),lr.registerSingleton(to,ro);const Tp=Symbol("name"),Np=Symbol("value");class nt{constructor(e,t={},n=""){this[Tp]=e,this[Np]=n;for(const i in t)this[i]=t[i]}}nt.NAME=Tp,nt.VALUE=Np;class Wg{static toTextObject(e){const t=new nt("Algorithm Identifier",{},Rn.toString(e.algorithm));if(e.parameters)switch(e.algorithm){case Ws:{const n=new ro().toWebAlgorithm(e);n&&"namedCurve"in n?t["Named Curve"]=n.namedCurve:t.Parameters=e.parameters;break}default:t.Parameters=e.parameters}return t}}class Rn{static toString(e){const t=this.items[e];return t||e}}Rn.items={[Ma]:"sha1",[Sd]:"sha224",[Va]:"sha256",[La]:"sha384",[Ha]:"sha512",[Oi]:"rsaEncryption",[Ua]:"sha1WithRSAEncryption",[kg]:"sha224WithRSAEncryption",[wu]:"sha256WithRSAEncryption",[Da]:"sha384WithRSAEncryption",[$a]:"sha512WithRSAEncryption",[Ws]:"ecPublicKey",[pu]:"ecdsaWithSHA1",[md]:"ecdsaWithSHA224",[yu]:"ecdsaWithSHA256",[gu]:"ecdsaWithSHA384",[vu]:"ecdsaWithSHA512",[ug]:"TLS WWW server authentication",[fg]:"TLS WWW client authentication",[hg]:"Code Signing",[dg]:"E-mail Protection",[pg]:"Time Stamping",[yg]:"OCSP Signing",[hu]:"Signed Data"};class Gn{static serialize(e){return this.serializeObj(e).join(`
143
- `)}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,t=0){const n=[];let i=this.pad(t++),s="";const o=e[nt.VALUE];o&&(s=` ${o}`),n.push(`${i}${e[nt.NAME]}:${s}`),i=this.pad(t);for(const c in e){if(typeof c=="symbol")continue;const u=e[c],d=c?`${c}: `:"";if(typeof u=="string"||typeof u=="number"||typeof u=="boolean")n.push(`${i}${d}${u}`);else if(u instanceof Date)n.push(`${i}${d}${u.toUTCString()}`);else if(Array.isArray(u))for(const b of u)b[nt.NAME]=c,n.push(...this.serializeObj(b,t));else if(u instanceof nt)u[nt.NAME]=c,n.push(...this.serializeObj(u,t));else if(Q.isBufferSource(u))c?(n.push(`${i}${d}`),n.push(...this.serializeBufferSource(u,t+1))):n.push(...this.serializeBufferSource(u,t));else if("toTextObject"in u){const b=u.toTextObject();b[nt.NAME]=c,n.push(...this.serializeObj(b,t))}else throw new TypeError("Cannot serialize data in text format. Unsupported type.")}return n}static serializeBufferSource(e,t=0){const n=this.pad(t),i=Q.toUint8Array(e),s=[];for(let o=0;o<i.length;){const c=[];for(let u=0;u<16&&o<i.length;u++){u===8&&c.push("");const d=i[o++].toString(16).padStart(2,"0");c.push(d)}s.push(`${n}${c.join(" ")}`)}return s}static serializeAlgorithm(e){return this.algorithmSerializer.toTextObject(e)}}Gn.oidSerializer=Rn,Gn.algorithmSerializer=Wg;class zn{constructor(...e){if(e.length===1){const t=e[0];this.rawData=J.serialize(t),this.onInit(t)}else{const t=J.parse(e[0],e[1]);this.rawData=Q.toArrayBuffer(e[0]),this.onInit(t)}}equal(e){return e instanceof zn?jo(e.rawData,this.rawData):!1}toString(e="text"){switch(e){case"asn":return J.toString(this.rawData);case"text":return Gn.serialize(this.toTextObject());case"hex":return ve.ToHex(this.rawData);case"base64":return ve.ToBase64(this.rawData);case"base64url":return ve.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 nt(this.getTextName(),{},e)}}zn.NAME="ASN";class Pr extends zn{constructor(...e){let t;Q.isBufferSource(e[0])?t=Q.toArrayBuffer(e[0]):t=J.serialize(new Gr({extnID:e[0],critical:e[1],extnValue:new rt(Q.toArrayBuffer(e[2]))})),super(t,Gr)}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[nt.NAME]===Pr.NAME&&(e[nt.NAME]=Rn.toString(this.type)),e}}var Rp;class Kn{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[Rp]="CryptoProvider",typeof self<"u"&&typeof crypto<"u"?this.set(Kn.DEFAULT,crypto):typeof global<"u"&&global.crypto&&global.crypto.subtle&&this.set(Kn.DEFAULT,global.crypto)}clear(){this.items.clear()}delete(e){return this.items.delete(e)}forEach(e,t){return this.items.forEach(e,t)}has(e){return this.items.has(e)}get size(){return this.items.size}entries(){return this.items.entries()}keys(){return this.items.keys()}values(){return this.items.values()}[Symbol.iterator](){return this.items[Symbol.iterator]()}get(e=Kn.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(Kn.DEFAULT,e);return this}}Rp=Symbol.toStringTag,Kn.DEFAULT="default";const Yt=new Kn,qg=/^[0-2](?:\.[1-9][0-9]*)+$/;function Yg(r){return new RegExp(qg).test(r)}class jp{constructor(e={}){this.items={};for(const t in e)this.register(t,e[t])}get(e){return this.items[e]||null}findId(e){return Yg(e)?e:this.get(e)}register(e,t){this.items[e]=t,this.items[t]=e}}const br=new jp;br.register("CN","2.5.4.3"),br.register("L","2.5.4.7"),br.register("ST","2.5.4.8"),br.register("O","2.5.4.10"),br.register("OU","2.5.4.11"),br.register("C","2.5.4.6"),br.register("DC","0.9.2342.19200300.100.1.25"),br.register("E","1.2.840.113549.1.9.1"),br.register("G","2.5.4.42"),br.register("I","2.5.4.43"),br.register("SN","2.5.4.4"),br.register("T","2.5.4.12");function Jg(r,e){return`\\${ve.ToHex(ve.FromUtf8String(e)).toUpperCase()}`}function Xg(r){return r.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,Jg)}class Zn{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 jp,this.asn=new Ft;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const i=t[n];this.extraNames.register(n,i)}typeof e=="string"?this.asn=this.fromString(e):e instanceof Ft?this.asn=e:Q.isBufferSource(e)?this.asn=J.parse(e,Ft):this.asn=this.fromJSON(e)}getField(e){const t=this.extraNames.findId(e)||br.findId(e),n=[];for(const i of this.asn)for(const s of i)s.type===t&&n.push(s.value.toString());return n}getName(e){return this.extraNames.get(e)||br.get(e)}toString(){return this.asn.map(e=>e.map(t=>{const n=this.getName(t.type)||t.type,i=t.value.anyValue?`#${ve.ToHex(t.value.anyValue)}`:Xg(t.value.toString());return`${n}=${i}`}).join("+")).join(", ")}toJSON(){var e;const t=[];for(const n of this.asn){const i={};for(const s of n){const o=this.getName(s.type)||s.type;(e=i[o])!==null&&e!==void 0||(i[o]=[]),i[o].push(s.value.anyValue?`#${ve.ToHex(s.value.anyValue)}`:s.value.toString())}t.push(i)}return t}fromString(e){const t=new Ft,n=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let i=null,s=",";for(;i=n.exec(`${e},`);){let[,o,c]=i;const u=c[c.length-1];(u===","||u==="+")&&(c=c.slice(0,c.length-1),i[3]=u);const d=i[3];o=this.getTypeOid(o);const b=this.createAttribute(o,c);s==="+"?t[t.length-1].push(b):t.push(new Qi([b])),s=d}return t}fromJSON(e){const t=new Ft;for(const n of e){const i=new Qi;for(const s in n){const o=this.getTypeOid(s),c=n[s];for(const u of c){const d=this.createAttribute(o,u);i.push(d)}}t.push(i)}return t}getTypeOid(e){if(/[\d.]+/.test(e)||(e=this.getName(e)||""),!e)throw new Error(`Cannot get OID for name type '${e}'`);return e}createAttribute(e,t){const n=new ta({type:e});if(typeof t=="object")for(const i in t)switch(i){case"ia5String":n.value.ia5String=t[i];break;case"utf8String":n.value.utf8String=t[i];break;case"universalString":n.value.universalString=t[i];break;case"bmpString":n.value.bmpString=t[i];break;case"printableString":n.value.printableString=t[i];break}else if(t[0]==="#")n.value.anyValue=ve.FromHex(t.slice(1));else{const i=this.processStringValue(t);e===this.getName("E")||e===this.getName("DC")?n.value.ia5String=i:Zn.isPrintableString(i)?n.value.printableString=i:n.value.utf8String=i}return n}processStringValue(e){const t=/"(.*?[^\\])?"/.exec(e);return t&&(e=t[1]),e.replace(/\\0a/ig,`
144
- `).replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1")}toArrayBuffer(){return J.serialize(this.asn)}async getThumbprint(...e){var t;let n,i="SHA-1";return e.length>=1&&!(!((t=e[0])===null||t===void 0)&&t.subtle)?(i=e[0]||i,n=e[1]||Yt.get()):n=e[0]||Yt.get(),await n.subtle.digest(i,this.toArrayBuffer())}}const Pp="Cannot initialize GeneralName from ASN.1 data.",Up=`${Pp} Unsupported string format in use.`,Qg=`${Pp} Value doesn't match to GUID regular expression.`,Dp=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,$p="1.3.6.1.4.1.311.25.1",Mp="1.3.6.1.4.1.311.20.2.3",Ku="dns",Zu="dn",Wu="email",qu="ip",Yu="url",Ju="guid",Xu="upn",ac="id";class Wn extends zn{constructor(...e){let t;if(e.length===2)switch(e[0]){case Zu:{const n=new Zn(e[1]).toArrayBuffer(),i=J.parse(n,Ft);t=new De({directoryName:i});break}case Ku:t=new De({dNSName:e[1]});break;case Wu:t=new De({rfc822Name:e[1]});break;case Ju:{const n=new RegExp(Dp,"i").exec(e[1]);if(!n)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const i=n.slice(1).map((s,o)=>o<3?ve.ToHex(new Uint8Array(ve.FromHex(s)).reverse()):s).join("");t=new De({otherName:new js({typeId:$p,value:J.serialize(new rt(ve.FromHex(i)))})});break}case qu:t=new De({iPAddress:e[1]});break;case ac:t=new De({registeredID:e[1]});break;case Xu:{t=new De({otherName:new js({typeId:Mp,value:J.serialize(Mh.toASN(e[1]))})});break}case Yu:t=new De({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else Q.isBufferSource(e[0])?t=J.parse(e[0],De):t=e[0];super(t)}onInit(e){if(e.dNSName!=null)this.type=Ku,this.value=e.dNSName;else if(e.rfc822Name!=null)this.type=Wu,this.value=e.rfc822Name;else if(e.iPAddress!=null)this.type=qu,this.value=e.iPAddress;else if(e.uniformResourceIdentifier!=null)this.type=Yu,this.value=e.uniformResourceIdentifier;else if(e.registeredID!=null)this.type=ac,this.value=e.registeredID;else if(e.directoryName!=null)this.type=Zu,this.value=new Zn(e.directoryName).toString();else if(e.otherName!=null)if(e.otherName.typeId===$p){this.type=Ju;const t=J.parse(e.otherName.value,rt),n=new RegExp(Dp,"i").exec(ve.ToHex(t));if(!n)throw new Error(Qg);this.value=n.slice(1).map((i,s)=>s<3?ve.ToHex(new Uint8Array(ve.FromHex(i)).reverse()):i).join("-")}else if(e.otherName.typeId===Mp)this.type=Xu,this.value=J.parse(e.otherName.value,Wt).toString();else throw new Error(Up);else throw new Error(Up)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case Zu:case Ku:case Ju:case qu:case ac:case Xu:case Yu:e=this.type.toUpperCase();break;case Wu:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let t=this.value;return this.type===ac&&(t=Rn.toString(t)),new nt(e,void 0,t)}}class no extends zn{constructor(e){let t;if(e instanceof cr)t=e;else if(Array.isArray(e)){const n=[];for(const i of e)if(i instanceof De)n.push(i);else{const s=J.parse(new Wn(i.type,i.value).rawData,De);n.push(s)}t=new cr(n)}else if(Q.isBufferSource(e))t=J.parse(e,cr);else throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");super(t)}onInit(e){const t=[];for(const n of e){let i=null;try{i=new Wn(n)}catch{continue}t.push(i)}this.items=t}toJSON(){return this.items.map(e=>e.toJSON())}toTextObject(){const e=super.toTextObjectEmpty();for(const t of this.items){const n=t.toTextObject();let i=e[n[nt.NAME]];Array.isArray(i)||(i=[],e[n[nt.NAME]]=i),i.push(n)}return e}}no.NAME="GeneralNames";const io="-{5}",so="\\n",ev=`[^${so}]+`,tv=`${io}BEGIN (${ev}(?=${io}))${io}`,rv=`${io}END \\1${io}`,ms="\\n",nv=`[^:${so}]+`,iv=`(?:[^${so}]+${ms}(?: +[^${so}]+${ms})*)`,sv=`(?:[a-zA-Z0-9=+/]+${ms})+`,Vp=`${tv}${ms}(?:((?:${nv}: ${iv})+))?${ms}?(${sv})${rv}`;class xr{static isPem(e){return typeof e=="string"&&new RegExp(Vp,"g").test(e)}static decodeWithHeaders(e){e=e.replace(/\r/g,"");const t=new RegExp(Vp,"g"),n=[];let i=null;for(;i=t.exec(e);){const s=i[3].replace(new RegExp(`[${so}]+`,"g"),""),o={type:i[1],headers:[],rawData:ve.FromBase64(s)},c=i[2];if(c){const u=c.split(new RegExp(ms,"g"));let d=null;for(const b of u){const[S,Y]=b.split(/:(.*)/);if(Y===void 0){if(!d)throw new Error("Cannot parse PEM string. Incorrect header value");d.value+=S.trim()}else d&&o.headers.push(d),d={key:S,value:Y.trim()}}d&&o.headers.push(d)}n.push(o)}return n}static decode(e){return this.decodeWithHeaders(e).map(n=>n.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 n=new Array;return t?e.forEach(i=>{if(!Q.isBufferSource(i))throw new TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");n.push(this.encodeStruct({type:t,rawData:Q.toArrayBuffer(i)}))}):e.forEach(i=>{if(!("type"in i))throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");n.push(this.encodeStruct(i))}),n.join(`
142
+ */const to="crypto.algorithm";class zg{getAlgorithms(){return lr.resolveAll(to)}toAsnAlgorithm(e){({...e});for(const t of this.getAlgorithms()){const n=t.toAsnAlgorithm(e);if(n)return n}if(/^[0-9.]+$/.test(e.name)){const t=new le({algorithm:e.name});if("parameters"in e){const n=e;t.parameters=n.parameters}return t}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(e){for(const n of this.getAlgorithms()){const i=n.toWebAlgorithm(e);if(i)return i}return{name:e.algorithm,parameters:e.parameters}}}const vs="crypto.algorithmProvider";lr.registerSingleton(vs,zg);var oc;const wr="1.3.36.3.3.2.8.1.1",np=`${wr}.1`,ip=`${wr}.2`,sp=`${wr}.3`,op=`${wr}.4`,ap=`${wr}.5`,cp=`${wr}.6`,lp=`${wr}.7`,up=`${wr}.8`,fp=`${wr}.9`,hp=`${wr}.10`,dp=`${wr}.11`,pp=`${wr}.12`,yp=`${wr}.13`,gp=`${wr}.14`,vp="brainpoolP160r1",mp="brainpoolP160t1",wp="brainpoolP192r1",bp="brainpoolP192t1",xp="brainpoolP224r1",Ap="brainpoolP224t1",Sp="brainpoolP256r1",_p="brainpoolP256t1",Ep="brainpoolP320r1",kp="brainpoolP320t1",Ip="brainpoolP384r1",Cp="brainpoolP384t1",Bp="brainpoolP512r1",Op="brainpoolP512t1",Tt="ECDSA";let ro=oc=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case Tt.toLowerCase():if("hash"in e)switch((typeof e.hash=="string"?e.hash:e.hash.name).toLowerCase()){case"sha-1":return yg;case"sha-256":return gg;case"sha-384":return vg;case"sha-512":return mg}else if("namedCurve"in e){let t="";switch(e.namedCurve){case"P-256":t=wd;break;case"K-256":t=oc.SECP256K1;break;case"P-384":t=bd;break;case"P-521":t=xd;break;case vp:t=np;break;case mp:t=ip;break;case wp:t=sp;break;case bp:t=op;break;case xp:t=ap;break;case Ap:t=cp;break;case Sp:t=lp;break;case _p:t=up;break;case Ep:t=fp;break;case kp:t=hp;break;case Ip:t=dp;break;case Cp:t=pp;break;case Bp:t=yp;break;case Op:t=gp;break}if(t)return new le({algorithm:Ws,parameters:Y.serialize(new Fn({namedCurve:t}))})}}return null}toWebAlgorithm(e){switch(e.algorithm){case pu:return{name:Tt,hash:{name:"SHA-1"}};case yu:return{name:Tt,hash:{name:"SHA-256"}};case gu:return{name:Tt,hash:{name:"SHA-384"}};case vu:return{name:Tt,hash:{name:"SHA-512"}};case Ws:{if(!e.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(Y.parse(e.parameters,Fn).namedCurve){case wd:return{name:Tt,namedCurve:"P-256"};case oc.SECP256K1:return{name:Tt,namedCurve:"K-256"};case bd:return{name:Tt,namedCurve:"P-384"};case xd:return{name:Tt,namedCurve:"P-521"};case np:return{name:Tt,namedCurve:vp};case ip:return{name:Tt,namedCurve:mp};case sp:return{name:Tt,namedCurve:wp};case op:return{name:Tt,namedCurve:bp};case ap:return{name:Tt,namedCurve:xp};case cp:return{name:Tt,namedCurve:Ap};case lp:return{name:Tt,namedCurve:Sp};case up:return{name:Tt,namedCurve:_p};case fp:return{name:Tt,namedCurve:Ep};case hp:return{name:Tt,namedCurve:kp};case dp:return{name:Tt,namedCurve:Ip};case pp:return{name:Tt,namedCurve:Cp};case yp:return{name:Tt,namedCurve:Bp};case gp:return{name:Tt,namedCurve:Op}}}}return null}};ro.SECP256K1="1.3.132.0.10",ro=oc=f([Ja()],ro),lr.registerSingleton(to,ro);const Tp=Symbol("name"),Np=Symbol("value");class it{constructor(e,t={},n=""){this[Tp]=e,this[Np]=n;for(const i in t)this[i]=t[i]}}it.NAME=Tp,it.VALUE=Np;class Kg{static toTextObject(e){const t=new it("Algorithm Identifier",{},Rn.toString(e.algorithm));if(e.parameters)switch(e.algorithm){case Ws:{const n=new ro().toWebAlgorithm(e);n&&"namedCurve"in n?t["Named Curve"]=n.namedCurve:t.Parameters=e.parameters;break}default:t.Parameters=e.parameters}return t}}class Rn{static toString(e){const t=this.items[e];return t||e}}Rn.items={[Ma]:"sha1",[_d]:"sha224",[Va]:"sha256",[La]:"sha384",[Ha]:"sha512",[Oi]:"rsaEncryption",[Ua]:"sha1WithRSAEncryption",[_g]:"sha224WithRSAEncryption",[wu]:"sha256WithRSAEncryption",[Da]:"sha384WithRSAEncryption",[$a]:"sha512WithRSAEncryption",[Ws]:"ecPublicKey",[pu]:"ecdsaWithSHA1",[md]:"ecdsaWithSHA224",[yu]:"ecdsaWithSHA256",[gu]:"ecdsaWithSHA384",[vu]:"ecdsaWithSHA512",[cg]:"TLS WWW server authentication",[lg]:"TLS WWW client authentication",[ug]:"Code Signing",[fg]:"E-mail Protection",[hg]:"Time Stamping",[dg]:"OCSP Signing",[hu]:"Signed Data"};class Gn{static serialize(e){return this.serializeObj(e).join(`
143
+ `)}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,t=0){const n=[];let i=this.pad(t++),s="";const o=e[it.VALUE];o&&(s=` ${o}`),n.push(`${i}${e[it.NAME]}:${s}`),i=this.pad(t);for(const c in e){if(typeof c=="symbol")continue;const u=e[c],d=c?`${c}: `:"";if(typeof u=="string"||typeof u=="number"||typeof u=="boolean")n.push(`${i}${d}${u}`);else if(u instanceof Date)n.push(`${i}${d}${u.toUTCString()}`);else if(Array.isArray(u))for(const b of u)b[it.NAME]=c,n.push(...this.serializeObj(b,t));else if(u instanceof it)u[it.NAME]=c,n.push(...this.serializeObj(u,t));else if(Q.isBufferSource(u))c?(n.push(`${i}${d}`),n.push(...this.serializeBufferSource(u,t+1))):n.push(...this.serializeBufferSource(u,t));else if("toTextObject"in u){const b=u.toTextObject();b[it.NAME]=c,n.push(...this.serializeObj(b,t))}else throw new TypeError("Cannot serialize data in text format. Unsupported type.")}return n}static serializeBufferSource(e,t=0){const n=this.pad(t),i=Q.toUint8Array(e),s=[];for(let o=0;o<i.length;){const c=[];for(let u=0;u<16&&o<i.length;u++){u===8&&c.push("");const d=i[o++].toString(16).padStart(2,"0");c.push(d)}s.push(`${n}${c.join(" ")}`)}return s}static serializeAlgorithm(e){return this.algorithmSerializer.toTextObject(e)}}Gn.oidSerializer=Rn,Gn.algorithmSerializer=Kg;class zn{constructor(...e){if(e.length===1){const t=e[0];this.rawData=Y.serialize(t),this.onInit(t)}else{const t=Y.parse(e[0],e[1]);this.rawData=Q.toArrayBuffer(e[0]),this.onInit(t)}}equal(e){return e instanceof zn?jo(e.rawData,this.rawData):!1}toString(e="text"){switch(e){case"asn":return Y.toString(this.rawData);case"text":return Gn.serialize(this.toTextObject());case"hex":return ve.ToHex(this.rawData);case"base64":return ve.ToBase64(this.rawData);case"base64url":return ve.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 it(this.getTextName(),{},e)}}zn.NAME="ASN";class Pr extends zn{constructor(...e){let t;Q.isBufferSource(e[0])?t=Q.toArrayBuffer(e[0]):t=Y.serialize(new Gr({extnID:e[0],critical:e[1],extnValue:new nt(Q.toArrayBuffer(e[2]))})),super(t,Gr)}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[it.NAME]===Pr.NAME&&(e[it.NAME]=Rn.toString(this.type)),e}}var Rp;class Kn{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[Rp]="CryptoProvider",typeof self<"u"&&typeof crypto<"u"?this.set(Kn.DEFAULT,crypto):typeof global<"u"&&global.crypto&&global.crypto.subtle&&this.set(Kn.DEFAULT,global.crypto)}clear(){this.items.clear()}delete(e){return this.items.delete(e)}forEach(e,t){return this.items.forEach(e,t)}has(e){return this.items.has(e)}get size(){return this.items.size}entries(){return this.items.entries()}keys(){return this.items.keys()}values(){return this.items.values()}[Symbol.iterator](){return this.items[Symbol.iterator]()}get(e=Kn.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(Kn.DEFAULT,e);return this}}Rp=Symbol.toStringTag,Kn.DEFAULT="default";const Yt=new Kn,Zg=/^[0-2](?:\.[1-9][0-9]*)+$/;function Wg(r){return new RegExp(Zg).test(r)}class jp{constructor(e={}){this.items={};for(const t in e)this.register(t,e[t])}get(e){return this.items[e]||null}findId(e){return Wg(e)?e:this.get(e)}register(e,t){this.items[e]=t,this.items[t]=e}}const br=new jp;br.register("CN","2.5.4.3"),br.register("L","2.5.4.7"),br.register("ST","2.5.4.8"),br.register("O","2.5.4.10"),br.register("OU","2.5.4.11"),br.register("C","2.5.4.6"),br.register("DC","0.9.2342.19200300.100.1.25"),br.register("E","1.2.840.113549.1.9.1"),br.register("G","2.5.4.42"),br.register("I","2.5.4.43"),br.register("SN","2.5.4.4"),br.register("T","2.5.4.12");function qg(r,e){return`\\${ve.ToHex(ve.FromUtf8String(e)).toUpperCase()}`}function Yg(r){return r.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,qg)}class Zn{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 jp,this.asn=new Ft;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const i=t[n];this.extraNames.register(n,i)}typeof e=="string"?this.asn=this.fromString(e):e instanceof Ft?this.asn=e:Q.isBufferSource(e)?this.asn=Y.parse(e,Ft):this.asn=this.fromJSON(e)}getField(e){const t=this.extraNames.findId(e)||br.findId(e),n=[];for(const i of this.asn)for(const s of i)s.type===t&&n.push(s.value.toString());return n}getName(e){return this.extraNames.get(e)||br.get(e)}toString(){return this.asn.map(e=>e.map(t=>{const n=this.getName(t.type)||t.type,i=t.value.anyValue?`#${ve.ToHex(t.value.anyValue)}`:Yg(t.value.toString());return`${n}=${i}`}).join("+")).join(", ")}toJSON(){var e;const t=[];for(const n of this.asn){const i={};for(const s of n){const o=this.getName(s.type)||s.type;(e=i[o])!==null&&e!==void 0||(i[o]=[]),i[o].push(s.value.anyValue?`#${ve.ToHex(s.value.anyValue)}`:s.value.toString())}t.push(i)}return t}fromString(e){const t=new Ft,n=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let i=null,s=",";for(;i=n.exec(`${e},`);){let[,o,c]=i;const u=c[c.length-1];(u===","||u==="+")&&(c=c.slice(0,c.length-1),i[3]=u);const d=i[3];o=this.getTypeOid(o);const b=this.createAttribute(o,c);s==="+"?t[t.length-1].push(b):t.push(new Qi([b])),s=d}return t}fromJSON(e){const t=new Ft;for(const n of e){const i=new Qi;for(const s in n){const o=this.getTypeOid(s),c=n[s];for(const u of c){const d=this.createAttribute(o,u);i.push(d)}}t.push(i)}return t}getTypeOid(e){if(/[\d.]+/.test(e)||(e=this.getName(e)||""),!e)throw new Error(`Cannot get OID for name type '${e}'`);return e}createAttribute(e,t){const n=new ta({type:e});if(typeof t=="object")for(const i in t)switch(i){case"ia5String":n.value.ia5String=t[i];break;case"utf8String":n.value.utf8String=t[i];break;case"universalString":n.value.universalString=t[i];break;case"bmpString":n.value.bmpString=t[i];break;case"printableString":n.value.printableString=t[i];break}else if(t[0]==="#")n.value.anyValue=ve.FromHex(t.slice(1));else{const i=this.processStringValue(t);e===this.getName("E")||e===this.getName("DC")?n.value.ia5String=i:Zn.isPrintableString(i)?n.value.printableString=i:n.value.utf8String=i}return n}processStringValue(e){const t=/"(.*?[^\\])?"/.exec(e);return t&&(e=t[1]),e.replace(/\\0a/ig,`
144
+ `).replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1")}toArrayBuffer(){return Y.serialize(this.asn)}async getThumbprint(...e){var t;let n,i="SHA-1";return e.length>=1&&!(!((t=e[0])===null||t===void 0)&&t.subtle)?(i=e[0]||i,n=e[1]||Yt.get()):n=e[0]||Yt.get(),await n.subtle.digest(i,this.toArrayBuffer())}}const Pp="Cannot initialize GeneralName from ASN.1 data.",Up=`${Pp} Unsupported string format in use.`,Jg=`${Pp} Value doesn't match to GUID regular expression.`,Dp=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,$p="1.3.6.1.4.1.311.25.1",Mp="1.3.6.1.4.1.311.20.2.3",Ku="dns",Zu="dn",Wu="email",qu="ip",Yu="url",Ju="guid",Xu="upn",ac="id";class Wn extends zn{constructor(...e){let t;if(e.length===2)switch(e[0]){case Zu:{const n=new Zn(e[1]).toArrayBuffer(),i=Y.parse(n,Ft);t=new De({directoryName:i});break}case Ku:t=new De({dNSName:e[1]});break;case Wu:t=new De({rfc822Name:e[1]});break;case Ju:{const n=new RegExp(Dp,"i").exec(e[1]);if(!n)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const i=n.slice(1).map((s,o)=>o<3?ve.ToHex(new Uint8Array(ve.FromHex(s)).reverse()):s).join("");t=new De({otherName:new js({typeId:$p,value:Y.serialize(new nt(ve.FromHex(i)))})});break}case qu:t=new De({iPAddress:e[1]});break;case ac:t=new De({registeredID:e[1]});break;case Xu:{t=new De({otherName:new js({typeId:Mp,value:Y.serialize(Mh.toASN(e[1]))})});break}case Yu:t=new De({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else Q.isBufferSource(e[0])?t=Y.parse(e[0],De):t=e[0];super(t)}onInit(e){if(e.dNSName!=null)this.type=Ku,this.value=e.dNSName;else if(e.rfc822Name!=null)this.type=Wu,this.value=e.rfc822Name;else if(e.iPAddress!=null)this.type=qu,this.value=e.iPAddress;else if(e.uniformResourceIdentifier!=null)this.type=Yu,this.value=e.uniformResourceIdentifier;else if(e.registeredID!=null)this.type=ac,this.value=e.registeredID;else if(e.directoryName!=null)this.type=Zu,this.value=new Zn(e.directoryName).toString();else if(e.otherName!=null)if(e.otherName.typeId===$p){this.type=Ju;const t=Y.parse(e.otherName.value,nt),n=new RegExp(Dp,"i").exec(ve.ToHex(t));if(!n)throw new Error(Jg);this.value=n.slice(1).map((i,s)=>s<3?ve.ToHex(new Uint8Array(ve.FromHex(i)).reverse()):i).join("-")}else if(e.otherName.typeId===Mp)this.type=Xu,this.value=Y.parse(e.otherName.value,Wt).toString();else throw new Error(Up);else throw new Error(Up)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case Zu:case Ku:case Ju:case qu:case ac:case Xu:case Yu:e=this.type.toUpperCase();break;case Wu:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let t=this.value;return this.type===ac&&(t=Rn.toString(t)),new it(e,void 0,t)}}class no extends zn{constructor(e){let t;if(e instanceof cr)t=e;else if(Array.isArray(e)){const n=[];for(const i of e)if(i instanceof De)n.push(i);else{const s=Y.parse(new Wn(i.type,i.value).rawData,De);n.push(s)}t=new cr(n)}else if(Q.isBufferSource(e))t=Y.parse(e,cr);else throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");super(t)}onInit(e){const t=[];for(const n of e){let i=null;try{i=new Wn(n)}catch{continue}t.push(i)}this.items=t}toJSON(){return this.items.map(e=>e.toJSON())}toTextObject(){const e=super.toTextObjectEmpty();for(const t of this.items){const n=t.toTextObject();let i=e[n[it.NAME]];Array.isArray(i)||(i=[],e[n[it.NAME]]=i),i.push(n)}return e}}no.NAME="GeneralNames";const io="-{5}",so="\\n",Xg=`[^${so}]+`,Qg=`${io}BEGIN (${Xg}(?=${io}))${io}`,ev=`${io}END \\1${io}`,ms="\\n",tv=`[^:${so}]+`,rv=`(?:[^${so}]+${ms}(?: +[^${so}]+${ms})*)`,nv=`(?:[a-zA-Z0-9=+/]+${ms})+`,Vp=`${Qg}${ms}(?:((?:${tv}: ${rv})+))?${ms}?(${nv})${ev}`;class xr{static isPem(e){return typeof e=="string"&&new RegExp(Vp,"g").test(e)}static decodeWithHeaders(e){e=e.replace(/\r/g,"");const t=new RegExp(Vp,"g"),n=[];let i=null;for(;i=t.exec(e);){const s=i[3].replace(new RegExp(`[${so}]+`,"g"),""),o={type:i[1],headers:[],rawData:ve.FromBase64(s)},c=i[2];if(c){const u=c.split(new RegExp(ms,"g"));let d=null;for(const b of u){const[_,q]=b.split(/:(.*)/);if(q===void 0){if(!d)throw new Error("Cannot parse PEM string. Incorrect header value");d.value+=_.trim()}else d&&o.headers.push(d),d={key:_,value:q.trim()}}d&&o.headers.push(d)}n.push(o)}return n}static decode(e){return this.decodeWithHeaders(e).map(n=>n.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 n=new Array;return t?e.forEach(i=>{if(!Q.isBufferSource(i))throw new TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");n.push(this.encodeStruct({type:t,rawData:Q.toArrayBuffer(i)}))}):e.forEach(i=>{if(!("type"in i))throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");n.push(this.encodeStruct(i))}),n.join(`
145
145
  `)}else{if(!t)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:t,rawData:Q.toArrayBuffer(e)})}}static encodeStruct(e){var t;const n=e.type.toLocaleUpperCase(),i=[];if(i.push(`-----BEGIN ${n}-----`),!((t=e.headers)===null||t===void 0)&&t.length){for(const d of e.headers)i.push(`${d.key}: ${d.value}`);i.push("")}const s=ve.ToBase64(e.rawData);let o,c=0;const u=Array();for(;c<s.length&&(s.length-c<64?o=s.substring(c):(o=s.substring(c,c+64),c+=64),o.length!==0);)if(u.push(o),o.length<64)break;return i.push(...u),i.push(`-----END ${n}-----`),i.join(`
146
- `)}}xr.CertificateTag="CERTIFICATE",xr.CrlTag="CRL",xr.CertificateRequestTag="CERTIFICATE REQUEST",xr.PublicKeyTag="PUBLIC KEY",xr.PrivateKeyTag="PRIVATE KEY";class Kr extends zn{static isAsnEncoded(e){return Q.isBufferSource(e)||typeof e=="string"}static toArrayBuffer(e){if(typeof e=="string"){if(xr.isPem(e))return xr.decode(e)[0];if(ve.isHex(e))return ve.FromHex(e);if(ve.isBase64(e))return ve.FromBase64(e);if(ve.isBase64Url(e))return ve.FromBase64Url(e);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}else{const t=ve.ToBinary(e);return xr.isPem(t)?xr.decode(t)[0]:ve.isHex(t)?ve.FromHex(t):ve.isBase64(t)?ve.FromBase64(t):ve.isBase64Url(t)?ve.FromBase64Url(t):Q.toArrayBuffer(e)}}constructor(...e){Kr.isAsnEncoded(e[0])?super(Kr.toArrayBuffer(e[0]),e[1]):super(e[0])}toString(e="pem"){switch(e){case"pem":return xr.encode(this.rawData,this.tag);default:return super.toString(e)}}}class ln extends Kr{static async create(e,t=Yt.get()){if(e instanceof ln)return e;if(Kn.isCryptoKey(e)){if(e.type!=="public")throw new TypeError("Public key is required");const n=await t.subtle.exportKey("spki",e);return new ln(n)}else{if(e.publicKey)return e.publicKey;if(Q.isBufferSource(e))return new ln(e);throw new TypeError("Unsupported PublicKeyType")}}constructor(e){Kr.isAsnEncoded(e)?super(e,nn):super(e),this.tag=xr.PublicKeyTag}async export(...e){let t,n=["verify"],i={hash:"SHA-256",...this.algorithm};e.length>1?(i=e[0]||i,n=e[1]||n,t=e[2]||Yt.get()):t=e[0]||Yt.get();let s=this.rawData;const o=J.parse(this.rawData,nn);return o.algorithm.algorithm===Js&&(s=ov(o,s)),t.subtle.importKey("spki",s,i,!0,n)}onInit(e){const t=lr.resolve(vs),n=this.algorithm=t.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case Oi:{const i=J.parse(e.subjectPublicKey,Au),s=Q.toUint8Array(i.modulus);n.publicExponent=Q.toUint8Array(i.publicExponent),n.modulusLength=(s[0]?s:s.slice(1)).byteLength<<3;break}}}async getThumbprint(...e){var t;let n,i="SHA-1";return e.length>=1&&!(!((t=e[0])===null||t===void 0)&&t.subtle)?(i=e[0]||i,n=e[1]||Yt.get()):n=e[0]||Yt.get(),await n.subtle.digest(i,this.rawData)}async getKeyIdentifier(...e){let t,n="SHA-1";e.length===1?typeof e[0]=="string"?(n=e[0],t=Yt.get()):t=e[0]:e.length===2?(n=e[0],t=e[1]):t=Yt.get();const i=J.parse(this.rawData,nn);return await t.subtle.digest(n,i.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),t=J.parse(this.rawData,nn);switch(e.Algorithm=Gn.serializeAlgorithm(t.algorithm),t.algorithm.algorithm){case Ws:e["EC Point"]=t.subjectPublicKey;break;case Oi:default:e["Raw Data"]=t.subjectPublicKey}return e}}function ov(r,e){return r.algorithm=new ae({algorithm:Oi,parameters:null}),e=J.serialize(r),e}class oo extends Pr{static async create(e,t=!1,n=Yt.get()){if("name"in e&&"serialNumber"in e)return new oo(e,t);const s=await(await ln.create(e,n)).getKeyIdentifier(n);return new oo(ve.ToHex(s),t)}constructor(...e){if(Q.isBufferSource(e[0]))super(e[0]);else if(typeof e[0]=="string"){const t=new Ai({keyIdentifier:new yl(ve.FromHex(e[0]))});super(na,e[1],J.serialize(t))}else{const t=e[0],n=t.name instanceof no?J.parse(t.name.rawData,cr):t.name,i=new Ai({authorityCertIssuer:n,authorityCertSerialNumber:ve.FromHex(t.serialNumber)});super(na,e[1],J.serialize(i))}}onInit(e){super.onInit(e);const t=J.parse(e.extnValue,Ai);t.keyIdentifier&&(this.keyId=ve.ToHex(t.keyIdentifier)),(t.authorityCertIssuer||t.authorityCertSerialNumber)&&(this.certId={name:t.authorityCertIssuer||[],serialNumber:t.authorityCertSerialNumber?ve.ToHex(t.authorityCertSerialNumber):""})}toTextObject(){const e=this.toTextObjectWithoutValue(),t=J.parse(this.value,Ai);return t.authorityCertIssuer&&(e["Authority Issuer"]=new no(t.authorityCertIssuer).toTextObject()),t.authorityCertSerialNumber&&(e["Authority Serial Number"]=t.authorityCertSerialNumber),t.keyIdentifier&&(e[""]=t.keyIdentifier),e}}oo.NAME="Authority Key Identifier";class Lp extends Pr{constructor(...e){if(Q.isBufferSource(e[0])){super(e[0]);const t=J.parse(this.value,ia);this.ca=t.cA,this.pathLength=t.pathLenConstraint}else{const t=new ia({cA:e[0],pathLenConstraint:e[1]});super(qh,e[2],J.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}}Lp.NAME="Basic Constraints";var Hp;(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"})(Hp||(Hp={}));class Fp extends Pr{constructor(...e){if(Q.isBufferSource(e[0])){super(e[0]);const t=J.parse(this.value,la);this.usages=t.map(n=>n)}else{const t=new la(e[0]);super(td,e[1],J.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(t=>Rn.toString(t)).join(", "),e}}Fp.NAME="Extended Key Usages";var Gp;(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"})(Gp||(Gp={}));class zp extends Pr{constructor(...e){if(Q.isBufferSource(e[0])){super(e[0]);const t=J.parse(this.value,Ol);this.usages=t.toNumber()}else{const t=new Ol(e[0]);super(nd,e[1],J.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=J.parse(this.value,Ol);return e[""]=t.toJSON().join(", "),e}}zp.NAME="Key Usages";class cc extends Pr{static async create(e,t=!1,n=Yt.get()){const s=await(await ln.create(e,n)).getKeyIdentifier(n);return new cc(ve.ToHex(s),t)}constructor(...e){if(Q.isBufferSource(e[0])){super(e[0]);const t=J.parse(this.value,Ln);this.keyId=ve.ToHex(t)}else{const t=typeof e[0]=="string"?ve.FromHex(e[0]):e[0],n=new Ln(t);super($l,e[1],J.serialize(n)),this.keyId=ve.ToHex(t)}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=J.parse(this.value,Ln);return e[""]=t,e}}cc.NAME="Subject Key Identifier";class Kp extends Pr{constructor(...e){Q.isBufferSource(e[0])?super(e[0]):super(Pl,e[1],new no(e[0]||[]).rawData)}onInit(e){super.onInit(e);const t=J.parse(e.extnValue,Ul);this.names=new no(t)}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.names.toTextObject();for(const n in t)e[n]=t[n];return e}}Kp.NAME="Subject Alternative Name";class Ur{static register(e,t){this.items.set(e,t)}static create(e){const t=new Pr(e),n=this.items.get(t.type);return n?new n(e):t}}Ur.items=new Map;class Zp extends Pr{constructor(...e){var t;if(Q.isBufferSource(e[0])){super(e[0]);const n=J.parse(this.value,aa);this.policies=n.map(i=>i.policyIdentifier)}else{const n=e[0],i=(t=e[1])!==null&&t!==void 0?t:!1,s=new aa(n.map(o=>new oa({policyIdentifier:o})));super(Jh,i,J.serialize(s)),this.policies=n}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(t=>new nt("",{},Rn.toString(t))),e}}Zp.NAME="Certificate Policies",Ur.register(Jh,Zp);class Wp extends Pr{constructor(...e){var t;if(Q.isBufferSource(e[0]))super(e[0]);else if(Array.isArray(e[0])&&typeof e[0][0]=="string"){const i=e[0].map(o=>new rs({distributionPoint:new _i({fullName:[new De({uniformResourceIdentifier:o})]})})),s=new ns(i);super(_l,e[1],J.serialize(s))}else{const n=new ns(e[0]);super(_l,e[1],J.serialize(n))}(t=this.distributionPoints)!==null&&t!==void 0||(this.distributionPoints=[])}onInit(e){super.onInit(e);const t=J.parse(e.extnValue,ns);this.distributionPoints=t}toTextObject(){const e=this.toTextObjectWithoutValue();return e["Distribution Point"]=this.distributionPoints.map(t=>{var n;const i={};return t.distributionPoint&&(i[""]=(n=t.distributionPoint.fullName)===null||n===void 0?void 0:n.map(s=>new Wn(s).toString()).join(", ")),t.reasons&&(i.Reasons=t.reasons.toString()),t.cRLIssuer&&(i["CRL Issuer"]=t.cRLIssuer.map(s=>s.toString()).join(", ")),i}),e}}Wp.NAME="CRL Distribution Points";class qp extends Pr{constructor(...e){var t,n,i,s;if(Q.isBufferSource(e[0]))super(e[0]);else if(e[0]instanceof ts){const o=new ts(e[0]);super(pl,e[1],J.serialize(o))}else{const o=e[0],c=new ts;uc(c,o,zh,"ocsp"),uc(c,o,Kh,"caIssuers"),uc(c,o,Zh,"timeStamping"),uc(c,o,Wh,"caRepository"),super(pl,e[1],J.serialize(c))}(t=this.ocsp)!==null&&t!==void 0||(this.ocsp=[]),(n=this.caIssuers)!==null&&n!==void 0||(this.caIssuers=[]),(i=this.timeStamping)!==null&&i!==void 0||(this.timeStamping=[]),(s=this.caRepository)!==null&&s!==void 0||(this.caRepository=[])}onInit(e){super.onInit(e),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[],J.parse(e.extnValue,ts).forEach(n=>{switch(n.accessMethod){case zh:this.ocsp.push(new Wn(n.accessLocation));break;case Kh:this.caIssuers.push(new Wn(n.accessLocation));break;case Zh:this.timeStamping.push(new Wn(n.accessLocation));break;case Wh:this.caRepository.push(new Wn(n.accessLocation));break}})}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ocsp.length&&lc(e,"OCSP",this.ocsp),this.caIssuers.length&&lc(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&lc(e,"Time Stamping",this.timeStamping),this.caRepository.length&&lc(e,"CA Repository",this.caRepository),e}}qp.NAME="Authority Info Access";function lc(r,e,t){if(t.length===1)r[e]=t[0].toTextObject();else{const n=new nt("");t.forEach((i,s)=>{const o=i.toTextObject(),c=`${o[nt.NAME]} ${s+1}`;let u=n[c];Array.isArray(u)||(u=[],n[c]=u),u.push(o)}),r[e]=n}}function uc(r,e,t,n){const i=e[n];i&&(Array.isArray(i)?i:[i]).forEach(o=>{typeof o=="string"&&(o=new Wn("url",o)),r.push(new Ps({accessMethod:t,accessLocation:J.parse(o.rawData,De)}))})}class ws extends zn{constructor(...e){let t;if(Q.isBufferSource(e[0]))t=Q.toArrayBuffer(e[0]);else{const n=e[0],i=Array.isArray(e[1])?e[1].map(s=>Q.toArrayBuffer(s)):[];t=J.serialize(new Cn({type:n,values:i}))}super(t,Cn)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Value=this.values.map(t=>new nt("",{"":t})),e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty();return e[nt.NAME]===ws.NAME&&(e[nt.NAME]=Rn.toString(this.type)),e}}ws.NAME="Attribute";class Yp extends ws{constructor(...e){var t;if(Q.isBufferSource(e[0]))super(e[0]);else{const n=new ic({printableString:e[0]});super(Fd,[J.serialize(n)])}(t=this.password)!==null&&t!==void 0||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){const t=J.parse(this.values[0],ic);this.password=t.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[nt.VALUE]=this.password,e}}Yp.NAME="Challenge Password";class Qu extends ws{constructor(...e){var t;if(Q.isBufferSource(e[0]))super(e[0]);else{const n=e[0],i=new Si;for(const s of n)i.push(J.parse(s.rawData,Gr));super(Du,[J.serialize(i)])}(t=this.items)!==null&&t!==void 0||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){const t=J.parse(this.values[0],Si);this.items=t.map(n=>Ur.create(J.serialize(n)))}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.items.map(n=>n.toTextObject());for(const n of t)e[n[nt.NAME]]=n;return e}}Qu.NAME="Extensions";class fc{static register(e,t){this.items.set(e,t)}static create(e){const t=new ws(e),n=this.items.get(t.type);return n?new n(e):t}}fc.items=new Map;const hc="crypto.signatureFormatter";class av{toAsnSignature(e,t){return Q.toArrayBuffer(t)}toWebSignature(e,t){return Q.toArrayBuffer(t)}}var dc;let ef=dc=class{static createPssParams(e,t){const n=dc.getHashAlgorithm(e);return n?new Ni({hashAlgorithm:n,maskGenAlgorithm:new ae({algorithm:Fa,parameters:J.serialize(n)}),saltLength:t}):null}static getHashAlgorithm(e){const t=lr.resolve(vs);return typeof e=="string"?t.toAsnAlgorithm({name:e}):typeof e=="object"&&e&&"name"in e?t.toAsnAlgorithm(e):null}toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if("hash"in e){let t;if(typeof e.hash=="string")t=e.hash;else if(e.hash&&typeof e.hash=="object"&&"name"in e.hash&&typeof e.hash.name=="string")t=e.hash.name.toUpperCase();else throw new Error("Cannot get hash algorithm name");switch(t.toLowerCase()){case"sha-1":return new ae({algorithm:Ua,parameters:null});case"sha-256":return new ae({algorithm:wu,parameters:null});case"sha-384":return new ae({algorithm:Da,parameters:null});case"sha-512":return new ae({algorithm:$a,parameters:null})}}else return new ae({algorithm:Oi,parameters:null});break;case"rsa-pss":if("hash"in e){if(!("saltLength"in e&&typeof e.saltLength=="number"))throw new Error("Cannot get 'saltLength' from 'alg' argument");const t=dc.createPssParams(e.hash,e.saltLength);if(!t)throw new Error("Cannot create PSS parameters");return new ae({algorithm:Js,parameters:J.serialize(t)})}else return new ae({algorithm:Js,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case Oi:return{name:"RSASSA-PKCS1-v1_5"};case Ua:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case wu:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case Da:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case $a:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case Js:if(e.parameters){const t=J.parse(e.parameters,Ni);return{name:"RSA-PSS",hash:lr.resolve(vs).toWebAlgorithm(t.hashAlgorithm),saltLength:t.saltLength}}else return{name:"RSA-PSS"}}return null}};ef=dc=f([Ja()],ef),lr.registerSingleton(to,ef);let tf=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new ae({algorithm:Ma});case"sha-256":return new ae({algorithm:Va});case"sha-384":return new ae({algorithm:La});case"sha-512":return new ae({algorithm:Ha})}return null}toWebAlgorithm(e){switch(e.algorithm){case Ma:return{name:"SHA-1"};case Va:return{name:"SHA-256"};case La:return{name:"SHA-384"};case Ha:return{name:"SHA-512"}}return null}};tf=f([Ja()],tf),lr.registerSingleton(to,tf);class Dr{addPadding(e,t){const n=Q.toUint8Array(t),i=new Uint8Array(e);return i.set(n,e-n.length),i}removePadding(e,t=!1){let n=Q.toUint8Array(e);for(let i=0;i<n.length;i++)if(n[i]){n=n.slice(i);break}if(t&&n[0]>127){const i=new Uint8Array(n.length+1);return i.set(n,1),i.buffer}return n.buffer}toAsnSignature(e,t){if(e.name==="ECDSA"){const n=e.namedCurve,i=Dr.namedCurveSize.get(n)||Dr.defaultNamedCurveSize,s=new Pa,o=Q.toUint8Array(t);return s.r=this.removePadding(o.slice(0,i),!0),s.s=this.removePadding(o.slice(i,i+i),!0),J.serialize(s)}return null}toWebSignature(e,t){if(e.name==="ECDSA"){const n=J.parse(t,Pa),i=e.namedCurve,s=Dr.namedCurveSize.get(i)||Dr.defaultNamedCurveSize,o=this.addPadding(s,this.removePadding(n.r)),c=this.addPadding(s,this.removePadding(n.s));return xy(o,c)}return null}}Dr.namedCurveSize=new Map,Dr.defaultNamedCurveSize=32;const rf="1.3.101.110",Jp="1.3.101.111",nf="1.3.101.112",Xp="1.3.101.113";let sf=class{toAsnAlgorithm(e){let t=null;switch(e.name.toLowerCase()){case"ed25519":t=nf;break;case"x25519":t=rf;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":t=nf;break;case"ed448":t=Xp;break}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":t=rf;break;case"x448":t=Jp;break}}return t?new ae({algorithm:t}):null}toWebAlgorithm(e){switch(e.algorithm){case nf:return{name:"Ed25519"};case Xp:return{name:"EdDSA",namedCurve:"Ed448"};case rf:return{name:"X25519"};case Jp:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};sf=f([Ja()],sf),lr.registerSingleton(to,sf);class cv extends Kr{constructor(e){Kr.isAsnEncoded(e)?super(e,eo):super(e),this.tag=xr.CertificateRequestTag}onInit(e){this.tbs=J.serialize(e.certificationRequestInfo),this.publicKey=new ln(e.certificationRequestInfo.subjectPKInfo);const t=lr.resolve(vs);this.signatureAlgorithm=t.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signature,this.attributes=e.certificationRequestInfo.attributes.map(i=>fc.create(J.serialize(i)));const n=this.getAttribute(Du);this.extensions=[],n instanceof Qu&&(this.extensions=n.items),this.subjectName=new Zn(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=Yt.get()){const t={...this.publicKey.algorithm,...this.signatureAlgorithm},n=await this.publicKey.export(t,["verify"],e),i=lr.resolveAll(hc).reverse();let s=null;for(const c of i)if(s=c.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,n,s,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),t=J.parse(this.rawData,eo),n=t.certificationRequestInfo,i=new nt("",{Version:`${is[n.version]} (${n.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const s=new nt("");for(const o of this.attributes){const c=o.toTextObject();s[c[nt.NAME]]=c}i.Attributes=s}return e.Data=i,e.Signature=new nt("",{Algorithm:Gn.serializeAlgorithm(t.signatureAlgorithm),"":t.signature}),e}}cv.NAME="PKCS#10 Certificate Request";class ji extends Kr{constructor(e){Kr.isAsnEncoded(e)?super(e,Ei):super(e),this.tag=xr.CertificateTag}onInit(e){const t=e.tbsCertificate;this.tbs=J.serialize(t),this.serialNumber=ve.ToHex(t.serialNumber),this.subjectName=new Zn(t.subject),this.subject=new Zn(t.subject).toString(),this.issuerName=new Zn(t.issuer),this.issuer=this.issuerName.toString();const n=lr.resolve(vs);this.signatureAlgorithm=n.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signatureValue;const i=t.validity.notBefore.utcTime||t.validity.notBefore.generalTime;if(!i)throw new Error("Cannot get 'notBefore' value");this.notBefore=i;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(o=>Ur.create(J.serialize(o)))),this.publicKey=new ln(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=Yt.get()){let n,i;const s=e.publicKey;try{if(!s)n={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(n,["verify"],t);else if("publicKey"in s)n={...s.publicKey.algorithm,...this.signatureAlgorithm},i=await s.publicKey.export(n,["verify"],t);else if(s instanceof ln)n={...s.algorithm,...this.signatureAlgorithm},i=await s.export(n,["verify"],t);else if(Q.isBufferSource(s)){const d=new ln(s);n={...d.algorithm,...this.signatureAlgorithm},i=await d.export(n,["verify"],t)}else n={...s.algorithm,...this.signatureAlgorithm},i=s}catch{return!1}const o=lr.resolveAll(hc).reverse();let c=null;for(const d of o)if(c=d.toWebSignature(n,this.signature),c)break;if(!c)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const u=await t.subtle.verify(this.signatureAlgorithm,i,c,this.tbs);if(e.signatureOnly)return u;{const b=(e.date||new Date).getTime();return u&&this.notBefore.getTime()<b&&b<this.notAfter.getTime()}}async getThumbprint(...e){let t,n="SHA-1";return e[0]&&(e[0].subtle?t=e[0]:(n=e[0]||n,t=e[1])),t??(t=Yt.get()),await t.subtle.digest(n,this.rawData)}async isSelfSigned(e=Yt.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){const e=this.toTextObjectEmpty(),t=J.parse(this.rawData,Ei),n=t.tbsCertificate,i=new nt("",{Version:`${is[n.version]} (${n.version})`,"Serial Number":n.serialNumber,"Signature Algorithm":Gn.serializeAlgorithm(n.signature),Issuer:this.issuer,Validity:new nt("",{"Not Before":n.validity.notBefore.getTime(),"Not After":n.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(n.issuerUniqueID&&(i["Issuer Unique ID"]=n.issuerUniqueID),n.subjectUniqueID&&(i["Subject Unique ID"]=n.subjectUniqueID),this.extensions.length){const s=new nt("");for(const o of this.extensions){const c=o.toTextObject();s[c[nt.NAME]]=c}i.Extensions=s}return e.Data=i,e.Signature=new nt("",{Algorithm:Gn.serializeAlgorithm(t.signatureAlgorithm),"":t.signatureValue}),e}}ji.NAME="Certificate";class lv extends Array{constructor(e){if(super(),Kr.isAsnEncoded(e))this.import(e);else if(e instanceof ji)this.push(e);else if(Array.isArray(e))for(const t of e)this.push(t)}export(e){const t=new Tn;t.version=1,t.encapContentInfo.eContentType=gg,t.encapContentInfo.eContent=new us({single:new rt}),t.certificates=new Vs(this.map(s=>new Ci({certificate:J.parse(s.rawData,Ei)})));const n=new On({contentType:hu,content:J.serialize(t)}),i=J.serialize(n);return e==="raw"?i:this.toString(e)}import(e){const t=Kr.toArrayBuffer(e),n=J.parse(t,On);if(n.contentType!==hu)throw new TypeError("Cannot parse CMS package. Incoming data is not a SignedData object.");const i=J.parse(n.content,Tn);this.clear();for(const s of i.certificates||[])s.certificate&&this.push(new ji(s.certificate))}clear(){for(;this.pop(););}toString(e="pem"){const t=this.export("raw");switch(e){case"pem":return xr.encode(t,"CMS");case"pem-chain":return this.map(n=>n.toString("pem")).join(`
147
- `);case"asn":return J.toString(t);case"hex":return ve.ToHex(t);case"base64":return ve.ToBase64(t);case"base64url":return ve.ToBase64Url(t);case"text":return Gn.serialize(this.toTextObject());default:throw TypeError("Argument 'format' is unsupported value")}}toTextObject(){const e=J.parse(this.export("raw"),On),t=J.parse(e.content,Tn);return new nt("X509Certificates",{"Content Type":Rn.toString(e.contentType),Content:new nt("",{Version:`${sn[t.version]} (${t.version})`,Certificates:new nt("",{Certificate:this.map(i=>i.toTextObject())})})})}}class uv{constructor(e={}){this.certificates=[],e.certificates&&(this.certificates=e.certificates)}async build(e,t=Yt.get()){const n=new lv(e);let i=e;for(;i=await this.findIssuer(i,t);){const s=await i.getThumbprint(t);for(const o of n){const c=await o.getThumbprint(t);if(jo(s,c))throw new Error("Cannot build a certificate chain. Circular dependency.")}n.push(i)}return n}async findIssuer(e,t=Yt.get()){if(!await e.isSelfSigned(t)){const n=e.getExtension(na);for(const i of this.certificates)if(i.subject===e.issuer){if(n){if(n.keyId){const s=i.getExtension($l);if(s&&s.keyId!==n.keyId)continue}else if(n.certId){const s=i.getExtension(Pl);if(s&&!(n.certId.serialNumber===i.serialNumber&&jo(J.serialize(n.certId.name),J.serialize(s))))continue}}try{const s={...i.publicKey.algorithm,...e.signatureAlgorithm},o=await i.publicKey.export(s,["verify"],t);if(!await e.verify({publicKey:o,signatureOnly:!0},t))continue}catch{continue}return i}}return null}}var Qp;(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"})(Qp||(Qp={})),Ur.register(qh,Lp),Ur.register(td,Fp),Ur.register(nd,zp),Ur.register($l,cc),Ur.register(na,oo),Ur.register(Pl,Kp),Ur.register(_l,Wp),Ur.register(pl,qp),fc.register(Fd,Yp),fc.register(Du,Qu),lr.registerSingleton(hc,av),lr.registerSingleton(hc,Dr),Dr.namedCurveSize.set("P-256",32),Dr.namedCurveSize.set("K-256",32),Dr.namedCurveSize.set("P-384",48),Dr.namedCurveSize.set("P-521",66);const Ae={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7},kt={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,MIME:36,SET:258,JSON:262,REGEXP:21066,SELF_DESCRIBED:55799,INVALID_16:65535,INVALID_32:4294967295,INVALID_64:0xffffffffffffffffn},bt={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31},qn={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23};let Er=(Oo=class{},Ze(Oo,"BREAK",Symbol.for("github.com/hildjj/cbor2/break")),Ze(Oo,"ENCODED",Symbol.for("github.com/hildjj/cbor2/cbor-encoded")),Ze(Oo,"LENGTH",Symbol.for("github.com/hildjj/cbor2/length")),Oo);const pc={MIN:-(2n**63n),MAX:2n**64n-1n};let qe=(Un=class{constructor(e,t=void 0){Ze(this,"tag");Ze(this,"contents");this.tag=e,this.contents=t}get noChildren(){var e;return!!((e=M(Un,dn).get(this.tag))!=null&&e.noChildren)}static registerDecoder(e,t,n){const i=M(this,dn).get(e);return M(this,dn).set(e,t),i&&("comment"in t||(t.comment=i.comment),"noChildren"in t||(t.noChildren=i.noChildren)),n&&!t.comment&&(t.comment=()=>`(${n})`),i}static clearDecoder(e){const t=M(this,dn).get(e);return M(this,dn).delete(e),t}*[Symbol.iterator](){yield this.contents}push(e){return this.contents=e,1}decode(e){const t=M(Un,dn).get(this.tag);return t?t(this,e):this}comment(e,t){const n=M(Un,dn).get(this.tag);if(n!=null&&n.comment)return n.comment(this,e,t)}toCBOR(){return[this.tag,this.contents]}[Symbol.for("nodejs.util.inspect.custom")](e,t,n){return`${this.tag}(${n(this.contents,t)})`}},dn=new WeakMap,or(Un,dn,new Map),Un);function yc(r){if(r!=null&&typeof r=="object")return r[Er.ENCODED]}function fv(r){if(r!=null&&typeof r=="object")return r[Er.LENGTH]}function ao(r,e){Object.defineProperty(r,Er.ENCODED,{configurable:!0,enumerable:!1,value:e})}function co(r,e){const t=Object(r);return ao(t,e),t}function e0(r){let e=Math.ceil(r.length/2);const t=new Uint8Array(e);e--;for(let n=r.length,i=n-2;n>=0;n=i,i-=2,e--)t[e]=parseInt(r.substring(i,n),16);return t}function Zr(r){return r.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),"")}function hv(r){const e=r.reduce((i,s)=>i+s.length,0),t=new Uint8Array(e);let n=0;for(const i of r)t.set(i,n),n+=i.length;return t}function of(r){const e=atob(r);return Uint8Array.from(e,t=>t.codePointAt(0))}const dv={"-":"+",_:"/"};function pv(r){const e=r.replace(/[_-]/g,t=>dv[t]);return of(e.padEnd(Math.ceil(e.length/4)*4,"="))}function yv(){const r=new Uint8Array(4),e=new Uint32Array(r.buffer);return!((e[0]=1)&r[0])}function t0(r){var t;let e="";for(const n of r){const i=(t=n.codePointAt(0))==null?void 0:t.toString(16).padStart(4,"0");e&&(e+=", "),e+=`U+${i}`}return e}function r0(r,e){const[t,n,i]=r,[s,o,c]=e,u=Math.min(i.length,c.length);for(let d=0;d<u;d++){const b=i[d]-c[d];if(b!==0)return b}return 0}const Pc=class Pc{constructor(e={}){or(this,tt);or(this,ii);or(this,Jt,[]);or(this,Ar,null);or(this,Mt,0);or(this,si,0);if(jt(this,ii,{...Pc.defaultOptions,...e}),M(this,ii).chunkSize<8)throw new RangeError(`Expected size >= 8, got ${M(this,ii).chunkSize}`);$e(this,tt,Ki).call(this)}get length(){return M(this,si)}read(){$e(this,tt,$c).call(this);const e=new Uint8Array(M(this,si));let t=0;for(const n of M(this,Jt))e.set(n,t),t+=n.length;return $e(this,tt,Ki).call(this),e}write(e){const t=e.length;t>$e(this,tt,Ef).call(this)?($e(this,tt,$c).call(this),t>M(this,ii).chunkSize?(M(this,Jt).push(e),$e(this,tt,Ki).call(this)):($e(this,tt,Ki).call(this),M(this,Jt)[M(this,Jt).length-1].set(e),jt(this,Mt,t))):(M(this,Jt)[M(this,Jt).length-1].set(e,M(this,Mt)),jt(this,Mt,M(this,Mt)+t)),jt(this,si,M(this,si)+t)}writeUint8(e){$e(this,tt,bn).call(this,1),M(this,Ar).setUint8(M(this,Mt),e),$e(this,tt,xn).call(this,1)}writeUint16(e,t=!1){$e(this,tt,bn).call(this,2),M(this,Ar).setUint16(M(this,Mt),e,t),$e(this,tt,xn).call(this,2)}writeUint32(e,t=!1){$e(this,tt,bn).call(this,4),M(this,Ar).setUint32(M(this,Mt),e,t),$e(this,tt,xn).call(this,4)}writeBigUint64(e,t=!1){$e(this,tt,bn).call(this,8),M(this,Ar).setBigUint64(M(this,Mt),e,t),$e(this,tt,xn).call(this,8)}writeInt16(e,t=!1){$e(this,tt,bn).call(this,2),M(this,Ar).setInt16(M(this,Mt),e,t),$e(this,tt,xn).call(this,2)}writeInt32(e,t=!1){$e(this,tt,bn).call(this,4),M(this,Ar).setInt32(M(this,Mt),e,t),$e(this,tt,xn).call(this,4)}writeBigInt64(e,t=!1){$e(this,tt,bn).call(this,8),M(this,Ar).setBigInt64(M(this,Mt),e,t),$e(this,tt,xn).call(this,8)}writeFloat32(e,t=!1){$e(this,tt,bn).call(this,4),M(this,Ar).setFloat32(M(this,Mt),e,t),$e(this,tt,xn).call(this,4)}writeFloat64(e,t=!1){$e(this,tt,bn).call(this,8),M(this,Ar).setFloat64(M(this,Mt),e,t),$e(this,tt,xn).call(this,8)}clear(){jt(this,si,0),jt(this,Jt,[]),$e(this,tt,Ki).call(this)}};ii=new WeakMap,Jt=new WeakMap,Ar=new WeakMap,Mt=new WeakMap,si=new WeakMap,tt=new WeakSet,Ki=function(){const e=new Uint8Array(M(this,ii).chunkSize);M(this,Jt).push(e),jt(this,Mt,0),jt(this,Ar,new DataView(e.buffer,e.byteOffset,e.byteLength))},$c=function(){if(M(this,Mt)===0){M(this,Jt).pop();return}const e=M(this,Jt).length-1;M(this,Jt)[e]=M(this,Jt)[e].subarray(0,M(this,Mt)),jt(this,Mt,0),jt(this,Ar,null)},Ef=function(){const e=M(this,Jt).length-1;return M(this,Jt)[e].length-M(this,Mt)},bn=function(e){$e(this,tt,Ef).call(this)<e&&($e(this,tt,$c).call(this),$e(this,tt,Ki).call(this))},xn=function(e){jt(this,Mt,M(this,Mt)+e),jt(this,si,M(this,si)+e)},Ze(Pc,"defaultOptions",{chunkSize:4096});let gc=Pc;function n0(r,e=0,t=!1){const n=r[e]&128?-1:1,i=(r[e]&124)>>2,s=(r[e]&3)<<8|r[e+1];if(i===0){if(t&&s!==0)throw new Error(`Unwanted subnormal: ${n*5960464477539063e-23*s}`);return n*5960464477539063e-23*s}else if(i===31)return s?NaN:n*(1/0);return n*2**(i-25)*(1024+s)}function gv(r){const e=new DataView(new ArrayBuffer(4));e.setFloat32(0,r,!1);const t=e.getUint32(0,!1);if(t&8191)return null;let n=t>>16&32768;const i=t>>23&255,s=t&8388607;if(!(i===0&&s===0))if(i>=113&&i<=142)n+=(i-112<<10)+(s>>13);else if(i>=103&&i<113){if(s&(1<<126-i)-1)return null;n+=s+8388608>>126-i}else if(i===255)n|=31744,n|=s>>13;else return null;return n}function vv(r){if(r!==0){const e=new ArrayBuffer(8),t=new DataView(e);t.setFloat64(0,r,!1);const n=t.getBigUint64(0,!1);if((n&0x7ff0000000000000n)===0n)return n&0x8000000000000000n?-0:0}return r}function mv(r){switch(r.length){case 2:n0(r,0,!0);break;case 4:{const e=new DataView(r.buffer,r.byteOffset,r.byteLength),t=e.getUint32(0,!1);if(!(t&2139095040)&&t&8388607)throw new Error(`Unwanted subnormal: ${e.getFloat32(0,!1)}`);break}case 8:{const e=new DataView(r.buffer,r.byteOffset,r.byteLength),t=e.getBigUint64(0,!1);if((t&0x7ff0000000000000n)===0n&&t&0x000fffffffffffn)throw new Error(`Unwanted subnormal: ${e.getFloat64(0,!1)}`);break}default:throw new TypeError(`Bad input to isSubnormal: ${r}`)}}const i0=Ae.SIMPLE_FLOAT<<5|bt.TWO,wv=Ae.SIMPLE_FLOAT<<5|bt.FOUR,bv=Ae.SIMPLE_FLOAT<<5|bt.EIGHT,xv=Ae.SIMPLE_FLOAT<<5|qn.TRUE,Av=Ae.SIMPLE_FLOAT<<5|qn.FALSE,_v=Ae.SIMPLE_FLOAT<<5|qn.UNDEFINED,Sv=Ae.SIMPLE_FLOAT<<5|qn.NULL,Ev=new TextEncoder,kv={...gc.defaultOptions,avoidInts:!1,cde:!1,collapseBigInts:!0,dcbor:!1,float64:!1,flushToZero:!1,forceEndian:null,ignoreOriginalEncoding:!1,largeNegativeAsBigInt:!1,reduceUnsafeNumbers:!1,rejectBigInts:!1,rejectCustomSimples:!1,rejectDuplicateKeys:!1,rejectFloats:!1,rejectUndefined:!1,simplifyNegativeZero:!1,sortKeys:null,stringNormalization:null},s0={cde:!0,ignoreOriginalEncoding:!0,sortKeys:r0},Iv={...s0,dcbor:!0,largeNegativeAsBigInt:!0,reduceUnsafeNumbers:!0,rejectCustomSimples:!0,rejectDuplicateKeys:!0,rejectUndefined:!0,simplifyNegativeZero:!0,stringNormalization:"NFC"};function o0(r){const e=r<0;return typeof r=="bigint"?[e?-r-1n:r,e]:[e?-r-1:r,e]}function af(r,e,t){if(t.rejectFloats)throw new Error(`Attempt to encode an unwanted floating point number: ${r}`);if(isNaN(r))e.writeUint8(i0),e.writeUint16(32256);else if(!t.float64&&Math.fround(r)===r){const n=gv(r);n===null?(e.writeUint8(wv),e.writeFloat32(r)):(e.writeUint8(i0),e.writeUint16(n))}else e.writeUint8(bv),e.writeFloat64(r)}function Wr(r,e,t){const[n,i]=o0(r);if(i&&t)throw new TypeError(`Negative size: ${r}`);t??(t=i?Ae.NEG_INT:Ae.POS_INT),t<<=5,n<24?e.writeUint8(t|n):n<=255?(e.writeUint8(t|bt.ONE),e.writeUint8(n)):n<=65535?(e.writeUint8(t|bt.TWO),e.writeUint16(n)):n<=4294967295?(e.writeUint8(t|bt.FOUR),e.writeUint32(n)):(e.writeUint8(t|bt.EIGHT),e.writeBigUint64(BigInt(n)))}function vc(r,e,t){typeof r=="number"?Wr(r,e,Ae.TAG):typeof r=="object"&&!t.ignoreOriginalEncoding&&Er.ENCODED in r?e.write(r[Er.ENCODED]):r<=Number.MAX_SAFE_INTEGER?Wr(Number(r),e,Ae.TAG):(e.writeUint8(Ae.TAG<<5|bt.EIGHT),e.writeBigUint64(BigInt(r)))}function a0(r,e,t){const[n,i]=o0(r);if(t.collapseBigInts&&(!t.largeNegativeAsBigInt||r>=-0x8000000000000000n)){if(n<=0xffffffffn){Wr(Number(r),e);return}if(n<=0xffffffffffffffffn){const d=(i?Ae.NEG_INT:Ae.POS_INT)<<5;e.writeUint8(d|bt.EIGHT),e.writeBigUint64(n);return}}if(t.rejectBigInts)throw new Error(`Attempt to encode unwanted bigint: ${r}`);const s=i?kt.NEG_BIGINT:kt.POS_BIGINT,o=n.toString(16),c=o.length%2?"0":"";vc(s,e,t);const u=e0(c+o);Wr(u.length,e,Ae.BYTE_STRING),e.write(u)}function Cv(r,e,t){t.flushToZero&&(r=vv(r)),Object.is(r,-0)?t.simplifyNegativeZero?t.avoidInts?af(0,e,t):Wr(0,e):af(r,e,t):!t.avoidInts&&Number.isSafeInteger(r)?Wr(r,e):t.reduceUnsafeNumbers&&Math.floor(r)===r&&r>=pc.MIN&&r<=pc.MAX?a0(BigInt(r),e,t):af(r,e,t)}function Bv(r,e,t){const n=t.stringNormalization?r.normalize(t.stringNormalization):r,i=Ev.encode(n);Wr(i.length,e,Ae.UTF8_STRING),e.write(i)}function Ov(r,e,t){const n=r;lf(n,n.length,Ae.ARRAY,e,t);for(const i of n)Pi(i,e,t)}function Tv(r,e){const t=r;Wr(t.length,e,Ae.BYTE_STRING),e.write(t)}const cf=new Map([[Array,Ov],[Uint8Array,Tv]]);function Pt(r,e){const t=cf.get(r);return cf.set(r,e),t}function lf(r,e,t,n,i){const s=fv(r);s&&!i.ignoreOriginalEncoding?n.write(s):Wr(e,n,t)}function Nv(r,e,t){if(r===null){e.writeUint8(Sv);return}if(!t.ignoreOriginalEncoding&&Er.ENCODED in r){e.write(r[Er.ENCODED]);return}const n=cf.get(r.constructor);if(n){const s=n(r,e,t);s&&((typeof s[0]=="bigint"||isFinite(Number(s[0])))&&vc(s[0],e,t),Pi(s[1],e,t));return}if(typeof r.toCBOR=="function"){const s=r.toCBOR(e,t);s&&((typeof s[0]=="bigint"||isFinite(Number(s[0])))&&vc(s[0],e,t),Pi(s[1],e,t));return}if(typeof r.toJSON=="function"){Pi(r.toJSON(),e,t);return}const i=Object.entries(r).map(s=>[s[0],s[1],mc(s[0],t)]);t.sortKeys&&i.sort(t.sortKeys),lf(r,i.length,Ae.MAP,e,t);for(const[s,o,c]of i)e.write(c),Pi(o,e,t)}function Pi(r,e,t){switch(typeof r){case"number":Cv(r,e,t);break;case"bigint":a0(r,e,t);break;case"string":Bv(r,e,t);break;case"boolean":e.writeUint8(r?xv:Av);break;case"undefined":if(t.rejectUndefined)throw new Error("Attempt to encode unwanted undefined.");e.writeUint8(_v);break;case"object":Nv(r,e,t);break;case"symbol":throw new TypeError(`Unknown symbol: ${r.toString()}`);default:throw new TypeError(`Unknown type: ${typeof r}, ${String(r)}`)}}function mc(r,e={}){const t={...kv};e.dcbor?Object.assign(t,Iv):e.cde&&Object.assign(t,s0),Object.assign(t,e);const n=new gc(t);return Pi(r,n,t),n.read()}var c0=(r=>(r[r.NEVER=-1]="NEVER",r[r.PREFERRED=0]="PREFERRED",r[r.ALWAYS=1]="ALWAYS",r))(c0||{});const oi=class oi{constructor(e){Ze(this,"value");this.value=e}static create(e){return oi.KnownSimple.has(e)?oi.KnownSimple.get(e):new oi(e)}toCBOR(e,t){if(t.rejectCustomSimples)throw new Error(`Cannot encode non-standard Simple value: ${this.value}`);Wr(this.value,e,Ae.SIMPLE_FLOAT)}toString(){return`simple(${this.value})`}decode(){return oi.KnownSimple.has(this.value)?oi.KnownSimple.get(this.value):this}[Symbol.for("nodejs.util.inspect.custom")](e,t,n){return`simple(${n(this.value,t)})`}};Ze(oi,"KnownSimple",new Map([[qn.FALSE,!1],[qn.TRUE,!0],[qn.NULL,null],[qn.UNDEFINED,void 0]]));let lo=oi;const Rv=new TextDecoder("utf8",{fatal:!0,ignoreBOM:!0}),Uc=class Uc{constructor(e,t){or(this,Qt);or(this,Br);or(this,Xr);or(this,Xt,0);or(this,$r);if(jt(this,$r,{...Uc.defaultOptions,...t}),typeof e=="string")switch(M(this,$r).encoding){case"hex":jt(this,Br,e0(e));break;case"base64":jt(this,Br,of(e));break;default:throw new TypeError(`Encoding not implemented: "${M(this,$r).encoding}"`)}else jt(this,Br,e);jt(this,Xr,new DataView(M(this,Br).buffer,M(this,Br).byteOffset,M(this,Br).byteLength))}toHere(e){return M(this,Br).subarray(e,M(this,Xt))}*[Symbol.iterator](){if(yield*$e(this,Qt,Zi).call(this,0),M(this,Xt)!==M(this,Br).length)throw new Error("Extra data in input")}};Br=new WeakMap,Xr=new WeakMap,Xt=new WeakMap,$r=new WeakMap,Qt=new WeakSet,Zi=function*(e){if(e++>M(this,$r).maxDepth)throw new Error(`Maximum depth ${M(this,$r).maxDepth} exceeded`);const t=M(this,Xt),n=M(this,Xr).getUint8(Y0(this,Xt)._++),i=n>>5,s=n&31;let o=s,c=!1,u=0;switch(s){case bt.ONE:if(u=1,o=M(this,Xr).getUint8(M(this,Xt)),i===Ae.SIMPLE_FLOAT){if(o<32)throw new Error(`Invalid simple encoding in extra byte: ${o}`);c=!0}else if(M(this,$r).requirePreferred&&o<24)throw new Error(`Unexpectedly long integer encoding (1) for ${o}`);break;case bt.TWO:if(u=2,i===Ae.SIMPLE_FLOAT)o=n0(M(this,Br),M(this,Xt));else if(o=M(this,Xr).getUint16(M(this,Xt),!1),M(this,$r).requirePreferred&&o<=255)throw new Error(`Unexpectedly long integer encoding (2) for ${o}`);break;case bt.FOUR:if(u=4,i===Ae.SIMPLE_FLOAT)o=M(this,Xr).getFloat32(M(this,Xt),!1);else if(o=M(this,Xr).getUint32(M(this,Xt),!1),M(this,$r).requirePreferred&&o<=65535)throw new Error(`Unexpectedly long integer encoding (4) for ${o}`);break;case bt.EIGHT:{if(u=8,i===Ae.SIMPLE_FLOAT)o=M(this,Xr).getFloat64(M(this,Xt),!1);else if(o=M(this,Xr).getBigUint64(M(this,Xt),!1),o<=Number.MAX_SAFE_INTEGER&&(o=Number(o)),M(this,$r).requirePreferred&&o<=4294967295)throw new Error(`Unexpectedly long integer encoding (8) for ${o}`);break}case 28:case 29:case 30:throw new Error(`Additional info not implemented: ${s}`);case bt.INDEFINITE:switch(i){case Ae.POS_INT:case Ae.NEG_INT:case Ae.TAG:throw new Error(`Invalid indefinite encoding for MT ${i}`);case Ae.SIMPLE_FLOAT:yield[i,s,Er.BREAK,t,0];return}o=1/0;break;default:c=!0}switch(jt(this,Xt,M(this,Xt)+u),i){case Ae.POS_INT:yield[i,s,o,t,u];break;case Ae.NEG_INT:yield[i,s,typeof o=="bigint"?-1n-o:-1-Number(o),t,u];break;case Ae.BYTE_STRING:o===1/0?yield*$e(this,Qt,Ro).call(this,i,e,t):yield[i,s,$e(this,Qt,kf).call(this,o),t,o];break;case Ae.UTF8_STRING:o===1/0?yield*$e(this,Qt,Ro).call(this,i,e,t):yield[i,s,Rv.decode($e(this,Qt,kf).call(this,o)),t,o];break;case Ae.ARRAY:if(o===1/0)yield*$e(this,Qt,Ro).call(this,i,e,t,!1);else{const d=Number(o);yield[i,s,d,t,u];for(let b=0;b<d;b++)yield*$e(this,Qt,Zi).call(this,e+1)}break;case Ae.MAP:if(o===1/0)yield*$e(this,Qt,Ro).call(this,i,e,t,!1);else{const d=Number(o);yield[i,s,d,t,u];for(let b=0;b<d;b++)yield*$e(this,Qt,Zi).call(this,e),yield*$e(this,Qt,Zi).call(this,e)}break;case Ae.TAG:yield[i,s,o,t,u],yield*$e(this,Qt,Zi).call(this,e);break;case Ae.SIMPLE_FLOAT:{const d=o;c&&(o=lo.create(Number(o))),yield[i,s,o,t,d];break}}},kf=function(e){const t=M(this,Br).subarray(M(this,Xt),jt(this,Xt,M(this,Xt)+e));if(t.length!==e)throw new Error(`Unexpected end of stream reading ${e} bytes, got ${t.length}`);return t},Ro=function*(e,t,n,i=!0){for(yield[e,bt.INDEFINITE,1/0,n,1/0];;){const s=$e(this,Qt,Zi).call(this,t),o=s.next(),[c,u,d]=o.value;if(d===Er.BREAK){yield o.value,s.next();return}if(i){if(c!==e)throw new Error(`Unmatched major type. Expected ${e}, got ${c}.`);if(u===bt.INDEFINITE)throw new Error("New stream started in typed stream")}yield o.value,yield*s}},Ze(Uc,"defaultOptions",{maxDepth:1024,encoding:"hex",requirePreferred:!1});let uo=Uc;const jv=new Map([[bt.ZERO,1],[bt.ONE,2],[bt.TWO,3],[bt.FOUR,5],[bt.EIGHT,9]]),Pv=new Uint8Array(0);let Yn=(pn=class{constructor(e,t,n,i){or(this,Dc);Ze(this,"parent");Ze(this,"mt");Ze(this,"ai");Ze(this,"left");Ze(this,"offset");Ze(this,"count",0);Ze(this,"children",[]);Ze(this,"depth",0);or(this,fr);or(this,yn,null);if([this.mt,this.ai,,this.offset]=e,this.left=t,this.parent=n,jt(this,fr,i),n&&(this.depth=n.depth+1),this.mt===Ae.MAP&&(M(this,fr).sortKeys||M(this,fr).rejectDuplicateKeys)&&jt(this,yn,[]),M(this,fr).rejectStreaming&&this.ai===bt.INDEFINITE)throw new Error("Streaming not supported")}get isStreaming(){return this.left===1/0}get done(){return this.left===0}static create(e,t,n,i){const[s,o,c,u]=e;switch(s){case Ae.POS_INT:case Ae.NEG_INT:{if(n.rejectInts)throw new Error(`Unexpected integer: ${c}`);if(n.rejectLargeNegatives&&c<-0x8000000000000000n)throw new Error(`Invalid 65bit negative number: ${c}`);let d=c;return n.convertUnsafeIntsToFloat&&d>=pc.MIN&&d<=pc.MAX&&(d=Number(c)),n.boxed?co(d,i.toHere(u)):d}case Ae.SIMPLE_FLOAT:if(o>bt.ONE){if(n.rejectFloats)throw new Error(`Decoding unwanted floating point number: ${c}`);if(n.rejectNegativeZero&&Object.is(c,-0))throw new Error("Decoding negative zero");if(n.rejectLongLoundNaN&&isNaN(c)){const d=i.toHere(u);if(d.length!==3||d[1]!==126||d[2]!==0)throw new Error(`Invalid NaN encoding: "${Zr(d)}"`)}if(n.rejectSubnormals&&mv(i.toHere(u+1)),n.rejectLongFloats){const d=mc(c,{chunkSize:9,reduceUnsafeNumbers:n.rejectUnsafeFloatInts});if(d[0]>>5!==s)throw new Error(`Should have been encoded as int, not float: ${c}`);if(d.length<jv.get(o))throw new Error(`Number should have been encoded shorter: ${c}`)}if(typeof c=="number"&&n.boxed)return co(c,i.toHere(u))}else{if(n.rejectSimple&&c instanceof lo)throw new Error(`Invalid simple value: ${c}`);if(n.rejectUndefined&&c===void 0)throw new Error("Unexpected undefined")}return c;case Ae.BYTE_STRING:case Ae.UTF8_STRING:if(c===1/0)return new n.ParentType(e,1/0,t,n);if(n.rejectStringsNotNormalizedAs&&typeof c=="string"){const d=c.normalize(n.rejectStringsNotNormalizedAs);if(c!==d)throw new Error(`String not normalized as "${n.rejectStringsNotNormalizedAs}", got [${t0(c)}] instead of [${t0(d)}]`)}return n.boxed?co(c,i.toHere(u)):c;case Ae.ARRAY:return new n.ParentType(e,c,t,n);case Ae.MAP:return new n.ParentType(e,c*2,t,n);case Ae.TAG:{const d=new n.ParentType(e,1,t,n);return d.children=new qe(c),d}}throw new TypeError(`Invalid major type: ${s}`)}push(e,t,n){if(this.children.push(e),M(this,yn)){const i=yc(e)||t.toHere(n);M(this,yn).push(i)}return--this.left}replaceLast(e,t,n){let i,s=-1/0;if(this.children instanceof qe?(s=0,i=this.children.contents,this.children.contents=e):(s=this.children.length-1,i=this.children[s],this.children[s]=e),M(this,yn)){const o=yc(e)||n.toHere(t.offset);M(this,yn)[s]=o}return i}convert(e){let t;switch(this.mt){case Ae.ARRAY:t=this.children;break;case Ae.MAP:{const n=$e(this,Dc,Q0).call(this);if(M(this,fr).sortKeys){let i;for(const s of n){if(i&&M(this,fr).sortKeys(i,s)>=0)throw new Error(`Duplicate or out of order key: "0x${s[2]}"`);i=s}}else if(M(this,fr).rejectDuplicateKeys){const i=new Set;for(const[s,o,c]of n){const u=Zr(c);if(i.has(u))throw new Error(`Duplicate key: "0x${u}"`);i.add(u)}}t=!M(this,fr).boxed&&!M(this,fr).preferMap&&n.every(([i])=>typeof i=="string")?Object.fromEntries(n):new Map(n);break}case Ae.BYTE_STRING:return hv(this.children);case Ae.UTF8_STRING:{const n=this.children.join("");t=M(this,fr).boxed?co(n,e.toHere(this.offset)):n;break}case Ae.TAG:t=this.children.decode(M(this,fr));break;default:throw new TypeError(`Invalid mt on convert: ${this.mt}`)}return M(this,fr).saveOriginal&&t&&typeof t=="object"&&ao(t,e.toHere(this.offset)),t}},fr=new WeakMap,yn=new WeakMap,Dc=new WeakSet,Q0=function(){const e=this.children,t=e.length;if(t%2)throw new Error("Missing map value");const n=new Array(t/2);if(M(this,yn))for(let i=0;i<t;i+=2)n[i>>1]=[e[i],e[i+1],M(this,yn)[i]];else for(let i=0;i<t;i+=2)n[i>>1]=[e[i],e[i+1],Pv];return n},Ze(pn,"defaultDecodeOptions",{...uo.defaultOptions,ParentType:pn,boxed:!1,cde:!1,dcbor:!1,diagnosticSizes:c0.PREFERRED,convertUnsafeIntsToFloat:!1,pretty:!1,preferMap:!1,rejectLargeNegatives:!1,rejectBigInts:!1,rejectDuplicateKeys:!1,rejectFloats:!1,rejectInts:!1,rejectLongLoundNaN:!1,rejectLongFloats:!1,rejectNegativeZero:!1,rejectSimple:!1,rejectStreaming:!1,rejectStringsNotNormalizedAs:null,rejectSubnormals:!1,rejectUndefined:!1,rejectUnsafeFloatInts:!1,saveOriginal:!1,sortKeys:null}),Ze(pn,"cdeDecodeOptions",{cde:!0,rejectStreaming:!0,requirePreferred:!0,sortKeys:r0}),Ze(pn,"dcborDecodeOptions",{...pn.cdeDecodeOptions,dcbor:!0,convertUnsafeIntsToFloat:!0,rejectDuplicateKeys:!0,rejectLargeNegatives:!0,rejectLongLoundNaN:!0,rejectLongFloats:!0,rejectNegativeZero:!0,rejectSimple:!0,rejectUndefined:!0,rejectUnsafeFloatInts:!0,rejectStringsNotNormalizedAs:"NFC"}),pn);class uf extends(W0=Yn,Z0=Er.ENCODED,W0){constructor(t,n,i,s){super(t,n,i,s);Ze(this,"depth",0);Ze(this,"leaf",!1);Ze(this,"value");Ze(this,"length");Ze(this,Z0);this.parent?this.depth=this.parent.depth+1:this.depth=s.initialDepth,[,,this.value,,this.length]=t}numBytes(){switch(this.ai){case bt.ONE:return 1;case bt.TWO:return 2;case bt.FOUR:return 4;case bt.EIGHT:return 8}return 0}}function l0(r){return r instanceof uf}function wc(r,e){return r===1/0?"Indefinite":e?`${r} ${e}${r!==1&&r!==1n?"s":""}`:String(r)}function ff(r){return"".padStart(r," ")}function u0(r,e,t){let n="";n+=ff(r.depth*2);const i=yc(r);n+=Zr(i.subarray(0,1));const s=r.numBytes();s&&(n+=" ",n+=Zr(i.subarray(1,s+1))),n=n.padEnd(e.minCol+1," "),n+="-- ",t!==void 0&&(n+=ff(r.depth*2),t!==""&&(n+=`[${t}] `));let o=!1;const[c]=r.children;switch(r.mt){case Ae.POS_INT:n+=`Unsigned: ${c}`,typeof c=="bigint"&&(n+="n");break;case Ae.NEG_INT:n+=`Negative: ${c}`,typeof c=="bigint"&&(n+="n");break;case Ae.BYTE_STRING:n+=`Bytes (Length: ${wc(r.length)})`;break;case Ae.UTF8_STRING:n+=`UTF8 (Length: ${wc(r.length)})`,r.length!==1/0&&(n+=`: ${JSON.stringify(c)}`);break;case Ae.ARRAY:n+=`Array (Length: ${wc(r.value,"item")})`;break;case Ae.MAP:n+=`Map (Length: ${wc(r.value,"pair")})`;break;case Ae.TAG:{n+=`Tag #${r.value}`;const u=r.children,[d]=u.contents.children,b=new qe(u.tag,d);ao(b,i);const S=b.comment(e,r.depth);S&&(n+=": ",n+=S),o||(o=b.noChildren);break}case Ae.SIMPLE_FLOAT:c===Er.BREAK?n+="BREAK":r.ai>bt.ONE?Object.is(c,-0)?n+="Float: -0":n+=`Float: ${c}`:(n+="Simple: ",c instanceof lo?n+=c.value:n+=c);break}if(!o)if(r.leaf){if(n+=`
146
+ `)}}xr.CertificateTag="CERTIFICATE",xr.CrlTag="CRL",xr.CertificateRequestTag="CERTIFICATE REQUEST",xr.PublicKeyTag="PUBLIC KEY",xr.PrivateKeyTag="PRIVATE KEY";class Kr extends zn{static isAsnEncoded(e){return Q.isBufferSource(e)||typeof e=="string"}static toArrayBuffer(e){if(typeof e=="string"){if(xr.isPem(e))return xr.decode(e)[0];if(ve.isHex(e))return ve.FromHex(e);if(ve.isBase64(e))return ve.FromBase64(e);if(ve.isBase64Url(e))return ve.FromBase64Url(e);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}else{const t=ve.ToBinary(e);return xr.isPem(t)?xr.decode(t)[0]:ve.isHex(t)?ve.FromHex(t):ve.isBase64(t)?ve.FromBase64(t):ve.isBase64Url(t)?ve.FromBase64Url(t):Q.toArrayBuffer(e)}}constructor(...e){Kr.isAsnEncoded(e[0])?super(Kr.toArrayBuffer(e[0]),e[1]):super(e[0])}toString(e="pem"){switch(e){case"pem":return xr.encode(this.rawData,this.tag);default:return super.toString(e)}}}class ln extends Kr{static async create(e,t=Yt.get()){if(e instanceof ln)return e;if(Kn.isCryptoKey(e)){if(e.type!=="public")throw new TypeError("Public key is required");const n=await t.subtle.exportKey("spki",e);return new ln(n)}else{if(e.publicKey)return e.publicKey;if(Q.isBufferSource(e))return new ln(e);throw new TypeError("Unsupported PublicKeyType")}}constructor(e){Kr.isAsnEncoded(e)?super(e,nn):super(e),this.tag=xr.PublicKeyTag}async export(...e){let t,n=["verify"],i={hash:"SHA-256",...this.algorithm};e.length>1?(i=e[0]||i,n=e[1]||n,t=e[2]||Yt.get()):t=e[0]||Yt.get();let s=this.rawData;const o=Y.parse(this.rawData,nn);return o.algorithm.algorithm===Js&&(s=iv(o,s)),t.subtle.importKey("spki",s,i,!0,n)}onInit(e){const t=lr.resolve(vs),n=this.algorithm=t.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case Oi:{const i=Y.parse(e.subjectPublicKey,Au),s=Q.toUint8Array(i.modulus);n.publicExponent=Q.toUint8Array(i.publicExponent),n.modulusLength=(s[0]?s:s.slice(1)).byteLength<<3;break}}}async getThumbprint(...e){var t;let n,i="SHA-1";return e.length>=1&&!(!((t=e[0])===null||t===void 0)&&t.subtle)?(i=e[0]||i,n=e[1]||Yt.get()):n=e[0]||Yt.get(),await n.subtle.digest(i,this.rawData)}async getKeyIdentifier(...e){let t,n="SHA-1";e.length===1?typeof e[0]=="string"?(n=e[0],t=Yt.get()):t=e[0]:e.length===2?(n=e[0],t=e[1]):t=Yt.get();const i=Y.parse(this.rawData,nn);return await t.subtle.digest(n,i.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),t=Y.parse(this.rawData,nn);switch(e.Algorithm=Gn.serializeAlgorithm(t.algorithm),t.algorithm.algorithm){case Ws:e["EC Point"]=t.subjectPublicKey;break;case Oi:default:e["Raw Data"]=t.subjectPublicKey}return e}}function iv(r,e){return r.algorithm=new le({algorithm:Oi,parameters:null}),e=Y.serialize(r),e}class oo extends Pr{static async create(e,t=!1,n=Yt.get()){if("name"in e&&"serialNumber"in e)return new oo(e,t);const s=await(await ln.create(e,n)).getKeyIdentifier(n);return new oo(ve.ToHex(s),t)}constructor(...e){if(Q.isBufferSource(e[0]))super(e[0]);else if(typeof e[0]=="string"){const t=new Ai({keyIdentifier:new yl(ve.FromHex(e[0]))});super(na,e[1],Y.serialize(t))}else{const t=e[0],n=t.name instanceof no?Y.parse(t.name.rawData,cr):t.name,i=new Ai({authorityCertIssuer:n,authorityCertSerialNumber:ve.FromHex(t.serialNumber)});super(na,e[1],Y.serialize(i))}}onInit(e){super.onInit(e);const t=Y.parse(e.extnValue,Ai);t.keyIdentifier&&(this.keyId=ve.ToHex(t.keyIdentifier)),(t.authorityCertIssuer||t.authorityCertSerialNumber)&&(this.certId={name:t.authorityCertIssuer||[],serialNumber:t.authorityCertSerialNumber?ve.ToHex(t.authorityCertSerialNumber):""})}toTextObject(){const e=this.toTextObjectWithoutValue(),t=Y.parse(this.value,Ai);return t.authorityCertIssuer&&(e["Authority Issuer"]=new no(t.authorityCertIssuer).toTextObject()),t.authorityCertSerialNumber&&(e["Authority Serial Number"]=t.authorityCertSerialNumber),t.keyIdentifier&&(e[""]=t.keyIdentifier),e}}oo.NAME="Authority Key Identifier";class Lp extends Pr{constructor(...e){if(Q.isBufferSource(e[0])){super(e[0]);const t=Y.parse(this.value,ia);this.ca=t.cA,this.pathLength=t.pathLenConstraint}else{const t=new ia({cA:e[0],pathLenConstraint:e[1]});super(qh,e[2],Y.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}}Lp.NAME="Basic Constraints";var Hp;(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"})(Hp||(Hp={}));class Fp extends Pr{constructor(...e){if(Q.isBufferSource(e[0])){super(e[0]);const t=Y.parse(this.value,la);this.usages=t.map(n=>n)}else{const t=new la(e[0]);super(td,e[1],Y.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(t=>Rn.toString(t)).join(", "),e}}Fp.NAME="Extended Key Usages";var Gp;(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"})(Gp||(Gp={}));class zp extends Pr{constructor(...e){if(Q.isBufferSource(e[0])){super(e[0]);const t=Y.parse(this.value,Ol);this.usages=t.toNumber()}else{const t=new Ol(e[0]);super(nd,e[1],Y.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=Y.parse(this.value,Ol);return e[""]=t.toJSON().join(", "),e}}zp.NAME="Key Usages";class cc extends Pr{static async create(e,t=!1,n=Yt.get()){const s=await(await ln.create(e,n)).getKeyIdentifier(n);return new cc(ve.ToHex(s),t)}constructor(...e){if(Q.isBufferSource(e[0])){super(e[0]);const t=Y.parse(this.value,Ln);this.keyId=ve.ToHex(t)}else{const t=typeof e[0]=="string"?ve.FromHex(e[0]):e[0],n=new Ln(t);super($l,e[1],Y.serialize(n)),this.keyId=ve.ToHex(t)}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=Y.parse(this.value,Ln);return e[""]=t,e}}cc.NAME="Subject Key Identifier";class Kp extends Pr{constructor(...e){Q.isBufferSource(e[0])?super(e[0]):super(Pl,e[1],new no(e[0]||[]).rawData)}onInit(e){super.onInit(e);const t=Y.parse(e.extnValue,Ul);this.names=new no(t)}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.names.toTextObject();for(const n in t)e[n]=t[n];return e}}Kp.NAME="Subject Alternative Name";class Ur{static register(e,t){this.items.set(e,t)}static create(e){const t=new Pr(e),n=this.items.get(t.type);return n?new n(e):t}}Ur.items=new Map;class Zp extends Pr{constructor(...e){var t;if(Q.isBufferSource(e[0])){super(e[0]);const n=Y.parse(this.value,aa);this.policies=n.map(i=>i.policyIdentifier)}else{const n=e[0],i=(t=e[1])!==null&&t!==void 0?t:!1,s=new aa(n.map(o=>new oa({policyIdentifier:o})));super(Jh,i,Y.serialize(s)),this.policies=n}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(t=>new it("",{},Rn.toString(t))),e}}Zp.NAME="Certificate Policies",Ur.register(Jh,Zp);class Wp extends Pr{constructor(...e){var t;if(Q.isBufferSource(e[0]))super(e[0]);else if(Array.isArray(e[0])&&typeof e[0][0]=="string"){const i=e[0].map(o=>new rs({distributionPoint:new Si({fullName:[new De({uniformResourceIdentifier:o})]})})),s=new ns(i);super(Sl,e[1],Y.serialize(s))}else{const n=new ns(e[0]);super(Sl,e[1],Y.serialize(n))}(t=this.distributionPoints)!==null&&t!==void 0||(this.distributionPoints=[])}onInit(e){super.onInit(e);const t=Y.parse(e.extnValue,ns);this.distributionPoints=t}toTextObject(){const e=this.toTextObjectWithoutValue();return e["Distribution Point"]=this.distributionPoints.map(t=>{var n;const i={};return t.distributionPoint&&(i[""]=(n=t.distributionPoint.fullName)===null||n===void 0?void 0:n.map(s=>new Wn(s).toString()).join(", ")),t.reasons&&(i.Reasons=t.reasons.toString()),t.cRLIssuer&&(i["CRL Issuer"]=t.cRLIssuer.map(s=>s.toString()).join(", ")),i}),e}}Wp.NAME="CRL Distribution Points";class qp extends Pr{constructor(...e){var t,n,i,s;if(Q.isBufferSource(e[0]))super(e[0]);else if(e[0]instanceof ts){const o=new ts(e[0]);super(pl,e[1],Y.serialize(o))}else{const o=e[0],c=new ts;uc(c,o,zh,"ocsp"),uc(c,o,Kh,"caIssuers"),uc(c,o,Zh,"timeStamping"),uc(c,o,Wh,"caRepository"),super(pl,e[1],Y.serialize(c))}(t=this.ocsp)!==null&&t!==void 0||(this.ocsp=[]),(n=this.caIssuers)!==null&&n!==void 0||(this.caIssuers=[]),(i=this.timeStamping)!==null&&i!==void 0||(this.timeStamping=[]),(s=this.caRepository)!==null&&s!==void 0||(this.caRepository=[])}onInit(e){super.onInit(e),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[],Y.parse(e.extnValue,ts).forEach(n=>{switch(n.accessMethod){case zh:this.ocsp.push(new Wn(n.accessLocation));break;case Kh:this.caIssuers.push(new Wn(n.accessLocation));break;case Zh:this.timeStamping.push(new Wn(n.accessLocation));break;case Wh:this.caRepository.push(new Wn(n.accessLocation));break}})}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ocsp.length&&lc(e,"OCSP",this.ocsp),this.caIssuers.length&&lc(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&lc(e,"Time Stamping",this.timeStamping),this.caRepository.length&&lc(e,"CA Repository",this.caRepository),e}}qp.NAME="Authority Info Access";function lc(r,e,t){if(t.length===1)r[e]=t[0].toTextObject();else{const n=new it("");t.forEach((i,s)=>{const o=i.toTextObject(),c=`${o[it.NAME]} ${s+1}`;let u=n[c];Array.isArray(u)||(u=[],n[c]=u),u.push(o)}),r[e]=n}}function uc(r,e,t,n){const i=e[n];i&&(Array.isArray(i)?i:[i]).forEach(o=>{typeof o=="string"&&(o=new Wn("url",o)),r.push(new Ps({accessMethod:t,accessLocation:Y.parse(o.rawData,De)}))})}class ws extends zn{constructor(...e){let t;if(Q.isBufferSource(e[0]))t=Q.toArrayBuffer(e[0]);else{const n=e[0],i=Array.isArray(e[1])?e[1].map(s=>Q.toArrayBuffer(s)):[];t=Y.serialize(new Cn({type:n,values:i}))}super(t,Cn)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Value=this.values.map(t=>new it("",{"":t})),e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty();return e[it.NAME]===ws.NAME&&(e[it.NAME]=Rn.toString(this.type)),e}}ws.NAME="Attribute";class Yp extends ws{constructor(...e){var t;if(Q.isBufferSource(e[0]))super(e[0]);else{const n=new ic({printableString:e[0]});super(Fd,[Y.serialize(n)])}(t=this.password)!==null&&t!==void 0||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){const t=Y.parse(this.values[0],ic);this.password=t.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[it.VALUE]=this.password,e}}Yp.NAME="Challenge Password";class Qu extends ws{constructor(...e){var t;if(Q.isBufferSource(e[0]))super(e[0]);else{const n=e[0],i=new _i;for(const s of n)i.push(Y.parse(s.rawData,Gr));super(Du,[Y.serialize(i)])}(t=this.items)!==null&&t!==void 0||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){const t=Y.parse(this.values[0],_i);this.items=t.map(n=>Ur.create(Y.serialize(n)))}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.items.map(n=>n.toTextObject());for(const n of t)e[n[it.NAME]]=n;return e}}Qu.NAME="Extensions";class fc{static register(e,t){this.items.set(e,t)}static create(e){const t=new ws(e),n=this.items.get(t.type);return n?new n(e):t}}fc.items=new Map;const hc="crypto.signatureFormatter";class sv{toAsnSignature(e,t){return Q.toArrayBuffer(t)}toWebSignature(e,t){return Q.toArrayBuffer(t)}}var dc;let ef=dc=class{static createPssParams(e,t){const n=dc.getHashAlgorithm(e);return n?new Ni({hashAlgorithm:n,maskGenAlgorithm:new le({algorithm:Fa,parameters:Y.serialize(n)}),saltLength:t}):null}static getHashAlgorithm(e){const t=lr.resolve(vs);return typeof e=="string"?t.toAsnAlgorithm({name:e}):typeof e=="object"&&e&&"name"in e?t.toAsnAlgorithm(e):null}toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if("hash"in e){let t;if(typeof e.hash=="string")t=e.hash;else if(e.hash&&typeof e.hash=="object"&&"name"in e.hash&&typeof e.hash.name=="string")t=e.hash.name.toUpperCase();else throw new Error("Cannot get hash algorithm name");switch(t.toLowerCase()){case"sha-1":return new le({algorithm:Ua,parameters:null});case"sha-256":return new le({algorithm:wu,parameters:null});case"sha-384":return new le({algorithm:Da,parameters:null});case"sha-512":return new le({algorithm:$a,parameters:null})}}else return new le({algorithm:Oi,parameters:null});break;case"rsa-pss":if("hash"in e){if(!("saltLength"in e&&typeof e.saltLength=="number"))throw new Error("Cannot get 'saltLength' from 'alg' argument");const t=dc.createPssParams(e.hash,e.saltLength);if(!t)throw new Error("Cannot create PSS parameters");return new le({algorithm:Js,parameters:Y.serialize(t)})}else return new le({algorithm:Js,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case Oi:return{name:"RSASSA-PKCS1-v1_5"};case Ua:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case wu:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case Da:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case $a:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case Js:if(e.parameters){const t=Y.parse(e.parameters,Ni);return{name:"RSA-PSS",hash:lr.resolve(vs).toWebAlgorithm(t.hashAlgorithm),saltLength:t.saltLength}}else return{name:"RSA-PSS"}}return null}};ef=dc=f([Ja()],ef),lr.registerSingleton(to,ef);let tf=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new le({algorithm:Ma});case"sha-256":return new le({algorithm:Va});case"sha-384":return new le({algorithm:La});case"sha-512":return new le({algorithm:Ha})}return null}toWebAlgorithm(e){switch(e.algorithm){case Ma:return{name:"SHA-1"};case Va:return{name:"SHA-256"};case La:return{name:"SHA-384"};case Ha:return{name:"SHA-512"}}return null}};tf=f([Ja()],tf),lr.registerSingleton(to,tf);class Dr{addPadding(e,t){const n=Q.toUint8Array(t),i=new Uint8Array(e);return i.set(n,e-n.length),i}removePadding(e,t=!1){let n=Q.toUint8Array(e);for(let i=0;i<n.length;i++)if(n[i]){n=n.slice(i);break}if(t&&n[0]>127){const i=new Uint8Array(n.length+1);return i.set(n,1),i.buffer}return n.buffer}toAsnSignature(e,t){if(e.name==="ECDSA"){const n=e.namedCurve,i=Dr.namedCurveSize.get(n)||Dr.defaultNamedCurveSize,s=new Pa,o=Q.toUint8Array(t);return s.r=this.removePadding(o.slice(0,i),!0),s.s=this.removePadding(o.slice(i,i+i),!0),Y.serialize(s)}return null}toWebSignature(e,t){if(e.name==="ECDSA"){const n=Y.parse(t,Pa),i=e.namedCurve,s=Dr.namedCurveSize.get(i)||Dr.defaultNamedCurveSize,o=this.addPadding(s,this.removePadding(n.r)),c=this.addPadding(s,this.removePadding(n.s));return wy(o,c)}return null}}Dr.namedCurveSize=new Map,Dr.defaultNamedCurveSize=32;const rf="1.3.101.110",Jp="1.3.101.111",nf="1.3.101.112",Xp="1.3.101.113";let sf=class{toAsnAlgorithm(e){let t=null;switch(e.name.toLowerCase()){case"ed25519":t=nf;break;case"x25519":t=rf;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":t=nf;break;case"ed448":t=Xp;break}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":t=rf;break;case"x448":t=Jp;break}}return t?new le({algorithm:t}):null}toWebAlgorithm(e){switch(e.algorithm){case nf:return{name:"Ed25519"};case Xp:return{name:"EdDSA",namedCurve:"Ed448"};case rf:return{name:"X25519"};case Jp:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};sf=f([Ja()],sf),lr.registerSingleton(to,sf);class ov extends Kr{constructor(e){Kr.isAsnEncoded(e)?super(e,eo):super(e),this.tag=xr.CertificateRequestTag}onInit(e){this.tbs=Y.serialize(e.certificationRequestInfo),this.publicKey=new ln(e.certificationRequestInfo.subjectPKInfo);const t=lr.resolve(vs);this.signatureAlgorithm=t.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signature,this.attributes=e.certificationRequestInfo.attributes.map(i=>fc.create(Y.serialize(i)));const n=this.getAttribute(Du);this.extensions=[],n instanceof Qu&&(this.extensions=n.items),this.subjectName=new Zn(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=Yt.get()){const t={...this.publicKey.algorithm,...this.signatureAlgorithm},n=await this.publicKey.export(t,["verify"],e),i=lr.resolveAll(hc).reverse();let s=null;for(const c of i)if(s=c.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,n,s,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),t=Y.parse(this.rawData,eo),n=t.certificationRequestInfo,i=new it("",{Version:`${is[n.version]} (${n.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const s=new it("");for(const o of this.attributes){const c=o.toTextObject();s[c[it.NAME]]=c}i.Attributes=s}return e.Data=i,e.Signature=new it("",{Algorithm:Gn.serializeAlgorithm(t.signatureAlgorithm),"":t.signature}),e}}ov.NAME="PKCS#10 Certificate Request";class ji extends Kr{constructor(e){Kr.isAsnEncoded(e)?super(e,Ei):super(e),this.tag=xr.CertificateTag}onInit(e){const t=e.tbsCertificate;this.tbs=Y.serialize(t),this.serialNumber=ve.ToHex(t.serialNumber),this.subjectName=new Zn(t.subject),this.subject=new Zn(t.subject).toString(),this.issuerName=new Zn(t.issuer),this.issuer=this.issuerName.toString();const n=lr.resolve(vs);this.signatureAlgorithm=n.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signatureValue;const i=t.validity.notBefore.utcTime||t.validity.notBefore.generalTime;if(!i)throw new Error("Cannot get 'notBefore' value");this.notBefore=i;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(o=>Ur.create(Y.serialize(o)))),this.publicKey=new ln(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=Yt.get()){let n,i;const s=e.publicKey;try{if(!s)n={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(n,["verify"],t);else if("publicKey"in s)n={...s.publicKey.algorithm,...this.signatureAlgorithm},i=await s.publicKey.export(n,["verify"],t);else if(s instanceof ln)n={...s.algorithm,...this.signatureAlgorithm},i=await s.export(n,["verify"],t);else if(Q.isBufferSource(s)){const d=new ln(s);n={...d.algorithm,...this.signatureAlgorithm},i=await d.export(n,["verify"],t)}else n={...s.algorithm,...this.signatureAlgorithm},i=s}catch{return!1}const o=lr.resolveAll(hc).reverse();let c=null;for(const d of o)if(c=d.toWebSignature(n,this.signature),c)break;if(!c)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const u=await t.subtle.verify(this.signatureAlgorithm,i,c,this.tbs);if(e.signatureOnly)return u;{const b=(e.date||new Date).getTime();return u&&this.notBefore.getTime()<b&&b<this.notAfter.getTime()}}async getThumbprint(...e){let t,n="SHA-1";return e[0]&&(e[0].subtle?t=e[0]:(n=e[0]||n,t=e[1])),t??(t=Yt.get()),await t.subtle.digest(n,this.rawData)}async isSelfSigned(e=Yt.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){const e=this.toTextObjectEmpty(),t=Y.parse(this.rawData,Ei),n=t.tbsCertificate,i=new it("",{Version:`${is[n.version]} (${n.version})`,"Serial Number":n.serialNumber,"Signature Algorithm":Gn.serializeAlgorithm(n.signature),Issuer:this.issuer,Validity:new it("",{"Not Before":n.validity.notBefore.getTime(),"Not After":n.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(n.issuerUniqueID&&(i["Issuer Unique ID"]=n.issuerUniqueID),n.subjectUniqueID&&(i["Subject Unique ID"]=n.subjectUniqueID),this.extensions.length){const s=new it("");for(const o of this.extensions){const c=o.toTextObject();s[c[it.NAME]]=c}i.Extensions=s}return e.Data=i,e.Signature=new it("",{Algorithm:Gn.serializeAlgorithm(t.signatureAlgorithm),"":t.signatureValue}),e}}ji.NAME="Certificate";class av extends Array{constructor(e){if(super(),Kr.isAsnEncoded(e))this.import(e);else if(e instanceof ji)this.push(e);else if(Array.isArray(e))for(const t of e)this.push(t)}export(e){const t=new Tn;t.version=1,t.encapContentInfo.eContentType=pg,t.encapContentInfo.eContent=new us({single:new nt}),t.certificates=new Vs(this.map(s=>new Ci({certificate:Y.parse(s.rawData,Ei)})));const n=new On({contentType:hu,content:Y.serialize(t)}),i=Y.serialize(n);return e==="raw"?i:this.toString(e)}import(e){const t=Kr.toArrayBuffer(e),n=Y.parse(t,On);if(n.contentType!==hu)throw new TypeError("Cannot parse CMS package. Incoming data is not a SignedData object.");const i=Y.parse(n.content,Tn);this.clear();for(const s of i.certificates||[])s.certificate&&this.push(new ji(s.certificate))}clear(){for(;this.pop(););}toString(e="pem"){const t=this.export("raw");switch(e){case"pem":return xr.encode(t,"CMS");case"pem-chain":return this.map(n=>n.toString("pem")).join(`
147
+ `);case"asn":return Y.toString(t);case"hex":return ve.ToHex(t);case"base64":return ve.ToBase64(t);case"base64url":return ve.ToBase64Url(t);case"text":return Gn.serialize(this.toTextObject());default:throw TypeError("Argument 'format' is unsupported value")}}toTextObject(){const e=Y.parse(this.export("raw"),On),t=Y.parse(e.content,Tn);return new it("X509Certificates",{"Content Type":Rn.toString(e.contentType),Content:new it("",{Version:`${sn[t.version]} (${t.version})`,Certificates:new it("",{Certificate:this.map(i=>i.toTextObject())})})})}}class cv{constructor(e={}){this.certificates=[],e.certificates&&(this.certificates=e.certificates)}async build(e,t=Yt.get()){const n=new av(e);let i=e;for(;i=await this.findIssuer(i,t);){const s=await i.getThumbprint(t);for(const o of n){const c=await o.getThumbprint(t);if(jo(s,c))throw new Error("Cannot build a certificate chain. Circular dependency.")}n.push(i)}return n}async findIssuer(e,t=Yt.get()){if(!await e.isSelfSigned(t)){const n=e.getExtension(na);for(const i of this.certificates)if(i.subject===e.issuer){if(n){if(n.keyId){const s=i.getExtension($l);if(s&&s.keyId!==n.keyId)continue}else if(n.certId){const s=i.getExtension(Pl);if(s&&!(n.certId.serialNumber===i.serialNumber&&jo(Y.serialize(n.certId.name),Y.serialize(s))))continue}}try{const s={...i.publicKey.algorithm,...e.signatureAlgorithm},o=await i.publicKey.export(s,["verify"],t);if(!await e.verify({publicKey:o,signatureOnly:!0},t))continue}catch{continue}return i}}return null}}var Qp;(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"})(Qp||(Qp={})),Ur.register(qh,Lp),Ur.register(td,Fp),Ur.register(nd,zp),Ur.register($l,cc),Ur.register(na,oo),Ur.register(Pl,Kp),Ur.register(Sl,Wp),Ur.register(pl,qp),fc.register(Fd,Yp),fc.register(Du,Qu),lr.registerSingleton(hc,sv),lr.registerSingleton(hc,Dr),Dr.namedCurveSize.set("P-256",32),Dr.namedCurveSize.set("K-256",32),Dr.namedCurveSize.set("P-384",48),Dr.namedCurveSize.set("P-521",66);const Se={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7},kt={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,MIME:36,SET:258,JSON:262,REGEXP:21066,SELF_DESCRIBED:55799,INVALID_16:65535,INVALID_32:4294967295,INVALID_64:0xffffffffffffffffn},bt={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31},qn={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23};let Er=(Oo=class{},We(Oo,"BREAK",Symbol.for("github.com/hildjj/cbor2/break")),We(Oo,"ENCODED",Symbol.for("github.com/hildjj/cbor2/cbor-encoded")),We(Oo,"LENGTH",Symbol.for("github.com/hildjj/cbor2/length")),Oo);const pc={MIN:-(2n**63n),MAX:2n**64n-1n};let Ye=(Un=class{constructor(e,t=void 0){We(this,"tag");We(this,"contents");this.tag=e,this.contents=t}get noChildren(){var e;return!!((e=M(Un,dn).get(this.tag))!=null&&e.noChildren)}static registerDecoder(e,t,n){const i=M(this,dn).get(e);return M(this,dn).set(e,t),i&&("comment"in t||(t.comment=i.comment),"noChildren"in t||(t.noChildren=i.noChildren)),n&&!t.comment&&(t.comment=()=>`(${n})`),i}static clearDecoder(e){const t=M(this,dn).get(e);return M(this,dn).delete(e),t}*[Symbol.iterator](){yield this.contents}push(e){return this.contents=e,1}decode(e){const t=M(Un,dn).get(this.tag);return t?t(this,e):this}comment(e,t){const n=M(Un,dn).get(this.tag);if(n!=null&&n.comment)return n.comment(this,e,t)}toCBOR(){return[this.tag,this.contents]}[Symbol.for("nodejs.util.inspect.custom")](e,t,n){return`${this.tag}(${n(this.contents,t)})`}},dn=new WeakMap,or(Un,dn,new Map),Un);function yc(r){if(r!=null&&typeof r=="object")return r[Er.ENCODED]}function lv(r){if(r!=null&&typeof r=="object")return r[Er.LENGTH]}function ao(r,e){Object.defineProperty(r,Er.ENCODED,{configurable:!0,enumerable:!1,value:e})}function co(r,e){const t=Object(r);return ao(t,e),t}function e0(r){let e=Math.ceil(r.length/2);const t=new Uint8Array(e);e--;for(let n=r.length,i=n-2;n>=0;n=i,i-=2,e--)t[e]=parseInt(r.substring(i,n),16);return t}function Zr(r){return r.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),"")}function uv(r){const e=r.reduce((i,s)=>i+s.length,0),t=new Uint8Array(e);let n=0;for(const i of r)t.set(i,n),n+=i.length;return t}function of(r){const e=atob(r);return Uint8Array.from(e,t=>t.codePointAt(0))}const fv={"-":"+",_:"/"};function hv(r){const e=r.replace(/[_-]/g,t=>fv[t]);return of(e.padEnd(Math.ceil(e.length/4)*4,"="))}function dv(){const r=new Uint8Array(4),e=new Uint32Array(r.buffer);return!((e[0]=1)&r[0])}function t0(r){var t;let e="";for(const n of r){const i=(t=n.codePointAt(0))==null?void 0:t.toString(16).padStart(4,"0");e&&(e+=", "),e+=`U+${i}`}return e}function r0(r,e){const[t,n,i]=r,[s,o,c]=e,u=Math.min(i.length,c.length);for(let d=0;d<u;d++){const b=i[d]-c[d];if(b!==0)return b}return 0}const Pc=class Pc{constructor(e={}){or(this,rt);or(this,ii);or(this,Jt,[]);or(this,Ar,null);or(this,Mt,0);or(this,si,0);if(jt(this,ii,{...Pc.defaultOptions,...e}),M(this,ii).chunkSize<8)throw new RangeError(`Expected size >= 8, got ${M(this,ii).chunkSize}`);Me(this,rt,Ki).call(this)}get length(){return M(this,si)}read(){Me(this,rt,$c).call(this);const e=new Uint8Array(M(this,si));let t=0;for(const n of M(this,Jt))e.set(n,t),t+=n.length;return Me(this,rt,Ki).call(this),e}write(e){const t=e.length;t>Me(this,rt,Ef).call(this)?(Me(this,rt,$c).call(this),t>M(this,ii).chunkSize?(M(this,Jt).push(e),Me(this,rt,Ki).call(this)):(Me(this,rt,Ki).call(this),M(this,Jt)[M(this,Jt).length-1].set(e),jt(this,Mt,t))):(M(this,Jt)[M(this,Jt).length-1].set(e,M(this,Mt)),jt(this,Mt,M(this,Mt)+t)),jt(this,si,M(this,si)+t)}writeUint8(e){Me(this,rt,bn).call(this,1),M(this,Ar).setUint8(M(this,Mt),e),Me(this,rt,xn).call(this,1)}writeUint16(e,t=!1){Me(this,rt,bn).call(this,2),M(this,Ar).setUint16(M(this,Mt),e,t),Me(this,rt,xn).call(this,2)}writeUint32(e,t=!1){Me(this,rt,bn).call(this,4),M(this,Ar).setUint32(M(this,Mt),e,t),Me(this,rt,xn).call(this,4)}writeBigUint64(e,t=!1){Me(this,rt,bn).call(this,8),M(this,Ar).setBigUint64(M(this,Mt),e,t),Me(this,rt,xn).call(this,8)}writeInt16(e,t=!1){Me(this,rt,bn).call(this,2),M(this,Ar).setInt16(M(this,Mt),e,t),Me(this,rt,xn).call(this,2)}writeInt32(e,t=!1){Me(this,rt,bn).call(this,4),M(this,Ar).setInt32(M(this,Mt),e,t),Me(this,rt,xn).call(this,4)}writeBigInt64(e,t=!1){Me(this,rt,bn).call(this,8),M(this,Ar).setBigInt64(M(this,Mt),e,t),Me(this,rt,xn).call(this,8)}writeFloat32(e,t=!1){Me(this,rt,bn).call(this,4),M(this,Ar).setFloat32(M(this,Mt),e,t),Me(this,rt,xn).call(this,4)}writeFloat64(e,t=!1){Me(this,rt,bn).call(this,8),M(this,Ar).setFloat64(M(this,Mt),e,t),Me(this,rt,xn).call(this,8)}clear(){jt(this,si,0),jt(this,Jt,[]),Me(this,rt,Ki).call(this)}};ii=new WeakMap,Jt=new WeakMap,Ar=new WeakMap,Mt=new WeakMap,si=new WeakMap,rt=new WeakSet,Ki=function(){const e=new Uint8Array(M(this,ii).chunkSize);M(this,Jt).push(e),jt(this,Mt,0),jt(this,Ar,new DataView(e.buffer,e.byteOffset,e.byteLength))},$c=function(){if(M(this,Mt)===0){M(this,Jt).pop();return}const e=M(this,Jt).length-1;M(this,Jt)[e]=M(this,Jt)[e].subarray(0,M(this,Mt)),jt(this,Mt,0),jt(this,Ar,null)},Ef=function(){const e=M(this,Jt).length-1;return M(this,Jt)[e].length-M(this,Mt)},bn=function(e){Me(this,rt,Ef).call(this)<e&&(Me(this,rt,$c).call(this),Me(this,rt,Ki).call(this))},xn=function(e){jt(this,Mt,M(this,Mt)+e),jt(this,si,M(this,si)+e)},We(Pc,"defaultOptions",{chunkSize:4096});let gc=Pc;function n0(r,e=0,t=!1){const n=r[e]&128?-1:1,i=(r[e]&124)>>2,s=(r[e]&3)<<8|r[e+1];if(i===0){if(t&&s!==0)throw new Error(`Unwanted subnormal: ${n*5960464477539063e-23*s}`);return n*5960464477539063e-23*s}else if(i===31)return s?NaN:n*(1/0);return n*2**(i-25)*(1024+s)}function pv(r){const e=new DataView(new ArrayBuffer(4));e.setFloat32(0,r,!1);const t=e.getUint32(0,!1);if(t&8191)return null;let n=t>>16&32768;const i=t>>23&255,s=t&8388607;if(!(i===0&&s===0))if(i>=113&&i<=142)n+=(i-112<<10)+(s>>13);else if(i>=103&&i<113){if(s&(1<<126-i)-1)return null;n+=s+8388608>>126-i}else if(i===255)n|=31744,n|=s>>13;else return null;return n}function yv(r){if(r!==0){const e=new ArrayBuffer(8),t=new DataView(e);t.setFloat64(0,r,!1);const n=t.getBigUint64(0,!1);if((n&0x7ff0000000000000n)===0n)return n&0x8000000000000000n?-0:0}return r}function gv(r){switch(r.length){case 2:n0(r,0,!0);break;case 4:{const e=new DataView(r.buffer,r.byteOffset,r.byteLength),t=e.getUint32(0,!1);if(!(t&2139095040)&&t&8388607)throw new Error(`Unwanted subnormal: ${e.getFloat32(0,!1)}`);break}case 8:{const e=new DataView(r.buffer,r.byteOffset,r.byteLength),t=e.getBigUint64(0,!1);if((t&0x7ff0000000000000n)===0n&&t&0x000fffffffffffn)throw new Error(`Unwanted subnormal: ${e.getFloat64(0,!1)}`);break}default:throw new TypeError(`Bad input to isSubnormal: ${r}`)}}const i0=Se.SIMPLE_FLOAT<<5|bt.TWO,vv=Se.SIMPLE_FLOAT<<5|bt.FOUR,mv=Se.SIMPLE_FLOAT<<5|bt.EIGHT,wv=Se.SIMPLE_FLOAT<<5|qn.TRUE,bv=Se.SIMPLE_FLOAT<<5|qn.FALSE,xv=Se.SIMPLE_FLOAT<<5|qn.UNDEFINED,Av=Se.SIMPLE_FLOAT<<5|qn.NULL,Sv=new TextEncoder,_v={...gc.defaultOptions,avoidInts:!1,cde:!1,collapseBigInts:!0,dcbor:!1,float64:!1,flushToZero:!1,forceEndian:null,ignoreOriginalEncoding:!1,largeNegativeAsBigInt:!1,reduceUnsafeNumbers:!1,rejectBigInts:!1,rejectCustomSimples:!1,rejectDuplicateKeys:!1,rejectFloats:!1,rejectUndefined:!1,simplifyNegativeZero:!1,sortKeys:null,stringNormalization:null},s0={cde:!0,ignoreOriginalEncoding:!0,sortKeys:r0},Ev={...s0,dcbor:!0,largeNegativeAsBigInt:!0,reduceUnsafeNumbers:!0,rejectCustomSimples:!0,rejectDuplicateKeys:!0,rejectUndefined:!0,simplifyNegativeZero:!0,stringNormalization:"NFC"};function o0(r){const e=r<0;return typeof r=="bigint"?[e?-r-1n:r,e]:[e?-r-1:r,e]}function af(r,e,t){if(t.rejectFloats)throw new Error(`Attempt to encode an unwanted floating point number: ${r}`);if(isNaN(r))e.writeUint8(i0),e.writeUint16(32256);else if(!t.float64&&Math.fround(r)===r){const n=pv(r);n===null?(e.writeUint8(vv),e.writeFloat32(r)):(e.writeUint8(i0),e.writeUint16(n))}else e.writeUint8(mv),e.writeFloat64(r)}function Wr(r,e,t){const[n,i]=o0(r);if(i&&t)throw new TypeError(`Negative size: ${r}`);t??(t=i?Se.NEG_INT:Se.POS_INT),t<<=5,n<24?e.writeUint8(t|n):n<=255?(e.writeUint8(t|bt.ONE),e.writeUint8(n)):n<=65535?(e.writeUint8(t|bt.TWO),e.writeUint16(n)):n<=4294967295?(e.writeUint8(t|bt.FOUR),e.writeUint32(n)):(e.writeUint8(t|bt.EIGHT),e.writeBigUint64(BigInt(n)))}function vc(r,e,t){typeof r=="number"?Wr(r,e,Se.TAG):typeof r=="object"&&!t.ignoreOriginalEncoding&&Er.ENCODED in r?e.write(r[Er.ENCODED]):r<=Number.MAX_SAFE_INTEGER?Wr(Number(r),e,Se.TAG):(e.writeUint8(Se.TAG<<5|bt.EIGHT),e.writeBigUint64(BigInt(r)))}function a0(r,e,t){const[n,i]=o0(r);if(t.collapseBigInts&&(!t.largeNegativeAsBigInt||r>=-0x8000000000000000n)){if(n<=0xffffffffn){Wr(Number(r),e);return}if(n<=0xffffffffffffffffn){const d=(i?Se.NEG_INT:Se.POS_INT)<<5;e.writeUint8(d|bt.EIGHT),e.writeBigUint64(n);return}}if(t.rejectBigInts)throw new Error(`Attempt to encode unwanted bigint: ${r}`);const s=i?kt.NEG_BIGINT:kt.POS_BIGINT,o=n.toString(16),c=o.length%2?"0":"";vc(s,e,t);const u=e0(c+o);Wr(u.length,e,Se.BYTE_STRING),e.write(u)}function kv(r,e,t){t.flushToZero&&(r=yv(r)),Object.is(r,-0)?t.simplifyNegativeZero?t.avoidInts?af(0,e,t):Wr(0,e):af(r,e,t):!t.avoidInts&&Number.isSafeInteger(r)?Wr(r,e):t.reduceUnsafeNumbers&&Math.floor(r)===r&&r>=pc.MIN&&r<=pc.MAX?a0(BigInt(r),e,t):af(r,e,t)}function Iv(r,e,t){const n=t.stringNormalization?r.normalize(t.stringNormalization):r,i=Sv.encode(n);Wr(i.length,e,Se.UTF8_STRING),e.write(i)}function Cv(r,e,t){const n=r;lf(n,n.length,Se.ARRAY,e,t);for(const i of n)Pi(i,e,t)}function Bv(r,e){const t=r;Wr(t.length,e,Se.BYTE_STRING),e.write(t)}const cf=new Map([[Array,Cv],[Uint8Array,Bv]]);function Pt(r,e){const t=cf.get(r);return cf.set(r,e),t}function lf(r,e,t,n,i){const s=lv(r);s&&!i.ignoreOriginalEncoding?n.write(s):Wr(e,n,t)}function Ov(r,e,t){if(r===null){e.writeUint8(Av);return}if(!t.ignoreOriginalEncoding&&Er.ENCODED in r){e.write(r[Er.ENCODED]);return}const n=cf.get(r.constructor);if(n){const s=n(r,e,t);s&&((typeof s[0]=="bigint"||isFinite(Number(s[0])))&&vc(s[0],e,t),Pi(s[1],e,t));return}if(typeof r.toCBOR=="function"){const s=r.toCBOR(e,t);s&&((typeof s[0]=="bigint"||isFinite(Number(s[0])))&&vc(s[0],e,t),Pi(s[1],e,t));return}if(typeof r.toJSON=="function"){Pi(r.toJSON(),e,t);return}const i=Object.entries(r).map(s=>[s[0],s[1],mc(s[0],t)]);t.sortKeys&&i.sort(t.sortKeys),lf(r,i.length,Se.MAP,e,t);for(const[s,o,c]of i)e.write(c),Pi(o,e,t)}function Pi(r,e,t){switch(typeof r){case"number":kv(r,e,t);break;case"bigint":a0(r,e,t);break;case"string":Iv(r,e,t);break;case"boolean":e.writeUint8(r?wv:bv);break;case"undefined":if(t.rejectUndefined)throw new Error("Attempt to encode unwanted undefined.");e.writeUint8(xv);break;case"object":Ov(r,e,t);break;case"symbol":throw new TypeError(`Unknown symbol: ${r.toString()}`);default:throw new TypeError(`Unknown type: ${typeof r}, ${String(r)}`)}}function mc(r,e={}){const t={..._v};e.dcbor?Object.assign(t,Ev):e.cde&&Object.assign(t,s0),Object.assign(t,e);const n=new gc(t);return Pi(r,n,t),n.read()}var c0=(r=>(r[r.NEVER=-1]="NEVER",r[r.PREFERRED=0]="PREFERRED",r[r.ALWAYS=1]="ALWAYS",r))(c0||{});const oi=class oi{constructor(e){We(this,"value");this.value=e}static create(e){return oi.KnownSimple.has(e)?oi.KnownSimple.get(e):new oi(e)}toCBOR(e,t){if(t.rejectCustomSimples)throw new Error(`Cannot encode non-standard Simple value: ${this.value}`);Wr(this.value,e,Se.SIMPLE_FLOAT)}toString(){return`simple(${this.value})`}decode(){return oi.KnownSimple.has(this.value)?oi.KnownSimple.get(this.value):this}[Symbol.for("nodejs.util.inspect.custom")](e,t,n){return`simple(${n(this.value,t)})`}};We(oi,"KnownSimple",new Map([[qn.FALSE,!1],[qn.TRUE,!0],[qn.NULL,null],[qn.UNDEFINED,void 0]]));let lo=oi;const Tv=new TextDecoder("utf8",{fatal:!0,ignoreBOM:!0}),Uc=class Uc{constructor(e,t){or(this,Qt);or(this,Br);or(this,Xr);or(this,Xt,0);or(this,$r);if(jt(this,$r,{...Uc.defaultOptions,...t}),typeof e=="string")switch(M(this,$r).encoding){case"hex":jt(this,Br,e0(e));break;case"base64":jt(this,Br,of(e));break;default:throw new TypeError(`Encoding not implemented: "${M(this,$r).encoding}"`)}else jt(this,Br,e);jt(this,Xr,new DataView(M(this,Br).buffer,M(this,Br).byteOffset,M(this,Br).byteLength))}toHere(e){return M(this,Br).subarray(e,M(this,Xt))}*[Symbol.iterator](){if(yield*Me(this,Qt,Zi).call(this,0),M(this,Xt)!==M(this,Br).length)throw new Error("Extra data in input")}};Br=new WeakMap,Xr=new WeakMap,Xt=new WeakMap,$r=new WeakMap,Qt=new WeakSet,Zi=function*(e){if(e++>M(this,$r).maxDepth)throw new Error(`Maximum depth ${M(this,$r).maxDepth} exceeded`);const t=M(this,Xt),n=M(this,Xr).getUint8(W0(this,Xt)._++),i=n>>5,s=n&31;let o=s,c=!1,u=0;switch(s){case bt.ONE:if(u=1,o=M(this,Xr).getUint8(M(this,Xt)),i===Se.SIMPLE_FLOAT){if(o<32)throw new Error(`Invalid simple encoding in extra byte: ${o}`);c=!0}else if(M(this,$r).requirePreferred&&o<24)throw new Error(`Unexpectedly long integer encoding (1) for ${o}`);break;case bt.TWO:if(u=2,i===Se.SIMPLE_FLOAT)o=n0(M(this,Br),M(this,Xt));else if(o=M(this,Xr).getUint16(M(this,Xt),!1),M(this,$r).requirePreferred&&o<=255)throw new Error(`Unexpectedly long integer encoding (2) for ${o}`);break;case bt.FOUR:if(u=4,i===Se.SIMPLE_FLOAT)o=M(this,Xr).getFloat32(M(this,Xt),!1);else if(o=M(this,Xr).getUint32(M(this,Xt),!1),M(this,$r).requirePreferred&&o<=65535)throw new Error(`Unexpectedly long integer encoding (4) for ${o}`);break;case bt.EIGHT:{if(u=8,i===Se.SIMPLE_FLOAT)o=M(this,Xr).getFloat64(M(this,Xt),!1);else if(o=M(this,Xr).getBigUint64(M(this,Xt),!1),o<=Number.MAX_SAFE_INTEGER&&(o=Number(o)),M(this,$r).requirePreferred&&o<=4294967295)throw new Error(`Unexpectedly long integer encoding (8) for ${o}`);break}case 28:case 29:case 30:throw new Error(`Additional info not implemented: ${s}`);case bt.INDEFINITE:switch(i){case Se.POS_INT:case Se.NEG_INT:case Se.TAG:throw new Error(`Invalid indefinite encoding for MT ${i}`);case Se.SIMPLE_FLOAT:yield[i,s,Er.BREAK,t,0];return}o=1/0;break;default:c=!0}switch(jt(this,Xt,M(this,Xt)+u),i){case Se.POS_INT:yield[i,s,o,t,u];break;case Se.NEG_INT:yield[i,s,typeof o=="bigint"?-1n-o:-1-Number(o),t,u];break;case Se.BYTE_STRING:o===1/0?yield*Me(this,Qt,Ro).call(this,i,e,t):yield[i,s,Me(this,Qt,kf).call(this,o),t,o];break;case Se.UTF8_STRING:o===1/0?yield*Me(this,Qt,Ro).call(this,i,e,t):yield[i,s,Tv.decode(Me(this,Qt,kf).call(this,o)),t,o];break;case Se.ARRAY:if(o===1/0)yield*Me(this,Qt,Ro).call(this,i,e,t,!1);else{const d=Number(o);yield[i,s,d,t,u];for(let b=0;b<d;b++)yield*Me(this,Qt,Zi).call(this,e+1)}break;case Se.MAP:if(o===1/0)yield*Me(this,Qt,Ro).call(this,i,e,t,!1);else{const d=Number(o);yield[i,s,d,t,u];for(let b=0;b<d;b++)yield*Me(this,Qt,Zi).call(this,e),yield*Me(this,Qt,Zi).call(this,e)}break;case Se.TAG:yield[i,s,o,t,u],yield*Me(this,Qt,Zi).call(this,e);break;case Se.SIMPLE_FLOAT:{const d=o;c&&(o=lo.create(Number(o))),yield[i,s,o,t,d];break}}},kf=function(e){const t=M(this,Br).subarray(M(this,Xt),jt(this,Xt,M(this,Xt)+e));if(t.length!==e)throw new Error(`Unexpected end of stream reading ${e} bytes, got ${t.length}`);return t},Ro=function*(e,t,n,i=!0){for(yield[e,bt.INDEFINITE,1/0,n,1/0];;){const s=Me(this,Qt,Zi).call(this,t),o=s.next(),[c,u,d]=o.value;if(d===Er.BREAK){yield o.value,s.next();return}if(i){if(c!==e)throw new Error(`Unmatched major type. Expected ${e}, got ${c}.`);if(u===bt.INDEFINITE)throw new Error("New stream started in typed stream")}yield o.value,yield*s}},We(Uc,"defaultOptions",{maxDepth:1024,encoding:"hex",requirePreferred:!1});let uo=Uc;const Nv=new Map([[bt.ZERO,1],[bt.ONE,2],[bt.TWO,3],[bt.FOUR,5],[bt.EIGHT,9]]),Rv=new Uint8Array(0);let Yn=(pn=class{constructor(e,t,n,i){or(this,Dc);We(this,"parent");We(this,"mt");We(this,"ai");We(this,"left");We(this,"offset");We(this,"count",0);We(this,"children",[]);We(this,"depth",0);or(this,fr);or(this,yn,null);if([this.mt,this.ai,,this.offset]=e,this.left=t,this.parent=n,jt(this,fr,i),n&&(this.depth=n.depth+1),this.mt===Se.MAP&&(M(this,fr).sortKeys||M(this,fr).rejectDuplicateKeys)&&jt(this,yn,[]),M(this,fr).rejectStreaming&&this.ai===bt.INDEFINITE)throw new Error("Streaming not supported")}get isStreaming(){return this.left===1/0}get done(){return this.left===0}static create(e,t,n,i){const[s,o,c,u]=e;switch(s){case Se.POS_INT:case Se.NEG_INT:{if(n.rejectInts)throw new Error(`Unexpected integer: ${c}`);if(n.rejectLargeNegatives&&c<-0x8000000000000000n)throw new Error(`Invalid 65bit negative number: ${c}`);let d=c;return n.convertUnsafeIntsToFloat&&d>=pc.MIN&&d<=pc.MAX&&(d=Number(c)),n.boxed?co(d,i.toHere(u)):d}case Se.SIMPLE_FLOAT:if(o>bt.ONE){if(n.rejectFloats)throw new Error(`Decoding unwanted floating point number: ${c}`);if(n.rejectNegativeZero&&Object.is(c,-0))throw new Error("Decoding negative zero");if(n.rejectLongLoundNaN&&isNaN(c)){const d=i.toHere(u);if(d.length!==3||d[1]!==126||d[2]!==0)throw new Error(`Invalid NaN encoding: "${Zr(d)}"`)}if(n.rejectSubnormals&&gv(i.toHere(u+1)),n.rejectLongFloats){const d=mc(c,{chunkSize:9,reduceUnsafeNumbers:n.rejectUnsafeFloatInts});if(d[0]>>5!==s)throw new Error(`Should have been encoded as int, not float: ${c}`);if(d.length<Nv.get(o))throw new Error(`Number should have been encoded shorter: ${c}`)}if(typeof c=="number"&&n.boxed)return co(c,i.toHere(u))}else{if(n.rejectSimple&&c instanceof lo)throw new Error(`Invalid simple value: ${c}`);if(n.rejectUndefined&&c===void 0)throw new Error("Unexpected undefined")}return c;case Se.BYTE_STRING:case Se.UTF8_STRING:if(c===1/0)return new n.ParentType(e,1/0,t,n);if(n.rejectStringsNotNormalizedAs&&typeof c=="string"){const d=c.normalize(n.rejectStringsNotNormalizedAs);if(c!==d)throw new Error(`String not normalized as "${n.rejectStringsNotNormalizedAs}", got [${t0(c)}] instead of [${t0(d)}]`)}return n.boxed?co(c,i.toHere(u)):c;case Se.ARRAY:return new n.ParentType(e,c,t,n);case Se.MAP:return new n.ParentType(e,c*2,t,n);case Se.TAG:{const d=new n.ParentType(e,1,t,n);return d.children=new Ye(c),d}}throw new TypeError(`Invalid major type: ${s}`)}push(e,t,n){if(this.children.push(e),M(this,yn)){const i=yc(e)||t.toHere(n);M(this,yn).push(i)}return--this.left}replaceLast(e,t,n){let i,s=-1/0;if(this.children instanceof Ye?(s=0,i=this.children.contents,this.children.contents=e):(s=this.children.length-1,i=this.children[s],this.children[s]=e),M(this,yn)){const o=yc(e)||n.toHere(t.offset);M(this,yn)[s]=o}return i}convert(e){let t;switch(this.mt){case Se.ARRAY:t=this.children;break;case Se.MAP:{const n=Me(this,Dc,J0).call(this);if(M(this,fr).sortKeys){let i;for(const s of n){if(i&&M(this,fr).sortKeys(i,s)>=0)throw new Error(`Duplicate or out of order key: "0x${s[2]}"`);i=s}}else if(M(this,fr).rejectDuplicateKeys){const i=new Set;for(const[s,o,c]of n){const u=Zr(c);if(i.has(u))throw new Error(`Duplicate key: "0x${u}"`);i.add(u)}}t=!M(this,fr).boxed&&!M(this,fr).preferMap&&n.every(([i])=>typeof i=="string")?Object.fromEntries(n):new Map(n);break}case Se.BYTE_STRING:return uv(this.children);case Se.UTF8_STRING:{const n=this.children.join("");t=M(this,fr).boxed?co(n,e.toHere(this.offset)):n;break}case Se.TAG:t=this.children.decode(M(this,fr));break;default:throw new TypeError(`Invalid mt on convert: ${this.mt}`)}return M(this,fr).saveOriginal&&t&&typeof t=="object"&&ao(t,e.toHere(this.offset)),t}},fr=new WeakMap,yn=new WeakMap,Dc=new WeakSet,J0=function(){const e=this.children,t=e.length;if(t%2)throw new Error("Missing map value");const n=new Array(t/2);if(M(this,yn))for(let i=0;i<t;i+=2)n[i>>1]=[e[i],e[i+1],M(this,yn)[i]];else for(let i=0;i<t;i+=2)n[i>>1]=[e[i],e[i+1],Rv];return n},We(pn,"defaultDecodeOptions",{...uo.defaultOptions,ParentType:pn,boxed:!1,cde:!1,dcbor:!1,diagnosticSizes:c0.PREFERRED,convertUnsafeIntsToFloat:!1,pretty:!1,preferMap:!1,rejectLargeNegatives:!1,rejectBigInts:!1,rejectDuplicateKeys:!1,rejectFloats:!1,rejectInts:!1,rejectLongLoundNaN:!1,rejectLongFloats:!1,rejectNegativeZero:!1,rejectSimple:!1,rejectStreaming:!1,rejectStringsNotNormalizedAs:null,rejectSubnormals:!1,rejectUndefined:!1,rejectUnsafeFloatInts:!1,saveOriginal:!1,sortKeys:null}),We(pn,"cdeDecodeOptions",{cde:!0,rejectStreaming:!0,requirePreferred:!0,sortKeys:r0}),We(pn,"dcborDecodeOptions",{...pn.cdeDecodeOptions,dcbor:!0,convertUnsafeIntsToFloat:!0,rejectDuplicateKeys:!0,rejectLargeNegatives:!0,rejectLongLoundNaN:!0,rejectLongFloats:!0,rejectNegativeZero:!0,rejectSimple:!0,rejectUndefined:!0,rejectUnsafeFloatInts:!0,rejectStringsNotNormalizedAs:"NFC"}),pn);class uf extends(K0=Yn,z0=Er.ENCODED,K0){constructor(t,n,i,s){super(t,n,i,s);We(this,"depth",0);We(this,"leaf",!1);We(this,"value");We(this,"length");We(this,z0);this.parent?this.depth=this.parent.depth+1:this.depth=s.initialDepth,[,,this.value,,this.length]=t}numBytes(){switch(this.ai){case bt.ONE:return 1;case bt.TWO:return 2;case bt.FOUR:return 4;case bt.EIGHT:return 8}return 0}}function l0(r){return r instanceof uf}function wc(r,e){return r===1/0?"Indefinite":e?`${r} ${e}${r!==1&&r!==1n?"s":""}`:String(r)}function ff(r){return"".padStart(r," ")}function u0(r,e,t){let n="";n+=ff(r.depth*2);const i=yc(r);n+=Zr(i.subarray(0,1));const s=r.numBytes();s&&(n+=" ",n+=Zr(i.subarray(1,s+1))),n=n.padEnd(e.minCol+1," "),n+="-- ",t!==void 0&&(n+=ff(r.depth*2),t!==""&&(n+=`[${t}] `));let o=!1;const[c]=r.children;switch(r.mt){case Se.POS_INT:n+=`Unsigned: ${c}`,typeof c=="bigint"&&(n+="n");break;case Se.NEG_INT:n+=`Negative: ${c}`,typeof c=="bigint"&&(n+="n");break;case Se.BYTE_STRING:n+=`Bytes (Length: ${wc(r.length)})`;break;case Se.UTF8_STRING:n+=`UTF8 (Length: ${wc(r.length)})`,r.length!==1/0&&(n+=`: ${JSON.stringify(c)}`);break;case Se.ARRAY:n+=`Array (Length: ${wc(r.value,"item")})`;break;case Se.MAP:n+=`Map (Length: ${wc(r.value,"pair")})`;break;case Se.TAG:{n+=`Tag #${r.value}`;const u=r.children,[d]=u.contents.children,b=new Ye(u.tag,d);ao(b,i);const _=b.comment(e,r.depth);_&&(n+=": ",n+=_),o||(o=b.noChildren);break}case Se.SIMPLE_FLOAT:c===Er.BREAK?n+="BREAK":r.ai>bt.ONE?Object.is(c,-0)?n+="Float: -0":n+=`Float: ${c}`:(n+="Simple: ",c instanceof lo?n+=c.value:n+=c);break}if(!o)if(r.leaf){if(n+=`
148
148
  `,i.length>s+1){const u=ff((r.depth+1)*2);for(let d=s+1;d<i.length;d+=8)n+=u,n+=Zr(i.subarray(d,d+8)),n+=`
149
149
  `}}else{n+=`
150
- `;let u=0;for(const d of r.children){if(l0(d)){let b=String(u);r.mt===Ae.MAP?b=u%2?`val ${(u-1)/2}`:`key ${u/2}`:r.mt===Ae.TAG&&(b=""),n+=u0(d,e,b)}u++}}return n}const Uv={...Yn.defaultDecodeOptions,initialDepth:0,noPrefixHex:!1,minCol:0};function Dv(r,e){const t={...Uv,...e,ParentType:uf,saveOriginal:!0},n=new uo(r,t);let i,s;for(const c of n){if(s=Yn.create(c,i,t,n),c[2]===Er.BREAK)if(i!=null&&i.isStreaming)i.left=1;else throw new Error("Unexpected BREAK");if(!l0(s)){const b=new uf(c,0,i,t);b.leaf=!0,b.children.push(s),ao(b,n.toHere(c[3])),s=b}let u=(s.depth+1)*2;const d=s.numBytes();for(d&&(u+=1,u+=d*2),t.minCol=Math.max(t.minCol,u),i&&i.push(s,n,c[3]),i=s;i!=null&&i.done;)s=i,s.leaf||ao(s,n.toHere(s.offset)),{parent:i}=i}e&&(e.minCol=t.minCol);let o=t.noPrefixHex?"":`0x${Zr(n.toHere(0))}
151
- `;return o+=u0(s,t),o}const f0=!yv();function h0(r){if(typeof r=="object"&&r){if(r.constructor!==Number)throw new Error(`Expected number: ${r}`)}else if(typeof r!="number")throw new Error(`Expected number: ${r}`)}function Jn(r){if(typeof r=="object"&&r){if(r.constructor!==String)throw new Error(`Expected string: ${r}`)}else if(typeof r!="string")throw new Error(`Expected string: ${r}`)}function Ui(r){if(!(r instanceof Uint8Array))throw new Error(`Expected Uint8Array: ${r}`)}function d0(r){if(!Array.isArray(r))throw new Error(`Expected Array: ${r}`)}Pt(Map,(r,e,t)=>{const n=[...r.entries()].map(i=>[i[0],i[1],mc(i[0],t)]);if(t.rejectDuplicateKeys){const i=new Set;for(const[s,o,c]of n){const u=Zr(c);if(i.has(u))throw new Error(`Duplicate map key: 0x${u}`);i.add(u)}}t.sortKeys&&n.sort(t.sortKeys),lf(r,r.size,Ae.MAP,e,t);for(const[i,s,o]of n)e.write(o),Pi(s,e,t)});function p0(r){return Jn(r.contents),new Date(r.contents)}p0.comment=r=>(Jn(r.contents),`(String Date) ${new Date(r.contents).toISOString()}`),qe.registerDecoder(kt.DATE_STRING,p0);function y0(r){return h0(r.contents),new Date(r.contents*1e3)}y0.comment=r=>(h0(r.contents),`(Epoch Date) ${new Date(r.contents*1e3).toISOString()}`),qe.registerDecoder(kt.DATE_EPOCH,y0),Pt(Date,r=>[kt.DATE_EPOCH,r.valueOf()/1e3]);function bc(r,e,t){if(Ui(e.contents),t.rejectBigInts)throw new Error(`Decoding unwanted big integer: ${e}(h'${Zr(e.contents)}')`);if(t.requirePreferred&&e.contents[0]===0)throw new Error(`Decoding overly-large bigint: ${e.tag}(h'${Zr(e.contents)})`);let n=e.contents.reduce((i,s)=>i<<8n|BigInt(s),0n);if(r&&(n=-1n-n),t.requirePreferred&&n>=Number.MIN_SAFE_INTEGER&&n<=Number.MAX_SAFE_INTEGER)throw new Error(`Decoding bigint that could have been int: ${n}n`);return t.boxed?co(n,e.contents):n}const g0=bc.bind(null,!1),v0=bc.bind(null,!0);g0.comment=(r,e)=>`(Positive BigInt) ${bc(!1,r,e)}n`,v0.comment=(r,e)=>`(Negative BigInt) ${bc(!0,r,e)}n`,qe.registerDecoder(kt.POS_BIGINT,g0),qe.registerDecoder(kt.NEG_BIGINT,v0);function hf(r,e){return Ui(r.contents),r}hf.comment=(r,e,t)=>{Ui(r.contents);const n={...e,initialDepth:t+2,noPrefixHex:!0},i=yc(r);let s=2**((i[0]&31)-24)+1;const o=i[s]&31;let c=Zr(i.subarray(s,++s));o>=24&&(c+=" ",c+=Zr(i.subarray(s,s+2**(o-24)))),n.minCol=Math.max(n.minCol,(t+1)*2+c.length);const u=Dv(r.contents,n);let d=`Embedded CBOR
150
+ `;let u=0;for(const d of r.children){if(l0(d)){let b=String(u);r.mt===Se.MAP?b=u%2?`val ${(u-1)/2}`:`key ${u/2}`:r.mt===Se.TAG&&(b=""),n+=u0(d,e,b)}u++}}return n}const jv={...Yn.defaultDecodeOptions,initialDepth:0,noPrefixHex:!1,minCol:0};function Pv(r,e){const t={...jv,...e,ParentType:uf,saveOriginal:!0},n=new uo(r,t);let i,s;for(const c of n){if(s=Yn.create(c,i,t,n),c[2]===Er.BREAK)if(i!=null&&i.isStreaming)i.left=1;else throw new Error("Unexpected BREAK");if(!l0(s)){const b=new uf(c,0,i,t);b.leaf=!0,b.children.push(s),ao(b,n.toHere(c[3])),s=b}let u=(s.depth+1)*2;const d=s.numBytes();for(d&&(u+=1,u+=d*2),t.minCol=Math.max(t.minCol,u),i&&i.push(s,n,c[3]),i=s;i!=null&&i.done;)s=i,s.leaf||ao(s,n.toHere(s.offset)),{parent:i}=i}e&&(e.minCol=t.minCol);let o=t.noPrefixHex?"":`0x${Zr(n.toHere(0))}
151
+ `;return o+=u0(s,t),o}const f0=!dv();function h0(r){if(typeof r=="object"&&r){if(r.constructor!==Number)throw new Error(`Expected number: ${r}`)}else if(typeof r!="number")throw new Error(`Expected number: ${r}`)}function Jn(r){if(typeof r=="object"&&r){if(r.constructor!==String)throw new Error(`Expected string: ${r}`)}else if(typeof r!="string")throw new Error(`Expected string: ${r}`)}function Ui(r){if(!(r instanceof Uint8Array))throw new Error(`Expected Uint8Array: ${r}`)}function d0(r){if(!Array.isArray(r))throw new Error(`Expected Array: ${r}`)}Pt(Map,(r,e,t)=>{const n=[...r.entries()].map(i=>[i[0],i[1],mc(i[0],t)]);if(t.rejectDuplicateKeys){const i=new Set;for(const[s,o,c]of n){const u=Zr(c);if(i.has(u))throw new Error(`Duplicate map key: 0x${u}`);i.add(u)}}t.sortKeys&&n.sort(t.sortKeys),lf(r,r.size,Se.MAP,e,t);for(const[i,s,o]of n)e.write(o),Pi(s,e,t)});function p0(r){return Jn(r.contents),new Date(r.contents)}p0.comment=r=>(Jn(r.contents),`(String Date) ${new Date(r.contents).toISOString()}`),Ye.registerDecoder(kt.DATE_STRING,p0);function y0(r){return h0(r.contents),new Date(r.contents*1e3)}y0.comment=r=>(h0(r.contents),`(Epoch Date) ${new Date(r.contents*1e3).toISOString()}`),Ye.registerDecoder(kt.DATE_EPOCH,y0),Pt(Date,r=>[kt.DATE_EPOCH,r.valueOf()/1e3]);function bc(r,e,t){if(Ui(e.contents),t.rejectBigInts)throw new Error(`Decoding unwanted big integer: ${e}(h'${Zr(e.contents)}')`);if(t.requirePreferred&&e.contents[0]===0)throw new Error(`Decoding overly-large bigint: ${e.tag}(h'${Zr(e.contents)})`);let n=e.contents.reduce((i,s)=>i<<8n|BigInt(s),0n);if(r&&(n=-1n-n),t.requirePreferred&&n>=Number.MIN_SAFE_INTEGER&&n<=Number.MAX_SAFE_INTEGER)throw new Error(`Decoding bigint that could have been int: ${n}n`);return t.boxed?co(n,e.contents):n}const g0=bc.bind(null,!1),v0=bc.bind(null,!0);g0.comment=(r,e)=>`(Positive BigInt) ${bc(!1,r,e)}n`,v0.comment=(r,e)=>`(Negative BigInt) ${bc(!0,r,e)}n`,Ye.registerDecoder(kt.POS_BIGINT,g0),Ye.registerDecoder(kt.NEG_BIGINT,v0);function hf(r,e){return Ui(r.contents),r}hf.comment=(r,e,t)=>{Ui(r.contents);const n={...e,initialDepth:t+2,noPrefixHex:!0},i=yc(r);let s=2**((i[0]&31)-24)+1;const o=i[s]&31;let c=Zr(i.subarray(s,++s));o>=24&&(c+=" ",c+=Zr(i.subarray(s,s+2**(o-24)))),n.minCol=Math.max(n.minCol,(t+1)*2+c.length);const u=Pv(r.contents,n);let d=`Embedded CBOR
152
152
  `;return d+=`${"".padStart((t+1)*2," ")}${c}`.padEnd(n.minCol+1," "),d+=`-- Bytes (Length: ${r.contents.length})
153
- `,d+=u,d},hf.noChildren=!0,qe.registerDecoder(kt.CBOR,hf),qe.registerDecoder(kt.URI,r=>(Jn(r.contents),new URL(r.contents)),"URI"),Pt(URL,r=>[kt.URI,r.toString()]),qe.registerDecoder(kt.BASE64URL,r=>(Jn(r.contents),pv(r.contents)),"Base64url-encoded"),qe.registerDecoder(kt.BASE64,r=>(Jn(r.contents),of(r.contents)),"Base64-encoded"),qe.registerDecoder(35,r=>(Jn(r.contents),new RegExp(r.contents)),"RegExp"),qe.registerDecoder(21065,r=>{Jn(r.contents);let e=r.contents.replace(new RegExp("(?<!\\\\)(?<!\\[(?:[^\\]]|\\\\\\])*)\\.","g"),`[^
154
- \r]`);return e=`^(?:${e})$`,new RegExp(e,"u")},"I-RegExp"),qe.registerDecoder(kt.REGEXP,r=>{if(d0(r.contents),r.contents.length<1||r.contents.length>2)throw new Error(`Invalid RegExp Array: ${r.contents}`);return new RegExp(r.contents[0],r.contents[1])},"RegExp"),Pt(RegExp,r=>[kt.REGEXP,[r.source,r.flags]]),qe.registerDecoder(64,r=>(Ui(r.contents),r.contents),"uint8 Typed Array");function tr(r,e,t){Ui(r.contents);let n=r.contents.length;if(n%e.BYTES_PER_ELEMENT!==0)throw new Error(`Number of bytes must be divisible by ${e.BYTES_PER_ELEMENT}, got: ${n}`);n/=e.BYTES_PER_ELEMENT;const i=new e(n),s=new DataView(r.contents.buffer,r.contents.byteOffset,r.contents.byteLength),o=s[`get${e.name.replace(/Array/,"")}`].bind(s);for(let c=0;c<n;c++)i[c]=o(c*e.BYTES_PER_ELEMENT,t);return i}function Xn(r,e,t,n,i){const s=i.forceEndian??f0;if(vc(s?e:t,r,i),Wr(n.byteLength,r,Ae.BYTE_STRING),f0===s)r.write(new Uint8Array(n.buffer,n.byteOffset,n.byteLength));else{const o=`write${n.constructor.name.replace(/Array/,"")}`,c=r[o].bind(r);for(const u of n)c(u,s)}}qe.registerDecoder(65,r=>tr(r,Uint16Array,!1),"uint16, big endian, Typed Array"),qe.registerDecoder(66,r=>tr(r,Uint32Array,!1),"uint32, big endian, Typed Array"),qe.registerDecoder(67,r=>tr(r,BigUint64Array,!1),"uint64, big endian, Typed Array"),qe.registerDecoder(68,r=>(Ui(r.contents),new Uint8ClampedArray(r.contents)),"uint8 Typed Array, clamped arithmetic"),Pt(Uint8ClampedArray,r=>[68,new Uint8Array(r.buffer,r.byteOffset,r.byteLength)]),qe.registerDecoder(69,r=>tr(r,Uint16Array,!0),"uint16, little endian, Typed Array"),Pt(Uint16Array,(r,e,t)=>Xn(e,69,65,r,t)),qe.registerDecoder(70,r=>tr(r,Uint32Array,!0),"uint32, little endian, Typed Array"),Pt(Uint32Array,(r,e,t)=>Xn(e,70,66,r,t)),qe.registerDecoder(71,r=>tr(r,BigUint64Array,!0),"uint64, little endian, Typed Array"),Pt(BigUint64Array,(r,e,t)=>Xn(e,71,67,r,t)),qe.registerDecoder(72,r=>(Ui(r.contents),new Int8Array(r.contents)),"sint8 Typed Array"),Pt(Int8Array,r=>[72,new Uint8Array(r.buffer,r.byteOffset,r.byteLength)]),qe.registerDecoder(73,r=>tr(r,Int16Array,!1),"sint16, big endian, Typed Array"),qe.registerDecoder(74,r=>tr(r,Int32Array,!1),"sint32, big endian, Typed Array"),qe.registerDecoder(75,r=>tr(r,BigInt64Array,!1),"sint64, big endian, Typed Array"),qe.registerDecoder(77,r=>tr(r,Int16Array,!0),"sint16, little endian, Typed Array"),Pt(Int16Array,(r,e,t)=>Xn(e,77,73,r,t)),qe.registerDecoder(78,r=>tr(r,Int32Array,!0),"sint32, little endian, Typed Array"),Pt(Int32Array,(r,e,t)=>Xn(e,78,74,r,t)),qe.registerDecoder(79,r=>tr(r,BigInt64Array,!0),"sint64, little endian, Typed Array"),Pt(BigInt64Array,(r,e,t)=>Xn(e,79,75,r,t)),qe.registerDecoder(81,r=>tr(r,Float32Array,!1),"IEEE 754 binary32, big endian, Typed Array"),qe.registerDecoder(82,r=>tr(r,Float64Array,!1),"IEEE 754 binary64, big endian, Typed Array"),qe.registerDecoder(85,r=>tr(r,Float32Array,!0),"IEEE 754 binary32, little endian, Typed Array"),Pt(Float32Array,(r,e,t)=>Xn(e,85,81,r,t)),qe.registerDecoder(86,r=>tr(r,Float64Array,!0),"IEEE 754 binary64, big endian, Typed Array"),Pt(Float64Array,(r,e,t)=>Xn(e,86,82,r,t)),qe.registerDecoder(kt.SET,r=>(d0(r.contents),new Set(r.contents)),"Set"),Pt(Set,r=>[kt.SET,[...r]]),qe.registerDecoder(kt.JSON,r=>(Jn(r.contents),JSON.parse(r.contents)),"JSON-encoded"),qe.registerDecoder(kt.SELF_DESCRIBED,r=>r.contents,"Self-Described"),qe.registerDecoder(kt.INVALID_16,()=>{throw new Error(`Tag always invalid: ${kt.INVALID_16}`)},"Invalid"),qe.registerDecoder(kt.INVALID_32,()=>{throw new Error(`Tag always invalid: ${kt.INVALID_32}`)},"Invalid"),qe.registerDecoder(kt.INVALID_64,()=>{throw new Error(`Tag always invalid: ${kt.INVALID_64}`)},"Invalid");function df(r){throw new Error(`Encoding ${r.constructor.name} intentionally unimplmented. It is not concrete enough to interoperate. Convert to Uint8Array first.`)}Pt(ArrayBuffer,df),Pt(DataView,df),typeof SharedArrayBuffer<"u"&&Pt(SharedArrayBuffer,df);function xc(r){return[NaN,r.valueOf()]}Pt(Boolean,xc),Pt(Number,xc),Pt(String,xc),Pt(BigInt,xc);function Ac(r,e={}){const t={...Yn.defaultDecodeOptions};if(e.dcbor?Object.assign(t,Yn.dcborDecodeOptions):e.cde&&Object.assign(t,Yn.cdeDecodeOptions),Object.assign(t,e),Object.hasOwn(t,"rejectLongNumbers"))throw new TypeError("rejectLongNumbers has changed to requirePreferred");t.boxed&&(t.saveOriginal=!0);const n=new uo(r,t);let i,s;for(const o of n){if(s=Yn.create(o,i,t,n),o[2]===Er.BREAK)if(i!=null&&i.isStreaming)i.left=0;else throw new Error("Unexpected BREAK");else i&&i.push(s,n,o[3]);for(s instanceof Yn&&(i=s);i!=null&&i.done;){s=i.convert(n);const c=i.parent;c==null||c.replaceLast(s,i,n),i=c}}return s}new TextEncoder;var it;(function(r){r.assertEqual=i=>i;function e(i){}r.assertIs=e;function t(i){throw new Error}r.assertNever=t,r.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},r.getValidEnumValues=i=>{const s=r.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),o={};for(const c of s)o[c]=i[c];return r.objectValues(o)},r.objectValues=i=>r.objectKeys(i).map(function(s){return i[s]}),r.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},r.find=(i,s)=>{for(const o of i)if(s(o))return o},r.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}r.joinValues=n,r.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(it||(it={}));var pf;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(pf||(pf={}));const ce=it.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Qn=r=>{switch(typeof r){case"undefined":return ce.undefined;case"string":return ce.string;case"number":return isNaN(r)?ce.nan:ce.number;case"boolean":return ce.boolean;case"function":return ce.function;case"bigint":return ce.bigint;case"symbol":return ce.symbol;case"object":return Array.isArray(r)?ce.array:r===null?ce.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?ce.promise:typeof Map<"u"&&r instanceof Map?ce.map:typeof Set<"u"&&r instanceof Set?ce.set:typeof Date<"u"&&r instanceof Date?ce.date:ce.object;default:return ce.unknown}},Z=it.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),$v=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class kr extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(s){return s.message},n={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let c=n,u=0;for(;u<o.path.length;){const d=o.path[u];u===o.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(t(o))):c[d]=c[d]||{_errors:[]},c=c[d],u++}}};return i(this),n}static assert(e){if(!(e instanceof kr))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,it.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}kr.create=r=>new kr(r);const bs=(r,e)=>{let t;switch(r.code){case Z.invalid_type:r.received===ce.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case Z.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,it.jsonStringifyReplacer)}`;break;case Z.unrecognized_keys:t=`Unrecognized key(s) in object: ${it.joinValues(r.keys,", ")}`;break;case Z.invalid_union:t="Invalid input";break;case Z.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${it.joinValues(r.options)}`;break;case Z.invalid_enum_value:t=`Invalid enum value. Expected ${it.joinValues(r.options)}, received '${r.received}'`;break;case Z.invalid_arguments:t="Invalid function arguments";break;case Z.invalid_return_type:t="Invalid function return type";break;case Z.invalid_date:t="Invalid date";break;case Z.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:it.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case Z.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case Z.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case Z.custom:t="Invalid input";break;case Z.invalid_intersection_types:t="Intersection results could not be merged";break;case Z.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case Z.not_finite:t="Number must be finite";break;default:t=e.defaultError,it.assertNever(r)}return{message:t}};let m0=bs;function Mv(r){m0=r}function _c(){return m0}const Sc=r=>{const{data:e,path:t,errorMaps:n,issueData:i}=r,s=[...t,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let c="";const u=n.filter(d=>!!d).slice().reverse();for(const d of u)c=d(o,{data:e,defaultError:c}).message;return{...i,path:s,message:c}},Vv=[];function ie(r,e){const t=_c(),n=Sc({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===bs?void 0:bs].filter(i=>!!i)});r.common.issues.push(n)}class rr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const i of t){if(i.status==="aborted")return Pe;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const i of t){const s=await i.key,o=await i.value;n.push({key:s,value:o})}return rr.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const i of t){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Pe;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[s.value]=o.value)}return{status:e.value,value:n}}}const Pe=Object.freeze({status:"aborted"}),xs=r=>({status:"dirty",value:r}),ur=r=>({status:"valid",value:r}),yf=r=>r.status==="aborted",gf=r=>r.status==="dirty",fo=r=>r.status==="valid",ho=r=>typeof Promise<"u"&&r instanceof Promise;function Ec(r,e,t,n){if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(r)}function w0(r,e,t,n,i){if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(r,t),t}typeof SuppressedError=="function"&&SuppressedError;var Ie;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Ie||(Ie={}));var po,yo;class un{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const b0=(r,e)=>{if(fo(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new kr(r.common.issues);return this._error=t,this._error}}};function Me(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:i}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,c)=>{var u,d;const{message:b}=r;return o.code==="invalid_enum_value"?{message:b??c.defaultError}:typeof c.data>"u"?{message:(u=b??n)!==null&&u!==void 0?u:c.defaultError}:o.code!=="invalid_type"?{message:c.defaultError}:{message:(d=b??t)!==null&&d!==void 0?d:c.defaultError}},description:i}}class Ge{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Qn(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Qn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new rr,ctx:{common:e.parent.common,data:e.data,parsedType:Qn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ho(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const i={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Qn(e)},s=this._parseSync({data:e,path:i.path,parent:i});return b0(i,s)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Qn(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(ho(i)?i:Promise.resolve(i));return b0(n,s)}refine(e,t){const n=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,s)=>{const o=e(i),c=()=>s.addIssue({code:Z.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(c(),!1)):o?!0:(c(),!1)})}refinement(e,t){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new Jr({schema:this,typeName:je.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return hn.create(this,this._def)}nullable(){return ni.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Yr.create(this,this._def)}promise(){return Es.create(this,this._def)}or(e){return wo.create([this,e],this._def)}and(e){return bo.create(this,e,this._def)}transform(e){return new Jr({...Me(this._def),schema:this,typeName:je.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Eo({...Me(this._def),innerType:this,defaultValue:t,typeName:je.ZodDefault})}brand(){return new wf({typeName:je.ZodBranded,type:this,...Me(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ko({...Me(this._def),innerType:this,catchValue:t,typeName:je.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Io.create(this,e)}readonly(){return Co.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Lv=/^c[^\s-]{8,}$/i,Hv=/^[0-9a-z]+$/,Fv=/^[0-9A-HJKMNP-TV-Z]{26}$/,Gv=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,zv=/^[a-z0-9_-]{21}$/i,Kv=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Zv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Wv="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let vf;const qv=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Yv=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Jv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,x0="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Xv=new RegExp(`^${x0}$`);function A0(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Qv(r){return new RegExp(`^${A0(r)}$`)}function _0(r){let e=`${x0}T${A0(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function e1(r,e){return!!((e==="v4"||!e)&&qv.test(r)||(e==="v6"||!e)&&Yv.test(r))}class qr extends Ge{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ce.string){const s=this._getOrReturnCtx(e);return ie(s,{code:Z.invalid_type,expected:ce.string,received:s.parsedType}),Pe}const n=new rr;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),ie(i,{code:Z.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),ie(i,{code:Z.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const o=e.data.length>s.value,c=e.data.length<s.value;(o||c)&&(i=this._getOrReturnCtx(e,i),o?ie(i,{code:Z.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&ie(i,{code:Z.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")Zv.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"email",code:Z.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")vf||(vf=new RegExp(Wv,"u")),vf.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"emoji",code:Z.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Gv.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"uuid",code:Z.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")zv.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"nanoid",code:Z.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Lv.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"cuid",code:Z.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Hv.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"cuid2",code:Z.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Fv.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"ulid",code:Z.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),ie(i,{validation:"url",code:Z.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"regex",code:Z.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),ie(i,{code:Z.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),ie(i,{code:Z.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),ie(i,{code:Z.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?_0(s).test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{code:Z.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Xv.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{code:Z.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Qv(s).test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{code:Z.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?Kv.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"duration",code:Z.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?e1(e.data,s.version)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"ip",code:Z.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Jv.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"base64",code:Z.invalid_string,message:s.message}),n.dirty()):it.assertNever(s);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:Z.invalid_string,...Ie.errToObj(n)})}_addCheck(e){return new qr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ie.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ie.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ie.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ie.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ie.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ie.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ie.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ie.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ie.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ie.errToObj(e)})}datetime(e){var t,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!1,...Ie.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Ie.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ie.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ie.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...Ie.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ie.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ie.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ie.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ie.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ie.errToObj(t)})}nonempty(e){return this.min(1,Ie.errToObj(e))}trim(){return new qr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new qr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new qr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}qr.create=r=>{var e;return new qr({checks:[],typeName:je.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...Me(r)})};function t1(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,s=parseInt(r.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return s%o/Math.pow(10,i)}class ei extends Ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ce.number){const s=this._getOrReturnCtx(e);return ie(s,{code:Z.invalid_type,expected:ce.number,received:s.parsedType}),Pe}let n;const i=new rr;for(const s of this._def.checks)s.kind==="int"?it.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),ie(n,{code:Z.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),ie(n,{code:Z.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),ie(n,{code:Z.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?t1(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),ie(n,{code:Z.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),ie(n,{code:Z.not_finite,message:s.message}),i.dirty()):it.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ie.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ie.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ie.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ie.toString(t))}setLimit(e,t,n,i){return new ei({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ie.toString(i)}]})}_addCheck(e){return new ei({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ie.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ie.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ie.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ie.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ie.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ie.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ie.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ie.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ie.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&it.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ei.create=r=>new ei({checks:[],typeName:je.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...Me(r)});class ti extends Ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==ce.bigint){const s=this._getOrReturnCtx(e);return ie(s,{code:Z.invalid_type,expected:ce.bigint,received:s.parsedType}),Pe}let n;const i=new rr;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),ie(n,{code:Z.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),ie(n,{code:Z.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),ie(n,{code:Z.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):it.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ie.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ie.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ie.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ie.toString(t))}setLimit(e,t,n,i){return new ti({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ie.toString(i)}]})}_addCheck(e){return new ti({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ie.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ie.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ie.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ie.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ie.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}ti.create=r=>{var e;return new ti({checks:[],typeName:je.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...Me(r)})};class go extends Ge{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ce.boolean){const n=this._getOrReturnCtx(e);return ie(n,{code:Z.invalid_type,expected:ce.boolean,received:n.parsedType}),Pe}return ur(e.data)}}go.create=r=>new go({typeName:je.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...Me(r)});class Di extends Ge{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ce.date){const s=this._getOrReturnCtx(e);return ie(s,{code:Z.invalid_type,expected:ce.date,received:s.parsedType}),Pe}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return ie(s,{code:Z.invalid_date}),Pe}const n=new rr;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),ie(i,{code:Z.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),ie(i,{code:Z.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):it.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Di({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ie.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ie.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}Di.create=r=>new Di({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:je.ZodDate,...Me(r)});class kc extends Ge{_parse(e){if(this._getType(e)!==ce.symbol){const n=this._getOrReturnCtx(e);return ie(n,{code:Z.invalid_type,expected:ce.symbol,received:n.parsedType}),Pe}return ur(e.data)}}kc.create=r=>new kc({typeName:je.ZodSymbol,...Me(r)});class vo extends Ge{_parse(e){if(this._getType(e)!==ce.undefined){const n=this._getOrReturnCtx(e);return ie(n,{code:Z.invalid_type,expected:ce.undefined,received:n.parsedType}),Pe}return ur(e.data)}}vo.create=r=>new vo({typeName:je.ZodUndefined,...Me(r)});class mo extends Ge{_parse(e){if(this._getType(e)!==ce.null){const n=this._getOrReturnCtx(e);return ie(n,{code:Z.invalid_type,expected:ce.null,received:n.parsedType}),Pe}return ur(e.data)}}mo.create=r=>new mo({typeName:je.ZodNull,...Me(r)});class As extends Ge{constructor(){super(...arguments),this._any=!0}_parse(e){return ur(e.data)}}As.create=r=>new As({typeName:je.ZodAny,...Me(r)});class $i extends Ge{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ur(e.data)}}$i.create=r=>new $i({typeName:je.ZodUnknown,...Me(r)});class jn extends Ge{_parse(e){const t=this._getOrReturnCtx(e);return ie(t,{code:Z.invalid_type,expected:ce.never,received:t.parsedType}),Pe}}jn.create=r=>new jn({typeName:je.ZodNever,...Me(r)});class Ic extends Ge{_parse(e){if(this._getType(e)!==ce.undefined){const n=this._getOrReturnCtx(e);return ie(n,{code:Z.invalid_type,expected:ce.void,received:n.parsedType}),Pe}return ur(e.data)}}Ic.create=r=>new Ic({typeName:je.ZodVoid,...Me(r)});class Yr extends Ge{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==ce.array)return ie(t,{code:Z.invalid_type,expected:ce.array,received:t.parsedType}),Pe;if(i.exactLength!==null){const o=t.data.length>i.exactLength.value,c=t.data.length<i.exactLength.value;(o||c)&&(ie(t,{code:o?Z.too_big:Z.too_small,minimum:c?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(ie(t,{code:Z.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(ie(t,{code:Z.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,c)=>i.type._parseAsync(new un(t,o,t.path,c)))).then(o=>rr.mergeArray(n,o));const s=[...t.data].map((o,c)=>i.type._parseSync(new un(t,o,t.path,c)));return rr.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new Yr({...this._def,minLength:{value:e,message:Ie.toString(t)}})}max(e,t){return new Yr({...this._def,maxLength:{value:e,message:Ie.toString(t)}})}length(e,t){return new Yr({...this._def,exactLength:{value:e,message:Ie.toString(t)}})}nonempty(e){return this.min(1,e)}}Yr.create=(r,e)=>new Yr({type:r,minLength:null,maxLength:null,exactLength:null,typeName:je.ZodArray,...Me(e)});function _s(r){if(r instanceof Nt){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=hn.create(_s(n))}return new Nt({...r._def,shape:()=>e})}else return r instanceof Yr?new Yr({...r._def,type:_s(r.element)}):r instanceof hn?hn.create(_s(r.unwrap())):r instanceof ni?ni.create(_s(r.unwrap())):r instanceof fn?fn.create(r.items.map(e=>_s(e))):r}class Nt extends Ge{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=it.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==ce.object){const d=this._getOrReturnCtx(e);return ie(d,{code:Z.invalid_type,expected:ce.object,received:d.parsedType}),Pe}const{status:n,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),c=[];if(!(this._def.catchall instanceof jn&&this._def.unknownKeys==="strip"))for(const d in i.data)o.includes(d)||c.push(d);const u=[];for(const d of o){const b=s[d],S=i.data[d];u.push({key:{status:"valid",value:d},value:b._parse(new un(i,S,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof jn){const d=this._def.unknownKeys;if(d==="passthrough")for(const b of c)u.push({key:{status:"valid",value:b},value:{status:"valid",value:i.data[b]}});else if(d==="strict")c.length>0&&(ie(i,{code:Z.unrecognized_keys,keys:c}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const b of c){const S=i.data[b];u.push({key:{status:"valid",value:b},value:d._parse(new un(i,S,i.path,b)),alwaysSet:b in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const d=[];for(const b of u){const S=await b.key,Y=await b.value;d.push({key:S,value:Y,alwaysSet:b.alwaysSet})}return d}).then(d=>rr.mergeObjectSync(n,d)):rr.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Ie.errToObj,new Nt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var i,s,o,c;const u=(o=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,t,n).message)!==null&&o!==void 0?o:n.defaultError;return t.code==="unrecognized_keys"?{message:(c=Ie.errToObj(e).message)!==null&&c!==void 0?c:u}:{message:u}}}:{}})}strip(){return new Nt({...this._def,unknownKeys:"strip"})}passthrough(){return new Nt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Nt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Nt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:je.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Nt({...this._def,catchall:e})}pick(e){const t={};return it.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new Nt({...this._def,shape:()=>t})}omit(e){const t={};return it.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new Nt({...this._def,shape:()=>t})}deepPartial(){return _s(this)}partial(e){const t={};return it.objectKeys(this.shape).forEach(n=>{const i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}),new Nt({...this._def,shape:()=>t})}required(e){const t={};return it.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof hn;)s=s._def.innerType;t[n]=s}}),new Nt({...this._def,shape:()=>t})}keyof(){return S0(it.objectKeys(this.shape))}}Nt.create=(r,e)=>new Nt({shape:()=>r,unknownKeys:"strip",catchall:jn.create(),typeName:je.ZodObject,...Me(e)}),Nt.strictCreate=(r,e)=>new Nt({shape:()=>r,unknownKeys:"strict",catchall:jn.create(),typeName:je.ZodObject,...Me(e)}),Nt.lazycreate=(r,e)=>new Nt({shape:r,unknownKeys:"strip",catchall:jn.create(),typeName:je.ZodObject,...Me(e)});class wo extends Ge{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function i(s){for(const c of s)if(c.result.status==="valid")return c.result;for(const c of s)if(c.result.status==="dirty")return t.common.issues.push(...c.ctx.common.issues),c.result;const o=s.map(c=>new kr(c.ctx.common.issues));return ie(t,{code:Z.invalid_union,unionErrors:o}),Pe}if(t.common.async)return Promise.all(n.map(async s=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const u of n){const d={...t,common:{...t.common,issues:[]},parent:null},b=u._parseSync({data:t.data,path:t.path,parent:d});if(b.status==="valid")return b;b.status==="dirty"&&!s&&(s={result:b,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;const c=o.map(u=>new kr(u));return ie(t,{code:Z.invalid_union,unionErrors:c}),Pe}}get options(){return this._def.options}}wo.create=(r,e)=>new wo({options:r,typeName:je.ZodUnion,...Me(e)});const Pn=r=>r instanceof Ao?Pn(r.schema):r instanceof Jr?Pn(r.innerType()):r instanceof _o?[r.value]:r instanceof ri?r.options:r instanceof So?it.objectValues(r.enum):r instanceof Eo?Pn(r._def.innerType):r instanceof vo?[void 0]:r instanceof mo?[null]:r instanceof hn?[void 0,...Pn(r.unwrap())]:r instanceof ni?[null,...Pn(r.unwrap())]:r instanceof wf||r instanceof Co?Pn(r.unwrap()):r instanceof ko?Pn(r._def.innerType):[];class Cc extends Ge{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ce.object)return ie(t,{code:Z.invalid_type,expected:ce.object,received:t.parsedType}),Pe;const n=this.discriminator,i=t.data[n],s=this.optionsMap.get(i);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(ie(t,{code:Z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Pe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const i=new Map;for(const s of t){const o=Pn(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const c of o){if(i.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);i.set(c,s)}}return new Cc({typeName:je.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...Me(n)})}}function mf(r,e){const t=Qn(r),n=Qn(e);if(r===e)return{valid:!0,data:r};if(t===ce.object&&n===ce.object){const i=it.objectKeys(e),s=it.objectKeys(r).filter(c=>i.indexOf(c)!==-1),o={...r,...e};for(const c of s){const u=mf(r[c],e[c]);if(!u.valid)return{valid:!1};o[c]=u.data}return{valid:!0,data:o}}else if(t===ce.array&&n===ce.array){if(r.length!==e.length)return{valid:!1};const i=[];for(let s=0;s<r.length;s++){const o=r[s],c=e[s],u=mf(o,c);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return t===ce.date&&n===ce.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class bo extends Ge{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=(s,o)=>{if(yf(s)||yf(o))return Pe;const c=mf(s.value,o.value);return c.valid?((gf(s)||gf(o))&&t.dirty(),{status:t.value,value:c.data}):(ie(n,{code:Z.invalid_intersection_types}),Pe)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}bo.create=(r,e,t)=>new bo({left:r,right:e,typeName:je.ZodIntersection,...Me(t)});class fn extends Ge{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ce.array)return ie(n,{code:Z.invalid_type,expected:ce.array,received:n.parsedType}),Pe;if(n.data.length<this._def.items.length)return ie(n,{code:Z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Pe;!this._def.rest&&n.data.length>this._def.items.length&&(ie(n,{code:Z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...n.data].map((o,c)=>{const u=this._def.items[c]||this._def.rest;return u?u._parse(new un(n,o,n.path,c)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>rr.mergeArray(t,o)):rr.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new fn({...this._def,rest:e})}}fn.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new fn({items:r,typeName:je.ZodTuple,rest:null,...Me(e)})};class xo extends Ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ce.object)return ie(n,{code:Z.invalid_type,expected:ce.object,received:n.parsedType}),Pe;const i=[],s=this._def.keyType,o=this._def.valueType;for(const c in n.data)i.push({key:s._parse(new un(n,c,n.path,c)),value:o._parse(new un(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?rr.mergeObjectAsync(t,i):rr.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof Ge?new xo({keyType:e,valueType:t,typeName:je.ZodRecord,...Me(n)}):new xo({keyType:qr.create(),valueType:e,typeName:je.ZodRecord,...Me(t)})}}class Bc extends Ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ce.map)return ie(n,{code:Z.invalid_type,expected:ce.map,received:n.parsedType}),Pe;const i=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([c,u],d)=>({key:i._parse(new un(n,c,n.path,[d,"key"])),value:s._parse(new un(n,u,n.path,[d,"value"]))}));if(n.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const u of o){const d=await u.key,b=await u.value;if(d.status==="aborted"||b.status==="aborted")return Pe;(d.status==="dirty"||b.status==="dirty")&&t.dirty(),c.set(d.value,b.value)}return{status:t.value,value:c}})}else{const c=new Map;for(const u of o){const d=u.key,b=u.value;if(d.status==="aborted"||b.status==="aborted")return Pe;(d.status==="dirty"||b.status==="dirty")&&t.dirty(),c.set(d.value,b.value)}return{status:t.value,value:c}}}}Bc.create=(r,e,t)=>new Bc({valueType:e,keyType:r,typeName:je.ZodMap,...Me(t)});class Mi extends Ge{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ce.set)return ie(n,{code:Z.invalid_type,expected:ce.set,received:n.parsedType}),Pe;const i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(ie(n,{code:Z.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(ie(n,{code:Z.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const s=this._def.valueType;function o(u){const d=new Set;for(const b of u){if(b.status==="aborted")return Pe;b.status==="dirty"&&t.dirty(),d.add(b.value)}return{status:t.value,value:d}}const c=[...n.data.values()].map((u,d)=>s._parse(new un(n,u,n.path,d)));return n.common.async?Promise.all(c).then(u=>o(u)):o(c)}min(e,t){return new Mi({...this._def,minSize:{value:e,message:Ie.toString(t)}})}max(e,t){return new Mi({...this._def,maxSize:{value:e,message:Ie.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Mi.create=(r,e)=>new Mi({valueType:r,minSize:null,maxSize:null,typeName:je.ZodSet,...Me(e)});class Ss extends Ge{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ce.function)return ie(t,{code:Z.invalid_type,expected:ce.function,received:t.parsedType}),Pe;function n(c,u){return Sc({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_c(),bs].filter(d=>!!d),issueData:{code:Z.invalid_arguments,argumentsError:u}})}function i(c,u){return Sc({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_c(),bs].filter(d=>!!d),issueData:{code:Z.invalid_return_type,returnTypeError:u}})}const s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Es){const c=this;return ur(async function(...u){const d=new kr([]),b=await c._def.args.parseAsync(u,s).catch($=>{throw d.addIssue(n(u,$)),d}),S=await Reflect.apply(o,this,b);return await c._def.returns._def.type.parseAsync(S,s).catch($=>{throw d.addIssue(i(S,$)),d})})}else{const c=this;return ur(function(...u){const d=c._def.args.safeParse(u,s);if(!d.success)throw new kr([n(u,d.error)]);const b=Reflect.apply(o,this,d.data),S=c._def.returns.safeParse(b,s);if(!S.success)throw new kr([i(b,S.error)]);return S.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ss({...this._def,args:fn.create(e).rest($i.create())})}returns(e){return new Ss({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Ss({args:e||fn.create([]).rest($i.create()),returns:t||$i.create(),typeName:je.ZodFunction,...Me(n)})}}class Ao extends Ge{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ao.create=(r,e)=>new Ao({getter:r,typeName:je.ZodLazy,...Me(e)});class _o extends Ge{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ie(t,{received:t.data,code:Z.invalid_literal,expected:this._def.value}),Pe}return{status:"valid",value:e.data}}get value(){return this._def.value}}_o.create=(r,e)=>new _o({value:r,typeName:je.ZodLiteral,...Me(e)});function S0(r,e){return new ri({values:r,typeName:je.ZodEnum,...Me(e)})}class ri extends Ge{constructor(){super(...arguments),po.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return ie(t,{expected:it.joinValues(n),received:t.parsedType,code:Z.invalid_type}),Pe}if(Ec(this,po)||w0(this,po,new Set(this._def.values)),!Ec(this,po).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return ie(t,{received:t.data,code:Z.invalid_enum_value,options:n}),Pe}return ur(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ri.create(e,{...this._def,...t})}exclude(e,t=this._def){return ri.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}po=new WeakMap,ri.create=S0;class So extends Ge{constructor(){super(...arguments),yo.set(this,void 0)}_parse(e){const t=it.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==ce.string&&n.parsedType!==ce.number){const i=it.objectValues(t);return ie(n,{expected:it.joinValues(i),received:n.parsedType,code:Z.invalid_type}),Pe}if(Ec(this,yo)||w0(this,yo,new Set(it.getValidEnumValues(this._def.values))),!Ec(this,yo).has(e.data)){const i=it.objectValues(t);return ie(n,{received:n.data,code:Z.invalid_enum_value,options:i}),Pe}return ur(e.data)}get enum(){return this._def.values}}yo=new WeakMap,So.create=(r,e)=>new So({values:r,typeName:je.ZodNativeEnum,...Me(e)});class Es extends Ge{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ce.promise&&t.common.async===!1)return ie(t,{code:Z.invalid_type,expected:ce.promise,received:t.parsedType}),Pe;const n=t.parsedType===ce.promise?t.data:Promise.resolve(t.data);return ur(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Es.create=(r,e)=>new Es({type:r,typeName:je.ZodPromise,...Me(e)});class Jr extends Ge{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===je.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:o=>{ie(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(n.data,s);if(n.common.async)return Promise.resolve(o).then(async c=>{if(t.value==="aborted")return Pe;const u=await this._def.schema._parseAsync({data:c,path:n.path,parent:n});return u.status==="aborted"?Pe:u.status==="dirty"||t.value==="dirty"?xs(u.value):u});{if(t.value==="aborted")return Pe;const c=this._def.schema._parseSync({data:o,path:n.path,parent:n});return c.status==="aborted"?Pe:c.status==="dirty"||t.value==="dirty"?xs(c.value):c}}if(i.type==="refinement"){const o=c=>{const u=i.refinement(c,s);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(n.common.async===!1){const c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?Pe:(c.status==="dirty"&&t.dirty(),o(c.value),{status:t.value,value:c.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>c.status==="aborted"?Pe:(c.status==="dirty"&&t.dirty(),o(c.value).then(()=>({status:t.value,value:c.value}))))}if(i.type==="transform")if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!fo(o))return o;const c=i.transform(o.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:c}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>fo(o)?Promise.resolve(i.transform(o.value,s)).then(c=>({status:t.value,value:c})):o);it.assertNever(i)}}Jr.create=(r,e,t)=>new Jr({schema:r,typeName:je.ZodEffects,effect:e,...Me(t)}),Jr.createWithPreprocess=(r,e,t)=>new Jr({schema:e,effect:{type:"preprocess",transform:r},typeName:je.ZodEffects,...Me(t)});class hn extends Ge{_parse(e){return this._getType(e)===ce.undefined?ur(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}hn.create=(r,e)=>new hn({innerType:r,typeName:je.ZodOptional,...Me(e)});class ni extends Ge{_parse(e){return this._getType(e)===ce.null?ur(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ni.create=(r,e)=>new ni({innerType:r,typeName:je.ZodNullable,...Me(e)});class Eo extends Ge{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===ce.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Eo.create=(r,e)=>new Eo({innerType:r,typeName:je.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Me(e)});class ko extends Ge{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ho(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new kr(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new kr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ko.create=(r,e)=>new ko({innerType:r,typeName:je.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Me(e)});class Oc extends Ge{_parse(e){if(this._getType(e)!==ce.nan){const n=this._getOrReturnCtx(e);return ie(n,{code:Z.invalid_type,expected:ce.nan,received:n.parsedType}),Pe}return{status:"valid",value:e.data}}}Oc.create=r=>new Oc({typeName:je.ZodNaN,...Me(r)});const r1=Symbol("zod_brand");class wf extends Ge{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Io extends Ge{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Pe:s.status==="dirty"?(t.dirty(),xs(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Pe:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,t){return new Io({in:e,out:t,typeName:je.ZodPipeline})}}class Co extends Ge{_parse(e){const t=this._def.innerType._parse(e),n=i=>(fo(i)&&(i.value=Object.freeze(i.value)),i);return ho(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}}Co.create=(r,e)=>new Co({innerType:r,typeName:je.ZodReadonly,...Me(e)});function E0(r,e={},t){return r?As.create().superRefine((n,i)=>{var s,o;if(!r(n)){const c=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(o=(s=c.fatal)!==null&&s!==void 0?s:t)!==null&&o!==void 0?o:!0,d=typeof c=="string"?{message:c}:c;i.addIssue({code:"custom",...d,fatal:u})}}):As.create()}const n1={object:Nt.lazycreate};var je;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(je||(je={}));const i1=(r,e={message:`Input not instance of ${r.name}`})=>E0(t=>t instanceof r,e),k0=qr.create,I0=ei.create,s1=Oc.create,o1=ti.create,C0=go.create,a1=Di.create,c1=kc.create,l1=vo.create,u1=mo.create,f1=As.create,h1=$i.create,d1=jn.create,p1=Ic.create,y1=Yr.create,g1=Nt.create,v1=Nt.strictCreate,m1=wo.create,w1=Cc.create,b1=bo.create,x1=fn.create,A1=xo.create,_1=Bc.create,S1=Mi.create,E1=Ss.create,k1=Ao.create,I1=_o.create,C1=ri.create,B1=So.create,O1=Es.create,B0=Jr.create,T1=hn.create,N1=ni.create,R1=Jr.createWithPreprocess,j1=Io.create;var Rt=Object.freeze({__proto__:null,defaultErrorMap:bs,setErrorMap:Mv,getErrorMap:_c,makeIssue:Sc,EMPTY_PATH:Vv,addIssueToContext:ie,ParseStatus:rr,INVALID:Pe,DIRTY:xs,OK:ur,isAborted:yf,isDirty:gf,isValid:fo,isAsync:ho,get util(){return it},get objectUtil(){return pf},ZodParsedType:ce,getParsedType:Qn,ZodType:Ge,datetimeRegex:_0,ZodString:qr,ZodNumber:ei,ZodBigInt:ti,ZodBoolean:go,ZodDate:Di,ZodSymbol:kc,ZodUndefined:vo,ZodNull:mo,ZodAny:As,ZodUnknown:$i,ZodNever:jn,ZodVoid:Ic,ZodArray:Yr,ZodObject:Nt,ZodUnion:wo,ZodDiscriminatedUnion:Cc,ZodIntersection:bo,ZodTuple:fn,ZodRecord:xo,ZodMap:Bc,ZodSet:Mi,ZodFunction:Ss,ZodLazy:Ao,ZodLiteral:_o,ZodEnum:ri,ZodNativeEnum:So,ZodPromise:Es,ZodEffects:Jr,ZodTransformer:Jr,ZodOptional:hn,ZodNullable:ni,ZodDefault:Eo,ZodCatch:ko,ZodNaN:Oc,BRAND:r1,ZodBranded:wf,ZodPipeline:Io,ZodReadonly:Co,custom:E0,Schema:Ge,ZodSchema:Ge,late:n1,get ZodFirstPartyTypeKind(){return je},coerce:{string:r=>qr.create({...r,coerce:!0}),number:r=>ei.create({...r,coerce:!0}),boolean:r=>go.create({...r,coerce:!0}),bigint:r=>ti.create({...r,coerce:!0}),date:r=>Di.create({...r,coerce:!0})},any:f1,array:y1,bigint:o1,boolean:C0,date:a1,discriminatedUnion:w1,effect:B0,enum:C1,function:E1,instanceof:i1,intersection:b1,lazy:k1,literal:I1,map:_1,nan:s1,nativeEnum:B1,never:d1,null:u1,nullable:N1,number:I0,object:g1,oboolean:()=>C0().optional(),onumber:()=>I0().optional(),optional:T1,ostring:()=>k0().optional(),pipeline:j1,preprocess:R1,promise:O1,record:A1,set:S1,strictObject:v1,string:k0,symbol:c1,transformer:B0,tuple:x1,undefined:l1,union:m1,unknown:h1,void:p1,NEVER:Pe,ZodIssueCode:Z,quotelessJson:$v,ZodError:kr});const Tc=new Uint8Array([48,130,2,17,48,130,1,150,160,3,2,1,2,2,17,0,249,49,117,104,27,144,175,225,29,70,204,180,228,231,248,86,48,10,6,8,42,134,72,206,61,4,3,3,48,73,49,11,48,9,6,3,85,4,6,19,2,85,83,49,15,48,13,6,3,85,4,10,12,6,65,109,97,122,111,110,49,12,48,10,6,3,85,4,11,12,3,65,87,83,49,27,48,25,6,3,85,4,3,12,18,97,119,115,46,110,105,116,114,111,45,101,110,99,108,97,118,101,115,48,30,23,13,49,57,49,48,50,56,49,51,50,56,48,53,90,23,13,52,57,49,48,50,56,49,52,50,56,48,53,90,48,73,49,11,48,9,6,3,85,4,6,19,2,85,83,49,15,48,13,6,3,85,4,10,12,6,65,109,97,122,111,110,49,12,48,10,6,3,85,4,11,12,3,65,87,83,49,27,48,25,6,3,85,4,3,12,18,97,119,115,46,110,105,116,114,111,45,101,110,99,108,97,118,101,115,48,118,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,3,98,0,4,252,2,84,235,166,8,193,243,104,112,226,154,218,144,190,70,56,50,146,115,110,137,75,255,246,114,217,137,68,75,80,81,229,52,164,177,246,219,227,192,188,88,26,50,183,177,118,7,14,222,18,214,154,63,234,33,27,102,231,82,207,125,209,221,9,95,111,19,112,244,23,8,67,217,220,16,1,33,228,207,99,1,40,9,102,68,135,201,121,98,132,48,77,197,63,244,163,66,48,64,48,15,6,3,85,29,19,1,1,255,4,5,48,3,1,1,255,48,29,6,3,85,29,14,4,22,4,20,144,37,181,13,217,5,71,231,150,195,150,250,114,157,207,153,169,223,75,150,48,14,6,3,85,29,15,1,1,255,4,4,3,2,1,134,48,10,6,8,42,134,72,206,61,4,3,3,3,105,0,48,102,2,49,0,163,127,47,145,161,201,189,94,231,184,98,124,22,152,210,85,3,142,31,3,67,249,91,99,169,98,140,61,57,128,149,69,161,30,188,191,46,59,85,216,174,238,113,180,195,214,173,243,2,49,0,162,243,155,22,5,178,112,40,165,221,75,160,105,181,1,110,101,180,251,222,143,224,6,29,106,83,25,127,156,218,245,217,67,188,97,252,43,235,3,203,111,238,141,35,2,243,223,246]);if(!Tc||Tc.length===0)throw new Error("AWS root certificate is empty or not loaded correctly");const P1=Rt.object({module_id:Rt.string().min(1),digest:Rt.literal("SHA384"),timestamp:Rt.number().min(1677721600),pcrs:Rt.map(Rt.number(),Rt.instanceof(Uint8Array)),certificate:Rt.instanceof(Uint8Array),cabundle:Rt.array(Rt.instanceof(Uint8Array)),public_key:Rt.nullable(Rt.instanceof(Uint8Array)),user_data:Rt.nullable(Rt.instanceof(Uint8Array)),nonce:Rt.nullable(Rt.instanceof(Uint8Array))}),U1=Rt.object({protected:Rt.instanceof(Uint8Array),payload:Rt.instanceof(Uint8Array),signature:Rt.instanceof(Uint8Array)});async function D1(r){try{if(!r)throw new Error("Attestation document is empty.");const e=Cs(r),t=Ac(e),n=t[0],i=t[2],s=t[3];return U1.parse({protected:n,payload:i,signature:s})}catch(e){throw console.error("Error parsing document data:",e),new Error("Failed to parse document data.")}}async function $1(r){try{const e=Ac(r);return P1.parse(e)}catch(e){throw console.error("Error parsing document payload:",e),new Error("Failed to parse document payload.")}}function M1(r,e){const t=["Signature1",r,new Uint8Array(0),e];return mc(t)}async function V1(r,e){try{console.log("SIGNATURE:"),console.log(Vr(r.signature));const t=M1(r.protected,r.payload),n=await crypto.subtle.digest("SHA-384",t);return console.log("SIGNATURE STRUCTURE DIGEST:"),console.log(Vr(new Uint8Array(n))),await crypto.subtle.verify({name:"ECDSA",hash:"SHA-384"},e,r.signature,t)}catch(t){throw console.error("Error verifying signature:",t),t instanceof Error?new Error(`Signature verification failed: ${t.message}`):new Error(`Signature verification failed: ${t}`)}}async function Nc(r,e,t){try{const n=await D1(r),i=await $1(n.payload);if(!i.nonce)throw new Error("Attestation document does not have a nonce.");const o=new TextDecoder("utf-8").decode(i.nonce);if(t!==o)throw console.log("Nonce mismatch"),console.log("Provided nonce:",t),console.log("Attestation document nonce:",o),new Error("Attestation document's nonce does not match the provided nonce.");const c=[],u=Vr(i.cabundle[0]);if(u!==Vr(e))throw console.error("Root cert doesn't match first cert"),console.log("First cert base64:",u),console.log("Trusted root cert base64:",Vr(e)),new Error("Root cert does not match first cert in attestation document.");for(let I=0;I<i.cabundle.length;I++){const R=new ji(i.cabundle[I]);c.push(R)}const d=new ji(i.certificate),S=await new uv({certificates:c}).build(d);console.log("Chain items:",S);const $=new Date().getTime();for(let I=0;I<S.length;I++){const R=S[I];if(console.log("CERT: ",I),console.log(R.subject),console.log("Not before:",R.notBefore),console.log("Not after:",R.notAfter),console.log(R.toString("pem")),R.notBefore.getTime()>$||R.notAfter.getTime()<$)throw new Error("Certificate is expired.");console.log(`Certificate ${I} is not expired.`)}if(S.length!==i.cabundle.length+1)throw new Error("Certificate chain length does not match length of cabundle.");const w=d.publicKey;console.log("PUBLIC KEY:"),console.log(Vr(new Uint8Array(w.rawData)));const E=await w.export(),B=await V1(n,E);if(console.log("Signature verified:",B),!B)throw new Error("Signature verification failed.");return i}catch(n){throw console.error("Error verifying attestation document:",n),n}}const L1=Rt.object({public_key:Rt.nullable(Rt.instanceof(Uint8Array))});async function H1(r){const e=Cs(r),n=Ac(e)[2],i=Ac(n);return await L1.parse(i)}async function F1(r){try{const e=await rm(r),t=q1();return t&&(t==="http://127.0.0.1:3000"||t==="http://localhost:3000"||t==="http://0.0.0.0:3000")?(console.log("DEV MODE: Using fake attestation document"),await H1(e)):await Nc(e,Tc,r)}catch(e){throw e instanceof Error?(console.error("Error verifying attestation document:",e),new Error(`Couldn't process attestation document: ${e.message}`)):(console.error("Error verifying attestation document:",e),new Error("Couldn't process attestation document."))}}function G1(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var O0={exports:{}};const z1=Mc(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));(function(r){(function(e){var t=function(l){var y,p=new Float64Array(16);if(l)for(y=0;y<l.length;y++)p[y]=l[y];return p},n=function(){throw new Error("no PRNG")},i=new Uint8Array(16),s=new Uint8Array(32);s[0]=9;var o=t(),c=t([1]),u=t([56129,1]),d=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),b=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),S=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),Y=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),$=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(l,y,p,a){l[y]=p>>24&255,l[y+1]=p>>16&255,l[y+2]=p>>8&255,l[y+3]=p&255,l[y+4]=a>>24&255,l[y+5]=a>>16&255,l[y+6]=a>>8&255,l[y+7]=a&255}function E(l,y,p,a,v){var h,m=0;for(h=0;h<v;h++)m|=l[y+h]^p[a+h];return(1&m-1>>>8)-1}function B(l,y,p,a){return E(l,y,p,a,16)}function I(l,y,p,a){return E(l,y,p,a,32)}function R(l,y,p,a){for(var v=a[0]&255|(a[1]&255)<<8|(a[2]&255)<<16|(a[3]&255)<<24,h=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,m=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,_=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,N=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,W=a[4]&255|(a[5]&255)<<8|(a[6]&255)<<16|(a[7]&255)<<24,F=y[0]&255|(y[1]&255)<<8|(y[2]&255)<<16|(y[3]&255)<<24,ye=y[4]&255|(y[5]&255)<<8|(y[6]&255)<<16|(y[7]&255)<<24,L=y[8]&255|(y[9]&255)<<8|(y[10]&255)<<16|(y[11]&255)<<24,be=y[12]&255|(y[13]&255)<<8|(y[14]&255)<<16|(y[15]&255)<<24,ge=a[8]&255|(a[9]&255)<<8|(a[10]&255)<<16|(a[11]&255)<<24,xe=p[16]&255|(p[17]&255)<<8|(p[18]&255)<<16|(p[19]&255)<<24,Ce=p[20]&255|(p[21]&255)<<8|(p[22]&255)<<16|(p[23]&255)<<24,Be=p[24]&255|(p[25]&255)<<8|(p[26]&255)<<16|(p[27]&255)<<24,Oe=p[28]&255|(p[29]&255)<<8|(p[30]&255)<<16|(p[31]&255)<<24,Se=a[12]&255|(a[13]&255)<<8|(a[14]&255)<<16|(a[15]&255)<<24,fe=v,ke=h,se=m,we=_,_e=N,ne=W,O=F,T=ye,H=L,U=be,D=ge,G=xe,Ne=Ce,Le=Be,Fe=Oe,He=Se,x,Ye=0;Ye<20;Ye+=2)x=fe+Ne|0,_e^=x<<7|x>>>25,x=_e+fe|0,H^=x<<9|x>>>23,x=H+_e|0,Ne^=x<<13|x>>>19,x=Ne+H|0,fe^=x<<18|x>>>14,x=ne+ke|0,U^=x<<7|x>>>25,x=U+ne|0,Le^=x<<9|x>>>23,x=Le+U|0,ke^=x<<13|x>>>19,x=ke+Le|0,ne^=x<<18|x>>>14,x=D+O|0,Fe^=x<<7|x>>>25,x=Fe+D|0,se^=x<<9|x>>>23,x=se+Fe|0,O^=x<<13|x>>>19,x=O+se|0,D^=x<<18|x>>>14,x=He+G|0,we^=x<<7|x>>>25,x=we+He|0,T^=x<<9|x>>>23,x=T+we|0,G^=x<<13|x>>>19,x=G+T|0,He^=x<<18|x>>>14,x=fe+we|0,ke^=x<<7|x>>>25,x=ke+fe|0,se^=x<<9|x>>>23,x=se+ke|0,we^=x<<13|x>>>19,x=we+se|0,fe^=x<<18|x>>>14,x=ne+_e|0,O^=x<<7|x>>>25,x=O+ne|0,T^=x<<9|x>>>23,x=T+O|0,_e^=x<<13|x>>>19,x=_e+T|0,ne^=x<<18|x>>>14,x=D+U|0,G^=x<<7|x>>>25,x=G+D|0,H^=x<<9|x>>>23,x=H+G|0,U^=x<<13|x>>>19,x=U+H|0,D^=x<<18|x>>>14,x=He+Fe|0,Ne^=x<<7|x>>>25,x=Ne+He|0,Le^=x<<9|x>>>23,x=Le+Ne|0,Fe^=x<<13|x>>>19,x=Fe+Le|0,He^=x<<18|x>>>14;fe=fe+v|0,ke=ke+h|0,se=se+m|0,we=we+_|0,_e=_e+N|0,ne=ne+W|0,O=O+F|0,T=T+ye|0,H=H+L|0,U=U+be|0,D=D+ge|0,G=G+xe|0,Ne=Ne+Ce|0,Le=Le+Be|0,Fe=Fe+Oe|0,He=He+Se|0,l[0]=fe>>>0&255,l[1]=fe>>>8&255,l[2]=fe>>>16&255,l[3]=fe>>>24&255,l[4]=ke>>>0&255,l[5]=ke>>>8&255,l[6]=ke>>>16&255,l[7]=ke>>>24&255,l[8]=se>>>0&255,l[9]=se>>>8&255,l[10]=se>>>16&255,l[11]=se>>>24&255,l[12]=we>>>0&255,l[13]=we>>>8&255,l[14]=we>>>16&255,l[15]=we>>>24&255,l[16]=_e>>>0&255,l[17]=_e>>>8&255,l[18]=_e>>>16&255,l[19]=_e>>>24&255,l[20]=ne>>>0&255,l[21]=ne>>>8&255,l[22]=ne>>>16&255,l[23]=ne>>>24&255,l[24]=O>>>0&255,l[25]=O>>>8&255,l[26]=O>>>16&255,l[27]=O>>>24&255,l[28]=T>>>0&255,l[29]=T>>>8&255,l[30]=T>>>16&255,l[31]=T>>>24&255,l[32]=H>>>0&255,l[33]=H>>>8&255,l[34]=H>>>16&255,l[35]=H>>>24&255,l[36]=U>>>0&255,l[37]=U>>>8&255,l[38]=U>>>16&255,l[39]=U>>>24&255,l[40]=D>>>0&255,l[41]=D>>>8&255,l[42]=D>>>16&255,l[43]=D>>>24&255,l[44]=G>>>0&255,l[45]=G>>>8&255,l[46]=G>>>16&255,l[47]=G>>>24&255,l[48]=Ne>>>0&255,l[49]=Ne>>>8&255,l[50]=Ne>>>16&255,l[51]=Ne>>>24&255,l[52]=Le>>>0&255,l[53]=Le>>>8&255,l[54]=Le>>>16&255,l[55]=Le>>>24&255,l[56]=Fe>>>0&255,l[57]=Fe>>>8&255,l[58]=Fe>>>16&255,l[59]=Fe>>>24&255,l[60]=He>>>0&255,l[61]=He>>>8&255,l[62]=He>>>16&255,l[63]=He>>>24&255}function P(l,y,p,a){for(var v=a[0]&255|(a[1]&255)<<8|(a[2]&255)<<16|(a[3]&255)<<24,h=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,m=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,_=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,N=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,W=a[4]&255|(a[5]&255)<<8|(a[6]&255)<<16|(a[7]&255)<<24,F=y[0]&255|(y[1]&255)<<8|(y[2]&255)<<16|(y[3]&255)<<24,ye=y[4]&255|(y[5]&255)<<8|(y[6]&255)<<16|(y[7]&255)<<24,L=y[8]&255|(y[9]&255)<<8|(y[10]&255)<<16|(y[11]&255)<<24,be=y[12]&255|(y[13]&255)<<8|(y[14]&255)<<16|(y[15]&255)<<24,ge=a[8]&255|(a[9]&255)<<8|(a[10]&255)<<16|(a[11]&255)<<24,xe=p[16]&255|(p[17]&255)<<8|(p[18]&255)<<16|(p[19]&255)<<24,Ce=p[20]&255|(p[21]&255)<<8|(p[22]&255)<<16|(p[23]&255)<<24,Be=p[24]&255|(p[25]&255)<<8|(p[26]&255)<<16|(p[27]&255)<<24,Oe=p[28]&255|(p[29]&255)<<8|(p[30]&255)<<16|(p[31]&255)<<24,Se=a[12]&255|(a[13]&255)<<8|(a[14]&255)<<16|(a[15]&255)<<24,fe=v,ke=h,se=m,we=_,_e=N,ne=W,O=F,T=ye,H=L,U=be,D=ge,G=xe,Ne=Ce,Le=Be,Fe=Oe,He=Se,x,Ye=0;Ye<20;Ye+=2)x=fe+Ne|0,_e^=x<<7|x>>>25,x=_e+fe|0,H^=x<<9|x>>>23,x=H+_e|0,Ne^=x<<13|x>>>19,x=Ne+H|0,fe^=x<<18|x>>>14,x=ne+ke|0,U^=x<<7|x>>>25,x=U+ne|0,Le^=x<<9|x>>>23,x=Le+U|0,ke^=x<<13|x>>>19,x=ke+Le|0,ne^=x<<18|x>>>14,x=D+O|0,Fe^=x<<7|x>>>25,x=Fe+D|0,se^=x<<9|x>>>23,x=se+Fe|0,O^=x<<13|x>>>19,x=O+se|0,D^=x<<18|x>>>14,x=He+G|0,we^=x<<7|x>>>25,x=we+He|0,T^=x<<9|x>>>23,x=T+we|0,G^=x<<13|x>>>19,x=G+T|0,He^=x<<18|x>>>14,x=fe+we|0,ke^=x<<7|x>>>25,x=ke+fe|0,se^=x<<9|x>>>23,x=se+ke|0,we^=x<<13|x>>>19,x=we+se|0,fe^=x<<18|x>>>14,x=ne+_e|0,O^=x<<7|x>>>25,x=O+ne|0,T^=x<<9|x>>>23,x=T+O|0,_e^=x<<13|x>>>19,x=_e+T|0,ne^=x<<18|x>>>14,x=D+U|0,G^=x<<7|x>>>25,x=G+D|0,H^=x<<9|x>>>23,x=H+G|0,U^=x<<13|x>>>19,x=U+H|0,D^=x<<18|x>>>14,x=He+Fe|0,Ne^=x<<7|x>>>25,x=Ne+He|0,Le^=x<<9|x>>>23,x=Le+Ne|0,Fe^=x<<13|x>>>19,x=Fe+Le|0,He^=x<<18|x>>>14;l[0]=fe>>>0&255,l[1]=fe>>>8&255,l[2]=fe>>>16&255,l[3]=fe>>>24&255,l[4]=ne>>>0&255,l[5]=ne>>>8&255,l[6]=ne>>>16&255,l[7]=ne>>>24&255,l[8]=D>>>0&255,l[9]=D>>>8&255,l[10]=D>>>16&255,l[11]=D>>>24&255,l[12]=He>>>0&255,l[13]=He>>>8&255,l[14]=He>>>16&255,l[15]=He>>>24&255,l[16]=O>>>0&255,l[17]=O>>>8&255,l[18]=O>>>16&255,l[19]=O>>>24&255,l[20]=T>>>0&255,l[21]=T>>>8&255,l[22]=T>>>16&255,l[23]=T>>>24&255,l[24]=H>>>0&255,l[25]=H>>>8&255,l[26]=H>>>16&255,l[27]=H>>>24&255,l[28]=U>>>0&255,l[29]=U>>>8&255,l[30]=U>>>16&255,l[31]=U>>>24&255}function K(l,y,p,a){R(l,y,p,a)}function de(l,y,p,a){P(l,y,p,a)}var le=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function pe(l,y,p,a,v,h,m){var _=new Uint8Array(16),N=new Uint8Array(64),W,F;for(F=0;F<16;F++)_[F]=0;for(F=0;F<8;F++)_[F]=h[F];for(;v>=64;){for(K(N,_,m,le),F=0;F<64;F++)l[y+F]=p[a+F]^N[F];for(W=1,F=8;F<16;F++)W=W+(_[F]&255)|0,_[F]=W&255,W>>>=8;v-=64,y+=64,a+=64}if(v>0)for(K(N,_,m,le),F=0;F<v;F++)l[y+F]=p[a+F]^N[F];return 0}function Re(l,y,p,a,v){var h=new Uint8Array(16),m=new Uint8Array(64),_,N;for(N=0;N<16;N++)h[N]=0;for(N=0;N<8;N++)h[N]=a[N];for(;p>=64;){for(K(m,h,v,le),N=0;N<64;N++)l[y+N]=m[N];for(_=1,N=8;N<16;N++)_=_+(h[N]&255)|0,h[N]=_&255,_>>>=8;p-=64,y+=64}if(p>0)for(K(m,h,v,le),N=0;N<p;N++)l[y+N]=m[N];return 0}function st(l,y,p,a,v){var h=new Uint8Array(32);de(h,a,v,le);for(var m=new Uint8Array(8),_=0;_<8;_++)m[_]=a[_+16];return Re(l,y,p,m,h)}function dt(l,y,p,a,v,h,m){var _=new Uint8Array(32);de(_,h,m,le);for(var N=new Uint8Array(8),W=0;W<8;W++)N[W]=h[W+16];return pe(l,y,p,a,v,N,_)}var St=function(l){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var y,p,a,v,h,m,_,N;y=l[0]&255|(l[1]&255)<<8,this.r[0]=y&8191,p=l[2]&255|(l[3]&255)<<8,this.r[1]=(y>>>13|p<<3)&8191,a=l[4]&255|(l[5]&255)<<8,this.r[2]=(p>>>10|a<<6)&7939,v=l[6]&255|(l[7]&255)<<8,this.r[3]=(a>>>7|v<<9)&8191,h=l[8]&255|(l[9]&255)<<8,this.r[4]=(v>>>4|h<<12)&255,this.r[5]=h>>>1&8190,m=l[10]&255|(l[11]&255)<<8,this.r[6]=(h>>>14|m<<2)&8191,_=l[12]&255|(l[13]&255)<<8,this.r[7]=(m>>>11|_<<5)&8065,N=l[14]&255|(l[15]&255)<<8,this.r[8]=(_>>>8|N<<8)&8191,this.r[9]=N>>>5&127,this.pad[0]=l[16]&255|(l[17]&255)<<8,this.pad[1]=l[18]&255|(l[19]&255)<<8,this.pad[2]=l[20]&255|(l[21]&255)<<8,this.pad[3]=l[22]&255|(l[23]&255)<<8,this.pad[4]=l[24]&255|(l[25]&255)<<8,this.pad[5]=l[26]&255|(l[27]&255)<<8,this.pad[6]=l[28]&255|(l[29]&255)<<8,this.pad[7]=l[30]&255|(l[31]&255)<<8};St.prototype.blocks=function(l,y,p){for(var a=this.fin?0:2048,v,h,m,_,N,W,F,ye,L,be,ge,xe,Ce,Be,Oe,Se,fe,ke,se,we=this.h[0],_e=this.h[1],ne=this.h[2],O=this.h[3],T=this.h[4],H=this.h[5],U=this.h[6],D=this.h[7],G=this.h[8],Ne=this.h[9],Le=this.r[0],Fe=this.r[1],He=this.r[2],x=this.r[3],Ye=this.r[4],ut=this.r[5],ft=this.r[6],Ke=this.r[7],at=this.r[8],ct=this.r[9];p>=16;)v=l[y+0]&255|(l[y+1]&255)<<8,we+=v&8191,h=l[y+2]&255|(l[y+3]&255)<<8,_e+=(v>>>13|h<<3)&8191,m=l[y+4]&255|(l[y+5]&255)<<8,ne+=(h>>>10|m<<6)&8191,_=l[y+6]&255|(l[y+7]&255)<<8,O+=(m>>>7|_<<9)&8191,N=l[y+8]&255|(l[y+9]&255)<<8,T+=(_>>>4|N<<12)&8191,H+=N>>>1&8191,W=l[y+10]&255|(l[y+11]&255)<<8,U+=(N>>>14|W<<2)&8191,F=l[y+12]&255|(l[y+13]&255)<<8,D+=(W>>>11|F<<5)&8191,ye=l[y+14]&255|(l[y+15]&255)<<8,G+=(F>>>8|ye<<8)&8191,Ne+=ye>>>5|a,L=0,be=L,be+=we*Le,be+=_e*(5*ct),be+=ne*(5*at),be+=O*(5*Ke),be+=T*(5*ft),L=be>>>13,be&=8191,be+=H*(5*ut),be+=U*(5*Ye),be+=D*(5*x),be+=G*(5*He),be+=Ne*(5*Fe),L+=be>>>13,be&=8191,ge=L,ge+=we*Fe,ge+=_e*Le,ge+=ne*(5*ct),ge+=O*(5*at),ge+=T*(5*Ke),L=ge>>>13,ge&=8191,ge+=H*(5*ft),ge+=U*(5*ut),ge+=D*(5*Ye),ge+=G*(5*x),ge+=Ne*(5*He),L+=ge>>>13,ge&=8191,xe=L,xe+=we*He,xe+=_e*Fe,xe+=ne*Le,xe+=O*(5*ct),xe+=T*(5*at),L=xe>>>13,xe&=8191,xe+=H*(5*Ke),xe+=U*(5*ft),xe+=D*(5*ut),xe+=G*(5*Ye),xe+=Ne*(5*x),L+=xe>>>13,xe&=8191,Ce=L,Ce+=we*x,Ce+=_e*He,Ce+=ne*Fe,Ce+=O*Le,Ce+=T*(5*ct),L=Ce>>>13,Ce&=8191,Ce+=H*(5*at),Ce+=U*(5*Ke),Ce+=D*(5*ft),Ce+=G*(5*ut),Ce+=Ne*(5*Ye),L+=Ce>>>13,Ce&=8191,Be=L,Be+=we*Ye,Be+=_e*x,Be+=ne*He,Be+=O*Fe,Be+=T*Le,L=Be>>>13,Be&=8191,Be+=H*(5*ct),Be+=U*(5*at),Be+=D*(5*Ke),Be+=G*(5*ft),Be+=Ne*(5*ut),L+=Be>>>13,Be&=8191,Oe=L,Oe+=we*ut,Oe+=_e*Ye,Oe+=ne*x,Oe+=O*He,Oe+=T*Fe,L=Oe>>>13,Oe&=8191,Oe+=H*Le,Oe+=U*(5*ct),Oe+=D*(5*at),Oe+=G*(5*Ke),Oe+=Ne*(5*ft),L+=Oe>>>13,Oe&=8191,Se=L,Se+=we*ft,Se+=_e*ut,Se+=ne*Ye,Se+=O*x,Se+=T*He,L=Se>>>13,Se&=8191,Se+=H*Fe,Se+=U*Le,Se+=D*(5*ct),Se+=G*(5*at),Se+=Ne*(5*Ke),L+=Se>>>13,Se&=8191,fe=L,fe+=we*Ke,fe+=_e*ft,fe+=ne*ut,fe+=O*Ye,fe+=T*x,L=fe>>>13,fe&=8191,fe+=H*He,fe+=U*Fe,fe+=D*Le,fe+=G*(5*ct),fe+=Ne*(5*at),L+=fe>>>13,fe&=8191,ke=L,ke+=we*at,ke+=_e*Ke,ke+=ne*ft,ke+=O*ut,ke+=T*Ye,L=ke>>>13,ke&=8191,ke+=H*x,ke+=U*He,ke+=D*Fe,ke+=G*Le,ke+=Ne*(5*ct),L+=ke>>>13,ke&=8191,se=L,se+=we*ct,se+=_e*at,se+=ne*Ke,se+=O*ft,se+=T*ut,L=se>>>13,se&=8191,se+=H*Ye,se+=U*x,se+=D*He,se+=G*Fe,se+=Ne*Le,L+=se>>>13,se&=8191,L=(L<<2)+L|0,L=L+be|0,be=L&8191,L=L>>>13,ge+=L,we=be,_e=ge,ne=xe,O=Ce,T=Be,H=Oe,U=Se,D=fe,G=ke,Ne=se,y+=16,p-=16;this.h[0]=we,this.h[1]=_e,this.h[2]=ne,this.h[3]=O,this.h[4]=T,this.h[5]=H,this.h[6]=U,this.h[7]=D,this.h[8]=G,this.h[9]=Ne},St.prototype.finish=function(l,y){var p=new Uint16Array(10),a,v,h,m;if(this.leftover){for(m=this.leftover,this.buffer[m++]=1;m<16;m++)this.buffer[m]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(a=this.h[1]>>>13,this.h[1]&=8191,m=2;m<10;m++)this.h[m]+=a,a=this.h[m]>>>13,this.h[m]&=8191;for(this.h[0]+=a*5,a=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=a,a=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=a,p[0]=this.h[0]+5,a=p[0]>>>13,p[0]&=8191,m=1;m<10;m++)p[m]=this.h[m]+a,a=p[m]>>>13,p[m]&=8191;for(p[9]-=8192,v=(a^1)-1,m=0;m<10;m++)p[m]&=v;for(v=~v,m=0;m<10;m++)this.h[m]=this.h[m]&v|p[m];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,h=this.h[0]+this.pad[0],this.h[0]=h&65535,m=1;m<8;m++)h=(this.h[m]+this.pad[m]|0)+(h>>>16)|0,this.h[m]=h&65535;l[y+0]=this.h[0]>>>0&255,l[y+1]=this.h[0]>>>8&255,l[y+2]=this.h[1]>>>0&255,l[y+3]=this.h[1]>>>8&255,l[y+4]=this.h[2]>>>0&255,l[y+5]=this.h[2]>>>8&255,l[y+6]=this.h[3]>>>0&255,l[y+7]=this.h[3]>>>8&255,l[y+8]=this.h[4]>>>0&255,l[y+9]=this.h[4]>>>8&255,l[y+10]=this.h[5]>>>0&255,l[y+11]=this.h[5]>>>8&255,l[y+12]=this.h[6]>>>0&255,l[y+13]=this.h[6]>>>8&255,l[y+14]=this.h[7]>>>0&255,l[y+15]=this.h[7]>>>8&255},St.prototype.update=function(l,y,p){var a,v;if(this.leftover){for(v=16-this.leftover,v>p&&(v=p),a=0;a<v;a++)this.buffer[this.leftover+a]=l[y+a];if(p-=v,y+=v,this.leftover+=v,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(p>=16&&(v=p-p%16,this.blocks(l,y,v),y+=v,p-=v),p){for(a=0;a<p;a++)this.buffer[this.leftover+a]=l[y+a];this.leftover+=p}};function Et(l,y,p,a,v,h){var m=new St(h);return m.update(p,a,v),m.finish(l,y),0}function lt(l,y,p,a,v,h){var m=new Uint8Array(16);return Et(m,0,p,a,v,h),B(l,y,m,0)}function yt(l,y,p,a,v){var h;if(p<32)return-1;for(dt(l,0,y,0,p,a,v),Et(l,16,l,32,p-32,l),h=0;h<16;h++)l[h]=0;return 0}function Xe(l,y,p,a,v){var h,m=new Uint8Array(32);if(p<32||(st(m,0,32,a,v),lt(y,16,y,32,p-32,m)!==0))return-1;for(dt(l,0,y,0,p,a,v),h=0;h<32;h++)l[h]=0;return 0}function ze(l,y){var p;for(p=0;p<16;p++)l[p]=y[p]|0}function oe(l){var y,p,a=1;for(y=0;y<16;y++)p=l[y]+a+65535,a=Math.floor(p/65536),l[y]=p-a*65536;l[0]+=a-1+37*(a-1)}function Te(l,y,p){for(var a,v=~(p-1),h=0;h<16;h++)a=v&(l[h]^y[h]),l[h]^=a,y[h]^=a}function pt(l,y){var p,a,v,h=t(),m=t();for(p=0;p<16;p++)m[p]=y[p];for(oe(m),oe(m),oe(m),a=0;a<2;a++){for(h[0]=m[0]-65517,p=1;p<15;p++)h[p]=m[p]-65535-(h[p-1]>>16&1),h[p-1]&=65535;h[15]=m[15]-32767-(h[14]>>16&1),v=h[15]>>16&1,h[14]&=65535,Te(m,h,1-v)}for(p=0;p<16;p++)l[2*p]=m[p]&255,l[2*p+1]=m[p]>>8}function It(l,y){var p=new Uint8Array(32),a=new Uint8Array(32);return pt(p,l),pt(a,y),I(p,0,a,0)}function Ct(l){var y=new Uint8Array(32);return pt(y,l),y[0]&1}function ue(l,y){var p;for(p=0;p<16;p++)l[p]=y[2*p]+(y[2*p+1]<<8);l[15]&=32767}function et(l,y,p){for(var a=0;a<16;a++)l[a]=y[a]+p[a]}function gt(l,y,p){for(var a=0;a<16;a++)l[a]=y[a]-p[a]}function ee(l,y,p){var a,v,h=0,m=0,_=0,N=0,W=0,F=0,ye=0,L=0,be=0,ge=0,xe=0,Ce=0,Be=0,Oe=0,Se=0,fe=0,ke=0,se=0,we=0,_e=0,ne=0,O=0,T=0,H=0,U=0,D=0,G=0,Ne=0,Le=0,Fe=0,He=0,x=p[0],Ye=p[1],ut=p[2],ft=p[3],Ke=p[4],at=p[5],ct=p[6],Lt=p[7],wt=p[8],Ut=p[9],Dt=p[10],$t=p[11],zt=p[12],nr=p[13],ir=p[14],sr=p[15];a=y[0],h+=a*x,m+=a*Ye,_+=a*ut,N+=a*ft,W+=a*Ke,F+=a*at,ye+=a*ct,L+=a*Lt,be+=a*wt,ge+=a*Ut,xe+=a*Dt,Ce+=a*$t,Be+=a*zt,Oe+=a*nr,Se+=a*ir,fe+=a*sr,a=y[1],m+=a*x,_+=a*Ye,N+=a*ut,W+=a*ft,F+=a*Ke,ye+=a*at,L+=a*ct,be+=a*Lt,ge+=a*wt,xe+=a*Ut,Ce+=a*Dt,Be+=a*$t,Oe+=a*zt,Se+=a*nr,fe+=a*ir,ke+=a*sr,a=y[2],_+=a*x,N+=a*Ye,W+=a*ut,F+=a*ft,ye+=a*Ke,L+=a*at,be+=a*ct,ge+=a*Lt,xe+=a*wt,Ce+=a*Ut,Be+=a*Dt,Oe+=a*$t,Se+=a*zt,fe+=a*nr,ke+=a*ir,se+=a*sr,a=y[3],N+=a*x,W+=a*Ye,F+=a*ut,ye+=a*ft,L+=a*Ke,be+=a*at,ge+=a*ct,xe+=a*Lt,Ce+=a*wt,Be+=a*Ut,Oe+=a*Dt,Se+=a*$t,fe+=a*zt,ke+=a*nr,se+=a*ir,we+=a*sr,a=y[4],W+=a*x,F+=a*Ye,ye+=a*ut,L+=a*ft,be+=a*Ke,ge+=a*at,xe+=a*ct,Ce+=a*Lt,Be+=a*wt,Oe+=a*Ut,Se+=a*Dt,fe+=a*$t,ke+=a*zt,se+=a*nr,we+=a*ir,_e+=a*sr,a=y[5],F+=a*x,ye+=a*Ye,L+=a*ut,be+=a*ft,ge+=a*Ke,xe+=a*at,Ce+=a*ct,Be+=a*Lt,Oe+=a*wt,Se+=a*Ut,fe+=a*Dt,ke+=a*$t,se+=a*zt,we+=a*nr,_e+=a*ir,ne+=a*sr,a=y[6],ye+=a*x,L+=a*Ye,be+=a*ut,ge+=a*ft,xe+=a*Ke,Ce+=a*at,Be+=a*ct,Oe+=a*Lt,Se+=a*wt,fe+=a*Ut,ke+=a*Dt,se+=a*$t,we+=a*zt,_e+=a*nr,ne+=a*ir,O+=a*sr,a=y[7],L+=a*x,be+=a*Ye,ge+=a*ut,xe+=a*ft,Ce+=a*Ke,Be+=a*at,Oe+=a*ct,Se+=a*Lt,fe+=a*wt,ke+=a*Ut,se+=a*Dt,we+=a*$t,_e+=a*zt,ne+=a*nr,O+=a*ir,T+=a*sr,a=y[8],be+=a*x,ge+=a*Ye,xe+=a*ut,Ce+=a*ft,Be+=a*Ke,Oe+=a*at,Se+=a*ct,fe+=a*Lt,ke+=a*wt,se+=a*Ut,we+=a*Dt,_e+=a*$t,ne+=a*zt,O+=a*nr,T+=a*ir,H+=a*sr,a=y[9],ge+=a*x,xe+=a*Ye,Ce+=a*ut,Be+=a*ft,Oe+=a*Ke,Se+=a*at,fe+=a*ct,ke+=a*Lt,se+=a*wt,we+=a*Ut,_e+=a*Dt,ne+=a*$t,O+=a*zt,T+=a*nr,H+=a*ir,U+=a*sr,a=y[10],xe+=a*x,Ce+=a*Ye,Be+=a*ut,Oe+=a*ft,Se+=a*Ke,fe+=a*at,ke+=a*ct,se+=a*Lt,we+=a*wt,_e+=a*Ut,ne+=a*Dt,O+=a*$t,T+=a*zt,H+=a*nr,U+=a*ir,D+=a*sr,a=y[11],Ce+=a*x,Be+=a*Ye,Oe+=a*ut,Se+=a*ft,fe+=a*Ke,ke+=a*at,se+=a*ct,we+=a*Lt,_e+=a*wt,ne+=a*Ut,O+=a*Dt,T+=a*$t,H+=a*zt,U+=a*nr,D+=a*ir,G+=a*sr,a=y[12],Be+=a*x,Oe+=a*Ye,Se+=a*ut,fe+=a*ft,ke+=a*Ke,se+=a*at,we+=a*ct,_e+=a*Lt,ne+=a*wt,O+=a*Ut,T+=a*Dt,H+=a*$t,U+=a*zt,D+=a*nr,G+=a*ir,Ne+=a*sr,a=y[13],Oe+=a*x,Se+=a*Ye,fe+=a*ut,ke+=a*ft,se+=a*Ke,we+=a*at,_e+=a*ct,ne+=a*Lt,O+=a*wt,T+=a*Ut,H+=a*Dt,U+=a*$t,D+=a*zt,G+=a*nr,Ne+=a*ir,Le+=a*sr,a=y[14],Se+=a*x,fe+=a*Ye,ke+=a*ut,se+=a*ft,we+=a*Ke,_e+=a*at,ne+=a*ct,O+=a*Lt,T+=a*wt,H+=a*Ut,U+=a*Dt,D+=a*$t,G+=a*zt,Ne+=a*nr,Le+=a*ir,Fe+=a*sr,a=y[15],fe+=a*x,ke+=a*Ye,se+=a*ut,we+=a*ft,_e+=a*Ke,ne+=a*at,O+=a*ct,T+=a*Lt,H+=a*wt,U+=a*Ut,D+=a*Dt,G+=a*$t,Ne+=a*zt,Le+=a*nr,Fe+=a*ir,He+=a*sr,h+=38*ke,m+=38*se,_+=38*we,N+=38*_e,W+=38*ne,F+=38*O,ye+=38*T,L+=38*H,be+=38*U,ge+=38*D,xe+=38*G,Ce+=38*Ne,Be+=38*Le,Oe+=38*Fe,Se+=38*He,v=1,a=h+v+65535,v=Math.floor(a/65536),h=a-v*65536,a=m+v+65535,v=Math.floor(a/65536),m=a-v*65536,a=_+v+65535,v=Math.floor(a/65536),_=a-v*65536,a=N+v+65535,v=Math.floor(a/65536),N=a-v*65536,a=W+v+65535,v=Math.floor(a/65536),W=a-v*65536,a=F+v+65535,v=Math.floor(a/65536),F=a-v*65536,a=ye+v+65535,v=Math.floor(a/65536),ye=a-v*65536,a=L+v+65535,v=Math.floor(a/65536),L=a-v*65536,a=be+v+65535,v=Math.floor(a/65536),be=a-v*65536,a=ge+v+65535,v=Math.floor(a/65536),ge=a-v*65536,a=xe+v+65535,v=Math.floor(a/65536),xe=a-v*65536,a=Ce+v+65535,v=Math.floor(a/65536),Ce=a-v*65536,a=Be+v+65535,v=Math.floor(a/65536),Be=a-v*65536,a=Oe+v+65535,v=Math.floor(a/65536),Oe=a-v*65536,a=Se+v+65535,v=Math.floor(a/65536),Se=a-v*65536,a=fe+v+65535,v=Math.floor(a/65536),fe=a-v*65536,h+=v-1+37*(v-1),v=1,a=h+v+65535,v=Math.floor(a/65536),h=a-v*65536,a=m+v+65535,v=Math.floor(a/65536),m=a-v*65536,a=_+v+65535,v=Math.floor(a/65536),_=a-v*65536,a=N+v+65535,v=Math.floor(a/65536),N=a-v*65536,a=W+v+65535,v=Math.floor(a/65536),W=a-v*65536,a=F+v+65535,v=Math.floor(a/65536),F=a-v*65536,a=ye+v+65535,v=Math.floor(a/65536),ye=a-v*65536,a=L+v+65535,v=Math.floor(a/65536),L=a-v*65536,a=be+v+65535,v=Math.floor(a/65536),be=a-v*65536,a=ge+v+65535,v=Math.floor(a/65536),ge=a-v*65536,a=xe+v+65535,v=Math.floor(a/65536),xe=a-v*65536,a=Ce+v+65535,v=Math.floor(a/65536),Ce=a-v*65536,a=Be+v+65535,v=Math.floor(a/65536),Be=a-v*65536,a=Oe+v+65535,v=Math.floor(a/65536),Oe=a-v*65536,a=Se+v+65535,v=Math.floor(a/65536),Se=a-v*65536,a=fe+v+65535,v=Math.floor(a/65536),fe=a-v*65536,h+=v-1+37*(v-1),l[0]=h,l[1]=m,l[2]=_,l[3]=N,l[4]=W,l[5]=F,l[6]=ye,l[7]=L,l[8]=be,l[9]=ge,l[10]=xe,l[11]=Ce,l[12]=Be,l[13]=Oe,l[14]=Se,l[15]=fe}function ot(l,y){ee(l,y,y)}function Bt(l,y){var p=t(),a;for(a=0;a<16;a++)p[a]=y[a];for(a=253;a>=0;a--)ot(p,p),a!==2&&a!==4&&ee(p,p,y);for(a=0;a<16;a++)l[a]=p[a]}function gn(l,y){var p=t(),a;for(a=0;a<16;a++)p[a]=y[a];for(a=250;a>=0;a--)ot(p,p),a!==1&&ee(p,p,y);for(a=0;a<16;a++)l[a]=p[a]}function vn(l,y,p){var a=new Uint8Array(32),v=new Float64Array(80),h,m,_=t(),N=t(),W=t(),F=t(),ye=t(),L=t();for(m=0;m<31;m++)a[m]=y[m];for(a[31]=y[31]&127|64,a[0]&=248,ue(v,p),m=0;m<16;m++)N[m]=v[m],F[m]=_[m]=W[m]=0;for(_[0]=F[0]=1,m=254;m>=0;--m)h=a[m>>>3]>>>(m&7)&1,Te(_,N,h),Te(W,F,h),et(ye,_,W),gt(_,_,W),et(W,N,F),gt(N,N,F),ot(F,ye),ot(L,_),ee(_,W,_),ee(W,N,ye),et(ye,_,W),gt(_,_,W),ot(N,_),gt(W,F,L),ee(_,W,u),et(_,_,F),ee(W,W,_),ee(_,F,L),ee(F,N,v),ot(N,ye),Te(_,N,h),Te(W,F,h);for(m=0;m<16;m++)v[m+16]=_[m],v[m+32]=W[m],v[m+48]=N[m],v[m+64]=F[m];var be=v.subarray(32),ge=v.subarray(16);return Bt(be,be),ee(ge,ge,be),pt(l,ge),0}function Ht(l,y){return vn(l,y,s)}function Vi(l,y){return n(y,32),Ht(l,y)}function Mr(l,y,p){var a=new Uint8Array(32);return vn(a,p,y),de(l,i,a,le)}var Li=yt,To=Xe;function mn(l,y,p,a,v,h){var m=new Uint8Array(32);return Mr(m,v,h),Li(l,y,p,a,m)}function wn(l,y,p,a,v,h){var m=new Uint8Array(32);return Mr(m,v,h),To(l,y,p,a,m)}var ai=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function ci(l,y,p,a){for(var v=new Int32Array(16),h=new Int32Array(16),m,_,N,W,F,ye,L,be,ge,xe,Ce,Be,Oe,Se,fe,ke,se,we,_e,ne,O,T,H,U,D,G,Ne=l[0],Le=l[1],Fe=l[2],He=l[3],x=l[4],Ye=l[5],ut=l[6],ft=l[7],Ke=y[0],at=y[1],ct=y[2],Lt=y[3],wt=y[4],Ut=y[5],Dt=y[6],$t=y[7],zt=0;a>=128;){for(_e=0;_e<16;_e++)ne=8*_e+zt,v[_e]=p[ne+0]<<24|p[ne+1]<<16|p[ne+2]<<8|p[ne+3],h[_e]=p[ne+4]<<24|p[ne+5]<<16|p[ne+6]<<8|p[ne+7];for(_e=0;_e<80;_e++)if(m=Ne,_=Le,N=Fe,W=He,F=x,ye=Ye,L=ut,be=ft,ge=Ke,xe=at,Ce=ct,Be=Lt,Oe=wt,Se=Ut,fe=Dt,ke=$t,O=ft,T=$t,H=T&65535,U=T>>>16,D=O&65535,G=O>>>16,O=(x>>>14|wt<<18)^(x>>>18|wt<<14)^(wt>>>9|x<<23),T=(wt>>>14|x<<18)^(wt>>>18|x<<14)^(x>>>9|wt<<23),H+=T&65535,U+=T>>>16,D+=O&65535,G+=O>>>16,O=x&Ye^~x&ut,T=wt&Ut^~wt&Dt,H+=T&65535,U+=T>>>16,D+=O&65535,G+=O>>>16,O=ai[_e*2],T=ai[_e*2+1],H+=T&65535,U+=T>>>16,D+=O&65535,G+=O>>>16,O=v[_e%16],T=h[_e%16],H+=T&65535,U+=T>>>16,D+=O&65535,G+=O>>>16,U+=H>>>16,D+=U>>>16,G+=D>>>16,se=D&65535|G<<16,we=H&65535|U<<16,O=se,T=we,H=T&65535,U=T>>>16,D=O&65535,G=O>>>16,O=(Ne>>>28|Ke<<4)^(Ke>>>2|Ne<<30)^(Ke>>>7|Ne<<25),T=(Ke>>>28|Ne<<4)^(Ne>>>2|Ke<<30)^(Ne>>>7|Ke<<25),H+=T&65535,U+=T>>>16,D+=O&65535,G+=O>>>16,O=Ne&Le^Ne&Fe^Le&Fe,T=Ke&at^Ke&ct^at&ct,H+=T&65535,U+=T>>>16,D+=O&65535,G+=O>>>16,U+=H>>>16,D+=U>>>16,G+=D>>>16,be=D&65535|G<<16,ke=H&65535|U<<16,O=W,T=Be,H=T&65535,U=T>>>16,D=O&65535,G=O>>>16,O=se,T=we,H+=T&65535,U+=T>>>16,D+=O&65535,G+=O>>>16,U+=H>>>16,D+=U>>>16,G+=D>>>16,W=D&65535|G<<16,Be=H&65535|U<<16,Le=m,Fe=_,He=N,x=W,Ye=F,ut=ye,ft=L,Ne=be,at=ge,ct=xe,Lt=Ce,wt=Be,Ut=Oe,Dt=Se,$t=fe,Ke=ke,_e%16===15)for(ne=0;ne<16;ne++)O=v[ne],T=h[ne],H=T&65535,U=T>>>16,D=O&65535,G=O>>>16,O=v[(ne+9)%16],T=h[(ne+9)%16],H+=T&65535,U+=T>>>16,D+=O&65535,G+=O>>>16,se=v[(ne+1)%16],we=h[(ne+1)%16],O=(se>>>1|we<<31)^(se>>>8|we<<24)^se>>>7,T=(we>>>1|se<<31)^(we>>>8|se<<24)^(we>>>7|se<<25),H+=T&65535,U+=T>>>16,D+=O&65535,G+=O>>>16,se=v[(ne+14)%16],we=h[(ne+14)%16],O=(se>>>19|we<<13)^(we>>>29|se<<3)^se>>>6,T=(we>>>19|se<<13)^(se>>>29|we<<3)^(we>>>6|se<<26),H+=T&65535,U+=T>>>16,D+=O&65535,G+=O>>>16,U+=H>>>16,D+=U>>>16,G+=D>>>16,v[ne]=D&65535|G<<16,h[ne]=H&65535|U<<16;O=Ne,T=Ke,H=T&65535,U=T>>>16,D=O&65535,G=O>>>16,O=l[0],T=y[0],H+=T&65535,U+=T>>>16,D+=O&65535,G+=O>>>16,U+=H>>>16,D+=U>>>16,G+=D>>>16,l[0]=Ne=D&65535|G<<16,y[0]=Ke=H&65535|U<<16,O=Le,T=at,H=T&65535,U=T>>>16,D=O&65535,G=O>>>16,O=l[1],T=y[1],H+=T&65535,U+=T>>>16,D+=O&65535,G+=O>>>16,U+=H>>>16,D+=U>>>16,G+=D>>>16,l[1]=Le=D&65535|G<<16,y[1]=at=H&65535|U<<16,O=Fe,T=ct,H=T&65535,U=T>>>16,D=O&65535,G=O>>>16,O=l[2],T=y[2],H+=T&65535,U+=T>>>16,D+=O&65535,G+=O>>>16,U+=H>>>16,D+=U>>>16,G+=D>>>16,l[2]=Fe=D&65535|G<<16,y[2]=ct=H&65535|U<<16,O=He,T=Lt,H=T&65535,U=T>>>16,D=O&65535,G=O>>>16,O=l[3],T=y[3],H+=T&65535,U+=T>>>16,D+=O&65535,G+=O>>>16,U+=H>>>16,D+=U>>>16,G+=D>>>16,l[3]=He=D&65535|G<<16,y[3]=Lt=H&65535|U<<16,O=x,T=wt,H=T&65535,U=T>>>16,D=O&65535,G=O>>>16,O=l[4],T=y[4],H+=T&65535,U+=T>>>16,D+=O&65535,G+=O>>>16,U+=H>>>16,D+=U>>>16,G+=D>>>16,l[4]=x=D&65535|G<<16,y[4]=wt=H&65535|U<<16,O=Ye,T=Ut,H=T&65535,U=T>>>16,D=O&65535,G=O>>>16,O=l[5],T=y[5],H+=T&65535,U+=T>>>16,D+=O&65535,G+=O>>>16,U+=H>>>16,D+=U>>>16,G+=D>>>16,l[5]=Ye=D&65535|G<<16,y[5]=Ut=H&65535|U<<16,O=ut,T=Dt,H=T&65535,U=T>>>16,D=O&65535,G=O>>>16,O=l[6],T=y[6],H+=T&65535,U+=T>>>16,D+=O&65535,G+=O>>>16,U+=H>>>16,D+=U>>>16,G+=D>>>16,l[6]=ut=D&65535|G<<16,y[6]=Dt=H&65535|U<<16,O=ft,T=$t,H=T&65535,U=T>>>16,D=O&65535,G=O>>>16,O=l[7],T=y[7],H+=T&65535,U+=T>>>16,D+=O&65535,G+=O>>>16,U+=H>>>16,D+=U>>>16,G+=D>>>16,l[7]=ft=D&65535|G<<16,y[7]=$t=H&65535|U<<16,zt+=128,a-=128}return a}function hr(l,y,p){var a=new Int32Array(8),v=new Int32Array(8),h=new Uint8Array(256),m,_=p;for(a[0]=1779033703,a[1]=3144134277,a[2]=1013904242,a[3]=2773480762,a[4]=1359893119,a[5]=2600822924,a[6]=528734635,a[7]=1541459225,v[0]=4089235720,v[1]=2227873595,v[2]=4271175723,v[3]=1595750129,v[4]=2917565137,v[5]=725511199,v[6]=4215389547,v[7]=327033209,ci(a,v,y,p),p%=128,m=0;m<p;m++)h[m]=y[_-p+m];for(h[p]=128,p=256-128*(p<112?1:0),h[p-9]=0,w(h,p-8,_/536870912|0,_<<3),ci(a,v,h,p),m=0;m<8;m++)w(l,8*m,a[m],v[m]);return 0}function Dn(l,y){var p=t(),a=t(),v=t(),h=t(),m=t(),_=t(),N=t(),W=t(),F=t();gt(p,l[1],l[0]),gt(F,y[1],y[0]),ee(p,p,F),et(a,l[0],l[1]),et(F,y[0],y[1]),ee(a,a,F),ee(v,l[3],y[3]),ee(v,v,b),ee(h,l[2],y[2]),et(h,h,h),gt(m,a,p),gt(_,h,v),et(N,h,v),et(W,a,p),ee(l[0],m,_),ee(l[1],W,N),ee(l[2],N,_),ee(l[3],m,W)}function li(l,y,p){var a;for(a=0;a<4;a++)Te(l[a],y[a],p)}function $n(l,y){var p=t(),a=t(),v=t();Bt(v,y[2]),ee(p,y[0],v),ee(a,y[1],v),pt(l,a),l[31]^=Ct(p)<<7}function Hi(l,y,p){var a,v;for(ze(l[0],o),ze(l[1],c),ze(l[2],c),ze(l[3],o),v=255;v>=0;--v)a=p[v/8|0]>>(v&7)&1,li(l,y,a),Dn(y,l),Dn(l,l),li(l,y,a)}function ui(l,y){var p=[t(),t(),t(),t()];ze(p[0],S),ze(p[1],Y),ze(p[2],c),ee(p[3],S,Y),Hi(l,p,y)}function fi(l,y,p){var a=new Uint8Array(64),v=[t(),t(),t(),t()],h;for(p||n(y,32),hr(a,y,32),a[0]&=248,a[31]&=127,a[31]|=64,ui(v,a),$n(l,v),h=0;h<32;h++)y[h+32]=l[h];return 0}var Or=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Qr(l,y){var p,a,v,h;for(a=63;a>=32;--a){for(p=0,v=a-32,h=a-12;v<h;++v)y[v]+=p-16*y[a]*Or[v-(a-32)],p=Math.floor((y[v]+128)/256),y[v]-=p*256;y[v]+=p,y[a]=0}for(p=0,v=0;v<32;v++)y[v]+=p-(y[31]>>4)*Or[v],p=y[v]>>8,y[v]&=255;for(v=0;v<32;v++)y[v]-=p*Or[v];for(a=0;a<32;a++)y[a+1]+=y[a]>>8,l[a]=y[a]&255}function Fi(l){var y=new Float64Array(64),p;for(p=0;p<64;p++)y[p]=l[p];for(p=0;p<64;p++)l[p]=0;Qr(l,y)}function Gi(l,y,p,a){var v=new Uint8Array(64),h=new Uint8Array(64),m=new Uint8Array(64),_,N,W=new Float64Array(64),F=[t(),t(),t(),t()];hr(v,a,32),v[0]&=248,v[31]&=127,v[31]|=64;var ye=p+64;for(_=0;_<p;_++)l[64+_]=y[_];for(_=0;_<32;_++)l[32+_]=v[32+_];for(hr(m,l.subarray(32),p+32),Fi(m),ui(F,m),$n(l,F),_=32;_<64;_++)l[_]=a[_];for(hr(h,l,p+64),Fi(h),_=0;_<64;_++)W[_]=0;for(_=0;_<32;_++)W[_]=m[_];for(_=0;_<32;_++)for(N=0;N<32;N++)W[_+N]+=h[_]*v[N];return Qr(l.subarray(32),W),ye}function hi(l,y){var p=t(),a=t(),v=t(),h=t(),m=t(),_=t(),N=t();return ze(l[2],c),ue(l[1],y),ot(v,l[1]),ee(h,v,d),gt(v,v,l[2]),et(h,l[2],h),ot(m,h),ot(_,m),ee(N,_,m),ee(p,N,v),ee(p,p,h),gn(p,p),ee(p,p,v),ee(p,p,h),ee(p,p,h),ee(l[0],p,h),ot(a,l[0]),ee(a,a,h),It(a,v)&&ee(l[0],l[0],$),ot(a,l[0]),ee(a,a,h),It(a,v)?-1:(Ct(l[0])===y[31]>>7&&gt(l[0],o,l[0]),ee(l[3],l[0],l[1]),0)}function k(l,y,p,a){var v,h=new Uint8Array(32),m=new Uint8Array(64),_=[t(),t(),t(),t()],N=[t(),t(),t(),t()];if(p<64||hi(N,a))return-1;for(v=0;v<p;v++)l[v]=y[v];for(v=0;v<32;v++)l[v+32]=a[v];if(hr(m,l,p),Fi(m),Hi(_,N,m),ui(N,y.subarray(32)),Dn(_,N),$n(h,_),p-=64,I(y,0,h,0)){for(v=0;v<p;v++)l[v]=0;return-1}for(v=0;v<p;v++)l[v]=y[v+64];return p}var C=32,j=24,q=32,Ee=16,xt=32,At=32,Ue=32,X=32,te=32,re=j,me=q,Ve=Ee,Qe=64,vt=32,Vt=64,di=32,pi=64;e.lowlevel={crypto_core_hsalsa20:de,crypto_stream_xor:dt,crypto_stream:st,crypto_stream_salsa20_xor:pe,crypto_stream_salsa20:Re,crypto_onetimeauth:Et,crypto_onetimeauth_verify:lt,crypto_verify_16:B,crypto_verify_32:I,crypto_secretbox:yt,crypto_secretbox_open:Xe,crypto_scalarmult:vn,crypto_scalarmult_base:Ht,crypto_box_beforenm:Mr,crypto_box_afternm:Li,crypto_box:mn,crypto_box_open:wn,crypto_box_keypair:Vi,crypto_hash:hr,crypto_sign:Gi,crypto_sign_keypair:fi,crypto_sign_open:k,crypto_secretbox_KEYBYTES:C,crypto_secretbox_NONCEBYTES:j,crypto_secretbox_ZEROBYTES:q,crypto_secretbox_BOXZEROBYTES:Ee,crypto_scalarmult_BYTES:xt,crypto_scalarmult_SCALARBYTES:At,crypto_box_PUBLICKEYBYTES:Ue,crypto_box_SECRETKEYBYTES:X,crypto_box_BEFORENMBYTES:te,crypto_box_NONCEBYTES:re,crypto_box_ZEROBYTES:me,crypto_box_BOXZEROBYTES:Ve,crypto_sign_BYTES:Qe,crypto_sign_PUBLICKEYBYTES:vt,crypto_sign_SECRETKEYBYTES:Vt,crypto_sign_SEEDBYTES:di,crypto_hash_BYTES:pi,gf:t,D:d,L:Or,pack25519:pt,unpack25519:ue,M:ee,A:et,S:ot,Z:gt,pow2523:gn,add:Dn,set25519:ze,modL:Qr,scalarmult:Hi,scalarbase:ui};function zi(l,y){if(l.length!==C)throw new Error("bad key size");if(y.length!==j)throw new Error("bad nonce size")}function _f(l,y){if(l.length!==Ue)throw new Error("bad public key size");if(y.length!==X)throw new Error("bad secret key size")}function dr(){for(var l=0;l<arguments.length;l++)if(!(arguments[l]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function No(l){for(var y=0;y<l.length;y++)l[y]=0}e.randomBytes=function(l){var y=new Uint8Array(l);return n(y,l),y},e.secretbox=function(l,y,p){dr(l,y,p),zi(p,y);for(var a=new Uint8Array(q+l.length),v=new Uint8Array(a.length),h=0;h<l.length;h++)a[h+q]=l[h];return yt(v,a,a.length,y,p),v.subarray(Ee)},e.secretbox.open=function(l,y,p){dr(l,y,p),zi(p,y);for(var a=new Uint8Array(Ee+l.length),v=new Uint8Array(a.length),h=0;h<l.length;h++)a[h+Ee]=l[h];return a.length<32||Xe(v,a,a.length,y,p)!==0?null:v.subarray(q)},e.secretbox.keyLength=C,e.secretbox.nonceLength=j,e.secretbox.overheadLength=Ee,e.scalarMult=function(l,y){if(dr(l,y),l.length!==At)throw new Error("bad n size");if(y.length!==xt)throw new Error("bad p size");var p=new Uint8Array(xt);return vn(p,l,y),p},e.scalarMult.base=function(l){if(dr(l),l.length!==At)throw new Error("bad n size");var y=new Uint8Array(xt);return Ht(y,l),y},e.scalarMult.scalarLength=At,e.scalarMult.groupElementLength=xt,e.box=function(l,y,p,a){var v=e.box.before(p,a);return e.secretbox(l,y,v)},e.box.before=function(l,y){dr(l,y),_f(l,y);var p=new Uint8Array(te);return Mr(p,l,y),p},e.box.after=e.secretbox,e.box.open=function(l,y,p,a){var v=e.box.before(p,a);return e.secretbox.open(l,y,v)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var l=new Uint8Array(Ue),y=new Uint8Array(X);return Vi(l,y),{publicKey:l,secretKey:y}},e.box.keyPair.fromSecretKey=function(l){if(dr(l),l.length!==X)throw new Error("bad secret key size");var y=new Uint8Array(Ue);return Ht(y,l),{publicKey:y,secretKey:new Uint8Array(l)}},e.box.publicKeyLength=Ue,e.box.secretKeyLength=X,e.box.sharedKeyLength=te,e.box.nonceLength=re,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(l,y){if(dr(l,y),y.length!==Vt)throw new Error("bad secret key size");var p=new Uint8Array(Qe+l.length);return Gi(p,l,l.length,y),p},e.sign.open=function(l,y){if(dr(l,y),y.length!==vt)throw new Error("bad public key size");var p=new Uint8Array(l.length),a=k(p,l,l.length,y);if(a<0)return null;for(var v=new Uint8Array(a),h=0;h<v.length;h++)v[h]=p[h];return v},e.sign.detached=function(l,y){for(var p=e.sign(l,y),a=new Uint8Array(Qe),v=0;v<a.length;v++)a[v]=p[v];return a},e.sign.detached.verify=function(l,y,p){if(dr(l,y,p),y.length!==Qe)throw new Error("bad signature size");if(p.length!==vt)throw new Error("bad public key size");var a=new Uint8Array(Qe+l.length),v=new Uint8Array(Qe+l.length),h;for(h=0;h<Qe;h++)a[h]=y[h];for(h=0;h<l.length;h++)a[h+Qe]=l[h];return k(v,a,a.length,p)>=0},e.sign.keyPair=function(){var l=new Uint8Array(vt),y=new Uint8Array(Vt);return fi(l,y),{publicKey:l,secretKey:y}},e.sign.keyPair.fromSecretKey=function(l){if(dr(l),l.length!==Vt)throw new Error("bad secret key size");for(var y=new Uint8Array(vt),p=0;p<y.length;p++)y[p]=l[32+p];return{publicKey:y,secretKey:new Uint8Array(l)}},e.sign.keyPair.fromSeed=function(l){if(dr(l),l.length!==di)throw new Error("bad seed size");for(var y=new Uint8Array(vt),p=new Uint8Array(Vt),a=0;a<32;a++)p[a]=l[a];return fi(y,p,!0),{publicKey:y,secretKey:p}},e.sign.publicKeyLength=vt,e.sign.secretKeyLength=Vt,e.sign.seedLength=di,e.sign.signatureLength=Qe,e.hash=function(l){dr(l);var y=new Uint8Array(pi);return hr(y,l,l.length),y},e.hash.hashLength=pi,e.verify=function(l,y){return dr(l,y),l.length===0||y.length===0||l.length!==y.length?!1:E(l,0,y,0,l.length)===0},e.setPRNG=function(l){n=l},function(){var l=typeof self<"u"?self.crypto||self.msCrypto:null;if(l&&l.getRandomValues){var y=65536;e.setPRNG(function(p,a){var v,h=new Uint8Array(a);for(v=0;v<a;v+=y)l.getRandomValues(h.subarray(v,v+Math.min(a-v,y)));for(v=0;v<a;v++)p[v]=h[v];No(h)})}else typeof G1<"u"&&(l=z1,l&&l.randomBytes&&e.setPRNG(function(p,a){var v,h=l.randomBytes(a);for(v=0;v<a;v++)p[v]=h[v];No(h)}))}()})(r.exports?r.exports:self.nacl=self.nacl||{})})(O0);var K1=O0.exports;const T0=Wi(K1);function Z1(){return T0.box.keyPair()}async function Bo(r,e){const t=sessionStorage.getItem("sessionKey"),n=sessionStorage.getItem("sessionId");console.groupCollapsed("Attestation");try{if(t&&n&&!r){const o=Cs(t);return console.log("Using existing attestation from session storage."),{sessionKey:o,sessionId:n}}const i=window.crypto.randomUUID();console.log("Generated attestation nonce:",i);const s=await F1(i);if(s&&s.public_key){console.log("Attestation document verification succeeded");const o=Z1();console.log("Generated client key pair");const c=new Uint8Array(s.public_key),{encrypted_session_key:u,session_id:d}=await nm(Vr(o.publicKey),i);console.log("Key exchange completed.");const b=T0.scalarMult(o.secretKey,c),S=Cs(u),Y=12,$=S.slice(0,Y),w=S.slice(Y),B=new Hc(b).open($,w);if(B)return console.log("Session key decrypted successfully"),window.sessionStorage.setItem("sessionKey",Vr(B)),window.sessionStorage.setItem("sessionId",d),{sessionKey:B,sessionId:d};throw new Error("Failed to decrypt session key")}else throw new Error("Invalid attestation document")}catch(i){throw console.error("Error verifying attestation:",i),i}finally{console.groupEnd()}}async function Ir(r,e,t,n){const i=async(s=!1)=>{try{s&&(console.log("Refreshing access token"),await Rc());const o=window.localStorage.getItem("access_token");if(!o)throw new Error("No access token available");const c=await N0(r,e,t,o,n);if(c.status===401&&!s)return console.log("Received 401, attempting to refresh token"),i(!0);if(c.error)throw new Error(c.error);if(!c.data)throw new Error("No data received from the server");return c.data}catch(o){throw console.error(o),o}};return i()}async function N0(r,e,t,n,i){let{sessionKey:s,sessionId:o}=await Bo();const c=async(d,b=!1)=>{if(b||!s||!o){const B=await Bo(!0);s=B.sessionKey,o=B.sessionId}if(!s||!o)throw new Error("Failed to make encrypted API call, no attestation available.");const S=t?JSON.stringify(t):void 0,Y=S?jf(s,S):void 0,$={"Content-Type":"application/json","x-session-id":o};d&&($.Authorization=`Bearer ${d}`);const w=await fetch(r,{method:e,headers:$,body:Y?JSON.stringify({encrypted:Y}):void 0}),E={status:w.status};if(w.ok)try{const B=await w.json(),I=Pf(s,B.encrypted);E.data=JSON.parse(I)}catch(B){console.error("Error decrypting or parsing response:",B),E.status=500,E.error="Failed to decrypt or parse the response"}else try{const B=await w.json();E.error=B.message||i||`HTTP error! Status: ${w.status}`}catch{E.error=i||`HTTP error! Status: ${w.status}`}return E},u=async(d,b=!1)=>{var S;try{const Y=await c(d,b);return(Y.status===400||(S=Y.error)!=null&&S.includes("Encryption error"))&&!b?(console.log("Encryption error or Bad Request, attempting to renew attestation"),u(d,!0)):Y}catch(Y){return{status:500,error:Y instanceof Error?Y.message:"Unknown error occurred"}}};return u(n)}async function Cr(r,e,t,n,i){const s=await N0(r,e,t,n,i);if(s.error)throw new Error(s.error);if(!s.data)throw new Error("No data received from the server");return s.data}let ht="";function W1(r){ht=r}function q1(){return ht}async function Y1(r,e){return Cr(`${ht}/login`,"POST",{email:r,password:e})}async function J1(r,e){return Cr(`${ht}/login`,"POST",{id:r,password:e})}async function X1(r,e,t,n){return Cr(`${ht}/register`,"POST",{email:r,password:e,inviteCode:t.toLowerCase(),name:n})}async function Q1(r,e){return Cr(`${ht}/register`,"POST",{password:r,inviteCode:e.toLowerCase()})}async function Rc(){const r=window.localStorage.getItem("refresh_token");if(!r)throw new Error("No refresh token available");const e={refresh_token:r};try{const t=await Cr(`${ht}/refresh`,"POST",e,void 0,"Failed to refresh token");return window.localStorage.setItem("access_token",t.access_token),window.localStorage.setItem("refresh_token",t.refresh_token),t}catch(t){throw console.error("Error refreshing token:",t),t}}async function em(){return Ir(`${ht}/protected/user`,"GET",void 0,"Failed to fetch user")}async function R0(r,e){return Ir(`${ht}/protected/kv/${r}`,"PUT",e,"Failed to put key-value pair")}async function j0(r){return Ir(`${ht}/protected/kv/${r}`,"DELETE",void 0,"Failed to delete key-value pair")}async function P0(r){try{return await Ir(`${ht}/protected/kv/${r}`,"GET",void 0,"Failed to get key-value pair")}catch(e){console.error(`Error fetching key "${r}":`,e);return}}async function U0(){return Ir(`${ht}/protected/kv`,"GET",void 0,"Failed to list key-value pairs")}async function tm(r){const e={refresh_token:r};return Cr(`${ht}/logout`,"POST",e)}async function D0(r){return Cr(`${ht}/verify-email/${r}`,"GET",void 0,void 0,"Failed to verify email")}async function jc(){return Ir(`${ht}/protected/request_verification`,"POST",void 0,"Failed to request new verification code")}async function rm(r){const e=await fetch(`${ht}/attestation/${r}`);if(!e.ok)throw new Error(`Request failed with status ${e.status}`);return(await e.json()).attestation_document}async function nm(r,e){const t=await fetch(`${ht}/key_exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_public_key:r,nonce:e})});if(!t.ok)throw new Error("Key exchange failed");return t.json()}async function $0(r,e){const t={email:r,hashed_secret:e};return Cr(`${ht}/password-reset/request`,"POST",t,void 0,"Failed to request password reset")}async function M0(r,e,t,n){const i={email:r,alphanumeric_code:e,plaintext_secret:t,new_password:n};return Cr(`${ht}/password-reset/confirm`,"POST",i,void 0,"Failed to confirm password reset")}async function V0(r,e){const t={current_password:r,new_password:e};return Ir(`${ht}/protected/change_password`,"POST",t,"Failed to change password")}async function im(r){try{return await Cr(`${ht}/auth/github`,"POST",r?{invite_code:r}:{},void 0,"Failed to initiate GitHub auth")}catch(e){throw e instanceof Error&&e.message.includes("Invalid invite code")?new Error("Invalid invite code. Please check and try again."):e}}async function sm(r,e,t){const n={code:r,state:e,invite_code:t};try{return await Cr(`${ht}/auth/github/callback`,"POST",n,void 0,"GitHub callback failed")}catch(i){throw console.error("Detailed GitHub callback error:",i),i instanceof Error?i.message.includes("User exists")||i.message.includes("Email already registered")?new Error("An account with this email already exists. Please sign in using your existing account."):i.message.includes("Invalid invite code")?new Error("Invalid invite code. Please try signing up with a valid invite code."):i.message.includes("User not found")?new Error("User not found. Please sign up first before attempting to log in with GitHub."):new Error("Failed to authenticate with GitHub. Please try again."):i}}async function om(r){try{return await Cr(`${ht}/auth/google`,"POST",r?{invite_code:r}:{},void 0,"Failed to initiate Google auth")}catch(e){throw e instanceof Error&&e.message.includes("Invalid invite code")?new Error("Invalid invite code. Please check and try again."):e}}async function am(r,e,t){const n={code:r,state:e,invite_code:t};try{return await Cr(`${ht}/auth/google/callback`,"POST",n,void 0,"Google callback failed")}catch(i){throw console.error("Detailed Google callback error:",i),i instanceof Error?i.message.includes("User exists")||i.message.includes("Email already registered")?new Error("An account with this email already exists. Please sign in using your existing account."):i.message.includes("Invalid invite code")?new Error("Invalid invite code. Please try signing up with a valid invite code."):i.message.includes("User not found")?new Error("User not found. Please sign up first before attempting to log in with Google."):new Error("Failed to authenticate with Google. Please try again."):i}}async function L0(){return Ir(`${ht}/protected/private_key`,"GET",void 0,"Failed to fetch private key")}async function H0(r){const e=r?`${ht}/protected/private_key_bytes?derivation_path=${encodeURIComponent(r)}`:`${ht}/protected/private_key_bytes`;return Ir(e,"GET",void 0,"Failed to fetch private key bytes")}async function F0(r,e,t){const n=Vr(r);return Ir(`${ht}/protected/sign_message`,"POST",{message_base64:n,algorithm:e,derivation_path:t},"Failed to sign message")}async function G0(r,e){const t=e?`${ht}/protected/public_key?algorithm=${r}&derivation_path=${encodeURIComponent(e)}`:`${ht}/protected/public_key?algorithm=${r}`;return Ir(t,"GET",void 0,"Failed to fetch public key")}async function cm(r,e,t){const n={email:r,password:e,name:t};return Ir(`${ht}/protected/convert_guest`,"POST",n,"Failed to convert guest account")}async function lm(r){return Ir(`${ht}/protected/third_party_token`,"POST",{audience:r},"Failed to generate third party token")}function um(){return async(r,e)=>{var n,i;const t=()=>{const s=window.localStorage.getItem("access_token");if(!s)throw new Error("No access token available");return`Bearer ${s}`};try{const s=new Headers(e==null?void 0:e.headers);s.set("Authorization",t());const{sessionKey:o,sessionId:c}=await Bo();if(!o||!c)throw new Error("No session key or ID available");s.set("x-session-id",c);const u={...e,headers:s};if(e!=null&&e.body){const b=jf(o,e.body);u.body=JSON.stringify({encrypted:b}),s.set("Content-Type","application/json")}let d=await fetch(r,u);if(d.status===401&&(console.warn("Unauthorized, refreshing access token"),await Rc(),s.set("Authorization",t()),u.headers=s,d=await fetch(r,u)),!d.ok){const b=await d.text();throw console.error("Request failed with response status:",d.status," and message:",b),new Error(`Request failed with status ${d.status}: ${b}`)}if((n=d.headers.get("content-type"))!=null&&n.includes("text/event-stream")){const b=(i=d.body)==null?void 0:i.getReader(),S=new TextDecoder;let Y="";const $=new ReadableStream({async start(w){for(;;){const{done:E,value:B}=await b.read();if(E)break;const I=S.decode(B);Y+=I;let R;for(;R=fm(Y);)if(Y=Y.slice(R.length),R.trim().startsWith("data: ")){const P=R.slice(6).trim();if(P==="[DONE]")w.enqueue(`data: [DONE]
153
+ `,d+=u,d},hf.noChildren=!0,Ye.registerDecoder(kt.CBOR,hf),Ye.registerDecoder(kt.URI,r=>(Jn(r.contents),new URL(r.contents)),"URI"),Pt(URL,r=>[kt.URI,r.toString()]),Ye.registerDecoder(kt.BASE64URL,r=>(Jn(r.contents),hv(r.contents)),"Base64url-encoded"),Ye.registerDecoder(kt.BASE64,r=>(Jn(r.contents),of(r.contents)),"Base64-encoded"),Ye.registerDecoder(35,r=>(Jn(r.contents),new RegExp(r.contents)),"RegExp"),Ye.registerDecoder(21065,r=>{Jn(r.contents);let e=r.contents.replace(new RegExp("(?<!\\\\)(?<!\\[(?:[^\\]]|\\\\\\])*)\\.","g"),`[^
154
+ \r]`);return e=`^(?:${e})$`,new RegExp(e,"u")},"I-RegExp"),Ye.registerDecoder(kt.REGEXP,r=>{if(d0(r.contents),r.contents.length<1||r.contents.length>2)throw new Error(`Invalid RegExp Array: ${r.contents}`);return new RegExp(r.contents[0],r.contents[1])},"RegExp"),Pt(RegExp,r=>[kt.REGEXP,[r.source,r.flags]]),Ye.registerDecoder(64,r=>(Ui(r.contents),r.contents),"uint8 Typed Array");function tr(r,e,t){Ui(r.contents);let n=r.contents.length;if(n%e.BYTES_PER_ELEMENT!==0)throw new Error(`Number of bytes must be divisible by ${e.BYTES_PER_ELEMENT}, got: ${n}`);n/=e.BYTES_PER_ELEMENT;const i=new e(n),s=new DataView(r.contents.buffer,r.contents.byteOffset,r.contents.byteLength),o=s[`get${e.name.replace(/Array/,"")}`].bind(s);for(let c=0;c<n;c++)i[c]=o(c*e.BYTES_PER_ELEMENT,t);return i}function Xn(r,e,t,n,i){const s=i.forceEndian??f0;if(vc(s?e:t,r,i),Wr(n.byteLength,r,Se.BYTE_STRING),f0===s)r.write(new Uint8Array(n.buffer,n.byteOffset,n.byteLength));else{const o=`write${n.constructor.name.replace(/Array/,"")}`,c=r[o].bind(r);for(const u of n)c(u,s)}}Ye.registerDecoder(65,r=>tr(r,Uint16Array,!1),"uint16, big endian, Typed Array"),Ye.registerDecoder(66,r=>tr(r,Uint32Array,!1),"uint32, big endian, Typed Array"),Ye.registerDecoder(67,r=>tr(r,BigUint64Array,!1),"uint64, big endian, Typed Array"),Ye.registerDecoder(68,r=>(Ui(r.contents),new Uint8ClampedArray(r.contents)),"uint8 Typed Array, clamped arithmetic"),Pt(Uint8ClampedArray,r=>[68,new Uint8Array(r.buffer,r.byteOffset,r.byteLength)]),Ye.registerDecoder(69,r=>tr(r,Uint16Array,!0),"uint16, little endian, Typed Array"),Pt(Uint16Array,(r,e,t)=>Xn(e,69,65,r,t)),Ye.registerDecoder(70,r=>tr(r,Uint32Array,!0),"uint32, little endian, Typed Array"),Pt(Uint32Array,(r,e,t)=>Xn(e,70,66,r,t)),Ye.registerDecoder(71,r=>tr(r,BigUint64Array,!0),"uint64, little endian, Typed Array"),Pt(BigUint64Array,(r,e,t)=>Xn(e,71,67,r,t)),Ye.registerDecoder(72,r=>(Ui(r.contents),new Int8Array(r.contents)),"sint8 Typed Array"),Pt(Int8Array,r=>[72,new Uint8Array(r.buffer,r.byteOffset,r.byteLength)]),Ye.registerDecoder(73,r=>tr(r,Int16Array,!1),"sint16, big endian, Typed Array"),Ye.registerDecoder(74,r=>tr(r,Int32Array,!1),"sint32, big endian, Typed Array"),Ye.registerDecoder(75,r=>tr(r,BigInt64Array,!1),"sint64, big endian, Typed Array"),Ye.registerDecoder(77,r=>tr(r,Int16Array,!0),"sint16, little endian, Typed Array"),Pt(Int16Array,(r,e,t)=>Xn(e,77,73,r,t)),Ye.registerDecoder(78,r=>tr(r,Int32Array,!0),"sint32, little endian, Typed Array"),Pt(Int32Array,(r,e,t)=>Xn(e,78,74,r,t)),Ye.registerDecoder(79,r=>tr(r,BigInt64Array,!0),"sint64, little endian, Typed Array"),Pt(BigInt64Array,(r,e,t)=>Xn(e,79,75,r,t)),Ye.registerDecoder(81,r=>tr(r,Float32Array,!1),"IEEE 754 binary32, big endian, Typed Array"),Ye.registerDecoder(82,r=>tr(r,Float64Array,!1),"IEEE 754 binary64, big endian, Typed Array"),Ye.registerDecoder(85,r=>tr(r,Float32Array,!0),"IEEE 754 binary32, little endian, Typed Array"),Pt(Float32Array,(r,e,t)=>Xn(e,85,81,r,t)),Ye.registerDecoder(86,r=>tr(r,Float64Array,!0),"IEEE 754 binary64, big endian, Typed Array"),Pt(Float64Array,(r,e,t)=>Xn(e,86,82,r,t)),Ye.registerDecoder(kt.SET,r=>(d0(r.contents),new Set(r.contents)),"Set"),Pt(Set,r=>[kt.SET,[...r]]),Ye.registerDecoder(kt.JSON,r=>(Jn(r.contents),JSON.parse(r.contents)),"JSON-encoded"),Ye.registerDecoder(kt.SELF_DESCRIBED,r=>r.contents,"Self-Described"),Ye.registerDecoder(kt.INVALID_16,()=>{throw new Error(`Tag always invalid: ${kt.INVALID_16}`)},"Invalid"),Ye.registerDecoder(kt.INVALID_32,()=>{throw new Error(`Tag always invalid: ${kt.INVALID_32}`)},"Invalid"),Ye.registerDecoder(kt.INVALID_64,()=>{throw new Error(`Tag always invalid: ${kt.INVALID_64}`)},"Invalid");function df(r){throw new Error(`Encoding ${r.constructor.name} intentionally unimplmented. It is not concrete enough to interoperate. Convert to Uint8Array first.`)}Pt(ArrayBuffer,df),Pt(DataView,df),typeof SharedArrayBuffer<"u"&&Pt(SharedArrayBuffer,df);function xc(r){return[NaN,r.valueOf()]}Pt(Boolean,xc),Pt(Number,xc),Pt(String,xc),Pt(BigInt,xc);function Ac(r,e={}){const t={...Yn.defaultDecodeOptions};if(e.dcbor?Object.assign(t,Yn.dcborDecodeOptions):e.cde&&Object.assign(t,Yn.cdeDecodeOptions),Object.assign(t,e),Object.hasOwn(t,"rejectLongNumbers"))throw new TypeError("rejectLongNumbers has changed to requirePreferred");t.boxed&&(t.saveOriginal=!0);const n=new uo(r,t);let i,s;for(const o of n){if(s=Yn.create(o,i,t,n),o[2]===Er.BREAK)if(i!=null&&i.isStreaming)i.left=0;else throw new Error("Unexpected BREAK");else i&&i.push(s,n,o[3]);for(s instanceof Yn&&(i=s);i!=null&&i.done;){s=i.convert(n);const c=i.parent;c==null||c.replaceLast(s,i,n),i=c}}return s}new TextEncoder;var st;(function(r){r.assertEqual=i=>i;function e(i){}r.assertIs=e;function t(i){throw new Error}r.assertNever=t,r.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},r.getValidEnumValues=i=>{const s=r.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),o={};for(const c of s)o[c]=i[c];return r.objectValues(o)},r.objectValues=i=>r.objectKeys(i).map(function(s){return i[s]}),r.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},r.find=(i,s)=>{for(const o of i)if(s(o))return o},r.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}r.joinValues=n,r.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(st||(st={}));var pf;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(pf||(pf={}));const ue=st.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Qn=r=>{switch(typeof r){case"undefined":return ue.undefined;case"string":return ue.string;case"number":return isNaN(r)?ue.nan:ue.number;case"boolean":return ue.boolean;case"function":return ue.function;case"bigint":return ue.bigint;case"symbol":return ue.symbol;case"object":return Array.isArray(r)?ue.array:r===null?ue.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?ue.promise:typeof Map<"u"&&r instanceof Map?ue.map:typeof Set<"u"&&r instanceof Set?ue.set:typeof Date<"u"&&r instanceof Date?ue.date:ue.object;default:return ue.unknown}},K=st.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Uv=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class kr extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(s){return s.message},n={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let c=n,u=0;for(;u<o.path.length;){const d=o.path[u];u===o.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(t(o))):c[d]=c[d]||{_errors:[]},c=c[d],u++}}};return i(this),n}static assert(e){if(!(e instanceof kr))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,st.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}kr.create=r=>new kr(r);const bs=(r,e)=>{let t;switch(r.code){case K.invalid_type:r.received===ue.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case K.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,st.jsonStringifyReplacer)}`;break;case K.unrecognized_keys:t=`Unrecognized key(s) in object: ${st.joinValues(r.keys,", ")}`;break;case K.invalid_union:t="Invalid input";break;case K.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${st.joinValues(r.options)}`;break;case K.invalid_enum_value:t=`Invalid enum value. Expected ${st.joinValues(r.options)}, received '${r.received}'`;break;case K.invalid_arguments:t="Invalid function arguments";break;case K.invalid_return_type:t="Invalid function return type";break;case K.invalid_date:t="Invalid date";break;case K.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:st.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case K.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case K.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case K.custom:t="Invalid input";break;case K.invalid_intersection_types:t="Intersection results could not be merged";break;case K.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case K.not_finite:t="Number must be finite";break;default:t=e.defaultError,st.assertNever(r)}return{message:t}};let m0=bs;function Dv(r){m0=r}function Sc(){return m0}const _c=r=>{const{data:e,path:t,errorMaps:n,issueData:i}=r,s=[...t,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let c="";const u=n.filter(d=>!!d).slice().reverse();for(const d of u)c=d(o,{data:e,defaultError:c}).message;return{...i,path:s,message:c}},$v=[];function ie(r,e){const t=Sc(),n=_c({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===bs?void 0:bs].filter(i=>!!i)});r.common.issues.push(n)}class rr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const i of t){if(i.status==="aborted")return Pe;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const i of t){const s=await i.key,o=await i.value;n.push({key:s,value:o})}return rr.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const i of t){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Pe;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[s.value]=o.value)}return{status:e.value,value:n}}}const Pe=Object.freeze({status:"aborted"}),xs=r=>({status:"dirty",value:r}),ur=r=>({status:"valid",value:r}),yf=r=>r.status==="aborted",gf=r=>r.status==="dirty",fo=r=>r.status==="valid",ho=r=>typeof Promise<"u"&&r instanceof Promise;function Ec(r,e,t,n){if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(r)}function w0(r,e,t,n,i){if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(r,t),t}typeof SuppressedError=="function"&&SuppressedError;var Ce;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Ce||(Ce={}));var po,yo;class un{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const b0=(r,e)=>{if(fo(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new kr(r.common.issues);return this._error=t,this._error}}};function Ve(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:i}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,c)=>{var u,d;const{message:b}=r;return o.code==="invalid_enum_value"?{message:b??c.defaultError}:typeof c.data>"u"?{message:(u=b??n)!==null&&u!==void 0?u:c.defaultError}:o.code!=="invalid_type"?{message:c.defaultError}:{message:(d=b??t)!==null&&d!==void 0?d:c.defaultError}},description:i}}class ze{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Qn(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Qn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new rr,ctx:{common:e.parent.common,data:e.data,parsedType:Qn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ho(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const i={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Qn(e)},s=this._parseSync({data:e,path:i.path,parent:i});return b0(i,s)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Qn(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(ho(i)?i:Promise.resolve(i));return b0(n,s)}refine(e,t){const n=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,s)=>{const o=e(i),c=()=>s.addIssue({code:K.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(c(),!1)):o?!0:(c(),!1)})}refinement(e,t){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new Jr({schema:this,typeName:je.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return hn.create(this,this._def)}nullable(){return ni.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Yr.create(this,this._def)}promise(){return Es.create(this,this._def)}or(e){return wo.create([this,e],this._def)}and(e){return bo.create(this,e,this._def)}transform(e){return new Jr({...Ve(this._def),schema:this,typeName:je.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Eo({...Ve(this._def),innerType:this,defaultValue:t,typeName:je.ZodDefault})}brand(){return new wf({typeName:je.ZodBranded,type:this,...Ve(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ko({...Ve(this._def),innerType:this,catchValue:t,typeName:je.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Io.create(this,e)}readonly(){return Co.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Mv=/^c[^\s-]{8,}$/i,Vv=/^[0-9a-z]+$/,Lv=/^[0-9A-HJKMNP-TV-Z]{26}$/,Hv=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Fv=/^[a-z0-9_-]{21}$/i,Gv=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,zv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Kv="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let vf;const Zv=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Wv=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,qv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,x0="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Yv=new RegExp(`^${x0}$`);function A0(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Jv(r){return new RegExp(`^${A0(r)}$`)}function S0(r){let e=`${x0}T${A0(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Xv(r,e){return!!((e==="v4"||!e)&&Zv.test(r)||(e==="v6"||!e)&&Wv.test(r))}class qr extends ze{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ue.string){const s=this._getOrReturnCtx(e);return ie(s,{code:K.invalid_type,expected:ue.string,received:s.parsedType}),Pe}const n=new rr;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),ie(i,{code:K.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),ie(i,{code:K.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const o=e.data.length>s.value,c=e.data.length<s.value;(o||c)&&(i=this._getOrReturnCtx(e,i),o?ie(i,{code:K.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&ie(i,{code:K.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")zv.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"email",code:K.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")vf||(vf=new RegExp(Kv,"u")),vf.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"emoji",code:K.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Hv.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"uuid",code:K.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")Fv.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"nanoid",code:K.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Mv.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"cuid",code:K.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Vv.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"cuid2",code:K.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Lv.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"ulid",code:K.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),ie(i,{validation:"url",code:K.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"regex",code:K.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),ie(i,{code:K.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),ie(i,{code:K.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),ie(i,{code:K.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?S0(s).test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{code:K.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Yv.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{code:K.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Jv(s).test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{code:K.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?Gv.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"duration",code:K.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Xv(e.data,s.version)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"ip",code:K.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?qv.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"base64",code:K.invalid_string,message:s.message}),n.dirty()):st.assertNever(s);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:K.invalid_string,...Ce.errToObj(n)})}_addCheck(e){return new qr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ce.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ce.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ce.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ce.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ce.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ce.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ce.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ce.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ce.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ce.errToObj(e)})}datetime(e){var t,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!1,...Ce.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Ce.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ce.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ce.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...Ce.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ce.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ce.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ce.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ce.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ce.errToObj(t)})}nonempty(e){return this.min(1,Ce.errToObj(e))}trim(){return new qr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new qr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new qr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}qr.create=r=>{var e;return new qr({checks:[],typeName:je.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...Ve(r)})};function Qv(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,s=parseInt(r.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return s%o/Math.pow(10,i)}class ei extends ze{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ue.number){const s=this._getOrReturnCtx(e);return ie(s,{code:K.invalid_type,expected:ue.number,received:s.parsedType}),Pe}let n;const i=new rr;for(const s of this._def.checks)s.kind==="int"?st.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),ie(n,{code:K.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),ie(n,{code:K.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),ie(n,{code:K.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?Qv(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),ie(n,{code:K.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),ie(n,{code:K.not_finite,message:s.message}),i.dirty()):st.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ce.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ce.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ce.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ce.toString(t))}setLimit(e,t,n,i){return new ei({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ce.toString(i)}]})}_addCheck(e){return new ei({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ce.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ce.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ce.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ce.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ce.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ce.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ce.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ce.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ce.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&st.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ei.create=r=>new ei({checks:[],typeName:je.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...Ve(r)});class ti extends ze{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==ue.bigint){const s=this._getOrReturnCtx(e);return ie(s,{code:K.invalid_type,expected:ue.bigint,received:s.parsedType}),Pe}let n;const i=new rr;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),ie(n,{code:K.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),ie(n,{code:K.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),ie(n,{code:K.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):st.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ce.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ce.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ce.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ce.toString(t))}setLimit(e,t,n,i){return new ti({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ce.toString(i)}]})}_addCheck(e){return new ti({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ce.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ce.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ce.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ce.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ce.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}ti.create=r=>{var e;return new ti({checks:[],typeName:je.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...Ve(r)})};class go extends ze{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ue.boolean){const n=this._getOrReturnCtx(e);return ie(n,{code:K.invalid_type,expected:ue.boolean,received:n.parsedType}),Pe}return ur(e.data)}}go.create=r=>new go({typeName:je.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...Ve(r)});class Di extends ze{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ue.date){const s=this._getOrReturnCtx(e);return ie(s,{code:K.invalid_type,expected:ue.date,received:s.parsedType}),Pe}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return ie(s,{code:K.invalid_date}),Pe}const n=new rr;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),ie(i,{code:K.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),ie(i,{code:K.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):st.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Di({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ce.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ce.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}Di.create=r=>new Di({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:je.ZodDate,...Ve(r)});class kc extends ze{_parse(e){if(this._getType(e)!==ue.symbol){const n=this._getOrReturnCtx(e);return ie(n,{code:K.invalid_type,expected:ue.symbol,received:n.parsedType}),Pe}return ur(e.data)}}kc.create=r=>new kc({typeName:je.ZodSymbol,...Ve(r)});class vo extends ze{_parse(e){if(this._getType(e)!==ue.undefined){const n=this._getOrReturnCtx(e);return ie(n,{code:K.invalid_type,expected:ue.undefined,received:n.parsedType}),Pe}return ur(e.data)}}vo.create=r=>new vo({typeName:je.ZodUndefined,...Ve(r)});class mo extends ze{_parse(e){if(this._getType(e)!==ue.null){const n=this._getOrReturnCtx(e);return ie(n,{code:K.invalid_type,expected:ue.null,received:n.parsedType}),Pe}return ur(e.data)}}mo.create=r=>new mo({typeName:je.ZodNull,...Ve(r)});class As extends ze{constructor(){super(...arguments),this._any=!0}_parse(e){return ur(e.data)}}As.create=r=>new As({typeName:je.ZodAny,...Ve(r)});class $i extends ze{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ur(e.data)}}$i.create=r=>new $i({typeName:je.ZodUnknown,...Ve(r)});class jn extends ze{_parse(e){const t=this._getOrReturnCtx(e);return ie(t,{code:K.invalid_type,expected:ue.never,received:t.parsedType}),Pe}}jn.create=r=>new jn({typeName:je.ZodNever,...Ve(r)});class Ic extends ze{_parse(e){if(this._getType(e)!==ue.undefined){const n=this._getOrReturnCtx(e);return ie(n,{code:K.invalid_type,expected:ue.void,received:n.parsedType}),Pe}return ur(e.data)}}Ic.create=r=>new Ic({typeName:je.ZodVoid,...Ve(r)});class Yr extends ze{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==ue.array)return ie(t,{code:K.invalid_type,expected:ue.array,received:t.parsedType}),Pe;if(i.exactLength!==null){const o=t.data.length>i.exactLength.value,c=t.data.length<i.exactLength.value;(o||c)&&(ie(t,{code:o?K.too_big:K.too_small,minimum:c?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(ie(t,{code:K.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(ie(t,{code:K.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,c)=>i.type._parseAsync(new un(t,o,t.path,c)))).then(o=>rr.mergeArray(n,o));const s=[...t.data].map((o,c)=>i.type._parseSync(new un(t,o,t.path,c)));return rr.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new Yr({...this._def,minLength:{value:e,message:Ce.toString(t)}})}max(e,t){return new Yr({...this._def,maxLength:{value:e,message:Ce.toString(t)}})}length(e,t){return new Yr({...this._def,exactLength:{value:e,message:Ce.toString(t)}})}nonempty(e){return this.min(1,e)}}Yr.create=(r,e)=>new Yr({type:r,minLength:null,maxLength:null,exactLength:null,typeName:je.ZodArray,...Ve(e)});function Ss(r){if(r instanceof Nt){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=hn.create(Ss(n))}return new Nt({...r._def,shape:()=>e})}else return r instanceof Yr?new Yr({...r._def,type:Ss(r.element)}):r instanceof hn?hn.create(Ss(r.unwrap())):r instanceof ni?ni.create(Ss(r.unwrap())):r instanceof fn?fn.create(r.items.map(e=>Ss(e))):r}class Nt extends ze{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=st.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==ue.object){const d=this._getOrReturnCtx(e);return ie(d,{code:K.invalid_type,expected:ue.object,received:d.parsedType}),Pe}const{status:n,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),c=[];if(!(this._def.catchall instanceof jn&&this._def.unknownKeys==="strip"))for(const d in i.data)o.includes(d)||c.push(d);const u=[];for(const d of o){const b=s[d],_=i.data[d];u.push({key:{status:"valid",value:d},value:b._parse(new un(i,_,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof jn){const d=this._def.unknownKeys;if(d==="passthrough")for(const b of c)u.push({key:{status:"valid",value:b},value:{status:"valid",value:i.data[b]}});else if(d==="strict")c.length>0&&(ie(i,{code:K.unrecognized_keys,keys:c}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const b of c){const _=i.data[b];u.push({key:{status:"valid",value:b},value:d._parse(new un(i,_,i.path,b)),alwaysSet:b in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const d=[];for(const b of u){const _=await b.key,q=await b.value;d.push({key:_,value:q,alwaysSet:b.alwaysSet})}return d}).then(d=>rr.mergeObjectSync(n,d)):rr.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Ce.errToObj,new Nt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var i,s,o,c;const u=(o=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,t,n).message)!==null&&o!==void 0?o:n.defaultError;return t.code==="unrecognized_keys"?{message:(c=Ce.errToObj(e).message)!==null&&c!==void 0?c:u}:{message:u}}}:{}})}strip(){return new Nt({...this._def,unknownKeys:"strip"})}passthrough(){return new Nt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Nt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Nt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:je.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Nt({...this._def,catchall:e})}pick(e){const t={};return st.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new Nt({...this._def,shape:()=>t})}omit(e){const t={};return st.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new Nt({...this._def,shape:()=>t})}deepPartial(){return Ss(this)}partial(e){const t={};return st.objectKeys(this.shape).forEach(n=>{const i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}),new Nt({...this._def,shape:()=>t})}required(e){const t={};return st.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof hn;)s=s._def.innerType;t[n]=s}}),new Nt({...this._def,shape:()=>t})}keyof(){return _0(st.objectKeys(this.shape))}}Nt.create=(r,e)=>new Nt({shape:()=>r,unknownKeys:"strip",catchall:jn.create(),typeName:je.ZodObject,...Ve(e)}),Nt.strictCreate=(r,e)=>new Nt({shape:()=>r,unknownKeys:"strict",catchall:jn.create(),typeName:je.ZodObject,...Ve(e)}),Nt.lazycreate=(r,e)=>new Nt({shape:r,unknownKeys:"strip",catchall:jn.create(),typeName:je.ZodObject,...Ve(e)});class wo extends ze{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function i(s){for(const c of s)if(c.result.status==="valid")return c.result;for(const c of s)if(c.result.status==="dirty")return t.common.issues.push(...c.ctx.common.issues),c.result;const o=s.map(c=>new kr(c.ctx.common.issues));return ie(t,{code:K.invalid_union,unionErrors:o}),Pe}if(t.common.async)return Promise.all(n.map(async s=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const u of n){const d={...t,common:{...t.common,issues:[]},parent:null},b=u._parseSync({data:t.data,path:t.path,parent:d});if(b.status==="valid")return b;b.status==="dirty"&&!s&&(s={result:b,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;const c=o.map(u=>new kr(u));return ie(t,{code:K.invalid_union,unionErrors:c}),Pe}}get options(){return this._def.options}}wo.create=(r,e)=>new wo({options:r,typeName:je.ZodUnion,...Ve(e)});const Pn=r=>r instanceof Ao?Pn(r.schema):r instanceof Jr?Pn(r.innerType()):r instanceof So?[r.value]:r instanceof ri?r.options:r instanceof _o?st.objectValues(r.enum):r instanceof Eo?Pn(r._def.innerType):r instanceof vo?[void 0]:r instanceof mo?[null]:r instanceof hn?[void 0,...Pn(r.unwrap())]:r instanceof ni?[null,...Pn(r.unwrap())]:r instanceof wf||r instanceof Co?Pn(r.unwrap()):r instanceof ko?Pn(r._def.innerType):[];class Cc extends ze{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ue.object)return ie(t,{code:K.invalid_type,expected:ue.object,received:t.parsedType}),Pe;const n=this.discriminator,i=t.data[n],s=this.optionsMap.get(i);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(ie(t,{code:K.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Pe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const i=new Map;for(const s of t){const o=Pn(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const c of o){if(i.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);i.set(c,s)}}return new Cc({typeName:je.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...Ve(n)})}}function mf(r,e){const t=Qn(r),n=Qn(e);if(r===e)return{valid:!0,data:r};if(t===ue.object&&n===ue.object){const i=st.objectKeys(e),s=st.objectKeys(r).filter(c=>i.indexOf(c)!==-1),o={...r,...e};for(const c of s){const u=mf(r[c],e[c]);if(!u.valid)return{valid:!1};o[c]=u.data}return{valid:!0,data:o}}else if(t===ue.array&&n===ue.array){if(r.length!==e.length)return{valid:!1};const i=[];for(let s=0;s<r.length;s++){const o=r[s],c=e[s],u=mf(o,c);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return t===ue.date&&n===ue.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class bo extends ze{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=(s,o)=>{if(yf(s)||yf(o))return Pe;const c=mf(s.value,o.value);return c.valid?((gf(s)||gf(o))&&t.dirty(),{status:t.value,value:c.data}):(ie(n,{code:K.invalid_intersection_types}),Pe)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}bo.create=(r,e,t)=>new bo({left:r,right:e,typeName:je.ZodIntersection,...Ve(t)});class fn extends ze{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ue.array)return ie(n,{code:K.invalid_type,expected:ue.array,received:n.parsedType}),Pe;if(n.data.length<this._def.items.length)return ie(n,{code:K.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Pe;!this._def.rest&&n.data.length>this._def.items.length&&(ie(n,{code:K.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...n.data].map((o,c)=>{const u=this._def.items[c]||this._def.rest;return u?u._parse(new un(n,o,n.path,c)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>rr.mergeArray(t,o)):rr.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new fn({...this._def,rest:e})}}fn.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new fn({items:r,typeName:je.ZodTuple,rest:null,...Ve(e)})};class xo extends ze{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ue.object)return ie(n,{code:K.invalid_type,expected:ue.object,received:n.parsedType}),Pe;const i=[],s=this._def.keyType,o=this._def.valueType;for(const c in n.data)i.push({key:s._parse(new un(n,c,n.path,c)),value:o._parse(new un(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?rr.mergeObjectAsync(t,i):rr.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof ze?new xo({keyType:e,valueType:t,typeName:je.ZodRecord,...Ve(n)}):new xo({keyType:qr.create(),valueType:e,typeName:je.ZodRecord,...Ve(t)})}}class Bc extends ze{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ue.map)return ie(n,{code:K.invalid_type,expected:ue.map,received:n.parsedType}),Pe;const i=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([c,u],d)=>({key:i._parse(new un(n,c,n.path,[d,"key"])),value:s._parse(new un(n,u,n.path,[d,"value"]))}));if(n.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const u of o){const d=await u.key,b=await u.value;if(d.status==="aborted"||b.status==="aborted")return Pe;(d.status==="dirty"||b.status==="dirty")&&t.dirty(),c.set(d.value,b.value)}return{status:t.value,value:c}})}else{const c=new Map;for(const u of o){const d=u.key,b=u.value;if(d.status==="aborted"||b.status==="aborted")return Pe;(d.status==="dirty"||b.status==="dirty")&&t.dirty(),c.set(d.value,b.value)}return{status:t.value,value:c}}}}Bc.create=(r,e,t)=>new Bc({valueType:e,keyType:r,typeName:je.ZodMap,...Ve(t)});class Mi extends ze{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ue.set)return ie(n,{code:K.invalid_type,expected:ue.set,received:n.parsedType}),Pe;const i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(ie(n,{code:K.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(ie(n,{code:K.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const s=this._def.valueType;function o(u){const d=new Set;for(const b of u){if(b.status==="aborted")return Pe;b.status==="dirty"&&t.dirty(),d.add(b.value)}return{status:t.value,value:d}}const c=[...n.data.values()].map((u,d)=>s._parse(new un(n,u,n.path,d)));return n.common.async?Promise.all(c).then(u=>o(u)):o(c)}min(e,t){return new Mi({...this._def,minSize:{value:e,message:Ce.toString(t)}})}max(e,t){return new Mi({...this._def,maxSize:{value:e,message:Ce.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Mi.create=(r,e)=>new Mi({valueType:r,minSize:null,maxSize:null,typeName:je.ZodSet,...Ve(e)});class _s extends ze{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ue.function)return ie(t,{code:K.invalid_type,expected:ue.function,received:t.parsedType}),Pe;function n(c,u){return _c({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Sc(),bs].filter(d=>!!d),issueData:{code:K.invalid_arguments,argumentsError:u}})}function i(c,u){return _c({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Sc(),bs].filter(d=>!!d),issueData:{code:K.invalid_return_type,returnTypeError:u}})}const s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Es){const c=this;return ur(async function(...u){const d=new kr([]),b=await c._def.args.parseAsync(u,s).catch($=>{throw d.addIssue(n(u,$)),d}),_=await Reflect.apply(o,this,b);return await c._def.returns._def.type.parseAsync(_,s).catch($=>{throw d.addIssue(i(_,$)),d})})}else{const c=this;return ur(function(...u){const d=c._def.args.safeParse(u,s);if(!d.success)throw new kr([n(u,d.error)]);const b=Reflect.apply(o,this,d.data),_=c._def.returns.safeParse(b,s);if(!_.success)throw new kr([i(b,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new _s({...this._def,args:fn.create(e).rest($i.create())})}returns(e){return new _s({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new _s({args:e||fn.create([]).rest($i.create()),returns:t||$i.create(),typeName:je.ZodFunction,...Ve(n)})}}class Ao extends ze{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ao.create=(r,e)=>new Ao({getter:r,typeName:je.ZodLazy,...Ve(e)});class So extends ze{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ie(t,{received:t.data,code:K.invalid_literal,expected:this._def.value}),Pe}return{status:"valid",value:e.data}}get value(){return this._def.value}}So.create=(r,e)=>new So({value:r,typeName:je.ZodLiteral,...Ve(e)});function _0(r,e){return new ri({values:r,typeName:je.ZodEnum,...Ve(e)})}class ri extends ze{constructor(){super(...arguments),po.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return ie(t,{expected:st.joinValues(n),received:t.parsedType,code:K.invalid_type}),Pe}if(Ec(this,po)||w0(this,po,new Set(this._def.values)),!Ec(this,po).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return ie(t,{received:t.data,code:K.invalid_enum_value,options:n}),Pe}return ur(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ri.create(e,{...this._def,...t})}exclude(e,t=this._def){return ri.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}po=new WeakMap,ri.create=_0;class _o extends ze{constructor(){super(...arguments),yo.set(this,void 0)}_parse(e){const t=st.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==ue.string&&n.parsedType!==ue.number){const i=st.objectValues(t);return ie(n,{expected:st.joinValues(i),received:n.parsedType,code:K.invalid_type}),Pe}if(Ec(this,yo)||w0(this,yo,new Set(st.getValidEnumValues(this._def.values))),!Ec(this,yo).has(e.data)){const i=st.objectValues(t);return ie(n,{received:n.data,code:K.invalid_enum_value,options:i}),Pe}return ur(e.data)}get enum(){return this._def.values}}yo=new WeakMap,_o.create=(r,e)=>new _o({values:r,typeName:je.ZodNativeEnum,...Ve(e)});class Es extends ze{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ue.promise&&t.common.async===!1)return ie(t,{code:K.invalid_type,expected:ue.promise,received:t.parsedType}),Pe;const n=t.parsedType===ue.promise?t.data:Promise.resolve(t.data);return ur(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Es.create=(r,e)=>new Es({type:r,typeName:je.ZodPromise,...Ve(e)});class Jr extends ze{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===je.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:o=>{ie(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(n.data,s);if(n.common.async)return Promise.resolve(o).then(async c=>{if(t.value==="aborted")return Pe;const u=await this._def.schema._parseAsync({data:c,path:n.path,parent:n});return u.status==="aborted"?Pe:u.status==="dirty"||t.value==="dirty"?xs(u.value):u});{if(t.value==="aborted")return Pe;const c=this._def.schema._parseSync({data:o,path:n.path,parent:n});return c.status==="aborted"?Pe:c.status==="dirty"||t.value==="dirty"?xs(c.value):c}}if(i.type==="refinement"){const o=c=>{const u=i.refinement(c,s);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(n.common.async===!1){const c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?Pe:(c.status==="dirty"&&t.dirty(),o(c.value),{status:t.value,value:c.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>c.status==="aborted"?Pe:(c.status==="dirty"&&t.dirty(),o(c.value).then(()=>({status:t.value,value:c.value}))))}if(i.type==="transform")if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!fo(o))return o;const c=i.transform(o.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:c}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>fo(o)?Promise.resolve(i.transform(o.value,s)).then(c=>({status:t.value,value:c})):o);st.assertNever(i)}}Jr.create=(r,e,t)=>new Jr({schema:r,typeName:je.ZodEffects,effect:e,...Ve(t)}),Jr.createWithPreprocess=(r,e,t)=>new Jr({schema:e,effect:{type:"preprocess",transform:r},typeName:je.ZodEffects,...Ve(t)});class hn extends ze{_parse(e){return this._getType(e)===ue.undefined?ur(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}hn.create=(r,e)=>new hn({innerType:r,typeName:je.ZodOptional,...Ve(e)});class ni extends ze{_parse(e){return this._getType(e)===ue.null?ur(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ni.create=(r,e)=>new ni({innerType:r,typeName:je.ZodNullable,...Ve(e)});class Eo extends ze{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===ue.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Eo.create=(r,e)=>new Eo({innerType:r,typeName:je.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ve(e)});class ko extends ze{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ho(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new kr(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new kr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ko.create=(r,e)=>new ko({innerType:r,typeName:je.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ve(e)});class Oc extends ze{_parse(e){if(this._getType(e)!==ue.nan){const n=this._getOrReturnCtx(e);return ie(n,{code:K.invalid_type,expected:ue.nan,received:n.parsedType}),Pe}return{status:"valid",value:e.data}}}Oc.create=r=>new Oc({typeName:je.ZodNaN,...Ve(r)});const e1=Symbol("zod_brand");class wf extends ze{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Io extends ze{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Pe:s.status==="dirty"?(t.dirty(),xs(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Pe:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,t){return new Io({in:e,out:t,typeName:je.ZodPipeline})}}class Co extends ze{_parse(e){const t=this._def.innerType._parse(e),n=i=>(fo(i)&&(i.value=Object.freeze(i.value)),i);return ho(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}}Co.create=(r,e)=>new Co({innerType:r,typeName:je.ZodReadonly,...Ve(e)});function E0(r,e={},t){return r?As.create().superRefine((n,i)=>{var s,o;if(!r(n)){const c=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(o=(s=c.fatal)!==null&&s!==void 0?s:t)!==null&&o!==void 0?o:!0,d=typeof c=="string"?{message:c}:c;i.addIssue({code:"custom",...d,fatal:u})}}):As.create()}const t1={object:Nt.lazycreate};var je;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(je||(je={}));const r1=(r,e={message:`Input not instance of ${r.name}`})=>E0(t=>t instanceof r,e),k0=qr.create,I0=ei.create,n1=Oc.create,i1=ti.create,C0=go.create,s1=Di.create,o1=kc.create,a1=vo.create,c1=mo.create,l1=As.create,u1=$i.create,f1=jn.create,h1=Ic.create,d1=Yr.create,p1=Nt.create,y1=Nt.strictCreate,g1=wo.create,v1=Cc.create,m1=bo.create,w1=fn.create,b1=xo.create,x1=Bc.create,A1=Mi.create,S1=_s.create,_1=Ao.create,E1=So.create,k1=ri.create,I1=_o.create,C1=Es.create,B0=Jr.create,B1=hn.create,O1=ni.create,T1=Jr.createWithPreprocess,N1=Io.create;var Rt=Object.freeze({__proto__:null,defaultErrorMap:bs,setErrorMap:Dv,getErrorMap:Sc,makeIssue:_c,EMPTY_PATH:$v,addIssueToContext:ie,ParseStatus:rr,INVALID:Pe,DIRTY:xs,OK:ur,isAborted:yf,isDirty:gf,isValid:fo,isAsync:ho,get util(){return st},get objectUtil(){return pf},ZodParsedType:ue,getParsedType:Qn,ZodType:ze,datetimeRegex:S0,ZodString:qr,ZodNumber:ei,ZodBigInt:ti,ZodBoolean:go,ZodDate:Di,ZodSymbol:kc,ZodUndefined:vo,ZodNull:mo,ZodAny:As,ZodUnknown:$i,ZodNever:jn,ZodVoid:Ic,ZodArray:Yr,ZodObject:Nt,ZodUnion:wo,ZodDiscriminatedUnion:Cc,ZodIntersection:bo,ZodTuple:fn,ZodRecord:xo,ZodMap:Bc,ZodSet:Mi,ZodFunction:_s,ZodLazy:Ao,ZodLiteral:So,ZodEnum:ri,ZodNativeEnum:_o,ZodPromise:Es,ZodEffects:Jr,ZodTransformer:Jr,ZodOptional:hn,ZodNullable:ni,ZodDefault:Eo,ZodCatch:ko,ZodNaN:Oc,BRAND:e1,ZodBranded:wf,ZodPipeline:Io,ZodReadonly:Co,custom:E0,Schema:ze,ZodSchema:ze,late:t1,get ZodFirstPartyTypeKind(){return je},coerce:{string:r=>qr.create({...r,coerce:!0}),number:r=>ei.create({...r,coerce:!0}),boolean:r=>go.create({...r,coerce:!0}),bigint:r=>ti.create({...r,coerce:!0}),date:r=>Di.create({...r,coerce:!0})},any:l1,array:d1,bigint:i1,boolean:C0,date:s1,discriminatedUnion:v1,effect:B0,enum:k1,function:S1,instanceof:r1,intersection:m1,lazy:_1,literal:E1,map:x1,nan:n1,nativeEnum:I1,never:f1,null:c1,nullable:O1,number:I0,object:p1,oboolean:()=>C0().optional(),onumber:()=>I0().optional(),optional:B1,ostring:()=>k0().optional(),pipeline:N1,preprocess:T1,promise:C1,record:b1,set:A1,strictObject:y1,string:k0,symbol:o1,transformer:B0,tuple:w1,undefined:a1,union:g1,unknown:u1,void:h1,NEVER:Pe,ZodIssueCode:K,quotelessJson:Uv,ZodError:kr});const Tc=new Uint8Array([48,130,2,17,48,130,1,150,160,3,2,1,2,2,17,0,249,49,117,104,27,144,175,225,29,70,204,180,228,231,248,86,48,10,6,8,42,134,72,206,61,4,3,3,48,73,49,11,48,9,6,3,85,4,6,19,2,85,83,49,15,48,13,6,3,85,4,10,12,6,65,109,97,122,111,110,49,12,48,10,6,3,85,4,11,12,3,65,87,83,49,27,48,25,6,3,85,4,3,12,18,97,119,115,46,110,105,116,114,111,45,101,110,99,108,97,118,101,115,48,30,23,13,49,57,49,48,50,56,49,51,50,56,48,53,90,23,13,52,57,49,48,50,56,49,52,50,56,48,53,90,48,73,49,11,48,9,6,3,85,4,6,19,2,85,83,49,15,48,13,6,3,85,4,10,12,6,65,109,97,122,111,110,49,12,48,10,6,3,85,4,11,12,3,65,87,83,49,27,48,25,6,3,85,4,3,12,18,97,119,115,46,110,105,116,114,111,45,101,110,99,108,97,118,101,115,48,118,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,3,98,0,4,252,2,84,235,166,8,193,243,104,112,226,154,218,144,190,70,56,50,146,115,110,137,75,255,246,114,217,137,68,75,80,81,229,52,164,177,246,219,227,192,188,88,26,50,183,177,118,7,14,222,18,214,154,63,234,33,27,102,231,82,207,125,209,221,9,95,111,19,112,244,23,8,67,217,220,16,1,33,228,207,99,1,40,9,102,68,135,201,121,98,132,48,77,197,63,244,163,66,48,64,48,15,6,3,85,29,19,1,1,255,4,5,48,3,1,1,255,48,29,6,3,85,29,14,4,22,4,20,144,37,181,13,217,5,71,231,150,195,150,250,114,157,207,153,169,223,75,150,48,14,6,3,85,29,15,1,1,255,4,4,3,2,1,134,48,10,6,8,42,134,72,206,61,4,3,3,3,105,0,48,102,2,49,0,163,127,47,145,161,201,189,94,231,184,98,124,22,152,210,85,3,142,31,3,67,249,91,99,169,98,140,61,57,128,149,69,161,30,188,191,46,59,85,216,174,238,113,180,195,214,173,243,2,49,0,162,243,155,22,5,178,112,40,165,221,75,160,105,181,1,110,101,180,251,222,143,224,6,29,106,83,25,127,156,218,245,217,67,188,97,252,43,235,3,203,111,238,141,35,2,243,223,246]);if(!Tc||Tc.length===0)throw new Error("AWS root certificate is empty or not loaded correctly");const R1=Rt.object({module_id:Rt.string().min(1),digest:Rt.literal("SHA384"),timestamp:Rt.number().min(1677721600),pcrs:Rt.map(Rt.number(),Rt.instanceof(Uint8Array)),certificate:Rt.instanceof(Uint8Array),cabundle:Rt.array(Rt.instanceof(Uint8Array)),public_key:Rt.nullable(Rt.instanceof(Uint8Array)),user_data:Rt.nullable(Rt.instanceof(Uint8Array)),nonce:Rt.nullable(Rt.instanceof(Uint8Array))}),j1=Rt.object({protected:Rt.instanceof(Uint8Array),payload:Rt.instanceof(Uint8Array),signature:Rt.instanceof(Uint8Array)});async function P1(r){try{if(!r)throw new Error("Attestation document is empty.");const e=Cs(r),t=Ac(e),n=t[0],i=t[2],s=t[3];return j1.parse({protected:n,payload:i,signature:s})}catch(e){throw console.error("Error parsing document data:",e),new Error("Failed to parse document data.")}}async function U1(r){try{const e=Ac(r);return R1.parse(e)}catch(e){throw console.error("Error parsing document payload:",e),new Error("Failed to parse document payload.")}}function D1(r,e){const t=["Signature1",r,new Uint8Array(0),e];return mc(t)}async function $1(r,e){try{console.log("SIGNATURE:"),console.log(Vr(r.signature));const t=D1(r.protected,r.payload),n=await crypto.subtle.digest("SHA-384",t);return console.log("SIGNATURE STRUCTURE DIGEST:"),console.log(Vr(new Uint8Array(n))),await crypto.subtle.verify({name:"ECDSA",hash:"SHA-384"},e,r.signature,t)}catch(t){throw console.error("Error verifying signature:",t),t instanceof Error?new Error(`Signature verification failed: ${t.message}`):new Error(`Signature verification failed: ${t}`)}}async function Nc(r,e,t){try{const n=await P1(r),i=await U1(n.payload);if(!i.nonce)throw new Error("Attestation document does not have a nonce.");const o=new TextDecoder("utf-8").decode(i.nonce);if(t!==o)throw console.log("Nonce mismatch"),console.log("Provided nonce:",t),console.log("Attestation document nonce:",o),new Error("Attestation document's nonce does not match the provided nonce.");const c=[],u=Vr(i.cabundle[0]);if(u!==Vr(e))throw console.error("Root cert doesn't match first cert"),console.log("First cert base64:",u),console.log("Trusted root cert base64:",Vr(e)),new Error("Root cert does not match first cert in attestation document.");for(let I=0;I<i.cabundle.length;I++){const R=new ji(i.cabundle[I]);c.push(R)}const d=new ji(i.certificate),_=await new cv({certificates:c}).build(d);console.log("Chain items:",_);const $=new Date().getTime();for(let I=0;I<_.length;I++){const R=_[I];if(console.log("CERT: ",I),console.log(R.subject),console.log("Not before:",R.notBefore),console.log("Not after:",R.notAfter),console.log(R.toString("pem")),R.notBefore.getTime()>$||R.notAfter.getTime()<$)throw new Error("Certificate is expired.");console.log(`Certificate ${I} is not expired.`)}if(_.length!==i.cabundle.length+1)throw new Error("Certificate chain length does not match length of cabundle.");const w=d.publicKey;console.log("PUBLIC KEY:"),console.log(Vr(new Uint8Array(w.rawData)));const E=await w.export(),B=await $1(n,E);if(console.log("Signature verified:",B),!B)throw new Error("Signature verification failed.");return i}catch(n){throw console.error("Error verifying attestation document:",n),n}}const M1=Rt.object({public_key:Rt.nullable(Rt.instanceof(Uint8Array))});async function V1(r){const e=Cs(r),n=Ac(e)[2],i=Ac(n);return await M1.parse(i)}async function L1(r){try{const e=await em(r),t=Z1();return t&&(t==="http://127.0.0.1:3000"||t==="http://localhost:3000"||t==="http://0.0.0.0:3000")?(console.log("DEV MODE: Using fake attestation document"),await V1(e)):await Nc(e,Tc,r)}catch(e){throw e instanceof Error?(console.error("Error verifying attestation document:",e),new Error(`Couldn't process attestation document: ${e.message}`)):(console.error("Error verifying attestation document:",e),new Error("Couldn't process attestation document."))}}function H1(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var O0={exports:{}};const F1=Mc(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));(function(r){(function(e){var t=function(l){var y,p=new Float64Array(16);if(l)for(y=0;y<l.length;y++)p[y]=l[y];return p},n=function(){throw new Error("no PRNG")},i=new Uint8Array(16),s=new Uint8Array(32);s[0]=9;var o=t(),c=t([1]),u=t([56129,1]),d=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),b=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),_=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),q=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),$=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(l,y,p,a){l[y]=p>>24&255,l[y+1]=p>>16&255,l[y+2]=p>>8&255,l[y+3]=p&255,l[y+4]=a>>24&255,l[y+5]=a>>16&255,l[y+6]=a>>8&255,l[y+7]=a&255}function E(l,y,p,a,v){var h,m=0;for(h=0;h<v;h++)m|=l[y+h]^p[a+h];return(1&m-1>>>8)-1}function B(l,y,p,a){return E(l,y,p,a,16)}function I(l,y,p,a){return E(l,y,p,a,32)}function R(l,y,p,a){for(var v=a[0]&255|(a[1]&255)<<8|(a[2]&255)<<16|(a[3]&255)<<24,h=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,m=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,S=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,N=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,Z=a[4]&255|(a[5]&255)<<8|(a[6]&255)<<16|(a[7]&255)<<24,F=y[0]&255|(y[1]&255)<<8|(y[2]&255)<<16|(y[3]&255)<<24,ye=y[4]&255|(y[5]&255)<<8|(y[6]&255)<<16|(y[7]&255)<<24,L=y[8]&255|(y[9]&255)<<8|(y[10]&255)<<16|(y[11]&255)<<24,xe=y[12]&255|(y[13]&255)<<8|(y[14]&255)<<16|(y[15]&255)<<24,ge=a[8]&255|(a[9]&255)<<8|(a[10]&255)<<16|(a[11]&255)<<24,Ae=p[16]&255|(p[17]&255)<<8|(p[18]&255)<<16|(p[19]&255)<<24,Be=p[20]&255|(p[21]&255)<<8|(p[22]&255)<<16|(p[23]&255)<<24,Oe=p[24]&255|(p[25]&255)<<8|(p[26]&255)<<16|(p[27]&255)<<24,Te=p[28]&255|(p[29]&255)<<8|(p[30]&255)<<16|(p[31]&255)<<24,Ee=a[12]&255|(a[13]&255)<<8|(a[14]&255)<<16|(a[15]&255)<<24,de=v,Ie=h,se=m,be=S,_e=N,ne=Z,O=F,T=ye,H=L,P=xe,D=ge,G=Ae,Re=Be,He=Oe,Ge=Te,Fe=Ee,x,Je=0;Je<20;Je+=2)x=de+Re|0,_e^=x<<7|x>>>25,x=_e+de|0,H^=x<<9|x>>>23,x=H+_e|0,Re^=x<<13|x>>>19,x=Re+H|0,de^=x<<18|x>>>14,x=ne+Ie|0,P^=x<<7|x>>>25,x=P+ne|0,He^=x<<9|x>>>23,x=He+P|0,Ie^=x<<13|x>>>19,x=Ie+He|0,ne^=x<<18|x>>>14,x=D+O|0,Ge^=x<<7|x>>>25,x=Ge+D|0,se^=x<<9|x>>>23,x=se+Ge|0,O^=x<<13|x>>>19,x=O+se|0,D^=x<<18|x>>>14,x=Fe+G|0,be^=x<<7|x>>>25,x=be+Fe|0,T^=x<<9|x>>>23,x=T+be|0,G^=x<<13|x>>>19,x=G+T|0,Fe^=x<<18|x>>>14,x=de+be|0,Ie^=x<<7|x>>>25,x=Ie+de|0,se^=x<<9|x>>>23,x=se+Ie|0,be^=x<<13|x>>>19,x=be+se|0,de^=x<<18|x>>>14,x=ne+_e|0,O^=x<<7|x>>>25,x=O+ne|0,T^=x<<9|x>>>23,x=T+O|0,_e^=x<<13|x>>>19,x=_e+T|0,ne^=x<<18|x>>>14,x=D+P|0,G^=x<<7|x>>>25,x=G+D|0,H^=x<<9|x>>>23,x=H+G|0,P^=x<<13|x>>>19,x=P+H|0,D^=x<<18|x>>>14,x=Fe+Ge|0,Re^=x<<7|x>>>25,x=Re+Fe|0,He^=x<<9|x>>>23,x=He+Re|0,Ge^=x<<13|x>>>19,x=Ge+He|0,Fe^=x<<18|x>>>14;de=de+v|0,Ie=Ie+h|0,se=se+m|0,be=be+S|0,_e=_e+N|0,ne=ne+Z|0,O=O+F|0,T=T+ye|0,H=H+L|0,P=P+xe|0,D=D+ge|0,G=G+Ae|0,Re=Re+Be|0,He=He+Oe|0,Ge=Ge+Te|0,Fe=Fe+Ee|0,l[0]=de>>>0&255,l[1]=de>>>8&255,l[2]=de>>>16&255,l[3]=de>>>24&255,l[4]=Ie>>>0&255,l[5]=Ie>>>8&255,l[6]=Ie>>>16&255,l[7]=Ie>>>24&255,l[8]=se>>>0&255,l[9]=se>>>8&255,l[10]=se>>>16&255,l[11]=se>>>24&255,l[12]=be>>>0&255,l[13]=be>>>8&255,l[14]=be>>>16&255,l[15]=be>>>24&255,l[16]=_e>>>0&255,l[17]=_e>>>8&255,l[18]=_e>>>16&255,l[19]=_e>>>24&255,l[20]=ne>>>0&255,l[21]=ne>>>8&255,l[22]=ne>>>16&255,l[23]=ne>>>24&255,l[24]=O>>>0&255,l[25]=O>>>8&255,l[26]=O>>>16&255,l[27]=O>>>24&255,l[28]=T>>>0&255,l[29]=T>>>8&255,l[30]=T>>>16&255,l[31]=T>>>24&255,l[32]=H>>>0&255,l[33]=H>>>8&255,l[34]=H>>>16&255,l[35]=H>>>24&255,l[36]=P>>>0&255,l[37]=P>>>8&255,l[38]=P>>>16&255,l[39]=P>>>24&255,l[40]=D>>>0&255,l[41]=D>>>8&255,l[42]=D>>>16&255,l[43]=D>>>24&255,l[44]=G>>>0&255,l[45]=G>>>8&255,l[46]=G>>>16&255,l[47]=G>>>24&255,l[48]=Re>>>0&255,l[49]=Re>>>8&255,l[50]=Re>>>16&255,l[51]=Re>>>24&255,l[52]=He>>>0&255,l[53]=He>>>8&255,l[54]=He>>>16&255,l[55]=He>>>24&255,l[56]=Ge>>>0&255,l[57]=Ge>>>8&255,l[58]=Ge>>>16&255,l[59]=Ge>>>24&255,l[60]=Fe>>>0&255,l[61]=Fe>>>8&255,l[62]=Fe>>>16&255,l[63]=Fe>>>24&255}function U(l,y,p,a){for(var v=a[0]&255|(a[1]&255)<<8|(a[2]&255)<<16|(a[3]&255)<<24,h=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,m=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,S=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,N=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,Z=a[4]&255|(a[5]&255)<<8|(a[6]&255)<<16|(a[7]&255)<<24,F=y[0]&255|(y[1]&255)<<8|(y[2]&255)<<16|(y[3]&255)<<24,ye=y[4]&255|(y[5]&255)<<8|(y[6]&255)<<16|(y[7]&255)<<24,L=y[8]&255|(y[9]&255)<<8|(y[10]&255)<<16|(y[11]&255)<<24,xe=y[12]&255|(y[13]&255)<<8|(y[14]&255)<<16|(y[15]&255)<<24,ge=a[8]&255|(a[9]&255)<<8|(a[10]&255)<<16|(a[11]&255)<<24,Ae=p[16]&255|(p[17]&255)<<8|(p[18]&255)<<16|(p[19]&255)<<24,Be=p[20]&255|(p[21]&255)<<8|(p[22]&255)<<16|(p[23]&255)<<24,Oe=p[24]&255|(p[25]&255)<<8|(p[26]&255)<<16|(p[27]&255)<<24,Te=p[28]&255|(p[29]&255)<<8|(p[30]&255)<<16|(p[31]&255)<<24,Ee=a[12]&255|(a[13]&255)<<8|(a[14]&255)<<16|(a[15]&255)<<24,de=v,Ie=h,se=m,be=S,_e=N,ne=Z,O=F,T=ye,H=L,P=xe,D=ge,G=Ae,Re=Be,He=Oe,Ge=Te,Fe=Ee,x,Je=0;Je<20;Je+=2)x=de+Re|0,_e^=x<<7|x>>>25,x=_e+de|0,H^=x<<9|x>>>23,x=H+_e|0,Re^=x<<13|x>>>19,x=Re+H|0,de^=x<<18|x>>>14,x=ne+Ie|0,P^=x<<7|x>>>25,x=P+ne|0,He^=x<<9|x>>>23,x=He+P|0,Ie^=x<<13|x>>>19,x=Ie+He|0,ne^=x<<18|x>>>14,x=D+O|0,Ge^=x<<7|x>>>25,x=Ge+D|0,se^=x<<9|x>>>23,x=se+Ge|0,O^=x<<13|x>>>19,x=O+se|0,D^=x<<18|x>>>14,x=Fe+G|0,be^=x<<7|x>>>25,x=be+Fe|0,T^=x<<9|x>>>23,x=T+be|0,G^=x<<13|x>>>19,x=G+T|0,Fe^=x<<18|x>>>14,x=de+be|0,Ie^=x<<7|x>>>25,x=Ie+de|0,se^=x<<9|x>>>23,x=se+Ie|0,be^=x<<13|x>>>19,x=be+se|0,de^=x<<18|x>>>14,x=ne+_e|0,O^=x<<7|x>>>25,x=O+ne|0,T^=x<<9|x>>>23,x=T+O|0,_e^=x<<13|x>>>19,x=_e+T|0,ne^=x<<18|x>>>14,x=D+P|0,G^=x<<7|x>>>25,x=G+D|0,H^=x<<9|x>>>23,x=H+G|0,P^=x<<13|x>>>19,x=P+H|0,D^=x<<18|x>>>14,x=Fe+Ge|0,Re^=x<<7|x>>>25,x=Re+Fe|0,He^=x<<9|x>>>23,x=He+Re|0,Ge^=x<<13|x>>>19,x=Ge+He|0,Fe^=x<<18|x>>>14;l[0]=de>>>0&255,l[1]=de>>>8&255,l[2]=de>>>16&255,l[3]=de>>>24&255,l[4]=ne>>>0&255,l[5]=ne>>>8&255,l[6]=ne>>>16&255,l[7]=ne>>>24&255,l[8]=D>>>0&255,l[9]=D>>>8&255,l[10]=D>>>16&255,l[11]=D>>>24&255,l[12]=Fe>>>0&255,l[13]=Fe>>>8&255,l[14]=Fe>>>16&255,l[15]=Fe>>>24&255,l[16]=O>>>0&255,l[17]=O>>>8&255,l[18]=O>>>16&255,l[19]=O>>>24&255,l[20]=T>>>0&255,l[21]=T>>>8&255,l[22]=T>>>16&255,l[23]=T>>>24&255,l[24]=H>>>0&255,l[25]=H>>>8&255,l[26]=H>>>16&255,l[27]=H>>>24&255,l[28]=P>>>0&255,l[29]=P>>>8&255,l[30]=P>>>16&255,l[31]=P>>>24&255}function fe(l,y,p,a){R(l,y,p,a)}function oe(l,y,p,a){U(l,y,p,a)}var ce=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function X(l,y,p,a,v,h,m){var S=new Uint8Array(16),N=new Uint8Array(64),Z,F;for(F=0;F<16;F++)S[F]=0;for(F=0;F<8;F++)S[F]=h[F];for(;v>=64;){for(fe(N,S,m,ce),F=0;F<64;F++)l[y+F]=p[a+F]^N[F];for(Z=1,F=8;F<16;F++)Z=Z+(S[F]&255)|0,S[F]=Z&255,Z>>>=8;v-=64,y+=64,a+=64}if(v>0)for(fe(N,S,m,ce),F=0;F<v;F++)l[y+F]=p[a+F]^N[F];return 0}function me(l,y,p,a,v){var h=new Uint8Array(16),m=new Uint8Array(64),S,N;for(N=0;N<16;N++)h[N]=0;for(N=0;N<8;N++)h[N]=a[N];for(;p>=64;){for(fe(m,h,v,ce),N=0;N<64;N++)l[y+N]=m[N];for(S=1,N=8;N<16;N++)S=S+(h[N]&255)|0,h[N]=S&255,S>>>=8;p-=64,y+=64}if(p>0)for(fe(m,h,v,ce),N=0;N<p;N++)l[y+N]=m[N];return 0}function $e(l,y,p,a,v){var h=new Uint8Array(32);oe(h,a,v,ce);for(var m=new Uint8Array(8),S=0;S<8;S++)m[S]=a[S+16];return me(l,y,p,m,h)}function ot(l,y,p,a,v,h,m){var S=new Uint8Array(32);oe(S,h,m,ce);for(var N=new Uint8Array(8),Z=0;Z<8;Z++)N[Z]=h[Z+16];return X(l,y,p,a,v,N,S)}var _t=function(l){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var y,p,a,v,h,m,S,N;y=l[0]&255|(l[1]&255)<<8,this.r[0]=y&8191,p=l[2]&255|(l[3]&255)<<8,this.r[1]=(y>>>13|p<<3)&8191,a=l[4]&255|(l[5]&255)<<8,this.r[2]=(p>>>10|a<<6)&7939,v=l[6]&255|(l[7]&255)<<8,this.r[3]=(a>>>7|v<<9)&8191,h=l[8]&255|(l[9]&255)<<8,this.r[4]=(v>>>4|h<<12)&255,this.r[5]=h>>>1&8190,m=l[10]&255|(l[11]&255)<<8,this.r[6]=(h>>>14|m<<2)&8191,S=l[12]&255|(l[13]&255)<<8,this.r[7]=(m>>>11|S<<5)&8065,N=l[14]&255|(l[15]&255)<<8,this.r[8]=(S>>>8|N<<8)&8191,this.r[9]=N>>>5&127,this.pad[0]=l[16]&255|(l[17]&255)<<8,this.pad[1]=l[18]&255|(l[19]&255)<<8,this.pad[2]=l[20]&255|(l[21]&255)<<8,this.pad[3]=l[22]&255|(l[23]&255)<<8,this.pad[4]=l[24]&255|(l[25]&255)<<8,this.pad[5]=l[26]&255|(l[27]&255)<<8,this.pad[6]=l[28]&255|(l[29]&255)<<8,this.pad[7]=l[30]&255|(l[31]&255)<<8};_t.prototype.blocks=function(l,y,p){for(var a=this.fin?0:2048,v,h,m,S,N,Z,F,ye,L,xe,ge,Ae,Be,Oe,Te,Ee,de,Ie,se,be=this.h[0],_e=this.h[1],ne=this.h[2],O=this.h[3],T=this.h[4],H=this.h[5],P=this.h[6],D=this.h[7],G=this.h[8],Re=this.h[9],He=this.r[0],Ge=this.r[1],Fe=this.r[2],x=this.r[3],Je=this.r[4],ft=this.r[5],ht=this.r[6],Ze=this.r[7],ct=this.r[8],lt=this.r[9];p>=16;)v=l[y+0]&255|(l[y+1]&255)<<8,be+=v&8191,h=l[y+2]&255|(l[y+3]&255)<<8,_e+=(v>>>13|h<<3)&8191,m=l[y+4]&255|(l[y+5]&255)<<8,ne+=(h>>>10|m<<6)&8191,S=l[y+6]&255|(l[y+7]&255)<<8,O+=(m>>>7|S<<9)&8191,N=l[y+8]&255|(l[y+9]&255)<<8,T+=(S>>>4|N<<12)&8191,H+=N>>>1&8191,Z=l[y+10]&255|(l[y+11]&255)<<8,P+=(N>>>14|Z<<2)&8191,F=l[y+12]&255|(l[y+13]&255)<<8,D+=(Z>>>11|F<<5)&8191,ye=l[y+14]&255|(l[y+15]&255)<<8,G+=(F>>>8|ye<<8)&8191,Re+=ye>>>5|a,L=0,xe=L,xe+=be*He,xe+=_e*(5*lt),xe+=ne*(5*ct),xe+=O*(5*Ze),xe+=T*(5*ht),L=xe>>>13,xe&=8191,xe+=H*(5*ft),xe+=P*(5*Je),xe+=D*(5*x),xe+=G*(5*Fe),xe+=Re*(5*Ge),L+=xe>>>13,xe&=8191,ge=L,ge+=be*Ge,ge+=_e*He,ge+=ne*(5*lt),ge+=O*(5*ct),ge+=T*(5*Ze),L=ge>>>13,ge&=8191,ge+=H*(5*ht),ge+=P*(5*ft),ge+=D*(5*Je),ge+=G*(5*x),ge+=Re*(5*Fe),L+=ge>>>13,ge&=8191,Ae=L,Ae+=be*Fe,Ae+=_e*Ge,Ae+=ne*He,Ae+=O*(5*lt),Ae+=T*(5*ct),L=Ae>>>13,Ae&=8191,Ae+=H*(5*Ze),Ae+=P*(5*ht),Ae+=D*(5*ft),Ae+=G*(5*Je),Ae+=Re*(5*x),L+=Ae>>>13,Ae&=8191,Be=L,Be+=be*x,Be+=_e*Fe,Be+=ne*Ge,Be+=O*He,Be+=T*(5*lt),L=Be>>>13,Be&=8191,Be+=H*(5*ct),Be+=P*(5*Ze),Be+=D*(5*ht),Be+=G*(5*ft),Be+=Re*(5*Je),L+=Be>>>13,Be&=8191,Oe=L,Oe+=be*Je,Oe+=_e*x,Oe+=ne*Fe,Oe+=O*Ge,Oe+=T*He,L=Oe>>>13,Oe&=8191,Oe+=H*(5*lt),Oe+=P*(5*ct),Oe+=D*(5*Ze),Oe+=G*(5*ht),Oe+=Re*(5*ft),L+=Oe>>>13,Oe&=8191,Te=L,Te+=be*ft,Te+=_e*Je,Te+=ne*x,Te+=O*Fe,Te+=T*Ge,L=Te>>>13,Te&=8191,Te+=H*He,Te+=P*(5*lt),Te+=D*(5*ct),Te+=G*(5*Ze),Te+=Re*(5*ht),L+=Te>>>13,Te&=8191,Ee=L,Ee+=be*ht,Ee+=_e*ft,Ee+=ne*Je,Ee+=O*x,Ee+=T*Fe,L=Ee>>>13,Ee&=8191,Ee+=H*Ge,Ee+=P*He,Ee+=D*(5*lt),Ee+=G*(5*ct),Ee+=Re*(5*Ze),L+=Ee>>>13,Ee&=8191,de=L,de+=be*Ze,de+=_e*ht,de+=ne*ft,de+=O*Je,de+=T*x,L=de>>>13,de&=8191,de+=H*Fe,de+=P*Ge,de+=D*He,de+=G*(5*lt),de+=Re*(5*ct),L+=de>>>13,de&=8191,Ie=L,Ie+=be*ct,Ie+=_e*Ze,Ie+=ne*ht,Ie+=O*ft,Ie+=T*Je,L=Ie>>>13,Ie&=8191,Ie+=H*x,Ie+=P*Fe,Ie+=D*Ge,Ie+=G*He,Ie+=Re*(5*lt),L+=Ie>>>13,Ie&=8191,se=L,se+=be*lt,se+=_e*ct,se+=ne*Ze,se+=O*ht,se+=T*ft,L=se>>>13,se&=8191,se+=H*Je,se+=P*x,se+=D*Fe,se+=G*Ge,se+=Re*He,L+=se>>>13,se&=8191,L=(L<<2)+L|0,L=L+xe|0,xe=L&8191,L=L>>>13,ge+=L,be=xe,_e=ge,ne=Ae,O=Be,T=Oe,H=Te,P=Ee,D=de,G=Ie,Re=se,y+=16,p-=16;this.h[0]=be,this.h[1]=_e,this.h[2]=ne,this.h[3]=O,this.h[4]=T,this.h[5]=H,this.h[6]=P,this.h[7]=D,this.h[8]=G,this.h[9]=Re},_t.prototype.finish=function(l,y){var p=new Uint16Array(10),a,v,h,m;if(this.leftover){for(m=this.leftover,this.buffer[m++]=1;m<16;m++)this.buffer[m]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(a=this.h[1]>>>13,this.h[1]&=8191,m=2;m<10;m++)this.h[m]+=a,a=this.h[m]>>>13,this.h[m]&=8191;for(this.h[0]+=a*5,a=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=a,a=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=a,p[0]=this.h[0]+5,a=p[0]>>>13,p[0]&=8191,m=1;m<10;m++)p[m]=this.h[m]+a,a=p[m]>>>13,p[m]&=8191;for(p[9]-=8192,v=(a^1)-1,m=0;m<10;m++)p[m]&=v;for(v=~v,m=0;m<10;m++)this.h[m]=this.h[m]&v|p[m];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,h=this.h[0]+this.pad[0],this.h[0]=h&65535,m=1;m<8;m++)h=(this.h[m]+this.pad[m]|0)+(h>>>16)|0,this.h[m]=h&65535;l[y+0]=this.h[0]>>>0&255,l[y+1]=this.h[0]>>>8&255,l[y+2]=this.h[1]>>>0&255,l[y+3]=this.h[1]>>>8&255,l[y+4]=this.h[2]>>>0&255,l[y+5]=this.h[2]>>>8&255,l[y+6]=this.h[3]>>>0&255,l[y+7]=this.h[3]>>>8&255,l[y+8]=this.h[4]>>>0&255,l[y+9]=this.h[4]>>>8&255,l[y+10]=this.h[5]>>>0&255,l[y+11]=this.h[5]>>>8&255,l[y+12]=this.h[6]>>>0&255,l[y+13]=this.h[6]>>>8&255,l[y+14]=this.h[7]>>>0&255,l[y+15]=this.h[7]>>>8&255},_t.prototype.update=function(l,y,p){var a,v;if(this.leftover){for(v=16-this.leftover,v>p&&(v=p),a=0;a<v;a++)this.buffer[this.leftover+a]=l[y+a];if(p-=v,y+=v,this.leftover+=v,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(p>=16&&(v=p-p%16,this.blocks(l,y,v),y+=v,p-=v),p){for(a=0;a<p;a++)this.buffer[this.leftover+a]=l[y+a];this.leftover+=p}};function Et(l,y,p,a,v,h){var m=new _t(h);return m.update(p,a,v),m.finish(l,y),0}function ut(l,y,p,a,v,h){var m=new Uint8Array(16);return Et(m,0,p,a,v,h),B(l,y,m,0)}function yt(l,y,p,a,v){var h;if(p<32)return-1;for(ot(l,0,y,0,p,a,v),Et(l,16,l,32,p-32,l),h=0;h<16;h++)l[h]=0;return 0}function Qe(l,y,p,a,v){var h,m=new Uint8Array(32);if(p<32||($e(m,0,32,a,v),ut(y,16,y,32,p-32,m)!==0))return-1;for(ot(l,0,y,0,p,a,v),h=0;h<32;h++)l[h]=0;return 0}function Ke(l,y){var p;for(p=0;p<16;p++)l[p]=y[p]|0}function ae(l){var y,p,a=1;for(y=0;y<16;y++)p=l[y]+a+65535,a=Math.floor(p/65536),l[y]=p-a*65536;l[0]+=a-1+37*(a-1)}function Ne(l,y,p){for(var a,v=~(p-1),h=0;h<16;h++)a=v&(l[h]^y[h]),l[h]^=a,y[h]^=a}function pt(l,y){var p,a,v,h=t(),m=t();for(p=0;p<16;p++)m[p]=y[p];for(ae(m),ae(m),ae(m),a=0;a<2;a++){for(h[0]=m[0]-65517,p=1;p<15;p++)h[p]=m[p]-65535-(h[p-1]>>16&1),h[p-1]&=65535;h[15]=m[15]-32767-(h[14]>>16&1),v=h[15]>>16&1,h[14]&=65535,Ne(m,h,1-v)}for(p=0;p<16;p++)l[2*p]=m[p]&255,l[2*p+1]=m[p]>>8}function It(l,y){var p=new Uint8Array(32),a=new Uint8Array(32);return pt(p,l),pt(a,y),I(p,0,a,0)}function Ct(l){var y=new Uint8Array(32);return pt(y,l),y[0]&1}function he(l,y){var p;for(p=0;p<16;p++)l[p]=y[2*p]+(y[2*p+1]<<8);l[15]&=32767}function tt(l,y,p){for(var a=0;a<16;a++)l[a]=y[a]+p[a]}function gt(l,y,p){for(var a=0;a<16;a++)l[a]=y[a]-p[a]}function ee(l,y,p){var a,v,h=0,m=0,S=0,N=0,Z=0,F=0,ye=0,L=0,xe=0,ge=0,Ae=0,Be=0,Oe=0,Te=0,Ee=0,de=0,Ie=0,se=0,be=0,_e=0,ne=0,O=0,T=0,H=0,P=0,D=0,G=0,Re=0,He=0,Ge=0,Fe=0,x=p[0],Je=p[1],ft=p[2],ht=p[3],Ze=p[4],ct=p[5],lt=p[6],Lt=p[7],wt=p[8],Ut=p[9],Dt=p[10],$t=p[11],zt=p[12],nr=p[13],ir=p[14],sr=p[15];a=y[0],h+=a*x,m+=a*Je,S+=a*ft,N+=a*ht,Z+=a*Ze,F+=a*ct,ye+=a*lt,L+=a*Lt,xe+=a*wt,ge+=a*Ut,Ae+=a*Dt,Be+=a*$t,Oe+=a*zt,Te+=a*nr,Ee+=a*ir,de+=a*sr,a=y[1],m+=a*x,S+=a*Je,N+=a*ft,Z+=a*ht,F+=a*Ze,ye+=a*ct,L+=a*lt,xe+=a*Lt,ge+=a*wt,Ae+=a*Ut,Be+=a*Dt,Oe+=a*$t,Te+=a*zt,Ee+=a*nr,de+=a*ir,Ie+=a*sr,a=y[2],S+=a*x,N+=a*Je,Z+=a*ft,F+=a*ht,ye+=a*Ze,L+=a*ct,xe+=a*lt,ge+=a*Lt,Ae+=a*wt,Be+=a*Ut,Oe+=a*Dt,Te+=a*$t,Ee+=a*zt,de+=a*nr,Ie+=a*ir,se+=a*sr,a=y[3],N+=a*x,Z+=a*Je,F+=a*ft,ye+=a*ht,L+=a*Ze,xe+=a*ct,ge+=a*lt,Ae+=a*Lt,Be+=a*wt,Oe+=a*Ut,Te+=a*Dt,Ee+=a*$t,de+=a*zt,Ie+=a*nr,se+=a*ir,be+=a*sr,a=y[4],Z+=a*x,F+=a*Je,ye+=a*ft,L+=a*ht,xe+=a*Ze,ge+=a*ct,Ae+=a*lt,Be+=a*Lt,Oe+=a*wt,Te+=a*Ut,Ee+=a*Dt,de+=a*$t,Ie+=a*zt,se+=a*nr,be+=a*ir,_e+=a*sr,a=y[5],F+=a*x,ye+=a*Je,L+=a*ft,xe+=a*ht,ge+=a*Ze,Ae+=a*ct,Be+=a*lt,Oe+=a*Lt,Te+=a*wt,Ee+=a*Ut,de+=a*Dt,Ie+=a*$t,se+=a*zt,be+=a*nr,_e+=a*ir,ne+=a*sr,a=y[6],ye+=a*x,L+=a*Je,xe+=a*ft,ge+=a*ht,Ae+=a*Ze,Be+=a*ct,Oe+=a*lt,Te+=a*Lt,Ee+=a*wt,de+=a*Ut,Ie+=a*Dt,se+=a*$t,be+=a*zt,_e+=a*nr,ne+=a*ir,O+=a*sr,a=y[7],L+=a*x,xe+=a*Je,ge+=a*ft,Ae+=a*ht,Be+=a*Ze,Oe+=a*ct,Te+=a*lt,Ee+=a*Lt,de+=a*wt,Ie+=a*Ut,se+=a*Dt,be+=a*$t,_e+=a*zt,ne+=a*nr,O+=a*ir,T+=a*sr,a=y[8],xe+=a*x,ge+=a*Je,Ae+=a*ft,Be+=a*ht,Oe+=a*Ze,Te+=a*ct,Ee+=a*lt,de+=a*Lt,Ie+=a*wt,se+=a*Ut,be+=a*Dt,_e+=a*$t,ne+=a*zt,O+=a*nr,T+=a*ir,H+=a*sr,a=y[9],ge+=a*x,Ae+=a*Je,Be+=a*ft,Oe+=a*ht,Te+=a*Ze,Ee+=a*ct,de+=a*lt,Ie+=a*Lt,se+=a*wt,be+=a*Ut,_e+=a*Dt,ne+=a*$t,O+=a*zt,T+=a*nr,H+=a*ir,P+=a*sr,a=y[10],Ae+=a*x,Be+=a*Je,Oe+=a*ft,Te+=a*ht,Ee+=a*Ze,de+=a*ct,Ie+=a*lt,se+=a*Lt,be+=a*wt,_e+=a*Ut,ne+=a*Dt,O+=a*$t,T+=a*zt,H+=a*nr,P+=a*ir,D+=a*sr,a=y[11],Be+=a*x,Oe+=a*Je,Te+=a*ft,Ee+=a*ht,de+=a*Ze,Ie+=a*ct,se+=a*lt,be+=a*Lt,_e+=a*wt,ne+=a*Ut,O+=a*Dt,T+=a*$t,H+=a*zt,P+=a*nr,D+=a*ir,G+=a*sr,a=y[12],Oe+=a*x,Te+=a*Je,Ee+=a*ft,de+=a*ht,Ie+=a*Ze,se+=a*ct,be+=a*lt,_e+=a*Lt,ne+=a*wt,O+=a*Ut,T+=a*Dt,H+=a*$t,P+=a*zt,D+=a*nr,G+=a*ir,Re+=a*sr,a=y[13],Te+=a*x,Ee+=a*Je,de+=a*ft,Ie+=a*ht,se+=a*Ze,be+=a*ct,_e+=a*lt,ne+=a*Lt,O+=a*wt,T+=a*Ut,H+=a*Dt,P+=a*$t,D+=a*zt,G+=a*nr,Re+=a*ir,He+=a*sr,a=y[14],Ee+=a*x,de+=a*Je,Ie+=a*ft,se+=a*ht,be+=a*Ze,_e+=a*ct,ne+=a*lt,O+=a*Lt,T+=a*wt,H+=a*Ut,P+=a*Dt,D+=a*$t,G+=a*zt,Re+=a*nr,He+=a*ir,Ge+=a*sr,a=y[15],de+=a*x,Ie+=a*Je,se+=a*ft,be+=a*ht,_e+=a*Ze,ne+=a*ct,O+=a*lt,T+=a*Lt,H+=a*wt,P+=a*Ut,D+=a*Dt,G+=a*$t,Re+=a*zt,He+=a*nr,Ge+=a*ir,Fe+=a*sr,h+=38*Ie,m+=38*se,S+=38*be,N+=38*_e,Z+=38*ne,F+=38*O,ye+=38*T,L+=38*H,xe+=38*P,ge+=38*D,Ae+=38*G,Be+=38*Re,Oe+=38*He,Te+=38*Ge,Ee+=38*Fe,v=1,a=h+v+65535,v=Math.floor(a/65536),h=a-v*65536,a=m+v+65535,v=Math.floor(a/65536),m=a-v*65536,a=S+v+65535,v=Math.floor(a/65536),S=a-v*65536,a=N+v+65535,v=Math.floor(a/65536),N=a-v*65536,a=Z+v+65535,v=Math.floor(a/65536),Z=a-v*65536,a=F+v+65535,v=Math.floor(a/65536),F=a-v*65536,a=ye+v+65535,v=Math.floor(a/65536),ye=a-v*65536,a=L+v+65535,v=Math.floor(a/65536),L=a-v*65536,a=xe+v+65535,v=Math.floor(a/65536),xe=a-v*65536,a=ge+v+65535,v=Math.floor(a/65536),ge=a-v*65536,a=Ae+v+65535,v=Math.floor(a/65536),Ae=a-v*65536,a=Be+v+65535,v=Math.floor(a/65536),Be=a-v*65536,a=Oe+v+65535,v=Math.floor(a/65536),Oe=a-v*65536,a=Te+v+65535,v=Math.floor(a/65536),Te=a-v*65536,a=Ee+v+65535,v=Math.floor(a/65536),Ee=a-v*65536,a=de+v+65535,v=Math.floor(a/65536),de=a-v*65536,h+=v-1+37*(v-1),v=1,a=h+v+65535,v=Math.floor(a/65536),h=a-v*65536,a=m+v+65535,v=Math.floor(a/65536),m=a-v*65536,a=S+v+65535,v=Math.floor(a/65536),S=a-v*65536,a=N+v+65535,v=Math.floor(a/65536),N=a-v*65536,a=Z+v+65535,v=Math.floor(a/65536),Z=a-v*65536,a=F+v+65535,v=Math.floor(a/65536),F=a-v*65536,a=ye+v+65535,v=Math.floor(a/65536),ye=a-v*65536,a=L+v+65535,v=Math.floor(a/65536),L=a-v*65536,a=xe+v+65535,v=Math.floor(a/65536),xe=a-v*65536,a=ge+v+65535,v=Math.floor(a/65536),ge=a-v*65536,a=Ae+v+65535,v=Math.floor(a/65536),Ae=a-v*65536,a=Be+v+65535,v=Math.floor(a/65536),Be=a-v*65536,a=Oe+v+65535,v=Math.floor(a/65536),Oe=a-v*65536,a=Te+v+65535,v=Math.floor(a/65536),Te=a-v*65536,a=Ee+v+65535,v=Math.floor(a/65536),Ee=a-v*65536,a=de+v+65535,v=Math.floor(a/65536),de=a-v*65536,h+=v-1+37*(v-1),l[0]=h,l[1]=m,l[2]=S,l[3]=N,l[4]=Z,l[5]=F,l[6]=ye,l[7]=L,l[8]=xe,l[9]=ge,l[10]=Ae,l[11]=Be,l[12]=Oe,l[13]=Te,l[14]=Ee,l[15]=de}function at(l,y){ee(l,y,y)}function Bt(l,y){var p=t(),a;for(a=0;a<16;a++)p[a]=y[a];for(a=253;a>=0;a--)at(p,p),a!==2&&a!==4&&ee(p,p,y);for(a=0;a<16;a++)l[a]=p[a]}function gn(l,y){var p=t(),a;for(a=0;a<16;a++)p[a]=y[a];for(a=250;a>=0;a--)at(p,p),a!==1&&ee(p,p,y);for(a=0;a<16;a++)l[a]=p[a]}function vn(l,y,p){var a=new Uint8Array(32),v=new Float64Array(80),h,m,S=t(),N=t(),Z=t(),F=t(),ye=t(),L=t();for(m=0;m<31;m++)a[m]=y[m];for(a[31]=y[31]&127|64,a[0]&=248,he(v,p),m=0;m<16;m++)N[m]=v[m],F[m]=S[m]=Z[m]=0;for(S[0]=F[0]=1,m=254;m>=0;--m)h=a[m>>>3]>>>(m&7)&1,Ne(S,N,h),Ne(Z,F,h),tt(ye,S,Z),gt(S,S,Z),tt(Z,N,F),gt(N,N,F),at(F,ye),at(L,S),ee(S,Z,S),ee(Z,N,ye),tt(ye,S,Z),gt(S,S,Z),at(N,S),gt(Z,F,L),ee(S,Z,u),tt(S,S,F),ee(Z,Z,S),ee(S,F,L),ee(F,N,v),at(N,ye),Ne(S,N,h),Ne(Z,F,h);for(m=0;m<16;m++)v[m+16]=S[m],v[m+32]=Z[m],v[m+48]=N[m],v[m+64]=F[m];var xe=v.subarray(32),ge=v.subarray(16);return Bt(xe,xe),ee(ge,ge,xe),pt(l,ge),0}function Ht(l,y){return vn(l,y,s)}function Vi(l,y){return n(y,32),Ht(l,y)}function Mr(l,y,p){var a=new Uint8Array(32);return vn(a,p,y),oe(l,i,a,ce)}var Li=yt,To=Qe;function mn(l,y,p,a,v,h){var m=new Uint8Array(32);return Mr(m,v,h),Li(l,y,p,a,m)}function wn(l,y,p,a,v,h){var m=new Uint8Array(32);return Mr(m,v,h),To(l,y,p,a,m)}var ai=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function ci(l,y,p,a){for(var v=new Int32Array(16),h=new Int32Array(16),m,S,N,Z,F,ye,L,xe,ge,Ae,Be,Oe,Te,Ee,de,Ie,se,be,_e,ne,O,T,H,P,D,G,Re=l[0],He=l[1],Ge=l[2],Fe=l[3],x=l[4],Je=l[5],ft=l[6],ht=l[7],Ze=y[0],ct=y[1],lt=y[2],Lt=y[3],wt=y[4],Ut=y[5],Dt=y[6],$t=y[7],zt=0;a>=128;){for(_e=0;_e<16;_e++)ne=8*_e+zt,v[_e]=p[ne+0]<<24|p[ne+1]<<16|p[ne+2]<<8|p[ne+3],h[_e]=p[ne+4]<<24|p[ne+5]<<16|p[ne+6]<<8|p[ne+7];for(_e=0;_e<80;_e++)if(m=Re,S=He,N=Ge,Z=Fe,F=x,ye=Je,L=ft,xe=ht,ge=Ze,Ae=ct,Be=lt,Oe=Lt,Te=wt,Ee=Ut,de=Dt,Ie=$t,O=ht,T=$t,H=T&65535,P=T>>>16,D=O&65535,G=O>>>16,O=(x>>>14|wt<<18)^(x>>>18|wt<<14)^(wt>>>9|x<<23),T=(wt>>>14|x<<18)^(wt>>>18|x<<14)^(x>>>9|wt<<23),H+=T&65535,P+=T>>>16,D+=O&65535,G+=O>>>16,O=x&Je^~x&ft,T=wt&Ut^~wt&Dt,H+=T&65535,P+=T>>>16,D+=O&65535,G+=O>>>16,O=ai[_e*2],T=ai[_e*2+1],H+=T&65535,P+=T>>>16,D+=O&65535,G+=O>>>16,O=v[_e%16],T=h[_e%16],H+=T&65535,P+=T>>>16,D+=O&65535,G+=O>>>16,P+=H>>>16,D+=P>>>16,G+=D>>>16,se=D&65535|G<<16,be=H&65535|P<<16,O=se,T=be,H=T&65535,P=T>>>16,D=O&65535,G=O>>>16,O=(Re>>>28|Ze<<4)^(Ze>>>2|Re<<30)^(Ze>>>7|Re<<25),T=(Ze>>>28|Re<<4)^(Re>>>2|Ze<<30)^(Re>>>7|Ze<<25),H+=T&65535,P+=T>>>16,D+=O&65535,G+=O>>>16,O=Re&He^Re&Ge^He&Ge,T=Ze&ct^Ze&lt^ct&lt,H+=T&65535,P+=T>>>16,D+=O&65535,G+=O>>>16,P+=H>>>16,D+=P>>>16,G+=D>>>16,xe=D&65535|G<<16,Ie=H&65535|P<<16,O=Z,T=Oe,H=T&65535,P=T>>>16,D=O&65535,G=O>>>16,O=se,T=be,H+=T&65535,P+=T>>>16,D+=O&65535,G+=O>>>16,P+=H>>>16,D+=P>>>16,G+=D>>>16,Z=D&65535|G<<16,Oe=H&65535|P<<16,He=m,Ge=S,Fe=N,x=Z,Je=F,ft=ye,ht=L,Re=xe,ct=ge,lt=Ae,Lt=Be,wt=Oe,Ut=Te,Dt=Ee,$t=de,Ze=Ie,_e%16===15)for(ne=0;ne<16;ne++)O=v[ne],T=h[ne],H=T&65535,P=T>>>16,D=O&65535,G=O>>>16,O=v[(ne+9)%16],T=h[(ne+9)%16],H+=T&65535,P+=T>>>16,D+=O&65535,G+=O>>>16,se=v[(ne+1)%16],be=h[(ne+1)%16],O=(se>>>1|be<<31)^(se>>>8|be<<24)^se>>>7,T=(be>>>1|se<<31)^(be>>>8|se<<24)^(be>>>7|se<<25),H+=T&65535,P+=T>>>16,D+=O&65535,G+=O>>>16,se=v[(ne+14)%16],be=h[(ne+14)%16],O=(se>>>19|be<<13)^(be>>>29|se<<3)^se>>>6,T=(be>>>19|se<<13)^(se>>>29|be<<3)^(be>>>6|se<<26),H+=T&65535,P+=T>>>16,D+=O&65535,G+=O>>>16,P+=H>>>16,D+=P>>>16,G+=D>>>16,v[ne]=D&65535|G<<16,h[ne]=H&65535|P<<16;O=Re,T=Ze,H=T&65535,P=T>>>16,D=O&65535,G=O>>>16,O=l[0],T=y[0],H+=T&65535,P+=T>>>16,D+=O&65535,G+=O>>>16,P+=H>>>16,D+=P>>>16,G+=D>>>16,l[0]=Re=D&65535|G<<16,y[0]=Ze=H&65535|P<<16,O=He,T=ct,H=T&65535,P=T>>>16,D=O&65535,G=O>>>16,O=l[1],T=y[1],H+=T&65535,P+=T>>>16,D+=O&65535,G+=O>>>16,P+=H>>>16,D+=P>>>16,G+=D>>>16,l[1]=He=D&65535|G<<16,y[1]=ct=H&65535|P<<16,O=Ge,T=lt,H=T&65535,P=T>>>16,D=O&65535,G=O>>>16,O=l[2],T=y[2],H+=T&65535,P+=T>>>16,D+=O&65535,G+=O>>>16,P+=H>>>16,D+=P>>>16,G+=D>>>16,l[2]=Ge=D&65535|G<<16,y[2]=lt=H&65535|P<<16,O=Fe,T=Lt,H=T&65535,P=T>>>16,D=O&65535,G=O>>>16,O=l[3],T=y[3],H+=T&65535,P+=T>>>16,D+=O&65535,G+=O>>>16,P+=H>>>16,D+=P>>>16,G+=D>>>16,l[3]=Fe=D&65535|G<<16,y[3]=Lt=H&65535|P<<16,O=x,T=wt,H=T&65535,P=T>>>16,D=O&65535,G=O>>>16,O=l[4],T=y[4],H+=T&65535,P+=T>>>16,D+=O&65535,G+=O>>>16,P+=H>>>16,D+=P>>>16,G+=D>>>16,l[4]=x=D&65535|G<<16,y[4]=wt=H&65535|P<<16,O=Je,T=Ut,H=T&65535,P=T>>>16,D=O&65535,G=O>>>16,O=l[5],T=y[5],H+=T&65535,P+=T>>>16,D+=O&65535,G+=O>>>16,P+=H>>>16,D+=P>>>16,G+=D>>>16,l[5]=Je=D&65535|G<<16,y[5]=Ut=H&65535|P<<16,O=ft,T=Dt,H=T&65535,P=T>>>16,D=O&65535,G=O>>>16,O=l[6],T=y[6],H+=T&65535,P+=T>>>16,D+=O&65535,G+=O>>>16,P+=H>>>16,D+=P>>>16,G+=D>>>16,l[6]=ft=D&65535|G<<16,y[6]=Dt=H&65535|P<<16,O=ht,T=$t,H=T&65535,P=T>>>16,D=O&65535,G=O>>>16,O=l[7],T=y[7],H+=T&65535,P+=T>>>16,D+=O&65535,G+=O>>>16,P+=H>>>16,D+=P>>>16,G+=D>>>16,l[7]=ht=D&65535|G<<16,y[7]=$t=H&65535|P<<16,zt+=128,a-=128}return a}function hr(l,y,p){var a=new Int32Array(8),v=new Int32Array(8),h=new Uint8Array(256),m,S=p;for(a[0]=1779033703,a[1]=3144134277,a[2]=1013904242,a[3]=2773480762,a[4]=1359893119,a[5]=2600822924,a[6]=528734635,a[7]=1541459225,v[0]=4089235720,v[1]=2227873595,v[2]=4271175723,v[3]=1595750129,v[4]=2917565137,v[5]=725511199,v[6]=4215389547,v[7]=327033209,ci(a,v,y,p),p%=128,m=0;m<p;m++)h[m]=y[S-p+m];for(h[p]=128,p=256-128*(p<112?1:0),h[p-9]=0,w(h,p-8,S/536870912|0,S<<3),ci(a,v,h,p),m=0;m<8;m++)w(l,8*m,a[m],v[m]);return 0}function Dn(l,y){var p=t(),a=t(),v=t(),h=t(),m=t(),S=t(),N=t(),Z=t(),F=t();gt(p,l[1],l[0]),gt(F,y[1],y[0]),ee(p,p,F),tt(a,l[0],l[1]),tt(F,y[0],y[1]),ee(a,a,F),ee(v,l[3],y[3]),ee(v,v,b),ee(h,l[2],y[2]),tt(h,h,h),gt(m,a,p),gt(S,h,v),tt(N,h,v),tt(Z,a,p),ee(l[0],m,S),ee(l[1],Z,N),ee(l[2],N,S),ee(l[3],m,Z)}function li(l,y,p){var a;for(a=0;a<4;a++)Ne(l[a],y[a],p)}function $n(l,y){var p=t(),a=t(),v=t();Bt(v,y[2]),ee(p,y[0],v),ee(a,y[1],v),pt(l,a),l[31]^=Ct(p)<<7}function Hi(l,y,p){var a,v;for(Ke(l[0],o),Ke(l[1],c),Ke(l[2],c),Ke(l[3],o),v=255;v>=0;--v)a=p[v/8|0]>>(v&7)&1,li(l,y,a),Dn(y,l),Dn(l,l),li(l,y,a)}function ui(l,y){var p=[t(),t(),t(),t()];Ke(p[0],_),Ke(p[1],q),Ke(p[2],c),ee(p[3],_,q),Hi(l,p,y)}function fi(l,y,p){var a=new Uint8Array(64),v=[t(),t(),t(),t()],h;for(p||n(y,32),hr(a,y,32),a[0]&=248,a[31]&=127,a[31]|=64,ui(v,a),$n(l,v),h=0;h<32;h++)y[h+32]=l[h];return 0}var Or=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Qr(l,y){var p,a,v,h;for(a=63;a>=32;--a){for(p=0,v=a-32,h=a-12;v<h;++v)y[v]+=p-16*y[a]*Or[v-(a-32)],p=Math.floor((y[v]+128)/256),y[v]-=p*256;y[v]+=p,y[a]=0}for(p=0,v=0;v<32;v++)y[v]+=p-(y[31]>>4)*Or[v],p=y[v]>>8,y[v]&=255;for(v=0;v<32;v++)y[v]-=p*Or[v];for(a=0;a<32;a++)y[a+1]+=y[a]>>8,l[a]=y[a]&255}function Fi(l){var y=new Float64Array(64),p;for(p=0;p<64;p++)y[p]=l[p];for(p=0;p<64;p++)l[p]=0;Qr(l,y)}function Gi(l,y,p,a){var v=new Uint8Array(64),h=new Uint8Array(64),m=new Uint8Array(64),S,N,Z=new Float64Array(64),F=[t(),t(),t(),t()];hr(v,a,32),v[0]&=248,v[31]&=127,v[31]|=64;var ye=p+64;for(S=0;S<p;S++)l[64+S]=y[S];for(S=0;S<32;S++)l[32+S]=v[32+S];for(hr(m,l.subarray(32),p+32),Fi(m),ui(F,m),$n(l,F),S=32;S<64;S++)l[S]=a[S];for(hr(h,l,p+64),Fi(h),S=0;S<64;S++)Z[S]=0;for(S=0;S<32;S++)Z[S]=m[S];for(S=0;S<32;S++)for(N=0;N<32;N++)Z[S+N]+=h[S]*v[N];return Qr(l.subarray(32),Z),ye}function hi(l,y){var p=t(),a=t(),v=t(),h=t(),m=t(),S=t(),N=t();return Ke(l[2],c),he(l[1],y),at(v,l[1]),ee(h,v,d),gt(v,v,l[2]),tt(h,l[2],h),at(m,h),at(S,m),ee(N,S,m),ee(p,N,v),ee(p,p,h),gn(p,p),ee(p,p,v),ee(p,p,h),ee(p,p,h),ee(l[0],p,h),at(a,l[0]),ee(a,a,h),It(a,v)&&ee(l[0],l[0],$),at(a,l[0]),ee(a,a,h),It(a,v)?-1:(Ct(l[0])===y[31]>>7&&gt(l[0],o,l[0]),ee(l[3],l[0],l[1]),0)}function k(l,y,p,a){var v,h=new Uint8Array(32),m=new Uint8Array(64),S=[t(),t(),t(),t()],N=[t(),t(),t(),t()];if(p<64||hi(N,a))return-1;for(v=0;v<p;v++)l[v]=y[v];for(v=0;v<32;v++)l[v+32]=a[v];if(hr(m,l,p),Fi(m),Hi(S,N,m),ui(N,y.subarray(32)),Dn(S,N),$n(h,S),p-=64,I(y,0,h,0)){for(v=0;v<p;v++)l[v]=0;return-1}for(v=0;v<p;v++)l[v]=y[v+64];return p}var C=32,j=24,W=32,ke=16,xt=32,At=32,Ue=32,J=32,te=32,re=j,we=W,Le=ke,et=64,vt=32,Vt=64,di=32,pi=64;e.lowlevel={crypto_core_hsalsa20:oe,crypto_stream_xor:ot,crypto_stream:$e,crypto_stream_salsa20_xor:X,crypto_stream_salsa20:me,crypto_onetimeauth:Et,crypto_onetimeauth_verify:ut,crypto_verify_16:B,crypto_verify_32:I,crypto_secretbox:yt,crypto_secretbox_open:Qe,crypto_scalarmult:vn,crypto_scalarmult_base:Ht,crypto_box_beforenm:Mr,crypto_box_afternm:Li,crypto_box:mn,crypto_box_open:wn,crypto_box_keypair:Vi,crypto_hash:hr,crypto_sign:Gi,crypto_sign_keypair:fi,crypto_sign_open:k,crypto_secretbox_KEYBYTES:C,crypto_secretbox_NONCEBYTES:j,crypto_secretbox_ZEROBYTES:W,crypto_secretbox_BOXZEROBYTES:ke,crypto_scalarmult_BYTES:xt,crypto_scalarmult_SCALARBYTES:At,crypto_box_PUBLICKEYBYTES:Ue,crypto_box_SECRETKEYBYTES:J,crypto_box_BEFORENMBYTES:te,crypto_box_NONCEBYTES:re,crypto_box_ZEROBYTES:we,crypto_box_BOXZEROBYTES:Le,crypto_sign_BYTES:et,crypto_sign_PUBLICKEYBYTES:vt,crypto_sign_SECRETKEYBYTES:Vt,crypto_sign_SEEDBYTES:di,crypto_hash_BYTES:pi,gf:t,D:d,L:Or,pack25519:pt,unpack25519:he,M:ee,A:tt,S:at,Z:gt,pow2523:gn,add:Dn,set25519:Ke,modL:Qr,scalarmult:Hi,scalarbase:ui};function zi(l,y){if(l.length!==C)throw new Error("bad key size");if(y.length!==j)throw new Error("bad nonce size")}function Sf(l,y){if(l.length!==Ue)throw new Error("bad public key size");if(y.length!==J)throw new Error("bad secret key size")}function dr(){for(var l=0;l<arguments.length;l++)if(!(arguments[l]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function No(l){for(var y=0;y<l.length;y++)l[y]=0}e.randomBytes=function(l){var y=new Uint8Array(l);return n(y,l),y},e.secretbox=function(l,y,p){dr(l,y,p),zi(p,y);for(var a=new Uint8Array(W+l.length),v=new Uint8Array(a.length),h=0;h<l.length;h++)a[h+W]=l[h];return yt(v,a,a.length,y,p),v.subarray(ke)},e.secretbox.open=function(l,y,p){dr(l,y,p),zi(p,y);for(var a=new Uint8Array(ke+l.length),v=new Uint8Array(a.length),h=0;h<l.length;h++)a[h+ke]=l[h];return a.length<32||Qe(v,a,a.length,y,p)!==0?null:v.subarray(W)},e.secretbox.keyLength=C,e.secretbox.nonceLength=j,e.secretbox.overheadLength=ke,e.scalarMult=function(l,y){if(dr(l,y),l.length!==At)throw new Error("bad n size");if(y.length!==xt)throw new Error("bad p size");var p=new Uint8Array(xt);return vn(p,l,y),p},e.scalarMult.base=function(l){if(dr(l),l.length!==At)throw new Error("bad n size");var y=new Uint8Array(xt);return Ht(y,l),y},e.scalarMult.scalarLength=At,e.scalarMult.groupElementLength=xt,e.box=function(l,y,p,a){var v=e.box.before(p,a);return e.secretbox(l,y,v)},e.box.before=function(l,y){dr(l,y),Sf(l,y);var p=new Uint8Array(te);return Mr(p,l,y),p},e.box.after=e.secretbox,e.box.open=function(l,y,p,a){var v=e.box.before(p,a);return e.secretbox.open(l,y,v)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var l=new Uint8Array(Ue),y=new Uint8Array(J);return Vi(l,y),{publicKey:l,secretKey:y}},e.box.keyPair.fromSecretKey=function(l){if(dr(l),l.length!==J)throw new Error("bad secret key size");var y=new Uint8Array(Ue);return Ht(y,l),{publicKey:y,secretKey:new Uint8Array(l)}},e.box.publicKeyLength=Ue,e.box.secretKeyLength=J,e.box.sharedKeyLength=te,e.box.nonceLength=re,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(l,y){if(dr(l,y),y.length!==Vt)throw new Error("bad secret key size");var p=new Uint8Array(et+l.length);return Gi(p,l,l.length,y),p},e.sign.open=function(l,y){if(dr(l,y),y.length!==vt)throw new Error("bad public key size");var p=new Uint8Array(l.length),a=k(p,l,l.length,y);if(a<0)return null;for(var v=new Uint8Array(a),h=0;h<v.length;h++)v[h]=p[h];return v},e.sign.detached=function(l,y){for(var p=e.sign(l,y),a=new Uint8Array(et),v=0;v<a.length;v++)a[v]=p[v];return a},e.sign.detached.verify=function(l,y,p){if(dr(l,y,p),y.length!==et)throw new Error("bad signature size");if(p.length!==vt)throw new Error("bad public key size");var a=new Uint8Array(et+l.length),v=new Uint8Array(et+l.length),h;for(h=0;h<et;h++)a[h]=y[h];for(h=0;h<l.length;h++)a[h+et]=l[h];return k(v,a,a.length,p)>=0},e.sign.keyPair=function(){var l=new Uint8Array(vt),y=new Uint8Array(Vt);return fi(l,y),{publicKey:l,secretKey:y}},e.sign.keyPair.fromSecretKey=function(l){if(dr(l),l.length!==Vt)throw new Error("bad secret key size");for(var y=new Uint8Array(vt),p=0;p<y.length;p++)y[p]=l[32+p];return{publicKey:y,secretKey:new Uint8Array(l)}},e.sign.keyPair.fromSeed=function(l){if(dr(l),l.length!==di)throw new Error("bad seed size");for(var y=new Uint8Array(vt),p=new Uint8Array(Vt),a=0;a<32;a++)p[a]=l[a];return fi(y,p,!0),{publicKey:y,secretKey:p}},e.sign.publicKeyLength=vt,e.sign.secretKeyLength=Vt,e.sign.seedLength=di,e.sign.signatureLength=et,e.hash=function(l){dr(l);var y=new Uint8Array(pi);return hr(y,l,l.length),y},e.hash.hashLength=pi,e.verify=function(l,y){return dr(l,y),l.length===0||y.length===0||l.length!==y.length?!1:E(l,0,y,0,l.length)===0},e.setPRNG=function(l){n=l},function(){var l=typeof self<"u"?self.crypto||self.msCrypto:null;if(l&&l.getRandomValues){var y=65536;e.setPRNG(function(p,a){var v,h=new Uint8Array(a);for(v=0;v<a;v+=y)l.getRandomValues(h.subarray(v,v+Math.min(a-v,y)));for(v=0;v<a;v++)p[v]=h[v];No(h)})}else typeof H1<"u"&&(l=F1,l&&l.randomBytes&&e.setPRNG(function(p,a){var v,h=l.randomBytes(a);for(v=0;v<a;v++)p[v]=h[v];No(h)}))}()})(r.exports?r.exports:self.nacl=self.nacl||{})})(O0);var G1=O0.exports;const T0=Wi(G1);function z1(){return T0.box.keyPair()}async function Bo(r,e){const t=sessionStorage.getItem("sessionKey"),n=sessionStorage.getItem("sessionId");console.groupCollapsed("Attestation");try{if(t&&n&&!r){const o=Cs(t);return console.log("Using existing attestation from session storage."),{sessionKey:o,sessionId:n}}const i=window.crypto.randomUUID();console.log("Generated attestation nonce:",i);const s=await L1(i);if(s&&s.public_key){console.log("Attestation document verification succeeded");const o=z1();console.log("Generated client key pair");const c=new Uint8Array(s.public_key),{encrypted_session_key:u,session_id:d}=await tm(Vr(o.publicKey),i);console.log("Key exchange completed.");const b=T0.scalarMult(o.secretKey,c),_=Cs(u),q=12,$=_.slice(0,q),w=_.slice(q),B=new Hc(b).open($,w);if(B)return console.log("Session key decrypted successfully"),window.sessionStorage.setItem("sessionKey",Vr(B)),window.sessionStorage.setItem("sessionId",d),{sessionKey:B,sessionId:d};throw new Error("Failed to decrypt session key")}else throw new Error("Invalid attestation document")}catch(i){throw console.error("Error verifying attestation:",i),i}finally{console.groupEnd()}}async function Ir(r,e,t,n){const i=async(s=!1)=>{try{s&&(console.log("Refreshing access token"),await Rc());const o=window.localStorage.getItem("access_token");if(!o)throw new Error("No access token available");const c=await N0(r,e,t,o,n);if(c.status===401&&!s)return console.log("Received 401, attempting to refresh token"),i(!0);if(c.error)throw new Error(c.error);if(!c.data)throw new Error("No data received from the server");return c.data}catch(o){throw console.error(o),o}};return i()}async function N0(r,e,t,n,i){let{sessionKey:s,sessionId:o}=await Bo();const c=async(d,b=!1)=>{if(b||!s||!o){const B=await Bo(!0);s=B.sessionKey,o=B.sessionId}if(!s||!o)throw new Error("Failed to make encrypted API call, no attestation available.");const _=t?JSON.stringify(t):void 0,q=_?jf(s,_):void 0,$={"Content-Type":"application/json","x-session-id":o};d&&($.Authorization=`Bearer ${d}`);const w=await fetch(r,{method:e,headers:$,body:q?JSON.stringify({encrypted:q}):void 0}),E={status:w.status};if(w.ok)try{const B=await w.json(),I=Pf(s,B.encrypted);E.data=JSON.parse(I)}catch(B){console.error("Error decrypting or parsing response:",B),E.status=500,E.error="Failed to decrypt or parse the response"}else try{const B=await w.json();E.error=B.message||i||`HTTP error! Status: ${w.status}`}catch{E.error=i||`HTTP error! Status: ${w.status}`}return E},u=async(d,b=!1)=>{var _;try{const q=await c(d,b);return(q.status===400||(_=q.error)!=null&&_.includes("Encryption error"))&&!b?(console.log("Encryption error or Bad Request, attempting to renew attestation"),u(d,!0)):q}catch(q){return{status:500,error:q instanceof Error?q.message:"Unknown error occurred"}}};return u(n)}async function Cr(r,e,t,n,i){const s=await N0(r,e,t,n,i);if(s.error)throw new Error(s.error);if(!s.data)throw new Error("No data received from the server");return s.data}let dt="";function K1(r){dt=r}function Z1(){return dt}async function W1(r,e,t){return Cr(`${dt}/login`,"POST",{email:r,password:e,client_id:t})}async function q1(r,e,t){return Cr(`${dt}/login`,"POST",{id:r,password:e,client_id:t})}async function Y1(r,e,t,n,i){return Cr(`${dt}/register`,"POST",{email:r,password:e,inviteCode:t.toLowerCase(),client_id:n,name:i})}async function J1(r,e,t){return Cr(`${dt}/register`,"POST",{password:r,inviteCode:e.toLowerCase(),client_id:t})}async function Rc(){const r=window.localStorage.getItem("refresh_token");if(!r)throw new Error("No refresh token available");const e={refresh_token:r};try{const t=await Cr(`${dt}/refresh`,"POST",e,void 0,"Failed to refresh token");return window.localStorage.setItem("access_token",t.access_token),window.localStorage.setItem("refresh_token",t.refresh_token),t}catch(t){throw console.error("Error refreshing token:",t),t}}async function X1(){return Ir(`${dt}/protected/user`,"GET",void 0,"Failed to fetch user")}async function R0(r,e){return Ir(`${dt}/protected/kv/${r}`,"PUT",e,"Failed to put key-value pair")}async function j0(r){return Ir(`${dt}/protected/kv/${r}`,"DELETE",void 0,"Failed to delete key-value pair")}async function P0(r){try{return await Ir(`${dt}/protected/kv/${r}`,"GET",void 0,"Failed to get key-value pair")}catch(e){console.error(`Error fetching key "${r}":`,e);return}}async function U0(){return Ir(`${dt}/protected/kv`,"GET",void 0,"Failed to list key-value pairs")}async function Q1(r){const e={refresh_token:r};return Cr(`${dt}/logout`,"POST",e)}async function D0(r){return Cr(`${dt}/verify-email/${r}`,"GET",void 0,void 0,"Failed to verify email")}async function jc(){return Ir(`${dt}/protected/request_verification`,"POST",void 0,"Failed to request new verification code")}async function em(r){const e=await fetch(`${dt}/attestation/${r}`);if(!e.ok)throw new Error(`Request failed with status ${e.status}`);return(await e.json()).attestation_document}async function tm(r,e){const t=await fetch(`${dt}/key_exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_public_key:r,nonce:e})});if(!t.ok)throw new Error("Key exchange failed");return t.json()}async function rm(r,e,t){const n={email:r,hashed_secret:e,client_id:t};return Cr(`${dt}/password-reset/request`,"POST",n,void 0,"Failed to request password reset")}async function nm(r,e,t,n,i){const s={email:r,alphanumeric_code:e,plaintext_secret:t,new_password:n,client_id:i};return Cr(`${dt}/password-reset/confirm`,"POST",s,void 0,"Failed to confirm password reset")}async function $0(r,e){const t={current_password:r,new_password:e};return Ir(`${dt}/protected/change_password`,"POST",t,"Failed to change password")}async function im(r,e){try{return await Cr(`${dt}/auth/github`,"POST",e?{invite_code:e,client_id:r}:{client_id:r},void 0,"Failed to initiate GitHub auth")}catch(t){throw t instanceof Error&&t.message.includes("Invalid invite code")?new Error("Invalid invite code. Please check and try again."):t}}async function sm(r,e,t){const n={code:r,state:e,invite_code:t};try{return await Cr(`${dt}/auth/github/callback`,"POST",n,void 0,"GitHub callback failed")}catch(i){throw console.error("Detailed GitHub callback error:",i),i instanceof Error?i.message.includes("User exists")||i.message.includes("Email already registered")?new Error("An account with this email already exists. Please sign in using your existing account."):i.message.includes("Invalid invite code")?new Error("Invalid invite code. Please try signing up with a valid invite code."):i.message.includes("User not found")?new Error("User not found. Please sign up first before attempting to log in with GitHub."):new Error("Failed to authenticate with GitHub. Please try again."):i}}async function om(r,e){try{return await Cr(`${dt}/auth/google`,"POST",e?{invite_code:e,client_id:r}:{client_id:r},void 0,"Failed to initiate Google auth")}catch(t){throw t instanceof Error&&t.message.includes("Invalid invite code")?new Error("Invalid invite code. Please check and try again."):t}}async function am(r,e,t){const n={code:r,state:e,invite_code:t};try{return await Cr(`${dt}/auth/google/callback`,"POST",n,void 0,"Google callback failed")}catch(i){throw console.error("Detailed Google callback error:",i),i instanceof Error?i.message.includes("User exists")||i.message.includes("Email already registered")?new Error("An account with this email already exists. Please sign in using your existing account."):i.message.includes("Invalid invite code")?new Error("Invalid invite code. Please try signing up with a valid invite code."):i.message.includes("User not found")?new Error("User not found. Please sign up first before attempting to log in with Google."):new Error("Failed to authenticate with Google. Please try again."):i}}async function M0(){return Ir(`${dt}/protected/private_key`,"GET",void 0,"Failed to fetch private key")}async function V0(r){const e=r?`${dt}/protected/private_key_bytes?derivation_path=${encodeURIComponent(r)}`:`${dt}/protected/private_key_bytes`;return Ir(e,"GET",void 0,"Failed to fetch private key bytes")}async function L0(r,e,t){const n=Vr(r);return Ir(`${dt}/protected/sign_message`,"POST",{message_base64:n,algorithm:e,derivation_path:t},"Failed to sign message")}async function H0(r,e){const t=e?`${dt}/protected/public_key?algorithm=${r}&derivation_path=${encodeURIComponent(e)}`:`${dt}/protected/public_key?algorithm=${r}`;return Ir(t,"GET",void 0,"Failed to fetch public key")}async function cm(r,e,t){const n={email:r,password:e,...t!==void 0&&{name:t}};return Ir(`${dt}/protected/convert_guest`,"POST",n,"Failed to convert guest account")}async function lm(r){return Ir(`${dt}/protected/third_party_token`,"POST",{audience:r},"Failed to generate third party token")}function um(){return async(r,e)=>{var n,i;const t=()=>{const s=window.localStorage.getItem("access_token");if(!s)throw new Error("No access token available");return`Bearer ${s}`};try{const s=new Headers(e==null?void 0:e.headers);s.set("Authorization",t());const{sessionKey:o,sessionId:c}=await Bo();if(!o||!c)throw new Error("No session key or ID available");s.set("x-session-id",c);const u={...e,headers:s};if(e!=null&&e.body){const b=jf(o,e.body);u.body=JSON.stringify({encrypted:b}),s.set("Content-Type","application/json")}let d=await fetch(r,u);if(d.status===401&&(console.warn("Unauthorized, refreshing access token"),await Rc(),s.set("Authorization",t()),u.headers=s,d=await fetch(r,u)),!d.ok){const b=await d.text();throw console.error("Request failed with response status:",d.status," and message:",b),new Error(`Request failed with status ${d.status}: ${b}`)}if((n=d.headers.get("content-type"))!=null&&n.includes("text/event-stream")){const b=(i=d.body)==null?void 0:i.getReader(),_=new TextDecoder;let q="";const $=new ReadableStream({async start(w){for(;;){const{done:E,value:B}=await b.read();if(E)break;const I=_.decode(B);q+=I;let R;for(;R=fm(q);)if(q=q.slice(R.length),R.trim().startsWith("data: ")){const U=R.slice(6).trim();if(U==="[DONE]")w.enqueue(`data: [DONE]
155
155
 
156
- `);else try{console.groupCollapsed("Decrypting chunk"),console.log("Attempting to decrypt, data length:",P.length);const K=Pf(o,P);console.log("Decrypted data length:",K.length),console.log("Decrypted data:",K);try{const de=JSON.parse(K);console.log("Parsed JSON:",de),w.enqueue(`data: ${JSON.stringify(de)}
156
+ `);else try{console.groupCollapsed("Decrypting chunk"),console.log("Attempting to decrypt, data length:",U.length);const fe=Pf(o,U);console.log("Decrypted data length:",fe.length),console.log("Decrypted data:",fe);try{const oe=JSON.parse(fe);console.log("Parsed JSON:",oe),w.enqueue(`data: ${JSON.stringify(oe)}
157
157
 
158
- `)}catch(de){de instanceof SyntaxError&&(console.log("Failed to parse JSON:",K),w.enqueue(`data: ${K}
158
+ `)}catch(oe){oe instanceof SyntaxError&&(console.log("Failed to parse JSON:",fe),w.enqueue(`data: ${fe}
159
159
 
160
- `))}}catch(K){console.error("Decryption error:",K,"Data:",P),console.log("Skipping corrupted chunk")}finally{console.groupEnd()}}}w.close()}});return new Response($,{headers:d.headers,status:d.status,statusText:d.statusText})}return d}catch(s){throw console.error("Error during fetch process:",s),s}}}function fm(r){const e=r.indexOf(`
160
+ `))}}catch(fe){console.error("Decryption error:",fe,"Data:",U),console.log("Skipping corrupted chunk")}finally{console.groupEnd()}}}w.close()}});return new Response($,{headers:d.headers,status:d.status,statusText:d.statusText})}return d}catch(s){throw console.error("Error during fetch process:",s),s}}}function fm(r){const e=r.indexOf(`
161
161
 
162
- `);return e===-1?null:r.slice(0,e+2)}const hm=["eeddbb58f57c38894d6d5af5e575fbe791c5bf3bbcfb5df8da8cfcf0c2e1da1913108e6a762112444740b88c163d7f4b","74ed417f88cb0ca76c4a3d10f278bd010f1d3f95eafb254d4732511bb50e404507a4049b779c5230137e4091a5582271","9043fcab93b972d3c14ad2dc8fa78ca7ad374fc937c02435681772a003f7a72876bc4d578089b5c4cf3fe9b480f1aabb","52c3595b151d93d8b159c257301bfd5aa6f49210de0c55a6cd6df5ebeee44e4206cab950500f5d188f7fa14e6d900b75","91cb67311e910cce68cd5b7d0de77aa40610d87c6681439b44c46c3ff786ae643956ab2c812478a1da8745b259f07a45","859065ac81b81d3735130ba08b8af72a7256b603fefb74faabae25ed28cca6edcaa7c10ea32b5948d675c18a9b0f2b1d","acd82a7d3943e23e95a9dc3ce0b0107ea358d6287f9e3afa245622f7c7e3e0a66142a928b6efcc02f594a95366d3a99d"],dm=["62c0407056217a4c10764ed9045694c29fa93255d3cc04c2f989cdd9a1f8050c8b169714c71f1118ebce2fcc9951d1a9","cb95519905443f9f66f05f63c548b61ad1561a27fd5717b69285861aaea3c3063fe12a2571773b67fea3c6c11b4d8ec6","deb5895831b5e4286f5a2dcf5e9c27383821446f8df2b465f141d10743599be20ba3bb381ce063bf7139cc89f7f61d4c","70ba26c6af1ec3b57ce80e1adcc0ee96d70224d4c7a078f427895cdf68e1c30f09b5ac4c456588d872f3f21ff77c036b","669404ea71435b8f498b48db7816a5c2ab1d258b1a77685b11d84d15a73189504d79c4dee13a658de9f4a0cbfc39cfe8","a791bf92c25ffdfd372660e460a0e238c6778c090672df6509ae4bc065cf8668b6baac6b6a11d554af53ee0ff0172ad5","c4285443b87b9b12a6cea3bef1064ec060f652b235a297095975af8f134e5ed65f92d70d4616fdec80af9dff48bb9f35"];function pm(r,e){const t=[...(e==null?void 0:e.pcr0Values)||[],...hm],n=[...(e==null?void 0:e.pcr0DevValues)||[],...dm];return t.includes(r)?{isMatch:!0,text:"PCR0 matches a known good value"}:n.includes(r)?{isMatch:!0,text:"PCR0 matches development enclave"}:{isMatch:!1,text:"PCR0 does not match a known good value"}}const bf=Tc,z0="641a0321a3e244efe456463195d606317ed7cdcc3c1756e09893f3c68f79bb5b";function K0(r){return Array.from(r).map(e=>e.toString(16).padStart(2,"0")).join("")}async function ym(r){const e=await crypto.subtle.digest("SHA-256",r);return K0(new Uint8Array(e))}async function xf(r,e,t){console.log("Raw timestamp:",r.timestamp),console.log("Date object:",new Date(r.timestamp));const n=Array.from(r.pcrs.entries()).map(([b,S])=>({id:b,value:K0(S)})).filter(b=>!b.value.match(/^0+$/)),i=n.find(b=>b.id===0),s=i?pm(i.value,t):null,o=[...e,r.certificate].map(b=>{const S=new ji(b);return{subject:S.subject,notBefore:S.notBefore.toLocaleString(),notAfter:S.notAfter.toLocaleString(),pem:S.toString("pem"),isRoot:S.subject==="C=US, O=Amazon, OU=AWS, CN=aws.nitro-enclaves"}}),c=new TextDecoder,u=new ji(e[0]),d=await ym(u.rawData);return{moduleId:r.module_id,publicKey:r.public_key?Vr(r.public_key):null,timestamp:new Date(r.timestamp).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:"short"}),digest:r.digest,pcrs:n,certificates:o,userData:r.user_data?c.decode(r.user_data):null,nonce:r.nonce?c.decode(r.nonce):null,cert0hash:d,validatedPcr0Hash:s}}const Af=We.createContext({auth:{loading:!0,user:void 0},signIn:async()=>{},signUp:async()=>{},signInGuest:async()=>{},signUpGuest:async()=>({id:"",email:void 0,access_token:"",refresh_token:""}),convertGuestToUserAccount:async()=>{},signOut:async()=>{},get:P0,put:R0,list:U0,del:j0,verifyEmail:D0,requestNewVerificationCode:jc,requestNewVerificationEmail:jc,refetchUser:async()=>{},changePassword:V0,refreshAccessToken:Rc,requestPasswordReset:$0,confirmPasswordReset:M0,initiateGitHubAuth:async()=>({auth_url:"",csrf_token:""}),handleGitHubCallback:async()=>{},initiateGoogleAuth:async()=>({auth_url:"",csrf_token:""}),handleGoogleCallback:async()=>{},getPrivateKey:L0,getPrivateKeyBytes:H0,getPublicKey:G0,signMessage:F0,aiCustomFetch:async()=>new Response,apiUrl:"",pcrConfig:{},getAttestation:Bo,authenticate:Nc,parseAttestationForView:xf,awsRootCertDer:bf,expectedRootCertHash:z0,getAttestationDocument:async()=>{throw new Error("getAttestationDocument called outside of OpenSecretProvider")},generateThirdPartyToken:async()=>({token:""})});function gm({children:r,apiUrl:e,pcrConfig:t={}}){const[n,i]=We.useState({loading:!0,user:void 0}),[s,o]=We.useState();We.useEffect(()=>{if(!e||e.trim()==="")throw new Error("OpenSecretProvider requires a non-empty apiUrl. Please provide a valid API endpoint URL.");W1(e)},[e]),We.useEffect(()=>{n.user?o(()=>um()):o(void 0)},[n.user]);async function c(){const K=window.localStorage.getItem("access_token"),de=window.localStorage.getItem("refresh_token");if(!K||!de){i({loading:!1,user:void 0});return}try{const le=await em();i({loading:!1,user:le})}catch(le){console.error("Failed to fetch user:",le),i({loading:!1,user:void 0})}}We.useEffect(()=>{c()},[]);async function u(K,de){console.log("Signing in");try{const{access_token:le,refresh_token:pe}=await Y1(K,de);window.localStorage.setItem("access_token",le),window.localStorage.setItem("refresh_token",pe),await c()}catch(le){throw console.error(le),le}}async function d(K,de,le,pe){try{const{access_token:Re,refresh_token:st}=await X1(K,de,le,pe);window.localStorage.setItem("access_token",Re),window.localStorage.setItem("refresh_token",st),await c()}catch(Re){throw console.error(Re),Re}}async function b(K,de){console.log("Signing in Guest");try{const{access_token:le,refresh_token:pe}=await J1(K,de);window.localStorage.setItem("access_token",le),window.localStorage.setItem("refresh_token",pe),await c()}catch(le){throw console.error(le),le}}async function S(K,de){try{const{access_token:le,refresh_token:pe,id:Re}=await Q1(K,de);return window.localStorage.setItem("access_token",le),window.localStorage.setItem("refresh_token",pe),await c(),{access_token:le,refresh_token:pe,id:Re}}catch(le){throw console.error(le),le}}async function Y(K,de,le){try{await cm(K,de,le),await c()}catch(pe){throw console.error(pe),pe}}async function $(){const K=window.localStorage.getItem("refresh_token");if(K)try{await tm(K)}catch(de){console.error("Error during logout:",de)}localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token"),sessionStorage.removeItem("sessionKey"),sessionStorage.removeItem("sessionId"),i({loading:!1,user:void 0})}const P={auth:n,signIn:u,signInGuest:b,signOut:$,signUp:d,signUpGuest:S,convertGuestToUserAccount:Y,get:P0,put:R0,list:U0,del:j0,refetchUser:c,verifyEmail:D0,requestNewVerificationCode:jc,requestNewVerificationEmail:jc,changePassword:V0,refreshAccessToken:Rc,requestPasswordReset:$0,confirmPasswordReset:M0,initiateGitHubAuth:async K=>{try{return await im(K)}catch(de){throw console.error("Failed to initiate GitHub auth:",de),de}},handleGitHubCallback:async(K,de,le)=>{try{const{access_token:pe,refresh_token:Re}=await sm(K,de,le);window.localStorage.setItem("access_token",pe),window.localStorage.setItem("refresh_token",Re),await c()}catch(pe){throw console.error("GitHub callback error:",pe),pe}},initiateGoogleAuth:async K=>{try{return await om(K)}catch(de){throw console.error("Failed to initiate Google auth:",de),de}},handleGoogleCallback:async(K,de,le)=>{try{const{access_token:pe,refresh_token:Re}=await am(K,de,le);window.localStorage.setItem("access_token",pe),window.localStorage.setItem("refresh_token",Re),await c()}catch(pe){throw console.error("Google callback error:",pe),pe}},getPrivateKey:L0,getPrivateKeyBytes:H0,getPublicKey:G0,signMessage:F0,aiCustomFetch:s||(async()=>new Response),apiUrl:e,pcrConfig:t,getAttestation:Bo,authenticate:Nc,parseAttestationForView:xf,awsRootCertDer:bf,expectedRootCertHash:z0,getAttestationDocument:async()=>{const K=window.crypto.randomUUID(),de=await fetch(`${e}/attestation/${K}`);if(!de.ok)throw new Error("Failed to fetch attestation document");const le=await de.json(),pe=await Nc(le.attestation_document,bf,K);return xf(pe,pe.cabundle,t)},generateThirdPartyToken:lm};return ry.jsx(Af.Provider,{value:P,children:r})}function vm(){const r=We.useContext(Af);if(!r)throw new Error("useOpenSecret must be used within an OpenSecretProvider");return r}function mm(){const r=new Uint8Array(32);return crypto.getRandomValues(r),Array.from(r,e=>e.toString(16).padStart(2,"0")).join("")}async function wm(r){const t=new TextEncoder().encode(r),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(s=>s.toString(16).padStart(2,"0")).join("")}Je.OpenSecretContext=Af,Je.OpenSecretProvider=gm,Je.generateSecureSecret=mm,Je.hashSecret=wm,Je.useOpenSecret=vm,Object.defineProperty(Je,Symbol.toStringTag,{value:"Module"})});
162
+ `);return e===-1?null:r.slice(0,e+2)}const hm=["eeddbb58f57c38894d6d5af5e575fbe791c5bf3bbcfb5df8da8cfcf0c2e1da1913108e6a762112444740b88c163d7f4b","74ed417f88cb0ca76c4a3d10f278bd010f1d3f95eafb254d4732511bb50e404507a4049b779c5230137e4091a5582271","9043fcab93b972d3c14ad2dc8fa78ca7ad374fc937c02435681772a003f7a72876bc4d578089b5c4cf3fe9b480f1aabb","52c3595b151d93d8b159c257301bfd5aa6f49210de0c55a6cd6df5ebeee44e4206cab950500f5d188f7fa14e6d900b75","91cb67311e910cce68cd5b7d0de77aa40610d87c6681439b44c46c3ff786ae643956ab2c812478a1da8745b259f07a45","859065ac81b81d3735130ba08b8af72a7256b603fefb74faabae25ed28cca6edcaa7c10ea32b5948d675c18a9b0f2b1d","acd82a7d3943e23e95a9dc3ce0b0107ea358d6287f9e3afa245622f7c7e3e0a66142a928b6efcc02f594a95366d3a99d"],dm=["62c0407056217a4c10764ed9045694c29fa93255d3cc04c2f989cdd9a1f8050c8b169714c71f1118ebce2fcc9951d1a9","cb95519905443f9f66f05f63c548b61ad1561a27fd5717b69285861aaea3c3063fe12a2571773b67fea3c6c11b4d8ec6","deb5895831b5e4286f5a2dcf5e9c27383821446f8df2b465f141d10743599be20ba3bb381ce063bf7139cc89f7f61d4c","70ba26c6af1ec3b57ce80e1adcc0ee96d70224d4c7a078f427895cdf68e1c30f09b5ac4c456588d872f3f21ff77c036b","669404ea71435b8f498b48db7816a5c2ab1d258b1a77685b11d84d15a73189504d79c4dee13a658de9f4a0cbfc39cfe8","a791bf92c25ffdfd372660e460a0e238c6778c090672df6509ae4bc065cf8668b6baac6b6a11d554af53ee0ff0172ad5","c4285443b87b9b12a6cea3bef1064ec060f652b235a297095975af8f134e5ed65f92d70d4616fdec80af9dff48bb9f35"];function pm(r,e){const t=[...(e==null?void 0:e.pcr0Values)||[],...hm],n=[...(e==null?void 0:e.pcr0DevValues)||[],...dm];return t.includes(r)?{isMatch:!0,text:"PCR0 matches a known good value"}:n.includes(r)?{isMatch:!0,text:"PCR0 matches development enclave"}:{isMatch:!1,text:"PCR0 does not match a known good value"}}const bf=Tc,F0="641a0321a3e244efe456463195d606317ed7cdcc3c1756e09893f3c68f79bb5b";function G0(r){return Array.from(r).map(e=>e.toString(16).padStart(2,"0")).join("")}async function ym(r){const e=await crypto.subtle.digest("SHA-256",r);return G0(new Uint8Array(e))}async function xf(r,e,t){console.log("Raw timestamp:",r.timestamp),console.log("Date object:",new Date(r.timestamp));const n=Array.from(r.pcrs.entries()).map(([b,_])=>({id:b,value:G0(_)})).filter(b=>!b.value.match(/^0+$/)),i=n.find(b=>b.id===0),s=i?pm(i.value,t):null,o=[...e,r.certificate].map(b=>{const _=new ji(b);return{subject:_.subject,notBefore:_.notBefore.toLocaleString(),notAfter:_.notAfter.toLocaleString(),pem:_.toString("pem"),isRoot:_.subject==="C=US, O=Amazon, OU=AWS, CN=aws.nitro-enclaves"}}),c=new TextDecoder,u=new ji(e[0]),d=await ym(u.rawData);return{moduleId:r.module_id,publicKey:r.public_key?Vr(r.public_key):null,timestamp:new Date(r.timestamp).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:"short"}),digest:r.digest,pcrs:n,certificates:o,userData:r.user_data?c.decode(r.user_data):null,nonce:r.nonce?c.decode(r.nonce):null,cert0hash:d,validatedPcr0Hash:s}}const Af=qe.createContext({auth:{loading:!0,user:void 0},clientId:"",signIn:async()=>{},signUp:async()=>{},signInGuest:async()=>{},signUpGuest:async()=>({id:"",email:void 0,access_token:"",refresh_token:""}),convertGuestToUserAccount:async()=>{},signOut:async()=>{},get:P0,put:R0,list:U0,del:j0,verifyEmail:D0,requestNewVerificationCode:jc,requestNewVerificationEmail:jc,refetchUser:async()=>{},changePassword:$0,refreshAccessToken:Rc,requestPasswordReset:async()=>{},confirmPasswordReset:async()=>{},initiateGitHubAuth:async()=>({auth_url:"",csrf_token:""}),handleGitHubCallback:async()=>{},initiateGoogleAuth:async()=>({auth_url:"",csrf_token:""}),handleGoogleCallback:async()=>{},getPrivateKey:M0,getPrivateKeyBytes:V0,getPublicKey:H0,signMessage:L0,aiCustomFetch:async()=>new Response,apiUrl:"",pcrConfig:{},getAttestation:Bo,authenticate:Nc,parseAttestationForView:xf,awsRootCertDer:bf,expectedRootCertHash:F0,getAttestationDocument:async()=>{throw new Error("getAttestationDocument called outside of OpenSecretProvider")},generateThirdPartyToken:async()=>({token:""})});function gm({children:r,apiUrl:e,clientId:t,pcrConfig:n={}}){const[i,s]=qe.useState({loading:!0,user:void 0}),[o,c]=qe.useState();qe.useEffect(()=>{if(!e||e.trim()==="")throw new Error("OpenSecretProvider requires a non-empty apiUrl. Please provide a valid API endpoint URL.");if(!t||t.trim()==="")throw new Error("OpenSecretProvider requires a non-empty clientId. Please provide a valid project UUID.");K1(e)},[e,t]),qe.useEffect(()=>{i.user?c(()=>um()):c(void 0)},[i.user]);async function u(){const oe=window.localStorage.getItem("access_token"),ce=window.localStorage.getItem("refresh_token");if(!oe||!ce){s({loading:!1,user:void 0});return}try{const X=await X1();s({loading:!1,user:X})}catch(X){console.error("Failed to fetch user:",X),s({loading:!1,user:void 0})}}qe.useEffect(()=>{u()},[]);async function d(oe,ce){console.log("Signing in");try{const{access_token:X,refresh_token:me}=await W1(oe,ce,t);window.localStorage.setItem("access_token",X),window.localStorage.setItem("refresh_token",me),await u()}catch(X){throw console.error(X),X}}async function b(oe,ce,X,me){try{const{access_token:$e,refresh_token:ot}=await Y1(oe,ce,X,t,me||null);window.localStorage.setItem("access_token",$e),window.localStorage.setItem("refresh_token",ot),await u()}catch($e){throw console.error($e),$e}}async function _(oe,ce){console.log("Signing in Guest");try{const{access_token:X,refresh_token:me}=await q1(oe,ce,t);window.localStorage.setItem("access_token",X),window.localStorage.setItem("refresh_token",me),await u()}catch(X){throw console.error(X),X}}async function q(oe,ce){try{const{access_token:X,refresh_token:me,id:$e}=await J1(oe,ce,t);return window.localStorage.setItem("access_token",X),window.localStorage.setItem("refresh_token",me),await u(),{access_token:X,refresh_token:me,id:$e}}catch(X){throw console.error(X),X}}async function $(oe,ce,X){try{await cm(oe,ce,X),await u()}catch(me){throw console.error(me),me}}async function w(){const oe=window.localStorage.getItem("refresh_token");if(oe)try{await Q1(oe)}catch(ce){console.error("Error during logout:",ce)}localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token"),sessionStorage.removeItem("sessionKey"),sessionStorage.removeItem("sessionId"),s({loading:!1,user:void 0})}const fe={auth:i,clientId:t,signIn:d,signInGuest:_,signOut:w,signUp:b,signUpGuest:q,convertGuestToUserAccount:$,get:P0,put:R0,list:U0,del:j0,refetchUser:u,verifyEmail:D0,requestNewVerificationCode:jc,requestNewVerificationEmail:jc,changePassword:$0,refreshAccessToken:Rc,requestPasswordReset:(oe,ce)=>rm(oe,ce,t),confirmPasswordReset:(oe,ce,X,me)=>nm(oe,ce,X,me,t),initiateGitHubAuth:async oe=>{try{return await im(t,oe)}catch(ce){throw console.error("Failed to initiate GitHub auth:",ce),ce}},handleGitHubCallback:async(oe,ce,X)=>{try{const{access_token:me,refresh_token:$e}=await sm(oe,ce,X);window.localStorage.setItem("access_token",me),window.localStorage.setItem("refresh_token",$e),await u()}catch(me){throw console.error("GitHub callback error:",me),me}},initiateGoogleAuth:async oe=>{try{return await om(t,oe)}catch(ce){throw console.error("Failed to initiate Google auth:",ce),ce}},handleGoogleCallback:async(oe,ce,X)=>{try{const{access_token:me,refresh_token:$e}=await am(oe,ce,X);window.localStorage.setItem("access_token",me),window.localStorage.setItem("refresh_token",$e),await u()}catch(me){throw console.error("Google callback error:",me),me}},getPrivateKey:M0,getPrivateKeyBytes:V0,getPublicKey:H0,signMessage:L0,aiCustomFetch:o||(async()=>new Response),apiUrl:e,pcrConfig:n,getAttestation:Bo,authenticate:Nc,parseAttestationForView:xf,awsRootCertDer:bf,expectedRootCertHash:F0,getAttestationDocument:async()=>{const oe=window.crypto.randomUUID(),ce=await fetch(`${e}/attestation/${oe}`);if(!ce.ok)throw new Error("Failed to fetch attestation document");const X=await ce.json(),me=await Nc(X.attestation_document,bf,oe);return xf(me,me.cabundle,n)},generateThirdPartyToken:lm};return ey.jsx(Af.Provider,{value:fe,children:r})}function vm(){const r=qe.useContext(Af);if(!r)throw new Error("useOpenSecret must be used within an OpenSecretProvider");return r}function mm(){const r=new Uint8Array(32);return crypto.getRandomValues(r),Array.from(r,e=>e.toString(16).padStart(2,"0")).join("")}async function wm(r){const t=new TextEncoder().encode(r),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(s=>s.toString(16).padStart(2,"0")).join("")}Xe.OpenSecretContext=Af,Xe.OpenSecretProvider=gm,Xe.generateSecureSecret=mm,Xe.hashSecret=wm,Xe.useOpenSecret=vm,Object.defineProperty(Xe,Symbol.toStringTag,{value:"Module"})});