authhero 0.40.0 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/authhero.cjs CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";var Xf=Object.defineProperty;var Qf=(n,e,t)=>e in n?Xf(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var te=(n,e,t)=>Qf(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@hono/zod-openapi"),X=n=>typeof n=="string",Jn=()=>{let n,e;const t=new Promise((i,r)=>{n=i,e=r});return t.resolve=n,t.reject=e,t},Fc=n=>n==null?"":""+n,eh=(n,e,t)=>{n.forEach(i=>{e[i]&&(t[i]=e[i])})},th=/###/g,Wc=n=>n&&n.indexOf("###")>-1?n.replace(th,"."):n,Gc=n=>!n||X(n),Xn=(n,e,t)=>{const i=X(e)?e.split("."):e;let r=0;for(;r<i.length-1;){if(Gc(n))return{};const s=Wc(i[r]);!n[s]&&t&&(n[s]=new t),Object.prototype.hasOwnProperty.call(n,s)?n=n[s]:n={},++r}return Gc(n)?{}:{obj:n,k:Wc(i[r])}},Jc=(n,e,t)=>{const{obj:i,k:r}=Xn(n,e,Object);if(i!==void 0||e.length===1){i[r]=t;return}let s=e[e.length-1],a=e.slice(0,e.length-1),c=Xn(n,a,Object);for(;c.obj===void 0&&a.length;)s=`${a[a.length-1]}.${s}`,a=a.slice(0,a.length-1),c=Xn(n,a,Object),c!=null&&c.obj&&typeof c.obj[`${c.k}.${s}`]<"u"&&(c.obj=void 0);c.obj[`${c.k}.${s}`]=t},nh=(n,e,t,i)=>{const{obj:r,k:s}=Xn(n,e,Object);r[s]=r[s]||[],r[s].push(t)},er=(n,e)=>{const{obj:t,k:i}=Xn(n,e);if(t&&Object.prototype.hasOwnProperty.call(t,i))return t[i]},ih=(n,e,t)=>{const i=er(n,t);return i!==void 0?i:er(e,t)},td=(n,e,t)=>{for(const i in e)i!=="__proto__"&&i!=="constructor"&&(i in n?X(n[i])||n[i]instanceof String||X(e[i])||e[i]instanceof String?t&&(n[i]=e[i]):td(n[i],e[i],t):n[i]=e[i]);return n},gn=n=>n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var rh={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const sh=n=>X(n)?n.replace(/[&<>"'\/]/g,e=>rh[e]):n;class oh{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;const i=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,i),this.regExpQueue.push(e),i}}const ah=[" ",",","?","!",";"],ch=new oh(20),lh=(n,e,t)=>{e=e||"",t=t||"";const i=ah.filter(a=>e.indexOf(a)<0&&t.indexOf(a)<0);if(i.length===0)return!0;const r=ch.getRegExp(`(${i.map(a=>a==="?"?"\\?":a).join("|")})`);let s=!r.test(n);if(!s){const a=n.indexOf(t);a>0&&!r.test(n.substring(0,a))&&(s=!0)}return s},lo=function(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!n)return;if(n[e])return Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0;const i=e.split(t);let r=n;for(let s=0;s<i.length;){if(!r||typeof r!="object")return;let a,c="";for(let l=s;l<i.length;++l)if(l!==s&&(c+=t),c+=i[l],a=r[c],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&l<i.length-1)continue;s+=l-s+1;break}r=a}return r},tr=n=>n==null?void 0:n.replace("_","-"),uh={type:"logger",log(n){this.output("log",n)},warn(n){this.output("warn",n)},error(n){this.output("error",n)},output(n,e){var t,i;(i=(t=console==null?void 0:console[n])==null?void 0:t.apply)==null||i.call(t,console,e)}};class nr{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||uh,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"log","",!0)}warn(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"warn","",!0)}error(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"error","")}deprecate(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,i,r){return r&&!this.debug?null:(X(e[0])&&(e[0]=`${i}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new nr(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new nr(this.logger,e)}}var pt=new nr;class Jr{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(i=>{this.observers[i]||(this.observers[i]=new Map);const r=this.observers[i].get(t)||0;this.observers[i].set(t,r+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];this.observers[e]&&Array.from(this.observers[e].entries()).forEach(a=>{let[c,l]=a;for(let d=0;d<l;d++)c(...i)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(a=>{let[c,l]=a;for(let d=0;d<l;d++)c.apply(c,[e,...i])})}}class Zc extends Jr{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,i){var d,h;let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,a=r.ignoreJSONStructure!==void 0?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let c;e.indexOf(".")>-1?c=e.split("."):(c=[e,t],i&&(Array.isArray(i)?c.push(...i):X(i)&&s?c.push(...i.split(s)):c.push(i)));const l=er(this.data,c);return!l&&!t&&!i&&e.indexOf(".")>-1&&(e=c[0],t=c[1],i=c.slice(2).join(".")),l||!a||!X(i)?l:lo((h=(d=this.data)==null?void 0:d[e])==null?void 0:h[t],i,s)}addResource(e,t,i,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let c=[e,t];i&&(c=c.concat(a?i.split(a):i)),e.indexOf(".")>-1&&(c=e.split("."),r=t,t=c[1]),this.addNamespaces(t),Jc(this.data,c,r),s.silent||this.emit("added",e,t,i,r)}addResources(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const s in i)(X(i[s])||Array.isArray(i[s]))&&this.addResource(e,t,s,i[s],{silent:!0});r.silent||this.emit("added",e,t,i)}addResourceBundle(e,t,i,r,s){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},c=[e,t];e.indexOf(".")>-1&&(c=e.split("."),r=i,i=t,t=c[1]),this.addNamespaces(t);let l=er(this.data,c)||{};a.skipCopy||(i=JSON.parse(JSON.stringify(i))),r?td(l,i,s):l={...l,...i},Jc(this.data,c,l),a.silent||this.emit("added",e,t,i)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(r=>t[r]&&Object.keys(t[r]).length>0)}toJSON(){return this.data}}var nd={processors:{},addPostProcessor(n){this.processors[n.name]=n},handle(n,e,t,i,r){return n.forEach(s=>{var a;e=((a=this.processors[s])==null?void 0:a.process(e,t,i,r))??e}),e}};const Yc={};class ir extends Jr{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),eh(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=pt.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const i=this.resolve(e,t);return(i==null?void 0:i.res)!==void 0}extractFromKey(e,t){let i=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;i===void 0&&(i=":");const r=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let s=t.ns||this.options.defaultNS||[];const a=i&&e.indexOf(i)>-1,c=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!lh(e,i,r);if(a&&!c){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:X(s)?[s]:s};const d=e.split(i);(i!==r||i===r&&this.options.ns.indexOf(d[0])>-1)&&(s=d.shift()),e=d.join(r)}return{key:e,namespaces:X(s)?[s]:s}}translate(e,t,i){if(typeof t!="object"&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),typeof t=="object"&&(t={...t}),t||(t={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const r=t.returnDetails!==void 0?t.returnDetails:this.options.returnDetails,s=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator,{key:a,namespaces:c}=this.extractFromKey(e[e.length-1],t),l=c[c.length-1],d=t.lng||this.language,h=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((d==null?void 0:d.toLowerCase())==="cimode"){if(h){const F=t.nsSeparator||this.options.nsSeparator;return r?{res:`${l}${F}${a}`,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:`${l}${F}${a}`}return r?{res:a,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:a}const g=this.resolve(e,t);let y=g==null?void 0:g.res;const I=(g==null?void 0:g.usedKey)||a,f=(g==null?void 0:g.exactUsedKey)||a,_=Object.prototype.toString.apply(y),k=["[object Number]","[object Function]","[object RegExp]"],x=t.joinArrays!==void 0?t.joinArrays:this.options.joinArrays,O=!this.i18nFormat||this.i18nFormat.handleAsObject,R=!X(y)&&typeof y!="boolean"&&typeof y!="number";if(O&&y&&R&&k.indexOf(_)<0&&!(X(x)&&Array.isArray(y))){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const F=this.options.returnedObjectHandler?this.options.returnedObjectHandler(I,y,{...t,ns:c}):`key '${a} (${this.language})' returned an object instead of string.`;return r?(g.res=F,g.usedParams=this.getUsedParamsDetails(t),g):F}if(s){const F=Array.isArray(y),oe=F?[]:{},pe=F?f:I;for(const ce in y)if(Object.prototype.hasOwnProperty.call(y,ce)){const Ne=`${pe}${s}${ce}`;oe[ce]=this.translate(Ne,{...t,joinArrays:!1,ns:c}),oe[ce]===Ne&&(oe[ce]=y[ce])}y=oe}}else if(O&&X(x)&&Array.isArray(y))y=y.join(x),y&&(y=this.extendTranslation(y,e,t,i));else{let F=!1,oe=!1;const pe=t.count!==void 0&&!X(t.count),ce=ir.hasDefaultValue(t),Ne=pe?this.pluralResolver.getSuffix(d,t.count,t):"",Qe=t.ordinal&&pe?this.pluralResolver.getSuffix(d,t.count,{ordinal:!1}):"",Ve=pe&&!t.ordinal&&t.count===0,z=Ve&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${Ne}`]||t[`defaultValue${Qe}`]||t.defaultValue;!this.isValidLookup(y)&&ce&&(F=!0,y=z),this.isValidLookup(y)||(oe=!0,y=a);const S=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&oe?void 0:y,w=ce&&z!==y&&this.options.updateMissing;if(oe||F||w){if(this.logger.log(w?"updateKey":"missingKey",d,l,a,w?z:y),s){const Z=this.resolve(a,{...t,keySeparator:!1});Z&&Z.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let v=[];const E=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if(this.options.saveMissingTo==="fallback"&&E&&E[0])for(let Z=0;Z<E.length;Z++)v.push(E[Z]);else this.options.saveMissingTo==="all"?v=this.languageUtils.toResolveHierarchy(t.lng||this.language):v.push(t.lng||this.language);const T=(Z,K,ee)=>{var V;const se=ce&&ee!==y?ee:S;this.options.missingKeyHandler?this.options.missingKeyHandler(Z,l,K,se,w,t):(V=this.backendConnector)!=null&&V.saveMissing&&this.backendConnector.saveMissing(Z,l,K,se,w,t),this.emit("missingKey",Z,l,K,y)};this.options.saveMissing&&(this.options.saveMissingPlurals&&pe?v.forEach(Z=>{const K=this.pluralResolver.getSuffixes(Z,t);Ve&&t[`defaultValue${this.options.pluralSeparator}zero`]&&K.indexOf(`${this.options.pluralSeparator}zero`)<0&&K.push(`${this.options.pluralSeparator}zero`),K.forEach(ee=>{T([Z],a+ee,t[`defaultValue${ee}`]||z)})}):T(v,a,z))}y=this.extendTranslation(y,e,t,g,i),oe&&y===a&&this.options.appendNamespaceToMissingKey&&(y=`${l}:${a}`),(oe||F)&&this.options.parseMissingKeyHandler&&(y=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${a}`:a,F?y:void 0))}return r?(g.res=y,g.usedParams=this.getUsedParamsDetails(t),g):y}extendTranslation(e,t,i,r,s){var d,h;var a=this;if((d=this.i18nFormat)!=null&&d.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...i},i.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init({...i,interpolation:{...this.options.interpolation,...i.interpolation}});const g=X(e)&&(((h=i==null?void 0:i.interpolation)==null?void 0:h.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let y;if(g){const f=e.match(this.interpolator.nestingRegexp);y=f&&f.length}let I=i.replace&&!X(i.replace)?i.replace:i;if(this.options.interpolation.defaultVariables&&(I={...this.options.interpolation.defaultVariables,...I}),e=this.interpolator.interpolate(e,I,i.lng||this.language||r.usedLng,i),g){const f=e.match(this.interpolator.nestingRegexp),_=f&&f.length;y<_&&(i.nest=!1)}!i.lng&&r&&r.res&&(i.lng=this.language||r.usedLng),i.nest!==!1&&(e=this.interpolator.nest(e,function(){for(var f=arguments.length,_=new Array(f),k=0;k<f;k++)_[k]=arguments[k];return(s==null?void 0:s[0])===_[0]&&!i.context?(a.logger.warn(`It seems you are nesting recursively key: ${_[0]} in key: ${t[0]}`),null):a.translate(..._,t)},i)),i.interpolation&&this.interpolator.reset()}const c=i.postProcess||this.options.postProcess,l=X(c)?[c]:c;return e!=null&&(l!=null&&l.length)&&i.applyPostProcessor!==!1&&(e=nd.handle(l,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(i)},...i}:i,this)),e}resolve(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i,r,s,a,c;return X(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(i))return;const d=this.extractFromKey(l,t),h=d.key;r=h;let g=d.namespaces;this.options.fallbackNS&&(g=g.concat(this.options.fallbackNS));const y=t.count!==void 0&&!X(t.count),I=y&&!t.ordinal&&t.count===0,f=t.context!==void 0&&(X(t.context)||typeof t.context=="number")&&t.context!=="",_=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);g.forEach(k=>{var x,O;this.isValidLookup(i)||(c=k,!Yc[`${_[0]}-${k}`]&&((x=this.utils)!=null&&x.hasLoadedNamespace)&&!((O=this.utils)!=null&&O.hasLoadedNamespace(c))&&(Yc[`${_[0]}-${k}`]=!0,this.logger.warn(`key "${r}" for languages "${_.join(", ")}" won't get resolved as namespace "${c}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),_.forEach(R=>{var pe;if(this.isValidLookup(i))return;a=R;const F=[h];if((pe=this.i18nFormat)!=null&&pe.addLookupKeys)this.i18nFormat.addLookupKeys(F,h,R,k,t);else{let ce;y&&(ce=this.pluralResolver.getSuffix(R,t.count,t));const Ne=`${this.options.pluralSeparator}zero`,Qe=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(y&&(F.push(h+ce),t.ordinal&&ce.indexOf(Qe)===0&&F.push(h+ce.replace(Qe,this.options.pluralSeparator)),I&&F.push(h+Ne)),f){const Ve=`${h}${this.options.contextSeparator}${t.context}`;F.push(Ve),y&&(F.push(Ve+ce),t.ordinal&&ce.indexOf(Qe)===0&&F.push(Ve+ce.replace(Qe,this.options.pluralSeparator)),I&&F.push(Ve+Ne))}}let oe;for(;oe=F.pop();)this.isValidLookup(i)||(s=oe,i=this.getResource(R,k,oe,t))}))})}),{res:i,usedKey:r,exactUsedKey:s,usedLng:a,usedNS:c}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,i){var s;let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return(s=this.i18nFormat)!=null&&s.getResource?this.i18nFormat.getResource(e,t,i,r):this.resourceStore.getResource(e,t,i,r)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],i=e.replace&&!X(e.replace);let r=i?e.replace:e;if(i&&typeof e.count<"u"&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!i){r={...r};for(const s of t)delete r[s]}return r}static hasDefaultValue(e){const t="defaultValue";for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&t===i.substring(0,t.length)&&e[i]!==void 0)return!0;return!1}}class Xc{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=pt.create("languageUtils")}getScriptPartFromCode(e){if(e=tr(e),!e||e.indexOf("-")<0)return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=tr(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(X(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(i=>{if(t)return;const r=this.formatLanguageCode(i);(!this.options.supportedLngs||this.isSupportedCode(r))&&(t=r)}),!t&&this.options.supportedLngs&&e.forEach(i=>{if(t)return;const r=this.getLanguagePartFromCode(i);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(s=>{if(s===r)return s;if(!(s.indexOf("-")<0&&r.indexOf("-")<0)&&(s.indexOf("-")>0&&r.indexOf("-")<0&&s.substring(0,s.indexOf("-"))===r||s.indexOf(r)===0&&r.length>1))return s})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),X(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let i=e[t];return i||(i=e[this.getScriptPartFromCode(t)]),i||(i=e[this.formatLanguageCode(t)]),i||(i=e[this.getLanguagePartFromCode(t)]),i||(i=e.default),i||[]}toResolveHierarchy(e,t){const i=this.getFallbackCodes(t||this.options.fallbackLng||[],e),r=[],s=a=>{a&&(this.isSupportedCode(a)?r.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return X(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):X(e)&&s(this.formatLanguageCode(e)),i.forEach(a=>{r.indexOf(a)<0&&s(this.formatLanguageCode(a))}),r}}const Qc={zero:0,one:1,two:2,few:3,many:4,other:5},el={select:n=>n===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class dh{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=pt.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const i=tr(e==="dev"?"en":e),r=t.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:i,type:r});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let a;try{a=new Intl.PluralRules(i,{type:r})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),el;if(!e.match(/-|_/))return el;const l=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(l,t)}return this.pluralRulesCache[s]=a,a}needsPlural(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),(i==null?void 0:i.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,i).map(r=>`${t}${r}`)}getSuffixes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),i?i.resolvedOptions().pluralCategories.sort((r,s)=>Qc[r]-Qc[s]).map(r=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${r}`):[]}getSuffix(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=this.getRule(e,i);return r?`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,i))}}const tl=function(n,e,t){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=ih(n,e,t);return!s&&r&&X(t)&&(s=lo(n,t,i),s===void 0&&(s=lo(e,t,i))),s},Gs=n=>n.replace(/\$/g,"$$$$");class ph{constructor(){var t;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=pt.create("interpolator"),this.options=e,this.format=((t=e==null?void 0:e.interpolation)==null?void 0:t.format)||(i=>i),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:i,useRawValueToEscape:r,prefix:s,prefixEscaped:a,suffix:c,suffixEscaped:l,formatSeparator:d,unescapeSuffix:h,unescapePrefix:g,nestingPrefix:y,nestingPrefixEscaped:I,nestingSuffix:f,nestingSuffixEscaped:_,nestingOptionsSeparator:k,maxReplaces:x,alwaysFormat:O}=e.interpolation;this.escape=t!==void 0?t:sh,this.escapeValue=i!==void 0?i:!0,this.useRawValueToEscape=r!==void 0?r:!1,this.prefix=s?gn(s):a||"{{",this.suffix=c?gn(c):l||"}}",this.formatSeparator=d||",",this.unescapePrefix=h?"":g||"-",this.unescapeSuffix=this.unescapePrefix?"":h||"",this.nestingPrefix=y?gn(y):I||gn("$t("),this.nestingSuffix=f?gn(f):_||gn(")"),this.nestingOptionsSeparator=k||",",this.maxReplaces=x||1e3,this.alwaysFormat=O!==void 0?O:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,i)=>(t==null?void 0:t.source)===i?(t.lastIndex=0,t):new RegExp(i,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,t,i,r){var I;let s,a,c;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=f=>{if(f.indexOf(this.formatSeparator)<0){const O=tl(t,l,f,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(O,void 0,i,{...r,...t,interpolationkey:f}):O}const _=f.split(this.formatSeparator),k=_.shift().trim(),x=_.join(this.formatSeparator).trim();return this.format(tl(t,l,k,this.options.keySeparator,this.options.ignoreJSONStructure),x,i,{...r,...t,interpolationkey:k})};this.resetRegExp();const h=(r==null?void 0:r.missingInterpolationHandler)||this.options.missingInterpolationHandler,g=((I=r==null?void 0:r.interpolation)==null?void 0:I.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:f=>Gs(f)},{regex:this.regexp,safeValue:f=>this.escapeValue?Gs(this.escape(f)):Gs(f)}].forEach(f=>{for(c=0;s=f.regex.exec(e);){const _=s[1].trim();if(a=d(_),a===void 0)if(typeof h=="function"){const x=h(e,s,r);a=X(x)?x:""}else if(r&&Object.prototype.hasOwnProperty.call(r,_))a="";else if(g){a=s[0];continue}else this.logger.warn(`missed to pass in variable ${_} for interpolating ${e}`),a="";else!X(a)&&!this.useRawValueToEscape&&(a=Fc(a));const k=f.safeValue(a);if(e=e.replace(s[0],k),g?(f.regex.lastIndex+=a.length,f.regex.lastIndex-=s[0].length):f.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),e}nest(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r,s,a;const c=(l,d)=>{const h=this.nestingOptionsSeparator;if(l.indexOf(h)<0)return l;const g=l.split(new RegExp(`${h}[ ]*{`));let y=`{${g[1]}`;l=g[0],y=this.interpolate(y,a);const I=y.match(/'/g),f=y.match(/"/g);(((I==null?void 0:I.length)??0)%2===0&&!f||f.length%2!==0)&&(y=y.replace(/'/g,'"'));try{a=JSON.parse(y),d&&(a={...d,...a})}catch(_){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,_),`${l}${h}${y}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,l};for(;r=this.nestingRegexp.exec(e);){let l=[];a={...i},a=a.replace&&!X(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let d=!1;if(r[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(r[1])){const h=r[1].split(this.formatSeparator).map(g=>g.trim());r[1]=h.shift(),l=h,d=!0}if(s=t(c.call(this,r[1].trim(),a),a),s&&r[0]===e&&!X(s))return s;X(s)||(s=Fc(s)),s||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),s=""),d&&(s=l.reduce((h,g)=>this.format(h,g,i.lng,{...i,interpolationkey:r[1].trim()}),s.trim())),e=e.replace(r[0],s),this.regexp.lastIndex=0}return e}}const fh=n=>{let e=n.toLowerCase().trim();const t={};if(n.indexOf("(")>-1){const i=n.split("(");e=i[0].toLowerCase().trim();const r=i[1].substring(0,i[1].length-1);e==="currency"&&r.indexOf(":")<0?t.currency||(t.currency=r.trim()):e==="relativetime"&&r.indexOf(":")<0?t.range||(t.range=r.trim()):r.split(";").forEach(a=>{if(a){const[c,...l]=a.split(":"),d=l.join(":").trim().replace(/^'+|'+$/g,""),h=c.trim();t[h]||(t[h]=d),d==="false"&&(t[h]=!1),d==="true"&&(t[h]=!0),isNaN(d)||(t[h]=parseInt(d,10))}})}return{formatName:e,formatOptions:t}},_n=n=>{const e={};return(t,i,r)=>{let s=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(s={...s,[r.interpolationkey]:void 0});const a=i+JSON.stringify(s);let c=e[a];return c||(c=n(tr(i),r),e[a]=c),c(t)}};class hh{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=pt.create("formatter"),this.options=e,this.formats={number:_n((t,i)=>{const r=new Intl.NumberFormat(t,{...i});return s=>r.format(s)}),currency:_n((t,i)=>{const r=new Intl.NumberFormat(t,{...i,style:"currency"});return s=>r.format(s)}),datetime:_n((t,i)=>{const r=new Intl.DateTimeFormat(t,{...i});return s=>r.format(s)}),relativetime:_n((t,i)=>{const r=new Intl.RelativeTimeFormat(t,{...i});return s=>r.format(s,i.range||"day")}),list:_n((t,i)=>{const r=new Intl.ListFormat(t,{...i});return s=>r.format(s)})},this.init(e)}init(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=t.interpolation.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=_n(t)}format(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=t.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(c=>c.indexOf(")")>-1)){const c=s.findIndex(l=>l.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,c)].join(this.formatSeparator)}return s.reduce((c,l)=>{var g;const{formatName:d,formatOptions:h}=fh(l);if(this.formats[d]){let y=c;try{const I=((g=r==null?void 0:r.formatParams)==null?void 0:g[r.interpolationkey])||{},f=I.locale||I.lng||r.locale||r.lng||i;y=this.formats[d](c,f,{...h,...r,...I})}catch(I){this.logger.warn(I)}return y}else this.logger.warn(`there was no format function for ${d}`);return c},e)}}const gh=(n,e)=>{n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)};class _h extends Jr{constructor(e,t,i){var s,a;let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=i,this.languageUtils=i.languageUtils,this.options=r,this.logger=pt.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],(a=(s=this.backend)==null?void 0:s.init)==null||a.call(s,i,r.backend,r)}queueLoad(e,t,i,r){const s={},a={},c={},l={};return e.forEach(d=>{let h=!0;t.forEach(g=>{const y=`${d}|${g}`;!i.reload&&this.store.hasResourceBundle(d,g)?this.state[y]=2:this.state[y]<0||(this.state[y]===1?a[y]===void 0&&(a[y]=!0):(this.state[y]=1,h=!1,a[y]===void 0&&(a[y]=!0),s[y]===void 0&&(s[y]=!0),l[g]===void 0&&(l[g]=!0)))}),h||(c[d]=!0)}),(Object.keys(s).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(s),pending:Object.keys(a),toLoadLanguages:Object.keys(c),toLoadNamespaces:Object.keys(l)}}loaded(e,t,i){const r=e.split("|"),s=r[0],a=r[1];t&&this.emit("failedLoading",s,a,t),!t&&i&&this.store.addResourceBundle(s,a,i,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&i&&(this.state[e]=0);const c={};this.queue.forEach(l=>{nh(l.loaded,[s],a),gh(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(d=>{c[d]||(c[d]={});const h=l.loaded[d];h.length&&h.forEach(g=>{c[d][g]===void 0&&(c[d][g]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(l=>!l.done)}read(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:i,tried:r,wait:s,callback:a});return}this.readingCalls++;const c=(d,h)=>{if(this.readingCalls--,this.waitingReads.length>0){const g=this.waitingReads.shift();this.read(g.lng,g.ns,g.fcName,g.tried,g.wait,g.callback)}if(d&&h&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,i,r+1,s*2,a)},s);return}a(d,h)},l=this.backend[i].bind(this.backend);if(l.length===2){try{const d=l(e,t);d&&typeof d.then=="function"?d.then(h=>c(null,h)).catch(c):c(null,d)}catch(d){c(d)}return}return l(e,t,c)}prepareLoading(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();X(e)&&(e=this.languageUtils.toResolveHierarchy(e)),X(t)&&(t=[t]);const s=this.queueLoad(e,t,i,r);if(!s.toLoad.length)return s.pending.length||r(),null;s.toLoad.forEach(a=>{this.loadOne(a)})}load(e,t,i){this.prepareLoading(e,t,{},i)}reload(e,t,i){this.prepareLoading(e,t,{reload:!0},i)}loadOne(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const i=e.split("|"),r=i[0],s=i[1];this.read(r,s,"read",void 0,void 0,(a,c)=>{a&&this.logger.warn(`${t}loading namespace ${s} for language ${r} failed`,a),!a&&c&&this.logger.log(`${t}loaded namespace ${s} for language ${r}`,c),this.loaded(e,a,c)})}saveMissing(e,t,i,r,s){var l,d,h,g,y;let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if((d=(l=this.services)==null?void 0:l.utils)!=null&&d.hasLoadedNamespace&&!((g=(h=this.services)==null?void 0:h.utils)!=null&&g.hasLoadedNamespace(t))){this.logger.warn(`did not save key "${i}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(i==null||i==="")){if((y=this.backend)!=null&&y.create){const I={...a,isUpdate:s},f=this.backend.create.bind(this.backend);if(f.length<6)try{let _;f.length===5?_=f(e,t,i,r,I):_=f(e,t,i,r),_&&typeof _.then=="function"?_.then(k=>c(null,k)).catch(c):c(null,_)}catch(_){c(_)}else f(e,t,i,r,c,I)}!e||!e[0]||this.store.addResource(e[0],t,i,r)}}}const nl=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:n=>{let e={};if(typeof n[1]=="object"&&(e=n[1]),X(n[1])&&(e.defaultValue=n[1]),X(n[2])&&(e.tDescription=n[2]),typeof n[2]=="object"||typeof n[3]=="object"){const t=n[3]||n[2];Object.keys(t).forEach(i=>{e[i]=t[i]})}return e},interpolation:{escapeValue:!0,format:n=>n,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),il=n=>{var e,t;return X(n.ns)&&(n.ns=[n.ns]),X(n.fallbackLng)&&(n.fallbackLng=[n.fallbackLng]),X(n.fallbackNS)&&(n.fallbackNS=[n.fallbackNS]),((t=(e=n.supportedLngs)==null?void 0:e.indexOf)==null?void 0:t.call(e,"cimode"))<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),typeof n.initImmediate=="boolean"&&(n.initAsync=n.initImmediate),n},Di=()=>{},mh=n=>{Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(t=>{typeof n[t]=="function"&&(n[t]=n[t].bind(n))})};class si extends Jr{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if(super(),this.options=il(e),this.services={},this.logger=pt,this.modules={external:[]},mh(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof t=="function"&&(i=t,t={}),!t.defaultNS&&t.defaultNS!==!1&&t.ns&&(X(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=nl();this.options={...r,...this.options,...il(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);const s=h=>h?typeof h=="function"?new h:h:null;if(!this.options.isClone){this.modules.logger?pt.init(s(this.modules.logger),this.options):pt.init(null,this.options);let h;this.modules.formatter?h=this.modules.formatter:h=hh;const g=new Xc(this.options);this.store=new Zc(this.options.resources,this.options);const y=this.services;y.logger=pt,y.resourceStore=this.store,y.languageUtils=g,y.pluralResolver=new dh(g,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),h&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(y.formatter=s(h),y.formatter.init(y,this.options),this.options.interpolation.format=y.formatter.format.bind(y.formatter)),y.interpolator=new ph(this.options),y.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},y.backendConnector=new _h(s(this.modules.backend),y.resourceStore,y,this.options),y.backendConnector.on("*",function(I){for(var f=arguments.length,_=new Array(f>1?f-1:0),k=1;k<f;k++)_[k-1]=arguments[k];e.emit(I,..._)}),this.modules.languageDetector&&(y.languageDetector=s(this.modules.languageDetector),y.languageDetector.init&&y.languageDetector.init(y,this.options.detection,this.options)),this.modules.i18nFormat&&(y.i18nFormat=s(this.modules.i18nFormat),y.i18nFormat.init&&y.i18nFormat.init(this)),this.translator=new ir(this.services,this.options),this.translator.on("*",function(I){for(var f=arguments.length,_=new Array(f>1?f-1:0),k=1;k<f;k++)_[k-1]=arguments[k];e.emit(I,..._)}),this.modules.external.forEach(I=>{I.init&&I.init(this)})}if(this.format=this.options.interpolation.format,i||(i=Di),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const h=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);h.length>0&&h[0]!=="dev"&&(this.options.lng=h[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(h=>{this[h]=function(){return e.store[h](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(h=>{this[h]=function(){return e.store[h](...arguments),e}});const l=Jn(),d=()=>{const h=(g,y)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(y),i(g,y)};if(this.languages&&!this.isInitialized)return h(null,this.t.bind(this));this.changeLanguage(this.options.lng,h)};return this.options.resources||!this.options.initAsync?d():setTimeout(d,0),l}loadResources(e){var s,a;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Di;const r=X(e)?e:this.language;if(typeof e=="function"&&(i=e),!this.options.resources||this.options.partialBundledLanguages){if((r==null?void 0:r.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return i();const c=[],l=d=>{if(!d||d==="cimode")return;this.services.languageUtils.toResolveHierarchy(d).forEach(g=>{g!=="cimode"&&c.indexOf(g)<0&&c.push(g)})};r?l(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(h=>l(h)),(a=(s=this.options.preload)==null?void 0:s.forEach)==null||a.call(s,d=>l(d)),this.services.backendConnector.load(c,this.options.ns,d=>{!d&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),i(d)})}else i(null)}reloadResources(e,t,i){const r=Jn();return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),i||(i=Di),this.services.backendConnector.reload(e,t,s=>{r.resolve(),i(s)}),r}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&nd.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let t=0;t<this.languages.length;t++){const i=this.languages[t];if(!(["cimode","dev"].indexOf(i)>-1)&&this.store.hasLanguageSomeTranslations(i)){this.resolvedLanguage=i;break}}}changeLanguage(e,t){var i=this;this.isLanguageChangingTo=e;const r=Jn();this.emit("languageChanging",e);const s=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},a=(l,d)=>{d?(s(d),this.translator.changeLanguage(d),this.isLanguageChangingTo=void 0,this.emit("languageChanged",d),this.logger.log("languageChanged",d)):this.isLanguageChangingTo=void 0,r.resolve(function(){return i.t(...arguments)}),t&&t(l,function(){return i.t(...arguments)})},c=l=>{var h,g;!e&&!l&&this.services.languageDetector&&(l=[]);const d=X(l)?l:this.services.languageUtils.getBestMatchFromCodes(l);d&&(this.language||s(d),this.translator.language||this.translator.changeLanguage(d),(g=(h=this.services.languageDetector)==null?void 0:h.cacheUserLanguage)==null||g.call(h,d)),this.loadResources(d,y=>{a(y,d)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?c(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(c):this.services.languageDetector.detect(c):c(e),r}getFixedT(e,t,i){var r=this;const s=function(a,c){let l;if(typeof c!="object"){for(var d=arguments.length,h=new Array(d>2?d-2:0),g=2;g<d;g++)h[g-2]=arguments[g];l=r.options.overloadTranslationOptionHandler([a,c].concat(h))}else l={...c};l.lng=l.lng||s.lng,l.lngs=l.lngs||s.lngs,l.ns=l.ns||s.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||i||s.keyPrefix);const y=r.options.keySeparator||".";let I;return l.keyPrefix&&Array.isArray(a)?I=a.map(f=>`${l.keyPrefix}${y}${f}`):I=l.keyPrefix?`${l.keyPrefix}${y}${a}`:a,r.t(I,l)};return X(e)?s.lng=e:s.lngs=e,s.ns=t,s.keyPrefix=i,s}t(){var r;for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return(r=this.translator)==null?void 0:r.translate(...t)}exists(){var r;for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return(r=this.translator)==null?void 0:r.exists(...t)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const i=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(i.toLowerCase()==="cimode")return!0;const a=(c,l)=>{const d=this.services.backendConnector.state[`${c}|${l}`];return d===-1||d===0||d===2};if(t.precheck){const c=t.precheck(this,a);if(c!==void 0)return c}return!!(this.hasResourceBundle(i,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(i,e)&&(!r||a(s,e)))}loadNamespaces(e,t){const i=Jn();return this.options.ns?(X(e)&&(e=[e]),e.forEach(r=>{this.options.ns.indexOf(r)<0&&this.options.ns.push(r)}),this.loadResources(r=>{i.resolve(),t&&t(r)}),i):(t&&t(),Promise.resolve())}loadLanguages(e,t){const i=Jn();X(e)&&(e=[e]);const r=this.options.preload||[],s=e.filter(a=>r.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return s.length?(this.options.preload=r.concat(s),this.loadResources(a=>{i.resolve(),t&&t(a)}),i):(t&&t(),Promise.resolve())}dir(e){var r,s;if(e||(e=this.resolvedLanguage||(((r=this.languages)==null?void 0:r.length)>0?this.languages[0]:this.language)),!e)return"rtl";const t=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],i=((s=this.services)==null?void 0:s.languageUtils)||new Xc(nl());return t.indexOf(i.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new si(e,t)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Di;const i=e.forkResourceStore;i&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},s=new si(r);if((e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(c=>{s[c]=this[c]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},i){const c=Object.keys(this.store.data).reduce((l,d)=>(l[d]={...this.store.data[d]},Object.keys(l[d]).reduce((h,g)=>(h[g]={...l[d][g]},h),{})),{});s.store=new Zc(c,r),s.services.resourceStore=s.store}return s.translator=new ir(s.services,r),s.translator.on("*",function(c){for(var l=arguments.length,d=new Array(l>1?l-1:0),h=1;h<l;h++)d[h-1]=arguments[h];s.emit(c,...d)}),s.init(r,t),s.translator.options=r,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Ce=si.createInstance();Ce.createInstance=si.createInstance;Ce.createInstance;Ce.dir;Ce.init;Ce.loadResources;Ce.reloadResources;Ce.use;Ce.changeLanguage;Ce.getFixedT;const ue=Ce.t;Ce.exists;Ce.setDefaultNamespace;Ce.hasLoadedNamespace;Ce.loadNamespaces;Ce.loadLanguages;const Lt=o.z.object({start:o.z.number(),limit:o.z.number(),length:o.z.number()}),Ba=o.z.object({created_at:o.z.string(),updated_at:o.z.string()}),id=o.z.object({email:o.z.string().optional(),email_verified:o.z.boolean().optional(),name:o.z.string().optional(),username:o.z.string().optional(),given_name:o.z.string().optional(),phone_number:o.z.string().optional(),phone_verified:o.z.boolean().optional(),family_name:o.z.string().optional()}).catchall(o.z.any()),rd=o.z.object({connection:o.z.string(),user_id:o.z.string(),provider:o.z.string(),isSocial:o.z.boolean(),access_token:o.z.string().optional(),access_token_secret:o.z.string().optional(),refresh_token:o.z.string().optional(),profileData:id.optional()}),Zr=o.z.object({email:o.z.string().optional(),username:o.z.string().optional(),given_name:o.z.string().optional(),family_name:o.z.string().optional(),nickname:o.z.string().optional(),name:o.z.string().optional(),picture:o.z.string().optional(),locale:o.z.string().optional(),linked_to:o.z.string().optional(),profileData:o.z.string().optional(),user_id:o.z.string().optional(),app_metadata:o.z.any().default({}).optional(),user_metadata:o.z.any().default({}).optional()}),rr=Zr.extend({email_verified:o.z.boolean().default(!1),verify_email:o.z.boolean().optional(),last_ip:o.z.string().optional(),last_login:o.z.string().optional(),user_id:o.z.string().optional(),provider:o.z.string().default("email"),connection:o.z.string().default("email"),is_social:o.z.boolean().optional()}),Na=o.z.object({...rr.shape,...Ba.shape,user_id:o.z.string(),is_social:o.z.boolean(),email:o.z.string(),login_count:o.z.number(),identities:o.z.array(rd).optional()}),dt=Na,yh=Zr.extend({email:o.z.string(),login_count:o.z.number(),multifactor:o.z.array(o.z.string()).optional(),last_ip:o.z.string().optional(),last_login:o.z.string().optional(),user_id:o.z.string()}).catchall(o.z.any()),vh="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let wh=(n=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(n));for(;n--;)e+=vh[t[n]&63];return e};const sd=o.z.object({audience:o.z.string().optional(),recipient:o.z.string().optional(),createUpnClaim:o.z.boolean().optional(),mapUnknownClaimsAsIs:o.z.boolean().optional(),passthroughClaimsWithNoMapping:o.z.boolean().optional(),mapIdentities:o.z.boolean().optional(),signatureAlgorithm:o.z.string().optional(),digestAlgorithm:o.z.string().optional(),issuer:o.z.string().optional(),destination:o.z.string().optional(),lifetimeInSeconds:o.z.number().optional(),signResponse:o.z.boolean().optional(),nameIdentifierFormat:o.z.string().optional(),nameIdentifierProbes:o.z.array(o.z.string()).optional(),authnContextClassRef:o.z.string().optional(),mappings:o.z.record(o.z.string()).optional()}),sr=o.z.object({id:o.z.string(),name:o.z.string(),callbacks:o.z.array(o.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs whitelisted to use as a callback to the client after authentication."}),allowed_origins:o.z.array(o.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs allowed to make requests from JavaScript to Auth0 API (typically used with CORS). By default, all your callback URLs will be allowed. This field allows you to enter other origins if necessary. You can also use wildcards at the subdomain level. Query strings and hash information are not taken into account when validating these URLs."}),web_origins:o.z.array(o.z.string()).default([]).optional().openapi({description:"Comma-separated list of allowed origins for use with Cross-Origin Authentication, Device Flow, and web message response mode."}),allowed_logout_urls:o.z.array(o.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs that are valid to redirect to after logout from Auth0. Wildcards are allowed for subdomains."}),allowed_clients:o.z.array(o.z.string()).default([]).optional().openapi({description:"Ids of clients that will be allowed to perform delegation requests. Clients that will be allowed to make delegation request. By default, all your clients will be allowed. This field allows you to specify specific clients"}),addons:o.z.object({samlp:sd.optional()}).default({}).optional().openapi({description:"Addons associated with the client. The key is the addon's package name and the value is an object with the configuration for the addon."}),email_validation:o.z.enum(["enabled","disabled","enforced"]).default("enforced").optional().openapi({description:"Defines if it possible to sign in with an unverified email and if verification emails will be sent. This is not available in auth0"}),client_secret:o.z.string().default(()=>wh()).optional(),disable_sign_ups:o.z.boolean().optional().default(!1).openapi({description:"Prevents users from signing up using the hosted login page. This is not available in auth0"})}),Ft=o.z.object({created_at:o.z.string().transform(n=>n===null?"":n),updated_at:o.z.string().transform(n=>n===null?"":n),...sr.shape});var Rt=(n=>(n.TOKEN="token",n.TOKEN_ID_TOKEN="token id_token",n.CODE="code",n))(Rt||{}),Tn=(n=>(n.QUERY="query",n.FRAGMENT="fragment",n.FORM_POST="form_post",n.WEB_MESSAGE="web_message",n.SAML_POST="saml_post",n))(Tn||{}),Yr=(n=>(n.S256="S256",n.Plain="plain",n))(Yr||{});const Ra=o.z.object({client_id:o.z.string(),vendor_id:o.z.string().optional(),act_as:o.z.string().optional(),response_type:o.z.nativeEnum(Rt).optional(),response_mode:o.z.nativeEnum(Tn).optional(),redirect_uri:o.z.string().optional(),audience:o.z.string().optional(),state:o.z.string().optional(),nonce:o.z.string().optional(),scope:o.z.string().optional(),prompt:o.z.string().optional(),code_challenge_method:o.z.nativeEnum(Yr).optional(),code_challenge:o.z.string().optional(),username:o.z.string().optional(),ui_locales:o.z.string().optional()}),uo=o.z.object({colors:o.z.object({primary:o.z.string(),page_background:o.z.object({type:o.z.string().optional(),start:o.z.string().optional(),end:o.z.string().optional(),angle_deg:o.z.number().optional()}).optional()}).optional(),logo_url:o.z.string().optional(),favicon_url:o.z.string().optional(),font:o.z.object({url:o.z.string()}).optional()}),or=o.z.object({id:o.z.string().optional(),name:o.z.string(),strategy:o.z.string(),options:o.z.object({kid:o.z.string().optional(),team_id:o.z.string().optional(),realms:o.z.string().optional(),client_id:o.z.string().optional(),client_secret:o.z.string().optional(),app_secret:o.z.string().optional(),scope:o.z.string().optional(),authorization_endpoint:o.z.string().default("").optional(),token_endpoint:o.z.string().default("").optional(),userinfo_endpoint:o.z.string().default("").optional(),jwks_uri:o.z.string().default("").optional(),discovery_url:o.z.string().default("").optional(),issuer:o.z.string().default("").optional()}).default({}).optional(),enabled_clients:o.z.array(o.z.string()).default([]).optional(),response_type:o.z.custom().optional(),response_mode:o.z.custom().optional()}),Et=o.z.object({id:o.z.string(),created_at:o.z.string().transform(n=>n===null?"":n),updated_at:o.z.string().transform(n=>n===null?"":n)}).extend(or.shape),ar=o.z.object({name:o.z.string(),audience:o.z.string(),sender_email:o.z.string().email(),sender_name:o.z.string(),support_url:o.z.string().url().optional(),logo:o.z.string().url().optional(),primary_color:o.z.string().optional(),secondary_color:o.z.string().optional(),language:o.z.string().optional()}),wn=o.z.object({created_at:o.z.string().transform(n=>n===null?"":n),updated_at:o.z.string().transform(n=>n===null?"":n),id:o.z.string(),...ar.shape}),bh=o.z.object({logoUrl:o.z.string(),loginBackgroundImage:o.z.string().nullish(),style:o.z.object({primaryColor:o.z.string(),buttonTextColor:o.z.string(),primaryHoverColor:o.z.string()}),supportEmail:o.z.string().nullable(),supportUrl:o.z.string().nullable(),name:o.z.string(),showGreyishBackground:o.z.boolean().optional(),termsAndConditionsUrl:o.z.string().nullable(),companyName:o.z.string().optional(),checkoutHideSocial:o.z.boolean().optional(),siteUrl:o.z.string().nullable(),manageSubscriptionsUrl:o.z.string().optional()}),kh=o.z.object({domain:o.z.string(),dkim_private_key:o.z.string().optional(),dkim_public_key:o.z.string().optional(),email_api_key:o.z.string().optional(),email_service:o.z.string().optional()});o.z.object({...Ft.shape,domains:o.z.array(kh),tenant:wn,connections:o.z.array(Et)});const od=o.z.enum(["password_reset","email_verification","otp","authorization_code","oauth2_state","ticket"]),ad=o.z.object({code_id:o.z.string().openapi({description:"The code that will be used in for instance an email verification flow"}),login_id:o.z.string().openapi({description:"The id of the login session that the code is connected to"}),connection_id:o.z.string().optional().openapi({description:"The connection that the code is connected to"}),code_type:od,code_verifier:o.z.string().optional().openapi({description:"The code verifier used in PKCE in outbound flows"}),expires_at:o.z.string(),used_at:o.z.string().optional(),user_id:o.z.string().optional()}),xh=o.z.object({...ad.shape,created_at:o.z.string()}),cd=o.z.object({domain:o.z.string(),dkim_private_key:o.z.string().optional(),dkim_public_key:o.z.string().optional(),email_api_key:o.z.string().optional(),email_service:o.z.string().optional()}),Sh=Ba.extend({...cd.shape,id:o.z.string()}),cr=o.z.object({trigger_id:o.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),enabled:o.z.boolean().default(!1),url:o.z.string(),hook_id:o.z.string().optional(),synchronous:o.z.boolean().default(!1),priority:o.z.number().optional()}),yn=cr.extend({...Ba.shape,hook_id:o.z.string()}),Ta=o.z.object({alg:o.z.enum(["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512"]),e:o.z.string(),kid:o.z.string(),kty:o.z.enum(["RSA","EC","oct"]),n:o.z.string(),x5t:o.z.string().optional(),x5c:o.z.array(o.z.string()).optional(),use:o.z.enum(["sig","enc"]).optional()}),ld=o.z.object({keys:o.z.array(Ta)}),po=o.z.object({issuer:o.z.string(),authorization_endpoint:o.z.string(),token_endpoint:o.z.string(),device_authorization_endpoint:o.z.string(),userinfo_endpoint:o.z.string(),mfa_challenge_endpoint:o.z.string(),jwks_uri:o.z.string(),registration_endpoint:o.z.string(),revocation_endpoint:o.z.string(),scopes_supported:o.z.array(o.z.string()),response_types_supported:o.z.array(o.z.string()),code_challenge_methods_supported:o.z.array(o.z.string()),response_modes_supported:o.z.array(o.z.string()),subject_types_supported:o.z.array(o.z.string()),id_token_signing_alg_values_supported:o.z.array(o.z.string()),token_endpoint_auth_methods_supported:o.z.array(o.z.string()),claims_supported:o.z.array(o.z.string()),request_uri_parameter_supported:o.z.boolean(),request_parameter_supported:o.z.boolean(),token_endpoint_auth_signing_alg_values_supported:o.z.array(o.z.string())}),ud=o.z.object({auth0Client:o.z.string().optional(),authParams:Ra,expires_at:o.z.string(),deleted_at:o.z.string().optional(),ip:o.z.string().optional(),useragent:o.z.string().optional()}).openapi({description:"This represents a login sesion"}),Ah=o.z.object({...ud.shape,login_id:o.z.string().openapi({description:"This is is used as the state in the universal login"}),created_at:o.z.string(),updated_at:o.z.string()});var _e=(n=>(n.FAILED_SILENT_AUTH="fsa",n.FAILED_SIGNUP="fs",n.FAILED_LOGIN="f",n.FAILED_LOGIN_INCORRECT_PASSWORD="fp",n.FAILED_CHANGE_PASSWORD="fcp",n.FAILED_BY_CONNECTOR="fc",n.FAILED_LOGIN_INVALID_EMAIL_USERNAME="fu",n.FAILED_HOOK="fh",n.FAILED_CROSS_ORIGIN_AUTHENTICATION="fcoa",n.SUCCESS_API_OPERATION="sapi",n.SUCCESS_CHANGE_PASSWORD="scp",n.SUCCESS_CHANGE_PASSWORD_REQUEST="scpr",n.SUCCESS_CHANGE_USERNAME="scu",n.SUCCESS_CROSS_ORIGIN_AUTHENTICATION="scoa",n.SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN="seacft",n.SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN="serft",n.SUCCESS_LOGIN="s",n.SUCCESS_LOGOUT="slo",n.SUCCESS_SIGNUP="ss",n.SUCCESS_SILENT_AUTH="ssa",n.SUCCESS_VERIFICATION_EMAIL="sv",n.SUCCESS_VERIFICATION_EMAIL_REQUEST="svr",n.CODE_LINK_SENT="cls",n.BLOCKED_ACCOUNT_EMAIL="limit_wc",n.BLOCKED_ACCOUNT_IP="limit_sul",n.BLOCKED_IP_ADDRESS="limit_mu",n))(_e||{});const Ih=o.z.enum(["cls","fsa","fs","f","fc","fcoa","fcp","fh","fp","fs","fu","s","sapi","scoa","scp","scpr","scu","seacft","serft","slo","ss","ssa","sv","svr"]),dd=o.z.object({name:o.z.string(),version:o.z.string(),env:o.z.object({node:o.z.string().optional()}).optional()}),lr=o.z.object({type:Ih,date:o.z.string(),description:o.z.string().optional(),log_id:o.z.string().optional(),_id:o.z.string().optional(),ip:o.z.string(),user_agent:o.z.string(),details:o.z.any().optional(),isMobile:o.z.boolean(),user_id:o.z.string().optional(),user_name:o.z.string().optional(),connection:o.z.string().optional(),connection_id:o.z.string().optional(),client_id:o.z.string().optional(),client_name:o.z.string().optional(),audience:o.z.string().optional(),scope:o.z.array(o.z.string()).optional(),strategy:o.z.string().optional(),strategy_type:o.z.string().optional(),hostname:o.z.string().optional(),auth0_client:dd.optional()}),pd=o.z.object({user_id:o.z.string(),password:o.z.string(),algorithm:o.z.enum(["bcrypt","argon2id"]).default("argon2id")}),jh=o.z.object({...pd.shape,created_at:o.z.string(),updated_at:o.z.string()}),fd=o.z.object({session_id:o.z.string(),client_id:o.z.string(),expires_at:o.z.string(),used_at:o.z.string(),deleted_at:o.z.string().optional(),user_id:o.z.string()}),Pa=o.z.object({created_at:o.z.string(),...fd.shape}),fo=o.z.object({kid:o.z.string().openapi({description:"The key id of the signing key"}),cert:o.z.string().openapi({description:"The public certificate of the signing key"}),fingerprint:o.z.string().openapi({description:"The cert fingerprint"}),thumbprint:o.z.string().openapi({description:"The cert thumbprint"}),pkcs7:o.z.string().optional().openapi({description:"The private key in pkcs7 format"}),current:o.z.boolean().optional().openapi({description:"True if the key is the current key"}),next:o.z.boolean().optional().openapi({description:"True if the key is the next key"}),previous:o.z.boolean().optional().openapi({description:"True if the key is the previous key"}),current_since:o.z.string().optional().openapi({description:"The date and time when the key became the current key"}),current_until:o.z.string().optional().openapi({description:"The date and time when the current key was rotated"}),revoked:o.z.boolean().optional().openapi({description:"True if the key is revoked"}),revoked_at:o.z.string().optional().openapi({description:"The date and time when the key was revoked"})});var ur=(n=>(n.RefreshToken="refresh_token",n.AuthorizationCode="authorization_code",n.ClientCredential="client_credentials",n.Passwordless="passwordless",n.Password="password",n))(ur||{});o.z.object({access_token:o.z.string(),id_token:o.z.string().optional(),scope:o.z.string().optional(),state:o.z.string().optional(),refresh_token:o.z.string().optional(),token_type:o.z.string(),expires_in:o.z.number()});o.z.object({code:o.z.string(),state:o.z.string().optional()});const hd=o.z.object({button_border_radius:o.z.number(),button_border_weight:o.z.number(),buttons_style:o.z.enum(["pill"]),input_border_radius:o.z.number(),input_border_weight:o.z.number(),inputs_style:o.z.enum(["pill"]),show_widget_shadow:o.z.boolean(),widget_border_weight:o.z.number(),widget_corner_radius:o.z.number()}),gd=o.z.object({base_focus_color:o.z.string(),base_hover_color:o.z.string(),body_text:o.z.string(),captcha_widget_theme:o.z.enum(["auto"]),error:o.z.string(),header:o.z.string(),icons:o.z.string(),input_background:o.z.string(),input_border:o.z.string(),input_filled_text:o.z.string(),input_labels_placeholders:o.z.string(),links_focused_components:o.z.string(),primary_button:o.z.string(),primary_button_label:o.z.string(),secondary_button_border:o.z.string(),secondary_button_label:o.z.string(),success:o.z.string(),widget_background:o.z.string(),widget_border:o.z.string()}),qt=o.z.object({bold:o.z.boolean(),size:o.z.number()}),_d=o.z.object({body_text:qt,buttons_text:qt,font_url:o.z.string(),input_labels:qt,links:qt,links_style:o.z.enum(["normal"]),reference_text_size:o.z.number(),subtitle:qt,title:qt}),md=o.z.object({background_color:o.z.string(),background_image_url:o.z.string(),page_layout:o.z.enum(["center"])}),yd=o.z.object({header_text_alignment:o.z.enum(["center"]),logo_height:o.z.number(),logo_position:o.z.enum(["center"]),logo_url:o.z.string(),social_buttons_layout:o.z.enum(["bottom"])}),vd=o.z.object({borders:hd,colors:gd,displayName:o.z.string(),fonts:_d,page_background:md,widget:yd}),zh=vd.extend({themeId:o.z.string()}),Fi=o.z.object({universal_login_experience:o.z.enum(["new","classic"]).default("new"),identifier_first:o.z.boolean().default(!0),password_first:o.z.boolean().default(!1),webauthn_platform_first_factor:o.z.boolean()}),Wi=o.z.object({name:o.z.string(),enabled:o.z.boolean().optional().default(!0),default_from_address:o.z.string().optional(),credentials:o.z.union([o.z.object({accessKeyId:o.z.string(),secretAccessKey:o.z.string(),region:o.z.string()}),o.z.object({smtp_host:o.z.array(o.z.string()),smtp_port:o.z.number(),smtp_user:o.z.string(),smtp_pass:o.z.string()}),o.z.object({api_key:o.z.string(),domain:o.z.string().optional()}),o.z.object({connectionString:o.z.string()}),o.z.object({tenantId:o.z.string(),clientId:o.z.string(),clientSecret:o.z.string()})]),settings:o.z.object({}).optional()});function Eh(n){const[e,t]=n.split("|");if(!e||!t)throw new Error(`Invalid user_id: ${n}`);return{connection:e,id:t}}const $h=new o.OpenAPIHono().openapi(o.createRoute({tags:["branding"],method:"get",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:uo}},description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=await n.env.data.branding.get(e);return t?n.json(t):n.json({})}).openapi(o.createRoute({tags:["branding"],method:"patch",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object(uo.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json");return await n.env.data.branding.set(e,t),n.text("OK")});var B=class extends Error{constructor(e=500,t){super(t==null?void 0:t.message,{cause:t==null?void 0:t.cause});te(this,"res");te(this,"status");this.res=t==null?void 0:t.res,this.status=e}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}},dr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ch(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Oh(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function i(){return this instanceof i?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(n).forEach(function(i){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}),t}function Bh(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var wd={exports:{}};const Nh={},Rh=Object.freeze(Object.defineProperty({__proto__:null,default:Nh},Symbol.toStringTag,{value:"Module"})),Th=Oh(Rh);(function(n){/**
1
+ "use strict";var kh=Object.defineProperty;var xh=(n,e,t)=>e in n?kh(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var te=(n,e,t)=>xh(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@hono/zod-openapi"),X=n=>typeof n=="string",Qn=()=>{let n,e;const t=new Promise((i,r)=>{n=i,e=r});return t.resolve=n,t.reject=e,t},sl=n=>n==null?"":""+n,Sh=(n,e,t)=>{n.forEach(i=>{e[i]&&(t[i]=e[i])})},Ah=/###/g,ol=n=>n&&n.indexOf("###")>-1?n.replace(Ah,"."):n,al=n=>!n||X(n),ri=(n,e,t)=>{const i=X(e)?e.split("."):e;let r=0;for(;r<i.length-1;){if(al(n))return{};const s=ol(i[r]);!n[s]&&t&&(n[s]=new t),Object.prototype.hasOwnProperty.call(n,s)?n=n[s]:n={},++r}return al(n)?{}:{obj:n,k:ol(i[r])}},cl=(n,e,t)=>{const{obj:i,k:r}=ri(n,e,Object);if(i!==void 0||e.length===1){i[r]=t;return}let s=e[e.length-1],o=e.slice(0,e.length-1),c=ri(n,o,Object);for(;c.obj===void 0&&o.length;)s=`${o[o.length-1]}.${s}`,o=o.slice(0,o.length-1),c=ri(n,o,Object),c!=null&&c.obj&&typeof c.obj[`${c.k}.${s}`]<"u"&&(c.obj=void 0);c.obj[`${c.k}.${s}`]=t},Ih=(n,e,t,i)=>{const{obj:r,k:s}=ri(n,e,Object);r[s]=r[s]||[],r[s].push(t)},or=(n,e)=>{const{obj:t,k:i}=ri(n,e);if(t&&Object.prototype.hasOwnProperty.call(t,i))return t[i]},Eh=(n,e,t)=>{const i=or(n,t);return i!==void 0?i:or(e,t)},vd=(n,e,t)=>{for(const i in e)i!=="__proto__"&&i!=="constructor"&&(i in n?X(n[i])||n[i]instanceof String||X(e[i])||e[i]instanceof String?t&&(n[i]=e[i]):vd(n[i],e[i],t):n[i]=e[i]);return n},wn=n=>n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var $h={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Ch=n=>X(n)?n.replace(/[&<>"'\/]/g,e=>$h[e]):n;class jh{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;const i=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,i),this.regExpQueue.push(e),i}}const zh=[" ",",","?","!",";"],Nh=new jh(20),Oh=(n,e,t)=>{e=e||"",t=t||"";const i=zh.filter(o=>e.indexOf(o)<0&&t.indexOf(o)<0);if(i.length===0)return!0;const r=Nh.getRegExp(`(${i.map(o=>o==="?"?"\\?":o).join("|")})`);let s=!r.test(n);if(!s){const o=n.indexOf(t);o>0&&!r.test(n.substring(0,o))&&(s=!0)}return s},mo=function(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!n)return;if(n[e])return Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0;const i=e.split(t);let r=n;for(let s=0;s<i.length;){if(!r||typeof r!="object")return;let o,c="";for(let l=s;l<i.length;++l)if(l!==s&&(c+=t),c+=i[l],o=r[c],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&l<i.length-1)continue;s+=l-s+1;break}r=o}return r},ar=n=>n==null?void 0:n.replace("_","-"),Bh={type:"logger",log(n){this.output("log",n)},warn(n){this.output("warn",n)},error(n){this.output("error",n)},output(n,e){var t,i;(i=(t=console==null?void 0:console[n])==null?void 0:t.apply)==null||i.call(t,console,e)}};class cr{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||Bh,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"log","",!0)}warn(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"warn","",!0)}error(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"error","")}deprecate(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,i,r){return r&&!this.debug?null:(X(e[0])&&(e[0]=`${i}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new cr(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new cr(this.logger,e)}}var ht=new cr;class ts{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(i=>{this.observers[i]||(this.observers[i]=new Map);const r=this.observers[i].get(t)||0;this.observers[i].set(t,r+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];this.observers[e]&&Array.from(this.observers[e].entries()).forEach(o=>{let[c,l]=o;for(let u=0;u<l;u++)c(...i)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(o=>{let[c,l]=o;for(let u=0;u<l;u++)c.apply(c,[e,...i])})}}class ll extends ts{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,i){var u,p;let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,o=r.ignoreJSONStructure!==void 0?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let c;e.indexOf(".")>-1?c=e.split("."):(c=[e,t],i&&(Array.isArray(i)?c.push(...i):X(i)&&s?c.push(...i.split(s)):c.push(i)));const l=or(this.data,c);return!l&&!t&&!i&&e.indexOf(".")>-1&&(e=c[0],t=c[1],i=c.slice(2).join(".")),l||!o||!X(i)?l:mo((p=(u=this.data)==null?void 0:u[e])==null?void 0:p[t],i,s)}addResource(e,t,i,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let c=[e,t];i&&(c=c.concat(o?i.split(o):i)),e.indexOf(".")>-1&&(c=e.split("."),r=t,t=c[1]),this.addNamespaces(t),cl(this.data,c,r),s.silent||this.emit("added",e,t,i,r)}addResources(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const s in i)(X(i[s])||Array.isArray(i[s]))&&this.addResource(e,t,s,i[s],{silent:!0});r.silent||this.emit("added",e,t,i)}addResourceBundle(e,t,i,r,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},c=[e,t];e.indexOf(".")>-1&&(c=e.split("."),r=i,i=t,t=c[1]),this.addNamespaces(t);let l=or(this.data,c)||{};o.skipCopy||(i=JSON.parse(JSON.stringify(i))),r?vd(l,i,s):l={...l,...i},cl(this.data,c,l),o.silent||this.emit("added",e,t,i)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(r=>t[r]&&Object.keys(t[r]).length>0)}toJSON(){return this.data}}var wd={processors:{},addPostProcessor(n){this.processors[n.name]=n},handle(n,e,t,i,r){return n.forEach(s=>{var o;e=((o=this.processors[s])==null?void 0:o.process(e,t,i,r))??e}),e}};const ul={};class lr extends ts{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Sh(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=ht.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const i=this.resolve(e,t);return(i==null?void 0:i.res)!==void 0}extractFromKey(e,t){let i=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;i===void 0&&(i=":");const r=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let s=t.ns||this.options.defaultNS||[];const o=i&&e.indexOf(i)>-1,c=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!Oh(e,i,r);if(o&&!c){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:X(s)?[s]:s};const u=e.split(i);(i!==r||i===r&&this.options.ns.indexOf(u[0])>-1)&&(s=u.shift()),e=u.join(r)}return{key:e,namespaces:X(s)?[s]:s}}translate(e,t,i){if(typeof t!="object"&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),typeof t=="object"&&(t={...t}),t||(t={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const r=t.returnDetails!==void 0?t.returnDetails:this.options.returnDetails,s=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator,{key:o,namespaces:c}=this.extractFromKey(e[e.length-1],t),l=c[c.length-1],u=t.lng||this.language,p=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((u==null?void 0:u.toLowerCase())==="cimode"){if(p){const K=t.nsSeparator||this.options.nsSeparator;return r?{res:`${l}${K}${o}`,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:`${l}${K}${o}`}return r?{res:o,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:o}const g=this.resolve(e,t);let m=g==null?void 0:g.res;const x=(g==null?void 0:g.usedKey)||o,h=(g==null?void 0:g.exactUsedKey)||o,_=Object.prototype.toString.apply(m),b=["[object Number]","[object Function]","[object RegExp]"],S=t.joinArrays!==void 0?t.joinArrays:this.options.joinArrays,N=!this.i18nFormat||this.i18nFormat.handleAsObject,T=!X(m)&&typeof m!="boolean"&&typeof m!="number";if(N&&m&&T&&b.indexOf(_)<0&&!(X(S)&&Array.isArray(m))){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const K=this.options.returnedObjectHandler?this.options.returnedObjectHandler(x,m,{...t,ns:c}):`key '${o} (${this.language})' returned an object instead of string.`;return r?(g.res=K,g.usedParams=this.getUsedParamsDetails(t),g):K}if(s){const K=Array.isArray(m),oe=K?[]:{},pe=K?h:x;for(const ce in m)if(Object.prototype.hasOwnProperty.call(m,ce)){const Re=`${pe}${s}${ce}`;oe[ce]=this.translate(Re,{...t,joinArrays:!1,ns:c}),oe[ce]===Re&&(oe[ce]=m[ce])}m=oe}}else if(N&&X(S)&&Array.isArray(m))m=m.join(S),m&&(m=this.extendTranslation(m,e,t,i));else{let K=!1,oe=!1;const pe=t.count!==void 0&&!X(t.count),ce=lr.hasDefaultValue(t),Re=pe?this.pluralResolver.getSuffix(u,t.count,t):"",nt=t.ordinal&&pe?this.pluralResolver.getSuffix(u,t.count,{ordinal:!1}):"",De=pe&&!t.ordinal&&t.count===0,$=De&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${Re}`]||t[`defaultValue${nt}`]||t.defaultValue;!this.isValidLookup(m)&&ce&&(K=!0,m=$),this.isValidLookup(m)||(oe=!0,m=o);const A=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&oe?void 0:m,w=ce&&$!==m&&this.options.updateMissing;if(oe||K||w){if(this.logger.log(w?"updateKey":"missingKey",u,l,o,w?$:m),s){const Z=this.resolve(o,{...t,keySeparator:!1});Z&&Z.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let v=[];const C=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if(this.options.saveMissingTo==="fallback"&&C&&C[0])for(let Z=0;Z<C.length;Z++)v.push(C[Z]);else this.options.saveMissingTo==="all"?v=this.languageUtils.toResolveHierarchy(t.lng||this.language):v.push(t.lng||this.language);const R=(Z,q,ee)=>{var M;const se=ce&&ee!==m?ee:A;this.options.missingKeyHandler?this.options.missingKeyHandler(Z,l,q,se,w,t):(M=this.backendConnector)!=null&&M.saveMissing&&this.backendConnector.saveMissing(Z,l,q,se,w,t),this.emit("missingKey",Z,l,q,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&pe?v.forEach(Z=>{const q=this.pluralResolver.getSuffixes(Z,t);De&&t[`defaultValue${this.options.pluralSeparator}zero`]&&q.indexOf(`${this.options.pluralSeparator}zero`)<0&&q.push(`${this.options.pluralSeparator}zero`),q.forEach(ee=>{R([Z],o+ee,t[`defaultValue${ee}`]||$)})}):R(v,o,$))}m=this.extendTranslation(m,e,t,g,i),oe&&m===o&&this.options.appendNamespaceToMissingKey&&(m=`${l}:${o}`),(oe||K)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${o}`:o,K?m:void 0))}return r?(g.res=m,g.usedParams=this.getUsedParamsDetails(t),g):m}extendTranslation(e,t,i,r,s){var u,p;var o=this;if((u=this.i18nFormat)!=null&&u.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...i},i.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init({...i,interpolation:{...this.options.interpolation,...i.interpolation}});const g=X(e)&&(((p=i==null?void 0:i.interpolation)==null?void 0:p.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let m;if(g){const h=e.match(this.interpolator.nestingRegexp);m=h&&h.length}let x=i.replace&&!X(i.replace)?i.replace:i;if(this.options.interpolation.defaultVariables&&(x={...this.options.interpolation.defaultVariables,...x}),e=this.interpolator.interpolate(e,x,i.lng||this.language||r.usedLng,i),g){const h=e.match(this.interpolator.nestingRegexp),_=h&&h.length;m<_&&(i.nest=!1)}!i.lng&&r&&r.res&&(i.lng=this.language||r.usedLng),i.nest!==!1&&(e=this.interpolator.nest(e,function(){for(var h=arguments.length,_=new Array(h),b=0;b<h;b++)_[b]=arguments[b];return(s==null?void 0:s[0])===_[0]&&!i.context?(o.logger.warn(`It seems you are nesting recursively key: ${_[0]} in key: ${t[0]}`),null):o.translate(..._,t)},i)),i.interpolation&&this.interpolator.reset()}const c=i.postProcess||this.options.postProcess,l=X(c)?[c]:c;return e!=null&&(l!=null&&l.length)&&i.applyPostProcessor!==!1&&(e=wd.handle(l,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(i)},...i}:i,this)),e}resolve(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i,r,s,o,c;return X(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(i))return;const u=this.extractFromKey(l,t),p=u.key;r=p;let g=u.namespaces;this.options.fallbackNS&&(g=g.concat(this.options.fallbackNS));const m=t.count!==void 0&&!X(t.count),x=m&&!t.ordinal&&t.count===0,h=t.context!==void 0&&(X(t.context)||typeof t.context=="number")&&t.context!=="",_=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);g.forEach(b=>{var S,N;this.isValidLookup(i)||(c=b,!ul[`${_[0]}-${b}`]&&((S=this.utils)!=null&&S.hasLoadedNamespace)&&!((N=this.utils)!=null&&N.hasLoadedNamespace(c))&&(ul[`${_[0]}-${b}`]=!0,this.logger.warn(`key "${r}" for languages "${_.join(", ")}" won't get resolved as namespace "${c}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),_.forEach(T=>{var pe;if(this.isValidLookup(i))return;o=T;const K=[p];if((pe=this.i18nFormat)!=null&&pe.addLookupKeys)this.i18nFormat.addLookupKeys(K,p,T,b,t);else{let ce;m&&(ce=this.pluralResolver.getSuffix(T,t.count,t));const Re=`${this.options.pluralSeparator}zero`,nt=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(m&&(K.push(p+ce),t.ordinal&&ce.indexOf(nt)===0&&K.push(p+ce.replace(nt,this.options.pluralSeparator)),x&&K.push(p+Re)),h){const De=`${p}${this.options.contextSeparator}${t.context}`;K.push(De),m&&(K.push(De+ce),t.ordinal&&ce.indexOf(nt)===0&&K.push(De+ce.replace(nt,this.options.pluralSeparator)),x&&K.push(De+Re))}}let oe;for(;oe=K.pop();)this.isValidLookup(i)||(s=oe,i=this.getResource(T,b,oe,t))}))})}),{res:i,usedKey:r,exactUsedKey:s,usedLng:o,usedNS:c}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,i){var s;let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return(s=this.i18nFormat)!=null&&s.getResource?this.i18nFormat.getResource(e,t,i,r):this.resourceStore.getResource(e,t,i,r)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],i=e.replace&&!X(e.replace);let r=i?e.replace:e;if(i&&typeof e.count<"u"&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!i){r={...r};for(const s of t)delete r[s]}return r}static hasDefaultValue(e){const t="defaultValue";for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&t===i.substring(0,t.length)&&e[i]!==void 0)return!0;return!1}}class dl{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ht.create("languageUtils")}getScriptPartFromCode(e){if(e=ar(e),!e||e.indexOf("-")<0)return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=ar(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(X(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(i=>{if(t)return;const r=this.formatLanguageCode(i);(!this.options.supportedLngs||this.isSupportedCode(r))&&(t=r)}),!t&&this.options.supportedLngs&&e.forEach(i=>{if(t)return;const r=this.getLanguagePartFromCode(i);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(s=>{if(s===r)return s;if(!(s.indexOf("-")<0&&r.indexOf("-")<0)&&(s.indexOf("-")>0&&r.indexOf("-")<0&&s.substring(0,s.indexOf("-"))===r||s.indexOf(r)===0&&r.length>1))return s})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),X(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let i=e[t];return i||(i=e[this.getScriptPartFromCode(t)]),i||(i=e[this.formatLanguageCode(t)]),i||(i=e[this.getLanguagePartFromCode(t)]),i||(i=e.default),i||[]}toResolveHierarchy(e,t){const i=this.getFallbackCodes(t||this.options.fallbackLng||[],e),r=[],s=o=>{o&&(this.isSupportedCode(o)?r.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return X(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):X(e)&&s(this.formatLanguageCode(e)),i.forEach(o=>{r.indexOf(o)<0&&s(this.formatLanguageCode(o))}),r}}const pl={zero:0,one:1,two:2,few:3,many:4,other:5},fl={select:n=>n===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Th{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=ht.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const i=ar(e==="dev"?"en":e),r=t.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:i,type:r});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let o;try{o=new Intl.PluralRules(i,{type:r})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),fl;if(!e.match(/-|_/))return fl;const l=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(l,t)}return this.pluralRulesCache[s]=o,o}needsPlural(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),(i==null?void 0:i.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,i).map(r=>`${t}${r}`)}getSuffixes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),i?i.resolvedOptions().pluralCategories.sort((r,s)=>pl[r]-pl[s]).map(r=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${r}`):[]}getSuffix(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=this.getRule(e,i);return r?`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,i))}}const hl=function(n,e,t){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=Eh(n,e,t);return!s&&r&&X(t)&&(s=mo(n,t,i),s===void 0&&(s=mo(e,t,i))),s},to=n=>n.replace(/\$/g,"$$$$");class Rh{constructor(){var t;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=ht.create("interpolator"),this.options=e,this.format=((t=e==null?void 0:e.interpolation)==null?void 0:t.format)||(i=>i),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:i,useRawValueToEscape:r,prefix:s,prefixEscaped:o,suffix:c,suffixEscaped:l,formatSeparator:u,unescapeSuffix:p,unescapePrefix:g,nestingPrefix:m,nestingPrefixEscaped:x,nestingSuffix:h,nestingSuffixEscaped:_,nestingOptionsSeparator:b,maxReplaces:S,alwaysFormat:N}=e.interpolation;this.escape=t!==void 0?t:Ch,this.escapeValue=i!==void 0?i:!0,this.useRawValueToEscape=r!==void 0?r:!1,this.prefix=s?wn(s):o||"{{",this.suffix=c?wn(c):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=p?"":g||"-",this.unescapeSuffix=this.unescapePrefix?"":p||"",this.nestingPrefix=m?wn(m):x||wn("$t("),this.nestingSuffix=h?wn(h):_||wn(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=S||1e3,this.alwaysFormat=N!==void 0?N:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,i)=>(t==null?void 0:t.source)===i?(t.lastIndex=0,t):new RegExp(i,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,t,i,r){var x;let s,o,c;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=h=>{if(h.indexOf(this.formatSeparator)<0){const N=hl(t,l,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(N,void 0,i,{...r,...t,interpolationkey:h}):N}const _=h.split(this.formatSeparator),b=_.shift().trim(),S=_.join(this.formatSeparator).trim();return this.format(hl(t,l,b,this.options.keySeparator,this.options.ignoreJSONStructure),S,i,{...r,...t,interpolationkey:b})};this.resetRegExp();const p=(r==null?void 0:r.missingInterpolationHandler)||this.options.missingInterpolationHandler,g=((x=r==null?void 0:r.interpolation)==null?void 0:x.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>to(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?to(this.escape(h)):to(h)}].forEach(h=>{for(c=0;s=h.regex.exec(e);){const _=s[1].trim();if(o=u(_),o===void 0)if(typeof p=="function"){const S=p(e,s,r);o=X(S)?S:""}else if(r&&Object.prototype.hasOwnProperty.call(r,_))o="";else if(g){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${_} for interpolating ${e}`),o="";else!X(o)&&!this.useRawValueToEscape&&(o=sl(o));const b=h.safeValue(o);if(e=e.replace(s[0],b),g?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=s[0].length):h.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),e}nest(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r,s,o;const c=(l,u)=>{const p=this.nestingOptionsSeparator;if(l.indexOf(p)<0)return l;const g=l.split(new RegExp(`${p}[ ]*{`));let m=`{${g[1]}`;l=g[0],m=this.interpolate(m,o);const x=m.match(/'/g),h=m.match(/"/g);(((x==null?void 0:x.length)??0)%2===0&&!h||h.length%2!==0)&&(m=m.replace(/'/g,'"'));try{o=JSON.parse(m),u&&(o={...u,...o})}catch(_){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,_),`${l}${p}${m}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,l};for(;r=this.nestingRegexp.exec(e);){let l=[];o={...i},o=o.replace&&!X(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=!1;if(r[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(r[1])){const p=r[1].split(this.formatSeparator).map(g=>g.trim());r[1]=p.shift(),l=p,u=!0}if(s=t(c.call(this,r[1].trim(),o),o),s&&r[0]===e&&!X(s))return s;X(s)||(s=sl(s)),s||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),s=""),u&&(s=l.reduce((p,g)=>this.format(p,g,i.lng,{...i,interpolationkey:r[1].trim()}),s.trim())),e=e.replace(r[0],s),this.regexp.lastIndex=0}return e}}const Ph=n=>{let e=n.toLowerCase().trim();const t={};if(n.indexOf("(")>-1){const i=n.split("(");e=i[0].toLowerCase().trim();const r=i[1].substring(0,i[1].length-1);e==="currency"&&r.indexOf(":")<0?t.currency||(t.currency=r.trim()):e==="relativetime"&&r.indexOf(":")<0?t.range||(t.range=r.trim()):r.split(";").forEach(o=>{if(o){const[c,...l]=o.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),p=c.trim();t[p]||(t[p]=u),u==="false"&&(t[p]=!1),u==="true"&&(t[p]=!0),isNaN(u)||(t[p]=parseInt(u,10))}})}return{formatName:e,formatOptions:t}},bn=n=>{const e={};return(t,i,r)=>{let s=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(s={...s,[r.interpolationkey]:void 0});const o=i+JSON.stringify(s);let c=e[o];return c||(c=n(ar(i),r),e[o]=c),c(t)}};class Lh{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=ht.create("formatter"),this.options=e,this.formats={number:bn((t,i)=>{const r=new Intl.NumberFormat(t,{...i});return s=>r.format(s)}),currency:bn((t,i)=>{const r=new Intl.NumberFormat(t,{...i,style:"currency"});return s=>r.format(s)}),datetime:bn((t,i)=>{const r=new Intl.DateTimeFormat(t,{...i});return s=>r.format(s)}),relativetime:bn((t,i)=>{const r=new Intl.RelativeTimeFormat(t,{...i});return s=>r.format(s,i.range||"day")}),list:bn((t,i)=>{const r=new Intl.ListFormat(t,{...i});return s=>r.format(s)})},this.init(e)}init(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=t.interpolation.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=bn(t)}format(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=t.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(c=>c.indexOf(")")>-1)){const c=s.findIndex(l=>l.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,c)].join(this.formatSeparator)}return s.reduce((c,l)=>{var g;const{formatName:u,formatOptions:p}=Ph(l);if(this.formats[u]){let m=c;try{const x=((g=r==null?void 0:r.formatParams)==null?void 0:g[r.interpolationkey])||{},h=x.locale||x.lng||r.locale||r.lng||i;m=this.formats[u](c,h,{...p,...r,...x})}catch(x){this.logger.warn(x)}return m}else this.logger.warn(`there was no format function for ${u}`);return c},e)}}const Uh=(n,e)=>{n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)};class Vh extends ts{constructor(e,t,i){var s,o;let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=i,this.languageUtils=i.languageUtils,this.options=r,this.logger=ht.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],(o=(s=this.backend)==null?void 0:s.init)==null||o.call(s,i,r.backend,r)}queueLoad(e,t,i,r){const s={},o={},c={},l={};return e.forEach(u=>{let p=!0;t.forEach(g=>{const m=`${u}|${g}`;!i.reload&&this.store.hasResourceBundle(u,g)?this.state[m]=2:this.state[m]<0||(this.state[m]===1?o[m]===void 0&&(o[m]=!0):(this.state[m]=1,p=!1,o[m]===void 0&&(o[m]=!0),s[m]===void 0&&(s[m]=!0),l[g]===void 0&&(l[g]=!0)))}),p||(c[u]=!0)}),(Object.keys(s).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(s),pending:Object.keys(o),toLoadLanguages:Object.keys(c),toLoadNamespaces:Object.keys(l)}}loaded(e,t,i){const r=e.split("|"),s=r[0],o=r[1];t&&this.emit("failedLoading",s,o,t),!t&&i&&this.store.addResourceBundle(s,o,i,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&i&&(this.state[e]=0);const c={};this.queue.forEach(l=>{Ih(l.loaded,[s],o),Uh(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{c[u]||(c[u]={});const p=l.loaded[u];p.length&&p.forEach(g=>{c[u][g]===void 0&&(c[u][g]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(l=>!l.done)}read(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:i,tried:r,wait:s,callback:o});return}this.readingCalls++;const c=(u,p)=>{if(this.readingCalls--,this.waitingReads.length>0){const g=this.waitingReads.shift();this.read(g.lng,g.ns,g.fcName,g.tried,g.wait,g.callback)}if(u&&p&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,i,r+1,s*2,o)},s);return}o(u,p)},l=this.backend[i].bind(this.backend);if(l.length===2){try{const u=l(e,t);u&&typeof u.then=="function"?u.then(p=>c(null,p)).catch(c):c(null,u)}catch(u){c(u)}return}return l(e,t,c)}prepareLoading(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();X(e)&&(e=this.languageUtils.toResolveHierarchy(e)),X(t)&&(t=[t]);const s=this.queueLoad(e,t,i,r);if(!s.toLoad.length)return s.pending.length||r(),null;s.toLoad.forEach(o=>{this.loadOne(o)})}load(e,t,i){this.prepareLoading(e,t,{},i)}reload(e,t,i){this.prepareLoading(e,t,{reload:!0},i)}loadOne(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const i=e.split("|"),r=i[0],s=i[1];this.read(r,s,"read",void 0,void 0,(o,c)=>{o&&this.logger.warn(`${t}loading namespace ${s} for language ${r} failed`,o),!o&&c&&this.logger.log(`${t}loaded namespace ${s} for language ${r}`,c),this.loaded(e,o,c)})}saveMissing(e,t,i,r,s){var l,u,p,g,m;let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if((u=(l=this.services)==null?void 0:l.utils)!=null&&u.hasLoadedNamespace&&!((g=(p=this.services)==null?void 0:p.utils)!=null&&g.hasLoadedNamespace(t))){this.logger.warn(`did not save key "${i}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(i==null||i==="")){if((m=this.backend)!=null&&m.create){const x={...o,isUpdate:s},h=this.backend.create.bind(this.backend);if(h.length<6)try{let _;h.length===5?_=h(e,t,i,r,x):_=h(e,t,i,r),_&&typeof _.then=="function"?_.then(b=>c(null,b)).catch(c):c(null,_)}catch(_){c(_)}else h(e,t,i,r,c,x)}!e||!e[0]||this.store.addResource(e[0],t,i,r)}}}const gl=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:n=>{let e={};if(typeof n[1]=="object"&&(e=n[1]),X(n[1])&&(e.defaultValue=n[1]),X(n[2])&&(e.tDescription=n[2]),typeof n[2]=="object"||typeof n[3]=="object"){const t=n[3]||n[2];Object.keys(t).forEach(i=>{e[i]=t[i]})}return e},interpolation:{escapeValue:!0,format:n=>n,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),_l=n=>{var e,t;return X(n.ns)&&(n.ns=[n.ns]),X(n.fallbackLng)&&(n.fallbackLng=[n.fallbackLng]),X(n.fallbackNS)&&(n.fallbackNS=[n.fallbackNS]),((t=(e=n.supportedLngs)==null?void 0:e.indexOf)==null?void 0:t.call(e,"cimode"))<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),typeof n.initImmediate=="boolean"&&(n.initAsync=n.initImmediate),n},Ki=()=>{},Mh=n=>{Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(t=>{typeof n[t]=="function"&&(n[t]=n[t].bind(n))})};class di extends ts{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if(super(),this.options=_l(e),this.services={},this.logger=ht,this.modules={external:[]},Mh(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof t=="function"&&(i=t,t={}),!t.defaultNS&&t.defaultNS!==!1&&t.ns&&(X(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=gl();this.options={...r,...this.options,..._l(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);const s=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?ht.init(s(this.modules.logger),this.options):ht.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:p=Lh;const g=new dl(this.options);this.store=new ll(this.options.resources,this.options);const m=this.services;m.logger=ht,m.resourceStore=this.store,m.languageUtils=g,m.pluralResolver=new Th(g,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),p&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(m.formatter=s(p),m.formatter.init(m,this.options),this.options.interpolation.format=m.formatter.format.bind(m.formatter)),m.interpolator=new Rh(this.options),m.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},m.backendConnector=new Vh(s(this.modules.backend),m.resourceStore,m,this.options),m.backendConnector.on("*",function(x){for(var h=arguments.length,_=new Array(h>1?h-1:0),b=1;b<h;b++)_[b-1]=arguments[b];e.emit(x,..._)}),this.modules.languageDetector&&(m.languageDetector=s(this.modules.languageDetector),m.languageDetector.init&&m.languageDetector.init(m,this.options.detection,this.options)),this.modules.i18nFormat&&(m.i18nFormat=s(this.modules.i18nFormat),m.i18nFormat.init&&m.i18nFormat.init(this)),this.translator=new lr(this.services,this.options),this.translator.on("*",function(x){for(var h=arguments.length,_=new Array(h>1?h-1:0),b=1;b<h;b++)_[b-1]=arguments[b];e.emit(x,..._)}),this.modules.external.forEach(x=>{x.init&&x.init(this)})}if(this.format=this.options.interpolation.format,i||(i=Ki),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(p=>{this[p]=function(){return e.store[p](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=function(){return e.store[p](...arguments),e}});const l=Qn(),u=()=>{const p=(g,m)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(m),i(g,m)};if(this.languages&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initAsync?u():setTimeout(u,0),l}loadResources(e){var s,o;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ki;const r=X(e)?e:this.language;if(typeof e=="function"&&(i=e),!this.options.resources||this.options.partialBundledLanguages){if((r==null?void 0:r.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return i();const c=[],l=u=>{if(!u||u==="cimode")return;this.services.languageUtils.toResolveHierarchy(u).forEach(g=>{g!=="cimode"&&c.indexOf(g)<0&&c.push(g)})};r?l(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(p=>l(p)),(o=(s=this.options.preload)==null?void 0:s.forEach)==null||o.call(s,u=>l(u)),this.services.backendConnector.load(c,this.options.ns,u=>{!u&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),i(u)})}else i(null)}reloadResources(e,t,i){const r=Qn();return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),i||(i=Ki),this.services.backendConnector.reload(e,t,s=>{r.resolve(),i(s)}),r}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&wd.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let t=0;t<this.languages.length;t++){const i=this.languages[t];if(!(["cimode","dev"].indexOf(i)>-1)&&this.store.hasLanguageSomeTranslations(i)){this.resolvedLanguage=i;break}}}changeLanguage(e,t){var i=this;this.isLanguageChangingTo=e;const r=Qn();this.emit("languageChanging",e);const s=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},o=(l,u)=>{u?(s(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,r.resolve(function(){return i.t(...arguments)}),t&&t(l,function(){return i.t(...arguments)})},c=l=>{var p,g;!e&&!l&&this.services.languageDetector&&(l=[]);const u=X(l)?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||s(u),this.translator.language||this.translator.changeLanguage(u),(g=(p=this.services.languageDetector)==null?void 0:p.cacheUserLanguage)==null||g.call(p,u)),this.loadResources(u,m=>{o(m,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?c(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(c):this.services.languageDetector.detect(c):c(e),r}getFixedT(e,t,i){var r=this;const s=function(o,c){let l;if(typeof c!="object"){for(var u=arguments.length,p=new Array(u>2?u-2:0),g=2;g<u;g++)p[g-2]=arguments[g];l=r.options.overloadTranslationOptionHandler([o,c].concat(p))}else l={...c};l.lng=l.lng||s.lng,l.lngs=l.lngs||s.lngs,l.ns=l.ns||s.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||i||s.keyPrefix);const m=r.options.keySeparator||".";let x;return l.keyPrefix&&Array.isArray(o)?x=o.map(h=>`${l.keyPrefix}${m}${h}`):x=l.keyPrefix?`${l.keyPrefix}${m}${o}`:o,r.t(x,l)};return X(e)?s.lng=e:s.lngs=e,s.ns=t,s.keyPrefix=i,s}t(){var r;for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return(r=this.translator)==null?void 0:r.translate(...t)}exists(){var r;for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return(r=this.translator)==null?void 0:r.exists(...t)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const i=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(i.toLowerCase()==="cimode")return!0;const o=(c,l)=>{const u=this.services.backendConnector.state[`${c}|${l}`];return u===-1||u===0||u===2};if(t.precheck){const c=t.precheck(this,o);if(c!==void 0)return c}return!!(this.hasResourceBundle(i,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(i,e)&&(!r||o(s,e)))}loadNamespaces(e,t){const i=Qn();return this.options.ns?(X(e)&&(e=[e]),e.forEach(r=>{this.options.ns.indexOf(r)<0&&this.options.ns.push(r)}),this.loadResources(r=>{i.resolve(),t&&t(r)}),i):(t&&t(),Promise.resolve())}loadLanguages(e,t){const i=Qn();X(e)&&(e=[e]);const r=this.options.preload||[],s=e.filter(o=>r.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return s.length?(this.options.preload=r.concat(s),this.loadResources(o=>{i.resolve(),t&&t(o)}),i):(t&&t(),Promise.resolve())}dir(e){var r,s;if(e||(e=this.resolvedLanguage||(((r=this.languages)==null?void 0:r.length)>0?this.languages[0]:this.language)),!e)return"rtl";const t=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],i=((s=this.services)==null?void 0:s.languageUtils)||new dl(gl());return t.indexOf(i.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new di(e,t)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ki;const i=e.forkResourceStore;i&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},s=new di(r);if((e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(c=>{s[c]=this[c]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},i){const c=Object.keys(this.store.data).reduce((l,u)=>(l[u]={...this.store.data[u]},Object.keys(l[u]).reduce((p,g)=>(p[g]={...l[u][g]},p),{})),{});s.store=new ll(c,r),s.services.resourceStore=s.store}return s.translator=new lr(s.services,r),s.translator.on("*",function(c){for(var l=arguments.length,u=new Array(l>1?l-1:0),p=1;p<l;p++)u[p-1]=arguments[p];s.emit(c,...u)}),s.init(r,t),s.translator.options=r,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Ne=di.createInstance();Ne.createInstance=di.createInstance;Ne.createInstance;Ne.dir;Ne.init;Ne.loadResources;Ne.reloadResources;Ne.use;Ne.changeLanguage;Ne.getFixedT;const ue=Ne.t;Ne.exists;Ne.setDefaultNamespace;Ne.hasLoadedNamespace;Ne.loadNamespaces;Ne.loadLanguages;const Mt=a.z.object({start:a.z.number(),limit:a.z.number(),length:a.z.number()}),Ha=a.z.object({created_at:a.z.string(),updated_at:a.z.string()}),bd=a.z.object({email:a.z.string().optional(),email_verified:a.z.boolean().optional(),name:a.z.string().optional(),username:a.z.string().optional(),given_name:a.z.string().optional(),phone_number:a.z.string().optional(),phone_verified:a.z.boolean().optional(),family_name:a.z.string().optional()}).catchall(a.z.any()),kd=a.z.object({connection:a.z.string(),user_id:a.z.string(),provider:a.z.string(),isSocial:a.z.boolean(),access_token:a.z.string().optional(),access_token_secret:a.z.string().optional(),refresh_token:a.z.string().optional(),profileData:bd.optional()}),ns=a.z.object({email:a.z.string().optional(),username:a.z.string().optional(),given_name:a.z.string().optional(),family_name:a.z.string().optional(),nickname:a.z.string().optional(),name:a.z.string().optional(),picture:a.z.string().optional(),locale:a.z.string().optional(),linked_to:a.z.string().optional(),profileData:a.z.string().optional(),user_id:a.z.string().optional(),app_metadata:a.z.any().default({}).optional(),user_metadata:a.z.any().default({}).optional()}),ur=ns.extend({email_verified:a.z.boolean().default(!1),verify_email:a.z.boolean().optional(),last_ip:a.z.string().optional(),last_login:a.z.string().optional(),user_id:a.z.string().optional(),provider:a.z.string().default("email"),connection:a.z.string().default("email"),is_social:a.z.boolean().optional()}),Da=a.z.object({...ur.shape,...Ha.shape,user_id:a.z.string(),is_social:a.z.boolean(),email:a.z.string(),login_count:a.z.number(),identities:a.z.array(kd).optional()}),ft=Da,Hh=ns.extend({email:a.z.string(),login_count:a.z.number(),multifactor:a.z.array(a.z.string()).optional(),last_ip:a.z.string().optional(),last_login:a.z.string().optional(),user_id:a.z.string()}).catchall(a.z.any()),Dh="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Fh=(n=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(n));for(;n--;)e+=Dh[t[n]&63];return e};const xd=a.z.object({audience:a.z.string().optional(),recipient:a.z.string().optional(),createUpnClaim:a.z.boolean().optional(),mapUnknownClaimsAsIs:a.z.boolean().optional(),passthroughClaimsWithNoMapping:a.z.boolean().optional(),mapIdentities:a.z.boolean().optional(),signatureAlgorithm:a.z.string().optional(),digestAlgorithm:a.z.string().optional(),issuer:a.z.string().optional(),destination:a.z.string().optional(),lifetimeInSeconds:a.z.number().optional(),signResponse:a.z.boolean().optional(),nameIdentifierFormat:a.z.string().optional(),nameIdentifierProbes:a.z.array(a.z.string()).optional(),authnContextClassRef:a.z.string().optional(),mappings:a.z.record(a.z.string()).optional()}),dr=a.z.object({id:a.z.string(),name:a.z.string(),callbacks:a.z.array(a.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs whitelisted to use as a callback to the client after authentication."}),allowed_origins:a.z.array(a.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs allowed to make requests from JavaScript to Auth0 API (typically used with CORS). By default, all your callback URLs will be allowed. This field allows you to enter other origins if necessary. You can also use wildcards at the subdomain level. Query strings and hash information are not taken into account when validating these URLs."}),web_origins:a.z.array(a.z.string()).default([]).optional().openapi({description:"Comma-separated list of allowed origins for use with Cross-Origin Authentication, Device Flow, and web message response mode."}),allowed_logout_urls:a.z.array(a.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs that are valid to redirect to after logout from Auth0. Wildcards are allowed for subdomains."}),allowed_clients:a.z.array(a.z.string()).default([]).optional().openapi({description:"Ids of clients that will be allowed to perform delegation requests. Clients that will be allowed to make delegation request. By default, all your clients will be allowed. This field allows you to specify specific clients"}),addons:a.z.object({samlp:xd.optional()}).default({}).optional().openapi({description:"Addons associated with the client. The key is the addon's package name and the value is an object with the configuration for the addon."}),email_validation:a.z.enum(["enabled","disabled","enforced"]).default("enforced").optional().openapi({description:"Defines if it possible to sign in with an unverified email and if verification emails will be sent. This is not available in auth0"}),client_secret:a.z.string().default(()=>Fh()).optional(),disable_sign_ups:a.z.boolean().optional().default(!1).openapi({description:"Prevents users from signing up using the hosted login page. This is not available in auth0"})}),Jt=a.z.object({created_at:a.z.string().transform(n=>n===null?"":n),updated_at:a.z.string().transform(n=>n===null?"":n),...dr.shape});var Pt=(n=>(n.TOKEN="token",n.TOKEN_ID_TOKEN="token id_token",n.CODE="code",n))(Pt||{}),nn=(n=>(n.QUERY="query",n.FRAGMENT="fragment",n.FORM_POST="form_post",n.WEB_MESSAGE="web_message",n.SAML_POST="saml_post",n))(nn||{}),is=(n=>(n.S256="S256",n.Plain="plain",n))(is||{});const Fa=a.z.object({client_id:a.z.string(),vendor_id:a.z.string().optional(),act_as:a.z.string().optional(),response_type:a.z.nativeEnum(Pt).optional(),response_mode:a.z.nativeEnum(nn).optional(),redirect_uri:a.z.string().optional(),audience:a.z.string().optional(),state:a.z.string().optional(),nonce:a.z.string().optional(),scope:a.z.string().optional(),prompt:a.z.string().optional(),code_challenge_method:a.z.nativeEnum(is).optional(),code_challenge:a.z.string().optional(),username:a.z.string().optional(),ui_locales:a.z.string().optional()}),yo=a.z.object({colors:a.z.object({primary:a.z.string(),page_background:a.z.object({type:a.z.string().optional(),start:a.z.string().optional(),end:a.z.string().optional(),angle_deg:a.z.number().optional()}).optional()}).optional(),logo_url:a.z.string().optional(),favicon_url:a.z.string().optional(),font:a.z.object({url:a.z.string()}).optional()}),pr=a.z.object({id:a.z.string().optional(),name:a.z.string(),strategy:a.z.string(),options:a.z.object({kid:a.z.string().optional(),team_id:a.z.string().optional(),realms:a.z.string().optional(),client_id:a.z.string().optional(),client_secret:a.z.string().optional(),app_secret:a.z.string().optional(),scope:a.z.string().optional(),authorization_endpoint:a.z.string().default("").optional(),token_endpoint:a.z.string().default("").optional(),userinfo_endpoint:a.z.string().default("").optional(),jwks_uri:a.z.string().default("").optional(),discovery_url:a.z.string().default("").optional(),issuer:a.z.string().default("").optional()}).default({}).optional(),enabled_clients:a.z.array(a.z.string()).default([]).optional(),response_type:a.z.custom().optional(),response_mode:a.z.custom().optional()}),zt=a.z.object({id:a.z.string(),created_at:a.z.string().transform(n=>n===null?"":n),updated_at:a.z.string().transform(n=>n===null?"":n)}).extend(pr.shape),fr=a.z.object({name:a.z.string(),audience:a.z.string(),sender_email:a.z.string().email(),sender_name:a.z.string(),support_url:a.z.string().url().optional(),logo:a.z.string().url().optional(),primary_color:a.z.string().optional(),secondary_color:a.z.string().optional(),language:a.z.string().optional()}),An=a.z.object({created_at:a.z.string().transform(n=>n===null?"":n),updated_at:a.z.string().transform(n=>n===null?"":n),id:a.z.string(),...fr.shape}),qh=a.z.object({logoUrl:a.z.string(),loginBackgroundImage:a.z.string().nullish(),style:a.z.object({primaryColor:a.z.string(),buttonTextColor:a.z.string(),primaryHoverColor:a.z.string()}),supportEmail:a.z.string().nullable(),supportUrl:a.z.string().nullable(),name:a.z.string(),showGreyishBackground:a.z.boolean().optional(),termsAndConditionsUrl:a.z.string().nullable(),companyName:a.z.string().optional(),checkoutHideSocial:a.z.boolean().optional(),siteUrl:a.z.string().nullable(),manageSubscriptionsUrl:a.z.string().optional()}),Kh=a.z.object({domain:a.z.string(),dkim_private_key:a.z.string().optional(),dkim_public_key:a.z.string().optional(),email_api_key:a.z.string().optional(),email_service:a.z.string().optional()});a.z.object({...Jt.shape,domains:a.z.array(Kh),tenant:An,connections:a.z.array(zt)});const Sd=a.z.enum(["password_reset","email_verification","otp","authorization_code","oauth2_state","ticket"]),Ad=a.z.object({code_id:a.z.string().openapi({description:"The code that will be used in for instance an email verification flow"}),login_id:a.z.string().openapi({description:"The id of the login session that the code is connected to"}),connection_id:a.z.string().optional().openapi({description:"The connection that the code is connected to"}),code_type:Sd,code_verifier:a.z.string().optional().openapi({description:"The code verifier used in PKCE in outbound flows"}),expires_at:a.z.string(),used_at:a.z.string().optional(),user_id:a.z.string().optional()}),Wh=a.z.object({...Ad.shape,created_at:a.z.string()}),Id=a.z.object({domain:a.z.string(),dkim_private_key:a.z.string().optional(),dkim_public_key:a.z.string().optional(),email_api_key:a.z.string().optional(),email_service:a.z.string().optional()}),Gh=Ha.extend({...Id.shape,id:a.z.string()}),hr=a.z.object({trigger_id:a.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),enabled:a.z.boolean().default(!1),url:a.z.string(),hook_id:a.z.string().optional(),synchronous:a.z.boolean().default(!1),priority:a.z.number().optional()}),xn=hr.extend({...Ha.shape,hook_id:a.z.string()}),qa=a.z.object({alg:a.z.enum(["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512"]),e:a.z.string(),kid:a.z.string(),kty:a.z.enum(["RSA","EC","oct"]),n:a.z.string(),x5t:a.z.string().optional(),x5c:a.z.array(a.z.string()).optional(),use:a.z.enum(["sig","enc"]).optional()}),Ed=a.z.object({keys:a.z.array(qa)}),vo=a.z.object({issuer:a.z.string(),authorization_endpoint:a.z.string(),token_endpoint:a.z.string(),device_authorization_endpoint:a.z.string(),userinfo_endpoint:a.z.string(),mfa_challenge_endpoint:a.z.string(),jwks_uri:a.z.string(),registration_endpoint:a.z.string(),revocation_endpoint:a.z.string(),scopes_supported:a.z.array(a.z.string()),response_types_supported:a.z.array(a.z.string()),code_challenge_methods_supported:a.z.array(a.z.string()),response_modes_supported:a.z.array(a.z.string()),subject_types_supported:a.z.array(a.z.string()),id_token_signing_alg_values_supported:a.z.array(a.z.string()),token_endpoint_auth_methods_supported:a.z.array(a.z.string()),claims_supported:a.z.array(a.z.string()),request_uri_parameter_supported:a.z.boolean(),request_parameter_supported:a.z.boolean(),token_endpoint_auth_signing_alg_values_supported:a.z.array(a.z.string())}),$d=a.z.object({auth0Client:a.z.string().optional(),authParams:Fa,expires_at:a.z.string(),deleted_at:a.z.string().optional(),ip:a.z.string().optional(),useragent:a.z.string().optional()}).openapi({description:"This represents a login sesion"}),Jh=a.z.object({...$d.shape,login_id:a.z.string().openapi({description:"This is is used as the state in the universal login"}),created_at:a.z.string(),updated_at:a.z.string()});var _e=(n=>(n.FAILED_SILENT_AUTH="fsa",n.FAILED_SIGNUP="fs",n.FAILED_LOGIN="f",n.FAILED_LOGIN_INCORRECT_PASSWORD="fp",n.FAILED_CHANGE_PASSWORD="fcp",n.FAILED_BY_CONNECTOR="fc",n.FAILED_LOGIN_INVALID_EMAIL_USERNAME="fu",n.FAILED_HOOK="fh",n.FAILED_CROSS_ORIGIN_AUTHENTICATION="fcoa",n.SUCCESS_API_OPERATION="sapi",n.SUCCESS_CHANGE_PASSWORD="scp",n.SUCCESS_CHANGE_PASSWORD_REQUEST="scpr",n.SUCCESS_CHANGE_USERNAME="scu",n.SUCCESS_CROSS_ORIGIN_AUTHENTICATION="scoa",n.SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN="seacft",n.SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN="serft",n.SUCCESS_LOGIN="s",n.SUCCESS_LOGOUT="slo",n.SUCCESS_SIGNUP="ss",n.SUCCESS_SILENT_AUTH="ssa",n.SUCCESS_VERIFICATION_EMAIL="sv",n.SUCCESS_VERIFICATION_EMAIL_REQUEST="svr",n.CODE_LINK_SENT="cls",n.BLOCKED_ACCOUNT_EMAIL="limit_wc",n.BLOCKED_ACCOUNT_IP="limit_sul",n.BLOCKED_IP_ADDRESS="limit_mu",n))(_e||{});const Zh=a.z.enum(["cls","fsa","fs","f","fc","fcoa","fcp","fh","fp","fs","fu","s","sapi","scoa","scp","scpr","scu","seacft","serft","slo","ss","ssa","sv","svr"]),Cd=a.z.object({name:a.z.string(),version:a.z.string(),env:a.z.object({node:a.z.string().optional()}).optional()}),gr=a.z.object({type:Zh,date:a.z.string(),description:a.z.string().optional(),log_id:a.z.string().optional(),_id:a.z.string().optional(),ip:a.z.string(),user_agent:a.z.string(),details:a.z.any().optional(),isMobile:a.z.boolean(),user_id:a.z.string().optional(),user_name:a.z.string().optional(),connection:a.z.string().optional(),connection_id:a.z.string().optional(),client_id:a.z.string().optional(),client_name:a.z.string().optional(),audience:a.z.string().optional(),scope:a.z.array(a.z.string()).optional(),strategy:a.z.string().optional(),strategy_type:a.z.string().optional(),hostname:a.z.string().optional(),auth0_client:Cd.optional()}),jd=a.z.object({user_id:a.z.string(),password:a.z.string(),algorithm:a.z.enum(["bcrypt","argon2id"]).default("argon2id")}),Yh=a.z.object({...jd.shape,created_at:a.z.string(),updated_at:a.z.string()}),zd=a.z.object({session_id:a.z.string(),client_id:a.z.string(),expires_at:a.z.string(),used_at:a.z.string(),deleted_at:a.z.string().optional(),user_id:a.z.string()}),Ka=a.z.object({created_at:a.z.string(),...zd.shape}),wo=a.z.object({kid:a.z.string().openapi({description:"The key id of the signing key"}),cert:a.z.string().openapi({description:"The public certificate of the signing key"}),fingerprint:a.z.string().openapi({description:"The cert fingerprint"}),thumbprint:a.z.string().openapi({description:"The cert thumbprint"}),pkcs7:a.z.string().optional().openapi({description:"The private key in pkcs7 format"}),current:a.z.boolean().optional().openapi({description:"True if the key is the current key"}),next:a.z.boolean().optional().openapi({description:"True if the key is the next key"}),previous:a.z.boolean().optional().openapi({description:"True if the key is the previous key"}),current_since:a.z.string().optional().openapi({description:"The date and time when the key became the current key"}),current_until:a.z.string().optional().openapi({description:"The date and time when the current key was rotated"}),revoked:a.z.boolean().optional().openapi({description:"True if the key is revoked"}),revoked_at:a.z.string().optional().openapi({description:"The date and time when the key was revoked"})});var _r=(n=>(n.RefreshToken="refresh_token",n.AuthorizationCode="authorization_code",n.ClientCredential="client_credentials",n.Passwordless="passwordless",n.Password="password",n))(_r||{});a.z.object({access_token:a.z.string(),id_token:a.z.string().optional(),scope:a.z.string().optional(),state:a.z.string().optional(),refresh_token:a.z.string().optional(),token_type:a.z.string(),expires_in:a.z.number()});a.z.object({code:a.z.string(),state:a.z.string().optional()});const Nd=a.z.object({button_border_radius:a.z.number(),button_border_weight:a.z.number(),buttons_style:a.z.enum(["pill"]),input_border_radius:a.z.number(),input_border_weight:a.z.number(),inputs_style:a.z.enum(["pill"]),show_widget_shadow:a.z.boolean(),widget_border_weight:a.z.number(),widget_corner_radius:a.z.number()}),Od=a.z.object({base_focus_color:a.z.string(),base_hover_color:a.z.string(),body_text:a.z.string(),captcha_widget_theme:a.z.enum(["auto"]),error:a.z.string(),header:a.z.string(),icons:a.z.string(),input_background:a.z.string(),input_border:a.z.string(),input_filled_text:a.z.string(),input_labels_placeholders:a.z.string(),links_focused_components:a.z.string(),primary_button:a.z.string(),primary_button_label:a.z.string(),secondary_button_border:a.z.string(),secondary_button_label:a.z.string(),success:a.z.string(),widget_background:a.z.string(),widget_border:a.z.string()}),Wt=a.z.object({bold:a.z.boolean(),size:a.z.number()}),Bd=a.z.object({body_text:Wt,buttons_text:Wt,font_url:a.z.string(),input_labels:Wt,links:Wt,links_style:a.z.enum(["normal"]),reference_text_size:a.z.number(),subtitle:Wt,title:Wt}),Td=a.z.object({background_color:a.z.string(),background_image_url:a.z.string(),page_layout:a.z.enum(["center"])}),Rd=a.z.object({header_text_alignment:a.z.enum(["center"]),logo_height:a.z.number(),logo_position:a.z.enum(["center"]),logo_url:a.z.string(),social_buttons_layout:a.z.enum(["bottom"])}),Pd=a.z.object({borders:Nd,colors:Od,displayName:a.z.string(),fonts:Bd,page_background:Td,widget:Rd}),Xh=Pd.extend({themeId:a.z.string()}),Xi=a.z.object({universal_login_experience:a.z.enum(["new","classic"]).default("new"),identifier_first:a.z.boolean().default(!0),password_first:a.z.boolean().default(!1),webauthn_platform_first_factor:a.z.boolean()}),Qi=a.z.object({name:a.z.string(),enabled:a.z.boolean().optional().default(!0),default_from_address:a.z.string().optional(),credentials:a.z.union([a.z.object({accessKeyId:a.z.string(),secretAccessKey:a.z.string(),region:a.z.string()}),a.z.object({smtp_host:a.z.array(a.z.string()),smtp_port:a.z.number(),smtp_user:a.z.string(),smtp_pass:a.z.string()}),a.z.object({api_key:a.z.string(),domain:a.z.string().optional()}),a.z.object({connectionString:a.z.string()}),a.z.object({tenantId:a.z.string(),clientId:a.z.string(),clientSecret:a.z.string()})]),settings:a.z.object({}).optional()});function Qh(n){const[e,t]=n.split("|");if(!e||!t)throw new Error(`Invalid user_id: ${n}`);return{connection:e,id:t}}const eg=new a.OpenAPIHono().openapi(a.createRoute({tags:["branding"],method:"get",path:"/",request:{headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:yo}},description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=await n.env.data.branding.get(e);return t?n.json(t):n.json({})}).openapi(a.createRoute({tags:["branding"],method:"patch",path:"/",request:{headers:a.z.object({"tenant-id":a.z.string()}),body:{content:{"application/json":{schema:a.z.object(yo.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json");return await n.env.data.branding.set(e,t),n.text("OK")});var O=class extends Error{constructor(e=500,t){super(t==null?void 0:t.message,{cause:t==null?void 0:t.cause});te(this,"res");te(this,"status");this.res=t==null?void 0:t.res,this.status=e}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}},mr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function tg(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function ng(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function i(){return this instanceof i?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(n).forEach(function(i){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}),t}function ig(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ld={exports:{}};const rg={},sg=Object.freeze(Object.defineProperty({__proto__:null,default:rg},Symbol.toStringTag,{value:"Module"})),og=ng(sg);(function(n){/**
2
2
  * @license bcrypt.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
3
3
  * Released under the Apache License, Version 2.0
4
4
  * see: https://github.com/dcodeIO/bcrypt.js for details
5
- */(function(e,t){typeof Bh=="function"&&n&&n.exports?n.exports=t():(e.dcodeIO=e.dcodeIO||{}).bcrypt=t()})(dr,function(){var e={},t=null;function i(z){if(n&&n.exports)try{return Th.randomBytes(z)}catch{}try{var j;return(self.crypto||self.msCrypto).getRandomValues(j=new Uint32Array(z)),Array.prototype.slice.call(j)}catch{}if(!t)throw Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative");return t(z)}var r=!1;try{i(1),r=!0}catch{}t=null,e.setRandomFallback=function(z){t=z},e.genSaltSync=function(z,j){if(z=z||_,typeof z!="number")throw Error("Illegal arguments: "+typeof z+", "+typeof j);z<4?z=4:z>31&&(z=31);var S=[];return S.push("$2a$"),z<10&&S.push("0"),S.push(z.toString()),S.push("$"),S.push(g(i(f),f)),S.join("")},e.genSalt=function(z,j,S){if(typeof j=="function"&&(S=j,j=void 0),typeof z=="function"&&(S=z,z=void 0),typeof z>"u")z=_;else if(typeof z!="number")throw Error("illegal arguments: "+typeof z);function w(v){a(function(){try{v(null,e.genSaltSync(z))}catch(E){v(E)}})}if(S){if(typeof S!="function")throw Error("Illegal callback: "+typeof S);w(S)}else return new Promise(function(v,E){w(function(T,Z){if(T){E(T);return}v(Z)})})},e.hashSync=function(z,j){if(typeof j>"u"&&(j=_),typeof j=="number"&&(j=e.genSaltSync(j)),typeof z!="string"||typeof j!="string")throw Error("Illegal arguments: "+typeof z+", "+typeof j);return Ve(z,j)},e.hash=function(z,j,S,w){function v(E){typeof z=="string"&&typeof j=="number"?e.genSalt(j,function(T,Z){Ve(z,Z,E,w)}):typeof z=="string"&&typeof j=="string"?Ve(z,j,E,w):a(E.bind(this,Error("Illegal arguments: "+typeof z+", "+typeof j)))}if(S){if(typeof S!="function")throw Error("Illegal callback: "+typeof S);v(S)}else return new Promise(function(E,T){v(function(Z,K){if(Z){T(Z);return}E(K)})})};function s(z,j){for(var S=0,w=0,v=0,E=z.length;v<E;++v)z.charCodeAt(v)===j.charCodeAt(v)?++S:++w;return S<0?!1:w===0}e.compareSync=function(z,j){if(typeof z!="string"||typeof j!="string")throw Error("Illegal arguments: "+typeof z+", "+typeof j);return j.length!==60?!1:s(e.hashSync(z,j.substr(0,j.length-31)),j)},e.compare=function(z,j,S,w){function v(E){if(typeof z!="string"||typeof j!="string"){a(E.bind(this,Error("Illegal arguments: "+typeof z+", "+typeof j)));return}if(j.length!==60){a(E.bind(this,null,!1));return}e.hash(z,j.substr(0,29),function(T,Z){T?E(T):E(null,s(Z,j))},w)}if(S){if(typeof S!="function")throw Error("Illegal callback: "+typeof S);v(S)}else return new Promise(function(E,T){v(function(Z,K){if(Z){T(Z);return}E(K)})})},e.getRounds=function(z){if(typeof z!="string")throw Error("Illegal arguments: "+typeof z);return parseInt(z.split("$")[2],10)},e.getSalt=function(z){if(typeof z!="string")throw Error("Illegal arguments: "+typeof z);if(z.length!==60)throw Error("Illegal hash length: "+z.length+" != 60");return z.substring(0,29)};var a=typeof process<"u"&&process&&typeof process.nextTick=="function"?typeof setImmediate=="function"?setImmediate:process.nextTick:setTimeout;function c(z){var j=[],S=0;return I.encodeUTF16toUTF8(function(){return S>=z.length?null:z.charCodeAt(S++)},function(w){j.push(w)}),j}var l="./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),d=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,54,55,56,57,58,59,60,61,62,63,-1,-1,-1,-1,-1,-1,-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,-1,-1,-1,-1,-1,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,-1,-1,-1,-1,-1],h=String.fromCharCode;function g(z,j){var S=0,w=[],v,E;if(j<=0||j>z.length)throw Error("Illegal len: "+j);for(;S<j;){if(v=z[S++]&255,w.push(l[v>>2&63]),v=(v&3)<<4,S>=j){w.push(l[v&63]);break}if(E=z[S++]&255,v|=E>>4&15,w.push(l[v&63]),v=(E&15)<<2,S>=j){w.push(l[v&63]);break}E=z[S++]&255,v|=E>>6&3,w.push(l[v&63]),w.push(l[E&63])}return w.join("")}function y(z,j){var S=0,w=z.length,v=0,E=[],T,Z,K,ee,se,V;if(j<=0)throw Error("Illegal len: "+j);for(;S<w-1&&v<j&&(V=z.charCodeAt(S++),T=V<d.length?d[V]:-1,V=z.charCodeAt(S++),Z=V<d.length?d[V]:-1,!(T==-1||Z==-1||(se=T<<2>>>0,se|=(Z&48)>>4,E.push(h(se)),++v>=j||S>=w)||(V=z.charCodeAt(S++),K=V<d.length?d[V]:-1,K==-1)||(se=(Z&15)<<4>>>0,se|=(K&60)>>2,E.push(h(se)),++v>=j||S>=w)));)V=z.charCodeAt(S++),ee=V<d.length?d[V]:-1,se=(K&3)<<6>>>0,se|=ee,E.push(h(se)),++v;var xe=[];for(S=0;S<v;S++)xe.push(E[S].charCodeAt(0));return xe}var I=function(){var z={};return z.MAX_CODEPOINT=1114111,z.encodeUTF8=function(j,S){var w=null;for(typeof j=="number"&&(w=j,j=function(){return null});w!==null||(w=j())!==null;)w<128?S(w&127):w<2048?(S(w>>6&31|192),S(w&63|128)):w<65536?(S(w>>12&15|224),S(w>>6&63|128),S(w&63|128)):(S(w>>18&7|240),S(w>>12&63|128),S(w>>6&63|128),S(w&63|128)),w=null},z.decodeUTF8=function(j,S){for(var w,v,E,T,Z=function(K){K=K.slice(0,K.indexOf(null));var ee=Error(K.toString());throw ee.name="TruncatedError",ee.bytes=K,ee};(w=j())!==null;)if(!(w&128))S(w);else if((w&224)===192)(v=j())===null&&Z([w,v]),S((w&31)<<6|v&63);else if((w&240)===224)((v=j())===null||(E=j())===null)&&Z([w,v,E]),S((w&15)<<12|(v&63)<<6|E&63);else if((w&248)===240)((v=j())===null||(E=j())===null||(T=j())===null)&&Z([w,v,E,T]),S((w&7)<<18|(v&63)<<12|(E&63)<<6|T&63);else throw RangeError("Illegal starting byte: "+w)},z.UTF16toUTF8=function(j,S){for(var w,v=null;(w=v!==null?v:j())!==null;){if(w>=55296&&w<=57343&&(v=j())!==null&&v>=56320&&v<=57343){S((w-55296)*1024+v-56320+65536),v=null;continue}S(w)}v!==null&&S(v)},z.UTF8toUTF16=function(j,S){var w=null;for(typeof j=="number"&&(w=j,j=function(){return null});w!==null||(w=j())!==null;)w<=65535?S(w):(w-=65536,S((w>>10)+55296),S(w%1024+56320)),w=null},z.encodeUTF16toUTF8=function(j,S){z.UTF16toUTF8(j,function(w){z.encodeUTF8(w,S)})},z.decodeUTF8toUTF16=function(j,S){z.decodeUTF8(j,function(w){z.UTF8toUTF16(w,S)})},z.calculateCodePoint=function(j){return j<128?1:j<2048?2:j<65536?3:4},z.calculateUTF8=function(j){for(var S,w=0;(S=j())!==null;)w+=z.calculateCodePoint(S);return w},z.calculateUTF16asUTF8=function(j){var S=0,w=0;return z.UTF16toUTF8(j,function(v){++S,w+=z.calculateCodePoint(v)}),[S,w]},z}();Date.now=Date.now||function(){return+new Date};var f=16,_=10,k=16,x=100,O=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],R=[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946,1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055,3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504,976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462],F=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892];function oe(z,j,S,w){var v,E=z[j],T=z[j+1];return E^=S[0],v=w[E>>>24],v+=w[256|E>>16&255],v^=w[512|E>>8&255],v+=w[768|E&255],T^=v^S[1],v=w[T>>>24],v+=w[256|T>>16&255],v^=w[512|T>>8&255],v+=w[768|T&255],E^=v^S[2],v=w[E>>>24],v+=w[256|E>>16&255],v^=w[512|E>>8&255],v+=w[768|E&255],T^=v^S[3],v=w[T>>>24],v+=w[256|T>>16&255],v^=w[512|T>>8&255],v+=w[768|T&255],E^=v^S[4],v=w[E>>>24],v+=w[256|E>>16&255],v^=w[512|E>>8&255],v+=w[768|E&255],T^=v^S[5],v=w[T>>>24],v+=w[256|T>>16&255],v^=w[512|T>>8&255],v+=w[768|T&255],E^=v^S[6],v=w[E>>>24],v+=w[256|E>>16&255],v^=w[512|E>>8&255],v+=w[768|E&255],T^=v^S[7],v=w[T>>>24],v+=w[256|T>>16&255],v^=w[512|T>>8&255],v+=w[768|T&255],E^=v^S[8],v=w[E>>>24],v+=w[256|E>>16&255],v^=w[512|E>>8&255],v+=w[768|E&255],T^=v^S[9],v=w[T>>>24],v+=w[256|T>>16&255],v^=w[512|T>>8&255],v+=w[768|T&255],E^=v^S[10],v=w[E>>>24],v+=w[256|E>>16&255],v^=w[512|E>>8&255],v+=w[768|E&255],T^=v^S[11],v=w[T>>>24],v+=w[256|T>>16&255],v^=w[512|T>>8&255],v+=w[768|T&255],E^=v^S[12],v=w[E>>>24],v+=w[256|E>>16&255],v^=w[512|E>>8&255],v+=w[768|E&255],T^=v^S[13],v=w[T>>>24],v+=w[256|T>>16&255],v^=w[512|T>>8&255],v+=w[768|T&255],E^=v^S[14],v=w[E>>>24],v+=w[256|E>>16&255],v^=w[512|E>>8&255],v+=w[768|E&255],T^=v^S[15],v=w[T>>>24],v+=w[256|T>>16&255],v^=w[512|T>>8&255],v+=w[768|T&255],E^=v^S[16],z[j]=T^S[k+1],z[j+1]=E,z}function pe(z,j){for(var S=0,w=0;S<4;++S)w=w<<8|z[j]&255,j=(j+1)%z.length;return{key:w,offp:j}}function ce(z,j,S){for(var w=0,v=[0,0],E=j.length,T=S.length,Z,K=0;K<E;K++)Z=pe(z,w),w=Z.offp,j[K]=j[K]^Z.key;for(K=0;K<E;K+=2)v=oe(v,0,j,S),j[K]=v[0],j[K+1]=v[1];for(K=0;K<T;K+=2)v=oe(v,0,j,S),S[K]=v[0],S[K+1]=v[1]}function Ne(z,j,S,w){for(var v=0,E=[0,0],T=S.length,Z=w.length,K,ee=0;ee<T;ee++)K=pe(j,v),v=K.offp,S[ee]=S[ee]^K.key;for(v=0,ee=0;ee<T;ee+=2)K=pe(z,v),v=K.offp,E[0]^=K.key,K=pe(z,v),v=K.offp,E[1]^=K.key,E=oe(E,0,S,w),S[ee]=E[0],S[ee+1]=E[1];for(ee=0;ee<Z;ee+=2)K=pe(z,v),v=K.offp,E[0]^=K.key,K=pe(z,v),v=K.offp,E[1]^=K.key,E=oe(E,0,S,w),w[ee]=E[0],w[ee+1]=E[1]}function Qe(z,j,S,w,v){var E=F.slice(),T=E.length,Z;if(S<4||S>31)if(Z=Error("Illegal number of rounds (4-31): "+S),w){a(w.bind(this,Z));return}else throw Z;if(j.length!==f)if(Z=Error("Illegal salt length: "+j.length+" != "+f),w){a(w.bind(this,Z));return}else throw Z;S=1<<S>>>0;var K,ee,se=0,V;Int32Array?(K=new Int32Array(O),ee=new Int32Array(R)):(K=O.slice(),ee=R.slice()),Ne(j,z,K,ee);function xe(){if(v&&v(se/S),se<S)for(var de=Date.now();se<S&&(se=se+1,ce(z,K,ee),ce(j,K,ee),!(Date.now()-de>x)););else{for(se=0;se<64;se++)for(V=0;V<T>>1;V++)oe(E,V<<1,K,ee);var ve=[];for(se=0;se<T;se++)ve.push((E[se]>>24&255)>>>0),ve.push((E[se]>>16&255)>>>0),ve.push((E[se]>>8&255)>>>0),ve.push((E[se]&255)>>>0);if(w){w(null,ve);return}else return ve}w&&a(xe)}if(typeof w<"u")xe();else for(var Ht;;)if(typeof(Ht=xe())<"u")return Ht||[]}function Ve(z,j,S,w){var v;if(typeof z!="string"||typeof j!="string")if(v=Error("Invalid string / salt: Not a string"),S){a(S.bind(this,v));return}else throw v;var E,T;if(j.charAt(0)!=="$"||j.charAt(1)!=="2")if(v=Error("Invalid salt version: "+j.substring(0,2)),S){a(S.bind(this,v));return}else throw v;if(j.charAt(2)==="$")E="\0",T=3;else{if(E=j.charAt(2),E!=="a"&&E!=="b"&&E!=="y"||j.charAt(3)!=="$")if(v=Error("Invalid salt revision: "+j.substring(2,4)),S){a(S.bind(this,v));return}else throw v;T=4}if(j.charAt(T+2)>"$")if(v=Error("Missing salt rounds"),S){a(S.bind(this,v));return}else throw v;var Z=parseInt(j.substring(T,T+1),10)*10,K=parseInt(j.substring(T+1,T+2),10),ee=Z+K,se=j.substring(T+3,T+25);z+=E>="a"?"\0":"";var V=c(z),xe=y(se,f);function Ht(de){var ve=[];return ve.push("$2"),E>="a"&&ve.push(E),ve.push("$"),ee<10&&ve.push("0"),ve.push(ee.toString()),ve.push("$"),ve.push(g(xe,xe.length)),ve.push(g(de,F.length*4-1)),ve.join("")}if(typeof S>"u")return Ht(Qe(V,xe,ee));Qe(V,xe,ee,function(de,ve){de?S(de,null):S(null,Ht(ve))},w)}return e.encodeBase64=g,e.decodeBase64=y,e})})(wd);var Ph=wd.exports;const Ua=Ch(Ph),Uh="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Lh=n=>crypto.getRandomValues(new Uint8Array(n)),Dh=(n,e,t)=>{let i=(2<<Math.log2(n.length-1))-1,r=-~(1.6*i*e/n.length);return(s=e)=>{let a="";for(;;){let c=t(r),l=r;for(;l--;)if(a+=n[c[l]&i]||"",a.length===s)return a}}},Vh=(n,e=21)=>Dh(n,e,Lh),st=(n=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(n));for(;n--;)e+=Uh[t[n]&63];return e};const Mh=24;function La(){return Vh("0123456789abcdef",Mh)()}function rl(n){if(!n.includes("|"))return console.error("Invalid user_id format"),n;const[,e]=n.split("|");return e}async function bd(n,e,t){return(await n.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${t}`})).users}async function Da({userAdapter:n,tenant_id:e,email:t,provider:i}){const{users:r}=await n.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${t} provider:${i}`});return r.length>1&&console.error("More than one user found for same email and provider"),r[0]||null}async function kd({userAdapter:n,tenant_id:e,email:t}){var c;const{users:i}=await n.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${t}`}),r=i.filter(l=>!(l.provider==="auth2"&&!l.email_verified));if(r.length===0)return;const s=r.filter(l=>!l.linked_to);if(s.length>0)return s.length>1&&console.error("More than one primary user found for same email"),s[0];const a=await n.get(e,(c=r[0])==null?void 0:c.linked_to);if(!a)throw new Error("Primary account not found");return a}async function Xr({userAdapter:n,tenant_id:e,email:t,provider:i}){const r=await Da({userAdapter:n,tenant_id:e,email:t,provider:i});return r?r.linked_to?n.get(e,r.linked_to):r:null}const Xt=o.z.object({page:o.z.string().min(0).optional().default("0").transform(n=>parseInt(n,10)).openapi({description:"The page number where 0 is the first page"}),per_page:o.z.string().min(1).optional().default("10").transform(n=>parseInt(n,10)).openapi({description:"The number of items per page"}),include_totals:o.z.string().optional().default("false").transform(n=>n==="true").openapi({description:"If the total number of items should be included in the response"}),sort:o.z.string().regex(/^.+:(-1|1)$/).optional().openapi({description:"A property that should have the format 'string:-1' or 'string:1'"}),q:o.z.string().optional().openapi({description:"A lucene query string used to filter the results"})});function Pn(n){if(!n)return;const[e,t]=n.split(":"),i=t==="1"?"asc":"desc";if(!(!e||!i))return{sort_by:e,sort_order:i}}function be(n,e){return{type:e.type,description:e.description||"",ip:n.req.header("x-real-ip")||"",user_agent:n.req.header("user-agent")||"",date:new Date().toISOString(),details:{request:{method:n.req.method,path:n.req.path,qs:n.req.queries(),body:e.body||n.var.body||""}},isMobile:!1,client_id:n.var.client_id,client_name:"",user_id:e.userId||n.var.user_id||"",hostname:n.req.header("host")||"",user_name:n.var.username||"",connection_id:"",connection:n.var.connection||"",strategy:e.strategy||"",strategy_type:e.strategy_type||"",audience:"",scope:[]}}var Hh={deno:"Deno",bun:"Bun",workerd:"Cloudflare-Workers",node:"Node.js"},qh=()=>{var t,i;const n=globalThis;if(typeof navigator<"u"&&typeof navigator.userAgent=="string"){for(const[r,s]of Object.entries(Hh))if(Kh(s))return r}return typeof(n==null?void 0:n.EdgeRuntime)=="string"?"edge-light":(n==null?void 0:n.fastly)!==void 0?"fastly":((i=(t=n==null?void 0:n.process)==null?void 0:t.release)==null?void 0:i.name)==="node"?"node":"other"},Kh=n=>navigator.userAgent.startsWith(n);function $t(n,e){qh()==="workerd"&&n.executionCtx.waitUntil(e)}const sl=Lt.extend({users:o.z.array(dt)}),Fh=Lt.extend({sessions:o.z.array(Pa)}),Wh=new o.OpenAPIHono().openapi(o.createRoute({tags:["users"],method:"get",path:"/",request:{query:Xt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(dt),sl])}},description:"List of users"}}}),async n=>{const{page:e,per_page:t,include_totals:i,sort:r,q:s}=n.req.valid("query"),{"tenant-id":a}=n.req.valid("header");if(s!=null&&s.includes("identities.profileData.email")){const h=s.split("=")[1],y=(await n.env.data.users.list(a,{page:e,per_page:t,include_totals:i,q:`email:${h}`})).users.filter(_=>_.linked_to),[I]=y;if(!I)return n.json([]);const f=await n.env.data.users.get(a,I.linked_to);if(!f)throw new B(500,{message:"Primary account not found"});return n.json([dt.parse(f)])}const c=["-_exists_:linked_to"];s&&c.push(s);const l=await n.env.data.users.list(a,{page:e,per_page:t,include_totals:i,sort:Pn(r),q:c.join(" ")}),d=l.users.filter(h=>!h.linked_to);return i?n.json(sl.parse({users:d,length:l.length,start:l.start,limit:l.limit})):n.json(o.z.array(dt).parse(d))}).openapi(o.createRoute({tags:["users"],method:"get",path:"/{user_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({user_id:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:dt}},description:"List of users"}}}),async n=>{const{user_id:e}=n.req.valid("param"),{"tenant-id":t}=n.req.valid("header"),i=await n.env.data.users.get(t,e);if(!i)throw new B(404);if(i.linked_to)throw new B(404,{message:"User is linked to another user"});return n.json(i)}).openapi(o.createRoute({tags:["users"],method:"delete",path:"/{user_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({user_id:o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{user_id:e}=n.req.valid("param"),{"tenant-id":t}=n.req.valid("header");if(!await n.env.data.users.remove(t,e))throw new B(404);return n.text("OK")}).openapi(o.createRoute({tags:["users"],method:"post",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object({...rr.shape})}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:dt}},description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json");n.set("body",t);const{email:i}=t;if(!i)throw new B(400,{message:"Email is required"});const r=i.toLowerCase(),s=`${t.provider}|${t.user_id||La()}`;try{const a=await n.env.data.users.create(e,{email:r,user_id:s,name:t.name||r,provider:t.provider,connection:t.connection,email_verified:t.email_verified||!1,last_ip:"",is_social:!1,last_login:new Date().toISOString()});n.set("user_id",a.user_id);const c=be(n,{type:_e.SUCCESS_API_OPERATION,description:"User created"});$t(n,n.env.data.logs.create(e,c));const l={...a,identities:[{connection:a.connection,provider:a.provider,user_id:rl(a.user_id),isSocial:a.is_social}]};return n.json(dt.parse(l),{status:201})}catch(a){throw a.message==="User already exists"?new B(409,{message:"User already exists"}):a}}).openapi(o.createRoute({tags:["users"],method:"patch",path:"/{user_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object({...rr.shape,verify_email:o.z.boolean(),password:o.z.string()}).partial()}}},params:o.z.object({user_id:o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{var d;const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),{user_id:i}=n.req.valid("param"),{verify_email:r,password:s,...a}=t,c=await n.env.data.users.get(e,i);if(!c)throw new B(404);if(a.email&&a.email!==c.email){const h=await bd(n.env.data.users,e,a.email);if(h.length&&h.some(g=>g.user_id!==i))throw new B(409,{message:"Another user with the same email address already exists."})}if(c.linked_to)throw new B(404,{message:"User is linked to another user"});if(await n.env.data.users.update(e,i,a),s){const h=(d=c.identities)==null?void 0:d.find(g=>g.connection==="Username-Password-Authentication");if(!h)throw new B(400,{message:"User does not have a password identity"});await n.env.data.passwords.update(e,{user_id:`${h.provider}|${h.user_id}`,password:Ua.hashSync(s,10),algorithm:"bcrypt"})}const l=await n.env.data.users.get(e,i);if(!l)throw new B(500);return n.json(l)}).openapi(o.createRoute({tags:["users"],method:"post",path:"/{user_id}/identities",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.union([o.z.object({link_with:o.z.string()}),o.z.object({user_id:o.z.string(),provider:o.z.string(),connection:o.z.string().optional()})])}}},params:o.z.object({user_id:o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:o.z.array(o.z.object({connection:o.z.string(),provider:o.z.string(),user_id:o.z.string(),isSocial:o.z.boolean()}))}},description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),{user_id:i}=n.req.valid("param"),r="link_with"in t?t.link_with:t.user_id,s=await n.env.data.users.get(e,i);if(!s)throw new B(400,{message:"Linking an inexistent identity is not allowed."});await n.env.data.users.update(e,r,{linked_to:i});const a=await n.env.data.users.list(e,{page:0,per_page:10,include_totals:!1,q:`linked_to:${i}`}),c=[s,...a.users].map(l=>({connection:l.connection,provider:l.provider,user_id:rl(l.user_id),isSocial:l.is_social}));return n.json(c,{status:201})}).openapi(o.createRoute({tags:["users"],method:"delete",path:"/{user_id}/identities/{provider}/{linked_user_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({user_id:o.z.string(),provider:o.z.string(),linked_user_id:o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:o.z.array(dt)}},description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{user_id:t,provider:i,linked_user_id:r}=n.req.valid("param");await n.env.data.users.unlink(e,t,i,r);const s=await n.env.data.users.get(e,t);if(!s)throw new B(404);return n.json([dt.parse(s)])}).openapi(o.createRoute({tags:["users"],method:"get",path:"/{user_id}/sessions",request:{query:Xt,headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({user_id:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(Pa),Fh])}},description:"List of sessions"}}}),async n=>{const{user_id:e}=n.req.valid("param"),{include_totals:t}=n.req.valid("query"),{"tenant-id":i}=n.req.valid("header"),r=await n.env.data.sessions.list(i,{page:0,per_page:10,include_totals:!1,q:`user_id:${e}`});return t?n.json(r):n.json(r.sessions)});/*! *****************************************************************************
5
+ */(function(e,t){typeof ig=="function"&&n&&n.exports?n.exports=t():(e.dcodeIO=e.dcodeIO||{}).bcrypt=t()})(mr,function(){var e={},t=null;function i($){if(n&&n.exports)try{return og.randomBytes($)}catch{}try{var E;return(self.crypto||self.msCrypto).getRandomValues(E=new Uint32Array($)),Array.prototype.slice.call(E)}catch{}if(!t)throw Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative");return t($)}var r=!1;try{i(1),r=!0}catch{}t=null,e.setRandomFallback=function($){t=$},e.genSaltSync=function($,E){if($=$||_,typeof $!="number")throw Error("Illegal arguments: "+typeof $+", "+typeof E);$<4?$=4:$>31&&($=31);var A=[];return A.push("$2a$"),$<10&&A.push("0"),A.push($.toString()),A.push("$"),A.push(g(i(h),h)),A.join("")},e.genSalt=function($,E,A){if(typeof E=="function"&&(A=E,E=void 0),typeof $=="function"&&(A=$,$=void 0),typeof $>"u")$=_;else if(typeof $!="number")throw Error("illegal arguments: "+typeof $);function w(v){o(function(){try{v(null,e.genSaltSync($))}catch(C){v(C)}})}if(A){if(typeof A!="function")throw Error("Illegal callback: "+typeof A);w(A)}else return new Promise(function(v,C){w(function(R,Z){if(R){C(R);return}v(Z)})})},e.hashSync=function($,E){if(typeof E>"u"&&(E=_),typeof E=="number"&&(E=e.genSaltSync(E)),typeof $!="string"||typeof E!="string")throw Error("Illegal arguments: "+typeof $+", "+typeof E);return De($,E)},e.hash=function($,E,A,w){function v(C){typeof $=="string"&&typeof E=="number"?e.genSalt(E,function(R,Z){De($,Z,C,w)}):typeof $=="string"&&typeof E=="string"?De($,E,C,w):o(C.bind(this,Error("Illegal arguments: "+typeof $+", "+typeof E)))}if(A){if(typeof A!="function")throw Error("Illegal callback: "+typeof A);v(A)}else return new Promise(function(C,R){v(function(Z,q){if(Z){R(Z);return}C(q)})})};function s($,E){for(var A=0,w=0,v=0,C=$.length;v<C;++v)$.charCodeAt(v)===E.charCodeAt(v)?++A:++w;return A<0?!1:w===0}e.compareSync=function($,E){if(typeof $!="string"||typeof E!="string")throw Error("Illegal arguments: "+typeof $+", "+typeof E);return E.length!==60?!1:s(e.hashSync($,E.substr(0,E.length-31)),E)},e.compare=function($,E,A,w){function v(C){if(typeof $!="string"||typeof E!="string"){o(C.bind(this,Error("Illegal arguments: "+typeof $+", "+typeof E)));return}if(E.length!==60){o(C.bind(this,null,!1));return}e.hash($,E.substr(0,29),function(R,Z){R?C(R):C(null,s(Z,E))},w)}if(A){if(typeof A!="function")throw Error("Illegal callback: "+typeof A);v(A)}else return new Promise(function(C,R){v(function(Z,q){if(Z){R(Z);return}C(q)})})},e.getRounds=function($){if(typeof $!="string")throw Error("Illegal arguments: "+typeof $);return parseInt($.split("$")[2],10)},e.getSalt=function($){if(typeof $!="string")throw Error("Illegal arguments: "+typeof $);if($.length!==60)throw Error("Illegal hash length: "+$.length+" != 60");return $.substring(0,29)};var o=typeof process<"u"&&process&&typeof process.nextTick=="function"?typeof setImmediate=="function"?setImmediate:process.nextTick:setTimeout;function c($){var E=[],A=0;return x.encodeUTF16toUTF8(function(){return A>=$.length?null:$.charCodeAt(A++)},function(w){E.push(w)}),E}var l="./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),u=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,54,55,56,57,58,59,60,61,62,63,-1,-1,-1,-1,-1,-1,-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,-1,-1,-1,-1,-1,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,-1,-1,-1,-1,-1],p=String.fromCharCode;function g($,E){var A=0,w=[],v,C;if(E<=0||E>$.length)throw Error("Illegal len: "+E);for(;A<E;){if(v=$[A++]&255,w.push(l[v>>2&63]),v=(v&3)<<4,A>=E){w.push(l[v&63]);break}if(C=$[A++]&255,v|=C>>4&15,w.push(l[v&63]),v=(C&15)<<2,A>=E){w.push(l[v&63]);break}C=$[A++]&255,v|=C>>6&3,w.push(l[v&63]),w.push(l[C&63])}return w.join("")}function m($,E){var A=0,w=$.length,v=0,C=[],R,Z,q,ee,se,M;if(E<=0)throw Error("Illegal len: "+E);for(;A<w-1&&v<E&&(M=$.charCodeAt(A++),R=M<u.length?u[M]:-1,M=$.charCodeAt(A++),Z=M<u.length?u[M]:-1,!(R==-1||Z==-1||(se=R<<2>>>0,se|=(Z&48)>>4,C.push(p(se)),++v>=E||A>=w)||(M=$.charCodeAt(A++),q=M<u.length?u[M]:-1,q==-1)||(se=(Z&15)<<4>>>0,se|=(q&60)>>2,C.push(p(se)),++v>=E||A>=w)));)M=$.charCodeAt(A++),ee=M<u.length?u[M]:-1,se=(q&3)<<6>>>0,se|=ee,C.push(p(se)),++v;var Se=[];for(A=0;A<v;A++)Se.push(C[A].charCodeAt(0));return Se}var x=function(){var $={};return $.MAX_CODEPOINT=1114111,$.encodeUTF8=function(E,A){var w=null;for(typeof E=="number"&&(w=E,E=function(){return null});w!==null||(w=E())!==null;)w<128?A(w&127):w<2048?(A(w>>6&31|192),A(w&63|128)):w<65536?(A(w>>12&15|224),A(w>>6&63|128),A(w&63|128)):(A(w>>18&7|240),A(w>>12&63|128),A(w>>6&63|128),A(w&63|128)),w=null},$.decodeUTF8=function(E,A){for(var w,v,C,R,Z=function(q){q=q.slice(0,q.indexOf(null));var ee=Error(q.toString());throw ee.name="TruncatedError",ee.bytes=q,ee};(w=E())!==null;)if(!(w&128))A(w);else if((w&224)===192)(v=E())===null&&Z([w,v]),A((w&31)<<6|v&63);else if((w&240)===224)((v=E())===null||(C=E())===null)&&Z([w,v,C]),A((w&15)<<12|(v&63)<<6|C&63);else if((w&248)===240)((v=E())===null||(C=E())===null||(R=E())===null)&&Z([w,v,C,R]),A((w&7)<<18|(v&63)<<12|(C&63)<<6|R&63);else throw RangeError("Illegal starting byte: "+w)},$.UTF16toUTF8=function(E,A){for(var w,v=null;(w=v!==null?v:E())!==null;){if(w>=55296&&w<=57343&&(v=E())!==null&&v>=56320&&v<=57343){A((w-55296)*1024+v-56320+65536),v=null;continue}A(w)}v!==null&&A(v)},$.UTF8toUTF16=function(E,A){var w=null;for(typeof E=="number"&&(w=E,E=function(){return null});w!==null||(w=E())!==null;)w<=65535?A(w):(w-=65536,A((w>>10)+55296),A(w%1024+56320)),w=null},$.encodeUTF16toUTF8=function(E,A){$.UTF16toUTF8(E,function(w){$.encodeUTF8(w,A)})},$.decodeUTF8toUTF16=function(E,A){$.decodeUTF8(E,function(w){$.UTF8toUTF16(w,A)})},$.calculateCodePoint=function(E){return E<128?1:E<2048?2:E<65536?3:4},$.calculateUTF8=function(E){for(var A,w=0;(A=E())!==null;)w+=$.calculateCodePoint(A);return w},$.calculateUTF16asUTF8=function(E){var A=0,w=0;return $.UTF16toUTF8(E,function(v){++A,w+=$.calculateCodePoint(v)}),[A,w]},$}();Date.now=Date.now||function(){return+new Date};var h=16,_=10,b=16,S=100,N=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],T=[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946,1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055,3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504,976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462],K=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892];function oe($,E,A,w){var v,C=$[E],R=$[E+1];return C^=A[0],v=w[C>>>24],v+=w[256|C>>16&255],v^=w[512|C>>8&255],v+=w[768|C&255],R^=v^A[1],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],C^=v^A[2],v=w[C>>>24],v+=w[256|C>>16&255],v^=w[512|C>>8&255],v+=w[768|C&255],R^=v^A[3],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],C^=v^A[4],v=w[C>>>24],v+=w[256|C>>16&255],v^=w[512|C>>8&255],v+=w[768|C&255],R^=v^A[5],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],C^=v^A[6],v=w[C>>>24],v+=w[256|C>>16&255],v^=w[512|C>>8&255],v+=w[768|C&255],R^=v^A[7],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],C^=v^A[8],v=w[C>>>24],v+=w[256|C>>16&255],v^=w[512|C>>8&255],v+=w[768|C&255],R^=v^A[9],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],C^=v^A[10],v=w[C>>>24],v+=w[256|C>>16&255],v^=w[512|C>>8&255],v+=w[768|C&255],R^=v^A[11],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],C^=v^A[12],v=w[C>>>24],v+=w[256|C>>16&255],v^=w[512|C>>8&255],v+=w[768|C&255],R^=v^A[13],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],C^=v^A[14],v=w[C>>>24],v+=w[256|C>>16&255],v^=w[512|C>>8&255],v+=w[768|C&255],R^=v^A[15],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],C^=v^A[16],$[E]=R^A[b+1],$[E+1]=C,$}function pe($,E){for(var A=0,w=0;A<4;++A)w=w<<8|$[E]&255,E=(E+1)%$.length;return{key:w,offp:E}}function ce($,E,A){for(var w=0,v=[0,0],C=E.length,R=A.length,Z,q=0;q<C;q++)Z=pe($,w),w=Z.offp,E[q]=E[q]^Z.key;for(q=0;q<C;q+=2)v=oe(v,0,E,A),E[q]=v[0],E[q+1]=v[1];for(q=0;q<R;q+=2)v=oe(v,0,E,A),A[q]=v[0],A[q+1]=v[1]}function Re($,E,A,w){for(var v=0,C=[0,0],R=A.length,Z=w.length,q,ee=0;ee<R;ee++)q=pe(E,v),v=q.offp,A[ee]=A[ee]^q.key;for(v=0,ee=0;ee<R;ee+=2)q=pe($,v),v=q.offp,C[0]^=q.key,q=pe($,v),v=q.offp,C[1]^=q.key,C=oe(C,0,A,w),A[ee]=C[0],A[ee+1]=C[1];for(ee=0;ee<Z;ee+=2)q=pe($,v),v=q.offp,C[0]^=q.key,q=pe($,v),v=q.offp,C[1]^=q.key,C=oe(C,0,A,w),w[ee]=C[0],w[ee+1]=C[1]}function nt($,E,A,w,v){var C=K.slice(),R=C.length,Z;if(A<4||A>31)if(Z=Error("Illegal number of rounds (4-31): "+A),w){o(w.bind(this,Z));return}else throw Z;if(E.length!==h)if(Z=Error("Illegal salt length: "+E.length+" != "+h),w){o(w.bind(this,Z));return}else throw Z;A=1<<A>>>0;var q,ee,se=0,M;Int32Array?(q=new Int32Array(N),ee=new Int32Array(T)):(q=N.slice(),ee=T.slice()),Re(E,$,q,ee);function Se(){if(v&&v(se/A),se<A)for(var de=Date.now();se<A&&(se=se+1,ce($,q,ee),ce(E,q,ee),!(Date.now()-de>S)););else{for(se=0;se<64;se++)for(M=0;M<R>>1;M++)oe(C,M<<1,q,ee);var we=[];for(se=0;se<R;se++)we.push((C[se]>>24&255)>>>0),we.push((C[se]>>16&255)>>>0),we.push((C[se]>>8&255)>>>0),we.push((C[se]&255)>>>0);if(w){w(null,we);return}else return we}w&&o(Se)}if(typeof w<"u")Se();else for(var Kt;;)if(typeof(Kt=Se())<"u")return Kt||[]}function De($,E,A,w){var v;if(typeof $!="string"||typeof E!="string")if(v=Error("Invalid string / salt: Not a string"),A){o(A.bind(this,v));return}else throw v;var C,R;if(E.charAt(0)!=="$"||E.charAt(1)!=="2")if(v=Error("Invalid salt version: "+E.substring(0,2)),A){o(A.bind(this,v));return}else throw v;if(E.charAt(2)==="$")C="\0",R=3;else{if(C=E.charAt(2),C!=="a"&&C!=="b"&&C!=="y"||E.charAt(3)!=="$")if(v=Error("Invalid salt revision: "+E.substring(2,4)),A){o(A.bind(this,v));return}else throw v;R=4}if(E.charAt(R+2)>"$")if(v=Error("Missing salt rounds"),A){o(A.bind(this,v));return}else throw v;var Z=parseInt(E.substring(R,R+1),10)*10,q=parseInt(E.substring(R+1,R+2),10),ee=Z+q,se=E.substring(R+3,R+25);$+=C>="a"?"\0":"";var M=c($),Se=m(se,h);function Kt(de){var we=[];return we.push("$2"),C>="a"&&we.push(C),we.push("$"),ee<10&&we.push("0"),we.push(ee.toString()),we.push("$"),we.push(g(Se,Se.length)),we.push(g(de,K.length*4-1)),we.join("")}if(typeof A>"u")return Kt(nt(M,Se,ee));nt(M,Se,ee,function(de,we){de?A(de,null):A(null,Kt(we))},w)}return e.encodeBase64=g,e.decodeBase64=m,e})})(Ld);var ag=Ld.exports;const Wa=tg(ag),cg="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let lg=n=>crypto.getRandomValues(new Uint8Array(n)),ug=(n,e,t)=>{let i=(2<<Math.log2(n.length-1))-1,r=-~(1.6*i*e/n.length);return(s=e)=>{let o="";for(;;){let c=t(r),l=r;for(;l--;)if(o+=n[c[l]&i]||"",o.length===s)return o}}},dg=(n,e=21)=>ug(n,e,lg),Ke=(n=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(n));for(;n--;)e+=cg[t[n]&63];return e};const pg=24;function Ga(){return dg("0123456789abcdef",pg)()}function ml(n){if(!n.includes("|"))return console.error("Invalid user_id format"),n;const[,e]=n.split("|");return e}async function Ud(n,e,t){return(await n.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${t}`})).users}async function Ja({userAdapter:n,tenant_id:e,email:t,provider:i}){const{users:r}=await n.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${t} provider:${i}`});return r.length>1&&console.error("More than one user found for same email and provider"),r[0]||null}async function Vd({userAdapter:n,tenant_id:e,email:t}){var c;const{users:i}=await n.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${t}`}),r=i.filter(l=>!(l.provider==="auth2"&&!l.email_verified));if(r.length===0)return;const s=r.filter(l=>!l.linked_to);if(s.length>0)return s.length>1&&console.error("More than one primary user found for same email"),s[0];const o=await n.get(e,(c=r[0])==null?void 0:c.linked_to);if(!o)throw new Error("Primary account not found");return o}async function rs({userAdapter:n,tenant_id:e,email:t,provider:i}){const r=await Ja({userAdapter:n,tenant_id:e,email:t,provider:i});return r?r.linked_to?n.get(e,r.linked_to):r:null}const rn=a.z.object({page:a.z.string().min(0).optional().default("0").transform(n=>parseInt(n,10)).openapi({description:"The page number where 0 is the first page"}),per_page:a.z.string().min(1).optional().default("10").transform(n=>parseInt(n,10)).openapi({description:"The number of items per page"}),include_totals:a.z.string().optional().default("false").transform(n=>n==="true").openapi({description:"If the total number of items should be included in the response"}),sort:a.z.string().regex(/^.+:(-1|1)$/).optional().openapi({description:"A property that should have the format 'string:-1' or 'string:1'"}),q:a.z.string().optional().openapi({description:"A lucene query string used to filter the results"})});function Mn(n){if(!n)return;const[e,t]=n.split(":"),i=t==="1"?"asc":"desc";if(!(!e||!i))return{sort_by:e,sort_order:i}}function ke(n,e){return{type:e.type,description:e.description||"",ip:n.req.header("x-real-ip")||"",user_agent:n.req.header("user-agent")||"",date:new Date().toISOString(),details:{request:{method:n.req.method,path:n.req.path,qs:n.req.queries(),body:e.body||n.var.body||""}},isMobile:!1,client_id:n.var.client_id,client_name:"",user_id:e.userId||n.var.user_id||"",hostname:n.req.header("host")||"",user_name:n.var.username||"",connection_id:"",connection:n.var.connection||"",strategy:e.strategy||"",strategy_type:e.strategy_type||"",audience:"",scope:[]}}var fg={deno:"Deno",bun:"Bun",workerd:"Cloudflare-Workers",node:"Node.js"},hg=()=>{var t,i;const n=globalThis;if(typeof navigator<"u"&&typeof navigator.userAgent=="string"){for(const[r,s]of Object.entries(fg))if(gg(s))return r}return typeof(n==null?void 0:n.EdgeRuntime)=="string"?"edge-light":(n==null?void 0:n.fastly)!==void 0?"fastly":((i=(t=n==null?void 0:n.process)==null?void 0:t.release)==null?void 0:i.name)==="node"?"node":"other"},gg=n=>navigator.userAgent.startsWith(n);function Nt(n,e){hg()==="workerd"&&n.executionCtx.waitUntil(e)}const yl=Mt.extend({users:a.z.array(ft)}),_g=Mt.extend({sessions:a.z.array(Ka)}),mg=new a.OpenAPIHono().openapi(a.createRoute({tags:["users"],method:"get",path:"/",request:{query:rn,headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:a.z.union([a.z.array(ft),yl])}},description:"List of users"}}}),async n=>{const{page:e,per_page:t,include_totals:i,sort:r,q:s}=n.req.valid("query"),{"tenant-id":o}=n.req.valid("header");if(s!=null&&s.includes("identities.profileData.email")){const p=s.split("=")[1],m=(await n.env.data.users.list(o,{page:e,per_page:t,include_totals:i,q:`email:${p}`})).users.filter(_=>_.linked_to),[x]=m;if(!x)return n.json([]);const h=await n.env.data.users.get(o,x.linked_to);if(!h)throw new O(500,{message:"Primary account not found"});return n.json([ft.parse(h)])}const c=["-_exists_:linked_to"];s&&c.push(s);const l=await n.env.data.users.list(o,{page:e,per_page:t,include_totals:i,sort:Mn(r),q:c.join(" ")}),u=l.users.filter(p=>!p.linked_to);return i?n.json(yl.parse({users:u,length:l.length,start:l.start,limit:l.limit})):n.json(a.z.array(ft).parse(u))}).openapi(a.createRoute({tags:["users"],method:"get",path:"/{user_id}",request:{headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({user_id:a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:ft}},description:"List of users"}}}),async n=>{const{user_id:e}=n.req.valid("param"),{"tenant-id":t}=n.req.valid("header"),i=await n.env.data.users.get(t,e);if(!i)throw new O(404);if(i.linked_to)throw new O(404,{message:"User is linked to another user"});return n.json(i)}).openapi(a.createRoute({tags:["users"],method:"delete",path:"/{user_id}",request:{headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({user_id:a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{user_id:e}=n.req.valid("param"),{"tenant-id":t}=n.req.valid("header");if(!await n.env.data.users.remove(t,e))throw new O(404);return n.text("OK")}).openapi(a.createRoute({tags:["users"],method:"post",path:"/",request:{headers:a.z.object({"tenant-id":a.z.string()}),body:{content:{"application/json":{schema:a.z.object({...ur.shape})}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:ft}},description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json");n.set("body",t);const{email:i}=t;if(!i)throw new O(400,{message:"Email is required"});const r=i.toLowerCase(),s=`${t.provider}|${t.user_id||Ga()}`;try{const o=await n.env.data.users.create(e,{email:r,user_id:s,name:t.name||r,provider:t.provider,connection:t.connection,email_verified:t.email_verified||!1,last_ip:"",is_social:!1,last_login:new Date().toISOString()});n.set("user_id",o.user_id);const c=ke(n,{type:_e.SUCCESS_API_OPERATION,description:"User created"});Nt(n,n.env.data.logs.create(e,c));const l={...o,identities:[{connection:o.connection,provider:o.provider,user_id:ml(o.user_id),isSocial:o.is_social}]};return n.json(ft.parse(l),{status:201})}catch(o){throw o.message==="User already exists"?new O(409,{message:"User already exists"}):o}}).openapi(a.createRoute({tags:["users"],method:"patch",path:"/{user_id}",request:{headers:a.z.object({"tenant-id":a.z.string()}),body:{content:{"application/json":{schema:a.z.object({...ur.shape,verify_email:a.z.boolean(),password:a.z.string()}).partial()}}},params:a.z.object({user_id:a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{var u;const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),{user_id:i}=n.req.valid("param"),{verify_email:r,password:s,...o}=t,c=await n.env.data.users.get(e,i);if(!c)throw new O(404);if(o.email&&o.email!==c.email){const p=await Ud(n.env.data.users,e,o.email);if(p.length&&p.some(g=>g.user_id!==i))throw new O(409,{message:"Another user with the same email address already exists."})}if(c.linked_to)throw new O(404,{message:"User is linked to another user"});if(await n.env.data.users.update(e,i,o),s){const p=(u=c.identities)==null?void 0:u.find(g=>g.connection==="Username-Password-Authentication");if(!p)throw new O(400,{message:"User does not have a password identity"});await n.env.data.passwords.update(e,{user_id:`${p.provider}|${p.user_id}`,password:Wa.hashSync(s,10),algorithm:"bcrypt"})}const l=await n.env.data.users.get(e,i);if(!l)throw new O(500);return n.json(l)}).openapi(a.createRoute({tags:["users"],method:"post",path:"/{user_id}/identities",request:{headers:a.z.object({"tenant-id":a.z.string()}),body:{content:{"application/json":{schema:a.z.union([a.z.object({link_with:a.z.string()}),a.z.object({user_id:a.z.string(),provider:a.z.string(),connection:a.z.string().optional()})])}}},params:a.z.object({user_id:a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:a.z.array(a.z.object({connection:a.z.string(),provider:a.z.string(),user_id:a.z.string(),isSocial:a.z.boolean()}))}},description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),{user_id:i}=n.req.valid("param"),r="link_with"in t?t.link_with:t.user_id,s=await n.env.data.users.get(e,i);if(!s)throw new O(400,{message:"Linking an inexistent identity is not allowed."});await n.env.data.users.update(e,r,{linked_to:i});const o=await n.env.data.users.list(e,{page:0,per_page:10,include_totals:!1,q:`linked_to:${i}`}),c=[s,...o.users].map(l=>({connection:l.connection,provider:l.provider,user_id:ml(l.user_id),isSocial:l.is_social}));return n.json(c,{status:201})}).openapi(a.createRoute({tags:["users"],method:"delete",path:"/{user_id}/identities/{provider}/{linked_user_id}",request:{headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({user_id:a.z.string(),provider:a.z.string(),linked_user_id:a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:a.z.array(ft)}},description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{user_id:t,provider:i,linked_user_id:r}=n.req.valid("param");await n.env.data.users.unlink(e,t,i,r);const s=await n.env.data.users.get(e,t);if(!s)throw new O(404);return n.json([ft.parse(s)])}).openapi(a.createRoute({tags:["users"],method:"get",path:"/{user_id}/sessions",request:{query:rn,headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({user_id:a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:a.z.union([a.z.array(Ka),_g])}},description:"List of sessions"}}}),async n=>{const{user_id:e}=n.req.valid("param"),{include_totals:t}=n.req.valid("query"),{"tenant-id":i}=n.req.valid("header"),r=await n.env.data.sessions.list(i,{page:0,per_page:10,include_totals:!1,q:`user_id:${e}`});return t?n.json(r):n.json(r.sessions)});/*! *****************************************************************************
6
6
  Copyright (C) Microsoft. All rights reserved.
7
7
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
8
8
  this file except in compliance with the License. You may obtain a copy of the
@@ -15,7 +15,7 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
15
15
 
16
16
  See the Apache Version 2.0 License for specific language governing permissions
17
17
  and limitations under the License.
18
- ***************************************************************************** */var ol;(function(n){(function(e){var t=typeof globalThis=="object"?globalThis:typeof dr=="object"?dr:typeof self=="object"?self:typeof this=="object"?this:c(),i=r(n);typeof t.Reflect<"u"&&(i=r(t.Reflect,i)),e(i,t),typeof t.Reflect>"u"&&(t.Reflect=n);function r(l,d){return function(h,g){Object.defineProperty(l,h,{configurable:!0,writable:!0,value:g}),d&&d(h,g)}}function s(){try{return Function("return this;")()}catch{}}function a(){try{return(0,eval)("(function() { return this; })()")}catch{}}function c(){return s()||a()}})(function(e,t){var i=Object.prototype.hasOwnProperty,r=typeof Symbol=="function",s=r&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",a=r&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",l={__proto__:[]}instanceof Array,d=!c&&!l,h={create:c?function(){return Ws(Object.create(null))}:l?function(){return Ws({__proto__:null})}:function(){return Ws({})},has:d?function(b,A){return i.call(b,A)}:function(b,A){return A in b},get:d?function(b,A){return i.call(b,A)?b[A]:void 0}:function(b,A){return b[A]}},g=Object.getPrototypeOf(Function),y=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:Wf(),I=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Gf(),f=typeof WeakMap=="function"?WeakMap:Jf(),_=r?Symbol.for("@reflect-metadata:registry"):void 0,k=qf(),x=Kf(k);function O(b,A,$,P){if(V($)){if(!Uc(b))throw new TypeError;if(!Lc(A))throw new TypeError;return j(b,A)}else{if(!Uc(b))throw new TypeError;if(!de(A))throw new TypeError;if(!de(P)&&!V(P)&&!xe(P))throw new TypeError;return xe(P)&&(P=void 0),$=ct($),S(b,A,$,P)}}e("decorate",O);function R(b,A){function $(P,Y){if(!de(P))throw new TypeError;if(!V(Y)&&!Mf(Y))throw new TypeError;Z(b,A,P,Y)}return $}e("metadata",R);function F(b,A,$,P){if(!de($))throw new TypeError;return V(P)||(P=ct(P)),Z(b,A,$,P)}e("defineMetadata",F);function oe(b,A,$){if(!de(A))throw new TypeError;return V($)||($=ct($)),w(b,A,$)}e("hasMetadata",oe);function pe(b,A,$){if(!de(A))throw new TypeError;return V($)||($=ct($)),v(b,A,$)}e("hasOwnMetadata",pe);function ce(b,A,$){if(!de(A))throw new TypeError;return V($)||($=ct($)),E(b,A,$)}e("getMetadata",ce);function Ne(b,A,$){if(!de(A))throw new TypeError;return V($)||($=ct($)),T(b,A,$)}e("getOwnMetadata",Ne);function Qe(b,A){if(!de(b))throw new TypeError;return V(A)||(A=ct(A)),K(b,A)}e("getMetadataKeys",Qe);function Ve(b,A){if(!de(b))throw new TypeError;return V(A)||(A=ct(A)),ee(b,A)}e("getOwnMetadataKeys",Ve);function z(b,A,$){if(!de(A))throw new TypeError;if(V($)||($=ct($)),!de(A))throw new TypeError;V($)||($=ct($));var P=Gn(A,$,!1);return V(P)?!1:P.OrdinaryDeleteMetadata(b,A,$)}e("deleteMetadata",z);function j(b,A){for(var $=b.length-1;$>=0;--$){var P=b[$],Y=P(A);if(!V(Y)&&!xe(Y)){if(!Lc(Y))throw new TypeError;A=Y}}return A}function S(b,A,$,P){for(var Y=b.length-1;Y>=0;--Y){var Se=b[Y],we=Se(A,$,P);if(!V(we)&&!xe(we)){if(!de(we))throw new TypeError;P=we}}return P}function w(b,A,$){var P=v(b,A,$);if(P)return!0;var Y=Fs(A);return xe(Y)?!1:w(b,Y,$)}function v(b,A,$){var P=Gn(A,$,!1);return V(P)?!1:Pc(P.OrdinaryHasOwnMetadata(b,A,$))}function E(b,A,$){var P=v(b,A,$);if(P)return T(b,A,$);var Y=Fs(A);if(!xe(Y))return E(b,Y,$)}function T(b,A,$){var P=Gn(A,$,!1);if(!V(P))return P.OrdinaryGetOwnMetadata(b,A,$)}function Z(b,A,$,P){var Y=Gn($,P,!0);Y.OrdinaryDefineOwnMetadata(b,A,$,P)}function K(b,A){var $=ee(b,A),P=Fs(b);if(P===null)return $;var Y=K(P,A);if(Y.length<=0)return $;if($.length<=0)return Y;for(var Se=new I,we=[],ne=0,D=$;ne<D.length;ne++){var q=D[ne],G=Se.has(q);G||(Se.add(q),we.push(q))}for(var J=0,ie=Y;J<ie.length;J++){var q=ie[J],G=Se.has(q);G||(Se.add(q),we.push(q))}return we}function ee(b,A){var $=Gn(b,A,!1);return $?$.OrdinaryOwnMetadataKeys(b,A):[]}function se(b){if(b===null)return 1;switch(typeof b){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return b===null?1:6;default:return 6}}function V(b){return b===void 0}function xe(b){return b===null}function Ht(b){return typeof b=="symbol"}function de(b){return typeof b=="object"?b!==null:typeof b=="function"}function ve(b,A){switch(se(b)){case 0:return b;case 1:return b;case 2:return b;case 3:return b;case 4:return b;case 5:return b}var $="string",P=Dc(b,s);if(P!==void 0){var Y=P.call(b,$);if(de(Y))throw new TypeError;return Y}return Df(b)}function Df(b,A){var $,P;{var Y=b.toString;if(Li(Y)){var P=Y.call(b);if(!de(P))return P}var $=b.valueOf;if(Li($)){var P=$.call(b);if(!de(P))return P}}throw new TypeError}function Pc(b){return!!b}function Vf(b){return""+b}function ct(b){var A=ve(b);return Ht(A)?A:Vf(A)}function Uc(b){return Array.isArray?Array.isArray(b):b instanceof Object?b instanceof Array:Object.prototype.toString.call(b)==="[object Array]"}function Li(b){return typeof b=="function"}function Lc(b){return typeof b=="function"}function Mf(b){switch(se(b)){case 3:return!0;case 4:return!0;default:return!1}}function Ks(b,A){return b===A||b!==b&&A!==A}function Dc(b,A){var $=b[A];if($!=null){if(!Li($))throw new TypeError;return $}}function Vc(b){var A=Dc(b,a);if(!Li(A))throw new TypeError;var $=A.call(b);if(!de($))throw new TypeError;return $}function Mc(b){return b.value}function Hc(b){var A=b.next();return A.done?!1:A}function qc(b){var A=b.return;A&&A.call(b)}function Fs(b){var A=Object.getPrototypeOf(b);if(typeof b!="function"||b===g||A!==g)return A;var $=b.prototype,P=$&&Object.getPrototypeOf($);if(P==null||P===Object.prototype)return A;var Y=P.constructor;return typeof Y!="function"||Y===b?A:Y}function Hf(){var b;!V(_)&&typeof t.Reflect<"u"&&!(_ in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(b=Ff(t.Reflect));var A,$,P,Y=new f,Se={registerProvider:we,getProvider:D,setProvider:G};return Se;function we(J){if(!Object.isExtensible(Se))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case b===J:break;case V(A):A=J;break;case A===J:break;case V($):$=J;break;case $===J:break;default:P===void 0&&(P=new I),P.add(J);break}}function ne(J,ie){if(!V(A)){if(A.isProviderFor(J,ie))return A;if(!V($)){if($.isProviderFor(J,ie))return A;if(!V(P))for(var fe=Vc(P);;){var me=Hc(fe);if(!me)return;var et=Mc(me);if(et.isProviderFor(J,ie))return qc(fe),et}}}if(!V(b)&&b.isProviderFor(J,ie))return b}function D(J,ie){var fe=Y.get(J),me;return V(fe)||(me=fe.get(ie)),V(me)&&(me=ne(J,ie),V(me)||(V(fe)&&(fe=new y,Y.set(J,fe)),fe.set(ie,me))),me}function q(J){if(V(J))throw new TypeError;return A===J||$===J||!V(P)&&P.has(J)}function G(J,ie,fe){if(!q(fe))throw new Error("Metadata provider not registered.");var me=D(J,ie);if(me!==fe){if(!V(me))return!1;var et=Y.get(J);V(et)&&(et=new y,Y.set(J,et)),et.set(ie,fe)}return!0}}function qf(){var b;return!V(_)&&de(t.Reflect)&&Object.isExtensible(t.Reflect)&&(b=t.Reflect[_]),V(b)&&(b=Hf()),!V(_)&&de(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,_,{enumerable:!1,configurable:!1,writable:!1,value:b}),b}function Kf(b){var A=new f,$={isProviderFor:function(q,G){var J=A.get(q);return V(J)?!1:J.has(G)},OrdinaryDefineOwnMetadata:we,OrdinaryHasOwnMetadata:Y,OrdinaryGetOwnMetadata:Se,OrdinaryOwnMetadataKeys:ne,OrdinaryDeleteMetadata:D};return k.registerProvider($),$;function P(q,G,J){var ie=A.get(q),fe=!1;if(V(ie)){if(!J)return;ie=new y,A.set(q,ie),fe=!0}var me=ie.get(G);if(V(me)){if(!J)return;if(me=new y,ie.set(G,me),!b.setProvider(q,G,$))throw ie.delete(G),fe&&A.delete(q),new Error("Wrong provider for target.")}return me}function Y(q,G,J){var ie=P(G,J,!1);return V(ie)?!1:Pc(ie.has(q))}function Se(q,G,J){var ie=P(G,J,!1);if(!V(ie))return ie.get(q)}function we(q,G,J,ie){var fe=P(J,ie,!0);fe.set(q,G)}function ne(q,G){var J=[],ie=P(q,G,!1);if(V(ie))return J;for(var fe=ie.keys(),me=Vc(fe),et=0;;){var Kc=Hc(me);if(!Kc)return J.length=et,J;var Zf=Mc(Kc);try{J[et]=Zf}catch(Yf){try{qc(me)}finally{throw Yf}}et++}}function D(q,G,J){var ie=P(G,J,!1);if(V(ie)||!ie.delete(q))return!1;if(ie.size===0){var fe=A.get(G);V(fe)||(fe.delete(J),fe.size===0&&A.delete(fe))}return!0}}function Ff(b){var A=b.defineMetadata,$=b.hasOwnMetadata,P=b.getOwnMetadata,Y=b.getOwnMetadataKeys,Se=b.deleteMetadata,we=new f,ne={isProviderFor:function(D,q){var G=we.get(D);return!V(G)&&G.has(q)?!0:Y(D,q).length?(V(G)&&(G=new I,we.set(D,G)),G.add(q),!0):!1},OrdinaryDefineOwnMetadata:A,OrdinaryHasOwnMetadata:$,OrdinaryGetOwnMetadata:P,OrdinaryOwnMetadataKeys:Y,OrdinaryDeleteMetadata:Se};return ne}function Gn(b,A,$){var P=k.getProvider(b,A);if(!V(P))return P;if($){if(k.setProvider(b,A,x))return x;throw new Error("Illegal state.")}}function Wf(){var b={},A=[],$=function(){function ne(D,q,G){this._index=0,this._keys=D,this._values=q,this._selector=G}return ne.prototype["@@iterator"]=function(){return this},ne.prototype[a]=function(){return this},ne.prototype.next=function(){var D=this._index;if(D>=0&&D<this._keys.length){var q=this._selector(this._keys[D],this._values[D]);return D+1>=this._keys.length?(this._index=-1,this._keys=A,this._values=A):this._index++,{value:q,done:!1}}return{value:void 0,done:!0}},ne.prototype.throw=function(D){throw this._index>=0&&(this._index=-1,this._keys=A,this._values=A),D},ne.prototype.return=function(D){return this._index>=0&&(this._index=-1,this._keys=A,this._values=A),{value:D,done:!0}},ne}(),P=function(){function ne(){this._keys=[],this._values=[],this._cacheKey=b,this._cacheIndex=-2}return Object.defineProperty(ne.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),ne.prototype.has=function(D){return this._find(D,!1)>=0},ne.prototype.get=function(D){var q=this._find(D,!1);return q>=0?this._values[q]:void 0},ne.prototype.set=function(D,q){var G=this._find(D,!0);return this._values[G]=q,this},ne.prototype.delete=function(D){var q=this._find(D,!1);if(q>=0){for(var G=this._keys.length,J=q+1;J<G;J++)this._keys[J-1]=this._keys[J],this._values[J-1]=this._values[J];return this._keys.length--,this._values.length--,Ks(D,this._cacheKey)&&(this._cacheKey=b,this._cacheIndex=-2),!0}return!1},ne.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=b,this._cacheIndex=-2},ne.prototype.keys=function(){return new $(this._keys,this._values,Y)},ne.prototype.values=function(){return new $(this._keys,this._values,Se)},ne.prototype.entries=function(){return new $(this._keys,this._values,we)},ne.prototype["@@iterator"]=function(){return this.entries()},ne.prototype[a]=function(){return this.entries()},ne.prototype._find=function(D,q){if(!Ks(this._cacheKey,D)){this._cacheIndex=-1;for(var G=0;G<this._keys.length;G++)if(Ks(this._keys[G],D)){this._cacheIndex=G;break}}return this._cacheIndex<0&&q&&(this._cacheIndex=this._keys.length,this._keys.push(D),this._values.push(void 0)),this._cacheIndex},ne}();return P;function Y(ne,D){return ne}function Se(ne,D){return D}function we(ne,D){return[ne,D]}}function Gf(){var b=function(){function A(){this._map=new y}return Object.defineProperty(A.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),A.prototype.has=function($){return this._map.has($)},A.prototype.add=function($){return this._map.set($,$),this},A.prototype.delete=function($){return this._map.delete($)},A.prototype.clear=function(){this._map.clear()},A.prototype.keys=function(){return this._map.keys()},A.prototype.values=function(){return this._map.keys()},A.prototype.entries=function(){return this._map.entries()},A.prototype["@@iterator"]=function(){return this.keys()},A.prototype[a]=function(){return this.keys()},A}();return b}function Jf(){var b=16,A=h.create(),$=P();return function(){function D(){this._key=P()}return D.prototype.has=function(q){var G=Y(q,!1);return G!==void 0?h.has(G,this._key):!1},D.prototype.get=function(q){var G=Y(q,!1);return G!==void 0?h.get(G,this._key):void 0},D.prototype.set=function(q,G){var J=Y(q,!0);return J[this._key]=G,this},D.prototype.delete=function(q){var G=Y(q,!1);return G!==void 0?delete G[this._key]:!1},D.prototype.clear=function(){this._key=P()},D}();function P(){var D;do D="@@WeakMap@@"+ne();while(h.has(A,D));return A[D]=!0,D}function Y(D,q){if(!i.call(D,$)){if(!q)return;Object.defineProperty(D,$,{value:h.create()})}return D[$]}function Se(D,q){for(var G=0;G<q;++G)D[G]=Math.random()*255|0;return D}function we(D){if(typeof Uint8Array=="function"){var q=new Uint8Array(D);return typeof crypto<"u"?crypto.getRandomValues(q):typeof msCrypto<"u"?msCrypto.getRandomValues(q):Se(q,D),q}return Se(new Array(D),D)}function ne(){var D=we(b);D[6]=D[6]&79|64,D[8]=D[8]&191|128;for(var q="",G=0;G<b;++G){var J=D[G];(G===4||G===6||G===8)&&(q+="-"),J<16&&(q+="0"),q+=J.toString(16).toLowerCase()}return q}}function Ws(b){return b.__=void 0,delete b.__,b}})})(ol||(ol={}));/*!
18
+ ***************************************************************************** */var vl;(function(n){(function(e){var t=typeof globalThis=="object"?globalThis:typeof mr=="object"?mr:typeof self=="object"?self:typeof this=="object"?this:c(),i=r(n);typeof t.Reflect<"u"&&(i=r(t.Reflect,i)),e(i,t),typeof t.Reflect>"u"&&(t.Reflect=n);function r(l,u){return function(p,g){Object.defineProperty(l,p,{configurable:!0,writable:!0,value:g}),u&&u(p,g)}}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 i=Object.prototype.hasOwnProperty,r=typeof Symbol=="function",s=r&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",o=r&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",l={__proto__:[]}instanceof Array,u=!c&&!l,p={create:c?function(){return eo(Object.create(null))}:l?function(){return eo({__proto__:null})}:function(){return eo({})},has:u?function(k,I){return i.call(k,I)}:function(k,I){return I in k},get:u?function(k,I){return i.call(k,I)?k[I]:void 0}:function(k,I){return k[I]}},g=Object.getPrototypeOf(Function),m=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:mh(),x=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:yh(),h=typeof WeakMap=="function"?WeakMap:vh(),_=r?Symbol.for("@reflect-metadata:registry"):void 0,b=hh(),S=gh(b);function N(k,I,j,P){if(M(j)){if(!Yc(k))throw new TypeError;if(!Xc(I))throw new TypeError;return E(k,I)}else{if(!Yc(k))throw new TypeError;if(!de(I))throw new TypeError;if(!de(P)&&!M(P)&&!Se(P))throw new TypeError;return Se(P)&&(P=void 0),j=ut(j),A(k,I,j,P)}}e("decorate",N);function T(k,I){function j(P,Y){if(!de(P))throw new TypeError;if(!M(Y)&&!ph(Y))throw new TypeError;Z(k,I,P,Y)}return j}e("metadata",T);function K(k,I,j,P){if(!de(j))throw new TypeError;return M(P)||(P=ut(P)),Z(k,I,j,P)}e("defineMetadata",K);function oe(k,I,j){if(!de(I))throw new TypeError;return M(j)||(j=ut(j)),w(k,I,j)}e("hasMetadata",oe);function pe(k,I,j){if(!de(I))throw new TypeError;return M(j)||(j=ut(j)),v(k,I,j)}e("hasOwnMetadata",pe);function ce(k,I,j){if(!de(I))throw new TypeError;return M(j)||(j=ut(j)),C(k,I,j)}e("getMetadata",ce);function Re(k,I,j){if(!de(I))throw new TypeError;return M(j)||(j=ut(j)),R(k,I,j)}e("getOwnMetadata",Re);function nt(k,I){if(!de(k))throw new TypeError;return M(I)||(I=ut(I)),q(k,I)}e("getMetadataKeys",nt);function De(k,I){if(!de(k))throw new TypeError;return M(I)||(I=ut(I)),ee(k,I)}e("getOwnMetadataKeys",De);function $(k,I,j){if(!de(I))throw new TypeError;if(M(j)||(j=ut(j)),!de(I))throw new TypeError;M(j)||(j=ut(j));var P=Xn(I,j,!1);return M(P)?!1:P.OrdinaryDeleteMetadata(k,I,j)}e("deleteMetadata",$);function E(k,I){for(var j=k.length-1;j>=0;--j){var P=k[j],Y=P(I);if(!M(Y)&&!Se(Y)){if(!Xc(Y))throw new TypeError;I=Y}}return I}function A(k,I,j,P){for(var Y=k.length-1;Y>=0;--Y){var Ae=k[Y],be=Ae(I,j,P);if(!M(be)&&!Se(be)){if(!de(be))throw new TypeError;P=be}}return P}function w(k,I,j){var P=v(k,I,j);if(P)return!0;var Y=Qs(I);return Se(Y)?!1:w(k,Y,j)}function v(k,I,j){var P=Xn(I,j,!1);return M(P)?!1:Zc(P.OrdinaryHasOwnMetadata(k,I,j))}function C(k,I,j){var P=v(k,I,j);if(P)return R(k,I,j);var Y=Qs(I);if(!Se(Y))return C(k,Y,j)}function R(k,I,j){var P=Xn(I,j,!1);if(!M(P))return P.OrdinaryGetOwnMetadata(k,I,j)}function Z(k,I,j,P){var Y=Xn(j,P,!0);Y.OrdinaryDefineOwnMetadata(k,I,j,P)}function q(k,I){var j=ee(k,I),P=Qs(k);if(P===null)return j;var Y=q(P,I);if(Y.length<=0)return j;if(j.length<=0)return Y;for(var Ae=new x,be=[],ne=0,V=j;ne<V.length;ne++){var F=V[ne],G=Ae.has(F);G||(Ae.add(F),be.push(F))}for(var J=0,ie=Y;J<ie.length;J++){var F=ie[J],G=Ae.has(F);G||(Ae.add(F),be.push(F))}return be}function ee(k,I){var j=Xn(k,I,!1);return j?j.OrdinaryOwnMetadataKeys(k,I):[]}function se(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 M(k){return k===void 0}function Se(k){return k===null}function Kt(k){return typeof k=="symbol"}function de(k){return typeof k=="object"?k!==null:typeof k=="function"}function we(k,I){switch(se(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",P=Qc(k,s);if(P!==void 0){var Y=P.call(k,j);if(de(Y))throw new TypeError;return Y}return uh(k)}function uh(k,I){var j,P;{var Y=k.toString;if(qi(Y)){var P=Y.call(k);if(!de(P))return P}var j=k.valueOf;if(qi(j)){var P=j.call(k);if(!de(P))return P}}throw new TypeError}function Zc(k){return!!k}function dh(k){return""+k}function ut(k){var I=we(k);return Kt(I)?I:dh(I)}function Yc(k){return Array.isArray?Array.isArray(k):k instanceof Object?k instanceof Array:Object.prototype.toString.call(k)==="[object Array]"}function qi(k){return typeof k=="function"}function Xc(k){return typeof k=="function"}function ph(k){switch(se(k)){case 3:return!0;case 4:return!0;default:return!1}}function Xs(k,I){return k===I||k!==k&&I!==I}function Qc(k,I){var j=k[I];if(j!=null){if(!qi(j))throw new TypeError;return j}}function el(k){var I=Qc(k,o);if(!qi(I))throw new TypeError;var j=I.call(k);if(!de(j))throw new TypeError;return j}function tl(k){return k.value}function nl(k){var I=k.next();return I.done?!1:I}function il(k){var I=k.return;I&&I.call(k)}function Qs(k){var I=Object.getPrototypeOf(k);if(typeof k!="function"||k===g||I!==g)return I;var j=k.prototype,P=j&&Object.getPrototypeOf(j);if(P==null||P===Object.prototype)return I;var Y=P.constructor;return typeof Y!="function"||Y===k?I:Y}function fh(){var k;!M(_)&&typeof t.Reflect<"u"&&!(_ in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(k=_h(t.Reflect));var I,j,P,Y=new h,Ae={registerProvider:be,getProvider:V,setProvider:G};return Ae;function be(J){if(!Object.isExtensible(Ae))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case k===J:break;case M(I):I=J;break;case I===J:break;case M(j):j=J;break;case j===J:break;default:P===void 0&&(P=new x),P.add(J);break}}function ne(J,ie){if(!M(I)){if(I.isProviderFor(J,ie))return I;if(!M(j)){if(j.isProviderFor(J,ie))return I;if(!M(P))for(var fe=el(P);;){var me=nl(fe);if(!me)return;var it=tl(me);if(it.isProviderFor(J,ie))return il(fe),it}}}if(!M(k)&&k.isProviderFor(J,ie))return k}function V(J,ie){var fe=Y.get(J),me;return M(fe)||(me=fe.get(ie)),M(me)&&(me=ne(J,ie),M(me)||(M(fe)&&(fe=new m,Y.set(J,fe)),fe.set(ie,me))),me}function F(J){if(M(J))throw new TypeError;return I===J||j===J||!M(P)&&P.has(J)}function G(J,ie,fe){if(!F(fe))throw new Error("Metadata provider not registered.");var me=V(J,ie);if(me!==fe){if(!M(me))return!1;var it=Y.get(J);M(it)&&(it=new m,Y.set(J,it)),it.set(ie,fe)}return!0}}function hh(){var k;return!M(_)&&de(t.Reflect)&&Object.isExtensible(t.Reflect)&&(k=t.Reflect[_]),M(k)&&(k=fh()),!M(_)&&de(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,_,{enumerable:!1,configurable:!1,writable:!1,value:k}),k}function gh(k){var I=new h,j={isProviderFor:function(F,G){var J=I.get(F);return M(J)?!1:J.has(G)},OrdinaryDefineOwnMetadata:be,OrdinaryHasOwnMetadata:Y,OrdinaryGetOwnMetadata:Ae,OrdinaryOwnMetadataKeys:ne,OrdinaryDeleteMetadata:V};return b.registerProvider(j),j;function P(F,G,J){var ie=I.get(F),fe=!1;if(M(ie)){if(!J)return;ie=new m,I.set(F,ie),fe=!0}var me=ie.get(G);if(M(me)){if(!J)return;if(me=new m,ie.set(G,me),!k.setProvider(F,G,j))throw ie.delete(G),fe&&I.delete(F),new Error("Wrong provider for target.")}return me}function Y(F,G,J){var ie=P(G,J,!1);return M(ie)?!1:Zc(ie.has(F))}function Ae(F,G,J){var ie=P(G,J,!1);if(!M(ie))return ie.get(F)}function be(F,G,J,ie){var fe=P(J,ie,!0);fe.set(F,G)}function ne(F,G){var J=[],ie=P(F,G,!1);if(M(ie))return J;for(var fe=ie.keys(),me=el(fe),it=0;;){var rl=nl(me);if(!rl)return J.length=it,J;var wh=tl(rl);try{J[it]=wh}catch(bh){try{il(me)}finally{throw bh}}it++}}function V(F,G,J){var ie=P(G,J,!1);if(M(ie)||!ie.delete(F))return!1;if(ie.size===0){var fe=I.get(G);M(fe)||(fe.delete(J),fe.size===0&&I.delete(fe))}return!0}}function _h(k){var I=k.defineMetadata,j=k.hasOwnMetadata,P=k.getOwnMetadata,Y=k.getOwnMetadataKeys,Ae=k.deleteMetadata,be=new h,ne={isProviderFor:function(V,F){var G=be.get(V);return!M(G)&&G.has(F)?!0:Y(V,F).length?(M(G)&&(G=new x,be.set(V,G)),G.add(F),!0):!1},OrdinaryDefineOwnMetadata:I,OrdinaryHasOwnMetadata:j,OrdinaryGetOwnMetadata:P,OrdinaryOwnMetadataKeys:Y,OrdinaryDeleteMetadata:Ae};return ne}function Xn(k,I,j){var P=b.getProvider(k,I);if(!M(P))return P;if(j){if(b.setProvider(k,I,S))return S;throw new Error("Illegal state.")}}function mh(){var k={},I=[],j=function(){function ne(V,F,G){this._index=0,this._keys=V,this._values=F,this._selector=G}return ne.prototype["@@iterator"]=function(){return this},ne.prototype[o]=function(){return this},ne.prototype.next=function(){var V=this._index;if(V>=0&&V<this._keys.length){var F=this._selector(this._keys[V],this._values[V]);return V+1>=this._keys.length?(this._index=-1,this._keys=I,this._values=I):this._index++,{value:F,done:!1}}return{value:void 0,done:!0}},ne.prototype.throw=function(V){throw this._index>=0&&(this._index=-1,this._keys=I,this._values=I),V},ne.prototype.return=function(V){return this._index>=0&&(this._index=-1,this._keys=I,this._values=I),{value:V,done:!0}},ne}(),P=function(){function ne(){this._keys=[],this._values=[],this._cacheKey=k,this._cacheIndex=-2}return Object.defineProperty(ne.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),ne.prototype.has=function(V){return this._find(V,!1)>=0},ne.prototype.get=function(V){var F=this._find(V,!1);return F>=0?this._values[F]:void 0},ne.prototype.set=function(V,F){var G=this._find(V,!0);return this._values[G]=F,this},ne.prototype.delete=function(V){var F=this._find(V,!1);if(F>=0){for(var G=this._keys.length,J=F+1;J<G;J++)this._keys[J-1]=this._keys[J],this._values[J-1]=this._values[J];return this._keys.length--,this._values.length--,Xs(V,this._cacheKey)&&(this._cacheKey=k,this._cacheIndex=-2),!0}return!1},ne.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=k,this._cacheIndex=-2},ne.prototype.keys=function(){return new j(this._keys,this._values,Y)},ne.prototype.values=function(){return new j(this._keys,this._values,Ae)},ne.prototype.entries=function(){return new j(this._keys,this._values,be)},ne.prototype["@@iterator"]=function(){return this.entries()},ne.prototype[o]=function(){return this.entries()},ne.prototype._find=function(V,F){if(!Xs(this._cacheKey,V)){this._cacheIndex=-1;for(var G=0;G<this._keys.length;G++)if(Xs(this._keys[G],V)){this._cacheIndex=G;break}}return this._cacheIndex<0&&F&&(this._cacheIndex=this._keys.length,this._keys.push(V),this._values.push(void 0)),this._cacheIndex},ne}();return P;function Y(ne,V){return ne}function Ae(ne,V){return V}function be(ne,V){return[ne,V]}}function yh(){var k=function(){function I(){this._map=new m}return Object.defineProperty(I.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),I.prototype.has=function(j){return this._map.has(j)},I.prototype.add=function(j){return this._map.set(j,j),this},I.prototype.delete=function(j){return this._map.delete(j)},I.prototype.clear=function(){this._map.clear()},I.prototype.keys=function(){return this._map.keys()},I.prototype.values=function(){return this._map.keys()},I.prototype.entries=function(){return this._map.entries()},I.prototype["@@iterator"]=function(){return this.keys()},I.prototype[o]=function(){return this.keys()},I}();return k}function vh(){var k=16,I=p.create(),j=P();return function(){function V(){this._key=P()}return V.prototype.has=function(F){var G=Y(F,!1);return G!==void 0?p.has(G,this._key):!1},V.prototype.get=function(F){var G=Y(F,!1);return G!==void 0?p.get(G,this._key):void 0},V.prototype.set=function(F,G){var J=Y(F,!0);return J[this._key]=G,this},V.prototype.delete=function(F){var G=Y(F,!1);return G!==void 0?delete G[this._key]:!1},V.prototype.clear=function(){this._key=P()},V}();function P(){var V;do V="@@WeakMap@@"+ne();while(p.has(I,V));return I[V]=!0,V}function Y(V,F){if(!i.call(V,j)){if(!F)return;Object.defineProperty(V,j,{value:p.create()})}return V[j]}function Ae(V,F){for(var G=0;G<F;++G)V[G]=Math.random()*255|0;return V}function be(V){if(typeof Uint8Array=="function"){var F=new Uint8Array(V);return typeof crypto<"u"?crypto.getRandomValues(F):typeof msCrypto<"u"?msCrypto.getRandomValues(F):Ae(F,V),F}return Ae(new Array(V),V)}function ne(){var V=be(k);V[6]=V[6]&79|64,V[8]=V[8]&191|128;for(var F="",G=0;G<k;++G){var J=V[G];(G===4||G===6||G===8)&&(F+="-"),J<16&&(F+="0"),F+=J.toString(16).toLowerCase()}return F}}function eo(k){return k.__=void 0,delete k.__,k}})})(vl||(vl={}));/*!
19
19
  * MIT License
20
20
  *
21
21
  * Copyright (c) 2017-2022 Peculiar Ventures, LLC
@@ -38,9 +38,9 @@ and limitations under the License.
38
38
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39
39
  * SOFTWARE.
40
40
  *
41
- */const Gh="[object ArrayBuffer]";class L{static isArrayBuffer(e){return Object.prototype.toString.call(e)===Gh}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){const i=L.toUint8Array(e),r=L.toUint8Array(t);if(i.length!==r.byteLength)return!1;for(let s=0;s<i.length;s++)if(i[s]!==r[s])return!1;return!0}static concat(...e){let t;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?t=e[0]:e[e.length-1]instanceof Function?t=e.slice(0,e.length-1):t=e;let i=0;for(const a of t)i+=a.byteLength;const r=new Uint8Array(i);let s=0;for(const a of t){const c=this.toUint8Array(a);r.set(c,s),s+=c.length}return e[e.length-1]instanceof Function?this.toView(r,e[e.length-1]):r.buffer}}const Js="string",Jh=/^[0-9a-f]+$/i,Zh=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Yh=/^[a-zA-Z0-9-_]+$/;class al{static fromString(e){const t=unescape(encodeURIComponent(e)),i=new Uint8Array(t.length);for(let r=0;r<t.length;r++)i[r]=t.charCodeAt(r);return i.buffer}static toString(e){const t=L.toUint8Array(e);let i="";for(let s=0;s<t.length;s++)i+=String.fromCharCode(t[s]);return decodeURIComponent(escape(i))}}class lt{static toString(e,t=!1){const i=L.toArrayBuffer(e),r=new DataView(i);let s="";for(let a=0;a<i.byteLength;a+=2){const c=r.getUint16(a,t);s+=String.fromCharCode(c)}return s}static fromString(e,t=!1){const i=new ArrayBuffer(e.length*2),r=new DataView(i);for(let s=0;s<e.length;s++)r.setUint16(s*2,e.charCodeAt(s),t);return i}}class W{static isHex(e){return typeof e===Js&&Jh.test(e)}static isBase64(e){return typeof e===Js&&Zh.test(e)}static isBase64Url(e){return typeof e===Js&&Yh.test(e)}static ToString(e,t="utf8"){const i=L.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(i);case"binary":return this.ToBinary(i);case"hex":return this.ToHex(i);case"base64":return this.ToBase64(i);case"base64url":return this.ToBase64Url(i);case"utf16le":return lt.toString(i,!0);case"utf16":case"utf16be":return lt.toString(i);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return lt.fromString(e,!0);case"utf16":case"utf16be":return lt.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){const t=L.toUint8Array(e);if(typeof btoa<"u"){const i=this.ToString(t,"binary");return btoa(i)}else return Buffer.from(t).toString("base64")}static FromBase64(e){const t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!W.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(!W.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=W.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return al.fromString(e);case"utf16":case"utf16be":return lt.fromString(e);case"utf16le":case"usc2":return lt.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=W.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return al.toString(e);case"utf16":case"utf16be":return lt.toString(e);case"utf16le":case"usc2":return lt.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){const t=e.length,i=new Uint8Array(t);for(let r=0;r<t;r++)i[r]=e.charCodeAt(r);return i.buffer}static ToBinary(e){const t=L.toUint8Array(e);let i="";for(let r=0;r<t.length;r++)i+=String.fromCharCode(t[r]);return i}static ToHex(e){const t=L.toUint8Array(e);let i="";const r=t.length;for(let s=0;s<r;s++){const a=t[s];a<16&&(i+="0"),i+=a.toString(16)}return i}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!W.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);const i=new Uint8Array(t.length/2);for(let r=0;r<t.length;r=r+2){const s=t.slice(r,r+2);i[r/2]=parseInt(s,16)}return i.buffer}static ToUtf16String(e,t=!1){return lt.toString(e,t)}static FromUtf16String(e,t=!1){return lt.fromString(e,t)}static Base64Padding(e){const t=4-e.length%4;if(t<4)for(let i=0;i<t;i++)e+="=";return e}static formatString(e){return(e==null?void 0:e.replace(/[\n\r\t ]/g,""))||""}}W.DEFAULT_UTF8_ENCODING="utf8";function Xh(...n){const e=n.map(r=>r.byteLength).reduce((r,s)=>r+s),t=new Uint8Array(e);let i=0;return n.map(r=>new Uint8Array(r)).forEach(r=>{for(const s of r)t[i++]=s}),t.buffer}function xd(n,e){if(!(n&&e)||n.byteLength!==e.byteLength)return!1;const t=new Uint8Array(n),i=new Uint8Array(e);for(let r=0;r<n.byteLength;r++)if(t[r]!==i[r])return!1;return!0}/*!
41
+ */const yg="[object ArrayBuffer]";class U{static isArrayBuffer(e){return Object.prototype.toString.call(e)===yg}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){const i=U.toUint8Array(e),r=U.toUint8Array(t);if(i.length!==r.byteLength)return!1;for(let s=0;s<i.length;s++)if(i[s]!==r[s])return!1;return!0}static concat(...e){let t;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?t=e[0]:e[e.length-1]instanceof Function?t=e.slice(0,e.length-1):t=e;let i=0;for(const o of t)i+=o.byteLength;const r=new Uint8Array(i);let s=0;for(const o of t){const c=this.toUint8Array(o);r.set(c,s),s+=c.length}return e[e.length-1]instanceof Function?this.toView(r,e[e.length-1]):r.buffer}}const no="string",vg=/^[0-9a-f]+$/i,wg=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,bg=/^[a-zA-Z0-9-_]+$/;class wl{static fromString(e){const t=unescape(encodeURIComponent(e)),i=new Uint8Array(t.length);for(let r=0;r<t.length;r++)i[r]=t.charCodeAt(r);return i.buffer}static toString(e){const t=U.toUint8Array(e);let i="";for(let s=0;s<t.length;s++)i+=String.fromCharCode(t[s]);return decodeURIComponent(escape(i))}}class dt{static toString(e,t=!1){const i=U.toArrayBuffer(e),r=new DataView(i);let s="";for(let o=0;o<i.byteLength;o+=2){const c=r.getUint16(o,t);s+=String.fromCharCode(c)}return s}static fromString(e,t=!1){const i=new ArrayBuffer(e.length*2),r=new DataView(i);for(let s=0;s<e.length;s++)r.setUint16(s*2,e.charCodeAt(s),t);return i}}class W{static isHex(e){return typeof e===no&&vg.test(e)}static isBase64(e){return typeof e===no&&wg.test(e)}static isBase64Url(e){return typeof e===no&&bg.test(e)}static ToString(e,t="utf8"){const i=U.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(i);case"binary":return this.ToBinary(i);case"hex":return this.ToHex(i);case"base64":return this.ToBase64(i);case"base64url":return this.ToBase64Url(i);case"utf16le":return dt.toString(i,!0);case"utf16":case"utf16be":return dt.toString(i);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return dt.fromString(e,!0);case"utf16":case"utf16be":return dt.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){const t=U.toUint8Array(e);if(typeof btoa<"u"){const i=this.ToString(t,"binary");return btoa(i)}else return Buffer.from(t).toString("base64")}static FromBase64(e){const t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!W.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(!W.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=W.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return wl.fromString(e);case"utf16":case"utf16be":return dt.fromString(e);case"utf16le":case"usc2":return dt.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=W.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return wl.toString(e);case"utf16":case"utf16be":return dt.toString(e);case"utf16le":case"usc2":return dt.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){const t=e.length,i=new Uint8Array(t);for(let r=0;r<t;r++)i[r]=e.charCodeAt(r);return i.buffer}static ToBinary(e){const t=U.toUint8Array(e);let i="";for(let r=0;r<t.length;r++)i+=String.fromCharCode(t[r]);return i}static ToHex(e){const t=U.toUint8Array(e);let i="";const r=t.length;for(let s=0;s<r;s++){const o=t[s];o<16&&(i+="0"),i+=o.toString(16)}return i}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!W.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);const i=new Uint8Array(t.length/2);for(let r=0;r<t.length;r=r+2){const s=t.slice(r,r+2);i[r/2]=parseInt(s,16)}return i.buffer}static ToUtf16String(e,t=!1){return dt.toString(e,t)}static FromUtf16String(e,t=!1){return dt.fromString(e,t)}static Base64Padding(e){const t=4-e.length%4;if(t<4)for(let i=0;i<t;i++)e+="=";return e}static formatString(e){return(e==null?void 0:e.replace(/[\n\r\t ]/g,""))||""}}W.DEFAULT_UTF8_ENCODING="utf8";function kg(...n){const e=n.map(r=>r.byteLength).reduce((r,s)=>r+s),t=new Uint8Array(e);let i=0;return n.map(r=>new Uint8Array(r)).forEach(r=>{for(const s of r)t[i++]=s}),t.buffer}function Md(n,e){if(!(n&&e)||n.byteLength!==e.byteLength)return!1;const t=new Uint8Array(n),i=new Uint8Array(e);for(let r=0;r<n.byteLength;r++)if(t[r]!==i[r])return!1;return!0}/*!
42
42
  Copyright (c) Peculiar Ventures, LLC
43
- */function Sn(n,e){let t=0;if(n.length===1)return n[0];for(let i=n.length-1;i>=0;i--)t+=n[n.length-1-i]*Math.pow(2,e*i);return t}function Qt(n,e,t=-1){const i=t;let r=n,s=0,a=Math.pow(2,e);for(let c=1;c<8;c++){if(n<a){let l;if(i<0)l=new ArrayBuffer(c),s=c;else{if(i<c)return new ArrayBuffer(0);l=new ArrayBuffer(i),s=i}const d=new Uint8Array(l);for(let h=c-1;h>=0;h--){const g=Math.pow(2,h*e);d[s-h-1]=Math.floor(r/g),r-=d[s-h-1]*g}return l}a*=Math.pow(2,e)}return new ArrayBuffer(0)}function ho(...n){let e=0,t=0;for(const s of n)e+=s.length;const i=new ArrayBuffer(e),r=new Uint8Array(i);for(const s of n)r.set(s,t),t+=s.length;return r}function Sd(){const n=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const c=n[0]===255&&n[1]&128,l=n[0]===0&&(n[1]&128)===0;(c||l)&&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]=n[0]&128;const i=Sn(t,8),r=new ArrayBuffer(this.valueHex.byteLength),s=new Uint8Array(r);for(let c=0;c<this.valueHex.byteLength;c++)s[c]=n[c];return s[0]&=127,Sn(s,8)-i}function Qh(n){const e=n<0?n*-1:n;let t=128;for(let i=1;i<8;i++){if(e<=t){if(n<0){const a=t-e,c=Qt(a,8,i),l=new Uint8Array(c);return l[0]|=128,c}let r=Qt(e,8,i),s=new Uint8Array(r);if(s[0]&128){const a=r.slice(0),c=new Uint8Array(a);r=new ArrayBuffer(r.byteLength+1),s=new Uint8Array(r);for(let l=0;l<a.byteLength;l++)s[l+1]=c[l];s[0]=0}return r}t*=Math.pow(2,8)}return new ArrayBuffer(0)}function eg(n,e){if(n.byteLength!==e.byteLength)return!1;const t=new Uint8Array(n),i=new Uint8Array(e);for(let r=0;r<t.length;r++)if(t[r]!==i[r])return!1;return!0}function Me(n,e){const t=n.toString(10);if(e<t.length)return"";const i=e-t.length,r=new Array(i);for(let a=0;a<i;a++)r[a]="0";return r.join("").concat(t)}/*!
43
+ */function Cn(n,e){let t=0;if(n.length===1)return n[0];for(let i=n.length-1;i>=0;i--)t+=n[n.length-1-i]*Math.pow(2,e*i);return t}function sn(n,e,t=-1){const i=t;let r=n,s=0,o=Math.pow(2,e);for(let c=1;c<8;c++){if(n<o){let l;if(i<0)l=new ArrayBuffer(c),s=c;else{if(i<c)return new ArrayBuffer(0);l=new ArrayBuffer(i),s=i}const u=new Uint8Array(l);for(let p=c-1;p>=0;p--){const g=Math.pow(2,p*e);u[s-p-1]=Math.floor(r/g),r-=u[s-p-1]*g}return l}o*=Math.pow(2,e)}return new ArrayBuffer(0)}function bo(...n){let e=0,t=0;for(const s of n)e+=s.length;const i=new ArrayBuffer(e),r=new Uint8Array(i);for(const s of n)r.set(s,t),t+=s.length;return r}function Hd(){const n=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const c=n[0]===255&&n[1]&128,l=n[0]===0&&(n[1]&128)===0;(c||l)&&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]=n[0]&128;const i=Cn(t,8),r=new ArrayBuffer(this.valueHex.byteLength),s=new Uint8Array(r);for(let c=0;c<this.valueHex.byteLength;c++)s[c]=n[c];return s[0]&=127,Cn(s,8)-i}function xg(n){const e=n<0?n*-1:n;let t=128;for(let i=1;i<8;i++){if(e<=t){if(n<0){const o=t-e,c=sn(o,8,i),l=new Uint8Array(c);return l[0]|=128,c}let r=sn(e,8,i),s=new Uint8Array(r);if(s[0]&128){const o=r.slice(0),c=new Uint8Array(o);r=new ArrayBuffer(r.byteLength+1),s=new Uint8Array(r);for(let l=0;l<o.byteLength;l++)s[l+1]=c[l];s[0]=0}return r}t*=Math.pow(2,8)}return new ArrayBuffer(0)}function Sg(n,e){if(n.byteLength!==e.byteLength)return!1;const t=new Uint8Array(n),i=new Uint8Array(e);for(let r=0;r<t.length;r++)if(t[r]!==i[r])return!1;return!0}function Fe(n,e){const t=n.toString(10);if(e<t.length)return"";const i=e-t.length,r=new Array(i);for(let o=0;o<i;o++)r[o]="0";return r.join("").concat(t)}/*!
44
44
  * Copyright (c) 2014, GMO GlobalSign
45
45
  * Copyright (c) 2015-2022, Peculiar Ventures
46
46
  * All rights reserved.
@@ -72,11 +72,11 @@ and limitations under the License.
72
72
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
73
73
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
74
74
  *
75
- */function pr(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function Va(n){let e=0,t=0;for(let r=0;r<n.length;r++){const s=n[r];e+=s.byteLength}const i=new Uint8Array(e);for(let r=0;r<n.length;r++){const s=n[r];i.set(new Uint8Array(s),t),t+=s.byteLength}return i.buffer}function It(n,e,t,i){return e instanceof Uint8Array?e.byteLength?t<0?(n.error="Wrong parameter: inputOffset less than zero",!1):i<0?(n.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-i<0?(n.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(n.error="Wrong parameter: inputBuffer has zero length",!1):(n.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}class Qr{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return Va(this.items)}}const Zn=[new Uint8Array([1])],cl="0123456789",Zs="name",ll="valueHexView",tg="isHexOnly",ng="idBlock",ig="tagClass",rg="tagNumber",sg="isConstructed",og="fromBER",ag="toBER",cg="local",Te="",ot=new ArrayBuffer(0),es=new Uint8Array(0),oi="EndOfContent",Ad="OCTET STRING",Id="BIT STRING";function gt(n){var e;return e=class extends n{constructor(...i){var r;super(...i);const s=i[0]||{};this.isHexOnly=(r=s.isHexOnly)!==null&&r!==void 0?r:!1,this.valueHexView=s.valueHex?L.toUint8Array(s.valueHex):es}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(i){this.valueHexView=new Uint8Array(i)}fromBER(i,r,s){const a=i instanceof ArrayBuffer?new Uint8Array(i):i;if(!It(this,a,r,s))return-1;const c=r+s;return this.valueHexView=a.subarray(r,c),this.valueHexView.length?(this.blockLength=s,c):(this.warnings.push("Zero buffer length"),r)}toBER(i=!1){return this.isHexOnly?i?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",ot)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:W.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}class pn{constructor({blockLength:e=0,error:t=Te,warnings:i=[],valueBeforeDecode:r=es}={}){this.blockLength=e,this.error=t,this.warnings=i,this.valueBeforeDecodeView=L.toUint8Array(r)}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:W.ToHex(this.valueBeforeDecodeView)}}}pn.NAME="baseBlock";class Be extends pn{fromBER(e,t,i){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}Be.NAME="valueBlock";class jd extends gt(pn){constructor({idBlock:e={}}={}){var t,i,r,s;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?L.toUint8Array(e.valueHex):es,this.tagClass=(i=e.tagClass)!==null&&i!==void 0?i:-1,this.tagNumber=(r=e.tagNumber)!==null&&r!==void 0?r:-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",ot}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){const r=new Uint8Array(1);if(!e){let s=this.tagNumber;s&=31,t|=s,r[0]=t}return r.buffer}if(!this.isHexOnly){const r=Qt(this.tagNumber,7),s=new Uint8Array(r),a=r.byteLength,c=new Uint8Array(a+1);if(c[0]=t|31,!e){for(let l=0;l<a-1;l++)c[l+1]=s[l]|128;c[a]=s[a-1]}return c.buffer}const i=new Uint8Array(this.valueHexView.byteLength+1);if(i[0]=t|31,!e){const r=this.valueHexView;for(let s=0;s<r.length-1;s++)i[s+1]=r[s]|128;i[this.valueHexView.byteLength]=r[r.length-1]}return i.buffer}fromBER(e,t,i){const r=L.toUint8Array(e);if(!It(this,r,t,i))return-1;const s=r.subarray(t,t+i);if(s.length===0)return this.error="Zero buffer length",-1;switch(s[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(s[0]&32)===32,this.isHexOnly=!1;const c=s[0]&31;if(c!==31)this.tagNumber=c,this.blockLength=1;else{let l=1,d=this.valueHexView=new Uint8Array(255),h=255;for(;s[l]&128;){if(d[l-1]=s[l]&127,l++,l>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(l===h){h+=255;const y=new Uint8Array(h);for(let I=0;I<d.length;I++)y[I]=d[I];d=this.valueHexView=new Uint8Array(h)}}this.blockLength=l+1,d[l-1]=s[l]&127;const g=new Uint8Array(l);for(let y=0;y<l;y++)g[y]=d[y];d=this.valueHexView=new Uint8Array(l),d.set(g),this.blockLength<=9?this.tagNumber=Sn(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}}}jd.NAME="identificationBlock";class zd extends pn{constructor({lenBlock:e={}}={}){var t,i,r;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(i=e.longFormUsed)!==null&&i!==void 0?i:!1,this.length=(r=e.length)!==null&&r!==void 0?r:0}fromBER(e,t,i){const r=L.toUint8Array(e);if(!It(this,r,t,i))return-1;const s=r.subarray(t,t+i);if(s.length===0)return this.error="Zero buffer length",-1;if(s[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=s[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(s[0]&128),this.longFormUsed===!1)return this.length=s[0],this.blockLength=1,t+this.blockLength;const a=s[0]&127;if(a>8)return this.error="Too big integer",-1;if(a+1>s.length)return this.error="End of input reached before message was fully decoded",-1;const c=t+1,l=r.subarray(c,c+a);return l[a-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=Sn(l,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=a+1,t+this.blockLength}toBER(e=!1){let t,i;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(t),i[0]=128),t;if(this.longFormUsed){const r=Qt(this.length,8);if(r.byteLength>127)return this.error="Too big length",ot;if(t=new ArrayBuffer(r.byteLength+1),e)return t;const s=new Uint8Array(r);i=new Uint8Array(t),i[0]=r.byteLength|128;for(let a=0;a<r.byteLength;a++)i[a+1]=s[a];return t}return t=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(t),i[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}zd.NAME="lengthBlock";const H={};class je extends pn{constructor({name:e=Te,optional:t=!1,primitiveSchema:i,...r}={},s){super(r),this.name=e,this.optional=t,i&&(this.primitiveSchema=i),this.idBlock=new jd(r),this.lenBlock=new zd(r),this.valueBlock=s?new s(r):new Be(r)}fromBER(e,t,i){const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return r===-1?(this.error=this.valueBlock.error,r):(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),r)}toBER(e,t){const i=t||new Qr;t||Ed(this);const r=this.idBlock.toBER(e);if(i.write(r),this.lenBlock.isIndefiniteForm)i.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,i),i.write(new ArrayBuffer(2));else{const s=this.valueBlock.toBER(e);this.lenBlock.length=s.byteLength;const a=this.lenBlock.toBER(e);i.write(a),i.write(s)}return t?ot:i.final()}toJSON(){const e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():W.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${W.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;const t=this.toBER(),i=e.toBER();return eg(t,i)}}je.NAME="BaseBlock";function Ed(n){if(n instanceof H.Constructed)for(const e of n.valueBlock.value)Ed(e)&&(n.lenBlock.isIndefiniteForm=!0);return!!n.lenBlock.isIndefiniteForm}class Ma extends je{constructor({value:e=Te,...t}={},i){super(t,i),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,i){const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return r===-1?(this.error=this.valueBlock.error,r):(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),r)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}Ma.NAME="BaseStringBlock";class $d extends gt(Be){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}}$d.NAME="PrimitiveValueBlock";var Cd;class wi extends je{constructor(e={}){super(e,$d),this.idBlock.isConstructed=!1}}Cd=wi;H.Primitive=Cd;wi.NAME="PRIMITIVE";function lg(n,e){if(n instanceof e)return n;const t=new e;return t.idBlock=n.idBlock,t.lenBlock=n.lenBlock,t.warnings=n.warnings,t.valueBeforeDecodeView=n.valueBeforeDecodeView,t}function Un(n,e=0,t=n.length){const i=e;let r=new je({},Be);const s=new pn;if(!It(s,n,e,t))return r.error=s.error,{offset:-1,result:r};if(!n.subarray(e,e+t).length)return r.error="Zero buffer length",{offset:-1,result:r};let c=r.idBlock.fromBER(n,e,t);if(r.idBlock.warnings.length&&r.warnings.concat(r.idBlock.warnings),c===-1)return r.error=r.idBlock.error,{offset:-1,result:r};if(e=c,t-=r.idBlock.blockLength,c=r.lenBlock.fromBER(n,e,t),r.lenBlock.warnings.length&&r.warnings.concat(r.lenBlock.warnings),c===-1)return r.error=r.lenBlock.error,{offset:-1,result:r};if(e=c,t-=r.lenBlock.blockLength,!r.idBlock.isConstructed&&r.lenBlock.isIndefiniteForm)return r.error="Indefinite length form used for primitive encoding form",{offset:-1,result:r};let l=je;switch(r.idBlock.tagClass){case 1:if(r.idBlock.tagNumber>=37&&r.idBlock.isHexOnly===!1)return r.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:r};switch(r.idBlock.tagNumber){case 0:if(r.idBlock.isConstructed&&r.lenBlock.length>0)return r.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:r};l=H.EndOfContent;break;case 1:l=H.Boolean;break;case 2:l=H.Integer;break;case 3:l=H.BitString;break;case 4:l=H.OctetString;break;case 5:l=H.Null;break;case 6:l=H.ObjectIdentifier;break;case 10:l=H.Enumerated;break;case 12:l=H.Utf8String;break;case 13:l=H.RelativeObjectIdentifier;break;case 14:l=H.TIME;break;case 15:return r.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:r};case 16:l=H.Sequence;break;case 17:l=H.Set;break;case 18:l=H.NumericString;break;case 19:l=H.PrintableString;break;case 20:l=H.TeletexString;break;case 21:l=H.VideotexString;break;case 22:l=H.IA5String;break;case 23:l=H.UTCTime;break;case 24:l=H.GeneralizedTime;break;case 25:l=H.GraphicString;break;case 26:l=H.VisibleString;break;case 27:l=H.GeneralString;break;case 28:l=H.UniversalString;break;case 29:l=H.CharacterString;break;case 30:l=H.BmpString;break;case 31:l=H.DATE;break;case 32:l=H.TimeOfDay;break;case 33:l=H.DateTime;break;case 34:l=H.Duration;break;default:{const d=r.idBlock.isConstructed?new H.Constructed:new H.Primitive;d.idBlock=r.idBlock,d.lenBlock=r.lenBlock,d.warnings=r.warnings,r=d}}break;case 2:case 3:case 4:default:l=r.idBlock.isConstructed?H.Constructed:H.Primitive}return r=lg(r,l),c=r.fromBER(n,e,r.lenBlock.isIndefiniteForm?t:r.lenBlock.length),r.valueBeforeDecodeView=n.subarray(i,i+r.blockLength),{offset:c,result:r}}function bn(n){if(!n.byteLength){const e=new je({},Be);return e.error="Input buffer has zero length",{offset:-1,result:e}}return Un(L.toUint8Array(n).slice(),0,n.byteLength)}function ug(n,e){return n?1:e}class Bt extends Be{constructor({value:e=[],isIndefiniteForm:t=!1,...i}={}){super(i),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,i){const r=L.toUint8Array(e);if(!It(this,r,t,i))return-1;if(this.valueBeforeDecodeView=r.subarray(t,t+i),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let s=t;for(;ug(this.isIndefiniteForm,i)>0;){const a=Un(r,s,i);if(a.offset===-1)return this.error=a.result.error,this.warnings.concat(a.result.warnings),-1;if(s=a.offset,this.blockLength+=a.result.blockLength,i-=a.result.blockLength,this.value.push(a.result),this.isIndefiniteForm&&a.result.constructor.NAME===oi)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===oi?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(e,t){const i=t||new Qr;for(let r=0;r<this.value.length;r++)this.value[r].toBER(e,i);return t?ot:i.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const t of this.value)e.value.push(t.toJSON());return e}}Bt.NAME="ConstructedValueBlock";var Od;class Pe extends je{constructor(e={}){super(e,Bt),this.idBlock.isConstructed=!0}fromBER(e,t,i){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return r===-1?(this.error=this.valueBlock.error,r):(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),r)}onAsciiEncoding(){const e=[];for(const i of this.valueBlock.value)e.push(i.toString("ascii").split(`
75
+ */function yr(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function Za(n){let e=0,t=0;for(let r=0;r<n.length;r++){const s=n[r];e+=s.byteLength}const i=new Uint8Array(e);for(let r=0;r<n.length;r++){const s=n[r];i.set(new Uint8Array(s),t),t+=s.byteLength}return i.buffer}function $t(n,e,t,i){return e instanceof Uint8Array?e.byteLength?t<0?(n.error="Wrong parameter: inputOffset less than zero",!1):i<0?(n.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-i<0?(n.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(n.error="Wrong parameter: inputBuffer has zero length",!1):(n.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}class ss{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return Za(this.items)}}const ei=[new Uint8Array([1])],bl="0123456789",io="name",kl="valueHexView",Ag="isHexOnly",Ig="idBlock",Eg="tagClass",$g="tagNumber",Cg="isConstructed",jg="fromBER",zg="toBER",Ng="local",Le="",ct=new ArrayBuffer(0),os=new Uint8Array(0),pi="EndOfContent",Dd="OCTET STRING",Fd="BIT STRING";function mt(n){var e;return e=class extends n{constructor(...i){var r;super(...i);const s=i[0]||{};this.isHexOnly=(r=s.isHexOnly)!==null&&r!==void 0?r:!1,this.valueHexView=s.valueHex?U.toUint8Array(s.valueHex):os}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(i){this.valueHexView=new Uint8Array(i)}fromBER(i,r,s){const o=i instanceof ArrayBuffer?new Uint8Array(i):i;if(!$t(this,o,r,s))return-1;const c=r+s;return this.valueHexView=o.subarray(r,c),this.valueHexView.length?(this.blockLength=s,c):(this.warnings.push("Zero buffer length"),r)}toBER(i=!1){return this.isHexOnly?i?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",ct)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:W.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}class mn{constructor({blockLength:e=0,error:t=Le,warnings:i=[],valueBeforeDecode:r=os}={}){this.blockLength=e,this.error=t,this.warnings=i,this.valueBeforeDecodeView=U.toUint8Array(r)}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:W.ToHex(this.valueBeforeDecodeView)}}}mn.NAME="baseBlock";class Te extends mn{fromBER(e,t,i){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}Te.NAME="valueBlock";class qd extends mt(mn){constructor({idBlock:e={}}={}){var t,i,r,s;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?U.toUint8Array(e.valueHex):os,this.tagClass=(i=e.tagClass)!==null&&i!==void 0?i:-1,this.tagNumber=(r=e.tagNumber)!==null&&r!==void 0?r:-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",ct}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){const r=new Uint8Array(1);if(!e){let s=this.tagNumber;s&=31,t|=s,r[0]=t}return r.buffer}if(!this.isHexOnly){const r=sn(this.tagNumber,7),s=new Uint8Array(r),o=r.byteLength,c=new Uint8Array(o+1);if(c[0]=t|31,!e){for(let l=0;l<o-1;l++)c[l+1]=s[l]|128;c[o]=s[o-1]}return c.buffer}const i=new Uint8Array(this.valueHexView.byteLength+1);if(i[0]=t|31,!e){const r=this.valueHexView;for(let s=0;s<r.length-1;s++)i[s+1]=r[s]|128;i[this.valueHexView.byteLength]=r[r.length-1]}return i.buffer}fromBER(e,t,i){const r=U.toUint8Array(e);if(!$t(this,r,t,i))return-1;const s=r.subarray(t,t+i);if(s.length===0)return this.error="Zero buffer length",-1;switch(s[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(s[0]&32)===32,this.isHexOnly=!1;const c=s[0]&31;if(c!==31)this.tagNumber=c,this.blockLength=1;else{let l=1,u=this.valueHexView=new Uint8Array(255),p=255;for(;s[l]&128;){if(u[l-1]=s[l]&127,l++,l>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(l===p){p+=255;const m=new Uint8Array(p);for(let x=0;x<u.length;x++)m[x]=u[x];u=this.valueHexView=new Uint8Array(p)}}this.blockLength=l+1,u[l-1]=s[l]&127;const g=new Uint8Array(l);for(let m=0;m<l;m++)g[m]=u[m];u=this.valueHexView=new Uint8Array(l),u.set(g),this.blockLength<=9?this.tagNumber=Cn(u,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}}}qd.NAME="identificationBlock";class Kd extends mn{constructor({lenBlock:e={}}={}){var t,i,r;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(i=e.longFormUsed)!==null&&i!==void 0?i:!1,this.length=(r=e.length)!==null&&r!==void 0?r:0}fromBER(e,t,i){const r=U.toUint8Array(e);if(!$t(this,r,t,i))return-1;const s=r.subarray(t,t+i);if(s.length===0)return this.error="Zero buffer length",-1;if(s[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=s[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(s[0]&128),this.longFormUsed===!1)return this.length=s[0],this.blockLength=1,t+this.blockLength;const 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,l=r.subarray(c,c+o);return l[o-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=Cn(l,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,i;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(t),i[0]=128),t;if(this.longFormUsed){const r=sn(this.length,8);if(r.byteLength>127)return this.error="Too big length",ct;if(t=new ArrayBuffer(r.byteLength+1),e)return t;const s=new Uint8Array(r);i=new Uint8Array(t),i[0]=r.byteLength|128;for(let o=0;o<r.byteLength;o++)i[o+1]=s[o];return t}return t=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(t),i[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}Kd.NAME="lengthBlock";const D={};class $e extends mn{constructor({name:e=Le,optional:t=!1,primitiveSchema:i,...r}={},s){super(r),this.name=e,this.optional=t,i&&(this.primitiveSchema=i),this.idBlock=new qd(r),this.lenBlock=new Kd(r),this.valueBlock=s?new s(r):new Te(r)}fromBER(e,t,i){const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return r===-1?(this.error=this.valueBlock.error,r):(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),r)}toBER(e,t){const i=t||new ss;t||Wd(this);const r=this.idBlock.toBER(e);if(i.write(r),this.lenBlock.isIndefiniteForm)i.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,i),i.write(new ArrayBuffer(2));else{const s=this.valueBlock.toBER(e);this.lenBlock.length=s.byteLength;const o=this.lenBlock.toBER(e);i.write(o),i.write(s)}return t?ct:i.final()}toJSON(){const e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():W.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${W.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;const t=this.toBER(),i=e.toBER();return Sg(t,i)}}$e.NAME="BaseBlock";function Wd(n){if(n instanceof D.Constructed)for(const e of n.valueBlock.value)Wd(e)&&(n.lenBlock.isIndefiniteForm=!0);return!!n.lenBlock.isIndefiniteForm}class Ya extends $e{constructor({value:e=Le,...t}={},i){super(t,i),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,i){const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return r===-1?(this.error=this.valueBlock.error,r):(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),r)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}Ya.NAME="BaseStringBlock";class Gd extends mt(Te){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}}Gd.NAME="PrimitiveValueBlock";var Jd;class Ii extends $e{constructor(e={}){super(e,Gd),this.idBlock.isConstructed=!1}}Jd=Ii;D.Primitive=Jd;Ii.NAME="PRIMITIVE";function Og(n,e){if(n instanceof e)return n;const t=new e;return t.idBlock=n.idBlock,t.lenBlock=n.lenBlock,t.warnings=n.warnings,t.valueBeforeDecodeView=n.valueBeforeDecodeView,t}function Hn(n,e=0,t=n.length){const i=e;let r=new $e({},Te);const s=new mn;if(!$t(s,n,e,t))return r.error=s.error,{offset:-1,result:r};if(!n.subarray(e,e+t).length)return r.error="Zero buffer length",{offset:-1,result:r};let c=r.idBlock.fromBER(n,e,t);if(r.idBlock.warnings.length&&r.warnings.concat(r.idBlock.warnings),c===-1)return r.error=r.idBlock.error,{offset:-1,result:r};if(e=c,t-=r.idBlock.blockLength,c=r.lenBlock.fromBER(n,e,t),r.lenBlock.warnings.length&&r.warnings.concat(r.lenBlock.warnings),c===-1)return r.error=r.lenBlock.error,{offset:-1,result:r};if(e=c,t-=r.lenBlock.blockLength,!r.idBlock.isConstructed&&r.lenBlock.isIndefiniteForm)return r.error="Indefinite length form used for primitive encoding form",{offset:-1,result:r};let l=$e;switch(r.idBlock.tagClass){case 1:if(r.idBlock.tagNumber>=37&&r.idBlock.isHexOnly===!1)return r.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:r};switch(r.idBlock.tagNumber){case 0:if(r.idBlock.isConstructed&&r.lenBlock.length>0)return r.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:r};l=D.EndOfContent;break;case 1:l=D.Boolean;break;case 2:l=D.Integer;break;case 3:l=D.BitString;break;case 4:l=D.OctetString;break;case 5:l=D.Null;break;case 6:l=D.ObjectIdentifier;break;case 10:l=D.Enumerated;break;case 12:l=D.Utf8String;break;case 13:l=D.RelativeObjectIdentifier;break;case 14:l=D.TIME;break;case 15:return r.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:r};case 16:l=D.Sequence;break;case 17:l=D.Set;break;case 18:l=D.NumericString;break;case 19:l=D.PrintableString;break;case 20:l=D.TeletexString;break;case 21:l=D.VideotexString;break;case 22:l=D.IA5String;break;case 23:l=D.UTCTime;break;case 24:l=D.GeneralizedTime;break;case 25:l=D.GraphicString;break;case 26:l=D.VisibleString;break;case 27:l=D.GeneralString;break;case 28:l=D.UniversalString;break;case 29:l=D.CharacterString;break;case 30:l=D.BmpString;break;case 31:l=D.DATE;break;case 32:l=D.TimeOfDay;break;case 33:l=D.DateTime;break;case 34:l=D.Duration;break;default:{const u=r.idBlock.isConstructed?new D.Constructed:new D.Primitive;u.idBlock=r.idBlock,u.lenBlock=r.lenBlock,u.warnings=r.warnings,r=u}}break;case 2:case 3:case 4:default:l=r.idBlock.isConstructed?D.Constructed:D.Primitive}return r=Og(r,l),c=r.fromBER(n,e,r.lenBlock.isIndefiniteForm?t:r.lenBlock.length),r.valueBeforeDecodeView=n.subarray(i,i+r.blockLength),{offset:c,result:r}}function In(n){if(!n.byteLength){const e=new $e({},Te);return e.error="Input buffer has zero length",{offset:-1,result:e}}return Hn(U.toUint8Array(n).slice(),0,n.byteLength)}function Bg(n,e){return n?1:e}class Tt extends Te{constructor({value:e=[],isIndefiniteForm:t=!1,...i}={}){super(i),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,i){const r=U.toUint8Array(e);if(!$t(this,r,t,i))return-1;if(this.valueBeforeDecodeView=r.subarray(t,t+i),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let s=t;for(;Bg(this.isIndefiniteForm,i)>0;){const o=Hn(r,s,i);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,i-=o.result.blockLength,this.value.push(o.result),this.isIndefiniteForm&&o.result.constructor.NAME===pi)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===pi?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(e,t){const i=t||new ss;for(let r=0;r<this.value.length;r++)this.value[r].toBER(e,i);return t?ct:i.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const t of this.value)e.value.push(t.toJSON());return e}}Tt.NAME="ConstructedValueBlock";var Zd;class Ue extends $e{constructor(e={}){super(e,Tt),this.idBlock.isConstructed=!0}fromBER(e,t,i){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return r===-1?(this.error=this.valueBlock.error,r):(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),r)}onAsciiEncoding(){const e=[];for(const i of this.valueBlock.value)e.push(i.toString("ascii").split(`
76
76
  `).map(r=>` ${r}`).join(`
77
77
  `));const t=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :
78
78
  ${e.join(`
79
- `)}`:`${t} :`}}Od=Pe;H.Constructed=Od;Pe.NAME="CONSTRUCTED";class Bd extends Be{fromBER(e,t,i){return t}toBER(e){return ot}}Bd.override="EndOfContentValueBlock";var Nd;class Ha extends je{constructor(e={}){super(e,Bd),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}Nd=Ha;H.EndOfContent=Nd;Ha.NAME=oi;var Rd;class en extends je{constructor(e={}){super(e,Be),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,i){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=i,t+i>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+i}toBER(e,t){const i=new ArrayBuffer(2);if(!e){const r=new Uint8Array(i);r[0]=5,r[1]=0}return t&&t.write(i),i}onAsciiEncoding(){return`${this.constructor.NAME}`}}Rd=en;H.Null=Rd;en.NAME="NULL";class Td extends gt(Be){constructor({value:e,...t}={}){super(t),t.valueHex?this.valueHexView=L.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}fromBER(e,t,i){const r=L.toUint8Array(e);return It(this,r,t,i)?(this.valueHexView=r.subarray(t,t+i),i>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,Sd.call(this),this.blockLength=i,t+i):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}Td.NAME="BooleanValueBlock";var Pd;class ts extends je{constructor(e={}){super(e,Td),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}`}}Pd=ts;H.Boolean=Pd;ts.NAME="BOOLEAN";class Ud extends gt(Bt){constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,i){let r=0;if(this.isConstructed){if(this.isHexOnly=!1,r=Bt.prototype.fromBER.call(this,e,t,i),r===-1)return r;for(let s=0;s<this.value.length;s++){const a=this.value[s].constructor.NAME;if(a===oi){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(a!==Ad)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,r=super.fromBER(e,t,i),this.blockLength=i;return r}toBER(e,t){return this.isConstructed?Bt.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}Ud.NAME="OctetStringValueBlock";var Ld;let Jt=class Dd extends je{constructor({idBlock:e={},lenBlock:t={},...i}={}){var r,s;(r=i.isConstructed)!==null&&r!==void 0||(i.isConstructed=!!(!((s=i.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:i.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!i.isIndefiniteForm},...i},Ud),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,i){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,i===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){const s=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(t,t+i);try{if(s.byteLength){const a=Un(s,0,s.byteLength);a.offset!==-1&&a.offset===i&&(this.valueBlock.value=[a.result])}}catch{}}return super.fromBER(e,t,i)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?Pe.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${W.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 Dd&&e.push(t.valueBlock.valueHexView);return L.concat(e)}};Ld=Jt;H.OctetString=Ld;Jt.NAME=Ad;class Vd extends gt(Bt){constructor({unusedBits:e=0,isConstructed:t=!1,...i}={}){super(i),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,i){if(!i)return t;let r=-1;if(this.isConstructed){if(r=Bt.prototype.fromBER.call(this,e,t,i),r===-1)return r;for(const c of this.value){const l=c.constructor.NAME;if(l===oi){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(l!==Id)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 r}const s=L.toUint8Array(e);if(!It(this,s,t,i))return-1;const a=s.subarray(t,t+i);if(this.unusedBits=a[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const c=a.subarray(1);try{if(c.byteLength){const l=Un(c,0,c.byteLength);l.offset!==-1&&l.offset===i-1&&(this.value=[l.result])}}catch{}}return this.valueHexView=a.subarray(1),this.blockLength=a.length,t+i}toBER(e,t){if(this.isConstructed)return Bt.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return ot;const i=new Uint8Array(this.valueHexView.length+1);return i[0]=this.unusedBits,i.set(this.valueHexView,1),i.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}Vd.NAME="BitStringValueBlock";var Md;let Zt=class extends je{constructor({idBlock:e={},lenBlock:t={},...i}={}){var r,s;(r=i.isConstructed)!==null&&r!==void 0||(i.isConstructed=!!(!((s=i.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:i.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!i.isIndefiniteForm},...i},Vd),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,i){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Pe.prototype.onAsciiEncoding.call(this);{const e=[],t=this.valueBlock.valueHexView;for(const r of t)e.push(r.toString(2).padStart(8,"0"));const i=e.join("");return`${this.constructor.NAME} : ${i.substring(0,i.length-this.valueBlock.unusedBits)}`}}};Md=Zt;H.BitString=Md;Zt.NAME=Id;var Hd;function dg(n,e){const t=new Uint8Array([0]),i=new Uint8Array(n),r=new Uint8Array(e);let s=i.slice(0);const a=s.length-1,c=r.slice(0),l=c.length-1;let d=0;const h=l<a?a:l;let g=0;for(let y=h;y>=0;y--,g++){switch(!0){case g<c.length:d=s[a-g]+c[l-g]+t[0];break;default:d=s[a-g]+t[0]}switch(t[0]=d/10,!0){case g>=s.length:s=ho(new Uint8Array([d%10]),s);break;default:s[a-g]=d%10}}return t[0]>0&&(s=ho(t,s)),s}function ul(n){if(n>=Zn.length)for(let e=Zn.length;e<=n;e++){const t=new Uint8Array([0]);let i=Zn[e-1].slice(0);for(let r=i.length-1;r>=0;r--){const s=new Uint8Array([(i[r]<<1)+t[0]]);t[0]=s[0]/10,i[r]=s[0]%10}t[0]>0&&(i=ho(t,i)),Zn.push(i)}return Zn[n]}function pg(n,e){let t=0;const i=new Uint8Array(n),r=new Uint8Array(e),s=i.slice(0),a=s.length-1,c=r.slice(0),l=c.length-1;let d,h=0;for(let g=l;g>=0;g--,h++)switch(d=s[a-h]-c[l-h]-t,!0){case d<0:t=1,s[a-h]=d+10;break;default:t=0,s[a-h]=d}if(t>0)for(let g=a-l+1;g>=0;g--,h++)if(d=s[a-h]-t,d<0)t=1,s[a-h]=d+10;else{t=0,s[a-h]=d;break}return s.slice()}class qa extends gt(Be){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=Sd.call(this)))}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(Qh(e))}get valueDec(){return this._valueDec}fromDER(e,t,i,r=0){const s=this.fromBER(e,t,i);if(s===-1)return s;const a=this.valueHexView;return a[0]===0&&a[1]&128?this.valueHexView=a.subarray(1):r!==0&&a.length<r&&(r-a.length>1&&(r=a.length+1),this.valueHexView=a.subarray(r-a.length)),s}toDER(e=!1){const t=this.valueHexView;switch(!0){case(t[0]&128)!==0:{const i=new Uint8Array(this.valueHexView.length+1);i[0]=0,i.set(t,1),this.valueHexView=i}break;case(t[0]===0&&(t[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,t,i){const r=super.fromBER(e,t,i);return r===-1||this.setValueHex(),r}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=this.valueHexView.length*8-1;let t=new Uint8Array(this.valueHexView.length*8/3),i=0,r;const s=this.valueHexView;let a="",c=!1;for(let l=s.byteLength-1;l>=0;l--){r=s[l];for(let d=0;d<8;d++){if((r&1)===1)switch(i){case e:t=pg(ul(i),t),a="-";break;default:t=dg(t,ul(i))}i++,r>>=1}}for(let l=0;l<t.length;l++)t[l]&&(c=!0),c&&(a+=cl.charAt(t[l]));return c===!1&&(a+=cl.charAt(0)),a}}Hd=qa;qa.NAME="IntegerValueBlock";Object.defineProperty(Hd.prototype,"valueHex",{set:function(n){this.valueHexView=new Uint8Array(n),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var qd;class ft extends je{constructor(e={}){super(e,qa),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return pr(),BigInt(this.valueBlock.toString())}static fromBigInt(e){pr();const t=BigInt(e),i=new Qr,r=t.toString(16).replace(/^-/,""),s=new Uint8Array(W.FromHex(r));if(t<0){const c=new Uint8Array(s.length+(s[0]&128?1:0));c[0]|=128;const d=BigInt(`0x${W.ToHex(c)}`)+t,h=L.toUint8Array(W.FromHex(d.toString(16)));h[0]|=128,i.write(h)}else s[0]&128&&i.write(new Uint8Array([0])),i.write(s);return new ft({valueHex:i.final()})}convertToDER(){const e=new ft({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new ft({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}qd=ft;H.Integer=qd;ft.NAME="INTEGER";var Kd;class ns extends ft{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}Kd=ns;H.Enumerated=Kd;ns.NAME="ENUMERATED";class go extends gt(Be){constructor({valueDec:e=-1,isFirstSid:t=!1,...i}={}){super(i),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,i){if(!i)return t;const r=L.toUint8Array(e);if(!It(this,r,t,i))return-1;const s=r.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let c=0;c<i&&(this.valueHexView[c]=s[c]&127,this.blockLength++,!!(s[c]&128));c++);const a=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)a[c]=this.valueHexView[c];return this.valueHexView=a,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=Sn(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){pr();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;const i=new Uint8Array(t.length/7);for(let r=0;r<i.length;r++)i[r]=parseInt(t.slice(r*7,r*7+7),2)+(r+1<i.length?128:0);this.fromBER(i.buffer,0,i.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const r=this.valueHexView,s=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)s[a]=r[a]|128;return s[this.blockLength-1]=r[this.blockLength-1],s.buffer}const t=Qt(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",ot;const i=new Uint8Array(t.byteLength);if(!e){const r=new Uint8Array(t),s=t.byteLength-1;for(let a=0;a<s;a++)i[a]=r[a]|128;i[s]=r[s]}return i}toString(){let e="";if(this.isHexOnly)e=W.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}}}go.NAME="sidBlock";class Fd extends Be{constructor({value:e=Te,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let r=t;for(;i>0;){const s=new go;if(r=s.fromBER(e,r,i),r===-1)return this.blockLength=0,this.error=s.error,r;this.value.length===0&&(s.isFirstSid=!0),this.blockLength+=s.blockLength,i-=s.blockLength,this.value.push(s)}return r}toBER(e){const t=[];for(let i=0;i<this.value.length;i++){const r=this.value[i].toBER(e);if(r.byteLength===0)return this.error=this.value[i].error,ot;t.push(r)}return Va(t)}fromString(e){this.value=[];let t=0,i=0,r="",s=!1;do if(i=e.indexOf(".",t),i===-1?r=e.substring(t):r=e.substring(t,i),t=i+1,s){const a=this.value[0];let c=0;switch(a.valueDec){case 0:break;case 1:c=40;break;case 2:c=80;break;default:this.value=[];return}const l=parseInt(r,10);if(isNaN(l))return;a.valueDec=l+c,s=!1}else{const a=new go;if(r>Number.MAX_SAFE_INTEGER){pr();const c=BigInt(r);a.valueBigInt=c}else if(a.valueDec=parseInt(r,10),isNaN(a.valueDec))return;this.value.length||(a.isFirstSid=!0,s=!0),this.value.push(a)}while(i!==-1)}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let r=this.value[i].toString();i!==0&&(e=`${e}.`),t?(r=`{${r}}`,this.value[i].isFirstSid?e=`2.{${r} - 80}`:e+=r):e+=r}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}}Fd.NAME="ObjectIdentifierValueBlock";var Wd;class is extends je{constructor(e={}){super(e,Fd),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()}}}Wd=is;H.ObjectIdentifier=Wd;is.NAME="OBJECT IDENTIFIER";class _o extends gt(pn){constructor({valueDec:e=0,...t}={}){super(t),this.valueDec=e}fromBER(e,t,i){if(i===0)return t;const r=L.toUint8Array(e);if(!It(this,r,t,i))return-1;const s=r.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let c=0;c<i&&(this.valueHexView[c]=s[c]&127,this.blockLength++,!!(s[c]&128));c++);const a=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)a[c]=this.valueHexView[c];return this.valueHexView=a,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=Sn(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 r=this.valueHexView,s=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)s[a]=r[a]|128;return s[this.blockLength-1]=r[this.blockLength-1],s.buffer}const t=Qt(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",ot;const i=new Uint8Array(t.byteLength);if(!e){const r=new Uint8Array(t),s=t.byteLength-1;for(let a=0;a<s;a++)i[a]=r[a]|128;i[s]=r[s]}return i.buffer}toString(){let e="";return this.isHexOnly?e=W.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}_o.NAME="relativeSidBlock";class Gd extends Be{constructor({value:e=Te,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let r=t;for(;i>0;){const s=new _o;if(r=s.fromBER(e,r,i),r===-1)return this.blockLength=0,this.error=s.error,r;this.blockLength+=s.blockLength,i-=s.blockLength,this.value.push(s)}return r}toBER(e,t){const i=[];for(let r=0;r<this.value.length;r++){const s=this.value[r].toBER(e);if(s.byteLength===0)return this.error=this.value[r].error,ot;i.push(s)}return Va(i)}fromString(e){this.value=[];let t=0,i=0,r="";do{i=e.indexOf(".",t),i===-1?r=e.substring(t):r=e.substring(t,i),t=i+1;const s=new _o;if(s.valueDec=parseInt(r,10),isNaN(s.valueDec))return!0;this.value.push(s)}while(i!==-1);return!0}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let r=this.value[i].toString();i!==0&&(e=`${e}.`),t&&(r=`{${r}}`),e+=r}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}}Gd.NAME="RelativeObjectIdentifierValueBlock";var Jd;class Ka extends je{constructor(e={}){super(e,Gd),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()}}}Jd=Ka;H.RelativeObjectIdentifier=Jd;Ka.NAME="RelativeObjectIdentifier";var Zd;class vt extends Pe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}Zd=vt;H.Sequence=Zd;vt.NAME="SEQUENCE";var Yd;let wt=class extends Pe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};Yd=wt;H.Set=Yd;wt.NAME="SET";class Xd extends gt(Be){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=Te}toJSON(){return{...super.toJSON(),value:this.value}}}Xd.NAME="StringValueBlock";class Qd extends Xd{}Qd.NAME="SimpleStringValueBlock";class qe extends Ma{constructor({...e}={}){super(e,Qd)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,L.toUint8Array(e))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(t);for(let r=0;r<t;r++)i[r]=e.charCodeAt(r);this.valueBlock.value=e}}qe.NAME="SIMPLE STRING";class ep extends qe{fromBuffer(e){this.valueBlock.valueHexView=L.toUint8Array(e);try{this.valueBlock.value=W.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=W.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(W.FromUtf8String(e)),this.valueBlock.value=e}}ep.NAME="Utf8StringValueBlock";var tp;class jt extends ep{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}tp=jt;H.Utf8String=tp;jt.NAME="UTF8String";class np extends qe{fromBuffer(e){this.valueBlock.value=W.ToUtf16String(e),this.valueBlock.valueHexView=L.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(W.FromUtf16String(e))}}np.NAME="BmpStringValueBlock";var ip;class rs extends np{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}ip=rs;H.BmpString=ip;rs.NAME="BMPString";class rp extends qe{fromBuffer(e){const t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),i=new Uint8Array(t);for(let r=0;r<i.length;r+=4)i[r]=i[r+3],i[r+1]=i[r+2],i[r+2]=0,i[r+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(t*4);for(let r=0;r<t;r++){const s=Qt(e.charCodeAt(r),8),a=new Uint8Array(s);if(a.length>4)continue;const c=4-a.length;for(let l=a.length-1;l>=0;l--)i[r*4+l+c]=a[l]}this.valueBlock.value=e}}rp.NAME="UniversalStringValueBlock";var sp;class ss extends rp{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}sp=ss;H.UniversalString=sp;ss.NAME="UniversalString";var op;class os extends qe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}op=os;H.NumericString=op;os.NAME="NumericString";var ap;class as extends qe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}ap=as;H.PrintableString=ap;as.NAME="PrintableString";var cp;class cs extends qe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}cp=cs;H.TeletexString=cp;cs.NAME="TeletexString";var lp;class ls extends qe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}lp=ls;H.VideotexString=lp;ls.NAME="VideotexString";var up;class us extends qe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}up=us;H.IA5String=up;us.NAME="IA5String";var dp;class ds extends qe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}dp=ds;H.GraphicString=dp;ds.NAME="GraphicString";var pp;class bi extends qe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}pp=bi;H.VisibleString=pp;bi.NAME="VisibleString";var fp;class ps extends qe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}fp=ps;H.GeneralString=fp;ps.NAME="GeneralString";var hp;class fs extends qe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}hp=fs;H.CharacterString=hp;fs.NAME="CharacterString";var gp;class ki extends bi{constructor({value:e,valueDate:t,...i}={}){if(super(i),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let r=0;r<e.length;r++)this.valueBlock.valueHexView[r]=e.charCodeAt(r)}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,L.toUint8Array(e)))}toBuffer(){const e=this.toString(),t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let r=0;r<e.length;r++)i[r]=e.charCodeAt(r);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){const i=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(i===null){this.error="Wrong input string for conversion";return}const r=parseInt(i[1],10);r>=50?this.year=1900+r:this.year=2e3+r,this.month=parseInt(i[2],10),this.day=parseInt(i[3],10),this.hour=parseInt(i[4],10),this.minute=parseInt(i[5],10),this.second=parseInt(i[6],10)}toString(e="iso"){if(e==="iso"){const t=new Array(7);return t[0]=Me(this.year<2e3?this.year-1900:this.year-2e3,2),t[1]=Me(this.month,2),t[2]=Me(this.day,2),t[3]=Me(this.hour,2),t[4]=Me(this.minute,2),t[5]=Me(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}}}gp=ki;H.UTCTime=gp;ki.NAME="UTCTime";var _p;class hs extends ki{constructor(e={}){var t;super(e),(t=this.millisecond)!==null&&t!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(e){let t=!1,i="",r="",s=0,a,c=0,l=0;if(e[e.length-1]==="Z")i=e.substring(0,e.length-1),t=!0;else{const g=new Number(e[e.length-1]);if(isNaN(g.valueOf()))throw new Error("Wrong input string for conversion");i=e}if(t){if(i.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(i.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let g=1,y=i.indexOf("+"),I="";if(y===-1&&(y=i.indexOf("-"),g=-1),y!==-1){if(I=i.substring(y+1),i=i.substring(0,y),I.length!==2&&I.length!==4)throw new Error("Wrong input string for conversion");let f=parseInt(I.substring(0,2),10);if(isNaN(f.valueOf()))throw new Error("Wrong input string for conversion");if(c=g*f,I.length===4){if(f=parseInt(I.substring(2,4),10),isNaN(f.valueOf()))throw new Error("Wrong input string for conversion");l=g*f}}}let d=i.indexOf(".");if(d===-1&&(d=i.indexOf(",")),d!==-1){const g=new Number(`0${i.substring(d)}`);if(isNaN(g.valueOf()))throw new Error("Wrong input string for conversion");s=g.valueOf(),r=i.substring(0,d)}else r=i;switch(!0){case r.length===8:if(a=/(\d{4})(\d{2})(\d{2})/ig,d!==-1)throw new Error("Wrong input string for conversion");break;case r.length===10:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let g=60*s;this.minute=Math.floor(g),g=60*(g-this.minute),this.second=Math.floor(g),g=1e3*(g-this.second),this.millisecond=Math.floor(g)}break;case r.length===12:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let g=60*s;this.second=Math.floor(g),g=1e3*(g-this.second),this.millisecond=Math.floor(g)}break;case r.length===14:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){const g=1e3*s;this.millisecond=Math.floor(g)}break;default:throw new Error("Wrong input string for conversion")}const h=a.exec(r);if(h===null)throw new Error("Wrong input string for conversion");for(let g=1;g<h.length;g++)switch(g){case 1:this.year=parseInt(h[g],10);break;case 2:this.month=parseInt(h[g],10);break;case 3:this.day=parseInt(h[g],10);break;case 4:this.hour=parseInt(h[g],10)+c;break;case 5:this.minute=parseInt(h[g],10)+l;break;case 6:this.second=parseInt(h[g],10);break;default:throw new Error("Wrong input string for conversion")}if(t===!1){const g=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=g.getUTCFullYear(),this.month=g.getUTCMonth(),this.day=g.getUTCDay(),this.hour=g.getUTCHours(),this.minute=g.getUTCMinutes(),this.second=g.getUTCSeconds(),this.millisecond=g.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){const t=[];return t.push(Me(this.year,4)),t.push(Me(this.month,2)),t.push(Me(this.day,2)),t.push(Me(this.hour,2)),t.push(Me(this.minute,2)),t.push(Me(this.second,2)),this.millisecond!==0&&(t.push("."),t.push(Me(this.millisecond,3))),t.push("Z"),t.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}_p=hs;H.GeneralizedTime=_p;hs.NAME="GeneralizedTime";var mp;class Fa extends jt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}mp=Fa;H.DATE=mp;Fa.NAME="DATE";var yp;class Wa extends jt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}yp=Wa;H.TimeOfDay=yp;Wa.NAME="TimeOfDay";var vp;class Ga extends jt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}vp=Ga;H.DateTime=vp;Ga.NAME="DateTime";var wp;class Ja extends jt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}wp=Ja;H.Duration=wp;Ja.NAME="Duration";var bp;class Za extends jt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}bp=Za;H.TIME=bp;Za.NAME="TIME";class tn{constructor({name:e=Te,optional:t=!1}={}){this.name=e,this.optional=t}}class Ya extends tn{constructor({value:e=[],...t}={}){super(t),this.value=e}}class fr extends tn{constructor({value:e=new tn,local:t=!1,...i}={}){super(i),this.value=e,this.local=t}}class fg{constructor({data:e=es}={}){this.dataView=L.toUint8Array(e)}get data(){return this.dataView.slice().buffer}set data(e){this.dataView=L.toUint8Array(e)}fromBER(e,t,i){const r=t+i;return this.dataView=L.toUint8Array(e).subarray(t,r),r}toBER(e){return this.dataView.slice().buffer}}function Wt(n,e,t){if(t instanceof Ya){for(let s=0;s<t.value.length;s++)if(Wt(n,e,t.value[s]).verified)return{verified:!0,result:n};{const s={verified:!1,result:{error:"Wrong values for Choice type"}};return t.hasOwnProperty(Zs)&&(s.name=t.name),s}}if(t instanceof tn)return t.hasOwnProperty(Zs)&&(n[t.name]=e),{verified:!0,result:n};if(!(n 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(!(ng in t))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(og in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(ag in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const i=t.idBlock.toBER(!1);if(i.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(t.idBlock.fromBER(i,0,i.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(t.idBlock.hasOwnProperty(ig)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:n};if(t.idBlock.hasOwnProperty(rg)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:n};if(t.idBlock.hasOwnProperty(sg)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:n};if(!(tg in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:n};if(t.idBlock.isHexOnly){if(!(ll in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const s=t.idBlock.valueHexView,a=e.idBlock.valueHexView;if(s.length!==a.length)return{verified:!1,result:n};for(let c=0;c<s.length;c++)if(s[c]!==a[1])return{verified:!1,result:n}}if(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Te),t.name&&(n[t.name]=e)),t instanceof H.Constructed){let s=0,a={verified:!1,result:{error:"Unknown error"}},c=t.valueBlock.value.length;if(c>0&&t.valueBlock.value[0]instanceof fr&&(c=e.valueBlock.value.length),c===0)return{verified:!0,result:n};if(e.valueBlock.value.length===0&&t.valueBlock.value.length!==0){let l=!0;for(let d=0;d<t.valueBlock.value.length;d++)l=l&&(t.valueBlock.value[d].optional||!1);return l?{verified:!0,result:n}:(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Te),t.name&&delete n[t.name]),n.error="Inconsistent object length",{verified:!1,result:n})}for(let l=0;l<c;l++)if(l-s>=e.valueBlock.value.length){if(t.valueBlock.value[l].optional===!1){const d={verified:!1,result:n};return n.error="Inconsistent length between ASN.1 data and schema",t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Te),t.name&&(delete n[t.name],d.name=t.name)),d}}else if(t.valueBlock.value[0]instanceof fr){if(a=Wt(n,e.valueBlock.value[l],t.valueBlock.value[0].value),a.verified===!1)if(t.valueBlock.value[0].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Te),t.name&&delete n[t.name]),a;if(Zs in t.valueBlock.value[0]&&t.valueBlock.value[0].name.length>0){let d={};cg in t.valueBlock.value[0]&&t.valueBlock.value[0].local?d=e:d=n,typeof d[t.valueBlock.value[0].name]>"u"&&(d[t.valueBlock.value[0].name]=[]),d[t.valueBlock.value[0].name].push(e.valueBlock.value[l])}}else if(a=Wt(n,e.valueBlock.value[l-s],t.valueBlock.value[l]),a.verified===!1)if(t.valueBlock.value[l].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Te),t.name&&delete n[t.name]),a;if(a.verified===!1){const l={verified:!1,result:n};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Te),t.name&&(delete n[t.name],l.name=t.name)),l}return{verified:!0,result:n}}if(t.primitiveSchema&&ll in e.valueBlock){const s=Un(e.valueBlock.valueHexView);if(s.offset===-1){const a={verified:!1,result:s.result};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Te),t.name&&(delete n[t.name],a.name=t.name)),a}return Wt(n,s.result,t.primitiveSchema)}return{verified:!0,result:n}}function hg(n,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const t=Un(L.toUint8Array(n));return t.offset===-1?{verified:!1,result:t.result}:Wt(t.result,t.result,e)}const kp=Object.freeze(Object.defineProperty({__proto__:null,Any:tn,BaseBlock:je,BaseStringBlock:Ma,BitString:Zt,BmpString:rs,Boolean:ts,CharacterString:fs,Choice:Ya,Constructed:Pe,DATE:Fa,DateTime:Ga,Duration:Ja,EndOfContent:Ha,Enumerated:ns,GeneralString:ps,GeneralizedTime:hs,GraphicString:ds,HexBlock:gt,IA5String:us,Integer:ft,Null:en,NumericString:os,ObjectIdentifier:is,OctetString:Jt,Primitive:wi,PrintableString:as,RawData:fg,RelativeObjectIdentifier:Ka,Repeated:fr,Sequence:vt,Set:wt,TIME:Za,TeletexString:cs,TimeOfDay:Wa,UTCTime:ki,UniversalString:ss,Utf8String:jt,ValueBlock:Be,VideotexString:ls,ViewWriter:Qr,VisibleString:bi,compareSchema:Wt,fromBER:bn,verifySchema:hg},Symbol.toStringTag,{value:"Module"}));var C;(function(n){n[n.Sequence=0]="Sequence",n[n.Set=1]="Set",n[n.Choice=2]="Choice"})(C||(C={}));var m;(function(n){n[n.Any=1]="Any",n[n.Boolean=2]="Boolean",n[n.OctetString=3]="OctetString",n[n.BitString=4]="BitString",n[n.Integer=5]="Integer",n[n.Enumerated=6]="Enumerated",n[n.ObjectIdentifier=7]="ObjectIdentifier",n[n.Utf8String=8]="Utf8String",n[n.BmpString=9]="BmpString",n[n.UniversalString=10]="UniversalString",n[n.NumericString=11]="NumericString",n[n.PrintableString=12]="PrintableString",n[n.TeletexString=13]="TeletexString",n[n.VideotexString=14]="VideotexString",n[n.IA5String=15]="IA5String",n[n.GraphicString=16]="GraphicString",n[n.VisibleString=17]="VisibleString",n[n.GeneralString=18]="GeneralString",n[n.CharacterString=19]="CharacterString",n[n.UTCTime=20]="UTCTime",n[n.GeneralizedTime=21]="GeneralizedTime",n[n.DATE=22]="DATE",n[n.TimeOfDay=23]="TimeOfDay",n[n.DateTime=24]="DateTime",n[n.Duration=25]="Duration",n[n.TIME=26]="TIME",n[n.Null=27]="Null"})(m||(m={}));class gs{constructor(e,t=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(L.isBufferSource(e))this.unusedBits=t,this.value=L.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof Zt))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 Zt({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new Zt({name:e})}toNumber(){let e="";const t=new Uint8Array(this.value);for(const i of t)e+=i.toString(2).padStart(8,"0");return e=e.split("").reverse().join(""),this.unusedBits&&(e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(e,2)}fromNumber(e){let t=e.toString(2);const i=t.length+7>>3;this.unusedBits=(i<<3)-t.length;const r=new Uint8Array(i);t=t.padStart(i<<3,"0").split("").reverse().join("");let s=0;for(;s<i;)r[s]=parseInt(t.slice(s<<3,(s<<3)+8),2),s++;this.value=r.buffer}}class re{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):L.isBufferSource(e)?this.buffer=L.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof Jt))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new Jt({valueHex:this.buffer})}toSchema(e){return new Jt({name:e})}}const gg={fromASN:n=>n instanceof en?null:n.valueBeforeDecodeView,toASN:n=>{if(n===null)return new en;const e=bn(n);if(e.result.error)throw new Error(e.result.error);return e.result}},_g={fromASN:n=>n.valueBlock.valueHexView.byteLength>=4?n.valueBlock.toString():n.valueBlock.valueDec,toASN:n=>new ft({value:+n})},mg={fromASN:n=>n.valueBlock.valueDec,toASN:n=>new ns({value:n})},he={fromASN:n=>n.valueBlock.valueHexView,toASN:n=>new ft({valueHex:n})},yg={fromASN:n=>n.valueBlock.valueHexView,toASN:n=>new Zt({valueHex:n})},vg={fromASN:n=>n.valueBlock.toString(),toASN:n=>new is({value:n})},wg={fromASN:n=>n.valueBlock.value,toASN:n=>new ts({value:n})},hr={fromASN:n=>n.valueBlock.valueHexView,toASN:n=>new Jt({valueHex:n})},bg={fromASN:n=>new re(n.getValue()),toASN:n=>n.toASN()};function Ze(n){return{fromASN:e=>e.valueBlock.value,toASN:e=>new n({value:e})}}const xp=Ze(jt),kg=Ze(rs),xg=Ze(ss),Sg=Ze(os),Ag=Ze(as),Ig=Ze(cs),jg=Ze(ls),zg=Ze(us),Eg=Ze(ds),$g=Ze(bi),Cg=Ze(ps),Og=Ze(fs),Bg={fromASN:n=>n.toDate(),toASN:n=>new ki({valueDate:n})},Ng={fromASN:n=>n.toDate(),toASN:n=>new hs({valueDate:n})},Rg={fromASN:()=>null,toASN:()=>new en};function Xa(n){switch(n){case m.Any:return gg;case m.BitString:return yg;case m.BmpString:return kg;case m.Boolean:return wg;case m.CharacterString:return Og;case m.Enumerated:return mg;case m.GeneralString:return Cg;case m.GeneralizedTime:return Ng;case m.GraphicString:return Eg;case m.IA5String:return zg;case m.Integer:return _g;case m.Null:return Rg;case m.NumericString:return Sg;case m.ObjectIdentifier:return vg;case m.OctetString:return hr;case m.PrintableString:return Ag;case m.TeletexString:return Ig;case m.UTCTime:return Bg;case m.UniversalString:return xg;case m.Utf8String:return xp;case m.VideotexString:return jg;case m.VisibleString:return $g;default:return null}}function yt(n){return typeof n=="function"&&n.prototype?n.prototype.toASN&&n.prototype.fromASN?!0:yt(n.prototype):!!(n&&typeof n=="object"&&"toASN"in n&&"fromASN"in n)}function Sp(n){var e;if(n){const t=Object.getPrototypeOf(n);return((e=t==null?void 0:t.prototype)===null||e===void 0?void 0:e.constructor)===Array?!0:Sp(t)}return!1}function Tg(n,e){if(!(n&&e)||n.byteLength!==e.byteLength)return!1;const t=new Uint8Array(n),i=new Uint8Array(e);for(let r=0;r<n.byteLength;r++)if(t[r]!==i[r])return!1;return!0}class Pg{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e,t=!1){const i=this.items.get(e);if(!i)throw new Error(`Cannot get schema for '${e.prototype.constructor.name}' target`);if(t&&!i.schema)throw new Error(`Schema '${e.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return i}cache(e){const t=this.get(e);t.schema||(t.schema=this.create(e,!0))}createDefault(e){const t={type:C.Sequence,items:{}},i=this.findParentSchema(e);return i&&(Object.assign(t,i),t.items=Object.assign({},t.items,i.items)),t}create(e,t){const i=this.items.get(e)||this.createDefault(e),r=[];for(const s in i.items){const a=i.items[s],c=t?s:"";let l;if(typeof a.type=="number"){const h=m[a.type],g=kp[h];if(!g)throw new Error(`Cannot get ASN1 class by name '${h}'`);l=new g({name:c})}else yt(a.type)?l=new a.type().toSchema(c):a.optional?this.get(a.type).type===C.Choice?l=new tn({name:c}):(l=this.create(a.type,!1),l.name=c):l=new tn({name:c});const d=!!a.optional||a.defaultValue!==void 0;if(a.repeated){l.name="";const h=a.repeated==="set"?wt:vt;l=new h({name:"",value:[new fr({name:c,value:l})]})}if(a.context!==null&&a.context!==void 0)if(a.implicit)if(typeof a.type=="number"||yt(a.type)){const h=a.repeated?Pe:wi;r.push(new h({name:c,optional:d,idBlock:{tagClass:3,tagNumber:a.context}}))}else{this.cache(a.type);const h=!!a.repeated;let g=h?l:this.get(a.type,!0).schema;g="valueBlock"in g?g.valueBlock.value:g.value,r.push(new Pe({name:h?"":c,optional:d,idBlock:{tagClass:3,tagNumber:a.context},value:g}))}else r.push(new Pe({optional:d,idBlock:{tagClass:3,tagNumber:a.context},value:[l]}));else l.optional=d,r.push(l)}switch(i.type){case C.Sequence:return new vt({value:r,name:""});case C.Set:return new wt({value:r,name:""});case C.Choice:return new Ya({value:r,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 Fe=new Pg,N=n=>e=>{let t;Fe.has(e)?t=Fe.get(e):(t=Fe.createDefault(e),Fe.set(e,t)),Object.assign(t,n)},p=n=>(e,t)=>{let i;Fe.has(e.constructor)?i=Fe.get(e.constructor):(i=Fe.createDefault(e.constructor),Fe.set(e.constructor,i));const r=Object.assign({},n);if(typeof r.type=="number"&&!r.converter){const s=Xa(n.type);if(!s)throw new Error(`Cannot get default converter for property '${t}' of ${e.constructor.name}`);r.converter=s}i.items[t]=r};class dl extends Error{constructor(){super(...arguments),this.schemas=[]}}class Ug{static parse(e,t){const i=bn(e);if(i.result.error)throw new Error(i.result.error);return this.fromASN(i.result,t)}static fromASN(e,t){var i;try{if(yt(t))return new t().fromASN(e);const r=Fe.get(t);Fe.cache(t);let s=r.schema;if(e.constructor===Pe&&r.type!==C.Choice){s=new Pe({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:r.schema.valueBlock.value});for(const l in r.items)delete e[l]}const a=Wt({},e,s);if(!a.verified)throw new dl(`Data does not match to ${t.name} ASN1 schema. ${a.result.error}`);const c=new t;if(Sp(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 l=r.itemType;if(typeof l=="number"){const d=Xa(l);if(!d)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);return t.from(e.valueBlock.value,h=>d.fromASN(h))}else return t.from(e.valueBlock.value,d=>this.fromASN(d,l))}for(const l in r.items){const d=a.result[l];if(!d)continue;const h=r.items[l],g=h.type;if(typeof g=="number"||yt(g)){const y=(i=h.converter)!==null&&i!==void 0?i:yt(g)?new g:null;if(!y)throw new Error("Converter is empty");if(h.repeated)if(h.implicit){const I=h.repeated==="sequence"?vt:wt,f=new I;f.valueBlock=d.valueBlock;const _=bn(f.toBER(!1));if(_.offset===-1)throw new Error(`Cannot parse the child item. ${_.result.error}`);if(!("value"in _.result.valueBlock&&Array.isArray(_.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const k=_.result.valueBlock.value;c[l]=Array.from(k,x=>y.fromASN(x))}else c[l]=Array.from(d,I=>y.fromASN(I));else{let I=d;if(h.implicit){let f;if(yt(g))f=new g().toSchema("");else{const _=m[g],k=kp[_];if(!k)throw new Error(`Cannot get '${_}' class from asn1js module`);f=new k}f.valueBlock=I.valueBlock,I=bn(f.toBER(!1)).result}c[l]=y.fromASN(I)}}else if(h.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[l]=Array.from(d,y=>this.fromASN(y,g))}else c[l]=this.fromASN(d,g)}return c}catch(r){throw r instanceof dl&&r.schemas.push(t.name),r}}}class Qa{static serialize(e){return e instanceof je?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&yt(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const t=e.constructor,i=Fe.get(t);Fe.cache(t);let r=[];if(i.itemType){if(!Array.isArray(e))throw new TypeError("Parameter 1 should be type of Array.");if(typeof i.itemType=="number"){const a=Xa(i.itemType);if(!a)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);r=e.map(c=>a.toASN(c))}else r=e.map(a=>this.toAsnItem({type:i.itemType},"[]",t,a))}else for(const a in i.items){const c=i.items[a],l=e[a];if(l===void 0||c.defaultValue===l||typeof c.defaultValue=="object"&&typeof l=="object"&&Tg(this.serialize(c.defaultValue),this.serialize(l)))continue;const d=Qa.toAsnItem(c,a,t,l);if(typeof c.context=="number")if(c.implicit)if(!c.repeated&&(typeof c.type=="number"||yt(c.type))){const h={};h.valueHex=d instanceof en?d.valueBeforeDecodeView:d.valueBlock.toBER(),r.push(new wi({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},...h}))}else r.push(new Pe({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:d.valueBlock.value}));else r.push(new Pe({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:[d]}));else c.repeated?r=r.concat(d):r.push(d)}let s;switch(i.type){case C.Sequence:s=new vt({value:r});break;case C.Set:s=new wt({value:r});break;case C.Choice:if(!r[0])throw new Error(`Schema '${t.name}' has wrong data. Choice cannot be empty.`);s=r[0];break}return s}static toAsnItem(e,t,i,r){let s;if(typeof e.type=="number"){const a=e.converter;if(!a)throw new Error(`Property '${t}' doesn't have converter for type ${m[e.type]} in schema '${i.name}'`);if(e.repeated){if(!Array.isArray(r))throw new TypeError("Parameter 'objProp' should be type of Array.");const c=Array.from(r,d=>a.toASN(d)),l=e.repeated==="sequence"?vt:wt;s=new l({value:c})}else s=a.toASN(r)}else if(e.repeated){if(!Array.isArray(r))throw new TypeError("Parameter 'objProp' should be type of Array.");const a=Array.from(r,l=>this.toASN(l)),c=e.repeated==="sequence"?vt:wt;s=new c({value:a})}else s=this.toASN(r);return s}}class le extends Array{constructor(e=[]){if(typeof e=="number")super(e);else{super();for(const t of e)this.push(t)}}}class U{static serialize(e){return Qa.serialize(e)}static parse(e,t){return Ug.parse(e,t)}static toString(e){const t=L.isBufferSource(e)?L.toArrayBuffer(e):U.serialize(e),i=bn(t);if(i.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${i.result.error}`);return i.result.toString()}}function u(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(r<3?a(s):r>3?a(e,t,s):a(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s}var Ap={exports:{}};(function(n){(function(e){const t="(0?\\d+|0x[a-f0-9]+)",i={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},r=new RegExp("^0[0-7]+$","i"),s=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",l={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${c})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${t}\\.${t}\\.${t}\\.${t}(${a})?$`,"i")};function d(f,_){if(f.indexOf("::")!==f.lastIndexOf("::"))return null;let k=0,x=-1,O=(f.match(l.zoneIndex)||[])[0],R,F;for(O&&(O=O.substring(1),f=f.replace(/%.+$/,""));(x=f.indexOf(":",x+1))>=0;)k++;if(f.substr(0,2)==="::"&&k--,f.substr(-2,2)==="::"&&k--,k>_)return null;for(F=_-k,R=":";F--;)R+="0:";return f=f.replace("::",R),f[0]===":"&&(f=f.slice(1)),f[f.length-1]===":"&&(f=f.slice(0,-1)),_=function(){const oe=f.split(":"),pe=[];for(let ce=0;ce<oe.length;ce++)pe.push(parseInt(oe[ce],16));return pe}(),{parts:_,zoneId:O}}function h(f,_,k,x){if(f.length!==_.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let O=0,R;for(;x>0;){if(R=k-x,R<0&&(R=0),f[O]>>R!==_[O]>>R)return!1;x-=k,O+=1}return!0}function g(f){if(s.test(f))return parseInt(f,16);if(f[0]==="0"&&!isNaN(parseInt(f[1],10))){if(r.test(f))return parseInt(f,8);throw new Error(`ipaddr: cannot parse ${f} as octal`)}return parseInt(f,10)}function y(f,_){for(;f.length<_;)f=`0${f}`;return f}const I={};I.IPv4=function(){function f(_){if(_.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let k,x;for(k=0;k<_.length;k++)if(x=_[k],!(0<=x&&x<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=_}return f.prototype.SpecialRanges={unspecified:[[new f([0,0,0,0]),8]],broadcast:[[new f([255,255,255,255]),32]],multicast:[[new f([224,0,0,0]),4]],linkLocal:[[new f([169,254,0,0]),16]],loopback:[[new f([127,0,0,0]),8]],carrierGradeNat:[[new f([100,64,0,0]),10]],private:[[new f([10,0,0,0]),8],[new f([172,16,0,0]),12],[new f([192,168,0,0]),16]],reserved:[[new f([192,0,0,0]),24],[new f([192,0,2,0]),24],[new f([192,88,99,0]),24],[new f([198,18,0,0]),15],[new f([198,51,100,0]),24],[new f([203,0,113,0]),24],[new f([240,0,0,0]),4]],as112:[[new f([192,175,48,0]),24],[new f([192,31,196,0]),24]],amt:[[new f([192,52,193,0]),24]]},f.prototype.kind=function(){return"ipv4"},f.prototype.match=function(_,k){let x;if(k===void 0&&(x=_,_=x[0],k=x[1]),_.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return h(this.octets,_.octets,8,k)},f.prototype.prefixLengthFromSubnetMask=function(){let _=0,k=!1;const x={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let O,R,F;for(O=3;O>=0;O-=1)if(R=this.octets[O],R in x){if(F=x[R],k&&F!==0)return null;F!==8&&(k=!0),_+=F}else return null;return 32-_},f.prototype.range=function(){return I.subnetMatch(this,this.SpecialRanges)},f.prototype.toByteArray=function(){return this.octets.slice(0)},f.prototype.toIPv4MappedAddress=function(){return I.IPv6.parse(`::ffff:${this.toString()}`)},f.prototype.toNormalizedString=function(){return this.toString()},f.prototype.toString=function(){return this.octets.join(".")},f}(),I.IPv4.broadcastAddressFromCIDR=function(f){try{const _=this.parseCIDR(f),k=_[0].toByteArray(),x=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),O=[];let R=0;for(;R<4;)O.push(parseInt(k[R],10)|parseInt(x[R],10)^255),R++;return new this(O)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},I.IPv4.isIPv4=function(f){return this.parser(f)!==null},I.IPv4.isValid=function(f){try{return new this(this.parser(f)),!0}catch{return!1}},I.IPv4.isValidCIDR=function(f){try{return this.parseCIDR(f),!0}catch{return!1}},I.IPv4.isValidFourPartDecimal=function(f){return!!(I.IPv4.isValid(f)&&f.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},I.IPv4.networkAddressFromCIDR=function(f){let _,k,x,O,R;try{for(_=this.parseCIDR(f),x=_[0].toByteArray(),R=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),O=[],k=0;k<4;)O.push(parseInt(x[k],10)&parseInt(R[k],10)),k++;return new this(O)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},I.IPv4.parse=function(f){const _=this.parser(f);if(_===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(_)},I.IPv4.parseCIDR=function(f){let _;if(_=f.match(/^(.+)\/(\d+)$/)){const k=parseInt(_[2]);if(k>=0&&k<=32){const x=[this.parse(_[1]),k];return Object.defineProperty(x,"toString",{value:function(){return this.join("/")}}),x}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},I.IPv4.parser=function(f){let _,k,x;if(_=f.match(i.fourOctet))return function(){const O=_.slice(1,6),R=[];for(let F=0;F<O.length;F++)k=O[F],R.push(g(k));return R}();if(_=f.match(i.longValue)){if(x=g(_[1]),x>4294967295||x<0)throw new Error("ipaddr: address outside defined range");return function(){const O=[];let R;for(R=0;R<=24;R+=8)O.push(x>>R&255);return O}().reverse()}else return(_=f.match(i.twoOctet))?function(){const O=_.slice(1,4),R=[];if(x=g(O[1]),x>16777215||x<0)throw new Error("ipaddr: address outside defined range");return R.push(g(O[0])),R.push(x>>16&255),R.push(x>>8&255),R.push(x&255),R}():(_=f.match(i.threeOctet))?function(){const O=_.slice(1,5),R=[];if(x=g(O[2]),x>65535||x<0)throw new Error("ipaddr: address outside defined range");return R.push(g(O[0])),R.push(g(O[1])),R.push(x>>8&255),R.push(x&255),R}():null},I.IPv4.subnetMaskFromPrefixLength=function(f){if(f=parseInt(f),f<0||f>32)throw new Error("ipaddr: invalid IPv4 prefix length");const _=[0,0,0,0];let k=0;const x=Math.floor(f/8);for(;k<x;)_[k]=255,k++;return x<4&&(_[x]=Math.pow(2,f%8)-1<<8-f%8),new this(_)},I.IPv6=function(){function f(_,k){let x,O;if(_.length===16)for(this.parts=[],x=0;x<=14;x+=2)this.parts.push(_[x]<<8|_[x+1]);else if(_.length===8)this.parts=_;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(x=0;x<this.parts.length;x++)if(O=this.parts[x],!(0<=O&&O<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");k&&(this.zoneId=k)}return f.prototype.SpecialRanges={unspecified:[new f([0,0,0,0,0,0,0,0]),128],linkLocal:[new f([65152,0,0,0,0,0,0,0]),10],multicast:[new f([65280,0,0,0,0,0,0,0]),8],loopback:[new f([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new f([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new f([0,0,0,0,0,65535,0,0]),96],discard:[new f([256,0,0,0,0,0,0,0]),64],rfc6145:[new f([0,0,0,0,65535,0,0,0]),96],rfc6052:[new f([100,65435,0,0,0,0,0,0]),96],"6to4":[new f([8194,0,0,0,0,0,0,0]),16],teredo:[new f([8193,0,0,0,0,0,0,0]),32],benchmarking:[new f([8193,2,0,0,0,0,0,0]),48],amt:[new f([8193,3,0,0,0,0,0,0]),32],as112v6:[[new f([8193,4,274,0,0,0,0,0]),48],[new f([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new f([8193,16,0,0,0,0,0,0]),28],orchid2:[new f([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new f([8193,48,0,0,0,0,0,0]),28],reserved:[[new f([8193,0,0,0,0,0,0,0]),23],[new f([8193,3512,0,0,0,0,0,0]),32]]},f.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},f.prototype.kind=function(){return"ipv6"},f.prototype.match=function(_,k){let x;if(k===void 0&&(x=_,_=x[0],k=x[1]),_.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return h(this.parts,_.parts,16,k)},f.prototype.prefixLengthFromSubnetMask=function(){let _=0,k=!1;const x={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 O,R;for(let F=7;F>=0;F-=1)if(O=this.parts[F],O in x){if(R=x[O],k&&R!==0)return null;R!==16&&(k=!0),_+=R}else return null;return 128-_},f.prototype.range=function(){return I.subnetMatch(this,this.SpecialRanges)},f.prototype.toByteArray=function(){let _;const k=[],x=this.parts;for(let O=0;O<x.length;O++)_=x[O],k.push(_>>8),k.push(_&255);return k},f.prototype.toFixedLengthString=function(){const _=(function(){const x=[];for(let O=0;O<this.parts.length;O++)x.push(y(this.parts[O].toString(16),4));return x}).call(this).join(":");let k="";return this.zoneId&&(k=`%${this.zoneId}`),_+k},f.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const _=this.parts.slice(-2),k=_[0],x=_[1];return new I.IPv4([k>>8,k&255,x>>8,x&255])},f.prototype.toNormalizedString=function(){const _=(function(){const x=[];for(let O=0;O<this.parts.length;O++)x.push(this.parts[O].toString(16));return x}).call(this).join(":");let k="";return this.zoneId&&(k=`%${this.zoneId}`),_+k},f.prototype.toRFC5952String=function(){const _=/((^|:)(0(:|$)){2,})/g,k=this.toNormalizedString();let x=0,O=-1,R;for(;R=_.exec(k);)R[0].length>O&&(x=R.index,O=R[0].length);return O<0?k:`${k.substring(0,x)}::${k.substring(x+O)}`},f.prototype.toString=function(){return this.toRFC5952String()},f}(),I.IPv6.broadcastAddressFromCIDR=function(f){try{const _=this.parseCIDR(f),k=_[0].toByteArray(),x=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),O=[];let R=0;for(;R<16;)O.push(parseInt(k[R],10)|parseInt(x[R],10)^255),R++;return new this(O)}catch(_){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${_})`)}},I.IPv6.isIPv6=function(f){return this.parser(f)!==null},I.IPv6.isValid=function(f){if(typeof f=="string"&&f.indexOf(":")===-1)return!1;try{const _=this.parser(f);return new this(_.parts,_.zoneId),!0}catch{return!1}},I.IPv6.isValidCIDR=function(f){if(typeof f=="string"&&f.indexOf(":")===-1)return!1;try{return this.parseCIDR(f),!0}catch{return!1}},I.IPv6.networkAddressFromCIDR=function(f){let _,k,x,O,R;try{for(_=this.parseCIDR(f),x=_[0].toByteArray(),R=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),O=[],k=0;k<16;)O.push(parseInt(x[k],10)&parseInt(R[k],10)),k++;return new this(O)}catch(F){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${F})`)}},I.IPv6.parse=function(f){const _=this.parser(f);if(_.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(_.parts,_.zoneId)},I.IPv6.parseCIDR=function(f){let _,k,x;if((k=f.match(/^(.+)\/(\d+)$/))&&(_=parseInt(k[2]),_>=0&&_<=128))return x=[this.parse(k[1]),_],Object.defineProperty(x,"toString",{value:function(){return this.join("/")}}),x;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},I.IPv6.parser=function(f){let _,k,x,O,R,F;if(x=f.match(l.deprecatedTransitional))return this.parser(`::ffff:${x[1]}`);if(l.native.test(f))return d(f,8);if((x=f.match(l.transitional))&&(F=x[6]||"",_=x[1],x[1].endsWith("::")||(_=_.slice(0,-1)),_=d(_+F,6),_.parts)){for(R=[parseInt(x[2]),parseInt(x[3]),parseInt(x[4]),parseInt(x[5])],k=0;k<R.length;k++)if(O=R[k],!(0<=O&&O<=255))return null;return _.parts.push(R[0]<<8|R[1]),_.parts.push(R[2]<<8|R[3]),{parts:_.parts,zoneId:_.zoneId}}return null},I.IPv6.subnetMaskFromPrefixLength=function(f){if(f=parseInt(f),f<0||f>128)throw new Error("ipaddr: invalid IPv6 prefix length");const _=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let k=0;const x=Math.floor(f/8);for(;k<x;)_[k]=255,k++;return x<16&&(_[x]=Math.pow(2,f%8)-1<<8-f%8),new this(_)},I.fromByteArray=function(f){const _=f.length;if(_===4)return new I.IPv4(f);if(_===16)return new I.IPv6(f);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},I.isValid=function(f){return I.IPv6.isValid(f)||I.IPv4.isValid(f)},I.isValidCIDR=function(f){return I.IPv6.isValidCIDR(f)||I.IPv4.isValidCIDR(f)},I.parse=function(f){if(I.IPv6.isValid(f))return I.IPv6.parse(f);if(I.IPv4.isValid(f))return I.IPv4.parse(f);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},I.parseCIDR=function(f){try{return I.IPv6.parseCIDR(f)}catch{try{return I.IPv4.parseCIDR(f)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},I.process=function(f){const _=this.parse(f);return _.kind()==="ipv6"&&_.isIPv4MappedAddress()?_.toIPv4Address():_},I.subnetMatch=function(f,_,k){let x,O,R,F;k==null&&(k="unicast");for(O in _)if(Object.prototype.hasOwnProperty.call(_,O)){for(R=_[O],R[0]&&!(R[0]instanceof Array)&&(R=[R]),x=0;x<R.length;x++)if(F=R[x],f.kind()===F[0].kind()&&f.match.apply(f,F))return O}return k},n.exports?n.exports=I:e.ipaddr=I})(dr)})(Ap);var pl=Ap.exports;class fl{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((r,s)=>r+ +s,0);let i=e.slice(0,8).replace(/(.{2})/g,r=>`${parseInt(r,16)}.`);return i=i.slice(0,-1),`${i}/${t}`}static toString(e){if(e.byteLength===4||e.byteLength===16){const t=new Uint8Array(e);return pl.fromByteArray(Array.from(t)).toString()}return this.decodeIP(W.ToHex(e))}static fromString(e){const t=pl.parse(e);return new Uint8Array(t.toByteArray()).buffer}}var mo,yo,vo;let ze=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};u([p({type:m.TeletexString})],ze.prototype,"teletexString",void 0);u([p({type:m.PrintableString})],ze.prototype,"printableString",void 0);u([p({type:m.UniversalString})],ze.prototype,"universalString",void 0);u([p({type:m.Utf8String})],ze.prototype,"utf8String",void 0);u([p({type:m.BmpString})],ze.prototype,"bmpString",void 0);ze=u([N({type:C.Choice})],ze);let An=class extends ze{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?W.ToHex(this.anyValue):super.toString())}};u([p({type:m.IA5String})],An.prototype,"ia5String",void 0);u([p({type:m.Any})],An.prototype,"anyValue",void 0);An=u([N({type:C.Choice})],An);class _s{constructor(e={}){this.type="",this.value=new An,Object.assign(this,e)}}u([p({type:m.ObjectIdentifier})],_s.prototype,"type",void 0);u([p({type:An})],_s.prototype,"value",void 0);let In=mo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,mo.prototype)}};In=mo=u([N({type:C.Set,itemType:_s})],In);let wo=yo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,yo.prototype)}};wo=yo=u([N({type:C.Sequence,itemType:In})],wo);let ye=vo=class extends wo{constructor(e){super(e),Object.setPrototypeOf(this,vo.prototype)}};ye=vo=u([N({type:C.Sequence})],ye);const Lg={fromASN:n=>fl.toString(hr.fromASN(n)),toASN:n=>hr.toASN(fl.fromString(n))};class ai{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:m.ObjectIdentifier})],ai.prototype,"typeId",void 0);u([p({type:m.Any,context:0})],ai.prototype,"value",void 0);class ec{constructor(e={}){this.partyName=new ze,Object.assign(this,e)}}u([p({type:ze,optional:!0,context:0,implicit:!0})],ec.prototype,"nameAssigner",void 0);u([p({type:ze,context:1,implicit:!0})],ec.prototype,"partyName",void 0);let Q=class{constructor(e={}){Object.assign(this,e)}};u([p({type:ai,context:0,implicit:!0})],Q.prototype,"otherName",void 0);u([p({type:m.IA5String,context:1,implicit:!0})],Q.prototype,"rfc822Name",void 0);u([p({type:m.IA5String,context:2,implicit:!0})],Q.prototype,"dNSName",void 0);u([p({type:m.Any,context:3,implicit:!0})],Q.prototype,"x400Address",void 0);u([p({type:ye,context:4,implicit:!1})],Q.prototype,"directoryName",void 0);u([p({type:ec,context:5})],Q.prototype,"ediPartyName",void 0);u([p({type:m.IA5String,context:6,implicit:!0})],Q.prototype,"uniformResourceIdentifier",void 0);u([p({type:m.OctetString,context:7,implicit:!0,converter:Lg})],Q.prototype,"iPAddress",void 0);u([p({type:m.ObjectIdentifier,context:8,implicit:!0})],Q.prototype,"registeredID",void 0);Q=u([N({type:C.Choice})],Q);const tc="1.3.6.1.5.5.7",Dg=`${tc}.1`,Ln=`${tc}.3`,ms=`${tc}.48`,hl=`${ms}.1`,gl=`${ms}.2`,_l=`${ms}.3`,ml=`${ms}.5`,Dt="2.5.29";var bo;const ko=`${Dg}.1`;class xi{constructor(e={}){this.accessMethod="",this.accessLocation=new Q,Object.assign(this,e)}}u([p({type:m.ObjectIdentifier})],xi.prototype,"accessMethod",void 0);u([p({type:Q})],xi.prototype,"accessLocation",void 0);let vn=bo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,bo.prototype)}};vn=bo=u([N({type:C.Sequence,itemType:xi})],vn);const xo=`${Dt}.35`;class nc extends re{}class Gt{constructor(e={}){e&&Object.assign(this,e)}}u([p({type:nc,context:0,optional:!0,implicit:!0})],Gt.prototype,"keyIdentifier",void 0);u([p({type:Q,context:1,optional:!0,implicit:!0,repeated:"sequence"})],Gt.prototype,"authorityCertIssuer",void 0);u([p({type:m.Integer,context:2,optional:!0,implicit:!0,converter:he})],Gt.prototype,"authorityCertSerialNumber",void 0);const Ip=`${Dt}.19`;class gr{constructor(e={}){this.cA=!1,Object.assign(this,e)}}u([p({type:m.Boolean,defaultValue:!1})],gr.prototype,"cA",void 0);u([p({type:m.Integer,optional:!0})],gr.prototype,"pathLenConstraint",void 0);var So;let Oe=So=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,So.prototype)}};Oe=So=u([N({type:C.Sequence,itemType:Q})],Oe);var Ao;let yl=Ao=class extends Oe{constructor(e){super(e),Object.setPrototypeOf(this,Ao.prototype)}};yl=Ao=u([N({type:C.Sequence})],yl);var Io;const jp=`${Dt}.32`;let bt=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};u([p({type:m.IA5String})],bt.prototype,"ia5String",void 0);u([p({type:m.VisibleString})],bt.prototype,"visibleString",void 0);u([p({type:m.BmpString})],bt.prototype,"bmpString",void 0);u([p({type:m.Utf8String})],bt.prototype,"utf8String",void 0);bt=u([N({type:C.Choice})],bt);class ic{constructor(e={}){this.organization=new bt,this.noticeNumbers=[],Object.assign(this,e)}}u([p({type:bt})],ic.prototype,"organization",void 0);u([p({type:m.Integer,repeated:"sequence"})],ic.prototype,"noticeNumbers",void 0);class rc{constructor(e={}){Object.assign(this,e)}}u([p({type:ic,optional:!0})],rc.prototype,"noticeRef",void 0);u([p({type:bt,optional:!0})],rc.prototype,"explicitText",void 0);let _r=class{constructor(e={}){Object.assign(this,e)}};u([p({type:m.IA5String})],_r.prototype,"cPSuri",void 0);u([p({type:rc})],_r.prototype,"userNotice",void 0);_r=u([N({type:C.Choice})],_r);class sc{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:m.ObjectIdentifier})],sc.prototype,"policyQualifierId",void 0);u([p({type:m.Any})],sc.prototype,"qualifier",void 0);class ys{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}u([p({type:m.ObjectIdentifier})],ys.prototype,"policyIdentifier",void 0);u([p({type:sc,repeated:"sequence",optional:!0})],ys.prototype,"policyQualifiers",void 0);let mr=Io=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Io.prototype)}};mr=Io=u([N({type:C.Sequence,itemType:ys})],mr);let yr=class{constructor(e=0){this.value=e}};u([p({type:m.Integer})],yr.prototype,"value",void 0);yr=u([N({type:C.Choice})],yr);let vl=class extends yr{};vl=u([N({type:C.Choice})],vl);var jo;const zo=`${Dt}.31`;var tt;(function(n){n[n.unused=1]="unused",n[n.keyCompromise=2]="keyCompromise",n[n.cACompromise=4]="cACompromise",n[n.affiliationChanged=8]="affiliationChanged",n[n.superseded=16]="superseded",n[n.cessationOfOperation=32]="cessationOfOperation",n[n.certificateHold=64]="certificateHold",n[n.privilegeWithdrawn=128]="privilegeWithdrawn",n[n.aACompromise=256]="aACompromise"})(tt||(tt={}));class zp extends gs{toJSON(){const e=[],t=this.toNumber();return t&tt.aACompromise&&e.push("aACompromise"),t&tt.affiliationChanged&&e.push("affiliationChanged"),t&tt.cACompromise&&e.push("cACompromise"),t&tt.certificateHold&&e.push("certificateHold"),t&tt.cessationOfOperation&&e.push("cessationOfOperation"),t&tt.keyCompromise&&e.push("keyCompromise"),t&tt.privilegeWithdrawn&&e.push("privilegeWithdrawn"),t&tt.superseded&&e.push("superseded"),t&tt.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let nn=class{constructor(e={}){Object.assign(this,e)}};u([p({type:Q,context:0,repeated:"sequence",implicit:!0})],nn.prototype,"fullName",void 0);u([p({type:In,context:1,implicit:!0})],nn.prototype,"nameRelativeToCRLIssuer",void 0);nn=u([N({type:C.Choice})],nn);class Dn{constructor(e={}){Object.assign(this,e)}}u([p({type:nn,context:0,optional:!0})],Dn.prototype,"distributionPoint",void 0);u([p({type:zp,context:1,optional:!0,implicit:!0})],Dn.prototype,"reasons",void 0);u([p({type:Q,context:2,optional:!0,repeated:"sequence",implicit:!0})],Dn.prototype,"cRLIssuer",void 0);let kn=jo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,jo.prototype)}};kn=jo=u([N({type:C.Sequence,itemType:Dn})],kn);var Eo;let wl=Eo=class extends kn{constructor(e){super(e),Object.setPrototypeOf(this,Eo.prototype)}};wl=Eo=u([N({type:C.Sequence,itemType:Dn})],wl);class $e{constructor(e={}){this.onlyContainsUserCerts=$e.ONLY,this.onlyContainsCACerts=$e.ONLY,this.indirectCRL=$e.ONLY,this.onlyContainsAttributeCerts=$e.ONLY,Object.assign(this,e)}}$e.ONLY=!1;u([p({type:nn,context:0,optional:!0})],$e.prototype,"distributionPoint",void 0);u([p({type:m.Boolean,context:1,defaultValue:$e.ONLY,implicit:!0})],$e.prototype,"onlyContainsUserCerts",void 0);u([p({type:m.Boolean,context:2,defaultValue:$e.ONLY,implicit:!0})],$e.prototype,"onlyContainsCACerts",void 0);u([p({type:zp,context:3,optional:!0,implicit:!0})],$e.prototype,"onlySomeReasons",void 0);u([p({type:m.Boolean,context:4,defaultValue:$e.ONLY,implicit:!0})],$e.prototype,"indirectCRL",void 0);u([p({type:m.Boolean,context:5,defaultValue:$e.ONLY,implicit:!0})],$e.prototype,"onlyContainsAttributeCerts",void 0);var Qn;(function(n){n[n.unspecified=0]="unspecified",n[n.keyCompromise=1]="keyCompromise",n[n.cACompromise=2]="cACompromise",n[n.affiliationChanged=3]="affiliationChanged",n[n.superseded=4]="superseded",n[n.cessationOfOperation=5]="cessationOfOperation",n[n.certificateHold=6]="certificateHold",n[n.removeFromCRL=8]="removeFromCRL",n[n.privilegeWithdrawn=9]="privilegeWithdrawn",n[n.aACompromise=10]="aACompromise"})(Qn||(Qn={}));let $o=class{constructor(e=Qn.unspecified){this.reason=Qn.unspecified,this.reason=e}toJSON(){return Qn[this.reason]}toString(){return this.toJSON()}};u([p({type:m.Enumerated})],$o.prototype,"reason",void 0);$o=u([N({type:C.Choice})],$o);var Co;const Ep=`${Dt}.37`;let vr=Co=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Co.prototype)}};vr=Co=u([N({type:C.Sequence,itemType:m.ObjectIdentifier})],vr);const Vg=`${Ln}.1`,Mg=`${Ln}.2`,Hg=`${Ln}.3`,qg=`${Ln}.4`,Kg=`${Ln}.8`,Fg=`${Ln}.9`;let Oo=class{constructor(e=new ArrayBuffer(0)){this.value=e}};u([p({type:m.Integer,converter:he})],Oo.prototype,"value",void 0);Oo=u([N({type:C.Choice})],Oo);let Bo=class{constructor(e){this.value=new Date,e&&(this.value=e)}};u([p({type:m.GeneralizedTime})],Bo.prototype,"value",void 0);Bo=u([N({type:C.Choice})],Bo);var No;let bl=No=class extends Oe{constructor(e){super(e),Object.setPrototypeOf(this,No.prototype)}};bl=No=u([N({type:C.Sequence})],bl);const $p=`${Dt}.15`;var nt;(function(n){n[n.digitalSignature=1]="digitalSignature",n[n.nonRepudiation=2]="nonRepudiation",n[n.keyEncipherment=4]="keyEncipherment",n[n.dataEncipherment=8]="dataEncipherment",n[n.keyAgreement=16]="keyAgreement",n[n.keyCertSign=32]="keyCertSign",n[n.cRLSign=64]="cRLSign",n[n.encipherOnly=128]="encipherOnly",n[n.decipherOnly=256]="decipherOnly"})(nt||(nt={}));class Ys extends gs{toJSON(){const e=this.toNumber(),t=[];return e&nt.cRLSign&&t.push("crlSign"),e&nt.dataEncipherment&&t.push("dataEncipherment"),e&nt.decipherOnly&&t.push("decipherOnly"),e&nt.digitalSignature&&t.push("digitalSignature"),e&nt.encipherOnly&&t.push("encipherOnly"),e&nt.keyAgreement&&t.push("keyAgreement"),e&nt.keyCertSign&&t.push("keyCertSign"),e&nt.keyEncipherment&&t.push("keyEncipherment"),e&nt.nonRepudiation&&t.push("nonRepudiation"),t}toString(){return`[${this.toJSON().join(", ")}]`}}var Ro;class vs{constructor(e={}){this.base=new Q,this.minimum=0,Object.assign(this,e)}}u([p({type:Q})],vs.prototype,"base",void 0);u([p({type:m.Integer,context:0,defaultValue:0,implicit:!0})],vs.prototype,"minimum",void 0);u([p({type:m.Integer,context:1,optional:!0,implicit:!0})],vs.prototype,"maximum",void 0);let wr=Ro=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Ro.prototype)}};wr=Ro=u([N({type:C.Sequence,itemType:vs})],wr);class Cp{constructor(e={}){Object.assign(this,e)}}u([p({type:wr,context:0,optional:!0,implicit:!0})],Cp.prototype,"permittedSubtrees",void 0);u([p({type:wr,context:1,optional:!0,implicit:!0})],Cp.prototype,"excludedSubtrees",void 0);class Op{constructor(e={}){Object.assign(this,e)}}u([p({type:m.Integer,context:0,implicit:!0,optional:!0,converter:he})],Op.prototype,"requireExplicitPolicy",void 0);u([p({type:m.Integer,context:1,implicit:!0,optional:!0,converter:he})],Op.prototype,"inhibitPolicyMapping",void 0);var To;class oc{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}u([p({type:m.ObjectIdentifier})],oc.prototype,"issuerDomainPolicy",void 0);u([p({type:m.ObjectIdentifier})],oc.prototype,"subjectDomainPolicy",void 0);let kl=To=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,To.prototype)}};kl=To=u([N({type:C.Sequence,itemType:oc})],kl);var Po;const Bp=`${Dt}.17`;let Uo=Po=class extends Oe{constructor(e){super(e),Object.setPrototypeOf(this,Po.prototype)}};Uo=Po=u([N({type:C.Sequence})],Uo);let kt=class{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};u([p({type:m.ObjectIdentifier})],kt.prototype,"type",void 0);u([p({type:m.Any,repeated:"set"})],kt.prototype,"values",void 0);var Lo;let xl=Lo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Lo.prototype)}};xl=Lo=u([N({type:C.Sequence,itemType:kt})],xl);const Np=`${Dt}.14`;class Nt extends nc{}class Rp{constructor(e={}){Object.assign(this,e)}}u([p({type:m.GeneralizedTime,context:0,implicit:!0,optional:!0})],Rp.prototype,"notBefore",void 0);u([p({type:m.GeneralizedTime,context:1,implicit:!0,optional:!0})],Rp.prototype,"notAfter",void 0);var ei;(function(n){n[n.keyUpdateAllowed=1]="keyUpdateAllowed",n[n.newExtensions=2]="newExtensions",n[n.pKIXCertificate=4]="pKIXCertificate"})(ei||(ei={}));class Tp extends gs{toJSON(){const e=[],t=this.toNumber();return t&ei.pKIXCertificate&&e.push("pKIXCertificate"),t&ei.newExtensions&&e.push("newExtensions"),t&ei.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class Pp{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new Tp,Object.assign(this,e)}}u([p({type:m.GeneralString})],Pp.prototype,"entrustVers",void 0);u([p({type:Tp})],Pp.prototype,"entrustInfoFlags",void 0);var Do;let Sl=Do=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Do.prototype)}};Sl=Do=u([N({type:C.Sequence,itemType:xi})],Sl);class M{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof M&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&xd(e.parameters,this.parameters)||e.parameters===this.parameters)}}u([p({type:m.ObjectIdentifier})],M.prototype,"algorithm",void 0);u([p({type:m.Any,optional:!0})],M.prototype,"parameters",void 0);class it{constructor(e={}){this.algorithm=new M,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:M})],it.prototype,"algorithm",void 0);u([p({type:m.BitString})],it.prototype,"subjectPublicKey",void 0);let Ie=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}};u([p({type:m.UTCTime})],Ie.prototype,"utcTime",void 0);u([p({type:m.GeneralizedTime})],Ie.prototype,"generalTime",void 0);Ie=u([N({type:C.Choice})],Ie);class Si{constructor(e){this.notBefore=new Ie(new Date),this.notAfter=new Ie(new Date),e&&(this.notBefore=new Ie(e.notBefore),this.notAfter=new Ie(e.notAfter))}}u([p({type:Ie})],Si.prototype,"notBefore",void 0);u([p({type:Ie})],Si.prototype,"notAfter",void 0);var Vo;let Je=class Up{constructor(e={}){this.extnID="",this.critical=Up.CRITICAL,this.extnValue=new re,Object.assign(this,e)}};Je.CRITICAL=!1;u([p({type:m.ObjectIdentifier})],Je.prototype,"extnID",void 0);u([p({type:m.Boolean,defaultValue:Je.CRITICAL})],Je.prototype,"critical",void 0);u([p({type:re})],Je.prototype,"extnValue",void 0);let Tt=Vo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Vo.prototype)}};Tt=Vo=u([N({type:C.Sequence,itemType:Je})],Tt);var rn;(function(n){n[n.v1=0]="v1",n[n.v2=1]="v2",n[n.v3=2]="v3"})(rn||(rn={}));class Ke{constructor(e={}){this.version=rn.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new M,this.issuer=new ye,this.validity=new Si,this.subject=new ye,this.subjectPublicKeyInfo=new it,Object.assign(this,e)}}u([p({type:m.Integer,context:0,defaultValue:rn.v1})],Ke.prototype,"version",void 0);u([p({type:m.Integer,converter:he})],Ke.prototype,"serialNumber",void 0);u([p({type:M})],Ke.prototype,"signature",void 0);u([p({type:ye})],Ke.prototype,"issuer",void 0);u([p({type:Si})],Ke.prototype,"validity",void 0);u([p({type:ye})],Ke.prototype,"subject",void 0);u([p({type:it})],Ke.prototype,"subjectPublicKeyInfo",void 0);u([p({type:m.BitString,context:1,implicit:!0,optional:!0})],Ke.prototype,"issuerUniqueID",void 0);u([p({type:m.BitString,context:2,implicit:!0,optional:!0})],Ke.prototype,"subjectUniqueID",void 0);u([p({type:Tt,context:3,optional:!0})],Ke.prototype,"extensions",void 0);class sn{constructor(e={}){this.tbsCertificate=new Ke,this.signatureAlgorithm=new M,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:Ke})],sn.prototype,"tbsCertificate",void 0);u([p({type:M})],sn.prototype,"signatureAlgorithm",void 0);u([p({type:m.BitString})],sn.prototype,"signatureValue",void 0);class ws{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new Ie,Object.assign(this,e)}}u([p({type:m.Integer,converter:he})],ws.prototype,"userCertificate",void 0);u([p({type:Ie})],ws.prototype,"revocationDate",void 0);u([p({type:Je,optional:!0,repeated:"sequence"})],ws.prototype,"crlEntryExtensions",void 0);class zt{constructor(e={}){this.signature=new M,this.issuer=new ye,this.thisUpdate=new Ie,Object.assign(this,e)}}u([p({type:m.Integer,optional:!0})],zt.prototype,"version",void 0);u([p({type:M})],zt.prototype,"signature",void 0);u([p({type:ye})],zt.prototype,"issuer",void 0);u([p({type:Ie})],zt.prototype,"thisUpdate",void 0);u([p({type:Ie,optional:!0})],zt.prototype,"nextUpdate",void 0);u([p({type:ws,repeated:"sequence",optional:!0})],zt.prototype,"revokedCertificates",void 0);u([p({type:Je,optional:!0,context:0,repeated:"sequence"})],zt.prototype,"crlExtensions",void 0);class ac{constructor(e={}){this.tbsCertList=new zt,this.signatureAlgorithm=new M,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:zt})],ac.prototype,"tbsCertList",void 0);u([p({type:M})],ac.prototype,"signatureAlgorithm",void 0);u([p({type:m.BitString})],ac.prototype,"signature",void 0);class Vn{constructor(e={}){this.issuer=new ye,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:ye})],Vn.prototype,"issuer",void 0);u([p({type:m.Integer,converter:he})],Vn.prototype,"serialNumber",void 0);let jn=class{constructor(e={}){Object.assign(this,e)}};u([p({type:Nt,context:0,implicit:!0})],jn.prototype,"subjectKeyIdentifier",void 0);u([p({type:Vn})],jn.prototype,"issuerAndSerialNumber",void 0);jn=u([N({type:C.Choice})],jn);var xt;(function(n){n[n.v0=0]="v0",n[n.v1=1]="v1",n[n.v2=2]="v2",n[n.v3=3]="v3",n[n.v4=4]="v4",n[n.v5=5]="v5"})(xt||(xt={}));let ci=class extends M{};ci=u([N({type:C.Sequence})],ci);let br=class extends M{};br=u([N({type:C.Sequence})],br);let ht=class extends M{};ht=u([N({type:C.Sequence})],ht);let kr=class extends M{};kr=u([N({type:C.Sequence})],kr);let Al=class extends M{};Al=u([N({type:C.Sequence})],Al);let Mo=class extends M{};Mo=u([N({type:C.Sequence})],Mo);let Mn=class{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};u([p({type:m.ObjectIdentifier})],Mn.prototype,"attrType",void 0);u([p({type:m.Any,repeated:"set"})],Mn.prototype,"attrValues",void 0);var Ho;class _t{constructor(e={}){this.version=xt.v0,this.sid=new jn,this.digestAlgorithm=new ci,this.signatureAlgorithm=new br,this.signature=new re,Object.assign(this,e)}}u([p({type:m.Integer})],_t.prototype,"version",void 0);u([p({type:jn})],_t.prototype,"sid",void 0);u([p({type:ci})],_t.prototype,"digestAlgorithm",void 0);u([p({type:Mn,repeated:"set",context:0,implicit:!0,optional:!0})],_t.prototype,"signedAttrs",void 0);u([p({type:br})],_t.prototype,"signatureAlgorithm",void 0);u([p({type:re})],_t.prototype,"signature",void 0);u([p({type:Mn,repeated:"set",context:1,implicit:!0,optional:!0})],_t.prototype,"unsignedAttrs",void 0);let xr=Ho=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Ho.prototype)}};xr=Ho=u([N({type:C.Set,itemType:_t})],xr);let Il=class extends Ie{};Il=u([N({type:C.Choice})],Il);let jl=class extends _t{};jl=u([N({type:C.Sequence})],jl);class cc{constructor(e={}){this.acIssuer=new Q,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}u([p({type:Q})],cc.prototype,"acIssuer",void 0);u([p({type:m.Integer})],cc.prototype,"acSerial",void 0);u([p({type:kt,repeated:"sequence"})],cc.prototype,"attrs",void 0);var qo;let Sr=qo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,qo.prototype)}};Sr=qo=u([N({type:C.Sequence,itemType:m.ObjectIdentifier})],Sr);class bs{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}u([p({type:m.Integer,optional:!0})],bs.prototype,"pathLenConstraint",void 0);u([p({type:Sr,implicit:!0,context:0,optional:!0})],bs.prototype,"permittedAttrs",void 0);u([p({type:Sr,implicit:!0,context:1,optional:!0})],bs.prototype,"excludedAttrs",void 0);u([p({type:m.Boolean,defaultValue:!0})],bs.prototype,"permitUnSpecified",void 0);class fn{constructor(e={}){this.issuer=new Oe,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:Oe})],fn.prototype,"issuer",void 0);u([p({type:m.Integer,converter:he})],fn.prototype,"serial",void 0);u([p({type:m.BitString,optional:!0})],fn.prototype,"issuerUID",void 0);var Ko;(function(n){n[n.publicKey=0]="publicKey",n[n.publicKeyCert=1]="publicKeyCert",n[n.otherObjectTypes=2]="otherObjectTypes"})(Ko||(Ko={}));class hn{constructor(e={}){this.digestedObjectType=Ko.publicKey,this.digestAlgorithm=new M,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:m.Enumerated})],hn.prototype,"digestedObjectType",void 0);u([p({type:m.ObjectIdentifier,optional:!0})],hn.prototype,"otherObjectTypeID",void 0);u([p({type:M})],hn.prototype,"digestAlgorithm",void 0);u([p({type:m.BitString})],hn.prototype,"objectDigest",void 0);class ks{constructor(e={}){Object.assign(this,e)}}u([p({type:Oe,optional:!0})],ks.prototype,"issuerName",void 0);u([p({type:fn,context:0,implicit:!0,optional:!0})],ks.prototype,"baseCertificateID",void 0);u([p({type:hn,context:1,implicit:!0,optional:!0})],ks.prototype,"objectDigestInfo",void 0);let zn=class{constructor(e={}){Object.assign(this,e)}};u([p({type:Q,repeated:"sequence"})],zn.prototype,"v1Form",void 0);u([p({type:ks,context:0,implicit:!0})],zn.prototype,"v2Form",void 0);zn=u([N({type:C.Choice})],zn);class xs{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}u([p({type:m.GeneralizedTime})],xs.prototype,"notBeforeTime",void 0);u([p({type:m.GeneralizedTime})],xs.prototype,"notAfterTime",void 0);class Ai{constructor(e={}){Object.assign(this,e)}}u([p({type:fn,implicit:!0,context:0,optional:!0})],Ai.prototype,"baseCertificateID",void 0);u([p({type:Oe,implicit:!0,context:1,optional:!0})],Ai.prototype,"entityName",void 0);u([p({type:hn,implicit:!0,context:2,optional:!0})],Ai.prototype,"objectDigestInfo",void 0);var Fo;(function(n){n[n.v2=1]="v2"})(Fo||(Fo={}));class at{constructor(e={}){this.version=Fo.v2,this.holder=new Ai,this.issuer=new zn,this.signature=new M,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new xs,this.attributes=[],Object.assign(this,e)}}u([p({type:m.Integer})],at.prototype,"version",void 0);u([p({type:Ai})],at.prototype,"holder",void 0);u([p({type:zn})],at.prototype,"issuer",void 0);u([p({type:M})],at.prototype,"signature",void 0);u([p({type:m.Integer,converter:he})],at.prototype,"serialNumber",void 0);u([p({type:xs})],at.prototype,"attrCertValidityPeriod",void 0);u([p({type:kt,repeated:"sequence"})],at.prototype,"attributes",void 0);u([p({type:m.BitString,optional:!0})],at.prototype,"issuerUniqueID",void 0);u([p({type:Tt,optional:!0})],at.prototype,"extensions",void 0);class Ss{constructor(e={}){this.acinfo=new at,this.signatureAlgorithm=new M,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:at})],Ss.prototype,"acinfo",void 0);u([p({type:M})],Ss.prototype,"signatureAlgorithm",void 0);u([p({type:m.BitString})],Ss.prototype,"signatureValue",void 0);var Ar;(function(n){n[n.unmarked=1]="unmarked",n[n.unclassified=2]="unclassified",n[n.restricted=4]="restricted",n[n.confidential=8]="confidential",n[n.secret=16]="secret",n[n.topSecret=32]="topSecret"})(Ar||(Ar={}));class Wo extends gs{}class lc{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:m.ObjectIdentifier,implicit:!0,context:0})],lc.prototype,"type",void 0);u([p({type:m.Any,implicit:!0,context:1})],lc.prototype,"value",void 0);class uc{constructor(e={}){this.policyId="",this.classList=new Wo(Ar.unclassified),Object.assign(this,e)}}u([p({type:m.ObjectIdentifier})],uc.prototype,"policyId",void 0);u([p({type:Wo,defaultValue:new Wo(Ar.unclassified)})],uc.prototype,"classList",void 0);u([p({type:lc,repeated:"set"})],uc.prototype,"securityCategories",void 0);class As{constructor(e={}){Object.assign(this,e)}}u([p({type:re})],As.prototype,"cotets",void 0);u([p({type:m.ObjectIdentifier})],As.prototype,"oid",void 0);u([p({type:m.Utf8String})],As.prototype,"string",void 0);class Lp{constructor(e={}){this.values=[],Object.assign(this,e)}}u([p({type:Oe,implicit:!0,context:0,optional:!0})],Lp.prototype,"policyAuthority",void 0);u([p({type:As,repeated:"sequence"})],Lp.prototype,"values",void 0);var Go;class Is{constructor(e={}){this.targetCertificate=new fn,Object.assign(this,e)}}u([p({type:fn})],Is.prototype,"targetCertificate",void 0);u([p({type:Q,optional:!0})],Is.prototype,"targetName",void 0);u([p({type:hn,optional:!0})],Is.prototype,"certDigestInfo",void 0);let En=class{constructor(e={}){Object.assign(this,e)}};u([p({type:Q,context:0,implicit:!0})],En.prototype,"targetName",void 0);u([p({type:Q,context:1,implicit:!0})],En.prototype,"targetGroup",void 0);u([p({type:Is,context:2,implicit:!0})],En.prototype,"targetCert",void 0);En=u([N({type:C.Choice})],En);let Jo=Go=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Go.prototype)}};Jo=Go=u([N({type:C.Sequence,itemType:En})],Jo);var Zo;let zl=Zo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Zo.prototype)}};zl=Zo=u([N({type:C.Sequence,itemType:Jo})],zl);class Dp{constructor(e={}){Object.assign(this,e)}}u([p({type:Oe,implicit:!0,context:0,optional:!0})],Dp.prototype,"roleAuthority",void 0);u([p({type:Q,implicit:!0,context:1})],Dp.prototype,"roleName",void 0);class dc{constructor(e={}){this.service=new Q,this.ident=new Q,Object.assign(this,e)}}u([p({type:Q})],dc.prototype,"service",void 0);u([p({type:Q})],dc.prototype,"ident",void 0);u([p({type:re,optional:!0})],dc.prototype,"authInfo",void 0);var Yo;class pc{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:m.ObjectIdentifier})],pc.prototype,"otherCertFormat",void 0);u([p({type:m.Any})],pc.prototype,"otherCert",void 0);let $n=class{constructor(e={}){Object.assign(this,e)}};u([p({type:sn})],$n.prototype,"certificate",void 0);u([p({type:Ss,context:2,implicit:!0})],$n.prototype,"v2AttrCert",void 0);u([p({type:pc,context:3,implicit:!0})],$n.prototype,"other",void 0);$n=u([N({type:C.Choice})],$n);let Ir=Yo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Yo.prototype)}};Ir=Yo=u([N({type:C.Set,itemType:$n})],Ir);class Hn{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:m.ObjectIdentifier})],Hn.prototype,"contentType",void 0);u([p({type:m.Any,context:0})],Hn.prototype,"content",void 0);let li=class{constructor(e={}){Object.assign(this,e)}};u([p({type:re})],li.prototype,"single",void 0);u([p({type:m.Any})],li.prototype,"any",void 0);li=u([N({type:C.Choice})],li);class js{constructor(e={}){this.eContentType="",Object.assign(this,e)}}u([p({type:m.ObjectIdentifier})],js.prototype,"eContentType",void 0);u([p({type:li,context:0,optional:!0})],js.prototype,"eContent",void 0);let ui=class{constructor(e={}){Object.assign(this,e)}};u([p({type:re,context:0,implicit:!0,optional:!0})],ui.prototype,"value",void 0);u([p({type:re,converter:bg,context:0,implicit:!0,optional:!0,repeated:"sequence"})],ui.prototype,"constructedValue",void 0);ui=u([N({type:C.Choice})],ui);class Ii{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new kr,Object.assign(this,e)}}u([p({type:m.ObjectIdentifier})],Ii.prototype,"contentType",void 0);u([p({type:kr})],Ii.prototype,"contentEncryptionAlgorithm",void 0);u([p({type:ui,optional:!0})],Ii.prototype,"encryptedContent",void 0);class zs{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}u([p({type:m.ObjectIdentifier})],zs.prototype,"keyAttrId",void 0);u([p({type:m.Any,optional:!0})],zs.prototype,"keyAttr",void 0);var Xo;class Es{constructor(e={}){this.subjectKeyIdentifier=new Nt,Object.assign(this,e)}}u([p({type:Nt})],Es.prototype,"subjectKeyIdentifier",void 0);u([p({type:m.GeneralizedTime,optional:!0})],Es.prototype,"date",void 0);u([p({type:zs,optional:!0})],Es.prototype,"other",void 0);let Cn=class{constructor(e={}){Object.assign(this,e)}};u([p({type:Es,context:0,implicit:!0,optional:!0})],Cn.prototype,"rKeyId",void 0);u([p({type:Vn,optional:!0})],Cn.prototype,"issuerAndSerialNumber",void 0);Cn=u([N({type:C.Choice})],Cn);class fc{constructor(e={}){this.rid=new Cn,this.encryptedKey=new re,Object.assign(this,e)}}u([p({type:Cn})],fc.prototype,"rid",void 0);u([p({type:re})],fc.prototype,"encryptedKey",void 0);let jr=Xo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Xo.prototype)}};jr=Xo=u([N({type:C.Sequence,itemType:fc})],jr);class hc{constructor(e={}){this.algorithm=new M,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:M})],hc.prototype,"algorithm",void 0);u([p({type:m.BitString})],hc.prototype,"publicKey",void 0);let on=class{constructor(e={}){Object.assign(this,e)}};u([p({type:Nt,context:0,implicit:!0,optional:!0})],on.prototype,"subjectKeyIdentifier",void 0);u([p({type:hc,context:1,implicit:!0,optional:!0})],on.prototype,"originatorKey",void 0);u([p({type:Vn,optional:!0})],on.prototype,"issuerAndSerialNumber",void 0);on=u([N({type:C.Choice})],on);class qn{constructor(e={}){this.version=xt.v3,this.originator=new on,this.keyEncryptionAlgorithm=new ht,this.recipientEncryptedKeys=new jr,Object.assign(this,e)}}u([p({type:m.Integer})],qn.prototype,"version",void 0);u([p({type:on,context:0})],qn.prototype,"originator",void 0);u([p({type:re,context:1,optional:!0})],qn.prototype,"ukm",void 0);u([p({type:ht})],qn.prototype,"keyEncryptionAlgorithm",void 0);u([p({type:jr})],qn.prototype,"recipientEncryptedKeys",void 0);let On=class{constructor(e={}){Object.assign(this,e)}};u([p({type:Nt,context:0,implicit:!0})],On.prototype,"subjectKeyIdentifier",void 0);u([p({type:Vn})],On.prototype,"issuerAndSerialNumber",void 0);On=u([N({type:C.Choice})],On);class ji{constructor(e={}){this.version=xt.v0,this.rid=new On,this.keyEncryptionAlgorithm=new ht,this.encryptedKey=new re,Object.assign(this,e)}}u([p({type:m.Integer})],ji.prototype,"version",void 0);u([p({type:On})],ji.prototype,"rid",void 0);u([p({type:ht})],ji.prototype,"keyEncryptionAlgorithm",void 0);u([p({type:re})],ji.prototype,"encryptedKey",void 0);class zi{constructor(e={}){this.keyIdentifier=new re,Object.assign(this,e)}}u([p({type:re})],zi.prototype,"keyIdentifier",void 0);u([p({type:m.GeneralizedTime,optional:!0})],zi.prototype,"date",void 0);u([p({type:zs,optional:!0})],zi.prototype,"other",void 0);class Ei{constructor(e={}){this.version=xt.v4,this.kekid=new zi,this.keyEncryptionAlgorithm=new ht,this.encryptedKey=new re,Object.assign(this,e)}}u([p({type:m.Integer})],Ei.prototype,"version",void 0);u([p({type:zi})],Ei.prototype,"kekid",void 0);u([p({type:ht})],Ei.prototype,"keyEncryptionAlgorithm",void 0);u([p({type:re})],Ei.prototype,"encryptedKey",void 0);class $i{constructor(e={}){this.version=xt.v0,this.keyEncryptionAlgorithm=new ht,this.encryptedKey=new re,Object.assign(this,e)}}u([p({type:m.Integer})],$i.prototype,"version",void 0);u([p({type:Mo,context:0,optional:!0})],$i.prototype,"keyDerivationAlgorithm",void 0);u([p({type:ht})],$i.prototype,"keyEncryptionAlgorithm",void 0);u([p({type:re})],$i.prototype,"encryptedKey",void 0);class gc{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:m.ObjectIdentifier})],gc.prototype,"oriType",void 0);u([p({type:m.Any})],gc.prototype,"oriValue",void 0);let Pt=class{constructor(e={}){Object.assign(this,e)}};u([p({type:ji,optional:!0})],Pt.prototype,"ktri",void 0);u([p({type:qn,context:1,implicit:!0,optional:!0})],Pt.prototype,"kari",void 0);u([p({type:Ei,context:2,implicit:!0,optional:!0})],Pt.prototype,"kekri",void 0);u([p({type:$i,context:3,implicit:!0,optional:!0})],Pt.prototype,"pwri",void 0);u([p({type:gc,context:4,implicit:!0,optional:!0})],Pt.prototype,"ori",void 0);Pt=u([N({type:C.Choice})],Pt);var Qo;let zr=Qo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Qo.prototype)}};zr=Qo=u([N({type:C.Set,itemType:Pt})],zr);var ea;class $s{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:m.ObjectIdentifier})],$s.prototype,"otherRevInfoFormat",void 0);u([p({type:m.Any})],$s.prototype,"otherRevInfo",void 0);let Er=class{constructor(e={}){this.other=new $s,Object.assign(this,e)}};u([p({type:$s,context:1,implicit:!0})],Er.prototype,"other",void 0);Er=u([N({type:C.Choice})],Er);let $r=ea=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ea.prototype)}};$r=ea=u([N({type:C.Set,itemType:Er})],$r);class _c{constructor(e={}){Object.assign(this,e)}}u([p({type:Ir,context:0,implicit:!0,optional:!0})],_c.prototype,"certs",void 0);u([p({type:$r,context:1,implicit:!0,optional:!0})],_c.prototype,"crls",void 0);var ta;let na=ta=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ta.prototype)}};na=ta=u([N({type:C.Set,itemType:Mn})],na);class Ci{constructor(e={}){this.version=xt.v0,this.recipientInfos=new zr,this.encryptedContentInfo=new Ii,Object.assign(this,e)}}u([p({type:m.Integer})],Ci.prototype,"version",void 0);u([p({type:_c,context:0,implicit:!0,optional:!0})],Ci.prototype,"originatorInfo",void 0);u([p({type:zr})],Ci.prototype,"recipientInfos",void 0);u([p({type:Ii})],Ci.prototype,"encryptedContentInfo",void 0);u([p({type:na,context:1,implicit:!0,optional:!0})],Ci.prototype,"unprotectedAttrs",void 0);const Wg="1.2.840.113549.1.7.2";var ia;let Cr=ia=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ia.prototype)}};Cr=ia=u([N({type:C.Set,itemType:ci})],Cr);class Kn{constructor(e={}){this.version=xt.v0,this.digestAlgorithms=new Cr,this.encapContentInfo=new js,this.signerInfos=new xr,Object.assign(this,e)}}u([p({type:m.Integer})],Kn.prototype,"version",void 0);u([p({type:Cr})],Kn.prototype,"digestAlgorithms",void 0);u([p({type:js})],Kn.prototype,"encapContentInfo",void 0);u([p({type:Ir,context:0,implicit:!0,optional:!0})],Kn.prototype,"certificates",void 0);u([p({type:$r,context:1,implicit:!0,optional:!0})],Kn.prototype,"crls",void 0);u([p({type:xr})],Kn.prototype,"signerInfos",void 0);const di="1.2.840.10045.2.1",mc="1.2.840.10045.4.1",Vp="1.2.840.10045.4.3.1",yc="1.2.840.10045.4.3.2",vc="1.2.840.10045.4.3.3",wc="1.2.840.10045.4.3.4",El="1.2.840.10045.3.1.7",$l="1.3.132.0.34",Cl="1.3.132.0.35";function Oi(n){return new M({algorithm:n})}const Gg=Oi(mc);Oi(Vp);const Jg=Oi(yc),Zg=Oi(vc),Yg=Oi(wc);let pi=class{constructor(e={}){Object.assign(this,e)}};u([p({type:m.ObjectIdentifier})],pi.prototype,"fieldType",void 0);u([p({type:m.Any})],pi.prototype,"parameters",void 0);pi=u([N({type:C.Sequence})],pi);class Xg extends re{}let Bn=class{constructor(e={}){Object.assign(this,e)}};u([p({type:m.OctetString})],Bn.prototype,"a",void 0);u([p({type:m.OctetString})],Bn.prototype,"b",void 0);u([p({type:m.BitString,optional:!0})],Bn.prototype,"seed",void 0);Bn=u([N({type:C.Sequence})],Bn);var ra;(function(n){n[n.ecpVer1=1]="ecpVer1"})(ra||(ra={}));let St=class{constructor(e={}){this.version=ra.ecpVer1,Object.assign(this,e)}};u([p({type:m.Integer})],St.prototype,"version",void 0);u([p({type:pi})],St.prototype,"fieldID",void 0);u([p({type:Bn})],St.prototype,"curve",void 0);u([p({type:Xg})],St.prototype,"base",void 0);u([p({type:m.Integer,converter:he})],St.prototype,"order",void 0);u([p({type:m.Integer,optional:!0})],St.prototype,"cofactor",void 0);St=u([N({type:C.Sequence})],St);let Ut=class{constructor(e={}){Object.assign(this,e)}};u([p({type:m.ObjectIdentifier})],Ut.prototype,"namedCurve",void 0);u([p({type:m.Null})],Ut.prototype,"implicitCurve",void 0);u([p({type:St})],Ut.prototype,"specifiedCurve",void 0);Ut=u([N({type:C.Choice})],Ut);class Cs{constructor(e={}){this.version=1,this.privateKey=new re,Object.assign(this,e)}}u([p({type:m.Integer})],Cs.prototype,"version",void 0);u([p({type:re})],Cs.prototype,"privateKey",void 0);u([p({type:Ut,context:0,optional:!0})],Cs.prototype,"parameters",void 0);u([p({type:m.BitString,context:1,optional:!0})],Cs.prototype,"publicKey",void 0);class Or{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:m.Integer,converter:he})],Or.prototype,"r",void 0);u([p({type:m.Integer,converter:he})],Or.prototype,"s",void 0);const Le="1.2.840.113549.1.1",an=`${Le}.1`,Qg=`${Le}.7`,e_=`${Le}.9`,ti=`${Le}.10`,t_=`${Le}.2`,n_=`${Le}.4`,Br=`${Le}.5`,i_=`${Le}.14`,sa=`${Le}.11`,Nr=`${Le}.12`,Rr=`${Le}.13`,Mp=`${Le}.15`,Hp=`${Le}.16`,Tr="1.3.14.3.2.26",qp="2.16.840.1.101.3.4.2.4",Pr="2.16.840.1.101.3.4.2.1",Ur="2.16.840.1.101.3.4.2.2",Lr="2.16.840.1.101.3.4.2.3",r_="2.16.840.1.101.3.4.2.5",s_="2.16.840.1.101.3.4.2.6",o_="1.2.840.113549.2.2",a_="1.2.840.113549.2.5",Os=`${Le}.8`;function ke(n){return new M({algorithm:n,parameters:null})}ke(o_);ke(a_);const cn=ke(Tr);ke(qp);ke(Pr);ke(Ur);ke(Lr);ke(r_);ke(s_);const Kp=new M({algorithm:Os,parameters:U.serialize(cn)}),Fp=new M({algorithm:e_,parameters:U.serialize(hr.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});ke(an);ke(t_);ke(n_);ke(Br);ke(Mp);ke(Hp);ke(Nr);ke(Rr);ke(Mp);ke(Hp);class Bs{constructor(e={}){this.hashAlgorithm=new M(cn),this.maskGenAlgorithm=new M({algorithm:Os,parameters:U.serialize(cn)}),this.pSourceAlgorithm=new M(Fp),Object.assign(this,e)}}u([p({type:M,context:0,defaultValue:cn})],Bs.prototype,"hashAlgorithm",void 0);u([p({type:M,context:1,defaultValue:Kp})],Bs.prototype,"maskGenAlgorithm",void 0);u([p({type:M,context:2,defaultValue:Fp})],Bs.prototype,"pSourceAlgorithm",void 0);new M({algorithm:Qg,parameters:U.serialize(new Bs)});class ln{constructor(e={}){this.hashAlgorithm=new M(cn),this.maskGenAlgorithm=new M({algorithm:Os,parameters:U.serialize(cn)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}}u([p({type:M,context:0,defaultValue:cn})],ln.prototype,"hashAlgorithm",void 0);u([p({type:M,context:1,defaultValue:Kp})],ln.prototype,"maskGenAlgorithm",void 0);u([p({type:m.Integer,context:2,defaultValue:20})],ln.prototype,"saltLength",void 0);u([p({type:m.Integer,context:3,defaultValue:1})],ln.prototype,"trailerField",void 0);new M({algorithm:ti,parameters:U.serialize(new ln)});class Ns{constructor(e={}){this.digestAlgorithm=new M,this.digest=new re,Object.assign(this,e)}}u([p({type:M})],Ns.prototype,"digestAlgorithm",void 0);u([p({type:re})],Ns.prototype,"digest",void 0);var oa;class Rs{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:m.Integer,converter:he})],Rs.prototype,"prime",void 0);u([p({type:m.Integer,converter:he})],Rs.prototype,"exponent",void 0);u([p({type:m.Integer,converter:he})],Rs.prototype,"coefficient",void 0);let aa=oa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,oa.prototype)}};aa=oa=u([N({type:C.Sequence,itemType:Rs})],aa);class mt{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)}}u([p({type:m.Integer})],mt.prototype,"version",void 0);u([p({type:m.Integer,converter:he})],mt.prototype,"modulus",void 0);u([p({type:m.Integer,converter:he})],mt.prototype,"publicExponent",void 0);u([p({type:m.Integer,converter:he})],mt.prototype,"privateExponent",void 0);u([p({type:m.Integer,converter:he})],mt.prototype,"prime1",void 0);u([p({type:m.Integer,converter:he})],mt.prototype,"prime2",void 0);u([p({type:m.Integer,converter:he})],mt.prototype,"exponent1",void 0);u([p({type:m.Integer,converter:he})],mt.prototype,"exponent2",void 0);u([p({type:m.Integer,converter:he})],mt.prototype,"coefficient",void 0);u([p({type:aa,optional:!0})],mt.prototype,"otherPrimeInfos",void 0);class bc{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:m.Integer,converter:he})],bc.prototype,"modulus",void 0);u([p({type:m.Integer,converter:he})],bc.prototype,"publicExponent",void 0);var ca;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(ca||(ca={}));const Re=ca;/*! *****************************************************************************
79
+ `)}`:`${t} :`}}Zd=Ue;D.Constructed=Zd;Ue.NAME="CONSTRUCTED";class Yd extends Te{fromBER(e,t,i){return t}toBER(e){return ct}}Yd.override="EndOfContentValueBlock";var Xd;class Xa extends $e{constructor(e={}){super(e,Yd),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}Xd=Xa;D.EndOfContent=Xd;Xa.NAME=pi;var Qd;class on extends $e{constructor(e={}){super(e,Te),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,i){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=i,t+i>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+i}toBER(e,t){const i=new ArrayBuffer(2);if(!e){const r=new Uint8Array(i);r[0]=5,r[1]=0}return t&&t.write(i),i}onAsciiEncoding(){return`${this.constructor.NAME}`}}Qd=on;D.Null=Qd;on.NAME="NULL";class ep extends mt(Te){constructor({value:e,...t}={}){super(t),t.valueHex?this.valueHexView=U.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}fromBER(e,t,i){const r=U.toUint8Array(e);return $t(this,r,t,i)?(this.valueHexView=r.subarray(t,t+i),i>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,Hd.call(this),this.blockLength=i,t+i):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}ep.NAME="BooleanValueBlock";var tp;class as extends $e{constructor(e={}){super(e,ep),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}`}}tp=as;D.Boolean=tp;as.NAME="BOOLEAN";class np extends mt(Tt){constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,i){let r=0;if(this.isConstructed){if(this.isHexOnly=!1,r=Tt.prototype.fromBER.call(this,e,t,i),r===-1)return r;for(let s=0;s<this.value.length;s++){const o=this.value[s].constructor.NAME;if(o===pi){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(o!==Dd)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,r=super.fromBER(e,t,i),this.blockLength=i;return r}toBER(e,t){return this.isConstructed?Tt.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}np.NAME="OctetStringValueBlock";var ip;let Qt=class rp extends $e{constructor({idBlock:e={},lenBlock:t={},...i}={}){var r,s;(r=i.isConstructed)!==null&&r!==void 0||(i.isConstructed=!!(!((s=i.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:i.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!i.isIndefiniteForm},...i},np),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,i){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,i===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){const s=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(t,t+i);try{if(s.byteLength){const o=Hn(s,0,s.byteLength);o.offset!==-1&&o.offset===i&&(this.valueBlock.value=[o.result])}}catch{}}return super.fromBER(e,t,i)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?Ue.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${W.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 rp&&e.push(t.valueBlock.valueHexView);return U.concat(e)}};ip=Qt;D.OctetString=ip;Qt.NAME=Dd;class sp extends mt(Tt){constructor({unusedBits:e=0,isConstructed:t=!1,...i}={}){super(i),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,i){if(!i)return t;let r=-1;if(this.isConstructed){if(r=Tt.prototype.fromBER.call(this,e,t,i),r===-1)return r;for(const c of this.value){const l=c.constructor.NAME;if(l===pi){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(l!==Fd)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const u=c.valueBlock;if(this.unusedBits>0&&u.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=u.unusedBits}return r}const s=U.toUint8Array(e);if(!$t(this,s,t,i))return-1;const o=s.subarray(t,t+i);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 l=Hn(c,0,c.byteLength);l.offset!==-1&&l.offset===i-1&&(this.value=[l.result])}}catch{}}return this.valueHexView=o.subarray(1),this.blockLength=o.length,t+i}toBER(e,t){if(this.isConstructed)return Tt.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return ct;const i=new Uint8Array(this.valueHexView.length+1);return i[0]=this.unusedBits,i.set(this.valueHexView,1),i.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}sp.NAME="BitStringValueBlock";var op;let en=class extends $e{constructor({idBlock:e={},lenBlock:t={},...i}={}){var r,s;(r=i.isConstructed)!==null&&r!==void 0||(i.isConstructed=!!(!((s=i.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:i.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!i.isIndefiniteForm},...i},sp),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,i){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Ue.prototype.onAsciiEncoding.call(this);{const e=[],t=this.valueBlock.valueHexView;for(const r of t)e.push(r.toString(2).padStart(8,"0"));const i=e.join("");return`${this.constructor.NAME} : ${i.substring(0,i.length-this.valueBlock.unusedBits)}`}}};op=en;D.BitString=op;en.NAME=Fd;var ap;function Tg(n,e){const t=new Uint8Array([0]),i=new Uint8Array(n),r=new Uint8Array(e);let s=i.slice(0);const o=s.length-1,c=r.slice(0),l=c.length-1;let u=0;const p=l<o?o:l;let g=0;for(let m=p;m>=0;m--,g++){switch(!0){case g<c.length:u=s[o-g]+c[l-g]+t[0];break;default:u=s[o-g]+t[0]}switch(t[0]=u/10,!0){case g>=s.length:s=bo(new Uint8Array([u%10]),s);break;default:s[o-g]=u%10}}return t[0]>0&&(s=bo(t,s)),s}function xl(n){if(n>=ei.length)for(let e=ei.length;e<=n;e++){const t=new Uint8Array([0]);let i=ei[e-1].slice(0);for(let r=i.length-1;r>=0;r--){const s=new Uint8Array([(i[r]<<1)+t[0]]);t[0]=s[0]/10,i[r]=s[0]%10}t[0]>0&&(i=bo(t,i)),ei.push(i)}return ei[n]}function Rg(n,e){let t=0;const i=new Uint8Array(n),r=new Uint8Array(e),s=i.slice(0),o=s.length-1,c=r.slice(0),l=c.length-1;let u,p=0;for(let g=l;g>=0;g--,p++)switch(u=s[o-p]-c[l-p]-t,!0){case u<0:t=1,s[o-p]=u+10;break;default:t=0,s[o-p]=u}if(t>0)for(let g=o-l+1;g>=0;g--,p++)if(u=s[o-p]-t,u<0)t=1,s[o-p]=u+10;else{t=0,s[o-p]=u;break}return s.slice()}class Qa extends mt(Te){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=Hd.call(this)))}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(xg(e))}get valueDec(){return this._valueDec}fromDER(e,t,i,r=0){const s=this.fromBER(e,t,i);if(s===-1)return s;const o=this.valueHexView;return o[0]===0&&o[1]&128?this.valueHexView=o.subarray(1):r!==0&&o.length<r&&(r-o.length>1&&(r=o.length+1),this.valueHexView=o.subarray(r-o.length)),s}toDER(e=!1){const t=this.valueHexView;switch(!0){case(t[0]&128)!==0:{const i=new Uint8Array(this.valueHexView.length+1);i[0]=0,i.set(t,1),this.valueHexView=i}break;case(t[0]===0&&(t[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,t,i){const r=super.fromBER(e,t,i);return r===-1||this.setValueHex(),r}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=this.valueHexView.length*8-1;let t=new Uint8Array(this.valueHexView.length*8/3),i=0,r;const s=this.valueHexView;let o="",c=!1;for(let l=s.byteLength-1;l>=0;l--){r=s[l];for(let u=0;u<8;u++){if((r&1)===1)switch(i){case e:t=Rg(xl(i),t),o="-";break;default:t=Tg(t,xl(i))}i++,r>>=1}}for(let l=0;l<t.length;l++)t[l]&&(c=!0),c&&(o+=bl.charAt(t[l]));return c===!1&&(o+=bl.charAt(0)),o}}ap=Qa;Qa.NAME="IntegerValueBlock";Object.defineProperty(ap.prototype,"valueHex",{set:function(n){this.valueHexView=new Uint8Array(n),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var cp;class gt extends $e{constructor(e={}){super(e,Qa),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return yr(),BigInt(this.valueBlock.toString())}static fromBigInt(e){yr();const t=BigInt(e),i=new ss,r=t.toString(16).replace(/^-/,""),s=new Uint8Array(W.FromHex(r));if(t<0){const c=new Uint8Array(s.length+(s[0]&128?1:0));c[0]|=128;const u=BigInt(`0x${W.ToHex(c)}`)+t,p=U.toUint8Array(W.FromHex(u.toString(16)));p[0]|=128,i.write(p)}else s[0]&128&&i.write(new Uint8Array([0])),i.write(s);return new gt({valueHex:i.final()})}convertToDER(){const e=new gt({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new gt({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}cp=gt;D.Integer=cp;gt.NAME="INTEGER";var lp;class cs extends gt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}lp=cs;D.Enumerated=lp;cs.NAME="ENUMERATED";class ko extends mt(Te){constructor({valueDec:e=-1,isFirstSid:t=!1,...i}={}){super(i),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,i){if(!i)return t;const r=U.toUint8Array(e);if(!$t(this,r,t,i))return-1;const s=r.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let c=0;c<i&&(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=Cn(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){yr();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;const i=new Uint8Array(t.length/7);for(let r=0;r<i.length;r++)i[r]=parseInt(t.slice(r*7,r*7+7),2)+(r+1<i.length?128:0);this.fromBER(i.buffer,0,i.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const r=this.valueHexView,s=new Uint8Array(this.blockLength);for(let o=0;o<this.blockLength-1;o++)s[o]=r[o]|128;return s[this.blockLength-1]=r[this.blockLength-1],s.buffer}const t=sn(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",ct;const i=new Uint8Array(t.byteLength);if(!e){const r=new Uint8Array(t),s=t.byteLength-1;for(let o=0;o<s;o++)i[o]=r[o]|128;i[s]=r[s]}return i}toString(){let e="";if(this.isHexOnly)e=W.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}}}ko.NAME="sidBlock";class up extends Te{constructor({value:e=Le,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let r=t;for(;i>0;){const s=new ko;if(r=s.fromBER(e,r,i),r===-1)return this.blockLength=0,this.error=s.error,r;this.value.length===0&&(s.isFirstSid=!0),this.blockLength+=s.blockLength,i-=s.blockLength,this.value.push(s)}return r}toBER(e){const t=[];for(let i=0;i<this.value.length;i++){const r=this.value[i].toBER(e);if(r.byteLength===0)return this.error=this.value[i].error,ct;t.push(r)}return Za(t)}fromString(e){this.value=[];let t=0,i=0,r="",s=!1;do if(i=e.indexOf(".",t),i===-1?r=e.substring(t):r=e.substring(t,i),t=i+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 l=parseInt(r,10);if(isNaN(l))return;o.valueDec=l+c,s=!1}else{const o=new ko;if(r>Number.MAX_SAFE_INTEGER){yr();const c=BigInt(r);o.valueBigInt=c}else if(o.valueDec=parseInt(r,10),isNaN(o.valueDec))return;this.value.length||(o.isFirstSid=!0,s=!0),this.value.push(o)}while(i!==-1)}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let r=this.value[i].toString();i!==0&&(e=`${e}.`),t?(r=`{${r}}`,this.value[i].isFirstSid?e=`2.{${r} - 80}`:e+=r):e+=r}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}}up.NAME="ObjectIdentifierValueBlock";var dp;class ls extends $e{constructor(e={}){super(e,up),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()}}}dp=ls;D.ObjectIdentifier=dp;ls.NAME="OBJECT IDENTIFIER";class xo extends mt(mn){constructor({valueDec:e=0,...t}={}){super(t),this.valueDec=e}fromBER(e,t,i){if(i===0)return t;const r=U.toUint8Array(e);if(!$t(this,r,t,i))return-1;const s=r.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let c=0;c<i&&(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=Cn(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 r=this.valueHexView,s=new Uint8Array(this.blockLength);for(let o=0;o<this.blockLength-1;o++)s[o]=r[o]|128;return s[this.blockLength-1]=r[this.blockLength-1],s.buffer}const t=sn(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",ct;const i=new Uint8Array(t.byteLength);if(!e){const r=new Uint8Array(t),s=t.byteLength-1;for(let o=0;o<s;o++)i[o]=r[o]|128;i[s]=r[s]}return i.buffer}toString(){let e="";return this.isHexOnly?e=W.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}xo.NAME="relativeSidBlock";class pp extends Te{constructor({value:e=Le,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let r=t;for(;i>0;){const s=new xo;if(r=s.fromBER(e,r,i),r===-1)return this.blockLength=0,this.error=s.error,r;this.blockLength+=s.blockLength,i-=s.blockLength,this.value.push(s)}return r}toBER(e,t){const i=[];for(let r=0;r<this.value.length;r++){const s=this.value[r].toBER(e);if(s.byteLength===0)return this.error=this.value[r].error,ct;i.push(s)}return Za(i)}fromString(e){this.value=[];let t=0,i=0,r="";do{i=e.indexOf(".",t),i===-1?r=e.substring(t):r=e.substring(t,i),t=i+1;const s=new xo;if(s.valueDec=parseInt(r,10),isNaN(s.valueDec))return!0;this.value.push(s)}while(i!==-1);return!0}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let r=this.value[i].toString();i!==0&&(e=`${e}.`),t&&(r=`{${r}}`),e+=r}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}}pp.NAME="RelativeObjectIdentifierValueBlock";var fp;class ec extends $e{constructor(e={}){super(e,pp),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()}}}fp=ec;D.RelativeObjectIdentifier=fp;ec.NAME="RelativeObjectIdentifier";var hp;class bt extends Ue{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}hp=bt;D.Sequence=hp;bt.NAME="SEQUENCE";var gp;let kt=class extends Ue{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};gp=kt;D.Set=gp;kt.NAME="SET";class _p extends mt(Te){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=Le}toJSON(){return{...super.toJSON(),value:this.value}}}_p.NAME="StringValueBlock";class mp extends _p{}mp.NAME="SimpleStringValueBlock";class We extends Ya{constructor({...e}={}){super(e,mp)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,U.toUint8Array(e))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(t);for(let r=0;r<t;r++)i[r]=e.charCodeAt(r);this.valueBlock.value=e}}We.NAME="SIMPLE STRING";class yp extends We{fromBuffer(e){this.valueBlock.valueHexView=U.toUint8Array(e);try{this.valueBlock.value=W.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=W.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(W.FromUtf8String(e)),this.valueBlock.value=e}}yp.NAME="Utf8StringValueBlock";var vp;class Ct extends yp{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}vp=Ct;D.Utf8String=vp;Ct.NAME="UTF8String";class wp extends We{fromBuffer(e){this.valueBlock.value=W.ToUtf16String(e),this.valueBlock.valueHexView=U.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(W.FromUtf16String(e))}}wp.NAME="BmpStringValueBlock";var bp;class us extends wp{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}bp=us;D.BmpString=bp;us.NAME="BMPString";class kp extends We{fromBuffer(e){const t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),i=new Uint8Array(t);for(let r=0;r<i.length;r+=4)i[r]=i[r+3],i[r+1]=i[r+2],i[r+2]=0,i[r+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(t*4);for(let r=0;r<t;r++){const s=sn(e.charCodeAt(r),8),o=new Uint8Array(s);if(o.length>4)continue;const c=4-o.length;for(let l=o.length-1;l>=0;l--)i[r*4+l+c]=o[l]}this.valueBlock.value=e}}kp.NAME="UniversalStringValueBlock";var xp;class ds extends kp{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}xp=ds;D.UniversalString=xp;ds.NAME="UniversalString";var Sp;class ps extends We{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}Sp=ps;D.NumericString=Sp;ps.NAME="NumericString";var Ap;class fs extends We{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}Ap=fs;D.PrintableString=Ap;fs.NAME="PrintableString";var Ip;class hs extends We{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}Ip=hs;D.TeletexString=Ip;hs.NAME="TeletexString";var Ep;class gs extends We{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}Ep=gs;D.VideotexString=Ep;gs.NAME="VideotexString";var $p;class _s extends We{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}$p=_s;D.IA5String=$p;_s.NAME="IA5String";var Cp;class ms extends We{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}Cp=ms;D.GraphicString=Cp;ms.NAME="GraphicString";var jp;class Ei extends We{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}jp=Ei;D.VisibleString=jp;Ei.NAME="VisibleString";var zp;class ys extends We{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}zp=ys;D.GeneralString=zp;ys.NAME="GeneralString";var Np;class vs extends We{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}Np=vs;D.CharacterString=Np;vs.NAME="CharacterString";var Op;class $i extends Ei{constructor({value:e,valueDate:t,...i}={}){if(super(i),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let r=0;r<e.length;r++)this.valueBlock.valueHexView[r]=e.charCodeAt(r)}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,U.toUint8Array(e)))}toBuffer(){const e=this.toString(),t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let r=0;r<e.length;r++)i[r]=e.charCodeAt(r);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){const i=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(i===null){this.error="Wrong input string for conversion";return}const r=parseInt(i[1],10);r>=50?this.year=1900+r:this.year=2e3+r,this.month=parseInt(i[2],10),this.day=parseInt(i[3],10),this.hour=parseInt(i[4],10),this.minute=parseInt(i[5],10),this.second=parseInt(i[6],10)}toString(e="iso"){if(e==="iso"){const t=new Array(7);return t[0]=Fe(this.year<2e3?this.year-1900:this.year-2e3,2),t[1]=Fe(this.month,2),t[2]=Fe(this.day,2),t[3]=Fe(this.hour,2),t[4]=Fe(this.minute,2),t[5]=Fe(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}}}Op=$i;D.UTCTime=Op;$i.NAME="UTCTime";var Bp;class ws extends $i{constructor(e={}){var t;super(e),(t=this.millisecond)!==null&&t!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(e){let t=!1,i="",r="",s=0,o,c=0,l=0;if(e[e.length-1]==="Z")i=e.substring(0,e.length-1),t=!0;else{const g=new Number(e[e.length-1]);if(isNaN(g.valueOf()))throw new Error("Wrong input string for conversion");i=e}if(t){if(i.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(i.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let g=1,m=i.indexOf("+"),x="";if(m===-1&&(m=i.indexOf("-"),g=-1),m!==-1){if(x=i.substring(m+1),i=i.substring(0,m),x.length!==2&&x.length!==4)throw new Error("Wrong input string for conversion");let h=parseInt(x.substring(0,2),10);if(isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");if(c=g*h,x.length===4){if(h=parseInt(x.substring(2,4),10),isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");l=g*h}}}let u=i.indexOf(".");if(u===-1&&(u=i.indexOf(",")),u!==-1){const g=new Number(`0${i.substring(u)}`);if(isNaN(g.valueOf()))throw new Error("Wrong input string for conversion");s=g.valueOf(),r=i.substring(0,u)}else r=i;switch(!0){case r.length===8:if(o=/(\d{4})(\d{2})(\d{2})/ig,u!==-1)throw new Error("Wrong input string for conversion");break;case r.length===10:if(o=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,u!==-1){let g=60*s;this.minute=Math.floor(g),g=60*(g-this.minute),this.second=Math.floor(g),g=1e3*(g-this.second),this.millisecond=Math.floor(g)}break;case r.length===12:if(o=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,u!==-1){let g=60*s;this.second=Math.floor(g),g=1e3*(g-this.second),this.millisecond=Math.floor(g)}break;case r.length===14:if(o=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,u!==-1){const g=1e3*s;this.millisecond=Math.floor(g)}break;default:throw new Error("Wrong input string for conversion")}const p=o.exec(r);if(p===null)throw new Error("Wrong input string for conversion");for(let g=1;g<p.length;g++)switch(g){case 1:this.year=parseInt(p[g],10);break;case 2:this.month=parseInt(p[g],10);break;case 3:this.day=parseInt(p[g],10);break;case 4:this.hour=parseInt(p[g],10)+c;break;case 5:this.minute=parseInt(p[g],10)+l;break;case 6:this.second=parseInt(p[g],10);break;default:throw new Error("Wrong input string for conversion")}if(t===!1){const g=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=g.getUTCFullYear(),this.month=g.getUTCMonth(),this.day=g.getUTCDay(),this.hour=g.getUTCHours(),this.minute=g.getUTCMinutes(),this.second=g.getUTCSeconds(),this.millisecond=g.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){const t=[];return t.push(Fe(this.year,4)),t.push(Fe(this.month,2)),t.push(Fe(this.day,2)),t.push(Fe(this.hour,2)),t.push(Fe(this.minute,2)),t.push(Fe(this.second,2)),this.millisecond!==0&&(t.push("."),t.push(Fe(this.millisecond,3))),t.push("Z"),t.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}Bp=ws;D.GeneralizedTime=Bp;ws.NAME="GeneralizedTime";var Tp;class tc extends Ct{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}Tp=tc;D.DATE=Tp;tc.NAME="DATE";var Rp;class nc extends Ct{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}Rp=nc;D.TimeOfDay=Rp;nc.NAME="TimeOfDay";var Pp;class ic extends Ct{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}Pp=ic;D.DateTime=Pp;ic.NAME="DateTime";var Lp;class rc extends Ct{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}Lp=rc;D.Duration=Lp;rc.NAME="Duration";var Up;class sc extends Ct{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}Up=sc;D.TIME=Up;sc.NAME="TIME";class an{constructor({name:e=Le,optional:t=!1}={}){this.name=e,this.optional=t}}class oc extends an{constructor({value:e=[],...t}={}){super(t),this.value=e}}class vr extends an{constructor({value:e=new an,local:t=!1,...i}={}){super(i),this.value=e,this.local=t}}class Pg{constructor({data:e=os}={}){this.dataView=U.toUint8Array(e)}get data(){return this.dataView.slice().buffer}set data(e){this.dataView=U.toUint8Array(e)}fromBER(e,t,i){const r=t+i;return this.dataView=U.toUint8Array(e).subarray(t,r),r}toBER(e){return this.dataView.slice().buffer}}function Zt(n,e,t){if(t instanceof oc){for(let s=0;s<t.value.length;s++)if(Zt(n,e,t.value[s]).verified)return{verified:!0,result:n};{const s={verified:!1,result:{error:"Wrong values for Choice type"}};return t.hasOwnProperty(io)&&(s.name=t.name),s}}if(t instanceof an)return t.hasOwnProperty(io)&&(n[t.name]=e),{verified:!0,result:n};if(!(n 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(!(Ig in t))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(jg in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(zg in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const i=t.idBlock.toBER(!1);if(i.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(t.idBlock.fromBER(i,0,i.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(t.idBlock.hasOwnProperty(Eg)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:n};if(t.idBlock.hasOwnProperty($g)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:n};if(t.idBlock.hasOwnProperty(Cg)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:n};if(!(Ag in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:n};if(t.idBlock.isHexOnly){if(!(kl 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:n};for(let c=0;c<s.length;c++)if(s[c]!==o[1])return{verified:!1,result:n}}if(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Le),t.name&&(n[t.name]=e)),t instanceof D.Constructed){let s=0,o={verified:!1,result:{error:"Unknown error"}},c=t.valueBlock.value.length;if(c>0&&t.valueBlock.value[0]instanceof vr&&(c=e.valueBlock.value.length),c===0)return{verified:!0,result:n};if(e.valueBlock.value.length===0&&t.valueBlock.value.length!==0){let l=!0;for(let u=0;u<t.valueBlock.value.length;u++)l=l&&(t.valueBlock.value[u].optional||!1);return l?{verified:!0,result:n}:(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Le),t.name&&delete n[t.name]),n.error="Inconsistent object length",{verified:!1,result:n})}for(let l=0;l<c;l++)if(l-s>=e.valueBlock.value.length){if(t.valueBlock.value[l].optional===!1){const u={verified:!1,result:n};return n.error="Inconsistent length between ASN.1 data and schema",t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Le),t.name&&(delete n[t.name],u.name=t.name)),u}}else if(t.valueBlock.value[0]instanceof vr){if(o=Zt(n,e.valueBlock.value[l],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,Le),t.name&&delete n[t.name]),o;if(io in t.valueBlock.value[0]&&t.valueBlock.value[0].name.length>0){let u={};Ng in t.valueBlock.value[0]&&t.valueBlock.value[0].local?u=e:u=n,typeof u[t.valueBlock.value[0].name]>"u"&&(u[t.valueBlock.value[0].name]=[]),u[t.valueBlock.value[0].name].push(e.valueBlock.value[l])}}else if(o=Zt(n,e.valueBlock.value[l-s],t.valueBlock.value[l]),o.verified===!1)if(t.valueBlock.value[l].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Le),t.name&&delete n[t.name]),o;if(o.verified===!1){const l={verified:!1,result:n};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Le),t.name&&(delete n[t.name],l.name=t.name)),l}return{verified:!0,result:n}}if(t.primitiveSchema&&kl in e.valueBlock){const s=Hn(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,Le),t.name&&(delete n[t.name],o.name=t.name)),o}return Zt(n,s.result,t.primitiveSchema)}return{verified:!0,result:n}}function Lg(n,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const t=Hn(U.toUint8Array(n));return t.offset===-1?{verified:!1,result:t.result}:Zt(t.result,t.result,e)}const Vp=Object.freeze(Object.defineProperty({__proto__:null,Any:an,BaseBlock:$e,BaseStringBlock:Ya,BitString:en,BmpString:us,Boolean:as,CharacterString:vs,Choice:oc,Constructed:Ue,DATE:tc,DateTime:ic,Duration:rc,EndOfContent:Xa,Enumerated:cs,GeneralString:ys,GeneralizedTime:ws,GraphicString:ms,HexBlock:mt,IA5String:_s,Integer:gt,Null:on,NumericString:ps,ObjectIdentifier:ls,OctetString:Qt,Primitive:Ii,PrintableString:fs,RawData:Pg,RelativeObjectIdentifier:ec,Repeated:vr,Sequence:bt,Set:kt,TIME:sc,TeletexString:hs,TimeOfDay:nc,UTCTime:$i,UniversalString:ds,Utf8String:Ct,ValueBlock:Te,VideotexString:gs,ViewWriter:ss,VisibleString:Ei,compareSchema:Zt,fromBER:In,verifySchema:Lg},Symbol.toStringTag,{value:"Module"}));var z;(function(n){n[n.Sequence=0]="Sequence",n[n.Set=1]="Set",n[n.Choice=2]="Choice"})(z||(z={}));var y;(function(n){n[n.Any=1]="Any",n[n.Boolean=2]="Boolean",n[n.OctetString=3]="OctetString",n[n.BitString=4]="BitString",n[n.Integer=5]="Integer",n[n.Enumerated=6]="Enumerated",n[n.ObjectIdentifier=7]="ObjectIdentifier",n[n.Utf8String=8]="Utf8String",n[n.BmpString=9]="BmpString",n[n.UniversalString=10]="UniversalString",n[n.NumericString=11]="NumericString",n[n.PrintableString=12]="PrintableString",n[n.TeletexString=13]="TeletexString",n[n.VideotexString=14]="VideotexString",n[n.IA5String=15]="IA5String",n[n.GraphicString=16]="GraphicString",n[n.VisibleString=17]="VisibleString",n[n.GeneralString=18]="GeneralString",n[n.CharacterString=19]="CharacterString",n[n.UTCTime=20]="UTCTime",n[n.GeneralizedTime=21]="GeneralizedTime",n[n.DATE=22]="DATE",n[n.TimeOfDay=23]="TimeOfDay",n[n.DateTime=24]="DateTime",n[n.Duration=25]="Duration",n[n.TIME=26]="TIME",n[n.Null=27]="Null"})(y||(y={}));class bs{constructor(e,t=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(U.isBufferSource(e))this.unusedBits=t,this.value=U.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof en))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 en({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new en({name:e})}toNumber(){let e="";const t=new Uint8Array(this.value);for(const i of t)e+=i.toString(2).padStart(8,"0");return e=e.split("").reverse().join(""),this.unusedBits&&(e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(e,2)}fromNumber(e){let t=e.toString(2);const i=t.length+7>>3;this.unusedBits=(i<<3)-t.length;const r=new Uint8Array(i);t=t.padStart(i<<3,"0").split("").reverse().join("");let s=0;for(;s<i;)r[s]=parseInt(t.slice(s<<3,(s<<3)+8),2),s++;this.value=r.buffer}}class re{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):U.isBufferSource(e)?this.buffer=U.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof Qt))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new Qt({valueHex:this.buffer})}toSchema(e){return new Qt({name:e})}}const Ug={fromASN:n=>n instanceof on?null:n.valueBeforeDecodeView,toASN:n=>{if(n===null)return new on;const e=In(n);if(e.result.error)throw new Error(e.result.error);return e.result}},Vg={fromASN:n=>n.valueBlock.valueHexView.byteLength>=4?n.valueBlock.toString():n.valueBlock.valueDec,toASN:n=>new gt({value:+n})},Mg={fromASN:n=>n.valueBlock.valueDec,toASN:n=>new cs({value:n})},he={fromASN:n=>n.valueBlock.valueHexView,toASN:n=>new gt({valueHex:n})},Hg={fromASN:n=>n.valueBlock.valueHexView,toASN:n=>new en({valueHex:n})},Dg={fromASN:n=>n.valueBlock.toString(),toASN:n=>new ls({value:n})},Fg={fromASN:n=>n.valueBlock.value,toASN:n=>new as({value:n})},wr={fromASN:n=>n.valueBlock.valueHexView,toASN:n=>new Qt({valueHex:n})},qg={fromASN:n=>new re(n.getValue()),toASN:n=>n.toASN()};function Qe(n){return{fromASN:e=>e.valueBlock.value,toASN:e=>new n({value:e})}}const Mp=Qe(Ct),Kg=Qe(us),Wg=Qe(ds),Gg=Qe(ps),Jg=Qe(fs),Zg=Qe(hs),Yg=Qe(gs),Xg=Qe(_s),Qg=Qe(ms),e_=Qe(Ei),t_=Qe(ys),n_=Qe(vs),i_={fromASN:n=>n.toDate(),toASN:n=>new $i({valueDate:n})},r_={fromASN:n=>n.toDate(),toASN:n=>new ws({valueDate:n})},s_={fromASN:()=>null,toASN:()=>new on};function ac(n){switch(n){case y.Any:return Ug;case y.BitString:return Hg;case y.BmpString:return Kg;case y.Boolean:return Fg;case y.CharacterString:return n_;case y.Enumerated:return Mg;case y.GeneralString:return t_;case y.GeneralizedTime:return r_;case y.GraphicString:return Qg;case y.IA5String:return Xg;case y.Integer:return Vg;case y.Null:return s_;case y.NumericString:return Gg;case y.ObjectIdentifier:return Dg;case y.OctetString:return wr;case y.PrintableString:return Jg;case y.TeletexString:return Zg;case y.UTCTime:return i_;case y.UniversalString:return Wg;case y.Utf8String:return Mp;case y.VideotexString:return Yg;case y.VisibleString:return e_;default:return null}}function wt(n){return typeof n=="function"&&n.prototype?n.prototype.toASN&&n.prototype.fromASN?!0:wt(n.prototype):!!(n&&typeof n=="object"&&"toASN"in n&&"fromASN"in n)}function Hp(n){var e;if(n){const t=Object.getPrototypeOf(n);return((e=t==null?void 0:t.prototype)===null||e===void 0?void 0:e.constructor)===Array?!0:Hp(t)}return!1}function o_(n,e){if(!(n&&e)||n.byteLength!==e.byteLength)return!1;const t=new Uint8Array(n),i=new Uint8Array(e);for(let r=0;r<n.byteLength;r++)if(t[r]!==i[r])return!1;return!0}class a_{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e,t=!1){const i=this.items.get(e);if(!i)throw new Error(`Cannot get schema for '${e.prototype.constructor.name}' target`);if(t&&!i.schema)throw new Error(`Schema '${e.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return i}cache(e){const t=this.get(e);t.schema||(t.schema=this.create(e,!0))}createDefault(e){const t={type:z.Sequence,items:{}},i=this.findParentSchema(e);return i&&(Object.assign(t,i),t.items=Object.assign({},t.items,i.items)),t}create(e,t){const i=this.items.get(e)||this.createDefault(e),r=[];for(const s in i.items){const o=i.items[s],c=t?s:"";let l;if(typeof o.type=="number"){const p=y[o.type],g=Vp[p];if(!g)throw new Error(`Cannot get ASN1 class by name '${p}'`);l=new g({name:c})}else wt(o.type)?l=new o.type().toSchema(c):o.optional?this.get(o.type).type===z.Choice?l=new an({name:c}):(l=this.create(o.type,!1),l.name=c):l=new an({name:c});const u=!!o.optional||o.defaultValue!==void 0;if(o.repeated){l.name="";const p=o.repeated==="set"?kt:bt;l=new p({name:"",value:[new vr({name:c,value:l})]})}if(o.context!==null&&o.context!==void 0)if(o.implicit)if(typeof o.type=="number"||wt(o.type)){const p=o.repeated?Ue:Ii;r.push(new p({name:c,optional:u,idBlock:{tagClass:3,tagNumber:o.context}}))}else{this.cache(o.type);const p=!!o.repeated;let g=p?l:this.get(o.type,!0).schema;g="valueBlock"in g?g.valueBlock.value:g.value,r.push(new Ue({name:p?"":c,optional:u,idBlock:{tagClass:3,tagNumber:o.context},value:g}))}else r.push(new Ue({optional:u,idBlock:{tagClass:3,tagNumber:o.context},value:[l]}));else l.optional=u,r.push(l)}switch(i.type){case z.Sequence:return new bt({value:r,name:""});case z.Set:return new kt({value:r,name:""});case z.Choice:return new oc({value:r,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 Je=new a_,B=n=>e=>{let t;Je.has(e)?t=Je.get(e):(t=Je.createDefault(e),Je.set(e,t)),Object.assign(t,n)},f=n=>(e,t)=>{let i;Je.has(e.constructor)?i=Je.get(e.constructor):(i=Je.createDefault(e.constructor),Je.set(e.constructor,i));const r=Object.assign({},n);if(typeof r.type=="number"&&!r.converter){const s=ac(n.type);if(!s)throw new Error(`Cannot get default converter for property '${t}' of ${e.constructor.name}`);r.converter=s}i.items[t]=r};class Sl extends Error{constructor(){super(...arguments),this.schemas=[]}}class c_{static parse(e,t){const i=In(e);if(i.result.error)throw new Error(i.result.error);return this.fromASN(i.result,t)}static fromASN(e,t){var i;try{if(wt(t))return new t().fromASN(e);const r=Je.get(t);Je.cache(t);let s=r.schema;if(e.constructor===Ue&&r.type!==z.Choice){s=new Ue({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:r.schema.valueBlock.value});for(const l in r.items)delete e[l]}const o=Zt({},e,s);if(!o.verified)throw new Sl(`Data does not match to ${t.name} ASN1 schema. ${o.result.error}`);const c=new t;if(Hp(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 l=r.itemType;if(typeof l=="number"){const u=ac(l);if(!u)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);return t.from(e.valueBlock.value,p=>u.fromASN(p))}else return t.from(e.valueBlock.value,u=>this.fromASN(u,l))}for(const l in r.items){const u=o.result[l];if(!u)continue;const p=r.items[l],g=p.type;if(typeof g=="number"||wt(g)){const m=(i=p.converter)!==null&&i!==void 0?i:wt(g)?new g:null;if(!m)throw new Error("Converter is empty");if(p.repeated)if(p.implicit){const x=p.repeated==="sequence"?bt:kt,h=new x;h.valueBlock=u.valueBlock;const _=In(h.toBER(!1));if(_.offset===-1)throw new Error(`Cannot parse the child item. ${_.result.error}`);if(!("value"in _.result.valueBlock&&Array.isArray(_.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const b=_.result.valueBlock.value;c[l]=Array.from(b,S=>m.fromASN(S))}else c[l]=Array.from(u,x=>m.fromASN(x));else{let x=u;if(p.implicit){let h;if(wt(g))h=new g().toSchema("");else{const _=y[g],b=Vp[_];if(!b)throw new Error(`Cannot get '${_}' class from asn1js module`);h=new b}h.valueBlock=x.valueBlock,x=In(h.toBER(!1)).result}c[l]=m.fromASN(x)}}else if(p.repeated){if(!Array.isArray(u))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");c[l]=Array.from(u,m=>this.fromASN(m,g))}else c[l]=this.fromASN(u,g)}return c}catch(r){throw r instanceof Sl&&r.schemas.push(t.name),r}}}class cc{static serialize(e){return e instanceof $e?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&wt(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const t=e.constructor,i=Je.get(t);Je.cache(t);let r=[];if(i.itemType){if(!Array.isArray(e))throw new TypeError("Parameter 1 should be type of Array.");if(typeof i.itemType=="number"){const o=ac(i.itemType);if(!o)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);r=e.map(c=>o.toASN(c))}else r=e.map(o=>this.toAsnItem({type:i.itemType},"[]",t,o))}else for(const o in i.items){const c=i.items[o],l=e[o];if(l===void 0||c.defaultValue===l||typeof c.defaultValue=="object"&&typeof l=="object"&&o_(this.serialize(c.defaultValue),this.serialize(l)))continue;const u=cc.toAsnItem(c,o,t,l);if(typeof c.context=="number")if(c.implicit)if(!c.repeated&&(typeof c.type=="number"||wt(c.type))){const p={};p.valueHex=u instanceof on?u.valueBeforeDecodeView:u.valueBlock.toBER(),r.push(new Ii({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},...p}))}else r.push(new Ue({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:u.valueBlock.value}));else r.push(new Ue({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:[u]}));else c.repeated?r=r.concat(u):r.push(u)}let s;switch(i.type){case z.Sequence:s=new bt({value:r});break;case z.Set:s=new kt({value:r});break;case z.Choice:if(!r[0])throw new Error(`Schema '${t.name}' has wrong data. Choice cannot be empty.`);s=r[0];break}return s}static toAsnItem(e,t,i,r){let s;if(typeof e.type=="number"){const o=e.converter;if(!o)throw new Error(`Property '${t}' doesn't have converter for type ${y[e.type]} in schema '${i.name}'`);if(e.repeated){if(!Array.isArray(r))throw new TypeError("Parameter 'objProp' should be type of Array.");const c=Array.from(r,u=>o.toASN(u)),l=e.repeated==="sequence"?bt:kt;s=new l({value:c})}else s=o.toASN(r)}else if(e.repeated){if(!Array.isArray(r))throw new TypeError("Parameter 'objProp' should be type of Array.");const o=Array.from(r,l=>this.toASN(l)),c=e.repeated==="sequence"?bt:kt;s=new c({value:o})}else s=this.toASN(r);return s}}class le extends Array{constructor(e=[]){if(typeof e=="number")super(e);else{super();for(const t of e)this.push(t)}}}class L{static serialize(e){return cc.serialize(e)}static parse(e,t){return c_.parse(e,t)}static toString(e){const t=U.isBufferSource(e)?U.toArrayBuffer(e):L.serialize(e),i=In(t);if(i.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${i.result.error}`);return i.result.toString()}}function d(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var c=n.length-1;c>=0;c--)(o=n[c])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s}var Dp={exports:{}};(function(n){(function(e){const t="(0?\\d+|0x[a-f0-9]+)",i={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},r=new RegExp("^0[0-7]+$","i"),s=new RegExp("^0x[a-f0-9]+$","i"),o="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",l={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 u(h,_){if(h.indexOf("::")!==h.lastIndexOf("::"))return null;let b=0,S=-1,N=(h.match(l.zoneIndex)||[])[0],T,K;for(N&&(N=N.substring(1),h=h.replace(/%.+$/,""));(S=h.indexOf(":",S+1))>=0;)b++;if(h.substr(0,2)==="::"&&b--,h.substr(-2,2)==="::"&&b--,b>_)return null;for(K=_-b,T=":";K--;)T+="0:";return h=h.replace("::",T),h[0]===":"&&(h=h.slice(1)),h[h.length-1]===":"&&(h=h.slice(0,-1)),_=function(){const oe=h.split(":"),pe=[];for(let ce=0;ce<oe.length;ce++)pe.push(parseInt(oe[ce],16));return pe}(),{parts:_,zoneId:N}}function p(h,_,b,S){if(h.length!==_.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let N=0,T;for(;S>0;){if(T=b-S,T<0&&(T=0),h[N]>>T!==_[N]>>T)return!1;S-=b,N+=1}return!0}function g(h){if(s.test(h))return parseInt(h,16);if(h[0]==="0"&&!isNaN(parseInt(h[1],10))){if(r.test(h))return parseInt(h,8);throw new Error(`ipaddr: cannot parse ${h} as octal`)}return parseInt(h,10)}function m(h,_){for(;h.length<_;)h=`0${h}`;return h}const x={};x.IPv4=function(){function h(_){if(_.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let b,S;for(b=0;b<_.length;b++)if(S=_[b],!(0<=S&&S<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=_}return h.prototype.SpecialRanges={unspecified:[[new h([0,0,0,0]),8]],broadcast:[[new h([255,255,255,255]),32]],multicast:[[new h([224,0,0,0]),4]],linkLocal:[[new h([169,254,0,0]),16]],loopback:[[new h([127,0,0,0]),8]],carrierGradeNat:[[new h([100,64,0,0]),10]],private:[[new h([10,0,0,0]),8],[new h([172,16,0,0]),12],[new h([192,168,0,0]),16]],reserved:[[new h([192,0,0,0]),24],[new h([192,0,2,0]),24],[new h([192,88,99,0]),24],[new h([198,18,0,0]),15],[new h([198,51,100,0]),24],[new h([203,0,113,0]),24],[new h([240,0,0,0]),4]],as112:[[new h([192,175,48,0]),24],[new h([192,31,196,0]),24]],amt:[[new h([192,52,193,0]),24]]},h.prototype.kind=function(){return"ipv4"},h.prototype.match=function(_,b){let S;if(b===void 0&&(S=_,_=S[0],b=S[1]),_.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return p(this.octets,_.octets,8,b)},h.prototype.prefixLengthFromSubnetMask=function(){let _=0,b=!1;const S={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let N,T,K;for(N=3;N>=0;N-=1)if(T=this.octets[N],T in S){if(K=S[T],b&&K!==0)return null;K!==8&&(b=!0),_+=K}else return null;return 32-_},h.prototype.range=function(){return x.subnetMatch(this,this.SpecialRanges)},h.prototype.toByteArray=function(){return this.octets.slice(0)},h.prototype.toIPv4MappedAddress=function(){return x.IPv6.parse(`::ffff:${this.toString()}`)},h.prototype.toNormalizedString=function(){return this.toString()},h.prototype.toString=function(){return this.octets.join(".")},h}(),x.IPv4.broadcastAddressFromCIDR=function(h){try{const _=this.parseCIDR(h),b=_[0].toByteArray(),S=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),N=[];let T=0;for(;T<4;)N.push(parseInt(b[T],10)|parseInt(S[T],10)^255),T++;return new this(N)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},x.IPv4.isIPv4=function(h){return this.parser(h)!==null},x.IPv4.isValid=function(h){try{return new this(this.parser(h)),!0}catch{return!1}},x.IPv4.isValidCIDR=function(h){try{return this.parseCIDR(h),!0}catch{return!1}},x.IPv4.isValidFourPartDecimal=function(h){return!!(x.IPv4.isValid(h)&&h.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},x.IPv4.networkAddressFromCIDR=function(h){let _,b,S,N,T;try{for(_=this.parseCIDR(h),S=_[0].toByteArray(),T=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),N=[],b=0;b<4;)N.push(parseInt(S[b],10)&parseInt(T[b],10)),b++;return new this(N)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},x.IPv4.parse=function(h){const _=this.parser(h);if(_===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(_)},x.IPv4.parseCIDR=function(h){let _;if(_=h.match(/^(.+)\/(\d+)$/)){const b=parseInt(_[2]);if(b>=0&&b<=32){const S=[this.parse(_[1]),b];return Object.defineProperty(S,"toString",{value:function(){return this.join("/")}}),S}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},x.IPv4.parser=function(h){let _,b,S;if(_=h.match(i.fourOctet))return function(){const N=_.slice(1,6),T=[];for(let K=0;K<N.length;K++)b=N[K],T.push(g(b));return T}();if(_=h.match(i.longValue)){if(S=g(_[1]),S>4294967295||S<0)throw new Error("ipaddr: address outside defined range");return function(){const N=[];let T;for(T=0;T<=24;T+=8)N.push(S>>T&255);return N}().reverse()}else return(_=h.match(i.twoOctet))?function(){const N=_.slice(1,4),T=[];if(S=g(N[1]),S>16777215||S<0)throw new Error("ipaddr: address outside defined range");return T.push(g(N[0])),T.push(S>>16&255),T.push(S>>8&255),T.push(S&255),T}():(_=h.match(i.threeOctet))?function(){const N=_.slice(1,5),T=[];if(S=g(N[2]),S>65535||S<0)throw new Error("ipaddr: address outside defined range");return T.push(g(N[0])),T.push(g(N[1])),T.push(S>>8&255),T.push(S&255),T}():null},x.IPv4.subnetMaskFromPrefixLength=function(h){if(h=parseInt(h),h<0||h>32)throw new Error("ipaddr: invalid IPv4 prefix length");const _=[0,0,0,0];let b=0;const S=Math.floor(h/8);for(;b<S;)_[b]=255,b++;return S<4&&(_[S]=Math.pow(2,h%8)-1<<8-h%8),new this(_)},x.IPv6=function(){function h(_,b){let S,N;if(_.length===16)for(this.parts=[],S=0;S<=14;S+=2)this.parts.push(_[S]<<8|_[S+1]);else if(_.length===8)this.parts=_;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(S=0;S<this.parts.length;S++)if(N=this.parts[S],!(0<=N&&N<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");b&&(this.zoneId=b)}return h.prototype.SpecialRanges={unspecified:[new h([0,0,0,0,0,0,0,0]),128],linkLocal:[new h([65152,0,0,0,0,0,0,0]),10],multicast:[new h([65280,0,0,0,0,0,0,0]),8],loopback:[new h([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new h([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new h([0,0,0,0,0,65535,0,0]),96],discard:[new h([256,0,0,0,0,0,0,0]),64],rfc6145:[new h([0,0,0,0,65535,0,0,0]),96],rfc6052:[new h([100,65435,0,0,0,0,0,0]),96],"6to4":[new h([8194,0,0,0,0,0,0,0]),16],teredo:[new h([8193,0,0,0,0,0,0,0]),32],benchmarking:[new h([8193,2,0,0,0,0,0,0]),48],amt:[new h([8193,3,0,0,0,0,0,0]),32],as112v6:[[new h([8193,4,274,0,0,0,0,0]),48],[new h([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new h([8193,16,0,0,0,0,0,0]),28],orchid2:[new h([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new h([8193,48,0,0,0,0,0,0]),28],reserved:[[new h([8193,0,0,0,0,0,0,0]),23],[new h([8193,3512,0,0,0,0,0,0]),32]]},h.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},h.prototype.kind=function(){return"ipv6"},h.prototype.match=function(_,b){let S;if(b===void 0&&(S=_,_=S[0],b=S[1]),_.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return p(this.parts,_.parts,16,b)},h.prototype.prefixLengthFromSubnetMask=function(){let _=0,b=!1;const S={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 N,T;for(let K=7;K>=0;K-=1)if(N=this.parts[K],N in S){if(T=S[N],b&&T!==0)return null;T!==16&&(b=!0),_+=T}else return null;return 128-_},h.prototype.range=function(){return x.subnetMatch(this,this.SpecialRanges)},h.prototype.toByteArray=function(){let _;const b=[],S=this.parts;for(let N=0;N<S.length;N++)_=S[N],b.push(_>>8),b.push(_&255);return b},h.prototype.toFixedLengthString=function(){const _=(function(){const S=[];for(let N=0;N<this.parts.length;N++)S.push(m(this.parts[N].toString(16),4));return S}).call(this).join(":");let b="";return this.zoneId&&(b=`%${this.zoneId}`),_+b},h.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const _=this.parts.slice(-2),b=_[0],S=_[1];return new x.IPv4([b>>8,b&255,S>>8,S&255])},h.prototype.toNormalizedString=function(){const _=(function(){const S=[];for(let N=0;N<this.parts.length;N++)S.push(this.parts[N].toString(16));return S}).call(this).join(":");let b="";return this.zoneId&&(b=`%${this.zoneId}`),_+b},h.prototype.toRFC5952String=function(){const _=/((^|:)(0(:|$)){2,})/g,b=this.toNormalizedString();let S=0,N=-1,T;for(;T=_.exec(b);)T[0].length>N&&(S=T.index,N=T[0].length);return N<0?b:`${b.substring(0,S)}::${b.substring(S+N)}`},h.prototype.toString=function(){return this.toRFC5952String()},h}(),x.IPv6.broadcastAddressFromCIDR=function(h){try{const _=this.parseCIDR(h),b=_[0].toByteArray(),S=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),N=[];let T=0;for(;T<16;)N.push(parseInt(b[T],10)|parseInt(S[T],10)^255),T++;return new this(N)}catch(_){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${_})`)}},x.IPv6.isIPv6=function(h){return this.parser(h)!==null},x.IPv6.isValid=function(h){if(typeof h=="string"&&h.indexOf(":")===-1)return!1;try{const _=this.parser(h);return new this(_.parts,_.zoneId),!0}catch{return!1}},x.IPv6.isValidCIDR=function(h){if(typeof h=="string"&&h.indexOf(":")===-1)return!1;try{return this.parseCIDR(h),!0}catch{return!1}},x.IPv6.networkAddressFromCIDR=function(h){let _,b,S,N,T;try{for(_=this.parseCIDR(h),S=_[0].toByteArray(),T=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),N=[],b=0;b<16;)N.push(parseInt(S[b],10)&parseInt(T[b],10)),b++;return new this(N)}catch(K){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${K})`)}},x.IPv6.parse=function(h){const _=this.parser(h);if(_.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(_.parts,_.zoneId)},x.IPv6.parseCIDR=function(h){let _,b,S;if((b=h.match(/^(.+)\/(\d+)$/))&&(_=parseInt(b[2]),_>=0&&_<=128))return S=[this.parse(b[1]),_],Object.defineProperty(S,"toString",{value:function(){return this.join("/")}}),S;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},x.IPv6.parser=function(h){let _,b,S,N,T,K;if(S=h.match(l.deprecatedTransitional))return this.parser(`::ffff:${S[1]}`);if(l.native.test(h))return u(h,8);if((S=h.match(l.transitional))&&(K=S[6]||"",_=S[1],S[1].endsWith("::")||(_=_.slice(0,-1)),_=u(_+K,6),_.parts)){for(T=[parseInt(S[2]),parseInt(S[3]),parseInt(S[4]),parseInt(S[5])],b=0;b<T.length;b++)if(N=T[b],!(0<=N&&N<=255))return null;return _.parts.push(T[0]<<8|T[1]),_.parts.push(T[2]<<8|T[3]),{parts:_.parts,zoneId:_.zoneId}}return null},x.IPv6.subnetMaskFromPrefixLength=function(h){if(h=parseInt(h),h<0||h>128)throw new Error("ipaddr: invalid IPv6 prefix length");const _=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let b=0;const S=Math.floor(h/8);for(;b<S;)_[b]=255,b++;return S<16&&(_[S]=Math.pow(2,h%8)-1<<8-h%8),new this(_)},x.fromByteArray=function(h){const _=h.length;if(_===4)return new x.IPv4(h);if(_===16)return new x.IPv6(h);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},x.isValid=function(h){return x.IPv6.isValid(h)||x.IPv4.isValid(h)},x.isValidCIDR=function(h){return x.IPv6.isValidCIDR(h)||x.IPv4.isValidCIDR(h)},x.parse=function(h){if(x.IPv6.isValid(h))return x.IPv6.parse(h);if(x.IPv4.isValid(h))return x.IPv4.parse(h);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},x.parseCIDR=function(h){try{return x.IPv6.parseCIDR(h)}catch{try{return x.IPv4.parseCIDR(h)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},x.process=function(h){const _=this.parse(h);return _.kind()==="ipv6"&&_.isIPv4MappedAddress()?_.toIPv4Address():_},x.subnetMatch=function(h,_,b){let S,N,T,K;b==null&&(b="unicast");for(N in _)if(Object.prototype.hasOwnProperty.call(_,N)){for(T=_[N],T[0]&&!(T[0]instanceof Array)&&(T=[T]),S=0;S<T.length;S++)if(K=T[S],h.kind()===K[0].kind()&&h.match.apply(h,K))return N}return b},n.exports?n.exports=x:e.ipaddr=x})(mr)})(Dp);var Al=Dp.exports;class Il{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((r,s)=>r+ +s,0);let i=e.slice(0,8).replace(/(.{2})/g,r=>`${parseInt(r,16)}.`);return i=i.slice(0,-1),`${i}/${t}`}static toString(e){if(e.byteLength===4||e.byteLength===16){const t=new Uint8Array(e);return Al.fromByteArray(Array.from(t)).toString()}return this.decodeIP(W.ToHex(e))}static fromString(e){const t=Al.parse(e);return new Uint8Array(t.toByteArray()).buffer}}var So,Ao,Io;let Ce=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};d([f({type:y.TeletexString})],Ce.prototype,"teletexString",void 0);d([f({type:y.PrintableString})],Ce.prototype,"printableString",void 0);d([f({type:y.UniversalString})],Ce.prototype,"universalString",void 0);d([f({type:y.Utf8String})],Ce.prototype,"utf8String",void 0);d([f({type:y.BmpString})],Ce.prototype,"bmpString",void 0);Ce=d([B({type:z.Choice})],Ce);let jn=class extends Ce{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?W.ToHex(this.anyValue):super.toString())}};d([f({type:y.IA5String})],jn.prototype,"ia5String",void 0);d([f({type:y.Any})],jn.prototype,"anyValue",void 0);jn=d([B({type:z.Choice})],jn);class ks{constructor(e={}){this.type="",this.value=new jn,Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],ks.prototype,"type",void 0);d([f({type:jn})],ks.prototype,"value",void 0);let zn=So=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,So.prototype)}};zn=So=d([B({type:z.Set,itemType:ks})],zn);let Eo=Ao=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Ao.prototype)}};Eo=Ao=d([B({type:z.Sequence,itemType:zn})],Eo);let ve=Io=class extends Eo{constructor(e){super(e),Object.setPrototypeOf(this,Io.prototype)}};ve=Io=d([B({type:z.Sequence})],ve);const l_={fromASN:n=>Il.toString(wr.fromASN(n)),toASN:n=>wr.toASN(Il.fromString(n))};class fi{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],fi.prototype,"typeId",void 0);d([f({type:y.Any,context:0})],fi.prototype,"value",void 0);class lc{constructor(e={}){this.partyName=new Ce,Object.assign(this,e)}}d([f({type:Ce,optional:!0,context:0,implicit:!0})],lc.prototype,"nameAssigner",void 0);d([f({type:Ce,context:1,implicit:!0})],lc.prototype,"partyName",void 0);let Q=class{constructor(e={}){Object.assign(this,e)}};d([f({type:fi,context:0,implicit:!0})],Q.prototype,"otherName",void 0);d([f({type:y.IA5String,context:1,implicit:!0})],Q.prototype,"rfc822Name",void 0);d([f({type:y.IA5String,context:2,implicit:!0})],Q.prototype,"dNSName",void 0);d([f({type:y.Any,context:3,implicit:!0})],Q.prototype,"x400Address",void 0);d([f({type:ve,context:4,implicit:!1})],Q.prototype,"directoryName",void 0);d([f({type:lc,context:5})],Q.prototype,"ediPartyName",void 0);d([f({type:y.IA5String,context:6,implicit:!0})],Q.prototype,"uniformResourceIdentifier",void 0);d([f({type:y.OctetString,context:7,implicit:!0,converter:l_})],Q.prototype,"iPAddress",void 0);d([f({type:y.ObjectIdentifier,context:8,implicit:!0})],Q.prototype,"registeredID",void 0);Q=d([B({type:z.Choice})],Q);const uc="1.3.6.1.5.5.7",u_=`${uc}.1`,Dn=`${uc}.3`,xs=`${uc}.48`,El=`${xs}.1`,$l=`${xs}.2`,Cl=`${xs}.3`,jl=`${xs}.5`,Ht="2.5.29";var $o;const Co=`${u_}.1`;class Ci{constructor(e={}){this.accessMethod="",this.accessLocation=new Q,Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Ci.prototype,"accessMethod",void 0);d([f({type:Q})],Ci.prototype,"accessLocation",void 0);let Sn=$o=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,$o.prototype)}};Sn=$o=d([B({type:z.Sequence,itemType:Ci})],Sn);const jo=`${Ht}.35`;class dc extends re{}class Yt{constructor(e={}){e&&Object.assign(this,e)}}d([f({type:dc,context:0,optional:!0,implicit:!0})],Yt.prototype,"keyIdentifier",void 0);d([f({type:Q,context:1,optional:!0,implicit:!0,repeated:"sequence"})],Yt.prototype,"authorityCertIssuer",void 0);d([f({type:y.Integer,context:2,optional:!0,implicit:!0,converter:he})],Yt.prototype,"authorityCertSerialNumber",void 0);const Fp=`${Ht}.19`;class br{constructor(e={}){this.cA=!1,Object.assign(this,e)}}d([f({type:y.Boolean,defaultValue:!1})],br.prototype,"cA",void 0);d([f({type:y.Integer,optional:!0})],br.prototype,"pathLenConstraint",void 0);var zo;let Be=zo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,zo.prototype)}};Be=zo=d([B({type:z.Sequence,itemType:Q})],Be);var No;let zl=No=class extends Be{constructor(e){super(e),Object.setPrototypeOf(this,No.prototype)}};zl=No=d([B({type:z.Sequence})],zl);var Oo;const qp=`${Ht}.32`;let xt=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};d([f({type:y.IA5String})],xt.prototype,"ia5String",void 0);d([f({type:y.VisibleString})],xt.prototype,"visibleString",void 0);d([f({type:y.BmpString})],xt.prototype,"bmpString",void 0);d([f({type:y.Utf8String})],xt.prototype,"utf8String",void 0);xt=d([B({type:z.Choice})],xt);class pc{constructor(e={}){this.organization=new xt,this.noticeNumbers=[],Object.assign(this,e)}}d([f({type:xt})],pc.prototype,"organization",void 0);d([f({type:y.Integer,repeated:"sequence"})],pc.prototype,"noticeNumbers",void 0);class fc{constructor(e={}){Object.assign(this,e)}}d([f({type:pc,optional:!0})],fc.prototype,"noticeRef",void 0);d([f({type:xt,optional:!0})],fc.prototype,"explicitText",void 0);let kr=class{constructor(e={}){Object.assign(this,e)}};d([f({type:y.IA5String})],kr.prototype,"cPSuri",void 0);d([f({type:fc})],kr.prototype,"userNotice",void 0);kr=d([B({type:z.Choice})],kr);class hc{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],hc.prototype,"policyQualifierId",void 0);d([f({type:y.Any})],hc.prototype,"qualifier",void 0);class Ss{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Ss.prototype,"policyIdentifier",void 0);d([f({type:hc,repeated:"sequence",optional:!0})],Ss.prototype,"policyQualifiers",void 0);let xr=Oo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Oo.prototype)}};xr=Oo=d([B({type:z.Sequence,itemType:Ss})],xr);let Sr=class{constructor(e=0){this.value=e}};d([f({type:y.Integer})],Sr.prototype,"value",void 0);Sr=d([B({type:z.Choice})],Sr);let Nl=class extends Sr{};Nl=d([B({type:z.Choice})],Nl);var Bo;const To=`${Ht}.31`;var rt;(function(n){n[n.unused=1]="unused",n[n.keyCompromise=2]="keyCompromise",n[n.cACompromise=4]="cACompromise",n[n.affiliationChanged=8]="affiliationChanged",n[n.superseded=16]="superseded",n[n.cessationOfOperation=32]="cessationOfOperation",n[n.certificateHold=64]="certificateHold",n[n.privilegeWithdrawn=128]="privilegeWithdrawn",n[n.aACompromise=256]="aACompromise"})(rt||(rt={}));class Kp extends bs{toJSON(){const e=[],t=this.toNumber();return t&rt.aACompromise&&e.push("aACompromise"),t&rt.affiliationChanged&&e.push("affiliationChanged"),t&rt.cACompromise&&e.push("cACompromise"),t&rt.certificateHold&&e.push("certificateHold"),t&rt.cessationOfOperation&&e.push("cessationOfOperation"),t&rt.keyCompromise&&e.push("keyCompromise"),t&rt.privilegeWithdrawn&&e.push("privilegeWithdrawn"),t&rt.superseded&&e.push("superseded"),t&rt.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let cn=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Q,context:0,repeated:"sequence",implicit:!0})],cn.prototype,"fullName",void 0);d([f({type:zn,context:1,implicit:!0})],cn.prototype,"nameRelativeToCRLIssuer",void 0);cn=d([B({type:z.Choice})],cn);class Fn{constructor(e={}){Object.assign(this,e)}}d([f({type:cn,context:0,optional:!0})],Fn.prototype,"distributionPoint",void 0);d([f({type:Kp,context:1,optional:!0,implicit:!0})],Fn.prototype,"reasons",void 0);d([f({type:Q,context:2,optional:!0,repeated:"sequence",implicit:!0})],Fn.prototype,"cRLIssuer",void 0);let En=Bo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Bo.prototype)}};En=Bo=d([B({type:z.Sequence,itemType:Fn})],En);var Ro;let Ol=Ro=class extends En{constructor(e){super(e),Object.setPrototypeOf(this,Ro.prototype)}};Ol=Ro=d([B({type:z.Sequence,itemType:Fn})],Ol);class ze{constructor(e={}){this.onlyContainsUserCerts=ze.ONLY,this.onlyContainsCACerts=ze.ONLY,this.indirectCRL=ze.ONLY,this.onlyContainsAttributeCerts=ze.ONLY,Object.assign(this,e)}}ze.ONLY=!1;d([f({type:cn,context:0,optional:!0})],ze.prototype,"distributionPoint",void 0);d([f({type:y.Boolean,context:1,defaultValue:ze.ONLY,implicit:!0})],ze.prototype,"onlyContainsUserCerts",void 0);d([f({type:y.Boolean,context:2,defaultValue:ze.ONLY,implicit:!0})],ze.prototype,"onlyContainsCACerts",void 0);d([f({type:Kp,context:3,optional:!0,implicit:!0})],ze.prototype,"onlySomeReasons",void 0);d([f({type:y.Boolean,context:4,defaultValue:ze.ONLY,implicit:!0})],ze.prototype,"indirectCRL",void 0);d([f({type:y.Boolean,context:5,defaultValue:ze.ONLY,implicit:!0})],ze.prototype,"onlyContainsAttributeCerts",void 0);var si;(function(n){n[n.unspecified=0]="unspecified",n[n.keyCompromise=1]="keyCompromise",n[n.cACompromise=2]="cACompromise",n[n.affiliationChanged=3]="affiliationChanged",n[n.superseded=4]="superseded",n[n.cessationOfOperation=5]="cessationOfOperation",n[n.certificateHold=6]="certificateHold",n[n.removeFromCRL=8]="removeFromCRL",n[n.privilegeWithdrawn=9]="privilegeWithdrawn",n[n.aACompromise=10]="aACompromise"})(si||(si={}));let Po=class{constructor(e=si.unspecified){this.reason=si.unspecified,this.reason=e}toJSON(){return si[this.reason]}toString(){return this.toJSON()}};d([f({type:y.Enumerated})],Po.prototype,"reason",void 0);Po=d([B({type:z.Choice})],Po);var Lo;const Wp=`${Ht}.37`;let Ar=Lo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Lo.prototype)}};Ar=Lo=d([B({type:z.Sequence,itemType:y.ObjectIdentifier})],Ar);const d_=`${Dn}.1`,p_=`${Dn}.2`,f_=`${Dn}.3`,h_=`${Dn}.4`,g_=`${Dn}.8`,__=`${Dn}.9`;let Uo=class{constructor(e=new ArrayBuffer(0)){this.value=e}};d([f({type:y.Integer,converter:he})],Uo.prototype,"value",void 0);Uo=d([B({type:z.Choice})],Uo);let Vo=class{constructor(e){this.value=new Date,e&&(this.value=e)}};d([f({type:y.GeneralizedTime})],Vo.prototype,"value",void 0);Vo=d([B({type:z.Choice})],Vo);var Mo;let Bl=Mo=class extends Be{constructor(e){super(e),Object.setPrototypeOf(this,Mo.prototype)}};Bl=Mo=d([B({type:z.Sequence})],Bl);const Gp=`${Ht}.15`;var st;(function(n){n[n.digitalSignature=1]="digitalSignature",n[n.nonRepudiation=2]="nonRepudiation",n[n.keyEncipherment=4]="keyEncipherment",n[n.dataEncipherment=8]="dataEncipherment",n[n.keyAgreement=16]="keyAgreement",n[n.keyCertSign=32]="keyCertSign",n[n.cRLSign=64]="cRLSign",n[n.encipherOnly=128]="encipherOnly",n[n.decipherOnly=256]="decipherOnly"})(st||(st={}));class ro extends bs{toJSON(){const e=this.toNumber(),t=[];return e&st.cRLSign&&t.push("crlSign"),e&st.dataEncipherment&&t.push("dataEncipherment"),e&st.decipherOnly&&t.push("decipherOnly"),e&st.digitalSignature&&t.push("digitalSignature"),e&st.encipherOnly&&t.push("encipherOnly"),e&st.keyAgreement&&t.push("keyAgreement"),e&st.keyCertSign&&t.push("keyCertSign"),e&st.keyEncipherment&&t.push("keyEncipherment"),e&st.nonRepudiation&&t.push("nonRepudiation"),t}toString(){return`[${this.toJSON().join(", ")}]`}}var Ho;class As{constructor(e={}){this.base=new Q,this.minimum=0,Object.assign(this,e)}}d([f({type:Q})],As.prototype,"base",void 0);d([f({type:y.Integer,context:0,defaultValue:0,implicit:!0})],As.prototype,"minimum",void 0);d([f({type:y.Integer,context:1,optional:!0,implicit:!0})],As.prototype,"maximum",void 0);let Ir=Ho=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Ho.prototype)}};Ir=Ho=d([B({type:z.Sequence,itemType:As})],Ir);class Jp{constructor(e={}){Object.assign(this,e)}}d([f({type:Ir,context:0,optional:!0,implicit:!0})],Jp.prototype,"permittedSubtrees",void 0);d([f({type:Ir,context:1,optional:!0,implicit:!0})],Jp.prototype,"excludedSubtrees",void 0);class Zp{constructor(e={}){Object.assign(this,e)}}d([f({type:y.Integer,context:0,implicit:!0,optional:!0,converter:he})],Zp.prototype,"requireExplicitPolicy",void 0);d([f({type:y.Integer,context:1,implicit:!0,optional:!0,converter:he})],Zp.prototype,"inhibitPolicyMapping",void 0);var Do;class gc{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],gc.prototype,"issuerDomainPolicy",void 0);d([f({type:y.ObjectIdentifier})],gc.prototype,"subjectDomainPolicy",void 0);let Tl=Do=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Do.prototype)}};Tl=Do=d([B({type:z.Sequence,itemType:gc})],Tl);var Fo;const Yp=`${Ht}.17`;let qo=Fo=class extends Be{constructor(e){super(e),Object.setPrototypeOf(this,Fo.prototype)}};qo=Fo=d([B({type:z.Sequence})],qo);let St=class{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};d([f({type:y.ObjectIdentifier})],St.prototype,"type",void 0);d([f({type:y.Any,repeated:"set"})],St.prototype,"values",void 0);var Ko;let Rl=Ko=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Ko.prototype)}};Rl=Ko=d([B({type:z.Sequence,itemType:St})],Rl);const Xp=`${Ht}.14`;class Rt extends dc{}class Qp{constructor(e={}){Object.assign(this,e)}}d([f({type:y.GeneralizedTime,context:0,implicit:!0,optional:!0})],Qp.prototype,"notBefore",void 0);d([f({type:y.GeneralizedTime,context:1,implicit:!0,optional:!0})],Qp.prototype,"notAfter",void 0);var oi;(function(n){n[n.keyUpdateAllowed=1]="keyUpdateAllowed",n[n.newExtensions=2]="newExtensions",n[n.pKIXCertificate=4]="pKIXCertificate"})(oi||(oi={}));class ef extends bs{toJSON(){const e=[],t=this.toNumber();return t&oi.pKIXCertificate&&e.push("pKIXCertificate"),t&oi.newExtensions&&e.push("newExtensions"),t&oi.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class tf{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new ef,Object.assign(this,e)}}d([f({type:y.GeneralString})],tf.prototype,"entrustVers",void 0);d([f({type:ef})],tf.prototype,"entrustInfoFlags",void 0);var Wo;let Pl=Wo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Wo.prototype)}};Pl=Wo=d([B({type:z.Sequence,itemType:Ci})],Pl);class H{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof H&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&Md(e.parameters,this.parameters)||e.parameters===this.parameters)}}d([f({type:y.ObjectIdentifier})],H.prototype,"algorithm",void 0);d([f({type:y.Any,optional:!0})],H.prototype,"parameters",void 0);class ot{constructor(e={}){this.algorithm=new H,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:H})],ot.prototype,"algorithm",void 0);d([f({type:y.BitString})],ot.prototype,"subjectPublicKey",void 0);let Ee=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}};d([f({type:y.UTCTime})],Ee.prototype,"utcTime",void 0);d([f({type:y.GeneralizedTime})],Ee.prototype,"generalTime",void 0);Ee=d([B({type:z.Choice})],Ee);class ji{constructor(e){this.notBefore=new Ee(new Date),this.notAfter=new Ee(new Date),e&&(this.notBefore=new Ee(e.notBefore),this.notAfter=new Ee(e.notAfter))}}d([f({type:Ee})],ji.prototype,"notBefore",void 0);d([f({type:Ee})],ji.prototype,"notAfter",void 0);var Go;let Xe=class nf{constructor(e={}){this.extnID="",this.critical=nf.CRITICAL,this.extnValue=new re,Object.assign(this,e)}};Xe.CRITICAL=!1;d([f({type:y.ObjectIdentifier})],Xe.prototype,"extnID",void 0);d([f({type:y.Boolean,defaultValue:Xe.CRITICAL})],Xe.prototype,"critical",void 0);d([f({type:re})],Xe.prototype,"extnValue",void 0);let Lt=Go=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Go.prototype)}};Lt=Go=d([B({type:z.Sequence,itemType:Xe})],Lt);var ln;(function(n){n[n.v1=0]="v1",n[n.v2=1]="v2",n[n.v3=2]="v3"})(ln||(ln={}));class Ge{constructor(e={}){this.version=ln.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new H,this.issuer=new ve,this.validity=new ji,this.subject=new ve,this.subjectPublicKeyInfo=new ot,Object.assign(this,e)}}d([f({type:y.Integer,context:0,defaultValue:ln.v1})],Ge.prototype,"version",void 0);d([f({type:y.Integer,converter:he})],Ge.prototype,"serialNumber",void 0);d([f({type:H})],Ge.prototype,"signature",void 0);d([f({type:ve})],Ge.prototype,"issuer",void 0);d([f({type:ji})],Ge.prototype,"validity",void 0);d([f({type:ve})],Ge.prototype,"subject",void 0);d([f({type:ot})],Ge.prototype,"subjectPublicKeyInfo",void 0);d([f({type:y.BitString,context:1,implicit:!0,optional:!0})],Ge.prototype,"issuerUniqueID",void 0);d([f({type:y.BitString,context:2,implicit:!0,optional:!0})],Ge.prototype,"subjectUniqueID",void 0);d([f({type:Lt,context:3,optional:!0})],Ge.prototype,"extensions",void 0);class un{constructor(e={}){this.tbsCertificate=new Ge,this.signatureAlgorithm=new H,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:Ge})],un.prototype,"tbsCertificate",void 0);d([f({type:H})],un.prototype,"signatureAlgorithm",void 0);d([f({type:y.BitString})],un.prototype,"signatureValue",void 0);class Is{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new Ee,Object.assign(this,e)}}d([f({type:y.Integer,converter:he})],Is.prototype,"userCertificate",void 0);d([f({type:Ee})],Is.prototype,"revocationDate",void 0);d([f({type:Xe,optional:!0,repeated:"sequence"})],Is.prototype,"crlEntryExtensions",void 0);class jt{constructor(e={}){this.signature=new H,this.issuer=new ve,this.thisUpdate=new Ee,Object.assign(this,e)}}d([f({type:y.Integer,optional:!0})],jt.prototype,"version",void 0);d([f({type:H})],jt.prototype,"signature",void 0);d([f({type:ve})],jt.prototype,"issuer",void 0);d([f({type:Ee})],jt.prototype,"thisUpdate",void 0);d([f({type:Ee,optional:!0})],jt.prototype,"nextUpdate",void 0);d([f({type:Is,repeated:"sequence",optional:!0})],jt.prototype,"revokedCertificates",void 0);d([f({type:Xe,optional:!0,context:0,repeated:"sequence"})],jt.prototype,"crlExtensions",void 0);class _c{constructor(e={}){this.tbsCertList=new jt,this.signatureAlgorithm=new H,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:jt})],_c.prototype,"tbsCertList",void 0);d([f({type:H})],_c.prototype,"signatureAlgorithm",void 0);d([f({type:y.BitString})],_c.prototype,"signature",void 0);class qn{constructor(e={}){this.issuer=new ve,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:ve})],qn.prototype,"issuer",void 0);d([f({type:y.Integer,converter:he})],qn.prototype,"serialNumber",void 0);let Nn=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Rt,context:0,implicit:!0})],Nn.prototype,"subjectKeyIdentifier",void 0);d([f({type:qn})],Nn.prototype,"issuerAndSerialNumber",void 0);Nn=d([B({type:z.Choice})],Nn);var At;(function(n){n[n.v0=0]="v0",n[n.v1=1]="v1",n[n.v2=2]="v2",n[n.v3=3]="v3",n[n.v4=4]="v4",n[n.v5=5]="v5"})(At||(At={}));let hi=class extends H{};hi=d([B({type:z.Sequence})],hi);let Er=class extends H{};Er=d([B({type:z.Sequence})],Er);let _t=class extends H{};_t=d([B({type:z.Sequence})],_t);let $r=class extends H{};$r=d([B({type:z.Sequence})],$r);let Ll=class extends H{};Ll=d([B({type:z.Sequence})],Ll);let Jo=class extends H{};Jo=d([B({type:z.Sequence})],Jo);let Kn=class{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};d([f({type:y.ObjectIdentifier})],Kn.prototype,"attrType",void 0);d([f({type:y.Any,repeated:"set"})],Kn.prototype,"attrValues",void 0);var Zo;class yt{constructor(e={}){this.version=At.v0,this.sid=new Nn,this.digestAlgorithm=new hi,this.signatureAlgorithm=new Er,this.signature=new re,Object.assign(this,e)}}d([f({type:y.Integer})],yt.prototype,"version",void 0);d([f({type:Nn})],yt.prototype,"sid",void 0);d([f({type:hi})],yt.prototype,"digestAlgorithm",void 0);d([f({type:Kn,repeated:"set",context:0,implicit:!0,optional:!0})],yt.prototype,"signedAttrs",void 0);d([f({type:Er})],yt.prototype,"signatureAlgorithm",void 0);d([f({type:re})],yt.prototype,"signature",void 0);d([f({type:Kn,repeated:"set",context:1,implicit:!0,optional:!0})],yt.prototype,"unsignedAttrs",void 0);let Cr=Zo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Zo.prototype)}};Cr=Zo=d([B({type:z.Set,itemType:yt})],Cr);let Ul=class extends Ee{};Ul=d([B({type:z.Choice})],Ul);let Vl=class extends yt{};Vl=d([B({type:z.Sequence})],Vl);class mc{constructor(e={}){this.acIssuer=new Q,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}d([f({type:Q})],mc.prototype,"acIssuer",void 0);d([f({type:y.Integer})],mc.prototype,"acSerial",void 0);d([f({type:St,repeated:"sequence"})],mc.prototype,"attrs",void 0);var Yo;let jr=Yo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Yo.prototype)}};jr=Yo=d([B({type:z.Sequence,itemType:y.ObjectIdentifier})],jr);class Es{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}d([f({type:y.Integer,optional:!0})],Es.prototype,"pathLenConstraint",void 0);d([f({type:jr,implicit:!0,context:0,optional:!0})],Es.prototype,"permittedAttrs",void 0);d([f({type:jr,implicit:!0,context:1,optional:!0})],Es.prototype,"excludedAttrs",void 0);d([f({type:y.Boolean,defaultValue:!0})],Es.prototype,"permitUnSpecified",void 0);class yn{constructor(e={}){this.issuer=new Be,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:Be})],yn.prototype,"issuer",void 0);d([f({type:y.Integer,converter:he})],yn.prototype,"serial",void 0);d([f({type:y.BitString,optional:!0})],yn.prototype,"issuerUID",void 0);var Xo;(function(n){n[n.publicKey=0]="publicKey",n[n.publicKeyCert=1]="publicKeyCert",n[n.otherObjectTypes=2]="otherObjectTypes"})(Xo||(Xo={}));class vn{constructor(e={}){this.digestedObjectType=Xo.publicKey,this.digestAlgorithm=new H,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.Enumerated})],vn.prototype,"digestedObjectType",void 0);d([f({type:y.ObjectIdentifier,optional:!0})],vn.prototype,"otherObjectTypeID",void 0);d([f({type:H})],vn.prototype,"digestAlgorithm",void 0);d([f({type:y.BitString})],vn.prototype,"objectDigest",void 0);class $s{constructor(e={}){Object.assign(this,e)}}d([f({type:Be,optional:!0})],$s.prototype,"issuerName",void 0);d([f({type:yn,context:0,implicit:!0,optional:!0})],$s.prototype,"baseCertificateID",void 0);d([f({type:vn,context:1,implicit:!0,optional:!0})],$s.prototype,"objectDigestInfo",void 0);let On=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Q,repeated:"sequence"})],On.prototype,"v1Form",void 0);d([f({type:$s,context:0,implicit:!0})],On.prototype,"v2Form",void 0);On=d([B({type:z.Choice})],On);class Cs{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}d([f({type:y.GeneralizedTime})],Cs.prototype,"notBeforeTime",void 0);d([f({type:y.GeneralizedTime})],Cs.prototype,"notAfterTime",void 0);class zi{constructor(e={}){Object.assign(this,e)}}d([f({type:yn,implicit:!0,context:0,optional:!0})],zi.prototype,"baseCertificateID",void 0);d([f({type:Be,implicit:!0,context:1,optional:!0})],zi.prototype,"entityName",void 0);d([f({type:vn,implicit:!0,context:2,optional:!0})],zi.prototype,"objectDigestInfo",void 0);var Qo;(function(n){n[n.v2=1]="v2"})(Qo||(Qo={}));class lt{constructor(e={}){this.version=Qo.v2,this.holder=new zi,this.issuer=new On,this.signature=new H,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new Cs,this.attributes=[],Object.assign(this,e)}}d([f({type:y.Integer})],lt.prototype,"version",void 0);d([f({type:zi})],lt.prototype,"holder",void 0);d([f({type:On})],lt.prototype,"issuer",void 0);d([f({type:H})],lt.prototype,"signature",void 0);d([f({type:y.Integer,converter:he})],lt.prototype,"serialNumber",void 0);d([f({type:Cs})],lt.prototype,"attrCertValidityPeriod",void 0);d([f({type:St,repeated:"sequence"})],lt.prototype,"attributes",void 0);d([f({type:y.BitString,optional:!0})],lt.prototype,"issuerUniqueID",void 0);d([f({type:Lt,optional:!0})],lt.prototype,"extensions",void 0);class js{constructor(e={}){this.acinfo=new lt,this.signatureAlgorithm=new H,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:lt})],js.prototype,"acinfo",void 0);d([f({type:H})],js.prototype,"signatureAlgorithm",void 0);d([f({type:y.BitString})],js.prototype,"signatureValue",void 0);var zr;(function(n){n[n.unmarked=1]="unmarked",n[n.unclassified=2]="unclassified",n[n.restricted=4]="restricted",n[n.confidential=8]="confidential",n[n.secret=16]="secret",n[n.topSecret=32]="topSecret"})(zr||(zr={}));class ea extends bs{}class yc{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier,implicit:!0,context:0})],yc.prototype,"type",void 0);d([f({type:y.Any,implicit:!0,context:1})],yc.prototype,"value",void 0);class vc{constructor(e={}){this.policyId="",this.classList=new ea(zr.unclassified),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],vc.prototype,"policyId",void 0);d([f({type:ea,defaultValue:new ea(zr.unclassified)})],vc.prototype,"classList",void 0);d([f({type:yc,repeated:"set"})],vc.prototype,"securityCategories",void 0);class zs{constructor(e={}){Object.assign(this,e)}}d([f({type:re})],zs.prototype,"cotets",void 0);d([f({type:y.ObjectIdentifier})],zs.prototype,"oid",void 0);d([f({type:y.Utf8String})],zs.prototype,"string",void 0);class rf{constructor(e={}){this.values=[],Object.assign(this,e)}}d([f({type:Be,implicit:!0,context:0,optional:!0})],rf.prototype,"policyAuthority",void 0);d([f({type:zs,repeated:"sequence"})],rf.prototype,"values",void 0);var ta;class Ns{constructor(e={}){this.targetCertificate=new yn,Object.assign(this,e)}}d([f({type:yn})],Ns.prototype,"targetCertificate",void 0);d([f({type:Q,optional:!0})],Ns.prototype,"targetName",void 0);d([f({type:vn,optional:!0})],Ns.prototype,"certDigestInfo",void 0);let Bn=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Q,context:0,implicit:!0})],Bn.prototype,"targetName",void 0);d([f({type:Q,context:1,implicit:!0})],Bn.prototype,"targetGroup",void 0);d([f({type:Ns,context:2,implicit:!0})],Bn.prototype,"targetCert",void 0);Bn=d([B({type:z.Choice})],Bn);let na=ta=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ta.prototype)}};na=ta=d([B({type:z.Sequence,itemType:Bn})],na);var ia;let Ml=ia=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ia.prototype)}};Ml=ia=d([B({type:z.Sequence,itemType:na})],Ml);class sf{constructor(e={}){Object.assign(this,e)}}d([f({type:Be,implicit:!0,context:0,optional:!0})],sf.prototype,"roleAuthority",void 0);d([f({type:Q,implicit:!0,context:1})],sf.prototype,"roleName",void 0);class wc{constructor(e={}){this.service=new Q,this.ident=new Q,Object.assign(this,e)}}d([f({type:Q})],wc.prototype,"service",void 0);d([f({type:Q})],wc.prototype,"ident",void 0);d([f({type:re,optional:!0})],wc.prototype,"authInfo",void 0);var ra;class bc{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],bc.prototype,"otherCertFormat",void 0);d([f({type:y.Any})],bc.prototype,"otherCert",void 0);let Tn=class{constructor(e={}){Object.assign(this,e)}};d([f({type:un})],Tn.prototype,"certificate",void 0);d([f({type:js,context:2,implicit:!0})],Tn.prototype,"v2AttrCert",void 0);d([f({type:bc,context:3,implicit:!0})],Tn.prototype,"other",void 0);Tn=d([B({type:z.Choice})],Tn);let Nr=ra=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ra.prototype)}};Nr=ra=d([B({type:z.Set,itemType:Tn})],Nr);class Wn{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Wn.prototype,"contentType",void 0);d([f({type:y.Any,context:0})],Wn.prototype,"content",void 0);let gi=class{constructor(e={}){Object.assign(this,e)}};d([f({type:re})],gi.prototype,"single",void 0);d([f({type:y.Any})],gi.prototype,"any",void 0);gi=d([B({type:z.Choice})],gi);class Os{constructor(e={}){this.eContentType="",Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Os.prototype,"eContentType",void 0);d([f({type:gi,context:0,optional:!0})],Os.prototype,"eContent",void 0);let _i=class{constructor(e={}){Object.assign(this,e)}};d([f({type:re,context:0,implicit:!0,optional:!0})],_i.prototype,"value",void 0);d([f({type:re,converter:qg,context:0,implicit:!0,optional:!0,repeated:"sequence"})],_i.prototype,"constructedValue",void 0);_i=d([B({type:z.Choice})],_i);class Ni{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new $r,Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Ni.prototype,"contentType",void 0);d([f({type:$r})],Ni.prototype,"contentEncryptionAlgorithm",void 0);d([f({type:_i,optional:!0})],Ni.prototype,"encryptedContent",void 0);class Bs{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Bs.prototype,"keyAttrId",void 0);d([f({type:y.Any,optional:!0})],Bs.prototype,"keyAttr",void 0);var sa;class Ts{constructor(e={}){this.subjectKeyIdentifier=new Rt,Object.assign(this,e)}}d([f({type:Rt})],Ts.prototype,"subjectKeyIdentifier",void 0);d([f({type:y.GeneralizedTime,optional:!0})],Ts.prototype,"date",void 0);d([f({type:Bs,optional:!0})],Ts.prototype,"other",void 0);let Rn=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Ts,context:0,implicit:!0,optional:!0})],Rn.prototype,"rKeyId",void 0);d([f({type:qn,optional:!0})],Rn.prototype,"issuerAndSerialNumber",void 0);Rn=d([B({type:z.Choice})],Rn);class kc{constructor(e={}){this.rid=new Rn,this.encryptedKey=new re,Object.assign(this,e)}}d([f({type:Rn})],kc.prototype,"rid",void 0);d([f({type:re})],kc.prototype,"encryptedKey",void 0);let Or=sa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,sa.prototype)}};Or=sa=d([B({type:z.Sequence,itemType:kc})],Or);class xc{constructor(e={}){this.algorithm=new H,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:H})],xc.prototype,"algorithm",void 0);d([f({type:y.BitString})],xc.prototype,"publicKey",void 0);let dn=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Rt,context:0,implicit:!0,optional:!0})],dn.prototype,"subjectKeyIdentifier",void 0);d([f({type:xc,context:1,implicit:!0,optional:!0})],dn.prototype,"originatorKey",void 0);d([f({type:qn,optional:!0})],dn.prototype,"issuerAndSerialNumber",void 0);dn=d([B({type:z.Choice})],dn);class Gn{constructor(e={}){this.version=At.v3,this.originator=new dn,this.keyEncryptionAlgorithm=new _t,this.recipientEncryptedKeys=new Or,Object.assign(this,e)}}d([f({type:y.Integer})],Gn.prototype,"version",void 0);d([f({type:dn,context:0})],Gn.prototype,"originator",void 0);d([f({type:re,context:1,optional:!0})],Gn.prototype,"ukm",void 0);d([f({type:_t})],Gn.prototype,"keyEncryptionAlgorithm",void 0);d([f({type:Or})],Gn.prototype,"recipientEncryptedKeys",void 0);let Pn=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Rt,context:0,implicit:!0})],Pn.prototype,"subjectKeyIdentifier",void 0);d([f({type:qn})],Pn.prototype,"issuerAndSerialNumber",void 0);Pn=d([B({type:z.Choice})],Pn);class Oi{constructor(e={}){this.version=At.v0,this.rid=new Pn,this.keyEncryptionAlgorithm=new _t,this.encryptedKey=new re,Object.assign(this,e)}}d([f({type:y.Integer})],Oi.prototype,"version",void 0);d([f({type:Pn})],Oi.prototype,"rid",void 0);d([f({type:_t})],Oi.prototype,"keyEncryptionAlgorithm",void 0);d([f({type:re})],Oi.prototype,"encryptedKey",void 0);class Bi{constructor(e={}){this.keyIdentifier=new re,Object.assign(this,e)}}d([f({type:re})],Bi.prototype,"keyIdentifier",void 0);d([f({type:y.GeneralizedTime,optional:!0})],Bi.prototype,"date",void 0);d([f({type:Bs,optional:!0})],Bi.prototype,"other",void 0);class Ti{constructor(e={}){this.version=At.v4,this.kekid=new Bi,this.keyEncryptionAlgorithm=new _t,this.encryptedKey=new re,Object.assign(this,e)}}d([f({type:y.Integer})],Ti.prototype,"version",void 0);d([f({type:Bi})],Ti.prototype,"kekid",void 0);d([f({type:_t})],Ti.prototype,"keyEncryptionAlgorithm",void 0);d([f({type:re})],Ti.prototype,"encryptedKey",void 0);class Ri{constructor(e={}){this.version=At.v0,this.keyEncryptionAlgorithm=new _t,this.encryptedKey=new re,Object.assign(this,e)}}d([f({type:y.Integer})],Ri.prototype,"version",void 0);d([f({type:Jo,context:0,optional:!0})],Ri.prototype,"keyDerivationAlgorithm",void 0);d([f({type:_t})],Ri.prototype,"keyEncryptionAlgorithm",void 0);d([f({type:re})],Ri.prototype,"encryptedKey",void 0);class Sc{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Sc.prototype,"oriType",void 0);d([f({type:y.Any})],Sc.prototype,"oriValue",void 0);let Ut=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Oi,optional:!0})],Ut.prototype,"ktri",void 0);d([f({type:Gn,context:1,implicit:!0,optional:!0})],Ut.prototype,"kari",void 0);d([f({type:Ti,context:2,implicit:!0,optional:!0})],Ut.prototype,"kekri",void 0);d([f({type:Ri,context:3,implicit:!0,optional:!0})],Ut.prototype,"pwri",void 0);d([f({type:Sc,context:4,implicit:!0,optional:!0})],Ut.prototype,"ori",void 0);Ut=d([B({type:z.Choice})],Ut);var oa;let Br=oa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,oa.prototype)}};Br=oa=d([B({type:z.Set,itemType:Ut})],Br);var aa;class Rs{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Rs.prototype,"otherRevInfoFormat",void 0);d([f({type:y.Any})],Rs.prototype,"otherRevInfo",void 0);let Tr=class{constructor(e={}){this.other=new Rs,Object.assign(this,e)}};d([f({type:Rs,context:1,implicit:!0})],Tr.prototype,"other",void 0);Tr=d([B({type:z.Choice})],Tr);let Rr=aa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,aa.prototype)}};Rr=aa=d([B({type:z.Set,itemType:Tr})],Rr);class Ac{constructor(e={}){Object.assign(this,e)}}d([f({type:Nr,context:0,implicit:!0,optional:!0})],Ac.prototype,"certs",void 0);d([f({type:Rr,context:1,implicit:!0,optional:!0})],Ac.prototype,"crls",void 0);var ca;let la=ca=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ca.prototype)}};la=ca=d([B({type:z.Set,itemType:Kn})],la);class Pi{constructor(e={}){this.version=At.v0,this.recipientInfos=new Br,this.encryptedContentInfo=new Ni,Object.assign(this,e)}}d([f({type:y.Integer})],Pi.prototype,"version",void 0);d([f({type:Ac,context:0,implicit:!0,optional:!0})],Pi.prototype,"originatorInfo",void 0);d([f({type:Br})],Pi.prototype,"recipientInfos",void 0);d([f({type:Ni})],Pi.prototype,"encryptedContentInfo",void 0);d([f({type:la,context:1,implicit:!0,optional:!0})],Pi.prototype,"unprotectedAttrs",void 0);const m_="1.2.840.113549.1.7.2";var ua;let Pr=ua=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ua.prototype)}};Pr=ua=d([B({type:z.Set,itemType:hi})],Pr);class Jn{constructor(e={}){this.version=At.v0,this.digestAlgorithms=new Pr,this.encapContentInfo=new Os,this.signerInfos=new Cr,Object.assign(this,e)}}d([f({type:y.Integer})],Jn.prototype,"version",void 0);d([f({type:Pr})],Jn.prototype,"digestAlgorithms",void 0);d([f({type:Os})],Jn.prototype,"encapContentInfo",void 0);d([f({type:Nr,context:0,implicit:!0,optional:!0})],Jn.prototype,"certificates",void 0);d([f({type:Rr,context:1,implicit:!0,optional:!0})],Jn.prototype,"crls",void 0);d([f({type:Cr})],Jn.prototype,"signerInfos",void 0);const mi="1.2.840.10045.2.1",Ic="1.2.840.10045.4.1",of="1.2.840.10045.4.3.1",Ec="1.2.840.10045.4.3.2",$c="1.2.840.10045.4.3.3",Cc="1.2.840.10045.4.3.4",Hl="1.2.840.10045.3.1.7",Dl="1.3.132.0.34",Fl="1.3.132.0.35";function Li(n){return new H({algorithm:n})}const y_=Li(Ic);Li(of);const v_=Li(Ec),w_=Li($c),b_=Li(Cc);let yi=class{constructor(e={}){Object.assign(this,e)}};d([f({type:y.ObjectIdentifier})],yi.prototype,"fieldType",void 0);d([f({type:y.Any})],yi.prototype,"parameters",void 0);yi=d([B({type:z.Sequence})],yi);class k_ extends re{}let Ln=class{constructor(e={}){Object.assign(this,e)}};d([f({type:y.OctetString})],Ln.prototype,"a",void 0);d([f({type:y.OctetString})],Ln.prototype,"b",void 0);d([f({type:y.BitString,optional:!0})],Ln.prototype,"seed",void 0);Ln=d([B({type:z.Sequence})],Ln);var da;(function(n){n[n.ecpVer1=1]="ecpVer1"})(da||(da={}));let It=class{constructor(e={}){this.version=da.ecpVer1,Object.assign(this,e)}};d([f({type:y.Integer})],It.prototype,"version",void 0);d([f({type:yi})],It.prototype,"fieldID",void 0);d([f({type:Ln})],It.prototype,"curve",void 0);d([f({type:k_})],It.prototype,"base",void 0);d([f({type:y.Integer,converter:he})],It.prototype,"order",void 0);d([f({type:y.Integer,optional:!0})],It.prototype,"cofactor",void 0);It=d([B({type:z.Sequence})],It);let Vt=class{constructor(e={}){Object.assign(this,e)}};d([f({type:y.ObjectIdentifier})],Vt.prototype,"namedCurve",void 0);d([f({type:y.Null})],Vt.prototype,"implicitCurve",void 0);d([f({type:It})],Vt.prototype,"specifiedCurve",void 0);Vt=d([B({type:z.Choice})],Vt);class Ps{constructor(e={}){this.version=1,this.privateKey=new re,Object.assign(this,e)}}d([f({type:y.Integer})],Ps.prototype,"version",void 0);d([f({type:re})],Ps.prototype,"privateKey",void 0);d([f({type:Vt,context:0,optional:!0})],Ps.prototype,"parameters",void 0);d([f({type:y.BitString,context:1,optional:!0})],Ps.prototype,"publicKey",void 0);class Lr{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.Integer,converter:he})],Lr.prototype,"r",void 0);d([f({type:y.Integer,converter:he})],Lr.prototype,"s",void 0);const Me="1.2.840.113549.1.1",pn=`${Me}.1`,x_=`${Me}.7`,S_=`${Me}.9`,ai=`${Me}.10`,A_=`${Me}.2`,I_=`${Me}.4`,Ur=`${Me}.5`,E_=`${Me}.14`,pa=`${Me}.11`,Vr=`${Me}.12`,Mr=`${Me}.13`,af=`${Me}.15`,cf=`${Me}.16`,Hr="1.3.14.3.2.26",lf="2.16.840.1.101.3.4.2.4",Dr="2.16.840.1.101.3.4.2.1",Fr="2.16.840.1.101.3.4.2.2",qr="2.16.840.1.101.3.4.2.3",$_="2.16.840.1.101.3.4.2.5",C_="2.16.840.1.101.3.4.2.6",j_="1.2.840.113549.2.2",z_="1.2.840.113549.2.5",Ls=`${Me}.8`;function xe(n){return new H({algorithm:n,parameters:null})}xe(j_);xe(z_);const fn=xe(Hr);xe(lf);xe(Dr);xe(Fr);xe(qr);xe($_);xe(C_);const uf=new H({algorithm:Ls,parameters:L.serialize(fn)}),df=new H({algorithm:S_,parameters:L.serialize(wr.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});xe(pn);xe(A_);xe(I_);xe(Ur);xe(af);xe(cf);xe(Vr);xe(Mr);xe(af);xe(cf);class Us{constructor(e={}){this.hashAlgorithm=new H(fn),this.maskGenAlgorithm=new H({algorithm:Ls,parameters:L.serialize(fn)}),this.pSourceAlgorithm=new H(df),Object.assign(this,e)}}d([f({type:H,context:0,defaultValue:fn})],Us.prototype,"hashAlgorithm",void 0);d([f({type:H,context:1,defaultValue:uf})],Us.prototype,"maskGenAlgorithm",void 0);d([f({type:H,context:2,defaultValue:df})],Us.prototype,"pSourceAlgorithm",void 0);new H({algorithm:x_,parameters:L.serialize(new Us)});class hn{constructor(e={}){this.hashAlgorithm=new H(fn),this.maskGenAlgorithm=new H({algorithm:Ls,parameters:L.serialize(fn)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}}d([f({type:H,context:0,defaultValue:fn})],hn.prototype,"hashAlgorithm",void 0);d([f({type:H,context:1,defaultValue:uf})],hn.prototype,"maskGenAlgorithm",void 0);d([f({type:y.Integer,context:2,defaultValue:20})],hn.prototype,"saltLength",void 0);d([f({type:y.Integer,context:3,defaultValue:1})],hn.prototype,"trailerField",void 0);new H({algorithm:ai,parameters:L.serialize(new hn)});class Vs{constructor(e={}){this.digestAlgorithm=new H,this.digest=new re,Object.assign(this,e)}}d([f({type:H})],Vs.prototype,"digestAlgorithm",void 0);d([f({type:re})],Vs.prototype,"digest",void 0);var fa;class Ms{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.Integer,converter:he})],Ms.prototype,"prime",void 0);d([f({type:y.Integer,converter:he})],Ms.prototype,"exponent",void 0);d([f({type:y.Integer,converter:he})],Ms.prototype,"coefficient",void 0);let ha=fa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,fa.prototype)}};ha=fa=d([B({type:z.Sequence,itemType:Ms})],ha);class vt{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)}}d([f({type:y.Integer})],vt.prototype,"version",void 0);d([f({type:y.Integer,converter:he})],vt.prototype,"modulus",void 0);d([f({type:y.Integer,converter:he})],vt.prototype,"publicExponent",void 0);d([f({type:y.Integer,converter:he})],vt.prototype,"privateExponent",void 0);d([f({type:y.Integer,converter:he})],vt.prototype,"prime1",void 0);d([f({type:y.Integer,converter:he})],vt.prototype,"prime2",void 0);d([f({type:y.Integer,converter:he})],vt.prototype,"exponent1",void 0);d([f({type:y.Integer,converter:he})],vt.prototype,"exponent2",void 0);d([f({type:y.Integer,converter:he})],vt.prototype,"coefficient",void 0);d([f({type:ha,optional:!0})],vt.prototype,"otherPrimeInfos",void 0);class jc{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.Integer,converter:he})],jc.prototype,"modulus",void 0);d([f({type:y.Integer,converter:he})],jc.prototype,"publicExponent",void 0);var ga;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(ga||(ga={}));const Pe=ga;/*! *****************************************************************************
80
80
  Copyright (c) Microsoft Corporation.
81
81
 
82
82
  Permission to use, copy, modify, and/or distribute this software for any
@@ -89,9 +89,9 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
89
89
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
90
90
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
91
91
  PERFORMANCE OF THIS SOFTWARE.
92
- ***************************************************************************** */var la=function(n,e){return la=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])},la(n,e)};function kc(n,e){la(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function c_(n,e,t,i){function r(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function c(h){try{d(i.next(h))}catch(g){a(g)}}function l(h){try{d(i.throw(h))}catch(g){a(g)}}function d(h){h.done?s(h.value):r(h.value).then(c,l)}d((i=i.apply(n,[])).next())})}function l_(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(d){return function(h){return l([d,h])}}function l(d){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,r&&(s=d[0]&2?r.return:d[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,d[1])).done)return s;switch(r=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++,r=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(n,t)}catch(h){d=[6,h],r=0}finally{i=s=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function Vi(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],i=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Dr(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var i=t.call(n),r,s=[],a;try{for(;(e===void 0||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(c){a={error:c}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(a)throw a.error}}return s}function Kt(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(Dr(arguments[e]));return n}var u_="injectionTokens";function d_(n){var e=Reflect.getMetadata("design:paramtypes",n)||[],t=Reflect.getOwnMetadata(u_,n)||{};return Object.keys(t).forEach(function(i){e[+i]=t[i]}),e}function Wp(n){return!!n.useClass}function ua(n){return!!n.useFactory}var Gp=function(){function n(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return n.prototype.createProxy=function(e){var t=this,i={},r=!1,s,a=function(){return r||(s=e(t.wrap()),r=!0),s};return new Proxy(i,this.createHandler(a))},n.prototype.createHandler=function(e){var t={},i=function(r){t[r]=function(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];s[0]=e();var c=Reflect[r];return c.apply(void 0,Kt(s))}};return this.reflectMethods.forEach(i),t},n}();function mn(n){return typeof n=="string"||typeof n=="symbol"}function p_(n){return typeof n=="object"&&"token"in n&&"multiple"in n}function Ol(n){return typeof n=="object"&&"token"in n&&"transform"in n}function f_(n){return typeof n=="function"||n instanceof Gp}function Gi(n){return!!n.useToken}function Ji(n){return n.useValue!=null}function h_(n){return Wp(n)||Ji(n)||Gi(n)||ua(n)}var xc=function(){function n(){this._registryMap=new Map}return n.prototype.entries=function(){return this._registryMap.entries()},n.prototype.getAll=function(e){return this.ensure(e),this._registryMap.get(e)},n.prototype.get=function(e){this.ensure(e);var t=this._registryMap.get(e);return t[t.length-1]||null},n.prototype.set=function(e,t){this.ensure(e),this._registryMap.get(e).push(t)},n.prototype.setAll=function(e,t){this._registryMap.set(e,t)},n.prototype.has=function(e){return this.ensure(e),this._registryMap.get(e).length>0},n.prototype.clear=function(){this._registryMap.clear()},n.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},n}(),g_=function(n){kc(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(xc),Bl=function(){function n(){this.scopedResolutions=new Map}return n}();function __(n,e){if(n===null)return"at position #"+e;var t=n.split(",")[e].trim();return'"'+t+'" at position #'+e}function m_(n,e,t){return t===void 0&&(t=" "),Kt([n],e.message.split(`
92
+ ***************************************************************************** */var _a=function(n,e){return _a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])},_a(n,e)};function zc(n,e){_a(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function N_(n,e,t,i){function r(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function c(p){try{u(i.next(p))}catch(g){o(g)}}function l(p){try{u(i.throw(p))}catch(g){o(g)}}function u(p){p.done?s(p.value):r(p.value).then(c,l)}u((i=i.apply(n,[])).next())})}function O_(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,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(u){return function(p){return l([u,p])}}function l(u){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,r&&(s=u[0]&2?r.return:u[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,u[1])).done)return s;switch(r=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,r=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label<s[1]){t.label=s[1],s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break}s[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(n,t)}catch(p){u=[6,p],r=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Wi(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],i=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Kr(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var i=t.call(n),r,s=[],o;try{for(;(e===void 0||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(c){o={error:c}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return s}function Gt(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(Kr(arguments[e]));return n}var B_="injectionTokens";function T_(n){var e=Reflect.getMetadata("design:paramtypes",n)||[],t=Reflect.getOwnMetadata(B_,n)||{};return Object.keys(t).forEach(function(i){e[+i]=t[i]}),e}function pf(n){return!!n.useClass}function ma(n){return!!n.useFactory}var ff=function(){function n(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return n.prototype.createProxy=function(e){var t=this,i={},r=!1,s,o=function(){return r||(s=e(t.wrap()),r=!0),s};return new Proxy(i,this.createHandler(o))},n.prototype.createHandler=function(e){var t={},i=function(r){t[r]=function(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];s[0]=e();var c=Reflect[r];return c.apply(void 0,Gt(s))}};return this.reflectMethods.forEach(i),t},n}();function kn(n){return typeof n=="string"||typeof n=="symbol"}function R_(n){return typeof n=="object"&&"token"in n&&"multiple"in n}function ql(n){return typeof n=="object"&&"token"in n&&"transform"in n}function P_(n){return typeof n=="function"||n instanceof ff}function er(n){return!!n.useToken}function tr(n){return n.useValue!=null}function L_(n){return pf(n)||tr(n)||er(n)||ma(n)}var Nc=function(){function n(){this._registryMap=new Map}return n.prototype.entries=function(){return this._registryMap.entries()},n.prototype.getAll=function(e){return this.ensure(e),this._registryMap.get(e)},n.prototype.get=function(e){this.ensure(e);var t=this._registryMap.get(e);return t[t.length-1]||null},n.prototype.set=function(e,t){this.ensure(e),this._registryMap.get(e).push(t)},n.prototype.setAll=function(e,t){this._registryMap.set(e,t)},n.prototype.has=function(e){return this.ensure(e),this._registryMap.get(e).length>0},n.prototype.clear=function(){this._registryMap.clear()},n.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},n}(),U_=function(n){zc(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(Nc),Kl=function(){function n(){this.scopedResolutions=new Map}return n}();function V_(n,e){if(n===null)return"at position #"+e;var t=n.split(",")[e].trim();return'"'+t+'" at position #'+e}function M_(n,e,t){return t===void 0&&(t=" "),Gt([n],e.message.split(`
93
93
  `).map(function(i){return t+i})).join(`
94
- `)}function y_(n,e,t){var i=Dr(n.toString().match(/constructor\(([\w, ]+)\)/)||[],2),r=i[1],s=r===void 0?null:r,a=__(s,e);return m_("Cannot inject the dependency "+a+' of "'+n.name+'" constructor. Reason:',t)}function v_(n){if(typeof n.dispose!="function")return!1;var e=n.dispose;return!(e.length>0)}var w_=function(n){kc(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(xc),b_=function(n){kc(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(xc),k_=function(){function n(){this.preResolution=new w_,this.postResolution=new b_}return n}(),Jp=new Map,x_=function(){function n(e){this.parent=e,this._registry=new g_,this.interceptors=new k_,this.disposed=!1,this.disposables=new Set}return n.prototype.register=function(e,t,i){i===void 0&&(i={lifecycle:Re.Transient}),this.ensureNotDisposed();var r;if(h_(t)?r=t:r={useClass:t},Gi(r))for(var s=[e],a=r;a!=null;){var c=a.useToken;if(s.includes(c))throw new Error("Token registration cycle detected! "+Kt(s,[c]).join(" -> "));s.push(c);var l=this._registry.get(c);l&&Gi(l.provider)?a=l.provider:a=null}if((i.lifecycle===Re.Singleton||i.lifecycle==Re.ContainerScoped||i.lifecycle==Re.ResolutionScoped)&&(Ji(r)||ua(r)))throw new Error('Cannot use lifecycle "'+Re[i.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:r,options:i}),this},n.prototype.registerType=function(e,t){return this.ensureNotDisposed(),mn(t)?this.register(e,{useToken:t}):this.register(e,{useClass:t})},n.prototype.registerInstance=function(e,t){return this.ensureNotDisposed(),this.register(e,{useValue:t})},n.prototype.registerSingleton=function(e,t){if(this.ensureNotDisposed(),mn(e)){if(mn(t))return this.register(e,{useToken:t},{lifecycle:Re.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:Re.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var i=e;return t&&!mn(t)&&(i=t),this.register(e,{useClass:i},{lifecycle:Re.Singleton})},n.prototype.resolve=function(e,t){t===void 0&&(t=new Bl),this.ensureNotDisposed();var i=this.getRegistration(e);if(!i&&mn(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"Single"),i){var r=this.resolveRegistration(i,t);return this.executePostResolutionInterceptor(e,r,"Single"),r}if(f_(e)){var r=this.construct(e,t);return this.executePostResolutionInterceptor(e,r,"Single"),r}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},n.prototype.executePreResolutionInterceptor=function(e,t){var i,r;if(this.interceptors.preResolution.has(e)){var s=[];try{for(var a=Vi(this.interceptors.preResolution.getAll(e)),c=a.next();!c.done;c=a.next()){var l=c.value;l.options.frequency!="Once"&&s.push(l),l.callback(e,t)}}catch(d){i={error:d}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}this.interceptors.preResolution.setAll(e,s)}},n.prototype.executePostResolutionInterceptor=function(e,t,i){var r,s;if(this.interceptors.postResolution.has(e)){var a=[];try{for(var c=Vi(this.interceptors.postResolution.getAll(e)),l=c.next();!l.done;l=c.next()){var d=l.value;d.options.frequency!="Once"&&a.push(d),d.callback(e,t,i)}}catch(h){r={error:h}}finally{try{l&&!l.done&&(s=c.return)&&s.call(c)}finally{if(r)throw r.error}}this.interceptors.postResolution.setAll(e,a)}},n.prototype.resolveRegistration=function(e,t){if(this.ensureNotDisposed(),e.options.lifecycle===Re.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);var i=e.options.lifecycle===Re.Singleton,r=e.options.lifecycle===Re.ContainerScoped,s=i||r,a;return Ji(e.provider)?a=e.provider.useValue:Gi(e.provider)?a=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):Wp(e.provider)?a=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):ua(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,t),e.options.lifecycle===Re.ResolutionScoped&&t.scopedResolutions.set(e,a),a},n.prototype.resolveAll=function(e,t){var i=this;t===void 0&&(t=new Bl),this.ensureNotDisposed();var r=this.getAllRegistrations(e);if(!r&&mn(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"All"),r){var s=r.map(function(c){return i.resolveRegistration(c,t)});return this.executePostResolutionInterceptor(e,s,"All"),s}var a=[this.construct(e,t)];return this.executePostResolutionInterceptor(e,a,"All"),a},n.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)},n.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},n.prototype.clearInstances=function(){var e,t;this.ensureNotDisposed();try{for(var i=Vi(this._registry.entries()),r=i.next();!r.done;r=i.next()){var s=Dr(r.value,2),a=s[0],c=s[1];this._registry.setAll(a,c.filter(function(l){return!Ji(l.provider)}).map(function(l){return l.instance=void 0,l}))}}catch(l){e={error:l}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},n.prototype.createChildContainer=function(){var e,t;this.ensureNotDisposed();var i=new n(this);try{for(var r=Vi(this._registry.entries()),s=r.next();!s.done;s=r.next()){var a=Dr(s.value,2),c=a[0],l=a[1];l.some(function(d){var h=d.options;return h.lifecycle===Re.ContainerScoped})&&i._registry.setAll(c,l.map(function(d){return d.options.lifecycle===Re.ContainerScoped?{provider:d.provider,options:d.options}:d}))}}catch(d){e={error:d}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return i},n.prototype.beforeResolution=function(e,t,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:t,options:i})},n.prototype.afterResolution=function(e,t,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:t,options:i})},n.prototype.dispose=function(){return c_(this,void 0,void 0,function(){var e;return l_(this,function(t){switch(t.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(i){var r=i.dispose();r&&e.push(r)}),[4,Promise.all(e)];case 1:return t.sent(),[2]}})})},n.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},n.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},n.prototype.construct=function(e,t){var i=this;if(e instanceof Gp)return e.createProxy(function(s){return i.resolve(s,t)});var r=function(){var s=Jp.get(e);if(!s||s.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var a=s.map(i.resolveParams(t,e));return new(e.bind.apply(e,Kt([void 0],a)))}();return v_(r)&&this.disposables.add(r),r},n.prototype.resolveParams=function(e,t){var i=this;return function(r,s){var a,c,l;try{return p_(r)?Ol(r)?r.multiple?(a=i.resolve(r.transform)).transform.apply(a,Kt([i.resolveAll(r.token)],r.transformArgs)):(c=i.resolve(r.transform)).transform.apply(c,Kt([i.resolve(r.token,e)],r.transformArgs)):r.multiple?i.resolveAll(r.token):i.resolve(r.token,e):Ol(r)?(l=i.resolve(r.transform,e)).transform.apply(l,Kt([i.resolve(r.token,e)],r.transformArgs)):i.resolve(r,e)}catch(d){throw new Error(y_(t,s,d))}}},n.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},n}(),Ee=new x_;function Ts(){return function(n){Jp.set(n,d_(n))}}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 da;class Ps{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}}u([p({type:m.ObjectIdentifier})],Ps.prototype,"attrId",void 0);u([p({type:m.Any,repeated:"set"})],Ps.prototype,"attrValues",void 0);let Nl=da=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,da.prototype)}};Nl=da=u([N({type:C.Sequence,itemType:Ps})],Nl);var pa;let Rl=pa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,pa.prototype)}};Rl=pa=u([N({type:C.Sequence,itemType:Hn})],Rl);class Zp{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:m.ObjectIdentifier})],Zp.prototype,"certId",void 0);u([p({type:m.Any,context:0})],Zp.prototype,"certValue",void 0);class Yp{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:m.ObjectIdentifier})],Yp.prototype,"crlId",void 0);u([p({type:m.Any,context:0})],Yp.prototype,"crltValue",void 0);class Xp extends re{}let Us=class{constructor(e={}){this.encryptionAlgorithm=new M,this.encryptedData=new Xp,Object.assign(this,e)}};u([p({type:M})],Us.prototype,"encryptionAlgorithm",void 0);u([p({type:Xp})],Us.prototype,"encryptedData",void 0);var fa,ha;(function(n){n[n.v1=0]="v1"})(ha||(ha={}));class Qp extends re{}let ga=fa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,fa.prototype)}};ga=fa=u([N({type:C.Sequence,itemType:kt})],ga);class Bi{constructor(e={}){this.version=ha.v1,this.privateKeyAlgorithm=new M,this.privateKey=new Qp,Object.assign(this,e)}}u([p({type:m.Integer})],Bi.prototype,"version",void 0);u([p({type:M})],Bi.prototype,"privateKeyAlgorithm",void 0);u([p({type:Qp})],Bi.prototype,"privateKey",void 0);u([p({type:ga,implicit:!0,context:0,optional:!0})],Bi.prototype,"attributes",void 0);let Tl=class extends Bi{};Tl=u([N({type:C.Sequence})],Tl);let Pl=class extends Us{};Pl=u([N({type:C.Sequence})],Pl);class ef{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:m.ObjectIdentifier})],ef.prototype,"secretTypeId",void 0);u([p({type:m.Any,context:0})],ef.prototype,"secretValue",void 0);class Ni{constructor(e={}){this.mac=new Ns,this.macSalt=new re,this.iterations=1,Object.assign(this,e)}}u([p({type:Ns})],Ni.prototype,"mac",void 0);u([p({type:re})],Ni.prototype,"macSalt",void 0);u([p({type:m.Integer,defaultValue:1})],Ni.prototype,"iterations",void 0);class Ls{constructor(e={}){this.version=3,this.authSafe=new Hn,this.macData=new Ni,Object.assign(this,e)}}u([p({type:m.Integer})],Ls.prototype,"version",void 0);u([p({type:Hn})],Ls.prototype,"authSafe",void 0);u([p({type:Ni,optional:!0})],Ls.prototype,"macData",void 0);var _a;class Ds{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:m.ObjectIdentifier})],Ds.prototype,"bagId",void 0);u([p({type:m.Any,context:0})],Ds.prototype,"bagValue",void 0);u([p({type:Ps,repeated:"set",optional:!0})],Ds.prototype,"bagAttributes",void 0);let Ul=_a=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,_a.prototype)}};Ul=_a=u([N({type:C.Sequence,itemType:Ds})],Ul);var ma,ya,va;const tf="1.2.840.113549.1.9",nf=`${tf}.7`,Sc=`${tf}.14`;let Vr=class extends ze{constructor(e={}){super(e)}toString(){return this.ia5String||super.toString()}};u([p({type:m.IA5String})],Vr.prototype,"ia5String",void 0);Vr=u([N({type:C.Choice})],Vr);let Ll=class extends Hn{};Ll=u([N({type:C.Sequence})],Ll);let Dl=class extends Ls{};Dl=u([N({type:C.Sequence})],Dl);let Vl=class extends Us{};Vl=u([N({type:C.Sequence})],Vl);let wa=class{constructor(e=""){this.value=e}toString(){return this.value}};u([p({type:m.IA5String})],wa.prototype,"value",void 0);wa=u([N({type:C.Choice})],wa);let Ml=class extends Vr{};Ml=u([N({type:C.Choice})],Ml);let Hl=class extends ze{};Hl=u([N({type:C.Choice})],Hl);let ba=class{constructor(e=new Date){this.value=e}};u([p({type:m.GeneralizedTime})],ba.prototype,"value",void 0);ba=u([N({type:C.Choice})],ba);let ql=class extends ze{};ql=u([N({type:C.Choice})],ql);let ka=class{constructor(e="M"){this.value=e}toString(){return this.value}};u([p({type:m.PrintableString})],ka.prototype,"value",void 0);ka=u([N({type:C.Choice})],ka);let Mr=class{constructor(e=""){this.value=e}toString(){return this.value}};u([p({type:m.PrintableString})],Mr.prototype,"value",void 0);Mr=u([N({type:C.Choice})],Mr);let Kl=class extends Mr{};Kl=u([N({type:C.Choice})],Kl);let Fl=class extends ze{};Fl=u([N({type:C.Choice})],Fl);let xa=class{constructor(e=""){this.value=e}toString(){return this.value}};u([p({type:m.ObjectIdentifier})],xa.prototype,"value",void 0);xa=u([N({type:C.Choice})],xa);let Wl=class extends Ie{};Wl=u([N({type:C.Choice})],Wl);let Sa=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};u([p({type:m.Integer})],Sa.prototype,"value",void 0);Sa=u([N({type:C.Choice})],Sa);let Gl=class extends _t{};Gl=u([N({type:C.Sequence})],Gl);let Hr=class extends ze{};Hr=u([N({type:C.Choice})],Hr);let Jl=ma=class extends Tt{constructor(e){super(e),Object.setPrototypeOf(this,ma.prototype)}};Jl=ma=u([N({type:C.Sequence})],Jl);let Zl=ya=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ya.prototype)}};Zl=ya=u([N({type:C.Set,itemType:Mn})],Zl);let Aa=class{constructor(e=""){this.value=e}toString(){return this.value}};u([p({type:m.BmpString})],Aa.prototype,"value",void 0);Aa=u([N({type:C.Choice})],Aa);let Ia=class extends M{};Ia=u([N({type:C.Sequence})],Ia);let Yl=va=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,va.prototype)}};Yl=va=u([N({type:C.Sequence,itemType:Ia})],Yl);var ja;let qr=ja=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ja.prototype)}};qr=ja=u([N({type:C.Sequence,itemType:kt})],qr);class Fn{constructor(e={}){this.version=0,this.subject=new ye,this.subjectPKInfo=new it,this.attributes=new qr,Object.assign(this,e)}}u([p({type:m.Integer})],Fn.prototype,"version",void 0);u([p({type:ye})],Fn.prototype,"subject",void 0);u([p({type:it})],Fn.prototype,"subjectPKInfo",void 0);u([p({type:qr,implicit:!0,context:0})],Fn.prototype,"attributes",void 0);class fi{constructor(e={}){this.certificationRequestInfo=new Fn,this.signatureAlgorithm=new M,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}u([p({type:Fn})],fi.prototype,"certificationRequestInfo",void 0);u([p({type:M})],fi.prototype,"signatureAlgorithm",void 0);u([p({type:m.BitString})],fi.prototype,"signature",void 0);/*!
94
+ `)}function H_(n,e,t){var i=Kr(n.toString().match(/constructor\(([\w, ]+)\)/)||[],2),r=i[1],s=r===void 0?null:r,o=V_(s,e);return M_("Cannot inject the dependency "+o+' of "'+n.name+'" constructor. Reason:',t)}function D_(n){if(typeof n.dispose!="function")return!1;var e=n.dispose;return!(e.length>0)}var F_=function(n){zc(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(Nc),q_=function(n){zc(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(Nc),K_=function(){function n(){this.preResolution=new F_,this.postResolution=new q_}return n}(),hf=new Map,W_=function(){function n(e){this.parent=e,this._registry=new U_,this.interceptors=new K_,this.disposed=!1,this.disposables=new Set}return n.prototype.register=function(e,t,i){i===void 0&&(i={lifecycle:Pe.Transient}),this.ensureNotDisposed();var r;if(L_(t)?r=t:r={useClass:t},er(r))for(var s=[e],o=r;o!=null;){var c=o.useToken;if(s.includes(c))throw new Error("Token registration cycle detected! "+Gt(s,[c]).join(" -> "));s.push(c);var l=this._registry.get(c);l&&er(l.provider)?o=l.provider:o=null}if((i.lifecycle===Pe.Singleton||i.lifecycle==Pe.ContainerScoped||i.lifecycle==Pe.ResolutionScoped)&&(tr(r)||ma(r)))throw new Error('Cannot use lifecycle "'+Pe[i.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:r,options:i}),this},n.prototype.registerType=function(e,t){return this.ensureNotDisposed(),kn(t)?this.register(e,{useToken:t}):this.register(e,{useClass:t})},n.prototype.registerInstance=function(e,t){return this.ensureNotDisposed(),this.register(e,{useValue:t})},n.prototype.registerSingleton=function(e,t){if(this.ensureNotDisposed(),kn(e)){if(kn(t))return this.register(e,{useToken:t},{lifecycle:Pe.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:Pe.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var i=e;return t&&!kn(t)&&(i=t),this.register(e,{useClass:i},{lifecycle:Pe.Singleton})},n.prototype.resolve=function(e,t){t===void 0&&(t=new Kl),this.ensureNotDisposed();var i=this.getRegistration(e);if(!i&&kn(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"Single"),i){var r=this.resolveRegistration(i,t);return this.executePostResolutionInterceptor(e,r,"Single"),r}if(P_(e)){var r=this.construct(e,t);return this.executePostResolutionInterceptor(e,r,"Single"),r}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},n.prototype.executePreResolutionInterceptor=function(e,t){var i,r;if(this.interceptors.preResolution.has(e)){var s=[];try{for(var o=Wi(this.interceptors.preResolution.getAll(e)),c=o.next();!c.done;c=o.next()){var l=c.value;l.options.frequency!="Once"&&s.push(l),l.callback(e,t)}}catch(u){i={error:u}}finally{try{c&&!c.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}this.interceptors.preResolution.setAll(e,s)}},n.prototype.executePostResolutionInterceptor=function(e,t,i){var r,s;if(this.interceptors.postResolution.has(e)){var o=[];try{for(var c=Wi(this.interceptors.postResolution.getAll(e)),l=c.next();!l.done;l=c.next()){var u=l.value;u.options.frequency!="Once"&&o.push(u),u.callback(e,t,i)}}catch(p){r={error:p}}finally{try{l&&!l.done&&(s=c.return)&&s.call(c)}finally{if(r)throw r.error}}this.interceptors.postResolution.setAll(e,o)}},n.prototype.resolveRegistration=function(e,t){if(this.ensureNotDisposed(),e.options.lifecycle===Pe.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);var i=e.options.lifecycle===Pe.Singleton,r=e.options.lifecycle===Pe.ContainerScoped,s=i||r,o;return tr(e.provider)?o=e.provider.useValue:er(e.provider)?o=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):pf(e.provider)?o=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):ma(e.provider)?o=e.provider.useFactory(this):o=this.construct(e.provider,t),e.options.lifecycle===Pe.ResolutionScoped&&t.scopedResolutions.set(e,o),o},n.prototype.resolveAll=function(e,t){var i=this;t===void 0&&(t=new Kl),this.ensureNotDisposed();var r=this.getAllRegistrations(e);if(!r&&kn(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"All"),r){var s=r.map(function(c){return i.resolveRegistration(c,t)});return this.executePostResolutionInterceptor(e,s,"All"),s}var o=[this.construct(e,t)];return this.executePostResolutionInterceptor(e,o,"All"),o},n.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)},n.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},n.prototype.clearInstances=function(){var e,t;this.ensureNotDisposed();try{for(var i=Wi(this._registry.entries()),r=i.next();!r.done;r=i.next()){var s=Kr(r.value,2),o=s[0],c=s[1];this._registry.setAll(o,c.filter(function(l){return!tr(l.provider)}).map(function(l){return l.instance=void 0,l}))}}catch(l){e={error:l}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},n.prototype.createChildContainer=function(){var e,t;this.ensureNotDisposed();var i=new n(this);try{for(var r=Wi(this._registry.entries()),s=r.next();!s.done;s=r.next()){var o=Kr(s.value,2),c=o[0],l=o[1];l.some(function(u){var p=u.options;return p.lifecycle===Pe.ContainerScoped})&&i._registry.setAll(c,l.map(function(u){return u.options.lifecycle===Pe.ContainerScoped?{provider:u.provider,options:u.options}:u}))}}catch(u){e={error:u}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return i},n.prototype.beforeResolution=function(e,t,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:t,options:i})},n.prototype.afterResolution=function(e,t,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:t,options:i})},n.prototype.dispose=function(){return N_(this,void 0,void 0,function(){var e;return O_(this,function(t){switch(t.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(i){var r=i.dispose();r&&e.push(r)}),[4,Promise.all(e)];case 1:return t.sent(),[2]}})})},n.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},n.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},n.prototype.construct=function(e,t){var i=this;if(e instanceof ff)return e.createProxy(function(s){return i.resolve(s,t)});var r=function(){var s=hf.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(i.resolveParams(t,e));return new(e.bind.apply(e,Gt([void 0],o)))}();return D_(r)&&this.disposables.add(r),r},n.prototype.resolveParams=function(e,t){var i=this;return function(r,s){var o,c,l;try{return R_(r)?ql(r)?r.multiple?(o=i.resolve(r.transform)).transform.apply(o,Gt([i.resolveAll(r.token)],r.transformArgs)):(c=i.resolve(r.transform)).transform.apply(c,Gt([i.resolve(r.token,e)],r.transformArgs)):r.multiple?i.resolveAll(r.token):i.resolve(r.token,e):ql(r)?(l=i.resolve(r.transform,e)).transform.apply(l,Gt([i.resolve(r.token,e)],r.transformArgs)):i.resolve(r,e)}catch(u){throw new Error(H_(t,s,u))}}},n.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},n}(),je=new W_;function Hs(){return function(n){hf.set(n,T_(n))}}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 ya;class Ds{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}}d([f({type:y.ObjectIdentifier})],Ds.prototype,"attrId",void 0);d([f({type:y.Any,repeated:"set"})],Ds.prototype,"attrValues",void 0);let Wl=ya=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ya.prototype)}};Wl=ya=d([B({type:z.Sequence,itemType:Ds})],Wl);var va;let Gl=va=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,va.prototype)}};Gl=va=d([B({type:z.Sequence,itemType:Wn})],Gl);class gf{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],gf.prototype,"certId",void 0);d([f({type:y.Any,context:0})],gf.prototype,"certValue",void 0);class _f{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],_f.prototype,"crlId",void 0);d([f({type:y.Any,context:0})],_f.prototype,"crltValue",void 0);class mf extends re{}let Fs=class{constructor(e={}){this.encryptionAlgorithm=new H,this.encryptedData=new mf,Object.assign(this,e)}};d([f({type:H})],Fs.prototype,"encryptionAlgorithm",void 0);d([f({type:mf})],Fs.prototype,"encryptedData",void 0);var wa,ba;(function(n){n[n.v1=0]="v1"})(ba||(ba={}));class yf extends re{}let ka=wa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,wa.prototype)}};ka=wa=d([B({type:z.Sequence,itemType:St})],ka);class Ui{constructor(e={}){this.version=ba.v1,this.privateKeyAlgorithm=new H,this.privateKey=new yf,Object.assign(this,e)}}d([f({type:y.Integer})],Ui.prototype,"version",void 0);d([f({type:H})],Ui.prototype,"privateKeyAlgorithm",void 0);d([f({type:yf})],Ui.prototype,"privateKey",void 0);d([f({type:ka,implicit:!0,context:0,optional:!0})],Ui.prototype,"attributes",void 0);let Jl=class extends Ui{};Jl=d([B({type:z.Sequence})],Jl);let Zl=class extends Fs{};Zl=d([B({type:z.Sequence})],Zl);class vf{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],vf.prototype,"secretTypeId",void 0);d([f({type:y.Any,context:0})],vf.prototype,"secretValue",void 0);class Vi{constructor(e={}){this.mac=new Vs,this.macSalt=new re,this.iterations=1,Object.assign(this,e)}}d([f({type:Vs})],Vi.prototype,"mac",void 0);d([f({type:re})],Vi.prototype,"macSalt",void 0);d([f({type:y.Integer,defaultValue:1})],Vi.prototype,"iterations",void 0);class qs{constructor(e={}){this.version=3,this.authSafe=new Wn,this.macData=new Vi,Object.assign(this,e)}}d([f({type:y.Integer})],qs.prototype,"version",void 0);d([f({type:Wn})],qs.prototype,"authSafe",void 0);d([f({type:Vi,optional:!0})],qs.prototype,"macData",void 0);var xa;class Ks{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Ks.prototype,"bagId",void 0);d([f({type:y.Any,context:0})],Ks.prototype,"bagValue",void 0);d([f({type:Ds,repeated:"set",optional:!0})],Ks.prototype,"bagAttributes",void 0);let Yl=xa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,xa.prototype)}};Yl=xa=d([B({type:z.Sequence,itemType:Ks})],Yl);var Sa,Aa,Ia;const wf="1.2.840.113549.1.9",bf=`${wf}.7`,Oc=`${wf}.14`;let Wr=class extends Ce{constructor(e={}){super(e)}toString(){return this.ia5String||super.toString()}};d([f({type:y.IA5String})],Wr.prototype,"ia5String",void 0);Wr=d([B({type:z.Choice})],Wr);let Xl=class extends Wn{};Xl=d([B({type:z.Sequence})],Xl);let Ql=class extends qs{};Ql=d([B({type:z.Sequence})],Ql);let eu=class extends Fs{};eu=d([B({type:z.Sequence})],eu);let Ea=class{constructor(e=""){this.value=e}toString(){return this.value}};d([f({type:y.IA5String})],Ea.prototype,"value",void 0);Ea=d([B({type:z.Choice})],Ea);let tu=class extends Wr{};tu=d([B({type:z.Choice})],tu);let nu=class extends Ce{};nu=d([B({type:z.Choice})],nu);let $a=class{constructor(e=new Date){this.value=e}};d([f({type:y.GeneralizedTime})],$a.prototype,"value",void 0);$a=d([B({type:z.Choice})],$a);let iu=class extends Ce{};iu=d([B({type:z.Choice})],iu);let Ca=class{constructor(e="M"){this.value=e}toString(){return this.value}};d([f({type:y.PrintableString})],Ca.prototype,"value",void 0);Ca=d([B({type:z.Choice})],Ca);let Gr=class{constructor(e=""){this.value=e}toString(){return this.value}};d([f({type:y.PrintableString})],Gr.prototype,"value",void 0);Gr=d([B({type:z.Choice})],Gr);let ru=class extends Gr{};ru=d([B({type:z.Choice})],ru);let su=class extends Ce{};su=d([B({type:z.Choice})],su);let ja=class{constructor(e=""){this.value=e}toString(){return this.value}};d([f({type:y.ObjectIdentifier})],ja.prototype,"value",void 0);ja=d([B({type:z.Choice})],ja);let ou=class extends Ee{};ou=d([B({type:z.Choice})],ou);let za=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};d([f({type:y.Integer})],za.prototype,"value",void 0);za=d([B({type:z.Choice})],za);let au=class extends yt{};au=d([B({type:z.Sequence})],au);let Jr=class extends Ce{};Jr=d([B({type:z.Choice})],Jr);let cu=Sa=class extends Lt{constructor(e){super(e),Object.setPrototypeOf(this,Sa.prototype)}};cu=Sa=d([B({type:z.Sequence})],cu);let lu=Aa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Aa.prototype)}};lu=Aa=d([B({type:z.Set,itemType:Kn})],lu);let Na=class{constructor(e=""){this.value=e}toString(){return this.value}};d([f({type:y.BmpString})],Na.prototype,"value",void 0);Na=d([B({type:z.Choice})],Na);let Oa=class extends H{};Oa=d([B({type:z.Sequence})],Oa);let uu=Ia=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Ia.prototype)}};uu=Ia=d([B({type:z.Sequence,itemType:Oa})],uu);var Ba;let Zr=Ba=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Ba.prototype)}};Zr=Ba=d([B({type:z.Sequence,itemType:St})],Zr);class Zn{constructor(e={}){this.version=0,this.subject=new ve,this.subjectPKInfo=new ot,this.attributes=new Zr,Object.assign(this,e)}}d([f({type:y.Integer})],Zn.prototype,"version",void 0);d([f({type:ve})],Zn.prototype,"subject",void 0);d([f({type:ot})],Zn.prototype,"subjectPKInfo",void 0);d([f({type:Zr,implicit:!0,context:0})],Zn.prototype,"attributes",void 0);class vi{constructor(e={}){this.certificationRequestInfo=new Zn,this.signatureAlgorithm=new H,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:Zn})],vi.prototype,"certificationRequestInfo",void 0);d([f({type:H})],vi.prototype,"signatureAlgorithm",void 0);d([f({type:y.BitString})],vi.prototype,"signature",void 0);/*!
95
95
  * MIT License
96
96
  *
97
97
  * Copyright (c) Peculiar Ventures. All rights reserved.
@@ -114,15 +114,39 @@ PERFORMANCE OF THIS SOFTWARE.
114
114
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
115
115
  * SOFTWARE.
116
116
  *
117
- */const Ri="crypto.algorithm";class S_{getAlgorithms(){return Ee.resolveAll(Ri)}toAsnAlgorithm(e){({...e});for(const t of this.getAlgorithms()){const i=t.toAsnAlgorithm(e);if(i)return i}if(/^[0-9.]+$/.test(e.name)){const t=new M({algorithm:e.name});if("parameters"in e){const i=e;t.parameters=i.parameters}return t}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(e){for(const i of this.getAlgorithms()){const r=i.toWebAlgorithm(e);if(r)return r}return{name:e.algorithm,parameters:e.parameters}}}const un="crypto.algorithmProvider";Ee.registerSingleton(un,S_);var Zi;const De="1.3.36.3.3.2.8.1.1",Xl=`${De}.1`,Ql=`${De}.2`,eu=`${De}.3`,tu=`${De}.4`,nu=`${De}.5`,iu=`${De}.6`,ru=`${De}.7`,su=`${De}.8`,ou=`${De}.9`,au=`${De}.10`,cu=`${De}.11`,lu=`${De}.12`,uu=`${De}.13`,du=`${De}.14`,pu="brainpoolP160r1",fu="brainpoolP160t1",hu="brainpoolP192r1",gu="brainpoolP192t1",_u="brainpoolP224r1",mu="brainpoolP224t1",yu="brainpoolP256r1",vu="brainpoolP256t1",wu="brainpoolP320r1",bu="brainpoolP320t1",ku="brainpoolP384r1",xu="brainpoolP384t1",Su="brainpoolP512r1",Au="brainpoolP512t1",ge="ECDSA";let hi=Zi=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case ge.toLowerCase():if("hash"in e)switch((typeof e.hash=="string"?e.hash:e.hash.name).toLowerCase()){case"sha-1":return Gg;case"sha-256":return Jg;case"sha-384":return Zg;case"sha-512":return Yg}else if("namedCurve"in e){let t="";switch(e.namedCurve){case"P-256":t=El;break;case"K-256":t=Zi.SECP256K1;break;case"P-384":t=$l;break;case"P-521":t=Cl;break;case pu:t=Xl;break;case fu:t=Ql;break;case hu:t=eu;break;case gu:t=tu;break;case _u:t=nu;break;case mu:t=iu;break;case yu:t=ru;break;case vu:t=su;break;case wu:t=ou;break;case bu:t=au;break;case ku:t=cu;break;case xu:t=lu;break;case Su:t=uu;break;case Au:t=du;break}if(t)return new M({algorithm:di,parameters:U.serialize(new Ut({namedCurve:t}))})}}return null}toWebAlgorithm(e){switch(e.algorithm){case mc:return{name:ge,hash:{name:"SHA-1"}};case yc:return{name:ge,hash:{name:"SHA-256"}};case vc:return{name:ge,hash:{name:"SHA-384"}};case wc:return{name:ge,hash:{name:"SHA-512"}};case di:{if(!e.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(U.parse(e.parameters,Ut).namedCurve){case El:return{name:ge,namedCurve:"P-256"};case Zi.SECP256K1:return{name:ge,namedCurve:"K-256"};case $l:return{name:ge,namedCurve:"P-384"};case Cl:return{name:ge,namedCurve:"P-521"};case Xl:return{name:ge,namedCurve:pu};case Ql:return{name:ge,namedCurve:fu};case eu:return{name:ge,namedCurve:hu};case tu:return{name:ge,namedCurve:gu};case nu:return{name:ge,namedCurve:_u};case iu:return{name:ge,namedCurve:mu};case ru:return{name:ge,namedCurve:yu};case su:return{name:ge,namedCurve:vu};case ou:return{name:ge,namedCurve:wu};case au:return{name:ge,namedCurve:bu};case cu:return{name:ge,namedCurve:ku};case lu:return{name:ge,namedCurve:xu};case uu:return{name:ge,namedCurve:Su};case du:return{name:ge,namedCurve:Au}}}}return null}};hi.SECP256K1="1.3.132.0.10";hi=Zi=u([Ts()],hi);Ee.registerSingleton(Ri,hi);const rf=Symbol("name"),sf=Symbol("value");class ae{constructor(e,t={},i=""){this[rf]=e,this[sf]=i;for(const r in t)this[r]=t[r]}}ae.NAME=rf;ae.VALUE=sf;class A_{static toTextObject(e){const t=new ae("Algorithm Identifier",{},Vt.toString(e.algorithm));if(e.parameters)switch(e.algorithm){case di:{const i=new hi().toWebAlgorithm(e);i&&"namedCurve"in i?t["Named Curve"]=i.namedCurve:t.Parameters=e.parameters;break}default:t.Parameters=e.parameters}return t}}class Vt{static toString(e){const t=this.items[e];return t||e}}Vt.items={[Tr]:"sha1",[qp]:"sha224",[Pr]:"sha256",[Ur]:"sha384",[Lr]:"sha512",[an]:"rsaEncryption",[Br]:"sha1WithRSAEncryption",[i_]:"sha224WithRSAEncryption",[sa]:"sha256WithRSAEncryption",[Nr]:"sha384WithRSAEncryption",[Rr]:"sha512WithRSAEncryption",[di]:"ecPublicKey",[mc]:"ecdsaWithSHA1",[Vp]:"ecdsaWithSHA224",[yc]:"ecdsaWithSHA256",[vc]:"ecdsaWithSHA384",[wc]:"ecdsaWithSHA512",[Vg]:"TLS WWW server authentication",[Mg]:"TLS WWW client authentication",[Hg]:"Code Signing",[qg]:"E-mail Protection",[Kg]:"Time Stamping",[Fg]:"OCSP Signing",[Wg]:"Signed Data"};class dn{static serialize(e){return this.serializeObj(e).join(`
118
- `)}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,t=0){const i=[];let r=this.pad(t++),s="";const a=e[ae.VALUE];a&&(s=` ${a}`),i.push(`${r}${e[ae.NAME]}:${s}`),r=this.pad(t);for(const c in e){if(typeof c=="symbol")continue;const l=e[c],d=c?`${c}: `:"";if(typeof l=="string"||typeof l=="number"||typeof l=="boolean")i.push(`${r}${d}${l}`);else if(l instanceof Date)i.push(`${r}${d}${l.toUTCString()}`);else if(Array.isArray(l))for(const h of l)h[ae.NAME]=c,i.push(...this.serializeObj(h,t));else if(l instanceof ae)l[ae.NAME]=c,i.push(...this.serializeObj(l,t));else if(L.isBufferSource(l))c?(i.push(`${r}${d}`),i.push(...this.serializeBufferSource(l,t+1))):i.push(...this.serializeBufferSource(l,t));else if("toTextObject"in l){const h=l.toTextObject();h[ae.NAME]=c,i.push(...this.serializeObj(h,t))}else throw new TypeError("Cannot serialize data in text format. Unsupported type.")}return i}static serializeBufferSource(e,t=0){const i=this.pad(t),r=L.toUint8Array(e),s=[];for(let a=0;a<r.length;){const c=[];for(let l=0;l<16&&a<r.length;l++){l===8&&c.push("");const d=r[a++].toString(16).padStart(2,"0");c.push(d)}s.push(`${i}${c.join(" ")}`)}return s}static serializeAlgorithm(e){return this.algorithmSerializer.toTextObject(e)}}dn.oidSerializer=Vt;dn.algorithmSerializer=A_;class Mt{constructor(...e){if(e.length===1){const t=e[0];this.rawData=U.serialize(t),this.onInit(t)}else{const t=U.parse(e[0],e[1]);this.rawData=L.toArrayBuffer(e[0]),this.onInit(t)}}equal(e){return e instanceof Mt?xd(e.rawData,this.rawData):!1}toString(e="text"){switch(e){case"asn":return U.toString(this.rawData);case"text":return dn.serialize(this.toTextObject());case"hex":return W.ToHex(this.rawData);case"base64":return W.ToBase64(this.rawData);case"base64url":return W.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 ae(this.getTextName(),{},e)}}Mt.NAME="ASN";class Ye extends Mt{constructor(...e){let t;L.isBufferSource(e[0])?t=L.toArrayBuffer(e[0]):t=U.serialize(new Je({extnID:e[0],critical:e[1],extnValue:new re(L.toArrayBuffer(e[2]))})),super(t,Je)}onInit(e){this.type=e.extnID,this.critical=e.critical,this.value=e.extnValue.buffer}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.value,e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty(this.critical?"critical":void 0);return e[ae.NAME]===Ye.NAME&&(e[ae.NAME]=Vt.toString(this.type)),e}}var of;class Ct{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[of]="CryptoProvider",typeof self<"u"&&typeof crypto<"u"?this.set(Ct.DEFAULT,crypto):typeof global<"u"&&global.crypto&&global.crypto.subtle&&this.set(Ct.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=Ct.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(Ct.DEFAULT,e);return this}}of=Symbol.toStringTag;Ct.DEFAULT="default";const Ae=new Ct,I_=/^[0-2](?:\.[1-9][0-9]*)+$/;function j_(n){return new RegExp(I_).test(n)}class af{constructor(e={}){this.items={};for(const t in e)this.register(t,e[t])}get(e){return this.items[e]||null}findId(e){return j_(e)?e:this.get(e)}register(e,t){this.items[e]=t,this.items[t]=e}}const Ue=new af;Ue.register("CN","2.5.4.3");Ue.register("L","2.5.4.7");Ue.register("ST","2.5.4.8");Ue.register("O","2.5.4.10");Ue.register("OU","2.5.4.11");Ue.register("C","2.5.4.6");Ue.register("DC","0.9.2342.19200300.100.1.25");Ue.register("E","1.2.840.113549.1.9.1");Ue.register("G","2.5.4.42");Ue.register("I","2.5.4.43");Ue.register("SN","2.5.4.4");Ue.register("T","2.5.4.12");function z_(n,e){return`\\${W.ToHex(W.FromUtf8String(e)).toUpperCase()}`}function E_(n){return n.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,z_)}class We{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 af,this.asn=new ye;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const r=t[i];this.extraNames.register(i,r)}typeof e=="string"?this.asn=this.fromString(e):e instanceof ye?this.asn=e:L.isBufferSource(e)?this.asn=U.parse(e,ye):this.asn=this.fromJSON(e)}getField(e){const t=this.extraNames.findId(e)||Ue.findId(e),i=[];for(const r of this.asn)for(const s of r)s.type===t&&i.push(s.value.toString());return i}getName(e){return this.extraNames.get(e)||Ue.get(e)}toString(){return this.asn.map(e=>e.map(t=>{const i=this.getName(t.type)||t.type,r=t.value.anyValue?`#${W.ToHex(t.value.anyValue)}`:E_(t.value.toString());return`${i}=${r}`}).join("+")).join(", ")}toJSON(){var e;const t=[];for(const i of this.asn){const r={};for(const s of i){const a=this.getName(s.type)||s.type;(e=r[a])!==null&&e!==void 0||(r[a]=[]),r[a].push(s.value.anyValue?`#${W.ToHex(s.value.anyValue)}`:s.value.toString())}t.push(r)}return t}fromString(e){const t=new ye,i=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let r=null,s=",";for(;r=i.exec(`${e},`);){let[,a,c]=r;const l=c[c.length-1];(l===","||l==="+")&&(c=c.slice(0,c.length-1),r[3]=l);const d=r[3];a=this.getTypeOid(a);const h=this.createAttribute(a,c);s==="+"?t[t.length-1].push(h):t.push(new In([h])),s=d}return t}fromJSON(e){const t=new ye;for(const i of e){const r=new In;for(const s in i){const a=this.getTypeOid(s),c=i[s];for(const l of c){const d=this.createAttribute(a,l);r.push(d)}}t.push(r)}return t}getTypeOid(e){if(/[\d.]+/.test(e)||(e=this.getName(e)||""),!e)throw new Error(`Cannot get OID for name type '${e}'`);return e}createAttribute(e,t){const i=new _s({type:e});if(typeof t=="object")for(const r in t)switch(r){case"ia5String":i.value.ia5String=t[r];break;case"utf8String":i.value.utf8String=t[r];break;case"universalString":i.value.universalString=t[r];break;case"bmpString":i.value.bmpString=t[r];break;case"printableString":i.value.printableString=t[r];break}else if(t[0]==="#")i.value.anyValue=W.FromHex(t.slice(1));else{const r=this.processStringValue(t);e===this.getName("E")||e===this.getName("DC")?i.value.ia5String=r:We.isPrintableString(r)?i.value.printableString=r:i.value.utf8String=r}return i}processStringValue(e){const t=/"(.*?[^\\])?"/.exec(e);return t&&(e=t[1]),e.replace(/\\0a/ig,`
119
- `).replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1")}toArrayBuffer(){return U.serialize(this.asn)}async getThumbprint(...e){var t;let i,r="SHA-1";return e.length>=1&&!(!((t=e[0])===null||t===void 0)&&t.subtle)?(r=e[0]||r,i=e[1]||Ae.get()):i=e[0]||Ae.get(),await i.subtle.digest(r,this.toArrayBuffer())}}const cf="Cannot initialize GeneralName from ASN.1 data.",Iu=`${cf} Unsupported string format in use.`,$_=`${cf} Value doesn't match to GUID regular expression.`,ju=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,zu="1.3.6.1.4.1.311.25.1",Eu="1.3.6.1.4.1.311.20.2.3",Xs="dns",Qs="dn",eo="email",to="ip",no="url",io="guid",ro="upn",Mi="id";class Ot extends Mt{constructor(...e){let t;if(e.length===2)switch(e[0]){case Qs:{const i=new We(e[1]).toArrayBuffer(),r=U.parse(i,ye);t=new Q({directoryName:r});break}case Xs:t=new Q({dNSName:e[1]});break;case eo:t=new Q({rfc822Name:e[1]});break;case io:{const i=new RegExp(ju,"i").exec(e[1]);if(!i)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const r=i.slice(1).map((s,a)=>a<3?W.ToHex(new Uint8Array(W.FromHex(s)).reverse()):s).join("");t=new Q({otherName:new ai({typeId:zu,value:U.serialize(new re(W.FromHex(r)))})});break}case to:t=new Q({iPAddress:e[1]});break;case Mi:t=new Q({registeredID:e[1]});break;case ro:{t=new Q({otherName:new ai({typeId:Eu,value:U.serialize(xp.toASN(e[1]))})});break}case no:t=new Q({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else L.isBufferSource(e[0])?t=U.parse(e[0],Q):t=e[0];super(t)}onInit(e){if(e.dNSName!=null)this.type=Xs,this.value=e.dNSName;else if(e.rfc822Name!=null)this.type=eo,this.value=e.rfc822Name;else if(e.iPAddress!=null)this.type=to,this.value=e.iPAddress;else if(e.uniformResourceIdentifier!=null)this.type=no,this.value=e.uniformResourceIdentifier;else if(e.registeredID!=null)this.type=Mi,this.value=e.registeredID;else if(e.directoryName!=null)this.type=Qs,this.value=new We(e.directoryName).toString();else if(e.otherName!=null)if(e.otherName.typeId===zu){this.type=io;const t=U.parse(e.otherName.value,re),i=new RegExp(ju,"i").exec(W.ToHex(t));if(!i)throw new Error($_);this.value=i.slice(1).map((r,s)=>s<3?W.ToHex(new Uint8Array(W.FromHex(r)).reverse()):r).join("-")}else if(e.otherName.typeId===Eu)this.type=ro,this.value=U.parse(e.otherName.value,ze).toString();else throw new Error(Iu);else throw new Error(Iu)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case Qs:case Xs:case io:case to:case Mi:case ro:case no:e=this.type.toUpperCase();break;case eo:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let t=this.value;return this.type===Mi&&(t=Vt.toString(t)),new ae(e,void 0,t)}}class gi extends Mt{constructor(e){let t;if(e instanceof Oe)t=e;else if(Array.isArray(e)){const i=[];for(const r of e)if(r instanceof Q)i.push(r);else{const s=U.parse(new Ot(r.type,r.value).rawData,Q);i.push(s)}t=new Oe(i)}else if(L.isBufferSource(e))t=U.parse(e,Oe);else throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");super(t)}onInit(e){const t=[];for(const i of e){let r=null;try{r=new Ot(i)}catch{continue}t.push(r)}this.items=t}toJSON(){return this.items.map(e=>e.toJSON())}toTextObject(){const e=super.toTextObjectEmpty();for(const t of this.items){const i=t.toTextObject();let r=e[i[ae.NAME]];Array.isArray(r)||(r=[],e[i[ae.NAME]]=r),r.push(i)}return e}}gi.NAME="GeneralNames";const ni="-{5}",_i="\\n",C_=`[^${_i}]+`,O_=`${ni}BEGIN (${C_}(?=${ni}))${ni}`,B_=`${ni}END \\1${ni}`,Nn="\\n",N_=`[^:${_i}]+`,R_=`(?:[^${_i}]+${Nn}(?: +[^${_i}]+${Nn})*)`,T_="[a-zA-Z0-9=+/]+",P_=`(?:${T_}${Nn})+`,$u=`${O_}${Nn}(?:((?:${N_}: ${R_})+))?${Nn}?(${P_})${B_}`;class He{static isPem(e){return typeof e=="string"&&new RegExp($u,"g").test(e)}static decodeWithHeaders(e){e=e.replace(/\r/g,"");const t=new RegExp($u,"g"),i=[];let r=null;for(;r=t.exec(e);){const s=r[3].replace(new RegExp(`[${_i}]+`,"g"),""),a={type:r[1],headers:[],rawData:W.FromBase64(s)},c=r[2];if(c){const l=c.split(new RegExp(Nn,"g"));let d=null;for(const h of l){const[g,y]=h.split(/:(.*)/);if(y===void 0){if(!d)throw new Error("Cannot parse PEM string. Incorrect header value");d.value+=g.trim()}else d&&a.headers.push(d),d={key:g,value:y.trim()}}d&&a.headers.push(d)}i.push(a)}return i}static decode(e){return this.decodeWithHeaders(e).map(i=>i.rawData)}static decodeFirst(e){const t=this.decode(e);if(!t.length)throw new RangeError("PEM string doesn't contain any objects");return t[0]}static encode(e,t){if(Array.isArray(e)){const i=new Array;return t?e.forEach(r=>{if(!L.isBufferSource(r))throw new TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");i.push(this.encodeStruct({type:t,rawData:L.toArrayBuffer(r)}))}):e.forEach(r=>{if(!("type"in r))throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");i.push(this.encodeStruct(r))}),i.join(`
120
- `)}else{if(!t)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:t,rawData:L.toArrayBuffer(e)})}}static encodeStruct(e){var t;const i=e.type.toLocaleUpperCase(),r=[];if(r.push(`-----BEGIN ${i}-----`),!((t=e.headers)===null||t===void 0)&&t.length){for(const d of e.headers)r.push(`${d.key}: ${d.value}`);r.push("")}const s=W.ToBase64(e.rawData);let a,c=0;const l=Array();for(;c<s.length&&(s.length-c<64?a=s.substring(c):(a=s.substring(c,c+64),c+=64),a.length!==0);)if(l.push(a),a.length<64)break;return r.push(...l),r.push(`-----END ${i}-----`),r.join(`
121
- `)}}He.CertificateTag="CERTIFICATE";He.CrlTag="CRL";He.CertificateRequestTag="CERTIFICATE REQUEST";He.PublicKeyTag="PUBLIC KEY";He.PrivateKeyTag="PRIVATE KEY";class At extends Mt{static isAsnEncoded(e){return L.isBufferSource(e)||typeof e=="string"}static toArrayBuffer(e){if(typeof e=="string"){if(He.isPem(e))return He.decode(e)[0];if(W.isHex(e))return W.FromHex(e);if(W.isBase64(e))return W.FromBase64(e);if(W.isBase64Url(e))return W.FromBase64Url(e);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}else{const t=W.ToBinary(e);return He.isPem(t)?He.decode(t)[0]:W.isHex(t)?W.FromHex(t):W.isBase64(t)?W.FromBase64(t):W.isBase64Url(t)?W.FromBase64Url(t):L.toArrayBuffer(e)}}constructor(...e){At.isAsnEncoded(e[0])?super(At.toArrayBuffer(e[0]),e[1]):super(e[0])}toString(e="pem"){switch(e){case"pem":return He.encode(this.rawData,this.tag);default:return super.toString(e)}}}class rt extends At{static async create(e,t=Ae.get()){if(e instanceof rt)return e;if(Ct.isCryptoKey(e)){if(e.type!=="public")throw new TypeError("Public key is required");const i=await t.subtle.exportKey("spki",e);return new rt(i)}else{if(e.publicKey)return e.publicKey;if(L.isBufferSource(e))return new rt(e);throw new TypeError("Unsupported PublicKeyType")}}constructor(e){At.isAsnEncoded(e)?super(e,it):super(e),this.tag=He.PublicKeyTag}async export(...e){let t,i=["verify"],r={hash:"SHA-256",...this.algorithm};e.length>1?(r=e[0]||r,i=e[1]||i,t=e[2]||Ae.get()):t=e[0]||Ae.get();let s=this.rawData;const a=U.parse(this.rawData,it);return a.algorithm.algorithm===ti&&(s=U_(a,s)),t.subtle.importKey("spki",s,r,!0,i)}onInit(e){const t=Ee.resolve(un),i=this.algorithm=t.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case an:{const r=U.parse(e.subjectPublicKey,bc),s=L.toUint8Array(r.modulus);i.publicExponent=L.toUint8Array(r.publicExponent),i.modulusLength=(s[0]?s:s.slice(1)).byteLength<<3;break}}}async getThumbprint(...e){var t;let i,r="SHA-1";return e.length>=1&&!(!((t=e[0])===null||t===void 0)&&t.subtle)?(r=e[0]||r,i=e[1]||Ae.get()):i=e[0]||Ae.get(),await i.subtle.digest(r,this.rawData)}async getKeyIdentifier(...e){let t,i="SHA-1";e.length===1?typeof e[0]=="string"?(i=e[0],t=Ae.get()):t=e[0]:e.length===2?(i=e[0],t=e[1]):t=Ae.get();const r=U.parse(this.rawData,it);return await t.subtle.digest(i,r.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),t=U.parse(this.rawData,it);switch(e.Algorithm=dn.serializeAlgorithm(t.algorithm),t.algorithm.algorithm){case di:e["EC Point"]=t.subjectPublicKey;break;case an:default:e["Raw Data"]=t.subjectPublicKey}return e}}function U_(n,e){return n.algorithm=new M({algorithm:an,parameters:null}),e=U.serialize(n),e}class mi extends Ye{static async create(e,t=!1,i=Ae.get()){if("name"in e&&"serialNumber"in e)return new mi(e,t);const s=await(await rt.create(e,i)).getKeyIdentifier(i);return new mi(W.ToHex(s),t)}constructor(...e){if(L.isBufferSource(e[0]))super(e[0]);else if(typeof e[0]=="string"){const t=new Gt({keyIdentifier:new nc(W.FromHex(e[0]))});super(xo,e[1],U.serialize(t))}else{const t=e[0],i=t.name instanceof gi?U.parse(t.name.rawData,Oe):t.name,r=new Gt({authorityCertIssuer:i,authorityCertSerialNumber:W.FromHex(t.serialNumber)});super(xo,e[1],U.serialize(r))}}onInit(e){super.onInit(e);const t=U.parse(e.extnValue,Gt);t.keyIdentifier&&(this.keyId=W.ToHex(t.keyIdentifier)),(t.authorityCertIssuer||t.authorityCertSerialNumber)&&(this.certId={name:t.authorityCertIssuer||[],serialNumber:t.authorityCertSerialNumber?W.ToHex(t.authorityCertSerialNumber):""})}toTextObject(){const e=this.toTextObjectWithoutValue(),t=U.parse(this.value,Gt);return t.authorityCertIssuer&&(e["Authority Issuer"]=new gi(t.authorityCertIssuer).toTextObject()),t.authorityCertSerialNumber&&(e["Authority Serial Number"]=t.authorityCertSerialNumber),t.keyIdentifier&&(e[""]=t.keyIdentifier),e}}mi.NAME="Authority Key Identifier";class Ac extends Ye{constructor(...e){if(L.isBufferSource(e[0])){super(e[0]);const t=U.parse(this.value,gr);this.ca=t.cA,this.pathLength=t.pathLenConstraint}else{const t=new gr({cA:e[0],pathLenConstraint:e[1]});super(Ip,e[2],U.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}}Ac.NAME="Basic Constraints";var Cu;(function(n){n.serverAuth="1.3.6.1.5.5.7.3.1",n.clientAuth="1.3.6.1.5.5.7.3.2",n.codeSigning="1.3.6.1.5.5.7.3.3",n.emailProtection="1.3.6.1.5.5.7.3.4",n.timeStamping="1.3.6.1.5.5.7.3.8",n.ocspSigning="1.3.6.1.5.5.7.3.9"})(Cu||(Cu={}));class Ic extends Ye{constructor(...e){if(L.isBufferSource(e[0])){super(e[0]);const t=U.parse(this.value,vr);this.usages=t.map(i=>i)}else{const t=new vr(e[0]);super(Ep,e[1],U.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(t=>Vt.toString(t)).join(", "),e}}Ic.NAME="Extended Key Usages";var Kr;(function(n){n[n.digitalSignature=1]="digitalSignature",n[n.nonRepudiation=2]="nonRepudiation",n[n.keyEncipherment=4]="keyEncipherment",n[n.dataEncipherment=8]="dataEncipherment",n[n.keyAgreement=16]="keyAgreement",n[n.keyCertSign=32]="keyCertSign",n[n.cRLSign=64]="cRLSign",n[n.encipherOnly=128]="encipherOnly",n[n.decipherOnly=256]="decipherOnly"})(Kr||(Kr={}));class jc extends Ye{constructor(...e){if(L.isBufferSource(e[0])){super(e[0]);const t=U.parse(this.value,Ys);this.usages=t.toNumber()}else{const t=new Ys(e[0]);super($p,e[1],U.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=U.parse(this.value,Ys);return e[""]=t.toJSON().join(", "),e}}jc.NAME="Key Usages";class Ti extends Ye{static async create(e,t=!1,i=Ae.get()){const s=await(await rt.create(e,i)).getKeyIdentifier(i);return new Ti(W.ToHex(s),t)}constructor(...e){if(L.isBufferSource(e[0])){super(e[0]);const t=U.parse(this.value,Nt);this.keyId=W.ToHex(t)}else{const t=typeof e[0]=="string"?W.FromHex(e[0]):e[0],i=new Nt(t);super(Np,e[1],U.serialize(i)),this.keyId=W.ToHex(t)}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=U.parse(this.value,Nt);return e[""]=t,e}}Ti.NAME="Subject Key Identifier";class lf extends Ye{constructor(...e){L.isBufferSource(e[0])?super(e[0]):super(Bp,e[1],new gi(e[0]||[]).rawData)}onInit(e){super.onInit(e);const t=U.parse(e.extnValue,Uo);this.names=new gi(t)}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.names.toTextObject();for(const i in t)e[i]=t[i];return e}}lf.NAME="Subject Alternative Name";class Xe{static register(e,t){this.items.set(e,t)}static create(e){const t=new Ye(e),i=this.items.get(t.type);return i?new i(e):t}}Xe.items=new Map;class uf extends Ye{constructor(...e){var t;if(L.isBufferSource(e[0])){super(e[0]);const i=U.parse(this.value,mr);this.policies=i.map(r=>r.policyIdentifier)}else{const i=e[0],r=(t=e[1])!==null&&t!==void 0?t:!1,s=new mr(i.map(a=>new ys({policyIdentifier:a})));super(jp,r,U.serialize(s)),this.policies=i}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(t=>new ae("",{},Vt.toString(t))),e}}uf.NAME="Certificate Policies";Xe.register(jp,uf);class df extends Ye{constructor(...e){var t;if(L.isBufferSource(e[0]))super(e[0]);else if(Array.isArray(e[0])&&typeof e[0][0]=="string"){const r=e[0].map(a=>new Dn({distributionPoint:new nn({fullName:[new Q({uniformResourceIdentifier:a})]})})),s=new kn(r);super(zo,e[1],U.serialize(s))}else{const i=new kn(e[0]);super(zo,e[1],U.serialize(i))}(t=this.distributionPoints)!==null&&t!==void 0||(this.distributionPoints=[])}onInit(e){super.onInit(e);const t=U.parse(e.extnValue,kn);this.distributionPoints=t}toTextObject(){const e=this.toTextObjectWithoutValue();return e["Distribution Point"]=this.distributionPoints.map(t=>{var i;const r={};return t.distributionPoint&&(r[""]=(i=t.distributionPoint.fullName)===null||i===void 0?void 0:i.map(s=>new Ot(s).toString()).join(", ")),t.reasons&&(r.Reasons=t.reasons.toString()),t.cRLIssuer&&(r["CRL Issuer"]=t.cRLIssuer.map(s=>s.toString()).join(", ")),r}),e}}df.NAME="CRL Distribution Points";class pf extends Ye{constructor(...e){var t,i,r,s;if(L.isBufferSource(e[0]))super(e[0]);else if(e[0]instanceof vn){const a=new vn(e[0]);super(ko,e[1],U.serialize(a))}else{const a=e[0],c=new vn;qi(c,a,hl,"ocsp"),qi(c,a,gl,"caIssuers"),qi(c,a,_l,"timeStamping"),qi(c,a,ml,"caRepository"),super(ko,e[1],U.serialize(c))}(t=this.ocsp)!==null&&t!==void 0||(this.ocsp=[]),(i=this.caIssuers)!==null&&i!==void 0||(this.caIssuers=[]),(r=this.timeStamping)!==null&&r!==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=[],U.parse(e.extnValue,vn).forEach(i=>{switch(i.accessMethod){case hl:this.ocsp.push(new Ot(i.accessLocation));break;case gl:this.caIssuers.push(new Ot(i.accessLocation));break;case _l:this.timeStamping.push(new Ot(i.accessLocation));break;case ml:this.caRepository.push(new Ot(i.accessLocation));break}})}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ocsp.length&&Hi(e,"OCSP",this.ocsp),this.caIssuers.length&&Hi(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&Hi(e,"Time Stamping",this.timeStamping),this.caRepository.length&&Hi(e,"CA Repository",this.caRepository),e}}pf.NAME="Authority Info Access";function Hi(n,e,t){if(t.length===1)n[e]=t[0].toTextObject();else{const i=new ae("");t.forEach((r,s)=>{const a=r.toTextObject(),c=`${a[ae.NAME]} ${s+1}`;let l=i[c];Array.isArray(l)||(l=[],i[c]=l),l.push(a)}),n[e]=i}}function qi(n,e,t,i){const r=e[i];r&&(Array.isArray(r)?r:[r]).forEach(a=>{typeof a=="string"&&(a=new Ot("url",a)),n.push(new xi({accessMethod:t,accessLocation:U.parse(a.rawData,Q)}))})}class Wn extends Mt{constructor(...e){let t;if(L.isBufferSource(e[0]))t=L.toArrayBuffer(e[0]);else{const i=e[0],r=Array.isArray(e[1])?e[1].map(s=>L.toArrayBuffer(s)):[];t=U.serialize(new kt({type:i,values:r}))}super(t,kt)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Value=this.values.map(t=>new ae("",{"":t})),e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty();return e[ae.NAME]===Wn.NAME&&(e[ae.NAME]=Vt.toString(this.type)),e}}Wn.NAME="Attribute";class ff extends Wn{constructor(...e){var t;if(L.isBufferSource(e[0]))super(e[0]);else{const i=new Hr({printableString:e[0]});super(nf,[U.serialize(i)])}(t=this.password)!==null&&t!==void 0||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){const t=U.parse(this.values[0],Hr);this.password=t.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[ae.VALUE]=this.password,e}}ff.NAME="Challenge Password";class zc extends Wn{constructor(...e){var t;if(L.isBufferSource(e[0]))super(e[0]);else{const i=e[0],r=new Tt;for(const s of i)r.push(U.parse(s.rawData,Je));super(Sc,[U.serialize(r)])}(t=this.items)!==null&&t!==void 0||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){const t=U.parse(this.values[0],Tt);this.items=t.map(i=>Xe.create(U.serialize(i)))}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.items.map(i=>i.toTextObject());for(const i of t)e[i[ae.NAME]]=i;return e}}zc.NAME="Extensions";class Vs{static register(e,t){this.items.set(e,t)}static create(e){const t=new Wn(e),i=this.items.get(t.type);return i?new i(e):t}}Vs.items=new Map;const Pi="crypto.signatureFormatter";class L_{toAsnSignature(e,t){return L.toArrayBuffer(t)}toWebSignature(e,t){return L.toArrayBuffer(t)}}var Yi;let za=Yi=class{static createPssParams(e,t){const i=Yi.getHashAlgorithm(e);return i?new ln({hashAlgorithm:i,maskGenAlgorithm:new M({algorithm:Os,parameters:U.serialize(i)}),saltLength:t}):null}static getHashAlgorithm(e){const t=Ee.resolve(un);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 M({algorithm:Br,parameters:null});case"sha-256":return new M({algorithm:sa,parameters:null});case"sha-384":return new M({algorithm:Nr,parameters:null});case"sha-512":return new M({algorithm:Rr,parameters:null})}}else return new M({algorithm:an,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=Yi.createPssParams(e.hash,e.saltLength);if(!t)throw new Error("Cannot create PSS parameters");return new M({algorithm:ti,parameters:U.serialize(t)})}else return new M({algorithm:ti,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case an:return{name:"RSASSA-PKCS1-v1_5"};case Br:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case sa:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case Nr:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case Rr:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case ti:if(e.parameters){const t=U.parse(e.parameters,ln);return{name:"RSA-PSS",hash:Ee.resolve(un).toWebAlgorithm(t.hashAlgorithm),saltLength:t.saltLength}}else return{name:"RSA-PSS"}}return null}};za=Yi=u([Ts()],za);Ee.registerSingleton(Ri,za);let Ea=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new M({algorithm:Tr});case"sha-256":return new M({algorithm:Pr});case"sha-384":return new M({algorithm:Ur});case"sha-512":return new M({algorithm:Lr})}return null}toWebAlgorithm(e){switch(e.algorithm){case Tr:return{name:"SHA-1"};case Pr:return{name:"SHA-256"};case Ur:return{name:"SHA-384"};case Lr:return{name:"SHA-512"}}return null}};Ea=u([Ts()],Ea);Ee.registerSingleton(Ri,Ea);class Ge{addPadding(e,t){const i=L.toUint8Array(t),r=new Uint8Array(e);return r.set(i,e-i.length),r}removePadding(e,t=!1){let i=L.toUint8Array(e);for(let r=0;r<i.length;r++)if(i[r]){i=i.slice(r);break}if(t&&i[0]>127){const r=new Uint8Array(i.length+1);return r.set(i,1),r.buffer}return i.buffer}toAsnSignature(e,t){if(e.name==="ECDSA"){const i=e.namedCurve,r=Ge.namedCurveSize.get(i)||Ge.defaultNamedCurveSize,s=new Or,a=L.toUint8Array(t);return s.r=this.removePadding(a.slice(0,r),!0),s.s=this.removePadding(a.slice(r,r+r),!0),U.serialize(s)}return null}toWebSignature(e,t){if(e.name==="ECDSA"){const i=U.parse(t,Or),r=e.namedCurve,s=Ge.namedCurveSize.get(r)||Ge.defaultNamedCurveSize,a=this.addPadding(s,this.removePadding(i.r)),c=this.addPadding(s,this.removePadding(i.s));return Xh(a,c)}return null}}Ge.namedCurveSize=new Map;Ge.defaultNamedCurveSize=32;const so="1.3.101.110",Ou="1.3.101.111",oo="1.3.101.112",Bu="1.3.101.113";let $a=class{toAsnAlgorithm(e){let t=null;switch(e.name.toLowerCase()){case"ed25519":t=oo;break;case"x25519":t=so;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":t=oo;break;case"ed448":t=Bu;break}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":t=so;break;case"x448":t=Ou;break}}return t?new M({algorithm:t}):null}toWebAlgorithm(e){switch(e.algorithm){case oo:return{name:"Ed25519"};case Bu:return{name:"EdDSA",namedCurve:"Ed448"};case so:return{name:"X25519"};case Ou:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};$a=u([Ts()],$a);Ee.registerSingleton(Ri,$a);class D_ extends At{constructor(e){At.isAsnEncoded(e)?super(e,fi):super(e),this.tag=He.CertificateRequestTag}onInit(e){this.tbs=U.serialize(e.certificationRequestInfo),this.publicKey=new rt(e.certificationRequestInfo.subjectPKInfo);const t=Ee.resolve(un);this.signatureAlgorithm=t.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signature,this.attributes=e.certificationRequestInfo.attributes.map(r=>Vs.create(U.serialize(r)));const i=this.getAttribute(Sc);this.extensions=[],i instanceof zc&&(this.extensions=i.items),this.subjectName=new We(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=Ae.get()){const t={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(t,["verify"],e),r=Ee.resolveAll(Pi).reverse();let s=null;for(const c of r)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,i,s,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),t=U.parse(this.rawData,fi),i=t.certificationRequestInfo,r=new ae("",{Version:`${rn[i.version]} (${i.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const s=new ae("");for(const a of this.attributes){const c=a.toTextObject();s[c[ae.NAME]]=c}r.Attributes=s}return e.Data=r,e.Signature=new ae("",{Algorithm:dn.serializeAlgorithm(t.signatureAlgorithm),"":t.signature}),e}}D_.NAME="PKCS#10 Certificate Request";class Ec extends At{constructor(e){At.isAsnEncoded(e)?super(e,sn):super(e),this.tag=He.CertificateTag}onInit(e){const t=e.tbsCertificate;this.tbs=U.serialize(t),this.serialNumber=W.ToHex(t.serialNumber),this.subjectName=new We(t.subject),this.subject=new We(t.subject).toString(),this.issuerName=new We(t.issuer),this.issuer=this.issuerName.toString();const i=Ee.resolve(un);this.signatureAlgorithm=i.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signatureValue;const r=t.validity.notBefore.utcTime||t.validity.notBefore.generalTime;if(!r)throw new Error("Cannot get 'notBefore' value");this.notBefore=r;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(a=>Xe.create(U.serialize(a)))),this.publicKey=new rt(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=Ae.get()){let i,r;const s=e.publicKey;try{if(!s)i={...this.publicKey.algorithm,...this.signatureAlgorithm},r=await this.publicKey.export(i,["verify"],t);else if("publicKey"in s)i={...s.publicKey.algorithm,...this.signatureAlgorithm},r=await s.publicKey.export(i,["verify"],t);else if(s instanceof rt)i={...s.algorithm,...this.signatureAlgorithm},r=await s.export(i,["verify"],t);else if(L.isBufferSource(s)){const d=new rt(s);i={...d.algorithm,...this.signatureAlgorithm},r=await d.export(i,["verify"],t)}else i={...s.algorithm,...this.signatureAlgorithm},r=s}catch{return!1}const a=Ee.resolveAll(Pi).reverse();let c=null;for(const d of a)if(c=d.toWebSignature(i,this.signature),c)break;if(!c)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const l=await t.subtle.verify(this.signatureAlgorithm,r,c,this.tbs);if(e.signatureOnly)return l;{const h=(e.date||new Date).getTime();return l&&this.notBefore.getTime()<h&&h<this.notAfter.getTime()}}async getThumbprint(...e){let t,i="SHA-1";return e[0]&&(e[0].subtle?t=e[0]:(i=e[0]||i,t=e[1])),t??(t=Ae.get()),await t.subtle.digest(i,this.rawData)}async isSelfSigned(e=Ae.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){const e=this.toTextObjectEmpty(),t=U.parse(this.rawData,sn),i=t.tbsCertificate,r=new ae("",{Version:`${rn[i.version]} (${i.version})`,"Serial Number":i.serialNumber,"Signature Algorithm":dn.serializeAlgorithm(i.signature),Issuer:this.issuer,Validity:new ae("",{"Not Before":i.validity.notBefore.getTime(),"Not After":i.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(i.issuerUniqueID&&(r["Issuer Unique ID"]=i.issuerUniqueID),i.subjectUniqueID&&(r["Subject Unique ID"]=i.subjectUniqueID),this.extensions.length){const s=new ae("");for(const a of this.extensions){const c=a.toTextObject();s[c[ae.NAME]]=c}r.Extensions=s}return e.Data=r,e.Signature=new ae("",{Algorithm:dn.serializeAlgorithm(t.signatureAlgorithm),"":t.signatureValue}),e}}Ec.NAME="Certificate";class V_{static async createSelfSigned(e,t=Ae.get()){if(!e.keys.privateKey)throw new Error("Bad field 'keys' in 'params' argument. 'privateKey' is empty");if(!e.keys.publicKey)throw new Error("Bad field 'keys' in 'params' argument. 'publicKey' is empty");return this.create({serialNumber:e.serialNumber,subject:e.name,issuer:e.name,notBefore:e.notBefore,notAfter:e.notAfter,publicKey:e.keys.publicKey,signingKey:e.keys.privateKey,signingAlgorithm:e.signingAlgorithm,extensions:e.extensions},t)}static async create(e,t=Ae.get()){var i;let r;e.publicKey instanceof rt?r=e.publicKey.rawData:"publicKey"in e.publicKey?r=e.publicKey.publicKey.rawData:L.isBufferSource(e.publicKey)?r=e.publicKey:r=await t.subtle.exportKey("spki",e.publicKey);const s=e.serialNumber?L.toUint8Array(W.FromHex(e.serialNumber)):t.getRandomValues(new Uint8Array(16));s[0]>127&&(s[0]&=127),s.length>1&&s[0]===0&&(s[1]|=128);const a=e.notBefore||new Date,c=e.notAfter||new Date(a.getTime()+31536e6),l=new sn({tbsCertificate:new Ke({version:rn.v3,serialNumber:s,validity:new Si({notBefore:a,notAfter:c}),extensions:new Tt(((i=e.extensions)===null||i===void 0?void 0:i.map(k=>U.parse(k.rawData,Je)))||[]),subjectPublicKeyInfo:U.parse(r,it)})});if(e.subject){const k=e.subject instanceof We?e.subject:new We(e.subject);l.tbsCertificate.subject=U.parse(k.toArrayBuffer(),ye)}if(e.issuer){const k=e.issuer instanceof We?e.issuer:new We(e.issuer);l.tbsCertificate.issuer=U.parse(k.toArrayBuffer(),ye)}const d={hash:"SHA-256"},h="signingKey"in e?{...d,...e.signingAlgorithm,...e.signingKey.algorithm}:{...d,...e.signingAlgorithm},g=Ee.resolve(un);l.tbsCertificate.signature=l.signatureAlgorithm=g.toAsnAlgorithm(h);const y=U.serialize(l.tbsCertificate),I="signingKey"in e?await t.subtle.sign(h,e.signingKey,y):e.signature,f=Ee.resolveAll(Pi).reverse();let _=null;for(const k of f)if(_=k.toAsnSignature(h,I),_)break;if(!_)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return l.signatureValue=_,new Ec(U.serialize(l))}}var Nu;(function(n){n[n.unspecified=0]="unspecified",n[n.keyCompromise=1]="keyCompromise",n[n.cACompromise=2]="cACompromise",n[n.affiliationChanged=3]="affiliationChanged",n[n.superseded=4]="superseded",n[n.cessationOfOperation=5]="cessationOfOperation",n[n.certificateHold=6]="certificateHold",n[n.removeFromCRL=8]="removeFromCRL",n[n.privilegeWithdrawn=9]="privilegeWithdrawn",n[n.aACompromise=10]="aACompromise"})(Nu||(Nu={}));Xe.register(Ip,Ac);Xe.register(Ep,Ic);Xe.register($p,jc);Xe.register(Np,Ti);Xe.register(xo,mi);Xe.register(Bp,lf);Xe.register(zo,df);Xe.register(ko,pf);Vs.register(nf,ff);Vs.register(Sc,zc);Ee.registerSingleton(Pi,L_);Ee.registerSingleton(Pi,Ge);Ge.namedCurveSize.set("P-256",32);Ge.namedCurveSize.set("K-256",32);Ge.namedCurveSize.set("P-384",48);Ge.namedCurveSize.set("P-521",66);const Ru="0123456789abcdef";function Ca(n){const e=new Uint8Array(n);let t="";for(let i=0;i<e.length;i++){const r=e[i]>>4;t+=Ru[r];const s=e[i]&15;t+=Ru[s]}return t}class hf{constructor(e,t){te(this,"alphabet");te(this,"padding");te(this,"decodeMap",new Map);if(e.length!==32)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(t==null?void 0:t.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let i=0;i<e.length;i++)this.decodeMap.set(e[i],i)}encode(e,t){let i="",r=0,s=0;for(let c=0;c<e.length;c++)for(r=r<<8|e[c],s+=8;s>=5;)s-=5,i+=this.alphabet[r>>s&31];if(s>0&&(i+=this.alphabet[r<<5-s&31]),(t==null?void 0:t.includePadding)??!0){const c=(8-i.length%8)%8;for(let l=0;l<c;l++)i+="="}return i}decode(e,t){const i=(t==null?void 0:t.strict)??!0,r=Math.ceil(e.length/8),s=[];for(let a=0;a<r;a++){let c=0;const l=[];for(let h=0;h<8;h++){const g=e[a*8+h];if(g==="="){if(a+1!==r)throw new Error(`Invalid character: ${g}`);c+=1;continue}if(g===void 0){if(i)throw new Error("Invalid data");c+=1;continue}const y=this.decodeMap.get(g)??null;if(y===null)throw new Error(`Invalid character: ${g}`);l.push(y)}if(c===8||c===7||c===5||c===2)throw new Error("Invalid padding");const d=(l[0]<<3)+(l[1]>>2);if(s.push(d),c<6){const h=((l[1]&3)<<6)+(l[2]<<1)+(l[3]>>4);s.push(h)}if(c<4){const h=((l[3]&255)<<4)+(l[4]>>1);s.push(h)}if(c<3){const h=((l[4]&1)<<7)+(l[5]<<2)+(l[6]>>3);s.push(h)}if(c<1){const h=((l[6]&7)<<5)+l[7];s.push(h)}}return Uint8Array.from(s)}}new hf("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567");new hf("0123456789ABCDEFGHIJKLMNOPQRSTUV");class gf{constructor(e,t){te(this,"alphabet");te(this,"padding");te(this,"decodeMap",new Map);if(e.length!==64)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(t==null?void 0:t.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let i=0;i<e.length;i++)this.decodeMap.set(e[i],i)}encode(e,t){let i="",r=0,s=0;for(let c=0;c<e.length;c++)for(r=r<<8|e[c],s+=8;s>=6;)s+=-6,i+=this.alphabet[r>>s&63];if(s>0&&(i+=this.alphabet[r<<6-s&63]),(t==null?void 0:t.includePadding)??!0){const c=(4-i.length%4)%4;for(let l=0;l<c;l++)i+="="}return i}decode(e,t){const i=(t==null?void 0:t.strict)??!0,r=Math.ceil(e.length/4),s=[];for(let a=0;a<r;a++){let c=0,l=0;for(let d=0;d<4;d++){const h=e[a*4+d];if(h==="="){if(a+1!==r)throw new Error(`Invalid character: ${h}`);c+=1;continue}if(h===void 0){if(i)throw new Error("Invalid data");c+=1;continue}const g=this.decodeMap.get(h)??null;if(g===null)throw new Error(`Invalid character: ${h}`);l+=g<<6*(3-d)}s.push(l>>16&255),c<2&&s.push(l>>8&255),c<1&&s.push(l&255)}return Uint8Array.from(s)}}const M_=new gf("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Yt=new gf("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");class H_{constructor(e){te(this,"hash");this.hash=e}async verify(e,t,i){const r=await crypto.subtle.importKey("spki",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["verify"]);return await crypto.subtle.verify("RSASSA-PKCS1-v1_5",r,t,i)}async sign(e,t){const i=await crypto.subtle.importKey("pkcs8",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["sign"]);return await crypto.subtle.sign("RSASSA-PKCS1-v1_5",i,t)}async generateKeyPair(e){const t=await crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",hash:this.hash,modulusLength:e??2048,publicExponent:new Uint8Array([1,0,1])},!0,["sign"]),i=await crypto.subtle.exportKey("pkcs8",t.privateKey),r=await crypto.subtle.exportKey("spki",t.publicKey);return{privateKey:i,publicKey:r}}}async function _f(n){return await crypto.subtle.digest("SHA-256",n)}async function Oa(n){const e={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",publicExponent:new Uint8Array([1,0,1]),modulusLength:2048},t=await crypto.subtle.generateKey(e,!0,["sign","verify"]),i=st(),r=Ca(new TextEncoder().encode(i)),s=await V_.createSelfSigned({serialNumber:r,name:n.name,notBefore:new Date,notAfter:new Date(Date.now()+365*24*60*60*1e3),signingAlgorithm:e,keys:t,extensions:[new Ac(!0,2,!0),new Ic(["1.3.6.1.5.5.7.3.1"],!0),new jc(Kr.keyCertSign|Kr.cRLSign,!0),await Ti.create(t.publicKey)]}),a=await crypto.subtle.exportKey("pkcs8",t.privateKey),c=s.toString("pem"),l=await K_(s),d=Ca(await s.getThumbprint()),h=q_("PRIVATE",a);return{kid:s.serialNumber,cert:c,thumbprint:d,fingerprint:l,pkcs7:h}}function q_(n,e){const t=M_.encode(new Uint8Array(e));let i=`-----BEGIN ${n} KEY-----\r
117
+ */const Mi="crypto.algorithm";class G_{getAlgorithms(){return je.resolveAll(Mi)}toAsnAlgorithm(e){({...e});for(const t of this.getAlgorithms()){const i=t.toAsnAlgorithm(e);if(i)return i}if(/^[0-9.]+$/.test(e.name)){const t=new H({algorithm:e.name});if("parameters"in e){const i=e;t.parameters=i.parameters}return t}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(e){for(const i of this.getAlgorithms()){const r=i.toWebAlgorithm(e);if(r)return r}return{name:e.algorithm,parameters:e.parameters}}}const gn="crypto.algorithmProvider";je.registerSingleton(gn,G_);var nr;const He="1.3.36.3.3.2.8.1.1",du=`${He}.1`,pu=`${He}.2`,fu=`${He}.3`,hu=`${He}.4`,gu=`${He}.5`,_u=`${He}.6`,mu=`${He}.7`,yu=`${He}.8`,vu=`${He}.9`,wu=`${He}.10`,bu=`${He}.11`,ku=`${He}.12`,xu=`${He}.13`,Su=`${He}.14`,Au="brainpoolP160r1",Iu="brainpoolP160t1",Eu="brainpoolP192r1",$u="brainpoolP192t1",Cu="brainpoolP224r1",ju="brainpoolP224t1",zu="brainpoolP256r1",Nu="brainpoolP256t1",Ou="brainpoolP320r1",Bu="brainpoolP320t1",Tu="brainpoolP384r1",Ru="brainpoolP384t1",Pu="brainpoolP512r1",Lu="brainpoolP512t1",ge="ECDSA";let wi=nr=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case ge.toLowerCase():if("hash"in e)switch((typeof e.hash=="string"?e.hash:e.hash.name).toLowerCase()){case"sha-1":return y_;case"sha-256":return v_;case"sha-384":return w_;case"sha-512":return b_}else if("namedCurve"in e){let t="";switch(e.namedCurve){case"P-256":t=Hl;break;case"K-256":t=nr.SECP256K1;break;case"P-384":t=Dl;break;case"P-521":t=Fl;break;case Au:t=du;break;case Iu:t=pu;break;case Eu:t=fu;break;case $u:t=hu;break;case Cu:t=gu;break;case ju:t=_u;break;case zu:t=mu;break;case Nu:t=yu;break;case Ou:t=vu;break;case Bu:t=wu;break;case Tu:t=bu;break;case Ru:t=ku;break;case Pu:t=xu;break;case Lu:t=Su;break}if(t)return new H({algorithm:mi,parameters:L.serialize(new Vt({namedCurve:t}))})}}return null}toWebAlgorithm(e){switch(e.algorithm){case Ic:return{name:ge,hash:{name:"SHA-1"}};case Ec:return{name:ge,hash:{name:"SHA-256"}};case $c:return{name:ge,hash:{name:"SHA-384"}};case Cc:return{name:ge,hash:{name:"SHA-512"}};case mi:{if(!e.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(L.parse(e.parameters,Vt).namedCurve){case Hl:return{name:ge,namedCurve:"P-256"};case nr.SECP256K1:return{name:ge,namedCurve:"K-256"};case Dl:return{name:ge,namedCurve:"P-384"};case Fl:return{name:ge,namedCurve:"P-521"};case du:return{name:ge,namedCurve:Au};case pu:return{name:ge,namedCurve:Iu};case fu:return{name:ge,namedCurve:Eu};case hu:return{name:ge,namedCurve:$u};case gu:return{name:ge,namedCurve:Cu};case _u:return{name:ge,namedCurve:ju};case mu:return{name:ge,namedCurve:zu};case yu:return{name:ge,namedCurve:Nu};case vu:return{name:ge,namedCurve:Ou};case wu:return{name:ge,namedCurve:Bu};case bu:return{name:ge,namedCurve:Tu};case ku:return{name:ge,namedCurve:Ru};case xu:return{name:ge,namedCurve:Pu};case Su:return{name:ge,namedCurve:Lu}}}}return null}};wi.SECP256K1="1.3.132.0.10";wi=nr=d([Hs()],wi);je.registerSingleton(Mi,wi);const kf=Symbol("name"),xf=Symbol("value");class ae{constructor(e,t={},i=""){this[kf]=e,this[xf]=i;for(const r in t)this[r]=t[r]}}ae.NAME=kf;ae.VALUE=xf;class J_{static toTextObject(e){const t=new ae("Algorithm Identifier",{},Dt.toString(e.algorithm));if(e.parameters)switch(e.algorithm){case mi:{const i=new wi().toWebAlgorithm(e);i&&"namedCurve"in i?t["Named Curve"]=i.namedCurve:t.Parameters=e.parameters;break}default:t.Parameters=e.parameters}return t}}class Dt{static toString(e){const t=this.items[e];return t||e}}Dt.items={[Hr]:"sha1",[lf]:"sha224",[Dr]:"sha256",[Fr]:"sha384",[qr]:"sha512",[pn]:"rsaEncryption",[Ur]:"sha1WithRSAEncryption",[E_]:"sha224WithRSAEncryption",[pa]:"sha256WithRSAEncryption",[Vr]:"sha384WithRSAEncryption",[Mr]:"sha512WithRSAEncryption",[mi]:"ecPublicKey",[Ic]:"ecdsaWithSHA1",[of]:"ecdsaWithSHA224",[Ec]:"ecdsaWithSHA256",[$c]:"ecdsaWithSHA384",[Cc]:"ecdsaWithSHA512",[d_]:"TLS WWW server authentication",[p_]:"TLS WWW client authentication",[f_]:"Code Signing",[h_]:"E-mail Protection",[g_]:"Time Stamping",[__]:"OCSP Signing",[m_]:"Signed Data"};class _n{static serialize(e){return this.serializeObj(e).join(`
118
+ `)}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,t=0){const i=[];let r=this.pad(t++),s="";const o=e[ae.VALUE];o&&(s=` ${o}`),i.push(`${r}${e[ae.NAME]}:${s}`),r=this.pad(t);for(const c in e){if(typeof c=="symbol")continue;const l=e[c],u=c?`${c}: `:"";if(typeof l=="string"||typeof l=="number"||typeof l=="boolean")i.push(`${r}${u}${l}`);else if(l instanceof Date)i.push(`${r}${u}${l.toUTCString()}`);else if(Array.isArray(l))for(const p of l)p[ae.NAME]=c,i.push(...this.serializeObj(p,t));else if(l instanceof ae)l[ae.NAME]=c,i.push(...this.serializeObj(l,t));else if(U.isBufferSource(l))c?(i.push(`${r}${u}`),i.push(...this.serializeBufferSource(l,t+1))):i.push(...this.serializeBufferSource(l,t));else if("toTextObject"in l){const p=l.toTextObject();p[ae.NAME]=c,i.push(...this.serializeObj(p,t))}else throw new TypeError("Cannot serialize data in text format. Unsupported type.")}return i}static serializeBufferSource(e,t=0){const i=this.pad(t),r=U.toUint8Array(e),s=[];for(let o=0;o<r.length;){const c=[];for(let l=0;l<16&&o<r.length;l++){l===8&&c.push("");const u=r[o++].toString(16).padStart(2,"0");c.push(u)}s.push(`${i}${c.join(" ")}`)}return s}static serializeAlgorithm(e){return this.algorithmSerializer.toTextObject(e)}}_n.oidSerializer=Dt;_n.algorithmSerializer=J_;class Ft{constructor(...e){if(e.length===1){const t=e[0];this.rawData=L.serialize(t),this.onInit(t)}else{const t=L.parse(e[0],e[1]);this.rawData=U.toArrayBuffer(e[0]),this.onInit(t)}}equal(e){return e instanceof Ft?Md(e.rawData,this.rawData):!1}toString(e="text"){switch(e){case"asn":return L.toString(this.rawData);case"text":return _n.serialize(this.toTextObject());case"hex":return W.ToHex(this.rawData);case"base64":return W.ToBase64(this.rawData);case"base64url":return W.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 ae(this.getTextName(),{},e)}}Ft.NAME="ASN";class et extends Ft{constructor(...e){let t;U.isBufferSource(e[0])?t=U.toArrayBuffer(e[0]):t=L.serialize(new Xe({extnID:e[0],critical:e[1],extnValue:new re(U.toArrayBuffer(e[2]))})),super(t,Xe)}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[ae.NAME]===et.NAME&&(e[ae.NAME]=Dt.toString(this.type)),e}}var Sf;class Ot{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[Sf]="CryptoProvider",typeof self<"u"&&typeof crypto<"u"?this.set(Ot.DEFAULT,crypto):typeof global<"u"&&global.crypto&&global.crypto.subtle&&this.set(Ot.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=Ot.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(Ot.DEFAULT,e);return this}}Sf=Symbol.toStringTag;Ot.DEFAULT="default";const Ie=new Ot,Z_=/^[0-2](?:\.[1-9][0-9]*)+$/;function Y_(n){return new RegExp(Z_).test(n)}class Af{constructor(e={}){this.items={};for(const t in e)this.register(t,e[t])}get(e){return this.items[e]||null}findId(e){return Y_(e)?e:this.get(e)}register(e,t){this.items[e]=t,this.items[t]=e}}const Ve=new Af;Ve.register("CN","2.5.4.3");Ve.register("L","2.5.4.7");Ve.register("ST","2.5.4.8");Ve.register("O","2.5.4.10");Ve.register("OU","2.5.4.11");Ve.register("C","2.5.4.6");Ve.register("DC","0.9.2342.19200300.100.1.25");Ve.register("E","1.2.840.113549.1.9.1");Ve.register("G","2.5.4.42");Ve.register("I","2.5.4.43");Ve.register("SN","2.5.4.4");Ve.register("T","2.5.4.12");function X_(n,e){return`\\${W.ToHex(W.FromUtf8String(e)).toUpperCase()}`}function Q_(n){return n.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,X_)}class Ze{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 Af,this.asn=new ve;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const r=t[i];this.extraNames.register(i,r)}typeof e=="string"?this.asn=this.fromString(e):e instanceof ve?this.asn=e:U.isBufferSource(e)?this.asn=L.parse(e,ve):this.asn=this.fromJSON(e)}getField(e){const t=this.extraNames.findId(e)||Ve.findId(e),i=[];for(const r of this.asn)for(const s of r)s.type===t&&i.push(s.value.toString());return i}getName(e){return this.extraNames.get(e)||Ve.get(e)}toString(){return this.asn.map(e=>e.map(t=>{const i=this.getName(t.type)||t.type,r=t.value.anyValue?`#${W.ToHex(t.value.anyValue)}`:Q_(t.value.toString());return`${i}=${r}`}).join("+")).join(", ")}toJSON(){var e;const t=[];for(const i of this.asn){const r={};for(const s of i){const o=this.getName(s.type)||s.type;(e=r[o])!==null&&e!==void 0||(r[o]=[]),r[o].push(s.value.anyValue?`#${W.ToHex(s.value.anyValue)}`:s.value.toString())}t.push(r)}return t}fromString(e){const t=new ve,i=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let r=null,s=",";for(;r=i.exec(`${e},`);){let[,o,c]=r;const l=c[c.length-1];(l===","||l==="+")&&(c=c.slice(0,c.length-1),r[3]=l);const u=r[3];o=this.getTypeOid(o);const p=this.createAttribute(o,c);s==="+"?t[t.length-1].push(p):t.push(new zn([p])),s=u}return t}fromJSON(e){const t=new ve;for(const i of e){const r=new zn;for(const s in i){const o=this.getTypeOid(s),c=i[s];for(const l of c){const u=this.createAttribute(o,l);r.push(u)}}t.push(r)}return t}getTypeOid(e){if(/[\d.]+/.test(e)||(e=this.getName(e)||""),!e)throw new Error(`Cannot get OID for name type '${e}'`);return e}createAttribute(e,t){const i=new ks({type:e});if(typeof t=="object")for(const r in t)switch(r){case"ia5String":i.value.ia5String=t[r];break;case"utf8String":i.value.utf8String=t[r];break;case"universalString":i.value.universalString=t[r];break;case"bmpString":i.value.bmpString=t[r];break;case"printableString":i.value.printableString=t[r];break}else if(t[0]==="#")i.value.anyValue=W.FromHex(t.slice(1));else{const r=this.processStringValue(t);e===this.getName("E")||e===this.getName("DC")?i.value.ia5String=r:Ze.isPrintableString(r)?i.value.printableString=r:i.value.utf8String=r}return i}processStringValue(e){const t=/"(.*?[^\\])?"/.exec(e);return t&&(e=t[1]),e.replace(/\\0a/ig,`
119
+ `).replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1")}toArrayBuffer(){return L.serialize(this.asn)}async getThumbprint(...e){var t;let i,r="SHA-1";return e.length>=1&&!(!((t=e[0])===null||t===void 0)&&t.subtle)?(r=e[0]||r,i=e[1]||Ie.get()):i=e[0]||Ie.get(),await i.subtle.digest(r,this.toArrayBuffer())}}const If="Cannot initialize GeneralName from ASN.1 data.",Uu=`${If} Unsupported string format in use.`,e0=`${If} Value doesn't match to GUID regular expression.`,Vu=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,Mu="1.3.6.1.4.1.311.25.1",Hu="1.3.6.1.4.1.311.20.2.3",so="dns",oo="dn",ao="email",co="ip",lo="url",uo="guid",po="upn",Gi="id";class Bt extends Ft{constructor(...e){let t;if(e.length===2)switch(e[0]){case oo:{const i=new Ze(e[1]).toArrayBuffer(),r=L.parse(i,ve);t=new Q({directoryName:r});break}case so:t=new Q({dNSName:e[1]});break;case ao:t=new Q({rfc822Name:e[1]});break;case uo:{const i=new RegExp(Vu,"i").exec(e[1]);if(!i)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const r=i.slice(1).map((s,o)=>o<3?W.ToHex(new Uint8Array(W.FromHex(s)).reverse()):s).join("");t=new Q({otherName:new fi({typeId:Mu,value:L.serialize(new re(W.FromHex(r)))})});break}case co:t=new Q({iPAddress:e[1]});break;case Gi:t=new Q({registeredID:e[1]});break;case po:{t=new Q({otherName:new fi({typeId:Hu,value:L.serialize(Mp.toASN(e[1]))})});break}case lo:t=new Q({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else U.isBufferSource(e[0])?t=L.parse(e[0],Q):t=e[0];super(t)}onInit(e){if(e.dNSName!=null)this.type=so,this.value=e.dNSName;else if(e.rfc822Name!=null)this.type=ao,this.value=e.rfc822Name;else if(e.iPAddress!=null)this.type=co,this.value=e.iPAddress;else if(e.uniformResourceIdentifier!=null)this.type=lo,this.value=e.uniformResourceIdentifier;else if(e.registeredID!=null)this.type=Gi,this.value=e.registeredID;else if(e.directoryName!=null)this.type=oo,this.value=new Ze(e.directoryName).toString();else if(e.otherName!=null)if(e.otherName.typeId===Mu){this.type=uo;const t=L.parse(e.otherName.value,re),i=new RegExp(Vu,"i").exec(W.ToHex(t));if(!i)throw new Error(e0);this.value=i.slice(1).map((r,s)=>s<3?W.ToHex(new Uint8Array(W.FromHex(r)).reverse()):r).join("-")}else if(e.otherName.typeId===Hu)this.type=po,this.value=L.parse(e.otherName.value,Ce).toString();else throw new Error(Uu);else throw new Error(Uu)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case oo:case so:case uo:case co:case Gi:case po:case lo:e=this.type.toUpperCase();break;case ao:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let t=this.value;return this.type===Gi&&(t=Dt.toString(t)),new ae(e,void 0,t)}}class bi extends Ft{constructor(e){let t;if(e instanceof Be)t=e;else if(Array.isArray(e)){const i=[];for(const r of e)if(r instanceof Q)i.push(r);else{const s=L.parse(new Bt(r.type,r.value).rawData,Q);i.push(s)}t=new Be(i)}else if(U.isBufferSource(e))t=L.parse(e,Be);else throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");super(t)}onInit(e){const t=[];for(const i of e){let r=null;try{r=new Bt(i)}catch{continue}t.push(r)}this.items=t}toJSON(){return this.items.map(e=>e.toJSON())}toTextObject(){const e=super.toTextObjectEmpty();for(const t of this.items){const i=t.toTextObject();let r=e[i[ae.NAME]];Array.isArray(r)||(r=[],e[i[ae.NAME]]=r),r.push(i)}return e}}bi.NAME="GeneralNames";const ci="-{5}",ki="\\n",t0=`[^${ki}]+`,n0=`${ci}BEGIN (${t0}(?=${ci}))${ci}`,i0=`${ci}END \\1${ci}`,Un="\\n",r0=`[^:${ki}]+`,s0=`(?:[^${ki}]+${Un}(?: +[^${ki}]+${Un})*)`,o0="[a-zA-Z0-9=+/]+",a0=`(?:${o0}${Un})+`,Du=`${n0}${Un}(?:((?:${r0}: ${s0})+))?${Un}?(${a0})${i0}`;class qe{static isPem(e){return typeof e=="string"&&new RegExp(Du,"g").test(e)}static decodeWithHeaders(e){e=e.replace(/\r/g,"");const t=new RegExp(Du,"g"),i=[];let r=null;for(;r=t.exec(e);){const s=r[3].replace(new RegExp(`[${ki}]+`,"g"),""),o={type:r[1],headers:[],rawData:W.FromBase64(s)},c=r[2];if(c){const l=c.split(new RegExp(Un,"g"));let u=null;for(const p of l){const[g,m]=p.split(/:(.*)/);if(m===void 0){if(!u)throw new Error("Cannot parse PEM string. Incorrect header value");u.value+=g.trim()}else u&&o.headers.push(u),u={key:g,value:m.trim()}}u&&o.headers.push(u)}i.push(o)}return i}static decode(e){return this.decodeWithHeaders(e).map(i=>i.rawData)}static decodeFirst(e){const t=this.decode(e);if(!t.length)throw new RangeError("PEM string doesn't contain any objects");return t[0]}static encode(e,t){if(Array.isArray(e)){const i=new Array;return t?e.forEach(r=>{if(!U.isBufferSource(r))throw new TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");i.push(this.encodeStruct({type:t,rawData:U.toArrayBuffer(r)}))}):e.forEach(r=>{if(!("type"in r))throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");i.push(this.encodeStruct(r))}),i.join(`
120
+ `)}else{if(!t)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:t,rawData:U.toArrayBuffer(e)})}}static encodeStruct(e){var t;const i=e.type.toLocaleUpperCase(),r=[];if(r.push(`-----BEGIN ${i}-----`),!((t=e.headers)===null||t===void 0)&&t.length){for(const u of e.headers)r.push(`${u.key}: ${u.value}`);r.push("")}const s=W.ToBase64(e.rawData);let o,c=0;const l=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(l.push(o),o.length<64)break;return r.push(...l),r.push(`-----END ${i}-----`),r.join(`
121
+ `)}}qe.CertificateTag="CERTIFICATE";qe.CrlTag="CRL";qe.CertificateRequestTag="CERTIFICATE REQUEST";qe.PublicKeyTag="PUBLIC KEY";qe.PrivateKeyTag="PRIVATE KEY";class Et extends Ft{static isAsnEncoded(e){return U.isBufferSource(e)||typeof e=="string"}static toArrayBuffer(e){if(typeof e=="string"){if(qe.isPem(e))return qe.decode(e)[0];if(W.isHex(e))return W.FromHex(e);if(W.isBase64(e))return W.FromBase64(e);if(W.isBase64Url(e))return W.FromBase64Url(e);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}else{const t=W.ToBinary(e);return qe.isPem(t)?qe.decode(t)[0]:W.isHex(t)?W.FromHex(t):W.isBase64(t)?W.FromBase64(t):W.isBase64Url(t)?W.FromBase64Url(t):U.toArrayBuffer(e)}}constructor(...e){Et.isAsnEncoded(e[0])?super(Et.toArrayBuffer(e[0]),e[1]):super(e[0])}toString(e="pem"){switch(e){case"pem":return qe.encode(this.rawData,this.tag);default:return super.toString(e)}}}class at extends Et{static async create(e,t=Ie.get()){if(e instanceof at)return e;if(Ot.isCryptoKey(e)){if(e.type!=="public")throw new TypeError("Public key is required");const i=await t.subtle.exportKey("spki",e);return new at(i)}else{if(e.publicKey)return e.publicKey;if(U.isBufferSource(e))return new at(e);throw new TypeError("Unsupported PublicKeyType")}}constructor(e){Et.isAsnEncoded(e)?super(e,ot):super(e),this.tag=qe.PublicKeyTag}async export(...e){let t,i=["verify"],r={hash:"SHA-256",...this.algorithm};e.length>1?(r=e[0]||r,i=e[1]||i,t=e[2]||Ie.get()):t=e[0]||Ie.get();let s=this.rawData;const o=L.parse(this.rawData,ot);return o.algorithm.algorithm===ai&&(s=c0(o,s)),t.subtle.importKey("spki",s,r,!0,i)}onInit(e){const t=je.resolve(gn),i=this.algorithm=t.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case pn:{const r=L.parse(e.subjectPublicKey,jc),s=U.toUint8Array(r.modulus);i.publicExponent=U.toUint8Array(r.publicExponent),i.modulusLength=(s[0]?s:s.slice(1)).byteLength<<3;break}}}async getThumbprint(...e){var t;let i,r="SHA-1";return e.length>=1&&!(!((t=e[0])===null||t===void 0)&&t.subtle)?(r=e[0]||r,i=e[1]||Ie.get()):i=e[0]||Ie.get(),await i.subtle.digest(r,this.rawData)}async getKeyIdentifier(...e){let t,i="SHA-1";e.length===1?typeof e[0]=="string"?(i=e[0],t=Ie.get()):t=e[0]:e.length===2?(i=e[0],t=e[1]):t=Ie.get();const r=L.parse(this.rawData,ot);return await t.subtle.digest(i,r.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),t=L.parse(this.rawData,ot);switch(e.Algorithm=_n.serializeAlgorithm(t.algorithm),t.algorithm.algorithm){case mi:e["EC Point"]=t.subjectPublicKey;break;case pn:default:e["Raw Data"]=t.subjectPublicKey}return e}}function c0(n,e){return n.algorithm=new H({algorithm:pn,parameters:null}),e=L.serialize(n),e}class xi extends et{static async create(e,t=!1,i=Ie.get()){if("name"in e&&"serialNumber"in e)return new xi(e,t);const s=await(await at.create(e,i)).getKeyIdentifier(i);return new xi(W.ToHex(s),t)}constructor(...e){if(U.isBufferSource(e[0]))super(e[0]);else if(typeof e[0]=="string"){const t=new Yt({keyIdentifier:new dc(W.FromHex(e[0]))});super(jo,e[1],L.serialize(t))}else{const t=e[0],i=t.name instanceof bi?L.parse(t.name.rawData,Be):t.name,r=new Yt({authorityCertIssuer:i,authorityCertSerialNumber:W.FromHex(t.serialNumber)});super(jo,e[1],L.serialize(r))}}onInit(e){super.onInit(e);const t=L.parse(e.extnValue,Yt);t.keyIdentifier&&(this.keyId=W.ToHex(t.keyIdentifier)),(t.authorityCertIssuer||t.authorityCertSerialNumber)&&(this.certId={name:t.authorityCertIssuer||[],serialNumber:t.authorityCertSerialNumber?W.ToHex(t.authorityCertSerialNumber):""})}toTextObject(){const e=this.toTextObjectWithoutValue(),t=L.parse(this.value,Yt);return t.authorityCertIssuer&&(e["Authority Issuer"]=new bi(t.authorityCertIssuer).toTextObject()),t.authorityCertSerialNumber&&(e["Authority Serial Number"]=t.authorityCertSerialNumber),t.keyIdentifier&&(e[""]=t.keyIdentifier),e}}xi.NAME="Authority Key Identifier";class Bc extends et{constructor(...e){if(U.isBufferSource(e[0])){super(e[0]);const t=L.parse(this.value,br);this.ca=t.cA,this.pathLength=t.pathLenConstraint}else{const t=new br({cA:e[0],pathLenConstraint:e[1]});super(Fp,e[2],L.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}}Bc.NAME="Basic Constraints";var Fu;(function(n){n.serverAuth="1.3.6.1.5.5.7.3.1",n.clientAuth="1.3.6.1.5.5.7.3.2",n.codeSigning="1.3.6.1.5.5.7.3.3",n.emailProtection="1.3.6.1.5.5.7.3.4",n.timeStamping="1.3.6.1.5.5.7.3.8",n.ocspSigning="1.3.6.1.5.5.7.3.9"})(Fu||(Fu={}));class Tc extends et{constructor(...e){if(U.isBufferSource(e[0])){super(e[0]);const t=L.parse(this.value,Ar);this.usages=t.map(i=>i)}else{const t=new Ar(e[0]);super(Wp,e[1],L.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(t=>Dt.toString(t)).join(", "),e}}Tc.NAME="Extended Key Usages";var Yr;(function(n){n[n.digitalSignature=1]="digitalSignature",n[n.nonRepudiation=2]="nonRepudiation",n[n.keyEncipherment=4]="keyEncipherment",n[n.dataEncipherment=8]="dataEncipherment",n[n.keyAgreement=16]="keyAgreement",n[n.keyCertSign=32]="keyCertSign",n[n.cRLSign=64]="cRLSign",n[n.encipherOnly=128]="encipherOnly",n[n.decipherOnly=256]="decipherOnly"})(Yr||(Yr={}));class Rc extends et{constructor(...e){if(U.isBufferSource(e[0])){super(e[0]);const t=L.parse(this.value,ro);this.usages=t.toNumber()}else{const t=new ro(e[0]);super(Gp,e[1],L.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=L.parse(this.value,ro);return e[""]=t.toJSON().join(", "),e}}Rc.NAME="Key Usages";class Hi extends et{static async create(e,t=!1,i=Ie.get()){const s=await(await at.create(e,i)).getKeyIdentifier(i);return new Hi(W.ToHex(s),t)}constructor(...e){if(U.isBufferSource(e[0])){super(e[0]);const t=L.parse(this.value,Rt);this.keyId=W.ToHex(t)}else{const t=typeof e[0]=="string"?W.FromHex(e[0]):e[0],i=new Rt(t);super(Xp,e[1],L.serialize(i)),this.keyId=W.ToHex(t)}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=L.parse(this.value,Rt);return e[""]=t,e}}Hi.NAME="Subject Key Identifier";class Ef extends et{constructor(...e){U.isBufferSource(e[0])?super(e[0]):super(Yp,e[1],new bi(e[0]||[]).rawData)}onInit(e){super.onInit(e);const t=L.parse(e.extnValue,qo);this.names=new bi(t)}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.names.toTextObject();for(const i in t)e[i]=t[i];return e}}Ef.NAME="Subject Alternative Name";class tt{static register(e,t){this.items.set(e,t)}static create(e){const t=new et(e),i=this.items.get(t.type);return i?new i(e):t}}tt.items=new Map;class $f extends et{constructor(...e){var t;if(U.isBufferSource(e[0])){super(e[0]);const i=L.parse(this.value,xr);this.policies=i.map(r=>r.policyIdentifier)}else{const i=e[0],r=(t=e[1])!==null&&t!==void 0?t:!1,s=new xr(i.map(o=>new Ss({policyIdentifier:o})));super(qp,r,L.serialize(s)),this.policies=i}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(t=>new ae("",{},Dt.toString(t))),e}}$f.NAME="Certificate Policies";tt.register(qp,$f);class Cf extends et{constructor(...e){var t;if(U.isBufferSource(e[0]))super(e[0]);else if(Array.isArray(e[0])&&typeof e[0][0]=="string"){const r=e[0].map(o=>new Fn({distributionPoint:new cn({fullName:[new Q({uniformResourceIdentifier:o})]})})),s=new En(r);super(To,e[1],L.serialize(s))}else{const i=new En(e[0]);super(To,e[1],L.serialize(i))}(t=this.distributionPoints)!==null&&t!==void 0||(this.distributionPoints=[])}onInit(e){super.onInit(e);const t=L.parse(e.extnValue,En);this.distributionPoints=t}toTextObject(){const e=this.toTextObjectWithoutValue();return e["Distribution Point"]=this.distributionPoints.map(t=>{var i;const r={};return t.distributionPoint&&(r[""]=(i=t.distributionPoint.fullName)===null||i===void 0?void 0:i.map(s=>new Bt(s).toString()).join(", ")),t.reasons&&(r.Reasons=t.reasons.toString()),t.cRLIssuer&&(r["CRL Issuer"]=t.cRLIssuer.map(s=>s.toString()).join(", ")),r}),e}}Cf.NAME="CRL Distribution Points";class jf extends et{constructor(...e){var t,i,r,s;if(U.isBufferSource(e[0]))super(e[0]);else if(e[0]instanceof Sn){const o=new Sn(e[0]);super(Co,e[1],L.serialize(o))}else{const o=e[0],c=new Sn;Zi(c,o,El,"ocsp"),Zi(c,o,$l,"caIssuers"),Zi(c,o,Cl,"timeStamping"),Zi(c,o,jl,"caRepository"),super(Co,e[1],L.serialize(c))}(t=this.ocsp)!==null&&t!==void 0||(this.ocsp=[]),(i=this.caIssuers)!==null&&i!==void 0||(this.caIssuers=[]),(r=this.timeStamping)!==null&&r!==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=[],L.parse(e.extnValue,Sn).forEach(i=>{switch(i.accessMethod){case El:this.ocsp.push(new Bt(i.accessLocation));break;case $l:this.caIssuers.push(new Bt(i.accessLocation));break;case Cl:this.timeStamping.push(new Bt(i.accessLocation));break;case jl:this.caRepository.push(new Bt(i.accessLocation));break}})}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ocsp.length&&Ji(e,"OCSP",this.ocsp),this.caIssuers.length&&Ji(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&Ji(e,"Time Stamping",this.timeStamping),this.caRepository.length&&Ji(e,"CA Repository",this.caRepository),e}}jf.NAME="Authority Info Access";function Ji(n,e,t){if(t.length===1)n[e]=t[0].toTextObject();else{const i=new ae("");t.forEach((r,s)=>{const o=r.toTextObject(),c=`${o[ae.NAME]} ${s+1}`;let l=i[c];Array.isArray(l)||(l=[],i[c]=l),l.push(o)}),n[e]=i}}function Zi(n,e,t,i){const r=e[i];r&&(Array.isArray(r)?r:[r]).forEach(o=>{typeof o=="string"&&(o=new Bt("url",o)),n.push(new Ci({accessMethod:t,accessLocation:L.parse(o.rawData,Q)}))})}class Yn extends Ft{constructor(...e){let t;if(U.isBufferSource(e[0]))t=U.toArrayBuffer(e[0]);else{const i=e[0],r=Array.isArray(e[1])?e[1].map(s=>U.toArrayBuffer(s)):[];t=L.serialize(new St({type:i,values:r}))}super(t,St)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Value=this.values.map(t=>new ae("",{"":t})),e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty();return e[ae.NAME]===Yn.NAME&&(e[ae.NAME]=Dt.toString(this.type)),e}}Yn.NAME="Attribute";class zf extends Yn{constructor(...e){var t;if(U.isBufferSource(e[0]))super(e[0]);else{const i=new Jr({printableString:e[0]});super(bf,[L.serialize(i)])}(t=this.password)!==null&&t!==void 0||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){const t=L.parse(this.values[0],Jr);this.password=t.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[ae.VALUE]=this.password,e}}zf.NAME="Challenge Password";class Pc extends Yn{constructor(...e){var t;if(U.isBufferSource(e[0]))super(e[0]);else{const i=e[0],r=new Lt;for(const s of i)r.push(L.parse(s.rawData,Xe));super(Oc,[L.serialize(r)])}(t=this.items)!==null&&t!==void 0||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){const t=L.parse(this.values[0],Lt);this.items=t.map(i=>tt.create(L.serialize(i)))}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.items.map(i=>i.toTextObject());for(const i of t)e[i[ae.NAME]]=i;return e}}Pc.NAME="Extensions";class Ws{static register(e,t){this.items.set(e,t)}static create(e){const t=new Yn(e),i=this.items.get(t.type);return i?new i(e):t}}Ws.items=new Map;const Di="crypto.signatureFormatter";class l0{toAsnSignature(e,t){return U.toArrayBuffer(t)}toWebSignature(e,t){return U.toArrayBuffer(t)}}var ir;let Ta=ir=class{static createPssParams(e,t){const i=ir.getHashAlgorithm(e);return i?new hn({hashAlgorithm:i,maskGenAlgorithm:new H({algorithm:Ls,parameters:L.serialize(i)}),saltLength:t}):null}static getHashAlgorithm(e){const t=je.resolve(gn);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 H({algorithm:Ur,parameters:null});case"sha-256":return new H({algorithm:pa,parameters:null});case"sha-384":return new H({algorithm:Vr,parameters:null});case"sha-512":return new H({algorithm:Mr,parameters:null})}}else return new H({algorithm:pn,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=ir.createPssParams(e.hash,e.saltLength);if(!t)throw new Error("Cannot create PSS parameters");return new H({algorithm:ai,parameters:L.serialize(t)})}else return new H({algorithm:ai,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case pn:return{name:"RSASSA-PKCS1-v1_5"};case Ur:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case pa:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case Vr:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case Mr:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case ai:if(e.parameters){const t=L.parse(e.parameters,hn);return{name:"RSA-PSS",hash:je.resolve(gn).toWebAlgorithm(t.hashAlgorithm),saltLength:t.saltLength}}else return{name:"RSA-PSS"}}return null}};Ta=ir=d([Hs()],Ta);je.registerSingleton(Mi,Ta);let Ra=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new H({algorithm:Hr});case"sha-256":return new H({algorithm:Dr});case"sha-384":return new H({algorithm:Fr});case"sha-512":return new H({algorithm:qr})}return null}toWebAlgorithm(e){switch(e.algorithm){case Hr:return{name:"SHA-1"};case Dr:return{name:"SHA-256"};case Fr:return{name:"SHA-384"};case qr:return{name:"SHA-512"}}return null}};Ra=d([Hs()],Ra);je.registerSingleton(Mi,Ra);class Ye{addPadding(e,t){const i=U.toUint8Array(t),r=new Uint8Array(e);return r.set(i,e-i.length),r}removePadding(e,t=!1){let i=U.toUint8Array(e);for(let r=0;r<i.length;r++)if(i[r]){i=i.slice(r);break}if(t&&i[0]>127){const r=new Uint8Array(i.length+1);return r.set(i,1),r.buffer}return i.buffer}toAsnSignature(e,t){if(e.name==="ECDSA"){const i=e.namedCurve,r=Ye.namedCurveSize.get(i)||Ye.defaultNamedCurveSize,s=new Lr,o=U.toUint8Array(t);return s.r=this.removePadding(o.slice(0,r),!0),s.s=this.removePadding(o.slice(r,r+r),!0),L.serialize(s)}return null}toWebSignature(e,t){if(e.name==="ECDSA"){const i=L.parse(t,Lr),r=e.namedCurve,s=Ye.namedCurveSize.get(r)||Ye.defaultNamedCurveSize,o=this.addPadding(s,this.removePadding(i.r)),c=this.addPadding(s,this.removePadding(i.s));return kg(o,c)}return null}}Ye.namedCurveSize=new Map;Ye.defaultNamedCurveSize=32;const fo="1.3.101.110",qu="1.3.101.111",ho="1.3.101.112",Ku="1.3.101.113";let Pa=class{toAsnAlgorithm(e){let t=null;switch(e.name.toLowerCase()){case"ed25519":t=ho;break;case"x25519":t=fo;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":t=ho;break;case"ed448":t=Ku;break}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":t=fo;break;case"x448":t=qu;break}}return t?new H({algorithm:t}):null}toWebAlgorithm(e){switch(e.algorithm){case ho:return{name:"Ed25519"};case Ku:return{name:"EdDSA",namedCurve:"Ed448"};case fo:return{name:"X25519"};case qu:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};Pa=d([Hs()],Pa);je.registerSingleton(Mi,Pa);class u0 extends Et{constructor(e){Et.isAsnEncoded(e)?super(e,vi):super(e),this.tag=qe.CertificateRequestTag}onInit(e){this.tbs=L.serialize(e.certificationRequestInfo),this.publicKey=new at(e.certificationRequestInfo.subjectPKInfo);const t=je.resolve(gn);this.signatureAlgorithm=t.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signature,this.attributes=e.certificationRequestInfo.attributes.map(r=>Ws.create(L.serialize(r)));const i=this.getAttribute(Oc);this.extensions=[],i instanceof Pc&&(this.extensions=i.items),this.subjectName=new Ze(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=Ie.get()){const t={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(t,["verify"],e),r=je.resolveAll(Di).reverse();let s=null;for(const c of r)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,i,s,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),t=L.parse(this.rawData,vi),i=t.certificationRequestInfo,r=new ae("",{Version:`${ln[i.version]} (${i.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const s=new ae("");for(const o of this.attributes){const c=o.toTextObject();s[c[ae.NAME]]=c}r.Attributes=s}return e.Data=r,e.Signature=new ae("",{Algorithm:_n.serializeAlgorithm(t.signatureAlgorithm),"":t.signature}),e}}u0.NAME="PKCS#10 Certificate Request";class Lc extends Et{constructor(e){Et.isAsnEncoded(e)?super(e,un):super(e),this.tag=qe.CertificateTag}onInit(e){const t=e.tbsCertificate;this.tbs=L.serialize(t),this.serialNumber=W.ToHex(t.serialNumber),this.subjectName=new Ze(t.subject),this.subject=new Ze(t.subject).toString(),this.issuerName=new Ze(t.issuer),this.issuer=this.issuerName.toString();const i=je.resolve(gn);this.signatureAlgorithm=i.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signatureValue;const r=t.validity.notBefore.utcTime||t.validity.notBefore.generalTime;if(!r)throw new Error("Cannot get 'notBefore' value");this.notBefore=r;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=>tt.create(L.serialize(o)))),this.publicKey=new at(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=Ie.get()){let i,r;const s=e.publicKey;try{if(!s)i={...this.publicKey.algorithm,...this.signatureAlgorithm},r=await this.publicKey.export(i,["verify"],t);else if("publicKey"in s)i={...s.publicKey.algorithm,...this.signatureAlgorithm},r=await s.publicKey.export(i,["verify"],t);else if(s instanceof at)i={...s.algorithm,...this.signatureAlgorithm},r=await s.export(i,["verify"],t);else if(U.isBufferSource(s)){const u=new at(s);i={...u.algorithm,...this.signatureAlgorithm},r=await u.export(i,["verify"],t)}else i={...s.algorithm,...this.signatureAlgorithm},r=s}catch{return!1}const o=je.resolveAll(Di).reverse();let c=null;for(const u of o)if(c=u.toWebSignature(i,this.signature),c)break;if(!c)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const l=await t.subtle.verify(this.signatureAlgorithm,r,c,this.tbs);if(e.signatureOnly)return l;{const p=(e.date||new Date).getTime();return l&&this.notBefore.getTime()<p&&p<this.notAfter.getTime()}}async getThumbprint(...e){let t,i="SHA-1";return e[0]&&(e[0].subtle?t=e[0]:(i=e[0]||i,t=e[1])),t??(t=Ie.get()),await t.subtle.digest(i,this.rawData)}async isSelfSigned(e=Ie.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){const e=this.toTextObjectEmpty(),t=L.parse(this.rawData,un),i=t.tbsCertificate,r=new ae("",{Version:`${ln[i.version]} (${i.version})`,"Serial Number":i.serialNumber,"Signature Algorithm":_n.serializeAlgorithm(i.signature),Issuer:this.issuer,Validity:new ae("",{"Not Before":i.validity.notBefore.getTime(),"Not After":i.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(i.issuerUniqueID&&(r["Issuer Unique ID"]=i.issuerUniqueID),i.subjectUniqueID&&(r["Subject Unique ID"]=i.subjectUniqueID),this.extensions.length){const s=new ae("");for(const o of this.extensions){const c=o.toTextObject();s[c[ae.NAME]]=c}r.Extensions=s}return e.Data=r,e.Signature=new ae("",{Algorithm:_n.serializeAlgorithm(t.signatureAlgorithm),"":t.signatureValue}),e}}Lc.NAME="Certificate";class d0{static async createSelfSigned(e,t=Ie.get()){if(!e.keys.privateKey)throw new Error("Bad field 'keys' in 'params' argument. 'privateKey' is empty");if(!e.keys.publicKey)throw new Error("Bad field 'keys' in 'params' argument. 'publicKey' is empty");return this.create({serialNumber:e.serialNumber,subject:e.name,issuer:e.name,notBefore:e.notBefore,notAfter:e.notAfter,publicKey:e.keys.publicKey,signingKey:e.keys.privateKey,signingAlgorithm:e.signingAlgorithm,extensions:e.extensions},t)}static async create(e,t=Ie.get()){var i;let r;e.publicKey instanceof at?r=e.publicKey.rawData:"publicKey"in e.publicKey?r=e.publicKey.publicKey.rawData:U.isBufferSource(e.publicKey)?r=e.publicKey:r=await t.subtle.exportKey("spki",e.publicKey);const s=e.serialNumber?U.toUint8Array(W.FromHex(e.serialNumber)):t.getRandomValues(new Uint8Array(16));s[0]>127&&(s[0]&=127),s.length>1&&s[0]===0&&(s[1]|=128);const o=e.notBefore||new Date,c=e.notAfter||new Date(o.getTime()+31536e6),l=new un({tbsCertificate:new Ge({version:ln.v3,serialNumber:s,validity:new ji({notBefore:o,notAfter:c}),extensions:new Lt(((i=e.extensions)===null||i===void 0?void 0:i.map(b=>L.parse(b.rawData,Xe)))||[]),subjectPublicKeyInfo:L.parse(r,ot)})});if(e.subject){const b=e.subject instanceof Ze?e.subject:new Ze(e.subject);l.tbsCertificate.subject=L.parse(b.toArrayBuffer(),ve)}if(e.issuer){const b=e.issuer instanceof Ze?e.issuer:new Ze(e.issuer);l.tbsCertificate.issuer=L.parse(b.toArrayBuffer(),ve)}const u={hash:"SHA-256"},p="signingKey"in e?{...u,...e.signingAlgorithm,...e.signingKey.algorithm}:{...u,...e.signingAlgorithm},g=je.resolve(gn);l.tbsCertificate.signature=l.signatureAlgorithm=g.toAsnAlgorithm(p);const m=L.serialize(l.tbsCertificate),x="signingKey"in e?await t.subtle.sign(p,e.signingKey,m):e.signature,h=je.resolveAll(Di).reverse();let _=null;for(const b of h)if(_=b.toAsnSignature(p,x),_)break;if(!_)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return l.signatureValue=_,new Lc(L.serialize(l))}}var Wu;(function(n){n[n.unspecified=0]="unspecified",n[n.keyCompromise=1]="keyCompromise",n[n.cACompromise=2]="cACompromise",n[n.affiliationChanged=3]="affiliationChanged",n[n.superseded=4]="superseded",n[n.cessationOfOperation=5]="cessationOfOperation",n[n.certificateHold=6]="certificateHold",n[n.removeFromCRL=8]="removeFromCRL",n[n.privilegeWithdrawn=9]="privilegeWithdrawn",n[n.aACompromise=10]="aACompromise"})(Wu||(Wu={}));tt.register(Fp,Bc);tt.register(Wp,Tc);tt.register(Gp,Rc);tt.register(Xp,Hi);tt.register(jo,xi);tt.register(Yp,Ef);tt.register(To,Cf);tt.register(Co,jf);Ws.register(bf,zf);Ws.register(Oc,Pc);je.registerSingleton(Di,l0);je.registerSingleton(Di,Ye);Ye.namedCurveSize.set("P-256",32);Ye.namedCurveSize.set("K-256",32);Ye.namedCurveSize.set("P-384",48);Ye.namedCurveSize.set("P-521",66);const Gu="0123456789abcdef";function La(n){const e=new Uint8Array(n);let t="";for(let i=0;i<e.length;i++){const r=e[i]>>4;t+=Gu[r];const s=e[i]&15;t+=Gu[s]}return t}class Nf{constructor(e,t){te(this,"alphabet");te(this,"padding");te(this,"decodeMap",new Map);if(e.length!==32)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(t==null?void 0:t.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let i=0;i<e.length;i++)this.decodeMap.set(e[i],i)}encode(e,t){let i="",r=0,s=0;for(let c=0;c<e.length;c++)for(r=r<<8|e[c],s+=8;s>=5;)s-=5,i+=this.alphabet[r>>s&31];if(s>0&&(i+=this.alphabet[r<<5-s&31]),(t==null?void 0:t.includePadding)??!0){const c=(8-i.length%8)%8;for(let l=0;l<c;l++)i+="="}return i}decode(e,t){const i=(t==null?void 0:t.strict)??!0,r=Math.ceil(e.length/8),s=[];for(let o=0;o<r;o++){let c=0;const l=[];for(let p=0;p<8;p++){const g=e[o*8+p];if(g==="="){if(o+1!==r)throw new Error(`Invalid character: ${g}`);c+=1;continue}if(g===void 0){if(i)throw new Error("Invalid data");c+=1;continue}const m=this.decodeMap.get(g)??null;if(m===null)throw new Error(`Invalid character: ${g}`);l.push(m)}if(c===8||c===7||c===5||c===2)throw new Error("Invalid padding");const u=(l[0]<<3)+(l[1]>>2);if(s.push(u),c<6){const p=((l[1]&3)<<6)+(l[2]<<1)+(l[3]>>4);s.push(p)}if(c<4){const p=((l[3]&255)<<4)+(l[4]>>1);s.push(p)}if(c<3){const p=((l[4]&1)<<7)+(l[5]<<2)+(l[6]>>3);s.push(p)}if(c<1){const p=((l[6]&7)<<5)+l[7];s.push(p)}}return Uint8Array.from(s)}}new Nf("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567");new Nf("0123456789ABCDEFGHIJKLMNOPQRSTUV");class Of{constructor(e,t){te(this,"alphabet");te(this,"padding");te(this,"decodeMap",new Map);if(e.length!==64)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(t==null?void 0:t.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let i=0;i<e.length;i++)this.decodeMap.set(e[i],i)}encode(e,t){let i="",r=0,s=0;for(let c=0;c<e.length;c++)for(r=r<<8|e[c],s+=8;s>=6;)s+=-6,i+=this.alphabet[r>>s&63];if(s>0&&(i+=this.alphabet[r<<6-s&63]),(t==null?void 0:t.includePadding)??!0){const c=(4-i.length%4)%4;for(let l=0;l<c;l++)i+="="}return i}decode(e,t){const i=(t==null?void 0:t.strict)??!0,r=Math.ceil(e.length/4),s=[];for(let o=0;o<r;o++){let c=0,l=0;for(let u=0;u<4;u++){const p=e[o*4+u];if(p==="="){if(o+1!==r)throw new Error(`Invalid character: ${p}`);c+=1;continue}if(p===void 0){if(i)throw new Error("Invalid data");c+=1;continue}const g=this.decodeMap.get(p)??null;if(g===null)throw new Error(`Invalid character: ${p}`);l+=g<<6*(3-u)}s.push(l>>16&255),c<2&&s.push(l>>8&255),c<1&&s.push(l&255)}return Uint8Array.from(s)}}const p0=new Of("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),tn=new Of("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");class f0{constructor(e){te(this,"hash");this.hash=e}async verify(e,t,i){const r=await crypto.subtle.importKey("spki",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["verify"]);return await crypto.subtle.verify("RSASSA-PKCS1-v1_5",r,t,i)}async sign(e,t){const i=await crypto.subtle.importKey("pkcs8",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["sign"]);return await crypto.subtle.sign("RSASSA-PKCS1-v1_5",i,t)}async generateKeyPair(e){const t=await crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",hash:this.hash,modulusLength:e??2048,publicExponent:new Uint8Array([1,0,1])},!0,["sign"]),i=await crypto.subtle.exportKey("pkcs8",t.privateKey),r=await crypto.subtle.exportKey("spki",t.publicKey);return{privateKey:i,publicKey:r}}}async function Bf(n){return await crypto.subtle.digest("SHA-256",n)}async function Ua(n){const e={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",publicExponent:new Uint8Array([1,0,1]),modulusLength:2048},t=await crypto.subtle.generateKey(e,!0,["sign","verify"]),i=Ke(),r=La(new TextEncoder().encode(i)),s=await d0.createSelfSigned({serialNumber:r,name:n.name,notBefore:new Date,notAfter:new Date(Date.now()+365*24*60*60*1e3),signingAlgorithm:e,keys:t,extensions:[new Bc(!0,2,!0),new Tc(["1.3.6.1.5.5.7.3.1"],!0),new Rc(Yr.keyCertSign|Yr.cRLSign,!0),await Hi.create(t.publicKey)]}),o=await crypto.subtle.exportKey("pkcs8",t.privateKey),c=s.toString("pem"),l=await g0(s),u=La(await s.getThumbprint()),p=h0("PRIVATE",o);return{kid:s.serialNumber,cert:c,thumbprint:u,fingerprint:l,pkcs7:p}}function h0(n,e){const t=p0.encode(new Uint8Array(e));let i=`-----BEGIN ${n} KEY-----\r
122
122
  `,r=0;for(;r<t.length;)r+64<=t.length?i+=t.substr(r,64)+`\r
123
123
  `:i+=t.substr(r)+`\r
124
124
  `,r+=64;return i+=`-----END ${n} KEY-----\r
125
- `,i}async function K_(n){const e=await n.publicKey.export(),t=await crypto.subtle.exportKey("jwk",e),i=JSON.stringify(t,Object.keys(t).sort()),s=new TextEncoder().encode(i);return Ca(await _f(s))}const F_=1e3*60*60*24,W_=new o.OpenAPIHono().openapi(o.createRoute({tags:["keys"],method:"get",path:"/signing",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.array(fo)}},description:"List of keys"}}}),async n=>{const t=(await n.env.data.keys.list()).filter(i=>"cert"in i).map(i=>i);return n.json(t)}).openapi(o.createRoute({tags:["keys"],method:"get",path:"/signing/{kid}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({kid:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:fo}},description:"The requested key"}}}),async n=>{const{kid:e}=n.req.valid("param"),i=(await n.env.data.keys.list()).find(r=>r.kid===e);if(!i)throw new B(404,{message:"Key not found"});return n.json(i)}).openapi(o.createRoute({tags:["keys"],method:"post",path:"/signing/rotate",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async n=>{const e=await n.env.data.keys.list();for await(const i of e)await n.env.data.keys.update(i.kid,{revoked_at:new Date(Date.now()+F_).toISOString()});const t=await Oa({name:`CN=${n.env.ORGANIZATION_NAME}`});return await n.env.data.keys.create(t),n.text("OK",{status:201})}).openapi(o.createRoute({tags:["keys"],method:"put",path:"/signing/{kid}/revoke",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({kid:o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async n=>{const{kid:e}=n.req.valid("param");if(!await n.env.data.keys.update(e,{revoked_at:new Date().toISOString()}))throw new B(404,{message:"Key not found"});const i=await Oa({name:`CN=${n.env.ORGANIZATION_NAME}`});return await n.env.data.keys.create(i),n.text("OK")}),G_=new o.OpenAPIHono().openapi(o.createRoute({tags:["users"],method:"get",path:"/",request:{query:o.z.object({email:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:o.z.array(Na)}},description:"List of users"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{email:t}=n.req.valid("query"),r=(await bd(n.env.data.users,e,t)).filter(s=>!s.linked_to);return n.json(r)}),J_=Lt.extend({clients:o.z.array(Ft)}),Z_=new o.OpenAPIHono().openapi(o.createRoute({tags:["clients"],method:"get",path:"/",request:{query:Xt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([J_,o.z.array(Ft)])}},description:"List of clients"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{page:t,per_page:i,include_totals:r,sort:s,q:a}=n.req.valid("query"),l=(await n.env.data.applications.list(e,{page:t,per_page:i,include_totals:r,sort:Pn(s),q:a})).applications;return r?n.json({clients:l,start:0,limit:10,length:l.length}):n.json(l)}).openapi(o.createRoute({tags:["clients"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Ft}},description:"An application"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),r=(await n.env.data.applications.list(e,{page:1,per_page:0,include_totals:!1})).applications.find(s=>s.id===t);if(!r)throw new B(404);return n.json(r)}).openapi(o.createRoute({tags:["clients"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param");if(!await n.env.data.applications.remove(e,t))throw new B(404,{message:"Application not found"});return n.text("OK")}).openapi(o.createRoute({tags:["clients"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:o.z.object(sr.shape).partial()}}},params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Ft}},description:"The update application"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),r=n.req.valid("json");await n.env.data.applications.update(e,t,r);const s=await n.env.data.applications.get(e,t);if(!s)throw new B(404,{message:"Application not found"});return n.json(s)}).openapi(o.createRoute({tags:["clients"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.object(sr.shape)}}},headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:o.z.object(Ft.shape)}},description:"An application"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),i={...t,id:t.id||st(),client_secret:t.client_secret||st()},r=await n.env.data.applications.create(e,i);return n.json(r,{status:201})});o.z.object({start:o.z.number(),limit:o.z.number(),length:o.z.number()});Zr.extend({email:o.z.string(),login_count:o.z.number(),multifactor:o.z.array(o.z.string()).optional(),last_ip:o.z.string().optional(),last_login:o.z.string().optional(),user_id:o.z.string()}).catchall(o.z.any());const Y_=Lt.extend({tenants:o.z.array(wn)}),X_=new o.OpenAPIHono().openapi(o.createRoute({tags:["tenants"],method:"get",path:"/",request:{query:Xt},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:o.z.union([o.z.array(wn),Y_])}},description:"List of tenants"}}}),async n=>{const{page:e,per_page:t,include_totals:i,sort:r,q:s}=n.req.valid("query"),a=await n.env.data.tenants.list({page:e,per_page:t,include_totals:i,sort:Pn(r),q:s});return i?n.json(a):n.json(a.tenants)}).openapi(o.createRoute({tags:["tenants"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:wn}},description:"A tenant"}}}),async n=>{const{id:e}=n.req.valid("param"),t=await n.env.data.tenants.get(e);if(!t)throw new B(404);return n.json(t)}).openapi(o.createRoute({tags:["tenants"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{id:e}=n.req.valid("param");return await n.env.data.tenants.remove(e),n.text("OK")}).openapi(o.createRoute({tags:["tenants"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:o.z.object(ar.shape).partial()}}},params:o.z.object({id:o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{id:e}=n.req.valid("param"),t=n.req.valid("json");return await n.env.data.tenants.update(e,t),n.text("OK")}).openapi(o.createRoute({tags:["tenants"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.object(ar.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"tenant/json":{schema:wn}},description:"An tenant"}}}),async n=>{const e=n.req.valid("json"),t=await n.env.data.tenants.create(e);return n.json(t,{status:201})}),Q_=Lt.extend({logs:o.z.array(lr)}),e0=new o.OpenAPIHono().openapi(o.createRoute({tags:["logs"],method:"get",path:"/",request:{query:Xt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(lr),Q_])}},description:"List of log rows"}}}),async n=>{const{page:e,per_page:t,include_totals:i,sort:r,q:s}=n.req.valid("query"),{"tenant-id":a}=n.req.valid("header"),c=await n.env.data.logs.list(a,{page:e,per_page:t,include_totals:i,sort:Pn(r),q:s});return i?n.json(c):n.json(c.logs)}).openapi(o.createRoute({tags:["logs"],method:"get",path:"/{id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({id:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:lr}},description:"A log entry"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),i=await n.env.data.logs.get(e,t);if(!i)throw new B(404);return n.json(i)}),t0=Lt.extend({hooks:o.z.array(yn)}),n0=new o.OpenAPIHono().openapi(o.createRoute({tags:["hooks"],method:"get",path:"/",request:{query:Xt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(yn),t0])}},description:"List of hooks"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{page:t,per_page:i,include_totals:r,sort:s,q:a}=n.req.valid("query"),c=await n.env.data.hooks.list(e,{page:t,per_page:i,include_totals:r,sort:Pn(s),q:a});return r?n.json(c):n.json(c.hooks)}).openapi(o.createRoute({tags:["hooks"],method:"post",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object(cr.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:yn}},description:"The created hook"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),i=await n.env.data.hooks.create(e,t);return n.json(i,{status:201})}).openapi(o.createRoute({tags:["hooks"],method:"patch",path:"/{hook_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({hook_id:o.z.string()}),body:{content:{"application/json":{schema:o.z.object(cr.shape).omit({hook_id:!0}).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:yn.shape}},description:"The updated hook"},404:{description:"Hook not found"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{hook_id:t}=n.req.valid("param"),i=n.req.valid("json");await n.env.data.hooks.update(e,t,i);const r=await n.env.data.hooks.get(e,t);if(!r)throw new B(404,{message:"Hook not found"});return n.json(r)}).openapi(o.createRoute({tags:["hooks"],method:"get",path:"/{hook_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({hook_id:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:yn}},description:"A hook"},404:{description:"Hook not found"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{hook_id:t}=n.req.valid("param"),i=await n.env.data.hooks.get(e,t);if(!i)throw new B(404,{message:"Hook not found"});return n.json(i)}).openapi(o.createRoute({tags:["hooks"],method:"delete",path:"/{hook_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({hook_id:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{description:"A hook"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{hook_id:t}=n.req.valid("param");if(!await n.env.data.hooks.remove(e,t))throw new B(404,{message:"Hook not found"});return n.text("OK")}),i0=Lt.extend({connections:o.z.array(Et)}),r0=new o.OpenAPIHono().openapi(o.createRoute({tags:["connections"],method:"get",path:"/",request:{query:Xt,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(Et),i0])}},description:"List of connectionss"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{page:t,per_page:i,include_totals:r=!1,sort:s,q:a}=n.req.valid("query"),c=await n.env.data.connections.list(e,{page:t,per_page:i,include_totals:r,sort:Pn(s),q:a});return r?n.json(c):n.json(c.connections)}).openapi(o.createRoute({tags:["connections"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Et}},description:"A connection"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),i=await n.env.data.connections.get(e,t);if(!i)throw new B(404);return n.json(i)}).openapi(o.createRoute({tags:["connections"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param");if(!await n.env.data.connections.remove(e,t))throw new B(404,{message:"Connection not found"});return n.text("OK")}).openapi(o.createRoute({tags:["connections"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:o.z.object(or.shape).partial()}}},params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Et}},description:"The updated connection"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),i=n.req.valid("json");if(!await n.env.data.connections.update(e,t,i))throw new B(404,{message:"Connection not found"});const s=await n.env.data.connections.get(e,t);if(!s)throw new B(404,{message:"Connection not found"});return n.json(s)}).openapi(o.createRoute({tags:["connections"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.object(or.shape)}}},headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:Et}},description:"A connection"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),i=await n.env.data.connections.create(e,t);return n.json(i,{status:201})}),s0=new o.OpenAPIHono().openapi(o.createRoute({tags:["prompts"],method:"get",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Fi}},description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=await n.env.data.promptSettings.get(e);return t?n.json(t):n.json(Fi.parse({}))}).openapi(o.createRoute({tags:["prompts"],method:"patch",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object(Fi.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Prompts settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),i=await n.env.data.promptSettings.get(e);return Object.assign(i,t),await n.env.data.promptSettings.set(e,i),n.json(i)});let Tu=!1;function mf(n){n.use(async(e,t)=>(Tu||(n.openAPIRegistry.registerComponent("securitySchemes","Bearer",{type:"oauth2",scheme:"bearer",flows:{implicit:{authorizationUrl:`${e.env.AUTH_URL}/authorize`,scopes:{openid:"Basic user information",email:"User email",profile:"User profile information"}}}}),Tu=!0),await t()))}o.z.object({alg:o.z.literal("RS256"),kty:o.z.literal("RSA"),use:o.z.literal("sig"),n:o.z.string(),e:o.z.string(),kid:o.z.string(),x5t:o.z.string(),x5c:o.z.array(o.z.string())});async function o0(n){try{const e=await n.JWKS_SERVICE.fetch(n.JWKS_URL);if(!e.ok)throw new Error("Failed to fetch jwks");return(await e.json()).keys}catch(e){throw new B(500,{message:`Failed to fetch jwks: ${e.message}`})}}async function a0(n,e){const i=new TextEncoder().encode([e.raw.header,e.raw.payload].join(".")),r=new Uint8Array(Array.from(e.signature).map(l=>l.charCodeAt(0))),a=(await o0(n.env)).find(l=>l.kid===e.header.kid);if(!a)return console.log("No matching kid found"),!1;const c=await crypto.subtle.importKey("jwk",a,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!1,["verify"]);return crypto.subtle.verify("RSASSA-PKCS1-v1_5",c,r,i)}function c0(n){const[e,t,i]=n.split(".");if(!e||!t||!i)return null;const r=JSON.parse(atob(e)),s=JSON.parse(atob(t)),a=atob(i.replace(/-/g,"+").replace(/_/g,"/"));return{header:r,payload:s,signature:a,raw:{header:e,payload:t,signature:i}}}function yf(n){return async(e,t)=>{var r,s,a;const i=n.openAPIRegistry.definitions.find(c=>"route"in c&&c.route.path===e.req.path&&c.route.method.toUpperCase()===e.req.method);if(i&&"route"in i){const c=(s=(r=i.route.security)==null?void 0:r[0])==null?void 0:s.Bearer;if(!(c!=null&&c.length))return await t();const l=e.req.header("authorization")||"",[d,h]=l.split(" ");if((d==null?void 0:d.toLowerCase())!=="bearer"||!h)throw new B(401,{message:"Missing bearer token"});const g=c0(h);if(!g||!await a0(e,g))throw new B(403,{message:"Invalid JWT signature"});e.set("user_id",g.payload.sub),e.set("user",g.payload);const y=g.payload.permissions||[],I=((a=g.payload.scope)==null?void 0:a.split(" "))||[];if(c.length&&!(c.some(f=>y.includes(f))||c.some(f=>I.includes(f))))throw new B(403,{message:"Unauthorized"})}return await t()}}const l0=new o.OpenAPIHono().openapi(o.createRoute({tags:["emails"],method:"get",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Wi}},description:"Email provider"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=await n.env.data.emailProviders.get(e);if(!t)throw new B(404,{message:"Email provider not found"});return n.json(t)}).openapi(o.createRoute({tags:["emails"],method:"post",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object(Wi.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json");return await n.env.data.emailProviders.create(e,t),n.text("OK",{status:201})}).openapi(o.createRoute({tags:["emails"],method:"patch",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object(Wi.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json");return await n.env.data.emailProviders.update(e,t),n.text("OK")});function u0(){const n=new o.OpenAPIHono;n.use(yf(n));const e=n.route("/branding",$h).route("/email/providers",l0).route("/users",Wh).route("/keys",W_).route("/users-by-email",G_).route("/clients",Z_).route("/tenants",X_).route("/logs",e0).route("/hooks",n0).route("/connections",r0).route("/prompts",s0);return mf(e),e.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Management api"}}),e}function d0(n,e){Object.keys(e).forEach(t=>{const i=e[t];i!=null&&i.length&&n.searchParams.set(t,i)})}function Rn(n){var e,t,i;return{auth0Client:(e=n.query("auth0Client"))==null?void 0:e.slice(0,255),ip:(t=n.header("x-real-ip"))==null?void 0:t.slice(0,45),useragent:(i=n.header("user-agent"))==null?void 0:i.slice(0,512)}}const Ki=60*5,vf=30*24*60*60,Fr=24*60*60,p0="auth-token",Pu=30*60*1e3,f0=5*60,h0=5*60;var Uu;(function(n){n[n.Include=0]="Include",n[n.None=1]="None"})(Uu||(Uu={}));var Lu;(function(n){n[n.Required=0]="Required",n[n.Ignore=1]="Ignore"})(Lu||(Lu={}));function g0(n){return bf(n,_0,yi.Include)}function wf(n){return bf(n,m0,yi.None)}function bf(n,e,t){let i="";for(let r=0;r<n.byteLength;r+=3){let s=0,a=0;for(let c=0;c<3&&r+c<n.byteLength;c++)s=s<<8|n[r+c],a+=8;for(let c=0;c<4;c++)a>=6?(i+=e[s>>a-6&63],a-=6):a>0?(i+=e[s<<6-a&63],a=0):t===yi.Include&&(i+="=")}return i}const _0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",m0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var yi;(function(n){n[n.Include=0]="Include",n[n.None=1]="None"})(yi||(yi={}));var Du;(function(n){n[n.Required=0]="Required",n[n.Ignore=1]="Ignore"})(Du||(Du={}));class y0{uint8(e,t){if(e.byteLength<t+1)throw new TypeError("Insufficient bytes");return e[t]}uint16(e,t){if(e.byteLength<t+2)throw new TypeError("Insufficient bytes");return e[t]<<8|e[t+1]}uint32(e,t){if(e.byteLength<t+4)throw new TypeError("Insufficient bytes");let i=0;for(let r=0;r<4;r++)i|=e[t+r]<<24-r*8;return i}uint64(e,t){if(e.byteLength<t+8)throw new TypeError("Insufficient bytes");let i=0n;for(let r=0;r<8;r++)i|=BigInt(e[t+r])<<BigInt(56-r*8);return i}putUint8(e,t,i){if(e.length<i+1)throw new TypeError("Not enough space");if(t<0||t>255)throw new TypeError("Invalid uint8 value");e[i]=t}putUint16(e,t,i){if(e.length<i+2)throw new TypeError("Not enough space");if(t<0||t>65535)throw new TypeError("Invalid uint16 value");e[i]=t>>8,e[i+1]=t&255}putUint32(e,t,i){if(e.length<i+4)throw new TypeError("Not enough space");if(t<0||t>4294967295)throw new TypeError("Invalid uint32 value");for(let r=0;r<4;r++)e[i+r]=t>>(3-r)*8&255}putUint64(e,t,i){if(e.length<i+8)throw new TypeError("Not enough space");if(t<0||t>18446744073709551615n)throw new TypeError("Invalid uint64 value");for(let r=0;r<8;r++)e[i+r]=Number(t>>BigInt((7-r)*8)&0xffn)}}const Vu=new y0;function ut(n,e){return(n<<32-e|n>>>e)>>>0}function v0(n){const e=new w0;return e.update(n),e.digest()}class w0{constructor(){te(this,"blockSize",64);te(this,"size",32);te(this,"blocks",new Uint8Array(64));te(this,"currentBlockSize",0);te(this,"H",new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]));te(this,"l",0n);te(this,"w",new Uint32Array(64))}update(e){if(this.l+=BigInt(e.byteLength)*8n,this.currentBlockSize+e.byteLength<64){this.blocks.set(e,this.currentBlockSize),this.currentBlockSize+=e.byteLength;return}let t=0;if(this.currentBlockSize>0){const i=e.slice(0,64-this.currentBlockSize);this.blocks.set(i,this.currentBlockSize),this.process(),t+=i.byteLength,this.currentBlockSize=0}for(;t+64<=e.byteLength;){const i=e.slice(t,t+64);this.blocks.set(i),this.process(),t+=64}if(e.byteLength-t>0){const i=e.slice(t);this.blocks.set(i),this.currentBlockSize=i.byteLength}}digest(){this.blocks[this.currentBlockSize]=128,this.currentBlockSize+=1,64-this.currentBlockSize<8&&(this.blocks.fill(0,this.currentBlockSize),this.process(),this.currentBlockSize=0),this.blocks.fill(0,this.currentBlockSize),Vu.putUint64(this.blocks,this.l,this.blockSize-8),this.process();const e=new Uint8Array(32);for(let t=0;t<8;t++)Vu.putUint32(e,this.H[t],t*4);return e}process(){for(let d=0;d<16;d++)this.w[d]=(this.blocks[d*4]<<24|this.blocks[d*4+1]<<16|this.blocks[d*4+2]<<8|this.blocks[d*4+3])>>>0;for(let d=16;d<64;d++){const h=(ut(this.w[d-2],17)^ut(this.w[d-2],19)^this.w[d-2]>>>10)>>>0,g=(ut(this.w[d-15],7)^ut(this.w[d-15],18)^this.w[d-15]>>>3)>>>0;this.w[d]=h+this.w[d-7]+g+this.w[d-16]|0}let e=this.H[0],t=this.H[1],i=this.H[2],r=this.H[3],s=this.H[4],a=this.H[5],c=this.H[6],l=this.H[7];for(let d=0;d<64;d++){const h=(ut(s,6)^ut(s,11)^ut(s,25))>>>0,g=(s&a^~s&c)>>>0,y=l+h+g+b0[d]+this.w[d]|0,I=(ut(e,2)^ut(e,13)^ut(e,22))>>>0,f=(e&t^e&i^t&i)>>>0,_=I+f|0;l=c,c=a,a=s,s=r+y|0,r=i,i=t,t=e,e=y+_|0}this.H[0]=e+this.H[0]|0,this.H[1]=t+this.H[1]|0,this.H[2]=i+this.H[2]|0,this.H[3]=r+this.H[3]|0,this.H[4]=s+this.H[4]|0,this.H[5]=a+this.H[5]|0,this.H[6]=c+this.H[6]|0,this.H[7]=l+this.H[7]|0}}const b0=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);new BigUint64Array([0x428a2f98d728ae22n,0x7137449123ef65cdn,0xb5c0fbcfec4d3b2fn,0xe9b5dba58189dbbcn,0x3956c25bf348b538n,0x59f111f1b605d019n,0x923f82a4af194f9bn,0xab1c5ed5da6d8118n,0xd807aa98a3030242n,0x12835b0145706fben,0x243185be4ee4b28cn,0x550c7dc3d5ffb4e2n,0x72be5d74f27b896fn,0x80deb1fe3b1696b1n,0x9bdc06a725c71235n,0xc19bf174cf692694n,0xe49b69c19ef14ad2n,0xefbe4786384f25e3n,0x0fc19dc68b8cd5b5n,0x240ca1cc77ac9c65n,0x2de92c6f592b0275n,0x4a7484aa6ea6e483n,0x5cb0a9dcbd41fbd4n,0x76f988da831153b5n,0x983e5152ee66dfabn,0xa831c66d2db43210n,0xb00327c898fb213fn,0xbf597fc7beef0ee4n,0xc6e00bf33da88fc2n,0xd5a79147930aa725n,0x06ca6351e003826fn,0x142929670a0e6e70n,0x27b70a8546d22ffcn,0x2e1b21385c26c926n,0x4d2c6dfc5ac42aedn,0x53380d139d95b3dfn,0x650a73548baf63den,0x766a0abb3c77b2a8n,0x81c2c92e47edaee6n,0x92722c851482353bn,0xa2bfe8a14cf10364n,0xa81a664bbc423001n,0xc24b8b70d0f89791n,0xc76c51a30654be30n,0xd192e819d6ef5218n,0xd69906245565a910n,0xf40e35855771202an,0x106aa07032bbd1b8n,0x19a4c116b8d2d0c8n,0x1e376c085141ab53n,0x2748774cdf8eeb99n,0x34b0bcb5e19b48a8n,0x391c0cb3c5c95a63n,0x4ed8aa4ae3418acbn,0x5b9cca4f7763e373n,0x682e6ff3d6b2b8a3n,0x748f82ee5defb2fcn,0x78a5636f43172f60n,0x84c87814a1f0ab72n,0x8cc702081a6439ecn,0x90befffa23631e28n,0xa4506cebde82bde9n,0xbef9a3f7b2c67915n,0xc67178f2e372532bn,0xca273eceea26619cn,0xd186b8c721c0c207n,0xeada7dd6cde0eb1en,0xf57d4f7fee6ed178n,0x06f067aa72176fban,0x0a637dc5a2c898a6n,0x113f9804bef90daen,0x1b710b35131c471bn,0x28db77f523047d84n,0x32caab7b40c72493n,0x3c9ebe0a15c9bebcn,0x431d67c49c100d4cn,0x4cc5d4becb3e42b6n,0x597f299cfc657e2an,0x5fcb6fab3ad6faecn,0x6c44198c4a475817n]);class k0{constructor(e){te(this,"data");this.data=e}tokenType(){if("token_type"in this.data&&typeof this.data.token_type=="string")return this.data.token_type;throw new Error("Missing or invalid 'token_type' field")}accessToken(){if("access_token"in this.data&&typeof this.data.access_token=="string")return this.data.access_token;throw new Error("Missing or invalid 'access_token' field")}accessTokenExpiresInSeconds(){if("expires_in"in this.data&&typeof this.data.expires_in=="number")return this.data.expires_in;throw new Error("Missing or invalid 'expires_in' field")}accessTokenExpiresAt(){return new Date(Date.now()+this.accessTokenExpiresInSeconds()*1e3)}hasRefreshToken(){return"refresh_token"in this.data&&typeof this.data.refresh_token=="string"}refreshToken(){if("refresh_token"in this.data&&typeof this.data.refresh_token=="string")return this.data.refresh_token;throw new Error("Missing or invalid 'refresh_token' field")}hasScopes(){return"scope"in this.data&&typeof this.data.scope=="string"}scopes(){if("scope"in this.data&&typeof this.data.scope=="string")return this.data.scope.split(" ");throw new Error("Missing or invalid 'scope' field")}idToken(){if("id_token"in this.data&&typeof this.data.id_token=="string")return this.data.id_token;throw new Error("Missing or invalid field 'id_token'")}}function x0(n){const e=v0(new TextEncoder().encode(n));return wf(e)}function S0(){const n=new Uint8Array(32);return crypto.getRandomValues(n),wf(n)}function ii(n,e){const t=new TextEncoder().encode(e.toString()),i=new Request(n,{method:"POST",body:t});return i.headers.set("Content-Type","application/x-www-form-urlencoded"),i.headers.set("Accept","application/json"),i.headers.set("User-Agent","arctic"),i.headers.set("Content-Length",t.byteLength.toString()),i}function ao(n,e){const t=new TextEncoder().encode(`${n}:${e}`);return g0(t)}async function Wr(n){let e;try{e=await fetch(n)}catch(t){throw new xf(t)}if(e.status===400||e.status===401){let t;try{t=await e.json()}catch{throw new Xi(e.status)}if(typeof t!="object"||t===null)throw new xn(e.status,t);let i;try{i=kf(t)}catch{throw new xn(e.status,t)}throw i}if(e.status===200){let t;try{t=await e.json()}catch{throw new Xi(e.status)}if(typeof t!="object"||t===null)throw new xn(e.status,t);return new k0(t)}throw e.body!==null&&await e.body.cancel(),new Xi(e.status)}async function A0(n){let e;try{e=await fetch(n)}catch(t){throw new xf(t)}if(e.status===400||e.status===401){let t;try{t=await e.json()}catch{throw new xn(e.status,null)}if(typeof t!="object"||t===null)throw new xn(e.status,t);let i;try{i=kf(t)}catch{throw new xn(e.status,t)}throw i}if(e.status===200){e.body!==null&&await e.body.cancel();return}throw e.body!==null&&await e.body.cancel(),new Xi(e.status)}function kf(n){let e;if("error"in n&&typeof n.error=="string")e=n.error;else throw new Error("Invalid error response");let t=null,i=null,r=null;if("error_description"in n){if(typeof n.error_description!="string")throw new Error("Invalid data");t=n.error_description}if("error_uri"in n){if(typeof n.error_uri!="string")throw new Error("Invalid data");i=n.error_uri}if("state"in n){if(typeof n.state!="string")throw new Error("Invalid data");r=n.state}return new I0(e,t,i,r)}class xf extends Error{constructor(e){super("Failed to send request",{cause:e})}}class I0 extends Error{constructor(t,i,r,s){super(`OAuth request error: ${t}`);te(this,"code");te(this,"description");te(this,"uri");te(this,"state");this.code=t,this.description=i,this.uri=r,this.state=s}}class Xi extends Error{constructor(t){super("Unexpected error response");te(this,"status");this.status=t}}class xn extends Error{constructor(t,i){super("Unexpected error response body");te(this,"status");te(this,"data");this.status=t,this.data=i}}class $c{constructor(e,t,i){te(this,"clientId");te(this,"clientPassword");te(this,"redirectURI");this.clientId=e,this.clientPassword=t,this.redirectURI=i}createAuthorizationURL(e,t,i){const r=new URL(e);return r.searchParams.set("response_type","code"),r.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&r.searchParams.set("redirect_uri",this.redirectURI),r.searchParams.set("state",t),i.length>0&&r.searchParams.set("scope",i.join(" ")),r}createAuthorizationURLWithPKCE(e,t,i,r,s){const a=new URL(e);if(a.searchParams.set("response_type","code"),a.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&a.searchParams.set("redirect_uri",this.redirectURI),a.searchParams.set("state",t),i===vi.S256){const c=x0(r);a.searchParams.set("code_challenge_method","S256"),a.searchParams.set("code_challenge",c)}else i===vi.Plain&&(a.searchParams.set("code_challenge_method","plain"),a.searchParams.set("code_challenge",r));return s.length>0&&a.searchParams.set("scope",s.join(" ")),a}async validateAuthorizationCode(e,t,i){const r=new URLSearchParams;r.set("grant_type","authorization_code"),r.set("code",t),this.redirectURI!==null&&r.set("redirect_uri",this.redirectURI),i!==null&&r.set("code_verifier",i),this.clientPassword===null&&r.set("client_id",this.clientId);const s=ii(e,r);if(this.clientPassword!==null){const c=ao(this.clientId,this.clientPassword);s.headers.set("Authorization",`Basic ${c}`)}return await Wr(s)}async refreshAccessToken(e,t,i){const r=new URLSearchParams;r.set("grant_type","refresh_token"),r.set("refresh_token",t),this.clientPassword===null&&r.set("client_id",this.clientId),i.length>0&&r.set("scope",i.join(" "));const s=ii(e,r);if(this.clientPassword!==null){const c=ao(this.clientId,this.clientPassword);s.headers.set("Authorization",`Basic ${c}`)}return await Wr(s)}async revokeToken(e,t){const i=new URLSearchParams;i.set("token",t),this.clientPassword===null&&i.set("client_id",this.clientId);const r=ii(e,i);if(this.clientPassword!==null){const s=ao(this.clientId,this.clientPassword);r.headers.set("Authorization",`Basic ${s}`)}await A0(r)}}var vi;(function(n){n[n.S256=0]="S256",n[n.Plain=1]="Plain"})(vi||(vi={}));var Mu;(function(n){n[n.Include=0]="Include",n[n.None=1]="None"})(Mu||(Mu={}));var Hu;(function(n){n[n.Required=0]="Required",n[n.Ignore=1]="Ignore"})(Hu||(Hu={}));function ri(n){return j0(n,z0,Gr.None)}function j0(n,e,t){let i="";for(let r=0;r<n.byteLength;r+=3){let s=0,a=0;for(let c=0;c<3&&r+c<n.byteLength;c++)s=s<<8|n[r+c],a+=8;for(let c=0;c<4;c++)a>=6?(i+=e[s>>a-6&63],a-=6):a>0?(i+=e[s<<6-a&63],a=0):t===Gr.Include&&(i+="=")}return i}const z0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var Gr;(function(n){n[n.Include=0]="Include",n[n.None=1]="None"})(Gr||(Gr={}));var qu;(function(n){n[n.Required=0]="Required",n[n.Ignore=1]="Ignore"})(qu||(qu={}));function E0(n,e,t){const i=ri(new TextEncoder().encode(n)),r=ri(new TextEncoder().encode(e)),s=ri(t);return i+"."+r+"."+s}function $0(n,e){const t=ri(new TextEncoder().encode(n)),i=ri(new TextEncoder().encode(e)),r=t+"."+i;return new TextEncoder().encode(r)}const C0="https://appleid.apple.com/auth/authorize",O0="https://appleid.apple.com/auth/token";class Sf{constructor(e,t,i,r,s){te(this,"clientId");te(this,"teamId");te(this,"keyId");te(this,"pkcs8PrivateKey");te(this,"redirectURI");this.clientId=e,this.teamId=t,this.keyId=i,this.pkcs8PrivateKey=r,this.redirectURI=s}createAuthorizationURL(e,t){const i=new URL(C0);return i.searchParams.set("response_type","code"),i.searchParams.set("client_id",this.clientId),i.searchParams.set("state",e),t.length>0&&i.searchParams.set("scope",t.join(" ")),i.searchParams.set("redirect_uri",this.redirectURI),i}async validateAuthorizationCode(e){const t=new URLSearchParams;t.set("grant_type","authorization_code"),t.set("code",e),t.set("redirect_uri",this.redirectURI),t.set("client_id",this.clientId);const i=await this.createClientSecret();t.set("client_secret",i);const r=ii(O0,t);return await Wr(r)}async createClientSecret(){const e=await crypto.subtle.importKey("pkcs8",this.pkcs8PrivateKey,{name:"ECDSA",namedCurve:"P-256"},!1,["sign"]),t=Math.floor(Date.now()/1e3),i=JSON.stringify({typ:"JWT",alg:"ES256",kid:this.keyId}),r=JSON.stringify({iss:this.teamId,exp:t+5*60,aud:["https://appleid.apple.com"],sub:this.clientId,iat:t}),s=new Uint8Array(await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},e,$0(i,r)));return E0(i,r,s)}}const B0="https://www.facebook.com/v16.0/dialog/oauth",N0="https://graph.facebook.com/v16.0/oauth/access_token";class Af{constructor(e,t,i){te(this,"clientId");te(this,"clientSecret");te(this,"redirectURI");this.clientId=e,this.clientSecret=t,this.redirectURI=i}createAuthorizationURL(e,t){const i=new URL(B0);return i.searchParams.set("response_type","code"),i.searchParams.set("client_id",this.clientId),i.searchParams.set("state",e),t.length>0&&i.searchParams.set("scope",t.join(" ")),i.searchParams.set("redirect_uri",this.redirectURI),i}async validateAuthorizationCode(e){const t=new URLSearchParams;t.set("grant_type","authorization_code"),t.set("code",e),t.set("redirect_uri",this.redirectURI),t.set("client_id",this.clientId),t.set("client_secret",this.clientSecret);const i=ii(N0,t);return await Wr(i)}}const R0="https://accounts.google.com/o/oauth2/v2/auth",Ku="https://oauth2.googleapis.com/token",T0="https://oauth2.googleapis.com/revoke";class If{constructor(e,t,i){te(this,"client");this.client=new $c(e,t,i)}createAuthorizationURL(e,t,i){return this.client.createAuthorizationURLWithPKCE(R0,e,vi.S256,t,i)}async validateAuthorizationCode(e,t){return await this.client.validateAuthorizationCode(Ku,e,t)}async refreshAccessToken(e){return await this.client.refreshAccessToken(Ku,e,[])}async revokeToken(e){await this.client.revokeToken(T0,e)}}class Cc{constructor(e,t){te(this,"value");te(this,"unit");this.value=e,this.unit=t}milliseconds(){return this.unit==="ms"?this.value:this.unit==="s"?this.value*1e3:this.unit==="m"?this.value*1e3*60:this.unit==="h"?this.value*1e3*60*60:this.unit==="d"?this.value*1e3*60*60*24:this.value*1e3*60*60*24*7}seconds(){return this.milliseconds()/1e3}transform(e){return new Cc(Math.round(this.milliseconds()*e),"ms")}}async function Fu(n,e,t,i){const r={alg:n,typ:"JWT",...i==null?void 0:i.headers},s={...t};(i==null?void 0:i.audiences)!==void 0&&(s.aud=i.audiences),(i==null?void 0:i.subject)!==void 0&&(s.sub=i.subject),(i==null?void 0:i.issuer)!==void 0&&(s.iss=i.issuer),(i==null?void 0:i.jwtId)!==void 0&&(s.jti=i.jwtId),(i==null?void 0:i.expiresIn)!==void 0&&(s.exp=Math.floor(Date.now()/1e3)+i.expiresIn.seconds()),(i==null?void 0:i.notBefore)!==void 0&&(s.nbf=Math.floor(i.notBefore.getTime()/1e3)),s.iat=Math.floor(Date.now()/1e3);const a=new TextEncoder,c=Yt.encode(a.encode(JSON.stringify(r)),{includePadding:!1}),l=Yt.encode(a.encode(JSON.stringify(s)),{includePadding:!1}),d=a.encode([c,l].join(".")),h=await U0(n).sign(e,d),g=Yt.encode(new Uint8Array(h),{includePadding:!1});return[c,l,g].join(".")}function P0(n){const e=n.split(".");return e.length!==3?null:e}function Oc(n){const e=P0(n);if(!e)return null;const t=new TextDecoder,i=Yt.decode(e[0],{strict:!1}),r=Yt.decode(e[1],{strict:!1}),s=JSON.parse(t.decode(i));if(typeof s!="object"||s===null||!("alg"in s)||!L0(s.alg)||"typ"in s&&s.typ!=="JWT")return null;const a=JSON.parse(t.decode(r));if(typeof a!="object"||a===null)return null;const c={algorithm:s.alg,expiresAt:null,subject:null,issuedAt:null,issuer:null,jwtId:null,audiences:null,notBefore:null};if("exp"in a){if(typeof a.exp!="number")return null;c.expiresAt=new Date(a.exp*1e3)}if("iss"in a){if(typeof a.iss!="string")return null;c.issuer=a.iss}if("sub"in a){if(typeof a.sub!="string")return null;c.subject=a.sub}if("aud"in a)if(Array.isArray(a.aud)){for(const l of a.aud)if(typeof l!="string")return null;c.audiences=a.aud}else{if(typeof a.aud!="string")return null;c.audiences=[a.aud]}if("nbf"in a){if(typeof a.nbf!="number")return null;c.notBefore=new Date(a.nbf*1e3)}if("iat"in a){if(typeof a.iat!="number")return null;c.issuedAt=new Date(a.iat*1e3)}if("jti"in a){if(typeof a.jti!="string")return null;c.jwtId=a.jti}return{value:n,header:{...s,typ:"JWT",alg:s.alg},payload:{...a},parts:e,...c}}function U0(n){return new H_(D0[n])}function L0(n){return typeof n!="string"?!1:["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512","PS256","PS384","PS512"].includes(n)}const D0={RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512"},Ms=o.z.object({iss:o.z.string().url(),sub:o.z.string(),aud:o.z.string(),exp:o.z.number(),email:o.z.string().optional(),given_name:o.z.string().optional(),family_name:o.z.string().optional(),name:o.z.string().optional(),iat:o.z.number(),auth_time:o.z.number().optional(),nonce:o.z.string().optional(),acr:o.z.string().optional(),amr:o.z.array(o.z.string()).optional(),azp:o.z.string().optional(),at_hash:o.z.string().optional(),c_hash:o.z.string().optional()}).passthrough();Ms.omit({iat:!0,auth_time:!0,nonce:!0,acr:!0,amr:!0,azp:!0,at_hash:!0,c_hash:!0});function jf(n){const{options:e}=n;if(!e||!e.client_id||!e.team_id||!e.kid||!e.app_secret)throw new Error("Missing required Apple authentication parameters");const t=Buffer.from(e.app_secret,"utf-8"),i=t.toString().replace(/-----BEGIN PRIVATE KEY-----|-----END PRIVATE KEY-----|\s/g,""),r=Uint8Array.from(Buffer.from(i,"base64"));return t.fill(0),{options:e,keyArray:r}}async function V0(n,e){var l,d;const{options:t,keyArray:i}=jf(e),r=new Sf(t.client_id,t.team_id,t.kid,i,`${n.env.ISSUER}callback`),s=st(),a=await r.createAuthorizationURL(s,((l=t.scope)==null?void 0:l.split(" "))||["name","email"]);return(((d=t.scope)==null?void 0:d.split(" "))||["name","email"]).some(h=>["email","name"].includes(h))&&a.searchParams.set("response_mode","form_post"),{redirectUrl:a.href,code:s}}async function M0(n,e,t){const{options:i,keyArray:r}=jf(e),a=await new Sf(i.client_id,i.team_id,i.kid,r,`${n.env.ISSUER}callback`).validateAuthorizationCode(t),c=Oc(a.idToken());if(!c)throw new Error("Invalid ID token");const l=Ms.parse(c.payload);return{sub:l.sub,email:l.email,given_name:l.given_name,family_name:l.family_name,name:l.name,picture:l.picture,locale:l.locale}}const H0=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:V0,validateAuthorizationCodeAndGetUser:M0},Symbol.toStringTag,{value:"Module"}));async function q0(n,e){var a;const{options:t}=e;if(!(t!=null&&t.client_id)||!t.client_secret)throw new Error("Missing required authentication parameters");const i=new Af(t.client_id,t.client_secret,`${n.env.ISSUER}callback`),r=st();return{redirectUrl:i.createAuthorizationURL(r,((a=t.scope)==null?void 0:a.split(" "))||["email"]).href,code:r}}async function K0(n,e,t){const{options:i}=e;if(!(i!=null&&i.client_id)||!i.client_secret)throw new Error("Missing required authentication parameters");const s=await new Af(i.client_id,i.client_secret,`${n.env.ISSUER}callback`).validateAuthorizationCode(t),a=Oc(s.idToken());if(!a)throw new Error("Invalid ID token");const c=Ms.parse(a.payload);return{sub:c.sub,email:c.email,given_name:c.given_name,family_name:c.family_name,name:c.name,picture:c.picture,locale:c.locale}}const F0=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:q0,validateAuthorizationCodeAndGetUser:K0},Symbol.toStringTag,{value:"Module"}));async function W0(n,e){var c;const{options:t}=e;if(!(t!=null&&t.client_id)||!t.client_secret)throw new Error("Missing required Google authentication parameters");const i=new If(t.client_id,t.client_secret,`${n.env.ISSUER}callback`),r=st(),s=S0();return{redirectUrl:i.createAuthorizationURL(r,s,((c=t.scope)==null?void 0:c.split(" "))??["email","profile"]).href,code:r,codeVerifier:s}}async function G0(n,e,t,i){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret||!i)throw new Error("Missing required authentication parameters");const a=await new If(r.client_id,r.client_secret,`${n.env.ISSUER}callback`).validateAuthorizationCode(t,i);console.log("got here");const c=Oc(a.idToken());if(!c)throw new Error("Invalid ID token");const l=Ms.parse(c.payload);return{sub:l.sub,email:l.email,given_name:l.given_name,family_name:l.family_name,name:l.name,picture:l.picture,locale:l.locale}}const J0=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:W0,validateAuthorizationCodeAndGetUser:G0},Symbol.toStringTag,{value:"Module"}));async function Z0(n,e){var a;const{options:t}=e;if(!(t!=null&&t.client_id)||!t.client_secret)throw new Error("Missing required authentication parameters");const i=new $c(t.client_id,t.client_secret,`${n.env.ISSUER}callback`),r=st(),s=i.createAuthorizationURL("https://api.vipps.no/access-management-1.0/access/oauth2/auth",r,((a=t.scope)==null?void 0:a.split(" "))||["openid","email","phoneNumber","name","address","birthDate"]);return s.searchParams.set("response_type","code"),s.searchParams.set("response_mode","query"),{redirectUrl:s.href,code:r}}async function Y0(n,e,t){const{options:i}=e;if(!(i!=null&&i.client_id)||!i.client_secret)throw new Error("Missing required authentication parameters");const s=await new $c(i.client_id,i.client_secret,`${n.env.ISSUER}callback`).validateAuthorizationCode("https://api.vipps.no/access-management-1.0/access/oauth2/token",t,null);return await(await fetch("https://api.vipps.no/vipps-userinfo-api/userinfo",{headers:{Authorization:`Bearer ${s.accessToken}`}})).json()}const X0=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:Z0,validateAuthorizationCodeAndGetUser:Y0},Symbol.toStringTag,{value:"Module"}));function zf(n,e){const t=n.env.STRATEGIES||{},r={apple:H0,facebook:F0,"google-oauth2":J0,vipps:X0,...t}[e];if(!r)throw new Error(`Strategy ${e} not found`);return r}async function Ef(n,e){const t=await n.data.clients.get(e);if(!t)throw new B(403,{message:"Client not found"});const i=n.DEFAULT_CLIENT_ID?await n.data.clients.get(n.DEFAULT_CLIENT_ID):void 0,r=await n.data.connections.list(t.tenant.id),s=n.DEFAULT_TENANT_ID?await n.data.connections.list(n.DEFAULT_TENANT_ID):{connections:[]},a=r.connections.map(c=>{var h;const l=(h=s.connections)==null?void 0:h.find(g=>g.name===c.name);return l!=null&&l.options?Et.parse({...l||{},...c,options:{...l.options||{},...c.options}}):c}).filter(c=>c);return{...t,web_origins:[...(i==null?void 0:i.web_origins)||[],...t.web_origins||[],`${n.ISSUER}u/login`],allowed_logout_urls:[...(i==null?void 0:i.allowed_logout_urls)||[],...t.allowed_logout_urls||[],n.ISSUER],callbacks:[...(i==null?void 0:i.callbacks)||[],...t.callbacks||[],`${n.ISSUER}u/info`],connections:a,domains:[...t.domains||[],...(i==null?void 0:i.domains)||[]],tenant:{...(i==null?void 0:i.tenant)||{},...t.tenant}}}function Hs(n,e=[]){try{const t=new URL(n);return e.some(i=>{try{return Q0(t,new URL(i))}catch{return!1}})}catch{return!1}}function Q0(n,e){if(n.protocol!==e.protocol||n.pathname!==e.pathname)return!1;if(e.hostname.startsWith("*.")&&e.hostname.split(".").length>2&&["http:","https:"].includes(e.protocol)){const t=e.hostname.split(".").slice(1).join(".");return n.hostname.endsWith(t)}return n.hostname===e.hostname}function em(n){try{const t=/-----BEGIN (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----([^-]*)-----END (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----/.exec(n);if(!t||!t[1])throw new Error("Invalid PEM format");return Uint8Array.from(atob(t[1].replace(/\s/g,"")),i=>i.charCodeAt(0)).buffer}finally{n=n.replace(/./g,"\0")}}async function tm(n,e){if(e==="plain")return n;const t=new TextEncoder().encode(n),i=await _f(t);return Yt.encode(new Uint8Array(i))}function $f(n,e,t){const i=[];return i.push([encodeURIComponent(n),encodeURIComponent(e)]),(t==null?void 0:t.domain)!==void 0&&i.push(["Domain",t.domain]),(t==null?void 0:t.expires)!==void 0&&i.push(["Expires",t.expires.toUTCString()]),t!=null&&t.httpOnly&&i.push(["HttpOnly"]),(t==null?void 0:t.maxAge)!==void 0&&i.push(["Max-Age",t.maxAge.toString()]),(t==null?void 0:t.path)!==void 0&&i.push(["Path",t.path]),(t==null?void 0:t.sameSite)==="lax"&&i.push(["SameSite","Lax"]),(t==null?void 0:t.sameSite)==="none"&&i.push(["SameSite","None"]),(t==null?void 0:t.sameSite)==="strict"&&i.push(["SameSite","Strict"]),t!=null&&t.secure&&i.push(["Secure"]),i.map(r=>r.join("=")).join("; ")}function nm(n){const e=new Map,t=n.split("; ");for(const i of t){const r=i.split("="),s=r[0],a=r[1]??"";s&&e.set(decodeURIComponent(s),decodeURIComponent(a))}return e}function Bc(n){return`${n}-${p0}`}function Cf(n,e){return e?nm(e).get(Bc(n)):void 0}function im(n){const e={path:"/",httpOnly:!0,secure:!0,maxAge:0};return $f(Bc(n),"",{...e,sameSite:"none"})}function Of(n,e){const t={path:"/",httpOnly:!0,secure:!0,maxAge:vf};return $f(Bc(n),e,{...t,sameSite:"none"})}const Wu=["sub","iss","aud","exp","nbf","iat","jti"];async function Nc(n,e){var _,k;const{authParams:t,user:i,client:r,sid:s}=e,c=(await n.env.data.keys.list()).filter(x=>!x.revoked_at||new Date(x.revoked_at)>new Date),l=c[c.length-1];if(!(l!=null&&l.pkcs7))throw new B(500,{message:"No signing key available"});const d=em(l.pkcs7),h={aud:t.audience||"default",scope:t.scope||"",sub:(i==null?void 0:i.user_id)||t.client_id,iss:n.env.ISSUER,tenant_id:n.var.tenant_id,sid:s},g=i&&((_=t.scope)!=null&&_.split(" ").includes("openid"))?{aud:t.client_id,sub:i.user_id,iss:n.env.ISSUER,sid:s,nonce:t.nonce,given_name:i.given_name,family_name:i.family_name,nickname:i.nickname,picture:i.picture,locale:i.locale,name:i.name,email:i.email,email_verified:i.email_verified}:void 0;(k=n.env.hooks)!=null&&k.onExecuteCredentialsExchange&&await n.env.hooks.onExecuteCredentialsExchange({client:r,user:i,scope:t.scope||"",grant_type:""},{accessToken:{setCustomClaim:(x,O)=>{if(Wu.includes(x))throw new Error(`Cannot overwrite reserved claim '${x}'`);h[x]=O}},idToken:{setCustomClaim:(x,O)=>{if(Wu.includes(x))throw new Error(`Cannot overwrite reserved claim '${x}'`);g&&(g[x]=O)}},access:{deny:x=>{throw new B(400,{message:`Access denied: ${x}`})}}});const y={includeIssuedTimestamp:!0,expiresIn:new Cc(1,"d"),headers:{kid:l.kid}},I=await Fu("RS256",d,h,y),f=g?await Fu("RS256",d,g,y):void 0;return{access_token:I,id_token:f,token_type:"Bearer",expires_in:86400}}async function Bf(n,e,t){return await n.env.data.sessions.create(t.tenant.id,{session_id:st(),user_id:e.user_id,client_id:t.id,expires_at:new Date(Date.now()+vf*1e3).toISOString(),used_at:new Date().toISOString()})}async function Ui(n,e){const{authParams:t,user:i,client:r}=e,s=e.sid||(await Bf(n,i,r)).session_id,a=await Nc(n,{authParams:t,user:i,client:r,sid:s}),c=new Headers({"set-cookie":Of(r.tenant.id,s)});if(t.response_mode===Tn.WEB_MESSAGE)return n.json(a,{headers:c});if((t.response_type||Rt.CODE)===Rt.CODE){if(!e.loginSession)throw new B(500,{message:"Login session not found"});const d=await n.env.data.codes.create(r.tenant.id,{code_id:st(),user_id:i.user_id,code_type:"authorization_code",login_id:e.loginSession.login_id,expires_at:new Date(Date.now()+f0*1e3).toISOString()});c.set("location",`${t.redirect_uri}?state=${e.authParams.state}&code=${d.code_id}`)}return new Response("Redirecting",{status:302,headers:c})}function rm(n){return async(e,t)=>{if(!t.email||!t.email_verified)return n.users.create(e,t);const i=await kd({userAdapter:n.users,tenant_id:e,email:t.email});return i?(await n.users.create(e,{...t,linked_to:i.user_id}),i):n.users.create(e,t)}}async function Nf(n,e,t){for await(const i of e)if(!(await fetch(i.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).ok){const s=be(n,{type:_e.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid password"});await t.logs.create(n.var.tenant_id,s)}}function sm(n,e){return async(t,i)=>{const{hooks:r}=await e.hooks.list(t);return await Nf(n,r,{tenant_id:t,user:i,trigger_id:"post-user-registration"}),i}}function om(n,e){return async(t,i)=>{const{hooks:r}=await e.hooks.list(t,{q:"trigger_id:pre-user-signup",page:0,per_page:100,include_totals:!1});await Nf(n,r,{tenant_id:t,email:i,trigger_id:"pre-user-signup"})}}function am(n,e){return async(t,i)=>{let r=await rm(e)(t,i);return await sm(n,e)(t,r),r}}async function cm(n,e,t,i){if(e.disable_sign_ups&&!await kd({userAdapter:n.env.data.users,tenant_id:e.tenant.id,email:i})){const s=be(n,{type:_e.FAILED_SIGNUP,description:"Public signup is disabled"});throw await n.env.data.logs.create(e.tenant.id,s),new B(400,{message:"Signups are disabled for this client"})}await om(n,t)(n.var.tenant_id||"",i)}function lm(n,e){return{...e,users:{...e.users,create:am(n,e)}}}async function um(n,e,t,i){if(!i.state)throw new B(400,{message:"State not found"});const r=e.connections.find(l=>l.name===t);if(!r){n.set("client_id",e.id);const l=be(n,{type:_e.FAILED_LOGIN,description:"Connection not found"});throw await n.env.data.logs.create(e.tenant.id,l),new B(403,{message:"Connection Not Found"})}let s=await n.env.data.logins.get(e.tenant.id,i.state);s||(s=await n.env.data.logins.create(e.tenant.id,{expires_at:new Date(Date.now()+Fr*1e3).toISOString(),authParams:i,...Rn(n.req)}));const c=await zf(n,r.strategy).getRedirect(n,r);return await n.env.data.codes.create(e.tenant.id,{login_id:s.login_id,code_id:c.code,code_type:"oauth2_state",connection_id:r.id,code_verifier:c.codeVerifier,expires_at:new Date(Date.now()+h0*1e3).toISOString()}),n.redirect(c.redirectUrl)}async function Gu(n,{code:e,state:t}){var f;const{env:i}=n,r=await i.data.codes.get(n.var.tenant_id||"",t,"oauth2_state");if(!r||!r.connection_id)throw new B(403,{message:"State not found"});const s=await i.data.logins.get(n.var.tenant_id||"",r.login_id);if(!s)throw new B(403,{message:"Session not found"});const a=await Ef(i,s.authParams.client_id);n.set("client_id",a.id),n.set("tenant_id",a.tenant.id);const c=a.connections.find(_=>_.id===r.connection_id);if(!c){const _=be(n,{type:_e.FAILED_LOGIN,description:"Connection not found"});throw await i.data.logs.create(a.tenant.id,_),new B(403,{message:"Connection not found"})}if(n.set("connection",c.name),!s.authParams.redirect_uri){const _=be(n,{type:_e.FAILED_LOGIN,description:"Redirect URI not defined"});throw await i.data.logs.create(a.tenant.id,_),new B(403,{message:"Redirect URI not defined"})}if(!Hs(s.authParams.redirect_uri,a.callbacks||[])){const _=`Invalid redirect URI - ${s.authParams.redirect_uri}`,k=be(n,{type:_e.FAILED_LOGIN,description:_});throw await i.data.logs.create(a.tenant.id,k),new B(403,{message:_})}const d=await zf(n,c.strategy).validateAuthorizationCodeAndGetUser(n,c,e,r.code_verifier),{sub:h,...g}=d;n.set("user_id",h);const y=((f=d.email)==null?void 0:f.toLocaleLowerCase())||`${c.name}.${h}@${new URL(n.env.ISSUER).hostname}`;n.set("username",y);let I=await Xr({userAdapter:i.data.users,tenant_id:a.tenant.id,email:y,provider:c.name});if(!I){try{await cm(n,a,n.env.data,y)}catch(_){const k=_;throw new B(500,{message:`Failed to run preUserSignupHook: ${k.message}`})}I=await i.data.users.create(a.tenant.id,{user_id:`${c.name}|${h}`,email:y,name:y,provider:c.name,connection:c.name,email_verified:!0,last_ip:"",is_social:!0,last_login:new Date().toISOString(),profileData:JSON.stringify(g)}),n.set("user_id",I.user_id)}return Ui(n,{client:a,authParams:s.authParams,loginSession:s,user:I})}async function Ju(n,e,t,i,r,s){const a=await n.env.data.codes.get(n.var.tenant_id||"",e,"oauth2_state");if(!a)throw new B(400,{message:"State not found"});const c=await n.env.data.logins.get(n.var.tenant_id,a.login_id);if(!c)throw new B(400,{message:"Login not found"});const{redirect_uri:l}=c.authParams;if(!l)throw new B(400,{message:"Redirect uri not found"});const d=be(n,{type:_e.FAILED_LOGIN,description:`Failed connection login: ${r} ${t}, ${i}`});$t(n,n.env.data.logs.create(n.var.tenant_id,d));const h=new URL(l);return d0(h,{error:t,error_description:i,error_reason:s,error_code:r,state:c.authParams.state}),n.redirect(`${n.env.ISSUER}u/enter-email?state=${c.login_id}&error=${t}`)}const dm=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:o.z.object({state:o.z.string(),code:o.z.string().optional(),scope:o.z.string().optional(),hd:o.z.string().optional(),error:o.z.string().optional(),error_description:o.z.string().optional(),error_code:o.z.string().optional(),error_reason:o.z.string().optional()})},responses:{302:{description:"Redirect to the client's redirect uri"}}}),async n=>{const{state:e,code:t,error:i,error_description:r,error_code:s,error_reason:a}=n.req.valid("query");if(i)return Ju(n,e,i,r,s,a);if(!t)throw new B(400,{message:"Code is required"});return Gu(n,{code:t,state:e})}).openapi(o.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:o.z.object({state:o.z.string(),code:o.z.string().optional(),scope:o.z.string().optional(),hd:o.z.string().optional(),error:o.z.string().optional(),error_description:o.z.string().optional(),error_code:o.z.string().optional(),error_reason:o.z.string().optional()})}}}},responses:{302:{description:"Redirect to the client's redirect uri"}}}),async n=>{const{state:e,code:t,error:i,error_description:r,error_code:s,error_reason:a}=n.req.valid("form");if(i)return Ju(n,e,i,r,s,a);if(!t)throw new B(400,{message:"Code is required"});return Gu(n,{code:t,state:e})}),pm=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:o.z.object({client_id:o.z.string(),returnTo:o.z.string().optional()}),header:o.z.object({cookie:o.z.string().optional()})},responses:{302:{description:"Log the user out"}}}),async n=>{const{client_id:e,returnTo:t}=n.req.valid("query"),i=await n.env.data.clients.get(e);if(!i)return n.text("OK");const r=await n.env.data.clients.get("DEFAULT_CLIENT");n.set("client_id",e),n.set("tenant_id",i.tenant.id);const s=t||n.req.header("referer");if(!s)return n.text("OK");if(!Hs(s,[...i.allowed_logout_urls||[],...(r==null?void 0:r.allowed_logout_urls)||[]]))throw new B(400,{message:"Invalid redirect uri"});const a=n.req.header("cookie");if(a){const l=Cf(i.tenant.id,a);if(l){const d=await n.env.data.sessions.get(i.tenant.id,l);if(d){const h=await n.env.data.users.get(i.tenant.id,d.user_id);h&&(n.set("user_id",h.user_id),n.set("connection",h.connection))}await n.env.data.sessions.remove(i.tenant.id,l)}}const c=be(n,{type:_e.SUCCESS_LOGOUT,description:"User successfully logged out"});return await n.env.data.logs.create(i.tenant.id,c),new Response("Redirecting",{status:302,headers:{"set-cookie":im(i.tenant.id),location:s}})}),Zu=o.z.object({sub:o.z.string(),email:o.z.string().optional(),family_name:o.z.string().optional(),given_name:o.z.string().optional(),email_verified:o.z.boolean()}),fm=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth2"],method:"get",path:"/",request:{},security:[{Bearer:["openid"]}],responses:{200:{content:{"application/json":{schema:Zu}},description:"Userinfo"}}}),async n=>{if(!n.var.user)throw new B(404,{message:"User not found"});const e=await n.env.data.users.get(n.var.user.tenant_id,n.var.user.sub);if(!e)throw new B(404,{message:"User not found"});return n.json(Zu.parse({...e,sub:e.user_id}))}),hm=new o.OpenAPIHono().openapi(o.createRoute({tags:["well known"],method:"get",path:"/jwks.json",request:{},responses:{200:{content:{"application/json":{schema:ld}},description:"List of tenants"}}}),async n=>{const e=await n.env.data.keys.list(),t=await Promise.all(e.map(async i=>{const s=await new Ec(i.cert).publicKey.export(),a=await crypto.subtle.exportKey("jwk",s);return Ta.parse({...a,kid:i.kid})}));return n.json({keys:t},{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${Ki}, stale-while-revalidate=${Ki*2}, stale-if-error=86400`}})}).openapi(o.createRoute({tags:["well known"],method:"get",path:"/openid-configuration",request:{},responses:{200:{content:{"application/json":{schema:po}},description:"List of tenants"}}}),async n=>{const e=n.env.ISSUER,t=po.parse({issuer:e,authorization_endpoint:`${e}authorize`,token_endpoint:`${e}oauth/token`,device_authorization_endpoint:`${e}oauth/device/code`,userinfo_endpoint:`${e}userinfo`,mfa_challenge_endpoint:`${e}mfa/challenge`,jwks_uri:`${e}.well-known/jwks.json`,registration_endpoint:`${e}oidc/register`,revocation_endpoint:`${e}oauth/revoke`,scopes_supported:["openid","profile","offline_access","name","given_name","family_name","nickname","email","email_verified","picture","created_at","identities","phone","address"],response_types_supported:["code","token","id_token","code token","code id_token","token id_token","code token id_token"],code_challenge_methods_supported:["S256","plain"],response_modes_supported:["query","fragment","form_post"],subject_types_supported:["public"],id_token_signing_alg_values_supported:["RS256"],token_endpoint_auth_methods_supported:["client_secret_basic","client_secret_post"],claims_supported:["aud","auth_time","created_at","email","email_verified","exp","family_name","given_name","iat","identities","iss","name","nickname","phone_number","picture","sub"],request_uri_parameter_supported:!1,request_parameter_supported:!1,token_endpoint_auth_signing_alg_values_supported:["RS256","RS384","PS256"]});return n.json(t,{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${Ki}, stale-while-revalidate=${Ki*2}, stale-if-error=86400`}})});function Qi(n,e){if(!n||!e||n.length!==e.length)return!1;let t=0;for(let i=0;i<n.length;i++)t|=n.charCodeAt(i)^e.charCodeAt(i);return t===0}const Rf=o.z.object({grant_type:o.z.literal("client_credentials"),scope:o.z.string().optional(),client_secret:o.z.string(),client_id:o.z.string(),audience:o.z.string().optional()});async function gm(n,e){const t=await n.env.data.clients.get(e.client_id);if(!t)throw new B(403,{message:"Invalid client credentials"});if(t.client_secret&&!Qi(t.client_secret,e.client_secret))throw new B(403,{message:"Invalid client credentials"});const i={client_id:t.id,scope:e.scope,audience:e.audience},r=await Nc(n,{authParams:i,client:t});return n.json(r)}const _m=o.z.object({grant_type:o.z.literal("authorization_code"),client_id:o.z.string(),code:o.z.string(),redirect_uri:o.z.string().optional(),client_secret:o.z.string().optional(),code_verifier:o.z.string().optional()}).refine(n=>"client_secret"in n&&!("code_verifier"in n)||!("client_secret"in n)&&"code_verifier"in n,{message:"Must provide either client_secret (standard flow) or code_verifier/code_verifier_mode (PKCE flow), but not both"});async function mm(n,e){const t=await n.env.data.clients.get(e.client_id);if(!t)throw new B(403,{message:"Client not found"});const i=await n.env.data.codes.get(t.tenant.id,e.code,"authorization_code");if(!i||!i.user_id)throw new B(403,{message:"Invalid client credentials"});if(new Date(i.expires_at)<new Date)throw new B(403,{message:"Code expired"});if(i.used_at)throw new B(403,{message:"Code already used"});const r=await n.env.data.logins.get(t.tenant.id,i.login_id);if(!r)throw new B(403,{message:"Invalid login"});if("client_secret"in e){const a=await n.env.data.clients.get("DEFAULT_CLIENT");if(!Qi(t.client_secret,e.client_secret)&&!Qi(a==null?void 0:a.client_secret,e.client_secret))throw new B(403,{message:"Invalid client credentials"})}else if("code_verifier"in e&&typeof e.code_verifier=="string"&&"code_challenge_method"in r.authParams&&typeof r.authParams.code_challenge_method=="string"){const a=await tm(e.code_verifier,r.authParams.code_challenge_method);if(!Qi(a,r.authParams.code_challenge||""))throw new B(403,{message:"Invalid client credentials"})}if(r.authParams.redirect_uri&&r.authParams.redirect_uri!==e.redirect_uri)throw new B(403,{message:"Invalid redirect uri"});const s=await n.env.data.users.get(t.tenant.id,i.user_id);if(!s)throw new B(403,{message:"User not found"});return await n.env.data.codes.used(t.tenant.id,e.code),Ui(n,{user:s,client:t,loginSession:r,authParams:{...r.authParams,response_mode:Tn.WEB_MESSAGE}})}const Yu=o.z.object({client_id:o.z.string().optional(),client_secret:o.z.string().optional()}),ym=o.z.union([Rf.extend(Yu.shape),o.z.object({grant_type:o.z.literal("authorization_code"),client_id:o.z.string(),code:o.z.string(),redirect_uri:o.z.string(),code_verifier:o.z.string().min(43).max(128)}),o.z.object({grant_type:o.z.literal("authorization_code"),code:o.z.string(),redirect_uri:o.z.string().optional(),...Yu.shape})]);function vm(n){if(!n)return{};const[e,t]=n.split(" ");if((e==null?void 0:e.toLowerCase())==="basic"&&t){const[i,r]=atob(t).split(":");return{client_id:i,client_secret:r}}return{}}const wm=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:ym}}}},responses:{200:{content:{"application/json":{schema:o.z.object({access_token:o.z.string(),id_token:o.z.string().optional(),refresh_token:o.z.string().optional(),token_type:o.z.string(),expires_in:o.z.number()})}},description:"Tokens"}}}),async n=>{const e=n.req.valid("form"),t=vm(n.req.header("Authorization")),i={...e,...t};if(!i.client_id)throw new B(400,{message:"client_id is required"});switch(e.grant_type){case ur.AuthorizationCode:return mm(n,_m.parse(i));case ur.ClientCredential:return gm(n,Rf.parse(i));default:throw new B(400,{message:"Not implemented"})}});var Rc={exports:{}};const Tc=[{id:0,value:"Too weak",minDiversity:0,minLength:0},{id:1,value:"Weak",minDiversity:2,minLength:6},{id:2,value:"Medium",minDiversity:4,minLength:8},{id:3,value:"Strong",minDiversity:4,minLength:10}],Tf=(n,e=Tc,t="!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~")=>{let i=n||"";e[0].minDiversity=0,e[0].minLength=0;const r=[{regex:"[a-z]",message:"lowercase"},{regex:"[A-Z]",message:"uppercase"},{regex:"[0-9]",message:"number"}];t&&r.push({regex:`[${t}]`,message:"symbol"});let s={};s.contains=r.filter(c=>new RegExp(`${c.regex}`).test(i)).map(c=>c.message),s.length=i.length;let a=e.filter(c=>s.contains.length>=c.minDiversity).filter(c=>s.length>=c.minLength).sort((c,l)=>l.id-c.id).map(c=>({id:c.id,value:c.value}));return Object.assign(s,a[0]),s};Rc.exports={passwordStrength:Tf,defaultOptions:Tc};var bm=Rc.exports.passwordStrength=Tf;Rc.exports.defaultOptions=Tc;function km(n){return bm(n).id<2?!1:n.length>=8&&/[a-z]/.test(n)&&/[A-Z]/.test(n)&&/[0-9]/.test(n)&&/[^A-Za-z0-9]/.test(n)}async function qs(n,e){var r;const t=await n.env.data.emailProviders.get(n.var.tenant_id)||(n.env.DEFAULT_TENANT_ID?await n.env.data.emailProviders.get(n.env.DEFAULT_TENANT_ID):null);if(!t)throw new B(500,{message:"Email provider not found"});const i=(r=n.env.emailProviders)==null?void 0:r[t.name];if(!i)throw new B(500,{message:"Email provider not found"});await i({emailProvider:t,...e,from:t.default_from_address||`login@${n.env.ISSUER}`})}async function xm(n,e,t,i){const r=await n.env.data.tenants.get(n.var.tenant_id);if(!r)throw new B(500,{message:"Tenant not found"});const s=`${n.env.ISSUER}u/reset-password?state=${i}&code=${t}`,a={vendorName:r.name,lng:r.language||"en"};await qs(n,{to:e,subject:"Reset your password",html:`Click here to reset your password: ${n.env.ISSUER}u/reset-password?state=${i}&code=${t}`,template:"auth-password-reset",data:{vendorName:r.name,logo:r.logo||"",passwordResetUrl:s,supportUrl:r.support_url||"https://support.sesamy.com",buttonColor:r.primary_color||"#7d68f4",passwordResetTitle:ue("password_reset_title",a),resetPasswordEmailClickToReset:ue("reset_password_email_click_to_reset",a),resetPasswordEmailReset:ue("reset_password_email_reset",a),supportInfo:ue("support_info",a),contactUs:ue("contact_us",a),copyright:ue("copyright",a)}})}async function Sm(n,e,t){const{env:i}=n,r=await n.env.data.tenants.get(n.var.tenant_id);if(!r)throw new B(500,{message:"Tenant not found"});const s={vendorName:r.name,code:t,lng:r.language||"en"};await qs(n,{to:e,subject:ue("code_email_subject",s),html:`Click here to validate your email: ${n.env.ISSUER}u/validate-email`,template:"auth-link",data:{code:t,vendorName:r.name,logo:r.logo||"",supportUrl:r.support_url||"",magicLink:`${i.ISSUER}passwordless/verify_redirect?ticket=${t}`,buttonColor:r.primary_color||"",welcomeToYourAccount:ue("welcome_to_your_account",s),linkEmailClickToLogin:ue("link_email_click_to_login",s),linkEmailLogin:ue("link_email_login",s),linkEmailOrEnterCode:ue("link_email_or_enter_code",s),codeValid30Mins:ue("code_valid_30_minutes",s),supportInfo:ue("support_info",s),contactUs:ue("contact_us",s),copyright:ue("copyright",s)}});const a=be(n,{type:_e.CODE_LINK_SENT,description:e});$t(n,n.env.data.logs.create(r.id,a))}async function Pf(n,e,t){const{env:i}=n,r=await n.env.data.tenants.get(n.var.tenant_id);if(!r)throw new B(500,{message:"Tenant not found"});const s={vendorName:r.name,code:t,lng:r.language||"en"};await qs(n,{to:e,subject:ue("code_email_subject",s),html:`Click here to validate your email: ${n.env.ISSUER}u/validate-email`,template:"auth-link",data:{code:t,vendorName:r.name,logo:r.logo||"",supportUrl:r.support_url||"",magicLink:`${i.ISSUER}passwordless/verify_redirect?ticket=${t}`,buttonColor:r.primary_color||"",welcomeToYourAccount:ue("welcome_to_your_account",s),linkEmailClickToLogin:ue("link_email_click_to_login",s),linkEmailLogin:ue("link_email_login",s),linkEmailOrEnterCode:ue("link_email_or_enter_code",s),codeValid30Mins:ue("code_valid_30_minutes",s),supportInfo:ue("support_info",s),contactUs:ue("contact_us",s),copyright:ue("copyright",s)}});const a=be(n,{type:_e.CODE_LINK_SENT,description:e});$t(n,n.env.data.logs.create(r.id,a))}async function Uf(n,e){const t=await n.env.data.tenants.get(n.var.tenant_id);if(!t)throw new B(500,{message:"Tenant not found"});const i={vendorName:t.name,lng:t.language||"en"};await qs(n,{to:e.email,subject:"Validate your email address",html:`Click here to validate your email: ${n.env.ISSUER}u/validate-email`,template:"auth-verify-email",data:{vendorName:t.name,logo:t.logo||"",emailValidationUrl:`${n.env.ISSUER}u/validate-email`,supportUrl:t.support_url||"https://support.sesamy.com",buttonColor:t.primary_color||"#7d68f4",welcomeToYourAccount:ue("welcome_to_your_account",i),verifyEmailVerify:ue("verify_email_verify",i),supportInfo:ue("support_info",i),contactUs:ue("contact_us",i),copyright:ue("copyright",i)}})}const Am=new o.OpenAPIHono().openapi(o.createRoute({tags:["dbconnections"],method:"post",path:"/signup",request:{body:{content:{"application/json":{schema:o.z.object({client_id:o.z.string(),connection:o.z.literal("Username-Password-Authentication"),email:o.z.string().transform(n=>n.toLowerCase()),password:o.z.string()})}}}},responses:{200:{content:{"application/json":{schema:o.z.object({_id:o.z.string(),email:o.z.string(),email_verified:o.z.boolean(),app_metadata:o.z.object({}),user_metadata:o.z.object({})})}},description:"Created user"}}}),async n=>{const{email:e,password:t,client_id:i}=n.req.valid("json"),r=await n.env.data.clients.get(i);if(!r)throw new B(400,{message:"Client not found"});if(n.set("client_id",r.id),n.set("tenant_id",r.tenant.id),!km(t))throw new B(400,{message:"Password does not meet the requirements"});if(await Xr({userAdapter:n.env.data.users,tenant_id:r.tenant.id,email:e,provider:"auth2"}))throw new B(400,{message:"Invalid sign up"});const a=await n.env.data.users.create(r.tenant.id,{user_id:`auth2|${La()}`,email:e,email_verified:!1,provider:"auth2",connection:"Username-Password-Authentication",is_social:!1});n.set("user_id",a.user_id),n.set("username",a.email),n.set("connection",a.connection);const c=await Ua.hash(t,10);await n.env.data.passwords.create(r.tenant.id,{user_id:a.user_id,password:c,algorithm:"bcrypt"}),await Uf(n,a);const l=be(n,{type:_e.SUCCESS_SIGNUP,description:"Successful signup"});return await n.env.data.logs.create(r.tenant.id,l),n.json({_id:a.user_id,email:a.email,email_verified:!1,app_metadata:{},user_metadata:{}})}).openapi(o.createRoute({tags:["dbconnections"],method:"post",path:"/change_password",request:{body:{content:{"application/json":{schema:o.z.object({client_id:o.z.string(),connection:o.z.literal("Username-Password-Authentication"),email:o.z.string().transform(n=>n.toLowerCase())})}}}},responses:{200:{description:"Redirect to the client's redirect uri"}}}),async n=>{const{email:e,client_id:t}=n.req.valid("json"),i=await n.env.data.clients.get(t);if(!i)throw new B(400,{message:"Client not found"});if(n.set("client_id",i.id),n.set("tenant_id",i.tenant.id),!await Da({userAdapter:n.env.data.users,tenant_id:i.tenant.id,email:e,provider:"auth2"}))return n.html("If an account with that email exists, we've sent instructions to reset your password.");const s={client_id:t,username:e},a=await n.env.data.logins.create(i.tenant.id,{expires_at:new Date(Date.now()+Fr*1e3).toISOString(),authParams:s,...Rn(n.req)});return await xm(n,e,a.login_id,a.authParams.state),n.html("If an account with that email exists, we've sent instructions to reset your password.")});function Lf(){const n="1234567890";let e="";for(let t=0;t<6;t+=1)e+=n[Math.floor(Math.random()*10)];return e.toString()}const Im=new o.OpenAPIHono().openapi(o.createRoute({tags:["passwordless"],method:"post",path:"/start",request:{body:{content:{"application/json":{schema:o.z.object({client_id:o.z.string(),connection:o.z.string(),email:o.z.string().transform(n=>n.toLowerCase()),send:o.z.enum(["link","code"]),authParams:Ra.omit({client_id:!0})})}}}},responses:{200:{description:"Status"}}}),async n=>{const e=n.req.valid("json"),{env:t}=n,{client_id:i,email:r,send:s,authParams:a}=e,c=await n.env.data.clients.get(i);if(!c)throw new B(400,{message:"Client not found"});n.set("client_id",c.id),n.set("tenant_id",c.tenant.id);const l=await t.data.logins.create(c.tenant.id,{authParams:{...a,client_id:i,username:r},expires_at:new Date(Date.now()+Pu).toISOString(),...Rn(n.req)}),d=await t.data.codes.create(c.tenant.id,{code_id:Lf(),code_type:"otp",login_id:l.login_id,expires_at:new Date(Date.now()+Pu).toISOString()});return s==="link"?await Pf(n,r,d.code_id):await Sm(n,r,d.code_id),n.html("OK")}).openapi(o.createRoute({tags:["passwordless"],method:"get",path:"/verify_redirect",request:{query:o.z.object({scope:o.z.string(),response_type:o.z.nativeEnum(Rt),redirect_uri:o.z.string(),state:o.z.string(),nonce:o.z.string().optional(),verification_code:o.z.string(),connection:o.z.string(),client_id:o.z.string(),email:o.z.string().transform(n=>n.toLowerCase()),audience:o.z.string().optional()})},responses:{302:{description:"Status"}}}),async n=>{const{env:e}=n,{client_id:t,email:i,verification_code:r,redirect_uri:s,state:a,scope:c,audience:l,response_type:d,nonce:h}=n.req.valid("query"),g=await n.env.data.clients.get(t);if(!g)throw new B(400,{message:"Client not found"});n.set("client_id",g.id),n.set("tenant_id",g.tenant.id),n.set("connection","email");const y=await e.data.codes.get(g.tenant.id,r,"otp");if(!y)throw new B(400,{message:"Code not found or expired"});if(y.expires_at<new Date().toISOString())throw new B(400,{message:"Code expired"});const I=await e.data.logins.get(g.tenant.id,y.login_id);if(!I||I.authParams.username!==i)throw new B(400,{message:"Code not found or expired"});const f=Rn(n.req);if(I.ip!==f.ip)return n.redirect(`${n.env.ISSUER}u/invalid-session?state=${I}`);if(!Hs(s,g.callbacks))throw new B(400,{message:`Invalid redirect URI - ${s}`});const _={client_id:t,redirect_uri:s,state:a,nonce:h,scope:c,audience:l,response_type:d},k=await Xr({userAdapter:e.data.users,tenant_id:g.tenant.id,email:i,provider:"email"});if(!k)throw new B(400,{message:"User not found"});return Ui(n,{user:k,client:g,loginSession:I,authParams:_})});class Yn extends B{constructor(t,i){super(t,i);te(this,"_code");this._code=i==null?void 0:i.code}get code(){return this._code}}async function jm(n,e,t){const{env:i}=n,r=t.username;if(n.set("username",r),!r)throw new B(400,{message:"Username is required"});const s=await Da({userAdapter:n.env.data.users,tenant_id:e.tenant.id,email:r,provider:"auth2"});if(!s){const y=be(n,{type:_e.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid user"});throw $t(n,n.env.data.logs.create(e.tenant.id,y)),new Yn(403,{message:"User not found",code:"USER_NOT_FOUND"})}const a=s.linked_to?await i.data.users.get(e.tenant.id,s.linked_to):s;if(!a)throw new Yn(403,{message:"User not found",code:"USER_NOT_FOUND"});n.set("connection",s.connection),n.set("user_id",a.user_id);const{password:c}=await i.data.passwords.get(e.tenant.id,s.user_id);if(!await Ua.compare(t.password,c)){const y=be(n,{type:_e.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid password"});throw $t(n,n.env.data.logs.create(e.tenant.id,y)),new Yn(403,{message:"Invalid password",code:"INVALID_PASSWORD"})}if((await i.data.logs.list(e.tenant.id,{page:0,per_page:10,include_totals:!1,q:`user_id:${a.user_id}`})).logs.filter(y=>y.type===_e.FAILED_LOGIN_INCORRECT_PASSWORD&&new Date(y.date)>new Date(Date.now()-1e3*60*5)).length>=3){const y=be(n,{type:_e.FAILED_LOGIN,description:"Too many failed login attempts"});throw $t(n,n.env.data.logs.create(e.tenant.id,y)),new Yn(403,{message:"Too many failed login attempts",code:"TOO_MANY_FAILED_LOGINS"})}if(!s.email_verified&&e.email_validation==="enforced"){await Uf(n,s);const y=be(n,{type:_e.FAILED_LOGIN,description:"Email not verified"});throw await n.env.data.logs.create(e.tenant.id,y),new Yn(403,{message:"Email not verified",code:"EMAIL_NOT_VERIFIED"})}const g=be(n,{type:_e.SUCCESS_LOGIN,description:"Successful login",strategy_type:"Username-Password-Authentication",strategy:"Username-Password-Authentication"});return $t(n,n.env.data.logs.create(e.tenant.id,g)),a}function zm(){const n=new Uint8Array(32);return crypto.getRandomValues(n),Yt.encode(n,{includePadding:!1})}function Xu(){return new B(403,{res:new Response(JSON.stringify({error:"access_denied",error_description:"Wrong email or verification code."}),{status:403,headers:{"Content-Type":"application/json"}}),message:"Wrong email or verification code."})}const Qu=30*60*1e3,Em=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.union([o.z.object({credential_type:o.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),otp:o.z.string(),client_id:o.z.string(),username:o.z.string().transform(n=>n.toLowerCase()),realm:o.z.enum(["email"]),scope:o.z.string().optional()}),o.z.object({credential_type:o.z.literal("http://auth0.com/oauth/grant-type/password-realm"),client_id:o.z.string(),username:o.z.string().transform(n=>n.toLowerCase()),password:o.z.string(),realm:o.z.enum(["Username-Password-Authentication"]),scope:o.z.string().optional()})])}}}},responses:{200:{description:"List of tenants"}}}),async n=>{const e=n.req.valid("json"),{client_id:t,username:i}=e;n.set("username",i);const r=await n.env.data.clients.get(t);if(!r)throw new B(400,{message:"Client not found"});n.set("client_id",t),n.set("tenant_id",r.tenant.id);const s=i.toLocaleLowerCase();let a;if("otp"in e){const h=await n.env.data.codes.get(r.tenant.id,e.otp,"otp");if(!h)throw Xu();const g=await n.env.data.logins.get(r.tenant.id,h.login_id);if(!g||g.authParams.username!==s)throw Xu();a=g}else if("password"in e)await jm(n,r,{username:i,password:e.password,client_id:t}),a=await n.env.data.logins.create(r.tenant.id,{expires_at:new Date(Date.now()+Qu).toISOString(),authParams:{client_id:r.id,username:s},...Rn(n.req)});else throw new B(400,{message:"Code or password required"});const c=zm(),l=st(12),d=await n.env.data.codes.create(r.tenant.id,{code_id:st(),code_type:"ticket",login_id:a.login_id,expires_at:new Date(Date.now()+Qu).toISOString(),code_verifier:[l,c].join("|")});return n.json({login_ticket:d.code_id,co_verifier:c,co_id:l})});function $m(n,e){var i,r,s;if(!n||e.length===0)return!1;const t=((i=co(n))==null?void 0:i.host)??null;if(!t)return!1;for(const a of e){let c;if(a.startsWith("http://")||a.startsWith("https://")?c=((r=co(a))==null?void 0:r.host)??null:c=((s=co("https://"+a))==null?void 0:s.host)??null,t===c)return!0}return!1}function co(n){try{return new URL(n)}catch{return null}}async function Cm({ctx:n,session:e,client:t,authParams:i,connection:r,login_hint:s}){const a=await n.env.data.logins.create(t.tenant.id,{expires_at:new Date(Date.now()+Fr*1e3).toISOString(),authParams:i,...Rn(n.req)});if(e&&s){const c=await n.env.data.users.get(t.tenant.id,e.user_id);if((c==null?void 0:c.email)===s)return Ui(n,{client:t,loginSession:a,authParams:i,user:c,sid:e.session_id})}if(r==="email"&&s){const c=Lf();return await n.env.data.codes.create(t.tenant.id,{code_id:c,code_type:"otp",login_id:a.login_id,expires_at:new Date(Date.now()+Fr*1e3).toISOString()}),await Pf(n,s,c),n.redirect(`/u/enter-code?state=${a.login_id}`)}return e?n.redirect(`/u/check-account?state=${a.login_id}`):n.redirect(`/u/enter-email?state=${a.login_id}`)}function Om(n){if(n==="Username-Password-Authentication")return"auth2";if(n==="email")return"email";throw new B(403,{message:"Invalid realm"})}async function Bm(n,e,t,i,r){var y;const{env:s}=n;n.set("connection",r);const a=await s.data.codes.get(e,t,"ticket");if(!a||a.used_at)throw new B(403,{message:"Ticket not found"});const c=await s.data.logins.get(e,a.login_id);if(!c||!c.authParams.username)throw new B(403,{message:"Session not found"});const l=await s.data.clients.get(c.authParams.client_id);if(!l)throw new B(403,{message:"Client not found"});n.set("client_id",c.authParams.client_id),await s.data.codes.used(e,t);const d=Om(r);let h=await Xr({userAdapter:s.data.users,tenant_id:e,email:c.authParams.username,provider:d});h||(h=await s.data.users.create(e,{user_id:`email|${La()}`,email:c.authParams.username,name:c.authParams.username,provider:"email",connection:"email",email_verified:!0,is_social:!1,last_ip:"",last_login:new Date().toISOString()})),n.set("username",h.email),n.set("user_id",h.user_id);const g=await Bf(n,h,l);return Ui(n,{authParams:{scope:(y=c.authParams)==null?void 0:y.scope,...i},loginSession:c,sid:g.session_id,user:h,client:l})}async function ed(n,e){return`<!DOCTYPE html>
125
+ `,i}async function g0(n){const e=await n.publicKey.export(),t=await crypto.subtle.exportKey("jwk",e),i=JSON.stringify(t,Object.keys(t).sort()),s=new TextEncoder().encode(i);return La(await Bf(s))}const _0=1e3*60*60*24,m0=new a.OpenAPIHono().openapi(a.createRoute({tags:["keys"],method:"get",path:"/signing",request:{headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:a.z.array(wo)}},description:"List of keys"}}}),async n=>{const t=(await n.env.data.keys.list()).filter(i=>"cert"in i).map(i=>i);return n.json(t)}).openapi(a.createRoute({tags:["keys"],method:"get",path:"/signing/{kid}",request:{headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({kid:a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:wo}},description:"The requested key"}}}),async n=>{const{kid:e}=n.req.valid("param"),i=(await n.env.data.keys.list()).find(r=>r.kid===e);if(!i)throw new O(404,{message:"Key not found"});return n.json(i)}).openapi(a.createRoute({tags:["keys"],method:"post",path:"/signing/rotate",request:{headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async n=>{const e=await n.env.data.keys.list();for await(const i of e)await n.env.data.keys.update(i.kid,{revoked_at:new Date(Date.now()+_0).toISOString()});const t=await Ua({name:`CN=${n.env.ORGANIZATION_NAME}`});return await n.env.data.keys.create(t),n.text("OK",{status:201})}).openapi(a.createRoute({tags:["keys"],method:"put",path:"/signing/{kid}/revoke",request:{headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({kid:a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async n=>{const{kid:e}=n.req.valid("param");if(!await n.env.data.keys.update(e,{revoked_at:new Date().toISOString()}))throw new O(404,{message:"Key not found"});const i=await Ua({name:`CN=${n.env.ORGANIZATION_NAME}`});return await n.env.data.keys.create(i),n.text("OK")}),y0=new a.OpenAPIHono().openapi(a.createRoute({tags:["users"],method:"get",path:"/",request:{query:a.z.object({email:a.z.string()}),headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:a.z.array(Da)}},description:"List of users"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{email:t}=n.req.valid("query"),r=(await Ud(n.env.data.users,e,t)).filter(s=>!s.linked_to);return n.json(r)}),v0=Mt.extend({clients:a.z.array(Jt)}),w0=new a.OpenAPIHono().openapi(a.createRoute({tags:["clients"],method:"get",path:"/",request:{query:rn,headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:a.z.union([v0,a.z.array(Jt)])}},description:"List of clients"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{page:t,per_page:i,include_totals:r,sort:s,q:o}=n.req.valid("query"),l=(await n.env.data.applications.list(e,{page:t,per_page:i,include_totals:r,sort:Mn(s),q:o})).applications;return r?n.json({clients:l,start:0,limit:10,length:l.length}):n.json(l)}).openapi(a.createRoute({tags:["clients"],method:"get",path:"/{id}",request:{params:a.z.object({id:a.z.string()}),headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Jt}},description:"An application"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),r=(await n.env.data.applications.list(e,{page:1,per_page:0,include_totals:!1})).applications.find(s=>s.id===t);if(!r)throw new O(404);return n.json(r)}).openapi(a.createRoute({tags:["clients"],method:"delete",path:"/{id}",request:{params:a.z.object({id:a.z.string()}),headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param");if(!await n.env.data.applications.remove(e,t))throw new O(404,{message:"Application not found"});return n.text("OK")}).openapi(a.createRoute({tags:["clients"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:a.z.object(dr.shape).partial()}}},params:a.z.object({id:a.z.string()}),headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Jt}},description:"The update application"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),r=n.req.valid("json");await n.env.data.applications.update(e,t,r);const s=await n.env.data.applications.get(e,t);if(!s)throw new O(404,{message:"Application not found"});return n.json(s)}).openapi(a.createRoute({tags:["clients"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:a.z.object(dr.shape)}}},headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:a.z.object(Jt.shape)}},description:"An application"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),i={...t,id:t.id||Ke(),client_secret:t.client_secret||Ke()},r=await n.env.data.applications.create(e,i);return n.json(r,{status:201})});a.z.object({start:a.z.number(),limit:a.z.number(),length:a.z.number()});ns.extend({email:a.z.string(),login_count:a.z.number(),multifactor:a.z.array(a.z.string()).optional(),last_ip:a.z.string().optional(),last_login:a.z.string().optional(),user_id:a.z.string()}).catchall(a.z.any());const b0=Mt.extend({tenants:a.z.array(An)}),k0=new a.OpenAPIHono().openapi(a.createRoute({tags:["tenants"],method:"get",path:"/",request:{query:rn},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:a.z.union([a.z.array(An),b0])}},description:"List of tenants"}}}),async n=>{const{page:e,per_page:t,include_totals:i,sort:r,q:s}=n.req.valid("query"),o=await n.env.data.tenants.list({page:e,per_page:t,include_totals:i,sort:Mn(r),q:s});return i?n.json(o):n.json(o.tenants)}).openapi(a.createRoute({tags:["tenants"],method:"get",path:"/{id}",request:{params:a.z.object({id:a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:An}},description:"A tenant"}}}),async n=>{const{id:e}=n.req.valid("param"),t=await n.env.data.tenants.get(e);if(!t)throw new O(404);return n.json(t)}).openapi(a.createRoute({tags:["tenants"],method:"delete",path:"/{id}",request:{params:a.z.object({id:a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{id:e}=n.req.valid("param");return await n.env.data.tenants.remove(e),n.text("OK")}).openapi(a.createRoute({tags:["tenants"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:a.z.object(fr.shape).partial()}}},params:a.z.object({id:a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{id:e}=n.req.valid("param"),t=n.req.valid("json");return await n.env.data.tenants.update(e,t),n.text("OK")}).openapi(a.createRoute({tags:["tenants"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:a.z.object(fr.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"tenant/json":{schema:An}},description:"An tenant"}}}),async n=>{const e=n.req.valid("json"),t=await n.env.data.tenants.create(e);return n.json(t,{status:201})}),x0=Mt.extend({logs:a.z.array(gr)}),S0=new a.OpenAPIHono().openapi(a.createRoute({tags:["logs"],method:"get",path:"/",request:{query:rn,headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:a.z.union([a.z.array(gr),x0])}},description:"List of log rows"}}}),async n=>{const{page:e,per_page:t,include_totals:i,sort:r,q:s}=n.req.valid("query"),{"tenant-id":o}=n.req.valid("header"),c=await n.env.data.logs.list(o,{page:e,per_page:t,include_totals:i,sort:Mn(r),q:s});return i?n.json(c):n.json(c.logs)}).openapi(a.createRoute({tags:["logs"],method:"get",path:"/{id}",request:{headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({id:a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:gr}},description:"A log entry"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),i=await n.env.data.logs.get(e,t);if(!i)throw new O(404);return n.json(i)}),A0=Mt.extend({hooks:a.z.array(xn)}),I0=new a.OpenAPIHono().openapi(a.createRoute({tags:["hooks"],method:"get",path:"/",request:{query:rn,headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:a.z.union([a.z.array(xn),A0])}},description:"List of hooks"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{page:t,per_page:i,include_totals:r,sort:s,q:o}=n.req.valid("query"),c=await n.env.data.hooks.list(e,{page:t,per_page:i,include_totals:r,sort:Mn(s),q:o});return r?n.json(c):n.json(c.hooks)}).openapi(a.createRoute({tags:["hooks"],method:"post",path:"/",request:{headers:a.z.object({"tenant-id":a.z.string()}),body:{content:{"application/json":{schema:a.z.object(hr.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:xn}},description:"The created hook"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),i=await n.env.data.hooks.create(e,t);return n.json(i,{status:201})}).openapi(a.createRoute({tags:["hooks"],method:"patch",path:"/{hook_id}",request:{headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({hook_id:a.z.string()}),body:{content:{"application/json":{schema:a.z.object(hr.shape).omit({hook_id:!0}).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:xn.shape}},description:"The updated hook"},404:{description:"Hook not found"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{hook_id:t}=n.req.valid("param"),i=n.req.valid("json");await n.env.data.hooks.update(e,t,i);const r=await n.env.data.hooks.get(e,t);if(!r)throw new O(404,{message:"Hook not found"});return n.json(r)}).openapi(a.createRoute({tags:["hooks"],method:"get",path:"/{hook_id}",request:{headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({hook_id:a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:xn}},description:"A hook"},404:{description:"Hook not found"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{hook_id:t}=n.req.valid("param"),i=await n.env.data.hooks.get(e,t);if(!i)throw new O(404,{message:"Hook not found"});return n.json(i)}).openapi(a.createRoute({tags:["hooks"],method:"delete",path:"/{hook_id}",request:{headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({hook_id:a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{description:"A hook"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{hook_id:t}=n.req.valid("param");if(!await n.env.data.hooks.remove(e,t))throw new O(404,{message:"Hook not found"});return n.text("OK")}),E0=Mt.extend({connections:a.z.array(zt)}),$0=new a.OpenAPIHono().openapi(a.createRoute({tags:["connections"],method:"get",path:"/",request:{query:rn,headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:a.z.union([a.z.array(zt),E0])}},description:"List of connectionss"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{page:t,per_page:i,include_totals:r=!1,sort:s,q:o}=n.req.valid("query"),c=await n.env.data.connections.list(e,{page:t,per_page:i,include_totals:r,sort:Mn(s),q:o});return r?n.json(c):n.json(c.connections)}).openapi(a.createRoute({tags:["connections"],method:"get",path:"/{id}",request:{params:a.z.object({id:a.z.string()}),headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:zt}},description:"A connection"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),i=await n.env.data.connections.get(e,t);if(!i)throw new O(404);return n.json(i)}).openapi(a.createRoute({tags:["connections"],method:"delete",path:"/{id}",request:{params:a.z.object({id:a.z.string()}),headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param");if(!await n.env.data.connections.remove(e,t))throw new O(404,{message:"Connection not found"});return n.text("OK")}).openapi(a.createRoute({tags:["connections"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:a.z.object(pr.shape).partial()}}},params:a.z.object({id:a.z.string()}),headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:zt}},description:"The updated connection"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),i=n.req.valid("json");if(!await n.env.data.connections.update(e,t,i))throw new O(404,{message:"Connection not found"});const s=await n.env.data.connections.get(e,t);if(!s)throw new O(404,{message:"Connection not found"});return n.json(s)}).openapi(a.createRoute({tags:["connections"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:a.z.object(pr.shape)}}},headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:zt}},description:"A connection"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),i=await n.env.data.connections.create(e,t);return n.json(i,{status:201})}),C0=new a.OpenAPIHono().openapi(a.createRoute({tags:["prompts"],method:"get",path:"/",request:{headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Xi}},description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=await n.env.data.promptSettings.get(e);return t?n.json(t):n.json(Xi.parse({}))}).openapi(a.createRoute({tags:["prompts"],method:"patch",path:"/",request:{headers:a.z.object({"tenant-id":a.z.string()}),body:{content:{"application/json":{schema:a.z.object(Xi.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Prompts settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),i=await n.env.data.promptSettings.get(e);return Object.assign(i,t),await n.env.data.promptSettings.set(e,i),n.json(i)});let Ju=!1;function Tf(n){n.use(async(e,t)=>(Ju||(n.openAPIRegistry.registerComponent("securitySchemes","Bearer",{type:"oauth2",scheme:"bearer",flows:{implicit:{authorizationUrl:`${e.env.AUTH_URL}/authorize`,scopes:{openid:"Basic user information",email:"User email",profile:"User profile information"}}}}),Ju=!0),await t()))}a.z.object({alg:a.z.literal("RS256"),kty:a.z.literal("RSA"),use:a.z.literal("sig"),n:a.z.string(),e:a.z.string(),kid:a.z.string(),x5t:a.z.string(),x5c:a.z.array(a.z.string())});async function j0(n){try{const e=await n.JWKS_SERVICE.fetch(n.JWKS_URL);if(!e.ok)throw new Error("Failed to fetch jwks");return(await e.json()).keys}catch(e){throw new O(500,{message:`Failed to fetch jwks: ${e.message}`})}}async function z0(n,e){const i=new TextEncoder().encode([e.raw.header,e.raw.payload].join(".")),r=new Uint8Array(Array.from(e.signature).map(l=>l.charCodeAt(0))),o=(await j0(n.env)).find(l=>l.kid===e.header.kid);if(!o)return console.log("No matching kid found"),!1;const c=await crypto.subtle.importKey("jwk",o,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!1,["verify"]);return crypto.subtle.verify("RSASSA-PKCS1-v1_5",c,r,i)}function N0(n){const[e,t,i]=n.split(".");if(!e||!t||!i)return null;const r=JSON.parse(atob(e)),s=JSON.parse(atob(t)),o=atob(i.replace(/-/g,"+").replace(/_/g,"/"));return{header:r,payload:s,signature:o,raw:{header:e,payload:t,signature:i}}}function Rf(n){return async(e,t)=>{var r,s,o;const i=n.openAPIRegistry.definitions.find(c=>"route"in c&&c.route.path===e.req.path&&c.route.method.toUpperCase()===e.req.method);if(i&&"route"in i){const c=(s=(r=i.route.security)==null?void 0:r[0])==null?void 0:s.Bearer;if(!(c!=null&&c.length))return await t();const l=e.req.header("authorization")||"",[u,p]=l.split(" ");if((u==null?void 0:u.toLowerCase())!=="bearer"||!p)throw new O(401,{message:"Missing bearer token"});const g=N0(p);if(!g||!await z0(e,g))throw new O(403,{message:"Invalid JWT signature"});e.set("user_id",g.payload.sub),e.set("user",g.payload);const m=g.payload.permissions||[],x=((o=g.payload.scope)==null?void 0:o.split(" "))||[];if(c.length&&!(c.some(h=>m.includes(h))||c.some(h=>x.includes(h))))throw new O(403,{message:"Unauthorized"})}return await t()}}const O0=new a.OpenAPIHono().openapi(a.createRoute({tags:["emails"],method:"get",path:"/",request:{headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Qi}},description:"Email provider"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=await n.env.data.emailProviders.get(e);if(!t)throw new O(404,{message:"Email provider not found"});return n.json(t)}).openapi(a.createRoute({tags:["emails"],method:"post",path:"/",request:{headers:a.z.object({"tenant-id":a.z.string()}),body:{content:{"application/json":{schema:a.z.object(Qi.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json");return await n.env.data.emailProviders.create(e,t),n.text("OK",{status:201})}).openapi(a.createRoute({tags:["emails"],method:"patch",path:"/",request:{headers:a.z.object({"tenant-id":a.z.string()}),body:{content:{"application/json":{schema:a.z.object(Qi.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json");return await n.env.data.emailProviders.update(e,t),n.text("OK")});function B0(){const n=new a.OpenAPIHono;n.use(Rf(n));const e=n.route("/branding",eg).route("/email/providers",O0).route("/users",mg).route("/keys",m0).route("/users-by-email",y0).route("/clients",w0).route("/tenants",k0).route("/logs",S0).route("/hooks",I0).route("/connections",$0).route("/prompts",C0);return Tf(e),e.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Management api"}}),e}function T0(n,e){Object.keys(e).forEach(t=>{const i=e[t];i!=null&&i.length&&n.searchParams.set(t,i)})}function Vn(n){var e,t,i;return{auth0Client:(e=n.query("auth0Client"))==null?void 0:e.slice(0,255),ip:(t=n.header("x-real-ip"))==null?void 0:t.slice(0,45),useragent:(i=n.header("user-agent"))==null?void 0:i.slice(0,512)}}const Yi=60*5,Pf=30*24*60*60,Xr=24*60*60,R0="auth-token",Zu=30*60*1e3,P0=5*60,L0=5*60;var Yu;(function(n){n[n.Include=0]="Include",n[n.None=1]="None"})(Yu||(Yu={}));var Xu;(function(n){n[n.Required=0]="Required",n[n.Ignore=1]="Ignore"})(Xu||(Xu={}));function U0(n){return Uf(n,V0,Si.Include)}function Lf(n){return Uf(n,M0,Si.None)}function Uf(n,e,t){let i="";for(let r=0;r<n.byteLength;r+=3){let s=0,o=0;for(let c=0;c<3&&r+c<n.byteLength;c++)s=s<<8|n[r+c],o+=8;for(let c=0;c<4;c++)o>=6?(i+=e[s>>o-6&63],o-=6):o>0?(i+=e[s<<6-o&63],o=0):t===Si.Include&&(i+="=")}return i}const V0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",M0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var Si;(function(n){n[n.Include=0]="Include",n[n.None=1]="None"})(Si||(Si={}));var Qu;(function(n){n[n.Required=0]="Required",n[n.Ignore=1]="Ignore"})(Qu||(Qu={}));class H0{uint8(e,t){if(e.byteLength<t+1)throw new TypeError("Insufficient bytes");return e[t]}uint16(e,t){if(e.byteLength<t+2)throw new TypeError("Insufficient bytes");return e[t]<<8|e[t+1]}uint32(e,t){if(e.byteLength<t+4)throw new TypeError("Insufficient bytes");let i=0;for(let r=0;r<4;r++)i|=e[t+r]<<24-r*8;return i}uint64(e,t){if(e.byteLength<t+8)throw new TypeError("Insufficient bytes");let i=0n;for(let r=0;r<8;r++)i|=BigInt(e[t+r])<<BigInt(56-r*8);return i}putUint8(e,t,i){if(e.length<i+1)throw new TypeError("Not enough space");if(t<0||t>255)throw new TypeError("Invalid uint8 value");e[i]=t}putUint16(e,t,i){if(e.length<i+2)throw new TypeError("Not enough space");if(t<0||t>65535)throw new TypeError("Invalid uint16 value");e[i]=t>>8,e[i+1]=t&255}putUint32(e,t,i){if(e.length<i+4)throw new TypeError("Not enough space");if(t<0||t>4294967295)throw new TypeError("Invalid uint32 value");for(let r=0;r<4;r++)e[i+r]=t>>(3-r)*8&255}putUint64(e,t,i){if(e.length<i+8)throw new TypeError("Not enough space");if(t<0||t>18446744073709551615n)throw new TypeError("Invalid uint64 value");for(let r=0;r<8;r++)e[i+r]=Number(t>>BigInt((7-r)*8)&0xffn)}}const ed=new H0;function pt(n,e){return(n<<32-e|n>>>e)>>>0}function D0(n){const e=new F0;return e.update(n),e.digest()}class F0{constructor(){te(this,"blockSize",64);te(this,"size",32);te(this,"blocks",new Uint8Array(64));te(this,"currentBlockSize",0);te(this,"H",new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]));te(this,"l",0n);te(this,"w",new Uint32Array(64))}update(e){if(this.l+=BigInt(e.byteLength)*8n,this.currentBlockSize+e.byteLength<64){this.blocks.set(e,this.currentBlockSize),this.currentBlockSize+=e.byteLength;return}let t=0;if(this.currentBlockSize>0){const i=e.slice(0,64-this.currentBlockSize);this.blocks.set(i,this.currentBlockSize),this.process(),t+=i.byteLength,this.currentBlockSize=0}for(;t+64<=e.byteLength;){const i=e.slice(t,t+64);this.blocks.set(i),this.process(),t+=64}if(e.byteLength-t>0){const i=e.slice(t);this.blocks.set(i),this.currentBlockSize=i.byteLength}}digest(){this.blocks[this.currentBlockSize]=128,this.currentBlockSize+=1,64-this.currentBlockSize<8&&(this.blocks.fill(0,this.currentBlockSize),this.process(),this.currentBlockSize=0),this.blocks.fill(0,this.currentBlockSize),ed.putUint64(this.blocks,this.l,this.blockSize-8),this.process();const e=new Uint8Array(32);for(let t=0;t<8;t++)ed.putUint32(e,this.H[t],t*4);return e}process(){for(let u=0;u<16;u++)this.w[u]=(this.blocks[u*4]<<24|this.blocks[u*4+1]<<16|this.blocks[u*4+2]<<8|this.blocks[u*4+3])>>>0;for(let u=16;u<64;u++){const p=(pt(this.w[u-2],17)^pt(this.w[u-2],19)^this.w[u-2]>>>10)>>>0,g=(pt(this.w[u-15],7)^pt(this.w[u-15],18)^this.w[u-15]>>>3)>>>0;this.w[u]=p+this.w[u-7]+g+this.w[u-16]|0}let e=this.H[0],t=this.H[1],i=this.H[2],r=this.H[3],s=this.H[4],o=this.H[5],c=this.H[6],l=this.H[7];for(let u=0;u<64;u++){const p=(pt(s,6)^pt(s,11)^pt(s,25))>>>0,g=(s&o^~s&c)>>>0,m=l+p+g+q0[u]+this.w[u]|0,x=(pt(e,2)^pt(e,13)^pt(e,22))>>>0,h=(e&t^e&i^t&i)>>>0,_=x+h|0;l=c,c=o,o=s,s=r+m|0,r=i,i=t,t=e,e=m+_|0}this.H[0]=e+this.H[0]|0,this.H[1]=t+this.H[1]|0,this.H[2]=i+this.H[2]|0,this.H[3]=r+this.H[3]|0,this.H[4]=s+this.H[4]|0,this.H[5]=o+this.H[5]|0,this.H[6]=c+this.H[6]|0,this.H[7]=l+this.H[7]|0}}const q0=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);new BigUint64Array([0x428a2f98d728ae22n,0x7137449123ef65cdn,0xb5c0fbcfec4d3b2fn,0xe9b5dba58189dbbcn,0x3956c25bf348b538n,0x59f111f1b605d019n,0x923f82a4af194f9bn,0xab1c5ed5da6d8118n,0xd807aa98a3030242n,0x12835b0145706fben,0x243185be4ee4b28cn,0x550c7dc3d5ffb4e2n,0x72be5d74f27b896fn,0x80deb1fe3b1696b1n,0x9bdc06a725c71235n,0xc19bf174cf692694n,0xe49b69c19ef14ad2n,0xefbe4786384f25e3n,0x0fc19dc68b8cd5b5n,0x240ca1cc77ac9c65n,0x2de92c6f592b0275n,0x4a7484aa6ea6e483n,0x5cb0a9dcbd41fbd4n,0x76f988da831153b5n,0x983e5152ee66dfabn,0xa831c66d2db43210n,0xb00327c898fb213fn,0xbf597fc7beef0ee4n,0xc6e00bf33da88fc2n,0xd5a79147930aa725n,0x06ca6351e003826fn,0x142929670a0e6e70n,0x27b70a8546d22ffcn,0x2e1b21385c26c926n,0x4d2c6dfc5ac42aedn,0x53380d139d95b3dfn,0x650a73548baf63den,0x766a0abb3c77b2a8n,0x81c2c92e47edaee6n,0x92722c851482353bn,0xa2bfe8a14cf10364n,0xa81a664bbc423001n,0xc24b8b70d0f89791n,0xc76c51a30654be30n,0xd192e819d6ef5218n,0xd69906245565a910n,0xf40e35855771202an,0x106aa07032bbd1b8n,0x19a4c116b8d2d0c8n,0x1e376c085141ab53n,0x2748774cdf8eeb99n,0x34b0bcb5e19b48a8n,0x391c0cb3c5c95a63n,0x4ed8aa4ae3418acbn,0x5b9cca4f7763e373n,0x682e6ff3d6b2b8a3n,0x748f82ee5defb2fcn,0x78a5636f43172f60n,0x84c87814a1f0ab72n,0x8cc702081a6439ecn,0x90befffa23631e28n,0xa4506cebde82bde9n,0xbef9a3f7b2c67915n,0xc67178f2e372532bn,0xca273eceea26619cn,0xd186b8c721c0c207n,0xeada7dd6cde0eb1en,0xf57d4f7fee6ed178n,0x06f067aa72176fban,0x0a637dc5a2c898a6n,0x113f9804bef90daen,0x1b710b35131c471bn,0x28db77f523047d84n,0x32caab7b40c72493n,0x3c9ebe0a15c9bebcn,0x431d67c49c100d4cn,0x4cc5d4becb3e42b6n,0x597f299cfc657e2an,0x5fcb6fab3ad6faecn,0x6c44198c4a475817n]);class K0{constructor(e){te(this,"data");this.data=e}tokenType(){if("token_type"in this.data&&typeof this.data.token_type=="string")return this.data.token_type;throw new Error("Missing or invalid 'token_type' field")}accessToken(){if("access_token"in this.data&&typeof this.data.access_token=="string")return this.data.access_token;throw new Error("Missing or invalid 'access_token' field")}accessTokenExpiresInSeconds(){if("expires_in"in this.data&&typeof this.data.expires_in=="number")return this.data.expires_in;throw new Error("Missing or invalid 'expires_in' field")}accessTokenExpiresAt(){return new Date(Date.now()+this.accessTokenExpiresInSeconds()*1e3)}hasRefreshToken(){return"refresh_token"in this.data&&typeof this.data.refresh_token=="string"}refreshToken(){if("refresh_token"in this.data&&typeof this.data.refresh_token=="string")return this.data.refresh_token;throw new Error("Missing or invalid 'refresh_token' field")}hasScopes(){return"scope"in this.data&&typeof this.data.scope=="string"}scopes(){if("scope"in this.data&&typeof this.data.scope=="string")return this.data.scope.split(" ");throw new Error("Missing or invalid 'scope' field")}idToken(){if("id_token"in this.data&&typeof this.data.id_token=="string")return this.data.id_token;throw new Error("Missing or invalid field 'id_token'")}}function W0(n){const e=D0(new TextEncoder().encode(n));return Lf(e)}function G0(){const n=new Uint8Array(32);return crypto.getRandomValues(n),Lf(n)}function li(n,e){const t=new TextEncoder().encode(e.toString()),i=new Request(n,{method:"POST",body:t});return i.headers.set("Content-Type","application/x-www-form-urlencoded"),i.headers.set("Accept","application/json"),i.headers.set("User-Agent","arctic"),i.headers.set("Content-Length",t.byteLength.toString()),i}function go(n,e){const t=new TextEncoder().encode(`${n}:${e}`);return U0(t)}async function Qr(n){let e;try{e=await fetch(n)}catch(t){throw new Mf(t)}if(e.status===400||e.status===401){let t;try{t=await e.json()}catch{throw new rr(e.status)}if(typeof t!="object"||t===null)throw new $n(e.status,t);let i;try{i=Vf(t)}catch{throw new $n(e.status,t)}throw i}if(e.status===200){let t;try{t=await e.json()}catch{throw new rr(e.status)}if(typeof t!="object"||t===null)throw new $n(e.status,t);return new K0(t)}throw e.body!==null&&await e.body.cancel(),new rr(e.status)}async function J0(n){let e;try{e=await fetch(n)}catch(t){throw new Mf(t)}if(e.status===400||e.status===401){let t;try{t=await e.json()}catch{throw new $n(e.status,null)}if(typeof t!="object"||t===null)throw new $n(e.status,t);let i;try{i=Vf(t)}catch{throw new $n(e.status,t)}throw i}if(e.status===200){e.body!==null&&await e.body.cancel();return}throw e.body!==null&&await e.body.cancel(),new rr(e.status)}function Vf(n){let e;if("error"in n&&typeof n.error=="string")e=n.error;else throw new Error("Invalid error response");let t=null,i=null,r=null;if("error_description"in n){if(typeof n.error_description!="string")throw new Error("Invalid data");t=n.error_description}if("error_uri"in n){if(typeof n.error_uri!="string")throw new Error("Invalid data");i=n.error_uri}if("state"in n){if(typeof n.state!="string")throw new Error("Invalid data");r=n.state}return new Z0(e,t,i,r)}class Mf extends Error{constructor(e){super("Failed to send request",{cause:e})}}class Z0 extends Error{constructor(t,i,r,s){super(`OAuth request error: ${t}`);te(this,"code");te(this,"description");te(this,"uri");te(this,"state");this.code=t,this.description=i,this.uri=r,this.state=s}}class rr extends Error{constructor(t){super("Unexpected error response");te(this,"status");this.status=t}}class $n extends Error{constructor(t,i){super("Unexpected error response body");te(this,"status");te(this,"data");this.status=t,this.data=i}}class Uc{constructor(e,t,i){te(this,"clientId");te(this,"clientPassword");te(this,"redirectURI");this.clientId=e,this.clientPassword=t,this.redirectURI=i}createAuthorizationURL(e,t,i){const r=new URL(e);return r.searchParams.set("response_type","code"),r.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&r.searchParams.set("redirect_uri",this.redirectURI),r.searchParams.set("state",t),i.length>0&&r.searchParams.set("scope",i.join(" ")),r}createAuthorizationURLWithPKCE(e,t,i,r,s){const o=new URL(e);if(o.searchParams.set("response_type","code"),o.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&o.searchParams.set("redirect_uri",this.redirectURI),o.searchParams.set("state",t),i===Ai.S256){const c=W0(r);o.searchParams.set("code_challenge_method","S256"),o.searchParams.set("code_challenge",c)}else i===Ai.Plain&&(o.searchParams.set("code_challenge_method","plain"),o.searchParams.set("code_challenge",r));return s.length>0&&o.searchParams.set("scope",s.join(" ")),o}async validateAuthorizationCode(e,t,i){const r=new URLSearchParams;r.set("grant_type","authorization_code"),r.set("code",t),this.redirectURI!==null&&r.set("redirect_uri",this.redirectURI),i!==null&&r.set("code_verifier",i),this.clientPassword===null&&r.set("client_id",this.clientId);const s=li(e,r);if(this.clientPassword!==null){const c=go(this.clientId,this.clientPassword);s.headers.set("Authorization",`Basic ${c}`)}return await Qr(s)}async refreshAccessToken(e,t,i){const r=new URLSearchParams;r.set("grant_type","refresh_token"),r.set("refresh_token",t),this.clientPassword===null&&r.set("client_id",this.clientId),i.length>0&&r.set("scope",i.join(" "));const s=li(e,r);if(this.clientPassword!==null){const c=go(this.clientId,this.clientPassword);s.headers.set("Authorization",`Basic ${c}`)}return await Qr(s)}async revokeToken(e,t){const i=new URLSearchParams;i.set("token",t),this.clientPassword===null&&i.set("client_id",this.clientId);const r=li(e,i);if(this.clientPassword!==null){const s=go(this.clientId,this.clientPassword);r.headers.set("Authorization",`Basic ${s}`)}await J0(r)}}var Ai;(function(n){n[n.S256=0]="S256",n[n.Plain=1]="Plain"})(Ai||(Ai={}));var td;(function(n){n[n.Include=0]="Include",n[n.None=1]="None"})(td||(td={}));var nd;(function(n){n[n.Required=0]="Required",n[n.Ignore=1]="Ignore"})(nd||(nd={}));function ui(n){return Y0(n,X0,es.None)}function Y0(n,e,t){let i="";for(let r=0;r<n.byteLength;r+=3){let s=0,o=0;for(let c=0;c<3&&r+c<n.byteLength;c++)s=s<<8|n[r+c],o+=8;for(let c=0;c<4;c++)o>=6?(i+=e[s>>o-6&63],o-=6):o>0?(i+=e[s<<6-o&63],o=0):t===es.Include&&(i+="=")}return i}const X0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var es;(function(n){n[n.Include=0]="Include",n[n.None=1]="None"})(es||(es={}));var id;(function(n){n[n.Required=0]="Required",n[n.Ignore=1]="Ignore"})(id||(id={}));function Q0(n,e,t){const i=ui(new TextEncoder().encode(n)),r=ui(new TextEncoder().encode(e)),s=ui(t);return i+"."+r+"."+s}function em(n,e){const t=ui(new TextEncoder().encode(n)),i=ui(new TextEncoder().encode(e)),r=t+"."+i;return new TextEncoder().encode(r)}const tm="https://appleid.apple.com/auth/authorize",nm="https://appleid.apple.com/auth/token";class Hf{constructor(e,t,i,r,s){te(this,"clientId");te(this,"teamId");te(this,"keyId");te(this,"pkcs8PrivateKey");te(this,"redirectURI");this.clientId=e,this.teamId=t,this.keyId=i,this.pkcs8PrivateKey=r,this.redirectURI=s}createAuthorizationURL(e,t){const i=new URL(tm);return i.searchParams.set("response_type","code"),i.searchParams.set("client_id",this.clientId),i.searchParams.set("state",e),t.length>0&&i.searchParams.set("scope",t.join(" ")),i.searchParams.set("redirect_uri",this.redirectURI),i}async validateAuthorizationCode(e){const t=new URLSearchParams;t.set("grant_type","authorization_code"),t.set("code",e),t.set("redirect_uri",this.redirectURI),t.set("client_id",this.clientId);const i=await this.createClientSecret();t.set("client_secret",i);const r=li(nm,t);return await Qr(r)}async createClientSecret(){const e=await crypto.subtle.importKey("pkcs8",this.pkcs8PrivateKey,{name:"ECDSA",namedCurve:"P-256"},!1,["sign"]),t=Math.floor(Date.now()/1e3),i=JSON.stringify({typ:"JWT",alg:"ES256",kid:this.keyId}),r=JSON.stringify({iss:this.teamId,exp:t+5*60,aud:["https://appleid.apple.com"],sub:this.clientId,iat:t}),s=new Uint8Array(await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},e,em(i,r)));return Q0(i,r,s)}}const im="https://www.facebook.com/v16.0/dialog/oauth",rm="https://graph.facebook.com/v16.0/oauth/access_token";class Df{constructor(e,t,i){te(this,"clientId");te(this,"clientSecret");te(this,"redirectURI");this.clientId=e,this.clientSecret=t,this.redirectURI=i}createAuthorizationURL(e,t){const i=new URL(im);return i.searchParams.set("response_type","code"),i.searchParams.set("client_id",this.clientId),i.searchParams.set("state",e),t.length>0&&i.searchParams.set("scope",t.join(" ")),i.searchParams.set("redirect_uri",this.redirectURI),i}async validateAuthorizationCode(e){const t=new URLSearchParams;t.set("grant_type","authorization_code"),t.set("code",e),t.set("redirect_uri",this.redirectURI),t.set("client_id",this.clientId),t.set("client_secret",this.clientSecret);const i=li(rm,t);return await Qr(i)}}const sm="https://accounts.google.com/o/oauth2/v2/auth",rd="https://oauth2.googleapis.com/token",om="https://oauth2.googleapis.com/revoke";class Ff{constructor(e,t,i){te(this,"client");this.client=new Uc(e,t,i)}createAuthorizationURL(e,t,i){return this.client.createAuthorizationURLWithPKCE(sm,e,Ai.S256,t,i)}async validateAuthorizationCode(e,t){return await this.client.validateAuthorizationCode(rd,e,t)}async refreshAccessToken(e){return await this.client.refreshAccessToken(rd,e,[])}async revokeToken(e){await this.client.revokeToken(om,e)}}class Vc{constructor(e,t){te(this,"value");te(this,"unit");this.value=e,this.unit=t}milliseconds(){return this.unit==="ms"?this.value:this.unit==="s"?this.value*1e3:this.unit==="m"?this.value*1e3*60:this.unit==="h"?this.value*1e3*60*60:this.unit==="d"?this.value*1e3*60*60*24:this.value*1e3*60*60*24*7}seconds(){return this.milliseconds()/1e3}transform(e){return new Vc(Math.round(this.milliseconds()*e),"ms")}}async function sd(n,e,t,i){const r={alg:n,typ:"JWT",...i==null?void 0:i.headers},s={...t};(i==null?void 0:i.audiences)!==void 0&&(s.aud=i.audiences),(i==null?void 0:i.subject)!==void 0&&(s.sub=i.subject),(i==null?void 0:i.issuer)!==void 0&&(s.iss=i.issuer),(i==null?void 0:i.jwtId)!==void 0&&(s.jti=i.jwtId),(i==null?void 0:i.expiresIn)!==void 0&&(s.exp=Math.floor(Date.now()/1e3)+i.expiresIn.seconds()),(i==null?void 0:i.notBefore)!==void 0&&(s.nbf=Math.floor(i.notBefore.getTime()/1e3)),s.iat=Math.floor(Date.now()/1e3);const o=new TextEncoder,c=tn.encode(o.encode(JSON.stringify(r)),{includePadding:!1}),l=tn.encode(o.encode(JSON.stringify(s)),{includePadding:!1}),u=o.encode([c,l].join(".")),p=await cm(n).sign(e,u),g=tn.encode(new Uint8Array(p),{includePadding:!1});return[c,l,g].join(".")}function am(n){const e=n.split(".");return e.length!==3?null:e}function Mc(n){const e=am(n);if(!e)return null;const t=new TextDecoder,i=tn.decode(e[0],{strict:!1}),r=tn.decode(e[1],{strict:!1}),s=JSON.parse(t.decode(i));if(typeof s!="object"||s===null||!("alg"in s)||!lm(s.alg)||"typ"in s&&s.typ!=="JWT")return null;const o=JSON.parse(t.decode(r));if(typeof o!="object"||o===null)return null;const c={algorithm:s.alg,expiresAt:null,subject:null,issuedAt:null,issuer:null,jwtId:null,audiences:null,notBefore:null};if("exp"in o){if(typeof o.exp!="number")return null;c.expiresAt=new Date(o.exp*1e3)}if("iss"in o){if(typeof o.iss!="string")return null;c.issuer=o.iss}if("sub"in o){if(typeof o.sub!="string")return null;c.subject=o.sub}if("aud"in o)if(Array.isArray(o.aud)){for(const l of o.aud)if(typeof l!="string")return null;c.audiences=o.aud}else{if(typeof o.aud!="string")return null;c.audiences=[o.aud]}if("nbf"in o){if(typeof o.nbf!="number")return null;c.notBefore=new Date(o.nbf*1e3)}if("iat"in o){if(typeof o.iat!="number")return null;c.issuedAt=new Date(o.iat*1e3)}if("jti"in o){if(typeof o.jti!="string")return null;c.jwtId=o.jti}return{value:n,header:{...s,typ:"JWT",alg:s.alg},payload:{...o},parts:e,...c}}function cm(n){return new f0(um[n])}function lm(n){return typeof n!="string"?!1:["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512","PS256","PS384","PS512"].includes(n)}const um={RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512"},Gs=a.z.object({iss:a.z.string().url(),sub:a.z.string(),aud:a.z.string(),exp:a.z.number(),email:a.z.string().optional(),given_name:a.z.string().optional(),family_name:a.z.string().optional(),name:a.z.string().optional(),iat:a.z.number(),auth_time:a.z.number().optional(),nonce:a.z.string().optional(),acr:a.z.string().optional(),amr:a.z.array(a.z.string()).optional(),azp:a.z.string().optional(),at_hash:a.z.string().optional(),c_hash:a.z.string().optional()}).passthrough();Gs.omit({iat:!0,auth_time:!0,nonce:!0,acr:!0,amr:!0,azp:!0,at_hash:!0,c_hash:!0});function qf(n){const{options:e}=n;if(!e||!e.client_id||!e.team_id||!e.kid||!e.app_secret)throw new Error("Missing required Apple authentication parameters");const t=Buffer.from(e.app_secret,"utf-8"),i=t.toString().replace(/-----BEGIN PRIVATE KEY-----|-----END PRIVATE KEY-----|\s/g,""),r=Uint8Array.from(Buffer.from(i,"base64"));return t.fill(0),{options:e,keyArray:r}}async function dm(n,e){var l,u;const{options:t,keyArray:i}=qf(e),r=new Hf(t.client_id,t.team_id,t.kid,i,`${n.env.ISSUER}callback`),s=Ke(),o=await r.createAuthorizationURL(s,((l=t.scope)==null?void 0:l.split(" "))||["name","email"]);return(((u=t.scope)==null?void 0:u.split(" "))||["name","email"]).some(p=>["email","name"].includes(p))&&o.searchParams.set("response_mode","form_post"),{redirectUrl:o.href,code:s}}async function pm(n,e,t){const{options:i,keyArray:r}=qf(e),o=await new Hf(i.client_id,i.team_id,i.kid,r,`${n.env.ISSUER}callback`).validateAuthorizationCode(t),c=Mc(o.idToken());if(!c)throw new Error("Invalid ID token");const l=Gs.parse(c.payload);return{sub:l.sub,email:l.email,given_name:l.given_name,family_name:l.family_name,name:l.name,picture:l.picture,locale:l.locale}}const fm=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:dm,validateAuthorizationCodeAndGetUser:pm},Symbol.toStringTag,{value:"Module"}));async function hm(n,e){var o;const{options:t}=e;if(!(t!=null&&t.client_id)||!t.client_secret)throw new Error("Missing required authentication parameters");const i=new Df(t.client_id,t.client_secret,`${n.env.ISSUER}callback`),r=Ke();return{redirectUrl:i.createAuthorizationURL(r,((o=t.scope)==null?void 0:o.split(" "))||["email"]).href,code:r}}async function gm(n,e,t){const{options:i}=e;if(!(i!=null&&i.client_id)||!i.client_secret)throw new Error("Missing required authentication parameters");const s=await new Df(i.client_id,i.client_secret,`${n.env.ISSUER}callback`).validateAuthorizationCode(t),o=Mc(s.idToken());if(!o)throw new Error("Invalid ID token");const c=Gs.parse(o.payload);return{sub:c.sub,email:c.email,given_name:c.given_name,family_name:c.family_name,name:c.name,picture:c.picture,locale:c.locale}}const _m=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:hm,validateAuthorizationCodeAndGetUser:gm},Symbol.toStringTag,{value:"Module"}));async function mm(n,e){var c;const{options:t}=e;if(!(t!=null&&t.client_id)||!t.client_secret)throw new Error("Missing required Google authentication parameters");const i=new Ff(t.client_id,t.client_secret,`${n.env.ISSUER}callback`),r=Ke(),s=G0();return{redirectUrl:i.createAuthorizationURL(r,s,((c=t.scope)==null?void 0:c.split(" "))??["email","profile"]).href,code:r,codeVerifier:s}}async function ym(n,e,t,i){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret||!i)throw new Error("Missing required authentication parameters");const o=await new Ff(r.client_id,r.client_secret,`${n.env.ISSUER}callback`).validateAuthorizationCode(t,i);console.log("got here");const c=Mc(o.idToken());if(!c)throw new Error("Invalid ID token");const l=Gs.parse(c.payload);return{sub:l.sub,email:l.email,given_name:l.given_name,family_name:l.family_name,name:l.name,picture:l.picture,locale:l.locale}}const vm=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:mm,validateAuthorizationCodeAndGetUser:ym},Symbol.toStringTag,{value:"Module"}));async function wm(n,e){var o;const{options:t}=e;if(!(t!=null&&t.client_id)||!t.client_secret)throw new Error("Missing required authentication parameters");const i=new Uc(t.client_id,t.client_secret,`${n.env.ISSUER}callback`),r=Ke(),s=i.createAuthorizationURL("https://api.vipps.no/access-management-1.0/access/oauth2/auth",r,((o=t.scope)==null?void 0:o.split(" "))||["openid","email","phoneNumber","name","address","birthDate"]);return s.searchParams.set("response_type","code"),s.searchParams.set("response_mode","query"),{redirectUrl:s.href,code:r}}async function bm(n,e,t){const{options:i}=e;if(!(i!=null&&i.client_id)||!i.client_secret)throw new Error("Missing required authentication parameters");const s=await new Uc(i.client_id,i.client_secret,`${n.env.ISSUER}callback`).validateAuthorizationCode("https://api.vipps.no/access-management-1.0/access/oauth2/token",t,null);return await(await fetch("https://api.vipps.no/vipps-userinfo-api/userinfo",{headers:{Authorization:`Bearer ${s.accessToken}`}})).json()}const km=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:wm,validateAuthorizationCodeAndGetUser:bm},Symbol.toStringTag,{value:"Module"}));function Kf(n,e){const t=n.env.STRATEGIES||{},r={apple:fm,facebook:_m,"google-oauth2":vm,vipps:km,...t}[e];if(!r)throw new Error(`Strategy ${e} not found`);return r}async function Hc(n,e){const t=await n.data.clients.get(e);if(!t)throw new O(403,{message:"Client not found"});const i=n.DEFAULT_CLIENT_ID?await n.data.clients.get(n.DEFAULT_CLIENT_ID):void 0,r=await n.data.connections.list(t.tenant.id),s=n.DEFAULT_TENANT_ID?await n.data.connections.list(n.DEFAULT_TENANT_ID):{connections:[]},o=r.connections.map(c=>{var p;const l=(p=s.connections)==null?void 0:p.find(g=>g.name===c.name);return l!=null&&l.options?zt.parse({...l||{},...c,options:{...l.options||{},...c.options}}):c}).filter(c=>c);return{...t,web_origins:[...(i==null?void 0:i.web_origins)||[],...t.web_origins||[],`${n.ISSUER}u/login`],allowed_logout_urls:[...(i==null?void 0:i.allowed_logout_urls)||[],...t.allowed_logout_urls||[],n.ISSUER],callbacks:[...(i==null?void 0:i.callbacks)||[],...t.callbacks||[],`${n.ISSUER}u/info`],connections:o,domains:[...t.domains||[],...(i==null?void 0:i.domains)||[]],tenant:{...(i==null?void 0:i.tenant)||{},...t.tenant}}}function Js(n,e=[]){try{const t=new URL(n);return e.some(i=>{try{return xm(t,new URL(i))}catch{return!1}})}catch{return!1}}function xm(n,e){if(n.protocol!==e.protocol||n.pathname!==e.pathname)return!1;if(e.hostname.startsWith("*.")&&e.hostname.split(".").length>2&&["http:","https:"].includes(e.protocol)){const t=e.hostname.split(".").slice(1).join(".");return n.hostname.endsWith(t)}return n.hostname===e.hostname}function Sm(n){try{const t=/-----BEGIN (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----([^-]*)-----END (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----/.exec(n);if(!t||!t[1])throw new Error("Invalid PEM format");return Uint8Array.from(atob(t[1].replace(/\s/g,"")),i=>i.charCodeAt(0)).buffer}finally{n=n.replace(/./g,"\0")}}async function Am(n,e){if(e==="plain")return n;const t=new TextEncoder().encode(n),i=await Bf(t);return tn.encode(new Uint8Array(i))}function Wf(n,e,t){const i=[];return i.push([encodeURIComponent(n),encodeURIComponent(e)]),(t==null?void 0:t.domain)!==void 0&&i.push(["Domain",t.domain]),(t==null?void 0:t.expires)!==void 0&&i.push(["Expires",t.expires.toUTCString()]),t!=null&&t.httpOnly&&i.push(["HttpOnly"]),(t==null?void 0:t.maxAge)!==void 0&&i.push(["Max-Age",t.maxAge.toString()]),(t==null?void 0:t.path)!==void 0&&i.push(["Path",t.path]),(t==null?void 0:t.sameSite)==="lax"&&i.push(["SameSite","Lax"]),(t==null?void 0:t.sameSite)==="none"&&i.push(["SameSite","None"]),(t==null?void 0:t.sameSite)==="strict"&&i.push(["SameSite","Strict"]),t!=null&&t.secure&&i.push(["Secure"]),i.map(r=>r.join("=")).join("; ")}function Im(n){const e=new Map,t=n.split("; ");for(const i of t){const r=i.split("="),s=r[0],o=r[1]??"";s&&e.set(decodeURIComponent(s),decodeURIComponent(o))}return e}function Dc(n){return`${n}-${R0}`}function Gf(n,e){return e?Im(e).get(Dc(n)):void 0}function Em(n){const e={path:"/",httpOnly:!0,secure:!0,maxAge:0};return Wf(Dc(n),"",{...e,sameSite:"none"})}function Jf(n,e){const t={path:"/",httpOnly:!0,secure:!0,maxAge:Pf};return Wf(Dc(n),e,{...t,sameSite:"none"})}var Fc={},Zs={};(function(n){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",t=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",i="["+e+"]["+t+"]*",r=new RegExp("^"+i+"$"),s=function(c,l){const u=[];let p=l.exec(c);for(;p;){const g=[];g.startIndex=l.lastIndex-p[0].length;const m=p.length;for(let x=0;x<m;x++)g.push(p[x]);u.push(g),p=l.exec(c)}return u},o=function(c){const l=r.exec(c);return!(l===null||typeof l>"u")};n.isExist=function(c){return typeof c<"u"},n.isEmptyObject=function(c){return Object.keys(c).length===0},n.merge=function(c,l,u){if(l){const p=Object.keys(l),g=p.length;for(let m=0;m<g;m++)u==="strict"?c[p[m]]=[l[p[m]]]:c[p[m]]=l[p[m]]}},n.getValue=function(c){return n.isExist(c)?c:""},n.isName=o,n.getAllMatches=s,n.nameRegexp=i})(Zs);const qc=Zs,$m={allowBooleanAttributes:!1,unpairedTags:[]};Fc.validate=function(n,e){e=Object.assign({},$m,e);const t=[];let i=!1,r=!1;n[0]==="\uFEFF"&&(n=n.substr(1));for(let s=0;s<n.length;s++)if(n[s]==="<"&&n[s+1]==="?"){if(s+=2,s=ad(n,s),s.err)return s}else if(n[s]==="<"){let o=s;if(s++,n[s]==="!"){s=cd(n,s);continue}else{let c=!1;n[s]==="/"&&(c=!0,s++);let l="";for(;s<n.length&&n[s]!==">"&&n[s]!==" "&&n[s]!==" "&&n[s]!==`
126
+ `&&n[s]!=="\r";s++)l+=n[s];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),s--),!Rm(l)){let g;return l.trim().length===0?g="Invalid space after '<'.":g="Tag '"+l+"' is an invalid name.",ye("InvalidTag",g,Oe(n,s))}const u=zm(n,s);if(u===!1)return ye("InvalidAttr","Attributes for '"+l+"' have open quote.",Oe(n,s));let p=u.value;if(s=u.index,p[p.length-1]==="/"){const g=s-p.length;p=p.substring(0,p.length-1);const m=ld(p,e);if(m===!0)i=!0;else return ye(m.err.code,m.err.msg,Oe(n,g+m.err.line))}else if(c)if(u.tagClosed){if(p.trim().length>0)return ye("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",Oe(n,o));if(t.length===0)return ye("InvalidTag","Closing tag '"+l+"' has not been opened.",Oe(n,o));{const g=t.pop();if(l!==g.tagName){let m=Oe(n,g.tagStartPos);return ye("InvalidTag","Expected closing tag '"+g.tagName+"' (opened in line "+m.line+", col "+m.col+") instead of closing tag '"+l+"'.",Oe(n,o))}t.length==0&&(r=!0)}}else return ye("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",Oe(n,s));else{const g=ld(p,e);if(g!==!0)return ye(g.err.code,g.err.msg,Oe(n,s-p.length+g.err.line));if(r===!0)return ye("InvalidXml","Multiple possible root nodes found.",Oe(n,s));e.unpairedTags.indexOf(l)!==-1||t.push({tagName:l,tagStartPos:o}),i=!0}for(s++;s<n.length;s++)if(n[s]==="<")if(n[s+1]==="!"){s++,s=cd(n,s);continue}else if(n[s+1]==="?"){if(s=ad(n,++s),s.err)return s}else break;else if(n[s]==="&"){const g=Bm(n,s);if(g==-1)return ye("InvalidChar","char '&' is not expected.",Oe(n,s));s=g}else if(r===!0&&!od(n[s]))return ye("InvalidXml","Extra text at the end",Oe(n,s));n[s]==="<"&&s--}}else{if(od(n[s]))continue;return ye("InvalidChar","char '"+n[s]+"' is not expected.",Oe(n,s))}if(i){if(t.length==1)return ye("InvalidTag","Unclosed tag '"+t[0].tagName+"'.",Oe(n,t[0].tagStartPos));if(t.length>0)return ye("InvalidXml","Invalid '"+JSON.stringify(t.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return ye("InvalidXml","Start tag expected.",1);return!0};function od(n){return n===" "||n===" "||n===`
127
+ `||n==="\r"}function ad(n,e){const t=e;for(;e<n.length;e++)if(n[e]=="?"||n[e]==" "){const i=n.substr(t,e-t);if(e>5&&i==="xml")return ye("InvalidXml","XML declaration allowed only at the start of the document.",Oe(n,e));if(n[e]=="?"&&n[e+1]==">"){e++;break}else continue}return e}function cd(n,e){if(n.length>e+5&&n[e+1]==="-"&&n[e+2]==="-"){for(e+=3;e<n.length;e++)if(n[e]==="-"&&n[e+1]==="-"&&n[e+2]===">"){e+=2;break}}else if(n.length>e+8&&n[e+1]==="D"&&n[e+2]==="O"&&n[e+3]==="C"&&n[e+4]==="T"&&n[e+5]==="Y"&&n[e+6]==="P"&&n[e+7]==="E"){let t=1;for(e+=8;e<n.length;e++)if(n[e]==="<")t++;else if(n[e]===">"&&(t--,t===0))break}else if(n.length>e+9&&n[e+1]==="["&&n[e+2]==="C"&&n[e+3]==="D"&&n[e+4]==="A"&&n[e+5]==="T"&&n[e+6]==="A"&&n[e+7]==="["){for(e+=8;e<n.length;e++)if(n[e]==="]"&&n[e+1]==="]"&&n[e+2]===">"){e+=2;break}}return e}const Cm='"',jm="'";function zm(n,e){let t="",i="",r=!1;for(;e<n.length;e++){if(n[e]===Cm||n[e]===jm)i===""?i=n[e]:i!==n[e]||(i="");else if(n[e]===">"&&i===""){r=!0;break}t+=n[e]}return i!==""?!1:{value:t,index:e,tagClosed:r}}const Nm=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function ld(n,e){const t=qc.getAllMatches(n,Nm),i={};for(let r=0;r<t.length;r++){if(t[r][1].length===0)return ye("InvalidAttr","Attribute '"+t[r][2]+"' has no space in starting.",ti(t[r]));if(t[r][3]!==void 0&&t[r][4]===void 0)return ye("InvalidAttr","Attribute '"+t[r][2]+"' is without value.",ti(t[r]));if(t[r][3]===void 0&&!e.allowBooleanAttributes)return ye("InvalidAttr","boolean attribute '"+t[r][2]+"' is not allowed.",ti(t[r]));const s=t[r][2];if(!Tm(s))return ye("InvalidAttr","Attribute '"+s+"' is an invalid name.",ti(t[r]));if(!i.hasOwnProperty(s))i[s]=1;else return ye("InvalidAttr","Attribute '"+s+"' is repeated.",ti(t[r]))}return!0}function Om(n,e){let t=/\d/;for(n[e]==="x"&&(e++,t=/[\da-fA-F]/);e<n.length;e++){if(n[e]===";")return e;if(!n[e].match(t))break}return-1}function Bm(n,e){if(e++,n[e]===";")return-1;if(n[e]==="#")return e++,Om(n,e);let t=0;for(;e<n.length;e++,t++)if(!(n[e].match(/\w/)&&t<20)){if(n[e]===";")break;return-1}return e}function ye(n,e,t){return{err:{code:n,msg:e,line:t.line||t,col:t.col}}}function Tm(n){return qc.isName(n)}function Rm(n){return qc.isName(n)}function Oe(n,e){const t=n.substring(0,e).split(/\r?\n/);return{line:t.length,col:t[t.length-1].length+1}}function ti(n){return n.startIndex+n[1].length}var Kc={};const Zf={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(n,e){return e},attributeValueProcessor:function(n,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(n,e,t){return n}},Pm=function(n){return Object.assign({},Zf,n)};Kc.buildOptions=Pm;Kc.defaultOptions=Zf;class Lm{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}var Um=Lm;const Vm=Zs;function Mm(n,e){const t={};if(n[e+3]==="O"&&n[e+4]==="C"&&n[e+5]==="T"&&n[e+6]==="Y"&&n[e+7]==="P"&&n[e+8]==="E"){e=e+9;let i=1,r=!1,s=!1,o="";for(;e<n.length;e++)if(n[e]==="<"&&!s){if(r&&Fm(n,e)){e+=7;let c,l;[c,l,e]=Hm(n,e+1),l.indexOf("&")===-1&&(t[Gm(c)]={regx:RegExp(`&${c};`,"g"),val:l})}else if(r&&qm(n,e))e+=8;else if(r&&Km(n,e))e+=8;else if(r&&Wm(n,e))e+=9;else if(Dm)s=!0;else throw new Error("Invalid DOCTYPE");i++,o=""}else if(n[e]===">"){if(s?n[e-1]==="-"&&n[e-2]==="-"&&(s=!1,i--):i--,i===0)break}else n[e]==="["?r=!0:o+=n[e];if(i!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:t,i:e}}function Hm(n,e){let t="";for(;e<n.length&&n[e]!=="'"&&n[e]!=='"';e++)t+=n[e];if(t=t.trim(),t.indexOf(" ")!==-1)throw new Error("External entites are not supported");const i=n[e++];let r="";for(;e<n.length&&n[e]!==i;e++)r+=n[e];return[t,r,e]}function Dm(n,e){return n[e+1]==="!"&&n[e+2]==="-"&&n[e+3]==="-"}function Fm(n,e){return n[e+1]==="!"&&n[e+2]==="E"&&n[e+3]==="N"&&n[e+4]==="T"&&n[e+5]==="I"&&n[e+6]==="T"&&n[e+7]==="Y"}function qm(n,e){return n[e+1]==="!"&&n[e+2]==="E"&&n[e+3]==="L"&&n[e+4]==="E"&&n[e+5]==="M"&&n[e+6]==="E"&&n[e+7]==="N"&&n[e+8]==="T"}function Km(n,e){return n[e+1]==="!"&&n[e+2]==="A"&&n[e+3]==="T"&&n[e+4]==="T"&&n[e+5]==="L"&&n[e+6]==="I"&&n[e+7]==="S"&&n[e+8]==="T"}function Wm(n,e){return n[e+1]==="!"&&n[e+2]==="N"&&n[e+3]==="O"&&n[e+4]==="T"&&n[e+5]==="A"&&n[e+6]==="T"&&n[e+7]==="I"&&n[e+8]==="O"&&n[e+9]==="N"}function Gm(n){if(Vm.isName(n))return n;throw new Error(`Invalid entity name ${n}`)}var Jm=Mm;const Zm=/^[-+]?0x[a-fA-F0-9]+$/,Ym=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const Xm={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Qm(n,e={}){if(e=Object.assign({},Xm,e),!n||typeof n!="string")return n;let t=n.trim();if(e.skipLike!==void 0&&e.skipLike.test(t))return n;if(e.hex&&Zm.test(t))return Number.parseInt(t,16);{const i=Ym.exec(t);if(i){const r=i[1],s=i[2];let o=ey(i[3]);const c=i[4]||i[6];if(!e.leadingZeros&&s.length>0&&r&&t[2]!==".")return n;if(!e.leadingZeros&&s.length>0&&!r&&t[1]!==".")return n;{const l=Number(t),u=""+l;return u.search(/[eE]/)!==-1||c?e.eNotation?l:n:t.indexOf(".")!==-1?u==="0"&&o===""||u===o||r&&u==="-"+o?l:n:s?o===u||r+o===u?l:n:t===u||t===r+u?l:n}}else return n}}function ey(n){return n&&n.indexOf(".")!==-1&&(n=n.replace(/0+$/,""),n==="."?n="0":n[0]==="."?n="0"+n:n[n.length-1]==="."&&(n=n.substr(0,n.length-1))),n}var ty=Qm;function ny(n){return typeof n=="function"?n:Array.isArray(n)?e=>{for(const t of n)if(typeof t=="string"&&e===t||t instanceof RegExp&&t.test(e))return!0}:()=>!1}var Yf=ny;const Xf=Zs,ni=Um,iy=Jm,ry=ty,sy=Yf;let oy=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,i)=>String.fromCharCode(Number.parseInt(i,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,i)=>String.fromCharCode(Number.parseInt(i,16))}},this.addExternalEntities=ay,this.parseXml=py,this.parseTextData=cy,this.resolveNameSpace=ly,this.buildAttributesMap=dy,this.isItStopNode=_y,this.replaceEntitiesValue=hy,this.readStopNodeData=yy,this.saveTextToParentTag=gy,this.addChild=fy,this.ignoreAttributesFn=sy(this.options.ignoreAttributes)}};function ay(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const i=e[t];this.lastEntities[i]={regex:new RegExp("&"+i+";","g"),val:n[i]}}}function cy(n,e,t,i,r,s,o){if(n!==void 0&&(this.options.trimValues&&!i&&(n=n.trim()),n.length>0)){o||(n=this.replaceEntitiesValue(n));const c=this.options.tagValueProcessor(e,n,t,r,s);return c==null?n:typeof c!=typeof n||c!==n?c:this.options.trimValues?Ma(n,this.options.parseTagValue,this.options.numberParseOptions):n.trim()===n?Ma(n,this.options.parseTagValue,this.options.numberParseOptions):n}}function ly(n){if(this.options.removeNSPrefix){const e=n.split(":"),t=n.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(n=t+e[1])}return n}const uy=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function dy(n,e,t){if(this.options.ignoreAttributes!==!0&&typeof n=="string"){const i=Xf.getAllMatches(n,uy),r=i.length,s={};for(let o=0;o<r;o++){const c=this.resolveNameSpace(i[o][1]);if(this.ignoreAttributesFn(c,e))continue;let l=i[o][4],u=this.options.attributeNamePrefix+c;if(c.length)if(this.options.transformAttributeName&&(u=this.options.transformAttributeName(u)),u==="__proto__"&&(u="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l);const p=this.options.attributeValueProcessor(c,l,e);p==null?s[u]=l:typeof p!=typeof l||p!==l?s[u]=p:s[u]=Ma(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[u]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const o={};return o[this.options.attributesGroupName]=s,o}return s}}const py=function(n){n=n.replace(/\r\n?/g,`
128
+ `);const e=new ni("!xml");let t=e,i="",r="";for(let s=0;s<n.length;s++)if(n[s]==="<")if(n[s+1]==="/"){const c=Xt(n,">",s,"Closing Tag is not closed.");let l=n.substring(s+2,c).trim();if(this.options.removeNSPrefix){const g=l.indexOf(":");g!==-1&&(l=l.substr(g+1))}this.options.transformTagName&&(l=this.options.transformTagName(l)),t&&(i=this.saveTextToParentTag(i,t,r));const u=r.substring(r.lastIndexOf(".")+1);if(l&&this.options.unpairedTags.indexOf(l)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${l}>`);let p=0;u&&this.options.unpairedTags.indexOf(u)!==-1?(p=r.lastIndexOf(".",r.lastIndexOf(".")-1),this.tagsNodeStack.pop()):p=r.lastIndexOf("."),r=r.substring(0,p),t=this.tagsNodeStack.pop(),i="",s=c}else if(n[s+1]==="?"){let c=Va(n,s,!1,"?>");if(!c)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,t,r),!(this.options.ignoreDeclaration&&c.tagName==="?xml"||this.options.ignorePiTags)){const l=new ni(c.tagName);l.add(this.options.textNodeName,""),c.tagName!==c.tagExp&&c.attrExpPresent&&(l[":@"]=this.buildAttributesMap(c.tagExp,r,c.tagName)),this.addChild(t,l,r)}s=c.closeIndex+1}else if(n.substr(s+1,3)==="!--"){const c=Xt(n,"-->",s+4,"Comment is not closed.");if(this.options.commentPropName){const l=n.substring(s+4,c-2);i=this.saveTextToParentTag(i,t,r),t.add(this.options.commentPropName,[{[this.options.textNodeName]:l}])}s=c}else if(n.substr(s+1,2)==="!D"){const c=iy(n,s);this.docTypeEntities=c.entities,s=c.i}else if(n.substr(s+1,2)==="!["){const c=Xt(n,"]]>",s,"CDATA is not closed.")-2,l=n.substring(s+9,c);i=this.saveTextToParentTag(i,t,r);let u=this.parseTextData(l,t.tagname,r,!0,!1,!0,!0);u==null&&(u=""),this.options.cdataPropName?t.add(this.options.cdataPropName,[{[this.options.textNodeName]:l}]):t.add(this.options.textNodeName,u),s=c+2}else{let c=Va(n,s,this.options.removeNSPrefix),l=c.tagName;const u=c.rawTagName;let p=c.tagExp,g=c.attrExpPresent,m=c.closeIndex;this.options.transformTagName&&(l=this.options.transformTagName(l)),t&&i&&t.tagname!=="!xml"&&(i=this.saveTextToParentTag(i,t,r,!1));const x=t;if(x&&this.options.unpairedTags.indexOf(x.tagname)!==-1&&(t=this.tagsNodeStack.pop(),r=r.substring(0,r.lastIndexOf("."))),l!==e.tagname&&(r+=r?"."+l:l),this.isItStopNode(this.options.stopNodes,r,l)){let h="";if(p.length>0&&p.lastIndexOf("/")===p.length-1)l[l.length-1]==="/"?(l=l.substr(0,l.length-1),r=r.substr(0,r.length-1),p=l):p=p.substr(0,p.length-1),s=c.closeIndex;else if(this.options.unpairedTags.indexOf(l)!==-1)s=c.closeIndex;else{const b=this.readStopNodeData(n,u,m+1);if(!b)throw new Error(`Unexpected end of ${u}`);s=b.i,h=b.tagContent}const _=new ni(l);l!==p&&g&&(_[":@"]=this.buildAttributesMap(p,r,l)),h&&(h=this.parseTextData(h,l,r,!0,g,!0,!0)),r=r.substr(0,r.lastIndexOf(".")),_.add(this.options.textNodeName,h),this.addChild(t,_,r)}else{if(p.length>0&&p.lastIndexOf("/")===p.length-1){l[l.length-1]==="/"?(l=l.substr(0,l.length-1),r=r.substr(0,r.length-1),p=l):p=p.substr(0,p.length-1),this.options.transformTagName&&(l=this.options.transformTagName(l));const h=new ni(l);l!==p&&g&&(h[":@"]=this.buildAttributesMap(p,r,l)),this.addChild(t,h,r),r=r.substr(0,r.lastIndexOf("."))}else{const h=new ni(l);this.tagsNodeStack.push(t),l!==p&&g&&(h[":@"]=this.buildAttributesMap(p,r,l)),this.addChild(t,h,r),t=h}i="",s=m}}else i+=n[s];return e.child};function fy(n,e,t){const i=this.options.updateTag(e.tagname,t,e[":@"]);i===!1||(typeof i=="string"&&(e.tagname=i),n.addChild(e))}const hy=function(n){if(this.options.processEntities){for(let e in this.docTypeEntities){const t=this.docTypeEntities[e];n=n.replace(t.regx,t.val)}for(let e in this.lastEntities){const t=this.lastEntities[e];n=n.replace(t.regex,t.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const t=this.htmlEntities[e];n=n.replace(t.regex,t.val)}n=n.replace(this.ampEntity.regex,this.ampEntity.val)}return n};function gy(n,e,t,i){return n&&(i===void 0&&(i=Object.keys(e.child).length===0),n=this.parseTextData(n,e.tagname,t,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,i),n!==void 0&&n!==""&&e.add(this.options.textNodeName,n),n=""),n}function _y(n,e,t){const i="*."+t;for(const r in n){const s=n[r];if(i===s||e===s)return!0}return!1}function my(n,e,t=">"){let i,r="";for(let s=e;s<n.length;s++){let o=n[s];if(i)o===i&&(i="");else if(o==='"'||o==="'")i=o;else if(o===t[0])if(t[1]){if(n[s+1]===t[1])return{data:r,index:s}}else return{data:r,index:s};else o===" "&&(o=" ");r+=o}}function Xt(n,e,t,i){const r=n.indexOf(e,t);if(r===-1)throw new Error(i);return r+e.length-1}function Va(n,e,t,i=">"){const r=my(n,e+1,i);if(!r)return;let s=r.data;const o=r.index,c=s.search(/\s/);let l=s,u=!0;c!==-1&&(l=s.substring(0,c),s=s.substring(c+1).trimStart());const p=l;if(t){const g=l.indexOf(":");g!==-1&&(l=l.substr(g+1),u=l!==r.data.substr(g+1))}return{tagName:l,tagExp:s,closeIndex:o,attrExpPresent:u,rawTagName:p}}function yy(n,e,t){const i=t;let r=1;for(;t<n.length;t++)if(n[t]==="<")if(n[t+1]==="/"){const s=Xt(n,">",t,`${e} is not closed`);if(n.substring(t+2,s).trim()===e&&(r--,r===0))return{tagContent:n.substring(i,t),i:s};t=s}else if(n[t+1]==="?")t=Xt(n,"?>",t+1,"StopNode is not closed.");else if(n.substr(t+1,3)==="!--")t=Xt(n,"-->",t+3,"StopNode is not closed.");else if(n.substr(t+1,2)==="![")t=Xt(n,"]]>",t,"StopNode is not closed.")-2;else{const s=Va(n,t,">");s&&((s&&s.tagName)===e&&s.tagExp[s.tagExp.length-1]!=="/"&&r++,t=s.closeIndex)}}function Ma(n,e,t){if(e&&typeof n=="string"){const i=n.trim();return i==="true"?!0:i==="false"?!1:ry(n,t)}else return Xf.isExist(n)?n:""}var vy=oy,Qf={};function wy(n,e){return eh(n,e)}function eh(n,e,t){let i;const r={};for(let s=0;s<n.length;s++){const o=n[s],c=by(o);let l="";if(t===void 0?l=c:l=t+"."+c,c===e.textNodeName)i===void 0?i=o[c]:i+=""+o[c];else{if(c===void 0)continue;if(o[c]){let u=eh(o[c],e,l);const p=xy(u,e);o[":@"]?ky(u,o[":@"],l,e):Object.keys(u).length===1&&u[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?u=u[e.textNodeName]:Object.keys(u).length===0&&(e.alwaysCreateTextNode?u[e.textNodeName]="":u=""),r[c]!==void 0&&r.hasOwnProperty(c)?(Array.isArray(r[c])||(r[c]=[r[c]]),r[c].push(u)):e.isArray(c,l,p)?r[c]=[u]:r[c]=u}}}return typeof i=="string"?i.length>0&&(r[e.textNodeName]=i):i!==void 0&&(r[e.textNodeName]=i),r}function by(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const i=e[t];if(i!==":@")return i}}function ky(n,e,t,i){if(e){const r=Object.keys(e),s=r.length;for(let o=0;o<s;o++){const c=r[o];i.isArray(c,t+"."+c,!0,!0)?n[c]=[e[c]]:n[c]=e[c]}}}function xy(n,e){const{textNodeName:t}=e,i=Object.keys(n).length;return!!(i===0||i===1&&(n[t]||typeof n[t]=="boolean"||n[t]===0))}Qf.prettify=wy;const{buildOptions:Sy}=Kc,Ay=vy,{prettify:Iy}=Qf,Ey=Fc;let $y=class{constructor(e){this.externalEntities={},this.options=Sy(e)}parse(e,t){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(t){t===!0&&(t={});const s=Ey.validate(e,t);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}const i=new Ay(this.options);i.addExternalEntities(this.externalEntities);const r=i.parseXml(e);return this.options.preserveOrder||r===void 0?r:Iy(r,this.options)}addEntity(e,t){if(t.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(t==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}};var Cy=$y;const jy=`
129
+ `;function zy(n,e){let t="";return e.format&&e.indentBy.length>0&&(t=jy),th(n,e,"",t)}function th(n,e,t,i){let r="",s=!1;for(let o=0;o<n.length;o++){const c=n[o],l=Ny(c);if(l===void 0)continue;let u="";if(t.length===0?u=l:u=`${t}.${l}`,l===e.textNodeName){let h=c[l];Oy(u,e)||(h=e.tagValueProcessor(l,h),h=nh(h,e)),s&&(r+=i),r+=h,s=!1;continue}else if(l===e.cdataPropName){s&&(r+=i),r+=`<![CDATA[${c[l][0][e.textNodeName]}]]>`,s=!1;continue}else if(l===e.commentPropName){r+=i+`<!--${c[l][0][e.textNodeName]}-->`,s=!0;continue}else if(l[0]==="?"){const h=ud(c[":@"],e),_=l==="?xml"?"":i;let b=c[l][0][e.textNodeName];b=b.length!==0?" "+b:"",r+=_+`<${l}${b}${h}?>`,s=!0;continue}let p=i;p!==""&&(p+=e.indentBy);const g=ud(c[":@"],e),m=i+`<${l}${g}`,x=th(c[l],e,u,p);e.unpairedTags.indexOf(l)!==-1?e.suppressUnpairedNode?r+=m+">":r+=m+"/>":(!x||x.length===0)&&e.suppressEmptyNode?r+=m+"/>":x&&x.endsWith(">")?r+=m+`>${x}${i}</${l}>`:(r+=m+">",x&&i!==""&&(x.includes("/>")||x.includes("</"))?r+=i+e.indentBy+x+i:r+=x,r+=`</${l}>`),s=!0}return r}function Ny(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const i=e[t];if(n.hasOwnProperty(i)&&i!==":@")return i}}function ud(n,e){let t="";if(n&&!e.ignoreAttributes)for(let i in n){if(!n.hasOwnProperty(i))continue;let r=e.attributeValueProcessor(i,n[i]);r=nh(r,e),r===!0&&e.suppressBooleanAttributes?t+=` ${i.substr(e.attributeNamePrefix.length)}`:t+=` ${i.substr(e.attributeNamePrefix.length)}="${r}"`}return t}function Oy(n,e){n=n.substr(0,n.length-e.textNodeName.length-1);let t=n.substr(n.lastIndexOf(".")+1);for(let i in e.stopNodes)if(e.stopNodes[i]===n||e.stopNodes[i]==="*."+t)return!0;return!1}function nh(n,e){if(n&&n.length>0&&e.processEntities)for(let t=0;t<e.entities.length;t++){const i=e.entities[t];n=n.replace(i.regex,i.val)}return n}var By=zy;const Ty=By,Ry=Yf,Py={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(n,e){return e},attributeValueProcessor:function(n,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function qt(n){this.options=Object.assign({},Py,n),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Ry(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Vy),this.processTextOrObjNode=Ly,this.options.format?(this.indentate=Uy,this.tagEndChar=`>
130
+ `,this.newLine=`
131
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}qt.prototype.build=function(n){return this.options.preserveOrder?Ty(n,this.options):(Array.isArray(n)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(n={[this.options.arrayNodeName]:n}),this.j2x(n,0,[]).val)};qt.prototype.j2x=function(n,e,t){let i="",r="";const s=t.join(".");for(let o in n)if(Object.prototype.hasOwnProperty.call(n,o))if(typeof n[o]>"u")this.isAttribute(o)&&(r+="");else if(n[o]===null)this.isAttribute(o)?r+="":o[0]==="?"?r+=this.indentate(e)+"<"+o+"?"+this.tagEndChar:r+=this.indentate(e)+"<"+o+"/"+this.tagEndChar;else if(n[o]instanceof Date)r+=this.buildTextValNode(n[o],o,"",e);else if(typeof n[o]!="object"){const c=this.isAttribute(o);if(c&&!this.ignoreAttributesFn(c,s))i+=this.buildAttrPairStr(c,""+n[o]);else if(!c)if(o===this.options.textNodeName){let l=this.options.tagValueProcessor(o,""+n[o]);r+=this.replaceEntitiesValue(l)}else r+=this.buildTextValNode(n[o],o,"",e)}else if(Array.isArray(n[o])){const c=n[o].length;let l="",u="";for(let p=0;p<c;p++){const g=n[o][p];if(!(typeof g>"u"))if(g===null)o[0]==="?"?r+=this.indentate(e)+"<"+o+"?"+this.tagEndChar:r+=this.indentate(e)+"<"+o+"/"+this.tagEndChar;else if(typeof g=="object")if(this.options.oneListGroup){const m=this.j2x(g,e+1,t.concat(o));l+=m.val,this.options.attributesGroupName&&g.hasOwnProperty(this.options.attributesGroupName)&&(u+=m.attrStr)}else l+=this.processTextOrObjNode(g,o,e,t);else if(this.options.oneListGroup){let m=this.options.tagValueProcessor(o,g);m=this.replaceEntitiesValue(m),l+=m}else l+=this.buildTextValNode(g,o,"",e)}this.options.oneListGroup&&(l=this.buildObjectNode(l,o,u,e)),r+=l}else if(this.options.attributesGroupName&&o===this.options.attributesGroupName){const c=Object.keys(n[o]),l=c.length;for(let u=0;u<l;u++)i+=this.buildAttrPairStr(c[u],""+n[o][c[u]])}else r+=this.processTextOrObjNode(n[o],o,e,t);return{attrStr:i,val:r}};qt.prototype.buildAttrPairStr=function(n,e){return e=this.options.attributeValueProcessor(n,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+n:" "+n+'="'+e+'"'};function Ly(n,e,t,i){const r=this.j2x(n,t+1,i.concat(e));return n[this.options.textNodeName]!==void 0&&Object.keys(n).length===1?this.buildTextValNode(n[this.options.textNodeName],e,r.attrStr,t):this.buildObjectNode(r.val,e,r.attrStr,t)}qt.prototype.buildObjectNode=function(n,e,t,i){if(n==="")return e[0]==="?"?this.indentate(i)+"<"+e+t+"?"+this.tagEndChar:this.indentate(i)+"<"+e+t+this.closeTag(e)+this.tagEndChar;{let r="</"+e+this.tagEndChar,s="";return e[0]==="?"&&(s="?",r=""),(t||t==="")&&n.indexOf("<")===-1?this.indentate(i)+"<"+e+t+s+">"+n+r:this.options.commentPropName!==!1&&e===this.options.commentPropName&&s.length===0?this.indentate(i)+`<!--${n}-->`+this.newLine:this.indentate(i)+"<"+e+t+s+this.tagEndChar+n+this.indentate(i)+r}};qt.prototype.closeTag=function(n){let e="";return this.options.unpairedTags.indexOf(n)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${n}`,e};qt.prototype.buildTextValNode=function(n,e,t,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(i)+`<![CDATA[${n}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(i)+`<!--${n}-->`+this.newLine;if(e[0]==="?")return this.indentate(i)+"<"+e+t+"?"+this.tagEndChar;{let r=this.options.tagValueProcessor(e,n);return r=this.replaceEntitiesValue(r),r===""?this.indentate(i)+"<"+e+t+this.closeTag(e)+this.tagEndChar:this.indentate(i)+"<"+e+t+">"+r+"</"+e+this.tagEndChar}};qt.prototype.replaceEntitiesValue=function(n){if(n&&n.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const t=this.options.entities[e];n=n.replace(t.regex,t.val)}return n};function Uy(n){return this.options.indentBy.repeat(n)}function Vy(n){return n.startsWith(this.options.attributeNamePrefix)&&n!==this.options.textNodeName?n.substr(this.attrPrefixLen):!1}var My=qt;const Hy=Fc,Dy=Cy,Fy=My;var qy={XMLParser:Dy,XMLValidator:Hy,XMLBuilder:Fy};function Ky(n,e,t){const i=t?`<input type="hidden" name="RelayState" value="${t}" />`:"",r=`
132
+ <!DOCTYPE html>
133
+ <html>
134
+ <body onload="document.forms[0].submit()">
135
+ <noscript>
136
+ <p>Your browser has JavaScript disabled. Please click the button below to continue:</p>
137
+ <input type="submit" value="Continue">
138
+ </noscript>
139
+ <form method="post" action="${n}">
140
+ <input type="hidden" name="SAMLResponse" value="${e}" />
141
+ ${i}
142
+ </form>
143
+ <script>
144
+ window.onload = function() {{
145
+ document.forms[0].submit();
146
+ }};
147
+ <\/script>
148
+ </body>
149
+ </html>`;return new Response(r,{headers:{"Content-Type":"text/html"}})}async function Wy(n,e,t,i,r){var m,x,h;if(!t.redirect_uri)throw new O(400,{message:"Missing redirect_uri in authParams"});const[s]=await n.env.data.keys.list();if(!s)throw new O(500,{message:"No signing key found"});if(!((m=e.addons)!=null&&m.samlp))throw new O(400,{message:`SAML Addon is not enabled for client ${e.id}`});const{recipient:o,audience:c}=e.addons.samlp,l=t.state||"";if(!o||!l||!i||!t.state)throw new O(400,{message:"Missing recipient or inResponseTo"});const u=JSON.parse(t.state),p=new URL(t.redirect_uri),g=await Gy(n,{issuer:n.env.ISSUER,audience:c||t.client_id,destination:p.toString(),inResponseTo:u.requestId,userId:((h=(x=i.app_metadata)==null?void 0:x.vimeo)==null?void 0:h.user_id)||i.user_id,email:i.email,sessionIndex:r,signature:{privateKeyPem:s.pkcs7,cert:s.cert,kid:s.kid}});return Ky(p.toString(),g,u.relayState)}async function Gy(n,e){const t=e.notBefore||new Date().toISOString(),i=e.notAfter||new Date(new Date(t).getTime()+10*60*1e3).toISOString(),r=e.issueInstant||t,s=e.sessionNotOnOrAfter||i,o=e.responseId||`_${Ke()}`,c=e.assertionId||`_${Ke()}`,l=[{"samlp:Response":[{"saml:Issuer":[{"#text":e.issuer}]},{"samlp:Status":[{"samlp:StatusCode":[],":@":{"@_Value":"urn:oasis:names:tc:SAML:2.0:status:Success"}}]},{"saml:Assertion":[{"saml:Issuer":[{"#text":e.issuer}]},{"saml:Subject":[{"saml:NameID":[{"#text":e.email}],":@":{"@_Format":"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"}},{"saml:SubjectConfirmation":[{"saml:SubjectConfirmationData":[],":@":{"@_InResponseTo":e.inResponseTo,"@_NotOnOrAfter":i,"@_Recipient":e.destination}}],":@":{"@_Method":"urn:oasis:names:tc:SAML:2.0:cm:bearer"}}]},{"saml:Conditions":[{"saml:AudienceRestriction":[{"saml:Audience":[{"#text":e.audience}]}]}],":@":{"@_NotBefore":t,"@_NotOnOrAfter":i}},{"saml:AuthnStatement":[{"saml:AuthnContext":[{"saml:AuthnContextClassRef":[{"#text":"urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified"}]}]}],":@":{"@_AuthnInstant":r,"@_SessionIndex":e.sessionIndex,"@_SessionNotOnOrAfter":s}},{"saml:AttributeStatement":[{"saml:Attribute":[{"saml:AttributeValue":[{"#text":e.userId}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_FriendlyName":"persistent","@_Name":"id","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":e.email}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"email","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"manage-account"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"default-roles-master"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"offline_access"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"view-profile"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"uma_authorization"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"manage-account-links"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}}]}],":@":{"@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion","@_ID":c,"@_IssueInstant":r,"@_Version":"2.0"}}],":@":{"@_xmlns:samlp":"urn:oasis:names:tc:SAML:2.0:protocol","@_xmlns:saml":"urn:oasis:names:tc:SAML:2.0:assertion","@_Destination":e.destination,"@_ID":o,"@_InResponseTo":e.inResponseTo,"@_IssueInstant":r,"@_Version":"2.0"}}];let p=new qy.XMLBuilder({ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0}).build(l);if(e.signature){const m=await fetch(n.env.SAML_SIGN_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({xmlContent:p,privateKey:e.signature.privateKeyPem,publicCert:e.signature.cert})});if(!m.ok)throw new Error(`Failed to sign SAML response: ${m.status}`);p=await m.text()}return e.encode===!1?p:btoa(p)}const dd=["sub","iss","aud","exp","nbf","iat","jti"];async function Wc(n,e){var _,b;const{authParams:t,user:i,client:r,sid:s}=e,c=(await n.env.data.keys.list()).filter(S=>!S.revoked_at||new Date(S.revoked_at)>new Date),l=c[c.length-1];if(!(l!=null&&l.pkcs7))throw new O(500,{message:"No signing key available"});const u=Sm(l.pkcs7),p={aud:t.audience||"default",scope:t.scope||"",sub:(i==null?void 0:i.user_id)||t.client_id,iss:n.env.ISSUER,tenant_id:n.var.tenant_id,sid:s},g=i&&((_=t.scope)!=null&&_.split(" ").includes("openid"))?{aud:t.client_id,sub:i.user_id,iss:n.env.ISSUER,sid:s,nonce:t.nonce,given_name:i.given_name,family_name:i.family_name,nickname:i.nickname,picture:i.picture,locale:i.locale,name:i.name,email:i.email,email_verified:i.email_verified}:void 0;(b=n.env.hooks)!=null&&b.onExecuteCredentialsExchange&&await n.env.hooks.onExecuteCredentialsExchange({client:r,user:i,scope:t.scope||"",grant_type:""},{accessToken:{setCustomClaim:(S,N)=>{if(dd.includes(S))throw new Error(`Cannot overwrite reserved claim '${S}'`);p[S]=N}},idToken:{setCustomClaim:(S,N)=>{if(dd.includes(S))throw new Error(`Cannot overwrite reserved claim '${S}'`);g&&(g[S]=N)}},access:{deny:S=>{throw new O(400,{message:`Access denied: ${S}`})}}});const m={includeIssuedTimestamp:!0,expiresIn:new Vc(1,"d"),headers:{kid:l.kid}},x=await sd("RS256",u,p,m),h=g?await sd("RS256",u,g,m):void 0;return{access_token:x,id_token:h,token_type:"Bearer",expires_in:86400}}async function ih(n,e,t){return await n.env.data.sessions.create(t.tenant.id,{session_id:Ke(),user_id:e.user_id,client_id:t.id,expires_at:new Date(Date.now()+Pf*1e3).toISOString(),used_at:new Date().toISOString()})}async function Fi(n,e){const{authParams:t,user:i,client:r}=e,s=e.sid||(await ih(n,i,r)).session_id;if(e.authParams.response_mode===nn.SAML_POST)return Wy(n,e.client,e.authParams,i,s);const o=await Wc(n,{authParams:t,user:i,client:r,sid:s}),c=new Headers({"set-cookie":Jf(r.tenant.id,s)});if(t.response_mode===nn.WEB_MESSAGE)return n.json(o,{headers:c});if((t.response_type||Pt.CODE)===Pt.CODE){if(!e.loginSession)throw new O(500,{message:"Login session not found"});const u=await n.env.data.codes.create(r.tenant.id,{code_id:Ke(),user_id:i.user_id,code_type:"authorization_code",login_id:e.loginSession.login_id,expires_at:new Date(Date.now()+P0*1e3).toISOString()});c.set("location",`${t.redirect_uri}?state=${e.authParams.state}&code=${u.code_id}`)}return new Response("Redirecting",{status:302,headers:c})}function Jy(n){return async(e,t)=>{if(!t.email||!t.email_verified)return n.users.create(e,t);const i=await Vd({userAdapter:n.users,tenant_id:e,email:t.email});return i?(await n.users.create(e,{...t,linked_to:i.user_id}),i):n.users.create(e,t)}}async function rh(n,e,t){for await(const i of e)if(!(await fetch(i.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).ok){const s=ke(n,{type:_e.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid password"});await t.logs.create(n.var.tenant_id,s)}}function Zy(n,e){return async(t,i)=>{const{hooks:r}=await e.hooks.list(t);return await rh(n,r,{tenant_id:t,user:i,trigger_id:"post-user-registration"}),i}}function Yy(n,e){return async(t,i)=>{const{hooks:r}=await e.hooks.list(t,{q:"trigger_id:pre-user-signup",page:0,per_page:100,include_totals:!1});await rh(n,r,{tenant_id:t,email:i,trigger_id:"pre-user-signup"})}}function Xy(n,e){return async(t,i)=>{let r=await Jy(e)(t,i);return await Zy(n,e)(t,r),r}}async function Qy(n,e,t,i){if(e.disable_sign_ups&&!await Vd({userAdapter:n.env.data.users,tenant_id:e.tenant.id,email:i})){const s=ke(n,{type:_e.FAILED_SIGNUP,description:"Public signup is disabled"});throw await n.env.data.logs.create(e.tenant.id,s),new O(400,{message:"Signups are disabled for this client"})}await Yy(n,t)(n.var.tenant_id||"",i)}function ev(n,e){return{...e,users:{...e.users,create:Xy(n,e)}}}async function tv(n,e,t,i){if(!i.state)throw new O(400,{message:"State not found"});const r=e.connections.find(l=>l.name===t);if(!r){n.set("client_id",e.id);const l=ke(n,{type:_e.FAILED_LOGIN,description:"Connection not found"});throw await n.env.data.logs.create(e.tenant.id,l),new O(403,{message:"Connection Not Found"})}let s=await n.env.data.logins.get(e.tenant.id,i.state);s||(s=await n.env.data.logins.create(e.tenant.id,{expires_at:new Date(Date.now()+Xr*1e3).toISOString(),authParams:i,...Vn(n.req)}));const c=await Kf(n,r.strategy).getRedirect(n,r);return await n.env.data.codes.create(e.tenant.id,{login_id:s.login_id,code_id:c.code,code_type:"oauth2_state",connection_id:r.id,code_verifier:c.codeVerifier,expires_at:new Date(Date.now()+L0*1e3).toISOString()}),n.redirect(c.redirectUrl)}async function pd(n,{code:e,state:t}){var h;const{env:i}=n,r=await i.data.codes.get(n.var.tenant_id||"",t,"oauth2_state");if(!r||!r.connection_id)throw new O(403,{message:"State not found"});const s=await i.data.logins.get(n.var.tenant_id||"",r.login_id);if(!s)throw new O(403,{message:"Session not found"});const o=await Hc(i,s.authParams.client_id);n.set("client_id",o.id),n.set("tenant_id",o.tenant.id);const c=o.connections.find(_=>_.id===r.connection_id);if(!c){const _=ke(n,{type:_e.FAILED_LOGIN,description:"Connection not found"});throw await i.data.logs.create(o.tenant.id,_),new O(403,{message:"Connection not found"})}if(n.set("connection",c.name),!s.authParams.redirect_uri){const _=ke(n,{type:_e.FAILED_LOGIN,description:"Redirect URI not defined"});throw await i.data.logs.create(o.tenant.id,_),new O(403,{message:"Redirect URI not defined"})}if(!Js(s.authParams.redirect_uri,o.callbacks||[])){const _=`Invalid redirect URI - ${s.authParams.redirect_uri}`,b=ke(n,{type:_e.FAILED_LOGIN,description:_});throw await i.data.logs.create(o.tenant.id,b),new O(403,{message:_})}const u=await Kf(n,c.strategy).validateAuthorizationCodeAndGetUser(n,c,e,r.code_verifier),{sub:p,...g}=u;n.set("user_id",p);const m=((h=u.email)==null?void 0:h.toLocaleLowerCase())||`${c.name}.${p}@${new URL(n.env.ISSUER).hostname}`;n.set("username",m);let x=await rs({userAdapter:i.data.users,tenant_id:o.tenant.id,email:m,provider:c.name});if(!x){try{await Qy(n,o,n.env.data,m)}catch(_){const b=_;throw new O(500,{message:`Failed to run preUserSignupHook: ${b.message}`})}x=await i.data.users.create(o.tenant.id,{user_id:`${c.name}|${p}`,email:m,name:m,provider:c.name,connection:c.name,email_verified:!0,last_ip:"",is_social:!0,last_login:new Date().toISOString(),profileData:JSON.stringify(g)}),n.set("user_id",x.user_id)}return Fi(n,{client:o,authParams:s.authParams,loginSession:s,user:x})}async function fd(n,e,t,i,r,s){const o=await n.env.data.codes.get(n.var.tenant_id||"",e,"oauth2_state");if(!o)throw new O(400,{message:"State not found"});const c=await n.env.data.logins.get(n.var.tenant_id,o.login_id);if(!c)throw new O(400,{message:"Login not found"});const{redirect_uri:l}=c.authParams;if(!l)throw new O(400,{message:"Redirect uri not found"});const u=ke(n,{type:_e.FAILED_LOGIN,description:`Failed connection login: ${r} ${t}, ${i}`});Nt(n,n.env.data.logs.create(n.var.tenant_id,u));const p=new URL(l);return T0(p,{error:t,error_description:i,error_reason:s,error_code:r,state:c.authParams.state}),n.redirect(`${n.env.ISSUER}u/enter-email?state=${c.login_id}&error=${t}`)}const nv=new a.OpenAPIHono().openapi(a.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:a.z.object({state:a.z.string(),code:a.z.string().optional(),scope:a.z.string().optional(),hd:a.z.string().optional(),error:a.z.string().optional(),error_description:a.z.string().optional(),error_code:a.z.string().optional(),error_reason:a.z.string().optional()})},responses:{302:{description:"Redirect to the client's redirect uri"}}}),async n=>{const{state:e,code:t,error:i,error_description:r,error_code:s,error_reason:o}=n.req.valid("query");if(i)return fd(n,e,i,r,s,o);if(!t)throw new O(400,{message:"Code is required"});return pd(n,{code:t,state:e})}).openapi(a.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:a.z.object({state:a.z.string(),code:a.z.string().optional(),scope:a.z.string().optional(),hd:a.z.string().optional(),error:a.z.string().optional(),error_description:a.z.string().optional(),error_code:a.z.string().optional(),error_reason:a.z.string().optional()})}}}},responses:{302:{description:"Redirect to the client's redirect uri"}}}),async n=>{const{state:e,code:t,error:i,error_description:r,error_code:s,error_reason:o}=n.req.valid("form");if(i)return fd(n,e,i,r,s,o);if(!t)throw new O(400,{message:"Code is required"});return pd(n,{code:t,state:e})}),iv=new a.OpenAPIHono().openapi(a.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:a.z.object({client_id:a.z.string(),returnTo:a.z.string().optional()}),header:a.z.object({cookie:a.z.string().optional()})},responses:{302:{description:"Log the user out"}}}),async n=>{const{client_id:e,returnTo:t}=n.req.valid("query"),i=await n.env.data.clients.get(e);if(!i)return n.text("OK");const r=await n.env.data.clients.get("DEFAULT_CLIENT");n.set("client_id",e),n.set("tenant_id",i.tenant.id);const s=t||n.req.header("referer");if(!s)return n.text("OK");if(!Js(s,[...i.allowed_logout_urls||[],...(r==null?void 0:r.allowed_logout_urls)||[]]))throw new O(400,{message:"Invalid redirect uri"});const o=n.req.header("cookie");if(o){const l=Gf(i.tenant.id,o);if(l){const u=await n.env.data.sessions.get(i.tenant.id,l);if(u){const p=await n.env.data.users.get(i.tenant.id,u.user_id);p&&(n.set("user_id",p.user_id),n.set("connection",p.connection))}await n.env.data.sessions.remove(i.tenant.id,l)}}const c=ke(n,{type:_e.SUCCESS_LOGOUT,description:"User successfully logged out"});return await n.env.data.logs.create(i.tenant.id,c),new Response("Redirecting",{status:302,headers:{"set-cookie":Em(i.tenant.id),location:s}})}),hd=a.z.object({sub:a.z.string(),email:a.z.string().optional(),family_name:a.z.string().optional(),given_name:a.z.string().optional(),email_verified:a.z.boolean()}),rv=new a.OpenAPIHono().openapi(a.createRoute({tags:["oauth2"],method:"get",path:"/",request:{},security:[{Bearer:["openid"]}],responses:{200:{content:{"application/json":{schema:hd}},description:"Userinfo"}}}),async n=>{if(!n.var.user)throw new O(404,{message:"User not found"});const e=await n.env.data.users.get(n.var.user.tenant_id,n.var.user.sub);if(!e)throw new O(404,{message:"User not found"});return n.json(hd.parse({...e,sub:e.user_id}))}),sv=new a.OpenAPIHono().openapi(a.createRoute({tags:["well known"],method:"get",path:"/jwks.json",request:{},responses:{200:{content:{"application/json":{schema:Ed}},description:"List of tenants"}}}),async n=>{const e=await n.env.data.keys.list(),t=await Promise.all(e.map(async i=>{const s=await new Lc(i.cert).publicKey.export(),o=await crypto.subtle.exportKey("jwk",s);return qa.parse({...o,kid:i.kid})}));return n.json({keys:t},{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${Yi}, stale-while-revalidate=${Yi*2}, stale-if-error=86400`}})}).openapi(a.createRoute({tags:["well known"],method:"get",path:"/openid-configuration",request:{},responses:{200:{content:{"application/json":{schema:vo}},description:"List of tenants"}}}),async n=>{const e=n.env.ISSUER,t=vo.parse({issuer:e,authorization_endpoint:`${e}authorize`,token_endpoint:`${e}oauth/token`,device_authorization_endpoint:`${e}oauth/device/code`,userinfo_endpoint:`${e}userinfo`,mfa_challenge_endpoint:`${e}mfa/challenge`,jwks_uri:`${e}.well-known/jwks.json`,registration_endpoint:`${e}oidc/register`,revocation_endpoint:`${e}oauth/revoke`,scopes_supported:["openid","profile","offline_access","name","given_name","family_name","nickname","email","email_verified","picture","created_at","identities","phone","address"],response_types_supported:["code","token","id_token","code token","code id_token","token id_token","code token id_token"],code_challenge_methods_supported:["S256","plain"],response_modes_supported:["query","fragment","form_post"],subject_types_supported:["public"],id_token_signing_alg_values_supported:["RS256"],token_endpoint_auth_methods_supported:["client_secret_basic","client_secret_post"],claims_supported:["aud","auth_time","created_at","email","email_verified","exp","family_name","given_name","iat","identities","iss","name","nickname","phone_number","picture","sub"],request_uri_parameter_supported:!1,request_parameter_supported:!1,token_endpoint_auth_signing_alg_values_supported:["RS256","RS384","PS256"]});return n.json(t,{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${Yi}, stale-while-revalidate=${Yi*2}, stale-if-error=86400`}})});function sr(n,e){if(!n||!e||n.length!==e.length)return!1;let t=0;for(let i=0;i<n.length;i++)t|=n.charCodeAt(i)^e.charCodeAt(i);return t===0}const sh=a.z.object({grant_type:a.z.literal("client_credentials"),scope:a.z.string().optional(),client_secret:a.z.string(),client_id:a.z.string(),audience:a.z.string().optional()});async function ov(n,e){const t=await n.env.data.clients.get(e.client_id);if(!t)throw new O(403,{message:"Invalid client credentials"});if(t.client_secret&&!sr(t.client_secret,e.client_secret))throw new O(403,{message:"Invalid client credentials"});const i={client_id:t.id,scope:e.scope,audience:e.audience},r=await Wc(n,{authParams:i,client:t});return n.json(r)}const av=a.z.object({grant_type:a.z.literal("authorization_code"),client_id:a.z.string(),code:a.z.string(),redirect_uri:a.z.string().optional(),client_secret:a.z.string().optional(),code_verifier:a.z.string().optional()}).refine(n=>"client_secret"in n&&!("code_verifier"in n)||!("client_secret"in n)&&"code_verifier"in n,{message:"Must provide either client_secret (standard flow) or code_verifier/code_verifier_mode (PKCE flow), but not both"});async function cv(n,e){const t=await n.env.data.clients.get(e.client_id);if(!t)throw new O(403,{message:"Client not found"});const i=await n.env.data.codes.get(t.tenant.id,e.code,"authorization_code");if(!i||!i.user_id)throw new O(403,{message:"Invalid client credentials"});if(new Date(i.expires_at)<new Date)throw new O(403,{message:"Code expired"});if(i.used_at)throw new O(403,{message:"Code already used"});const r=await n.env.data.logins.get(t.tenant.id,i.login_id);if(!r)throw new O(403,{message:"Invalid login"});if("client_secret"in e){const o=await n.env.data.clients.get("DEFAULT_CLIENT");if(!sr(t.client_secret,e.client_secret)&&!sr(o==null?void 0:o.client_secret,e.client_secret))throw new O(403,{message:"Invalid client credentials"})}else if("code_verifier"in e&&typeof e.code_verifier=="string"&&"code_challenge_method"in r.authParams&&typeof r.authParams.code_challenge_method=="string"){const o=await Am(e.code_verifier,r.authParams.code_challenge_method);if(!sr(o,r.authParams.code_challenge||""))throw new O(403,{message:"Invalid client credentials"})}if(r.authParams.redirect_uri&&r.authParams.redirect_uri!==e.redirect_uri)throw new O(403,{message:"Invalid redirect uri"});const s=await n.env.data.users.get(t.tenant.id,i.user_id);if(!s)throw new O(403,{message:"User not found"});return await n.env.data.codes.used(t.tenant.id,e.code),Fi(n,{user:s,client:t,loginSession:r,authParams:{...r.authParams,response_mode:nn.WEB_MESSAGE}})}const gd=a.z.object({client_id:a.z.string().optional(),client_secret:a.z.string().optional()}),lv=a.z.union([sh.extend(gd.shape),a.z.object({grant_type:a.z.literal("authorization_code"),client_id:a.z.string(),code:a.z.string(),redirect_uri:a.z.string(),code_verifier:a.z.string().min(43).max(128)}),a.z.object({grant_type:a.z.literal("authorization_code"),code:a.z.string(),redirect_uri:a.z.string().optional(),...gd.shape})]);function uv(n){if(!n)return{};const[e,t]=n.split(" ");if((e==null?void 0:e.toLowerCase())==="basic"&&t){const[i,r]=atob(t).split(":");return{client_id:i,client_secret:r}}return{}}const dv=new a.OpenAPIHono().openapi(a.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:lv}}}},responses:{200:{content:{"application/json":{schema:a.z.object({access_token:a.z.string(),id_token:a.z.string().optional(),refresh_token:a.z.string().optional(),token_type:a.z.string(),expires_in:a.z.number()})}},description:"Tokens"}}}),async n=>{const e=n.req.valid("form"),t=uv(n.req.header("Authorization")),i={...e,...t};if(!i.client_id)throw new O(400,{message:"client_id is required"});switch(e.grant_type){case _r.AuthorizationCode:return cv(n,av.parse(i));case _r.ClientCredential:return ov(n,sh.parse(i));default:throw new O(400,{message:"Not implemented"})}});var Gc={exports:{}};const Jc=[{id:0,value:"Too weak",minDiversity:0,minLength:0},{id:1,value:"Weak",minDiversity:2,minLength:6},{id:2,value:"Medium",minDiversity:4,minLength:8},{id:3,value:"Strong",minDiversity:4,minLength:10}],oh=(n,e=Jc,t="!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~")=>{let i=n||"";e[0].minDiversity=0,e[0].minLength=0;const r=[{regex:"[a-z]",message:"lowercase"},{regex:"[A-Z]",message:"uppercase"},{regex:"[0-9]",message:"number"}];t&&r.push({regex:`[${t}]`,message:"symbol"});let s={};s.contains=r.filter(c=>new RegExp(`${c.regex}`).test(i)).map(c=>c.message),s.length=i.length;let o=e.filter(c=>s.contains.length>=c.minDiversity).filter(c=>s.length>=c.minLength).sort((c,l)=>l.id-c.id).map(c=>({id:c.id,value:c.value}));return Object.assign(s,o[0]),s};Gc.exports={passwordStrength:oh,defaultOptions:Jc};var pv=Gc.exports.passwordStrength=oh;Gc.exports.defaultOptions=Jc;function fv(n){return pv(n).id<2?!1:n.length>=8&&/[a-z]/.test(n)&&/[A-Z]/.test(n)&&/[0-9]/.test(n)&&/[^A-Za-z0-9]/.test(n)}async function Ys(n,e){var r;const t=await n.env.data.emailProviders.get(n.var.tenant_id)||(n.env.DEFAULT_TENANT_ID?await n.env.data.emailProviders.get(n.env.DEFAULT_TENANT_ID):null);if(!t)throw new O(500,{message:"Email provider not found"});const i=(r=n.env.emailProviders)==null?void 0:r[t.name];if(!i)throw new O(500,{message:"Email provider not found"});await i({emailProvider:t,...e,from:t.default_from_address||`login@${n.env.ISSUER}`})}async function hv(n,e,t,i){const r=await n.env.data.tenants.get(n.var.tenant_id);if(!r)throw new O(500,{message:"Tenant not found"});const s=`${n.env.ISSUER}u/reset-password?state=${i}&code=${t}`,o={vendorName:r.name,lng:r.language||"en"};await Ys(n,{to:e,subject:"Reset your password",html:`Click here to reset your password: ${n.env.ISSUER}u/reset-password?state=${i}&code=${t}`,template:"auth-password-reset",data:{vendorName:r.name,logo:r.logo||"",passwordResetUrl:s,supportUrl:r.support_url||"https://support.sesamy.com",buttonColor:r.primary_color||"#7d68f4",passwordResetTitle:ue("password_reset_title",o),resetPasswordEmailClickToReset:ue("reset_password_email_click_to_reset",o),resetPasswordEmailReset:ue("reset_password_email_reset",o),supportInfo:ue("support_info",o),contactUs:ue("contact_us",o),copyright:ue("copyright",o)}})}async function gv(n,e,t){const{env:i}=n,r=await n.env.data.tenants.get(n.var.tenant_id);if(!r)throw new O(500,{message:"Tenant not found"});const s={vendorName:r.name,code:t,lng:r.language||"en"};await Ys(n,{to:e,subject:ue("code_email_subject",s),html:`Click here to validate your email: ${n.env.ISSUER}u/validate-email`,template:"auth-link",data:{code:t,vendorName:r.name,logo:r.logo||"",supportUrl:r.support_url||"",magicLink:`${i.ISSUER}passwordless/verify_redirect?ticket=${t}`,buttonColor:r.primary_color||"",welcomeToYourAccount:ue("welcome_to_your_account",s),linkEmailClickToLogin:ue("link_email_click_to_login",s),linkEmailLogin:ue("link_email_login",s),linkEmailOrEnterCode:ue("link_email_or_enter_code",s),codeValid30Mins:ue("code_valid_30_minutes",s),supportInfo:ue("support_info",s),contactUs:ue("contact_us",s),copyright:ue("copyright",s)}});const o=ke(n,{type:_e.CODE_LINK_SENT,description:e});Nt(n,n.env.data.logs.create(r.id,o))}async function ah(n,e,t){const{env:i}=n,r=await n.env.data.tenants.get(n.var.tenant_id);if(!r)throw new O(500,{message:"Tenant not found"});const s={vendorName:r.name,code:t,lng:r.language||"en"};await Ys(n,{to:e,subject:ue("code_email_subject",s),html:`Click here to validate your email: ${n.env.ISSUER}u/validate-email`,template:"auth-link",data:{code:t,vendorName:r.name,logo:r.logo||"",supportUrl:r.support_url||"",magicLink:`${i.ISSUER}passwordless/verify_redirect?ticket=${t}`,buttonColor:r.primary_color||"",welcomeToYourAccount:ue("welcome_to_your_account",s),linkEmailClickToLogin:ue("link_email_click_to_login",s),linkEmailLogin:ue("link_email_login",s),linkEmailOrEnterCode:ue("link_email_or_enter_code",s),codeValid30Mins:ue("code_valid_30_minutes",s),supportInfo:ue("support_info",s),contactUs:ue("contact_us",s),copyright:ue("copyright",s)}});const o=ke(n,{type:_e.CODE_LINK_SENT,description:e});Nt(n,n.env.data.logs.create(r.id,o))}async function ch(n,e){const t=await n.env.data.tenants.get(n.var.tenant_id);if(!t)throw new O(500,{message:"Tenant not found"});const i={vendorName:t.name,lng:t.language||"en"};await Ys(n,{to:e.email,subject:"Validate your email address",html:`Click here to validate your email: ${n.env.ISSUER}u/validate-email`,template:"auth-verify-email",data:{vendorName:t.name,logo:t.logo||"",emailValidationUrl:`${n.env.ISSUER}u/validate-email`,supportUrl:t.support_url||"https://support.sesamy.com",buttonColor:t.primary_color||"#7d68f4",welcomeToYourAccount:ue("welcome_to_your_account",i),verifyEmailVerify:ue("verify_email_verify",i),supportInfo:ue("support_info",i),contactUs:ue("contact_us",i),copyright:ue("copyright",i)}})}const _v=new a.OpenAPIHono().openapi(a.createRoute({tags:["dbconnections"],method:"post",path:"/signup",request:{body:{content:{"application/json":{schema:a.z.object({client_id:a.z.string(),connection:a.z.literal("Username-Password-Authentication"),email:a.z.string().transform(n=>n.toLowerCase()),password:a.z.string()})}}}},responses:{200:{content:{"application/json":{schema:a.z.object({_id:a.z.string(),email:a.z.string(),email_verified:a.z.boolean(),app_metadata:a.z.object({}),user_metadata:a.z.object({})})}},description:"Created user"}}}),async n=>{const{email:e,password:t,client_id:i}=n.req.valid("json"),r=await n.env.data.clients.get(i);if(!r)throw new O(400,{message:"Client not found"});if(n.set("client_id",r.id),n.set("tenant_id",r.tenant.id),!fv(t))throw new O(400,{message:"Password does not meet the requirements"});if(await rs({userAdapter:n.env.data.users,tenant_id:r.tenant.id,email:e,provider:"auth2"}))throw new O(400,{message:"Invalid sign up"});const o=await n.env.data.users.create(r.tenant.id,{user_id:`auth2|${Ga()}`,email:e,email_verified:!1,provider:"auth2",connection:"Username-Password-Authentication",is_social:!1});n.set("user_id",o.user_id),n.set("username",o.email),n.set("connection",o.connection);const c=await Wa.hash(t,10);await n.env.data.passwords.create(r.tenant.id,{user_id:o.user_id,password:c,algorithm:"bcrypt"}),await ch(n,o);const l=ke(n,{type:_e.SUCCESS_SIGNUP,description:"Successful signup"});return await n.env.data.logs.create(r.tenant.id,l),n.json({_id:o.user_id,email:o.email,email_verified:!1,app_metadata:{},user_metadata:{}})}).openapi(a.createRoute({tags:["dbconnections"],method:"post",path:"/change_password",request:{body:{content:{"application/json":{schema:a.z.object({client_id:a.z.string(),connection:a.z.literal("Username-Password-Authentication"),email:a.z.string().transform(n=>n.toLowerCase())})}}}},responses:{200:{description:"Redirect to the client's redirect uri"}}}),async n=>{const{email:e,client_id:t}=n.req.valid("json"),i=await n.env.data.clients.get(t);if(!i)throw new O(400,{message:"Client not found"});if(n.set("client_id",i.id),n.set("tenant_id",i.tenant.id),!await Ja({userAdapter:n.env.data.users,tenant_id:i.tenant.id,email:e,provider:"auth2"}))return n.html("If an account with that email exists, we've sent instructions to reset your password.");const s={client_id:t,username:e},o=await n.env.data.logins.create(i.tenant.id,{expires_at:new Date(Date.now()+Xr*1e3).toISOString(),authParams:s,...Vn(n.req)});return await hv(n,e,o.login_id,o.authParams.state),n.html("If an account with that email exists, we've sent instructions to reset your password.")});function lh(){const n="1234567890";let e="";for(let t=0;t<6;t+=1)e+=n[Math.floor(Math.random()*10)];return e.toString()}const mv=new a.OpenAPIHono().openapi(a.createRoute({tags:["passwordless"],method:"post",path:"/start",request:{body:{content:{"application/json":{schema:a.z.object({client_id:a.z.string(),connection:a.z.string(),email:a.z.string().transform(n=>n.toLowerCase()),send:a.z.enum(["link","code"]),authParams:Fa.omit({client_id:!0})})}}}},responses:{200:{description:"Status"}}}),async n=>{const e=n.req.valid("json"),{env:t}=n,{client_id:i,email:r,send:s,authParams:o}=e,c=await n.env.data.clients.get(i);if(!c)throw new O(400,{message:"Client not found"});n.set("client_id",c.id),n.set("tenant_id",c.tenant.id);const l=await t.data.logins.create(c.tenant.id,{authParams:{...o,client_id:i,username:r},expires_at:new Date(Date.now()+Zu).toISOString(),...Vn(n.req)}),u=await t.data.codes.create(c.tenant.id,{code_id:lh(),code_type:"otp",login_id:l.login_id,expires_at:new Date(Date.now()+Zu).toISOString()});return s==="link"?await ah(n,r,u.code_id):await gv(n,r,u.code_id),n.html("OK")}).openapi(a.createRoute({tags:["passwordless"],method:"get",path:"/verify_redirect",request:{query:a.z.object({scope:a.z.string(),response_type:a.z.nativeEnum(Pt),redirect_uri:a.z.string(),state:a.z.string(),nonce:a.z.string().optional(),verification_code:a.z.string(),connection:a.z.string(),client_id:a.z.string(),email:a.z.string().transform(n=>n.toLowerCase()),audience:a.z.string().optional()})},responses:{302:{description:"Status"}}}),async n=>{const{env:e}=n,{client_id:t,email:i,verification_code:r,redirect_uri:s,state:o,scope:c,audience:l,response_type:u,nonce:p}=n.req.valid("query"),g=await Hc(e,t);n.set("client_id",g.id),n.set("tenant_id",g.tenant.id),n.set("connection","email");const m=await e.data.codes.get(g.tenant.id,r,"otp");if(!m)throw new O(400,{message:"Code not found or expired"});if(m.expires_at<new Date().toISOString())throw new O(400,{message:"Code expired"});const x=await e.data.logins.get(g.tenant.id,m.login_id);if(!x||x.authParams.username!==i)throw new O(400,{message:"Code not found or expired"});const h=Vn(n.req);if(x.ip!==h.ip)return n.redirect(`${n.env.ISSUER}u/invalid-session?state=${x.login_id}`);if(!Js(s,g.callbacks))throw new O(400,{message:`Invalid redirect URI - ${s}`});const _={client_id:t,redirect_uri:s,state:o,nonce:p,scope:c,audience:l,response_type:u},b=await rs({userAdapter:e.data.users,tenant_id:g.tenant.id,email:i,provider:"email"});if(!b)throw new O(400,{message:"User not found"});return Fi(n,{user:b,client:g,loginSession:x,authParams:_})});class ii extends O{constructor(t,i){super(t,i);te(this,"_code");this._code=i==null?void 0:i.code}get code(){return this._code}}async function yv(n,e,t){const{env:i}=n,r=t.username;if(n.set("username",r),!r)throw new O(400,{message:"Username is required"});const s=await Ja({userAdapter:n.env.data.users,tenant_id:e.tenant.id,email:r,provider:"auth2"});if(!s){const m=ke(n,{type:_e.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid user"});throw Nt(n,n.env.data.logs.create(e.tenant.id,m)),new ii(403,{message:"User not found",code:"USER_NOT_FOUND"})}const o=s.linked_to?await i.data.users.get(e.tenant.id,s.linked_to):s;if(!o)throw new ii(403,{message:"User not found",code:"USER_NOT_FOUND"});n.set("connection",s.connection),n.set("user_id",o.user_id);const{password:c}=await i.data.passwords.get(e.tenant.id,s.user_id);if(!await Wa.compare(t.password,c)){const m=ke(n,{type:_e.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid password"});throw Nt(n,n.env.data.logs.create(e.tenant.id,m)),new ii(403,{message:"Invalid password",code:"INVALID_PASSWORD"})}if((await i.data.logs.list(e.tenant.id,{page:0,per_page:10,include_totals:!1,q:`user_id:${o.user_id}`})).logs.filter(m=>m.type===_e.FAILED_LOGIN_INCORRECT_PASSWORD&&new Date(m.date)>new Date(Date.now()-1e3*60*5)).length>=3){const m=ke(n,{type:_e.FAILED_LOGIN,description:"Too many failed login attempts"});throw Nt(n,n.env.data.logs.create(e.tenant.id,m)),new ii(403,{message:"Too many failed login attempts",code:"TOO_MANY_FAILED_LOGINS"})}if(!s.email_verified&&e.email_validation==="enforced"){await ch(n,s);const m=ke(n,{type:_e.FAILED_LOGIN,description:"Email not verified"});throw await n.env.data.logs.create(e.tenant.id,m),new ii(403,{message:"Email not verified",code:"EMAIL_NOT_VERIFIED"})}const g=ke(n,{type:_e.SUCCESS_LOGIN,description:"Successful login",strategy_type:"Username-Password-Authentication",strategy:"Username-Password-Authentication"});return Nt(n,n.env.data.logs.create(e.tenant.id,g)),o}function vv(){const n=new Uint8Array(32);return crypto.getRandomValues(n),tn.encode(n,{includePadding:!1})}function _d(){return new O(403,{res:new Response(JSON.stringify({error:"access_denied",error_description:"Wrong email or verification code."}),{status:403,headers:{"Content-Type":"application/json"}}),message:"Wrong email or verification code."})}const md=30*60*1e3,wv=new a.OpenAPIHono().openapi(a.createRoute({tags:["oauth"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:a.z.union([a.z.object({credential_type:a.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),otp:a.z.string(),client_id:a.z.string(),username:a.z.string().transform(n=>n.toLowerCase()),realm:a.z.enum(["email"]),scope:a.z.string().optional()}),a.z.object({credential_type:a.z.literal("http://auth0.com/oauth/grant-type/password-realm"),client_id:a.z.string(),username:a.z.string().transform(n=>n.toLowerCase()),password:a.z.string(),realm:a.z.enum(["Username-Password-Authentication"]),scope:a.z.string().optional()})])}}}},responses:{200:{description:"List of tenants"}}}),async n=>{const e=n.req.valid("json"),{client_id:t,username:i}=e;n.set("username",i);const r=await n.env.data.clients.get(t);if(!r)throw new O(400,{message:"Client not found"});n.set("client_id",t),n.set("tenant_id",r.tenant.id);const s=i.toLocaleLowerCase();let o;if("otp"in e){const p=await n.env.data.codes.get(r.tenant.id,e.otp,"otp");if(!p)throw _d();const g=await n.env.data.logins.get(r.tenant.id,p.login_id);if(!g||g.authParams.username!==s)throw _d();o=g}else if("password"in e)await yv(n,r,{username:i,password:e.password,client_id:t}),o=await n.env.data.logins.create(r.tenant.id,{expires_at:new Date(Date.now()+md).toISOString(),authParams:{client_id:r.id,username:s},...Vn(n.req)});else throw new O(400,{message:"Code or password required"});const c=vv(),l=Ke(12),u=await n.env.data.codes.create(r.tenant.id,{code_id:Ke(),code_type:"ticket",login_id:o.login_id,expires_at:new Date(Date.now()+md).toISOString(),code_verifier:[l,c].join("|")});return n.json({login_ticket:u.code_id,co_verifier:c,co_id:l})});function bv(n,e){var i,r,s;if(!n||e.length===0)return!1;const t=((i=_o(n))==null?void 0:i.host)??null;if(!t)return!1;for(const o of e){let c;if(o.startsWith("http://")||o.startsWith("https://")?c=((r=_o(o))==null?void 0:r.host)??null:c=((s=_o("https://"+o))==null?void 0:s.host)??null,t===c)return!0}return!1}function _o(n){try{return new URL(n)}catch{return null}}async function kv({ctx:n,session:e,client:t,authParams:i,connection:r,login_hint:s}){const o=await n.env.data.logins.create(t.tenant.id,{expires_at:new Date(Date.now()+Xr*1e3).toISOString(),authParams:i,...Vn(n.req)});if(e&&s){const c=await n.env.data.users.get(t.tenant.id,e.user_id);if((c==null?void 0:c.email)===s)return Fi(n,{client:t,loginSession:o,authParams:i,user:c,sid:e.session_id})}if(r==="email"&&s){const c=lh();return await n.env.data.codes.create(t.tenant.id,{code_id:c,code_type:"otp",login_id:o.login_id,expires_at:new Date(Date.now()+Xr*1e3).toISOString()}),await ah(n,s,c),n.redirect(`/u/enter-code?state=${o.login_id}`)}return e?n.redirect(`/u/check-account?state=${o.login_id}`):n.redirect(`/u/enter-email?state=${o.login_id}`)}function xv(n){if(n==="Username-Password-Authentication")return"auth2";if(n==="email")return"email";throw new O(403,{message:"Invalid realm"})}async function Sv(n,e,t,i,r){var m;const{env:s}=n;n.set("connection",r);const o=await s.data.codes.get(e,t,"ticket");if(!o||o.used_at)throw new O(403,{message:"Ticket not found"});const c=await s.data.logins.get(e,o.login_id);if(!c||!c.authParams.username)throw new O(403,{message:"Session not found"});const l=await s.data.clients.get(c.authParams.client_id);if(!l)throw new O(403,{message:"Client not found"});n.set("client_id",c.authParams.client_id),await s.data.codes.used(e,t);const u=xv(r);let p=await rs({userAdapter:s.data.users,tenant_id:e,email:c.authParams.username,provider:u});p||(p=await s.data.users.create(e,{user_id:`email|${Ga()}`,email:c.authParams.username,name:c.authParams.username,provider:"email",connection:"email",email_verified:!0,is_social:!1,last_ip:"",last_login:new Date().toISOString()})),n.set("username",p.email),n.set("user_id",p.user_id);const g=await ih(n,p,l);return Fi(n,{authParams:{scope:(m=c.authParams)==null?void 0:m.scope,...i},loginSession:c,sid:g.session_id,user:p,client:l})}async function yd(n,e){return`<!DOCTYPE html>
126
150
  <html>
127
151
 
128
152
  <head>
@@ -165,32 +189,32 @@ PERFORMANCE OF THIS SOFTWARE.
165
189
  <\/script>
166
190
  </body>
167
191
 
168
- </html>`}async function Nm({ctx:n,client:e,session:t,redirect_uri:i,state:r,nonce:s,code_challenge_method:a,code_challenge:c,audience:l,scope:d}){const{env:h}=n,g=new URL(i);if(t){n.set("user_id",t.user_id);const I=new Headers,f=Of(e.tenant.id,t.session_id);I.set("set-cookie",f);const _=await h.data.users.get(e.tenant.id,t.user_id);if(_){n.set("username",_.email),n.set("connection",_.connection);const k=await Nc(n,{client:e,authParams:{client_id:e.id,audience:l,code_challenge_method:a,code_challenge:c,scope:d,state:r,nonce:s,response_type:Rt.TOKEN_ID_TOKEN},user:_,sid:t.session_id});await h.data.sessions.update(e.tenant.id,t.session_id,{used_at:new Date().toISOString()});const x=be(n,{type:_e.SUCCESS_SILENT_AUTH,description:"Successful silent authentication"});return await n.env.data.logs.create(e.tenant.id,x),n.html(ed(`${g.protocol}//${g.host}`,JSON.stringify(k)),{headers:I})}}const y=be(n,{type:_e.FAILED_SILENT_AUTH,description:"Login required"});return await n.env.data.logs.create(e.tenant.id,y),n.html(ed(`${g.protocol}//${g.host}`,JSON.stringify({error:"login_required",error_description:"Login required",state:r})))}const Rm=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth"],method:"get",path:"/",request:{query:o.z.object({client_id:o.z.string(),vendor_id:o.z.string().optional(),redirect_uri:o.z.string(),scope:o.z.string().optional(),state:o.z.string(),prompt:o.z.string().optional(),response_mode:o.z.nativeEnum(Tn).optional(),response_type:o.z.nativeEnum(Rt).optional(),audience:o.z.string().optional(),connection:o.z.string().optional(),nonce:o.z.string().optional(),max_age:o.z.string().optional(),login_ticket:o.z.string().optional(),code_challenge_method:o.z.nativeEnum(Yr).optional(),code_challenge:o.z.string().optional(),realm:o.z.string().optional(),auth0Client:o.z.string().optional(),login_hint:o.z.string().optional(),ui_locales:o.z.string().optional()})},responses:{200:{description:"Silent authentication page"},302:{description:"Redirect to the client's redirect uri"}}}),async n=>{const{env:e}=n,{client_id:t,vendor_id:i,redirect_uri:r,scope:s,state:a,audience:c,nonce:l,connection:d,response_type:h,response_mode:g,code_challenge:y,code_challenge_method:I,prompt:f,login_ticket:_,realm:k,auth0Client:x,login_hint:O,ui_locales:R}=n.req.valid("query");n.set("log","authorize");const F=await Ef(e,t);n.set("client_id",F.id);const oe={redirect_uri:r,scope:s,state:a,client_id:t,vendor_id:i,audience:c,nonce:l,prompt:f,response_type:h,response_mode:g,code_challenge:y,code_challenge_method:I,username:O,ui_locales:R},pe=n.req.header("origin");if(pe&&!$m(pe,F.web_origins||[]))throw new B(403,{message:`Origin ${pe} not allowed`});if(oe.redirect_uri&&!Hs(oe.redirect_uri,F.callbacks||[]))throw new B(400,{message:`Invalid redirect URI - ${oe.redirect_uri}`});const ce=Cf(F.tenant.id,n.req.header("cookie")),Ne=ce?await e.data.sessions.get(F.tenant.id,ce):void 0;if(f=="none"){if(!h)throw new B(400,{message:"Missing response_type"});return Nm({ctx:n,session:Ne||void 0,redirect_uri:r,state:a,response_type:h,client:F,nonce:l,code_challenge_method:I,code_challenge:y,audience:c,scope:s})}return d&&d!=="email"?um(n,F,d,oe):_?Bm(n,F.tenant.id,_,oe,k):(console.log("5"),Cm({ctx:n,client:F,auth0Client:x,authParams:oe,session:Ne||void 0,connection:d,login_hint:O}))});function Tm(){const n=new o.OpenAPIHono;n.use(yf(n));const e=n.route("/v2/logout",pm).route("/userinfo",fm).route("/.well-known",hm).route("/oauth/token",wm).route("/dbconnections",Am).route("/passwordless",Im).route("/co/authenticate",Em).route("/authorize",Rm).route("/callback",dm);return e.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Oauth API"}}),mf(e),e}function Pm(){const e=new o.OpenAPIHono;return e.doc("/u/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Universal login"}}),e}const Um="Account detected",Lm="We have detected that you have already created an account through",Dm="By signing in, you agree to our",Vm="and",Mm="Callback URL mismatch",Hm="The provided redirect_uri is not in the list of allowed callback URLs.",qm="continue with user",Km="Please click the button to create a new password account.",Fm="Enter the code at {{vendorName}} to complete the login",Wm="Welcome to {{vendorName}}! {{code}} is the login code",Gm="Welcome to {{vendorName}}! {{code}} is the login code",Jm="The code is valid for 30 minutes",Zm="Confirm password",Ym="Need Help?",Xm="Contact us",Qm="or continue with social account",ey="Continue with {{provider}}",ty="Would you like to continue with your existing account?",ny="Copyright © 2023 SESAMY. All rights reserved.",iy="©2023 Sesamy",ry="Choose a password with a mix of uppercase and lowercase letters, numbers, and symbols.",sy="Please enter a valid email address.",oy="The passwords didn't match. Try again.",ay="Choose password",cy="Password must be at least 8 characters long and contain at least one lowercase letter, one uppercase letter, one number and one symbol.",ly="Create new account",uy="Sign up with password",dy="You are currently logged in as <0>{{email}}</0>",py="Email",fy="Email address",hy="Your email address has been validated",gy="Now enter your password to login again",_y="An email has been sent to <0>{{email}}</0> with a verification link. Please click the link to verify your email address and set a password.",my="Email verification sent",yy="Enter a code",vy="We'll send you a verification link to ensure you own this email address.",wy="Enter new password",by="Enter password",ky="Enter your email address and password to login.",xy="Enter your password",Sy="The magic link has expired. Please click on the button below to receive a new link in your inbox.",Ay="Hey! We updated our login experience. <0>Click here to learn more about it.</0>",Iy="Send password reset email",jy="Click the button below and we’ll send instructions on how to reset your password.",zy="Password reset email sent",Ey="Forgot password?",$y="Forgot password?",Cy="Go back",Oy="Invalid password",By=`The link is no longer valid.
192
+ </html>`}async function Av({ctx:n,client:e,session:t,redirect_uri:i,state:r,nonce:s,code_challenge_method:o,code_challenge:c,audience:l,scope:u}){const{env:p}=n,g=new URL(i);if(t){n.set("user_id",t.user_id);const x=new Headers,h=Jf(e.tenant.id,t.session_id);x.set("set-cookie",h);const _=await p.data.users.get(e.tenant.id,t.user_id);if(_){n.set("username",_.email),n.set("connection",_.connection);const b=await Wc(n,{client:e,authParams:{client_id:e.id,audience:l,code_challenge_method:o,code_challenge:c,scope:u,state:r,nonce:s,response_type:Pt.TOKEN_ID_TOKEN},user:_,sid:t.session_id});await p.data.sessions.update(e.tenant.id,t.session_id,{used_at:new Date().toISOString()});const S=ke(n,{type:_e.SUCCESS_SILENT_AUTH,description:"Successful silent authentication"});return await n.env.data.logs.create(e.tenant.id,S),n.html(yd(`${g.protocol}//${g.host}`,JSON.stringify(b)),{headers:x})}}const m=ke(n,{type:_e.FAILED_SILENT_AUTH,description:"Login required"});return await n.env.data.logs.create(e.tenant.id,m),n.html(yd(`${g.protocol}//${g.host}`,JSON.stringify({error:"login_required",error_description:"Login required",state:r})))}const Iv=new a.OpenAPIHono().openapi(a.createRoute({tags:["oauth"],method:"get",path:"/",request:{query:a.z.object({client_id:a.z.string(),vendor_id:a.z.string().optional(),redirect_uri:a.z.string(),scope:a.z.string().optional(),state:a.z.string(),prompt:a.z.string().optional(),response_mode:a.z.nativeEnum(nn).optional(),response_type:a.z.nativeEnum(Pt).optional(),audience:a.z.string().optional(),connection:a.z.string().optional(),nonce:a.z.string().optional(),max_age:a.z.string().optional(),login_ticket:a.z.string().optional(),code_challenge_method:a.z.nativeEnum(is).optional(),code_challenge:a.z.string().optional(),realm:a.z.string().optional(),auth0Client:a.z.string().optional(),login_hint:a.z.string().optional(),ui_locales:a.z.string().optional()})},responses:{200:{description:"Silent authentication page"},302:{description:"Redirect to the client's redirect uri"}}}),async n=>{const{env:e}=n,{client_id:t,vendor_id:i,redirect_uri:r,scope:s,state:o,audience:c,nonce:l,connection:u,response_type:p,response_mode:g,code_challenge:m,code_challenge_method:x,prompt:h,login_ticket:_,realm:b,auth0Client:S,login_hint:N,ui_locales:T}=n.req.valid("query");n.set("log","authorize");const K=await Hc(e,t);n.set("client_id",K.id);const oe={redirect_uri:r,scope:s,state:o,client_id:t,vendor_id:i,audience:c,nonce:l,prompt:h,response_type:p,response_mode:g,code_challenge:m,code_challenge_method:x,username:N,ui_locales:T},pe=n.req.header("origin");if(pe&&!bv(pe,K.web_origins||[]))throw new O(403,{message:`Origin ${pe} not allowed`});if(oe.redirect_uri&&!Js(oe.redirect_uri,K.callbacks||[]))throw new O(400,{message:`Invalid redirect URI - ${oe.redirect_uri}`});const ce=Gf(K.tenant.id,n.req.header("cookie")),Re=ce?await e.data.sessions.get(K.tenant.id,ce):void 0;if(h=="none"){if(!p)throw new O(400,{message:"Missing response_type"});return Av({ctx:n,session:Re||void 0,redirect_uri:r,state:o,response_type:p,client:K,nonce:l,code_challenge_method:x,code_challenge:m,audience:c,scope:s})}return u&&u!=="email"?tv(n,K,u,oe):_?Sv(n,K.tenant.id,_,oe,b):(console.log("5"),kv({ctx:n,client:K,auth0Client:S,authParams:oe,session:Re||void 0,connection:u,login_hint:N}))});function Ev(){const n=new a.OpenAPIHono;n.use(Rf(n));const e=n.route("/v2/logout",iv).route("/userinfo",rv).route("/.well-known",sv).route("/oauth/token",dv).route("/dbconnections",_v).route("/passwordless",mv).route("/co/authenticate",wv).route("/authorize",Iv).route("/callback",nv);return e.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Oauth API"}}),Tf(e),e}function $v(){const e=new a.OpenAPIHono;return e.doc("/u/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Universal login"}}),e}const Cv="Account detected",jv="We have detected that you have already created an account through",zv="By signing in, you agree to our",Nv="and",Ov="Callback URL mismatch",Bv="The provided redirect_uri is not in the list of allowed callback URLs.",Tv="continue with user",Rv="Please click the button to create a new password account.",Pv="Enter the code at {{vendorName}} to complete the login",Lv="Welcome to {{vendorName}}! {{code}} is the login code",Uv="Welcome to {{vendorName}}! {{code}} is the login code",Vv="The code is valid for 30 minutes",Mv="Confirm password",Hv="Need Help?",Dv="Contact us",Fv="or continue with social account",qv="Continue with {{provider}}",Kv="Would you like to continue with your existing account?",Wv="Copyright © 2023 SESAMY. All rights reserved.",Gv="©2023 Sesamy",Jv="Choose a password with a mix of uppercase and lowercase letters, numbers, and symbols.",Zv="Please enter a valid email address.",Yv="The passwords didn't match. Try again.",Xv="Choose password",Qv="Password must be at least 8 characters long and contain at least one lowercase letter, one uppercase letter, one number and one symbol.",ew="Create new account",tw="Sign up with password",nw="You are currently logged in as <0>{{email}}</0>",iw="Email",rw="Email address",sw="Your email address has been validated",ow="Now enter your password to login again",aw="An email has been sent to <0>{{email}}</0> with a verification link. Please click the link to verify your email address and set a password.",cw="Email verification sent",lw="Enter a code",uw="We'll send you a verification link to ensure you own this email address.",dw="Enter new password",pw="Enter password",fw="Enter your email address and password to login.",hw="Enter your password",gw="The magic link has expired. Please click on the button below to receive a new link in your inbox.",_w="Hey! We updated our login experience. <0>Click here to learn more about it.</0>",mw="Send password reset email",yw="Click the button below and we’ll send instructions on how to reset your password.",vw="Password reset email sent",ww="Forgot password?",bw="Forgot password?",kw="Go back",xw="Invalid password",Sw=`The link is no longer valid.
169
193
 
170
194
  Please make sure to open the login link in the same browser you started the login with.
171
195
 
172
- You can click the link below to start a new login.`,Ny="Invalid link",Ry="Click the button to log in",Ty="Login",Py="Or enter the code at {{vendorName}} to complete the login.",Uy="Enter your email address to unlock this show on {{service}}",Ly="Link your account with {{service}}",Dy="You are logged in as",Vy="Login",My="Enter your email address to sign in.",Hy="Enter your email address and we will send you a login code.",qy="Enter your email address and we will send you a login link.",Ky="Log out",Fy="No, I want to use another account",Wy="or",Gy="Password",Jy="The password has been reset",Zy="Success",Yy="Change password for your {{vendorName}} account",Xy="Change password for your {{vendorName}} account",Qy="Privacy Policy",ev="Redirecting",tv="Confirm password",nv="Register a new password",iv="Resend code",rv="Change password",sv="Enter your new password below for the email account: ",ov="Click the button to reset your password",av="Click the button to reset your password",cv="Reset your password",lv="Change password for your {{vendorName}} account",uv="Reset password",dv="Send",pv="Send me a new magic link",fv="Remember to check your spam folder if the email did not arrive.",hv="Set password",gv="Sign in",_v="Signup",mv="Sign up successful",yv="It appears that your Spotify account is currently linked to another Sesamy account. But fear not, we're here to guide you through the process to get this fixed.",vv="Go to Spotify's Content Access page",wv=`Let's start by unlinking your Spotify account. Click the button below to go to Spotify's Content Access page. After you've logged in to your Spotify account, find Sesamy on the list of connected platforms. Click "Unlink" next to the Sesamy logo.`,bv="Step 1: Unlink Your Spotify Account",kv="Once you've successfully unlinked your Spotify account, you can relink it to Sesamy. Simply repeat the steps you previously took that led you to this page.",xv="Step 2: Relink Your Spotify Account to Sesamy",Sv="Oops! Your Spotify Account Is Already Linked",Av="If you have questions or need assistance, you can contact our support team",Iv="Terms and Conditions",jv="Your email address needs validating. We have sent a new email to your inbox",zv="User account does not exist",Ev="User account does not exist",$v="We could not find a user with the provided email address. Please, try again.",Cv="Try again.",Ov="Validate code",Bv="Check your inbox for email validation instructions.",Nv="Signed up",Rv="Click the button to verify your email address",Tv="Validate your email address",Pv="Validate your email address",Uv="Verify account",Lv="Verify your email",Dv="Please check your email at <0>{{email}}</0> and enter the six-digit code that we've sent you.",Vv="Welcome",Mv="Welcome to your {{vendorName}} account!",Hv="Continue with this account",qv="Yes, continue with {{text}}",Kv="Yes, continue with existing account",Fv={"Server error: Invalid code":"Invalid code","Wrong email or verification code":{"":"Wrong email or verification code."},account_detected:Um,account_with_sso_provider:Lm,agree_to:Dm,and:Vm,callback_url_mismatch:Mm,callback_url_not_allowed:Hm,check_email_title:qm,click_to_sign_up_description:Km,code_email_enter_code:Fm,code_email_subject:Wm,code_email_title:Gm,code_valid_30_minutes:Jm,confirm_password:Zm,contact_support:Ym,contact_us:Xm,continue:"Continue",continue_social_login:Qm,continue_with:ey,continue_with_sso_provider_headline:ty,copyright:ny,copyright_sesamy:iy,create_account_description:ry,create_account_email_invalid:sy,create_account_passwords_didnt_match:oy,create_account_title:ay,create_account_weak_password:cy,create_new_account_link:ly,create_password_account_title:uy,currently_logged_in_as:dy,email:py,email_placeholder:fy,email_validated:hy,email_validated_cta:gy,email_verification_for_signup_sent_description:_y,email_verification_for_signup_sent_title:my,enter_a_code_btn:yy,enter_email_for_verification_description:vy,enter_new_password_placeholder:wy,enter_password:by,enter_password_description:ky,enter_your_password_btn:xy,expired_code:Sy,fokus_info_message:Ay,forgot_password_cta:Iy,forgot_password_description:jy,forgot_password_email_sent:zy,forgot_password_link:Ey,forgot_password_title:$y,go_back:Cy,"invalid-email":"Invalid email",invalid_password:Oy,invalid_session_body:By,invalid_session_title:Ny,link_email_click_to_login:Ry,link_email_login:Ty,link_email_or_enter_code:Py,link_page_body:Uy,link_page_headline:Ly,logged_in_as:Dy,login:Vy,login_description:My,login_description_code:Hy,login_description_link:qy,logout:Ky,no_use_another:Fy,or:Wy,password:Gy,password_has_been_reset:Jy,password_has_been_reset_title:Zy,password_reset_subject:Yy,password_reset_title:Xy,privacy_policy:Qy,redirecting:ev,reenter_new_password_placeholder:tv,register_password_account:nv,resend_code:iv,reset_password_cta:rv,reset_password_description:sv,reset_password_email_click_to_reset:ov,reset_password_email_cta:av,reset_password_email_reset:cv,reset_password_subject:lv,reset_password_title:uv,send:dv,send_me_a_new_magic_link:pv,sent_code_spam:fv,set_password:hv,sign_in:gv,signup:_v,signup_success:mv,spotify_already_linked_body:yv,spotify_already_linked_cta:vv,spotify_already_linked_step1_body:wv,spotify_already_linked_step1_title:bv,spotify_already_linked_step2_body:kv,spotify_already_linked_step2_title:xv,spotify_already_linked_title:Sv,support_info:Av,terms:Iv,unverified_email:jv,user_account_does_not_exist:zv,user_not_found:Ev,user_not_found_body:$v,user_not_found_cta:Cv,validate_code:Ov,validate_email_body:Bv,validate_email_title:Nv,verify_email_click_to_verify:Rv,verify_email_subject:Tv,verify_email_title:Pv,verify_email_verify:Uv,verify_your_email:Lv,we_sent_a_code_to:Dv,welcome:Vv,welcome_to_your_account:Mv,yes_continue:Hv,yes_continue_with:qv,yes_continue_with_existing_account:Kv},Wv="Account rilevato",Gv="Abbiamo rilevato che l'utente ha già creato un account tramite",Jv="Effettuando l'accesso, l'utente accetta la nostra",Zv="e",Yv="Mancata corrispondenza dell'URL di callback",Xv="Il redirect_uri fornito non è nell'elenco degli URL di callback consentiti.",Qv="continuare con l'utente",ew="Fare clic sul pulsante per creare un nuovo account con password.",tw="Inserite il codice all'indirizzo {{vendorName}} per completare il login.",nw="Benvenuti su {{vendorName}}! {{code}} è il codice di accesso",iw="Benvenuti su {{vendorName}}! {{code}} è il codice di accesso",rw="Il codice è valido per 30 minuti",sw="Confermare la password",ow="Avete bisogno di aiuto?",aw="Contattateci",cw="o continuare con il conto sociale",lw="Continua con {{provider}}",uw="Desidera continuare a utilizzare l'account esistente?",dw="Copyright © 2023 SESAMY. Tutti i diritti riservati.",pw="©2023 Sesamy",fw="Scegliete una password con un mix di lettere maiuscole e minuscole, numeri e simboli.",hw="Inserire un indirizzo e-mail valido.",gw="Le password non corrispondono. Riprovare.",_w="Scegliere la password",mw="La password deve essere lunga almeno 8 caratteri e contenere almeno una lettera minuscola, una lettera maiuscola, un numero e un simbolo.",yw="Creare un nuovo account",vw="Iscriviti con la password",ww="Attualmente si è connessi come <0>{{email}}</0>",bw="Email",kw="Indirizzo e-mail",xw="Il tuo indirizzo e-mail è stato convalidato",Sw="Ora inserire la password per accedere nuovamente",Aw="È stata inviata un'e-mail a <0>{{email}}</0> con un link di verifica. Fare clic sul link per verificare l'indirizzo e-mail e impostare una password.",Iw="Email di verifica inviata",jw="Inserire un codice",zw="Vi invieremo un link di verifica per assicurarvi di possedere questo indirizzo e-mail.",Ew="Inserire la nuova password",$w="Inserire la password",Cw="Inserire l'indirizzo e-mail e la password per accedere.",Ow="Inserire la password",Bw="Il link magico è scaduto. Cliccate sul pulsante sottostante per ricevere un nuovo link nella vostra casella di posta elettronica.",Nw="Abbiamo aggiornato la nostra esperienza di accesso. <0>Clicca qui per saperne di più.</0>",Rw="Inviare l'e-mail di reimpostazione della password",Tw="Fare clic sul pulsante sottostante per ricevere le istruzioni su come reimpostare la password.",Pw="Email di reimpostazione della password inviata",Uw="Hai dimenticato la password?",Lw="Hai dimenticato la password?",Dw="Torna indietro",Vw="Password non valida",Mw=`Il link non è più valido.
196
+ You can click the link below to start a new login.`,Aw="Invalid link",Iw="Click the button to log in",Ew="Login",$w="Or enter the code at {{vendorName}} to complete the login.",Cw="Enter your email address to unlock this show on {{service}}",jw="Link your account with {{service}}",zw="You are logged in as",Nw="Login",Ow="Enter your email address to sign in.",Bw="Enter your email address and we will send you a login code.",Tw="Enter your email address and we will send you a login link.",Rw="Log out",Pw="No, I want to use another account",Lw="or",Uw="Password",Vw="The password has been reset",Mw="Success",Hw="Change password for your {{vendorName}} account",Dw="Change password for your {{vendorName}} account",Fw="Privacy Policy",qw="Redirecting",Kw="Confirm password",Ww="Register a new password",Gw="Resend code",Jw="Change password",Zw="Enter your new password below for the email account: ",Yw="Click the button to reset your password",Xw="Click the button to reset your password",Qw="Reset your password",eb="Change password for your {{vendorName}} account",tb="Reset password",nb="Send",ib="Send me a new magic link",rb="Remember to check your spam folder if the email did not arrive.",sb="Set password",ob="Sign in",ab="Signup",cb="Sign up successful",lb="It appears that your Spotify account is currently linked to another Sesamy account. But fear not, we're here to guide you through the process to get this fixed.",ub="Go to Spotify's Content Access page",db=`Let's start by unlinking your Spotify account. Click the button below to go to Spotify's Content Access page. After you've logged in to your Spotify account, find Sesamy on the list of connected platforms. Click "Unlink" next to the Sesamy logo.`,pb="Step 1: Unlink Your Spotify Account",fb="Once you've successfully unlinked your Spotify account, you can relink it to Sesamy. Simply repeat the steps you previously took that led you to this page.",hb="Step 2: Relink Your Spotify Account to Sesamy",gb="Oops! Your Spotify Account Is Already Linked",_b="If you have questions or need assistance, you can contact our support team",mb="Terms and Conditions",yb="Your email address needs validating. We have sent a new email to your inbox",vb="User account does not exist",wb="User account does not exist",bb="We could not find a user with the provided email address. Please, try again.",kb="Try again.",xb="Validate code",Sb="Check your inbox for email validation instructions.",Ab="Signed up",Ib="Click the button to verify your email address",Eb="Validate your email address",$b="Validate your email address",Cb="Verify account",jb="Verify your email",zb="Please check your email at <0>{{email}}</0> and enter the six-digit code that we've sent you.",Nb="Welcome",Ob="Welcome to your {{vendorName}} account!",Bb="Continue with this account",Tb="Yes, continue with {{text}}",Rb="Yes, continue with existing account",Pb={"Server error: Invalid code":"Invalid code","Wrong email or verification code":{"":"Wrong email or verification code."},account_detected:Cv,account_with_sso_provider:jv,agree_to:zv,and:Nv,callback_url_mismatch:Ov,callback_url_not_allowed:Bv,check_email_title:Tv,click_to_sign_up_description:Rv,code_email_enter_code:Pv,code_email_subject:Lv,code_email_title:Uv,code_valid_30_minutes:Vv,confirm_password:Mv,contact_support:Hv,contact_us:Dv,continue:"Continue",continue_social_login:Fv,continue_with:qv,continue_with_sso_provider_headline:Kv,copyright:Wv,copyright_sesamy:Gv,create_account_description:Jv,create_account_email_invalid:Zv,create_account_passwords_didnt_match:Yv,create_account_title:Xv,create_account_weak_password:Qv,create_new_account_link:ew,create_password_account_title:tw,currently_logged_in_as:nw,email:iw,email_placeholder:rw,email_validated:sw,email_validated_cta:ow,email_verification_for_signup_sent_description:aw,email_verification_for_signup_sent_title:cw,enter_a_code_btn:lw,enter_email_for_verification_description:uw,enter_new_password_placeholder:dw,enter_password:pw,enter_password_description:fw,enter_your_password_btn:hw,expired_code:gw,fokus_info_message:_w,forgot_password_cta:mw,forgot_password_description:yw,forgot_password_email_sent:vw,forgot_password_link:ww,forgot_password_title:bw,go_back:kw,"invalid-email":"Invalid email",invalid_password:xw,invalid_session_body:Sw,invalid_session_title:Aw,link_email_click_to_login:Iw,link_email_login:Ew,link_email_or_enter_code:$w,link_page_body:Cw,link_page_headline:jw,logged_in_as:zw,login:Nw,login_description:Ow,login_description_code:Bw,login_description_link:Tw,logout:Rw,no_use_another:Pw,or:Lw,password:Uw,password_has_been_reset:Vw,password_has_been_reset_title:Mw,password_reset_subject:Hw,password_reset_title:Dw,privacy_policy:Fw,redirecting:qw,reenter_new_password_placeholder:Kw,register_password_account:Ww,resend_code:Gw,reset_password_cta:Jw,reset_password_description:Zw,reset_password_email_click_to_reset:Yw,reset_password_email_cta:Xw,reset_password_email_reset:Qw,reset_password_subject:eb,reset_password_title:tb,send:nb,send_me_a_new_magic_link:ib,sent_code_spam:rb,set_password:sb,sign_in:ob,signup:ab,signup_success:cb,spotify_already_linked_body:lb,spotify_already_linked_cta:ub,spotify_already_linked_step1_body:db,spotify_already_linked_step1_title:pb,spotify_already_linked_step2_body:fb,spotify_already_linked_step2_title:hb,spotify_already_linked_title:gb,support_info:_b,terms:mb,unverified_email:yb,user_account_does_not_exist:vb,user_not_found:wb,user_not_found_body:bb,user_not_found_cta:kb,validate_code:xb,validate_email_body:Sb,validate_email_title:Ab,verify_email_click_to_verify:Ib,verify_email_subject:Eb,verify_email_title:$b,verify_email_verify:Cb,verify_your_email:jb,we_sent_a_code_to:zb,welcome:Nb,welcome_to_your_account:Ob,yes_continue:Bb,yes_continue_with:Tb,yes_continue_with_existing_account:Rb},Lb="Account rilevato",Ub="Abbiamo rilevato che l'utente ha già creato un account tramite",Vb="Effettuando l'accesso, l'utente accetta la nostra",Mb="e",Hb="Mancata corrispondenza dell'URL di callback",Db="Il redirect_uri fornito non è nell'elenco degli URL di callback consentiti.",Fb="continuare con l'utente",qb="Fare clic sul pulsante per creare un nuovo account con password.",Kb="Inserite il codice all'indirizzo {{vendorName}} per completare il login.",Wb="Benvenuti su {{vendorName}}! {{code}} è il codice di accesso",Gb="Benvenuti su {{vendorName}}! {{code}} è il codice di accesso",Jb="Il codice è valido per 30 minuti",Zb="Confermare la password",Yb="Avete bisogno di aiuto?",Xb="Contattateci",Qb="o continuare con il conto sociale",e1="Continua con {{provider}}",t1="Desidera continuare a utilizzare l'account esistente?",n1="Copyright © 2023 SESAMY. Tutti i diritti riservati.",i1="©2023 Sesamy",r1="Scegliete una password con un mix di lettere maiuscole e minuscole, numeri e simboli.",s1="Inserire un indirizzo e-mail valido.",o1="Le password non corrispondono. Riprovare.",a1="Scegliere la password",c1="La password deve essere lunga almeno 8 caratteri e contenere almeno una lettera minuscola, una lettera maiuscola, un numero e un simbolo.",l1="Creare un nuovo account",u1="Iscriviti con la password",d1="Attualmente si è connessi come <0>{{email}}</0>",p1="Email",f1="Indirizzo e-mail",h1="Il tuo indirizzo e-mail è stato convalidato",g1="Ora inserire la password per accedere nuovamente",_1="È stata inviata un'e-mail a <0>{{email}}</0> con un link di verifica. Fare clic sul link per verificare l'indirizzo e-mail e impostare una password.",m1="Email di verifica inviata",y1="Inserire un codice",v1="Vi invieremo un link di verifica per assicurarvi di possedere questo indirizzo e-mail.",w1="Inserire la nuova password",b1="Inserire la password",k1="Inserire l'indirizzo e-mail e la password per accedere.",x1="Inserire la password",S1="Il link magico è scaduto. Cliccate sul pulsante sottostante per ricevere un nuovo link nella vostra casella di posta elettronica.",A1="Abbiamo aggiornato la nostra esperienza di accesso. <0>Clicca qui per saperne di più.</0>",I1="Inviare l'e-mail di reimpostazione della password",E1="Fare clic sul pulsante sottostante per ricevere le istruzioni su come reimpostare la password.",$1="Email di reimpostazione della password inviata",C1="Hai dimenticato la password?",j1="Hai dimenticato la password?",z1="Torna indietro",N1="Password non valida",O1=`Il link non è più valido.
173
197
 
174
198
  Assicuratevi di aprire il link di accesso con lo stesso browser con cui avete iniziato l'accesso.
175
199
 
176
- Potete fare clic sul link sottostante per iniziare un nuovo accesso.`,Hw="Collegamento non valido",qw="Fare clic sul pulsante per accedere",Kw="Accedi",Fw="Oppure inserire il codice all'indirizzo {{vendorName}} per completare il login.",Ww="Inserisci il tuo indirizzo e-mail per sbloccare questo spettacolo su {{service}}",Gw="Collegate il vostro account con {{service}}",Jw="L'utente ha effettuato l'accesso come",Zw="Accesso",Yw="Inserire l'indirizzo e-mail per accedere.",Xw="Inserite il vostro indirizzo e-mail e vi invieremo un codice di accesso.",Qw="Inserite il vostro indirizzo e-mail e vi invieremo un link di accesso.",eb="Disconnettersi",tb="No, voglio usare un altro account",nb="o",ib="Password",rb="La password è stata reimpostata",sb="Il successo",ob="Modifica della password dell'account {{vendorName}}",ab="Modifica della password dell'account {{vendorName}} ",cb="Informativa sulla privacy",lb="Reindirizzamento",ub="Confermare la password",db="Registrazione di una nuova password",pb="Reinvio del codice",fb="Modifica della password",hb="Immettere di seguito la nuova password per l'account e-mail: ",gb="Fare clic sul pulsante per reimpostare la password",_b="Fare clic sul pulsante per reimpostare la password",mb="Reimpostare la password",yb="Modifica della password dell'account {{vendorName}} ",vb="Reimpostare la password",wb="Inviare",bb="Inviami un nuovo link magico",kb="Ricordate di controllare la cartella spam se l'e-mail non è arrivata.",xb="Impostare la password",Sb="Accedi",Ab="Iscriviti",Ib="Iscriviti con successo",jb="Sembra che il vostro account Spotify sia attualmente collegato a un altro account Sesamy. Ma non temete, siamo qui per guidarvi attraverso la procedura per risolvere il problema.",zb="Vai alla pagina di accesso ai contenuti di Spotify",Eb=`Cominciamo con lo scollegare il vostro account Spotify. Fare clic sul pulsante sottostante per accedere alla pagina di accesso ai contenuti di Spotify. Dopo aver effettuato l'accesso al vostro account Spotify, trovate Sesamy nell'elenco delle piattaforme collegate. Fate clic su "Unlink" accanto al logo di Sesamy.`,$b="Passo 1: Disconnettere l'account Spotify",Cb="Dopo aver scollegato con successo il proprio account Spotify, è possibile ricollegarlo a Sesamy. È sufficiente ripetere i passaggi precedenti che vi hanno portato a questa pagina.",Ob="Passo 2: ricollegare l'account Spotify a Sesamy",Bb="Ops! Il tuo account Spotify è già collegato",Nb="Se avete domande o bisogno di assistenza, potete contattare il nostro team di supporto",Rb="Termini e condizioni",Tb="Il tuo indirizzo e-mail deve essere convalidato. Abbiamo inviato una nuova e-mail alla tua casella di posta.",Pb="L'account utente non esiste",Ub="L'account utente non esiste",Lb="Non è stato possibile trovare un utente con l'indirizzo e-mail fornito. Si prega di riprovare.",Db="Riprova.",Vb="Convalida del codice",Mb="Controllate la vostra casella di posta per le istruzioni di convalida dell'e-mail.",Hb="Iscritta",qb="Fare clic sul pulsante per verificare l'indirizzo e-mail",Kb="Convalidare l'indirizzo e-mail",Fb="Convalidare l'indirizzo e-mail",Wb="Verifica dell'account",Gb="Verificare l'e-mail",Jb="Controllate la vostra e-mail all'indirizzo <0>{{email}}</0> e inserisca il codice a sei cifre che le abbiamo inviato.",Zb="Benvenuti",Yb="Benvenuto nel tuo account {{vendorName}}!",Xb="Continuare con questo account",Qb="Sì, continuare con {{text}}",ek="Sì, continuare con l'account esistente",tk={"Server error: Invalid code":"Codice non valido","Wrong email or verification code":{"":"Email o codice di verifica errati."},account_detected:Wv,account_with_sso_provider:Gv,agree_to:Jv,and:Zv,callback_url_mismatch:Yv,callback_url_not_allowed:Xv,check_email_title:Qv,click_to_sign_up_description:ew,code_email_enter_code:tw,code_email_subject:nw,code_email_title:iw,code_valid_30_minutes:rw,confirm_password:sw,contact_support:ow,contact_us:aw,continue:"Continua",continue_social_login:cw,continue_with:lw,continue_with_sso_provider_headline:uw,copyright:dw,copyright_sesamy:pw,create_account_description:fw,create_account_email_invalid:hw,create_account_passwords_didnt_match:gw,create_account_title:_w,create_account_weak_password:mw,create_new_account_link:yw,create_password_account_title:vw,currently_logged_in_as:ww,email:bw,email_placeholder:kw,email_validated:xw,email_validated_cta:Sw,email_verification_for_signup_sent_description:Aw,email_verification_for_signup_sent_title:Iw,enter_a_code_btn:jw,enter_email_for_verification_description:zw,enter_new_password_placeholder:Ew,enter_password:$w,enter_password_description:Cw,enter_your_password_btn:Ow,expired_code:Bw,fokus_info_message:Nw,forgot_password_cta:Rw,forgot_password_description:Tw,forgot_password_email_sent:Pw,forgot_password_link:Uw,forgot_password_title:Lw,go_back:Dw,"invalid-email":"Email non valida",invalid_password:Vw,invalid_session_body:Mw,invalid_session_title:Hw,link_email_click_to_login:qw,link_email_login:Kw,link_email_or_enter_code:Fw,link_page_body:Ww,link_page_headline:Gw,logged_in_as:Jw,login:Zw,login_description:Yw,login_description_code:Xw,login_description_link:Qw,logout:eb,no_use_another:tb,or:nb,password:ib,password_has_been_reset:rb,password_has_been_reset_title:sb,password_reset_subject:ob,password_reset_title:ab,privacy_policy:cb,redirecting:lb,reenter_new_password_placeholder:ub,register_password_account:db,resend_code:pb,reset_password_cta:fb,reset_password_description:hb,reset_password_email_click_to_reset:gb,reset_password_email_cta:_b,reset_password_email_reset:mb,reset_password_subject:yb,reset_password_title:vb,send:wb,send_me_a_new_magic_link:bb,sent_code_spam:kb,set_password:xb,sign_in:Sb,signup:Ab,signup_success:Ib,spotify_already_linked_body:jb,spotify_already_linked_cta:zb,spotify_already_linked_step1_body:Eb,spotify_already_linked_step1_title:$b,spotify_already_linked_step2_body:Cb,spotify_already_linked_step2_title:Ob,spotify_already_linked_title:Bb,support_info:Nb,terms:Rb,unverified_email:Tb,user_account_does_not_exist:Pb,user_not_found:Ub,user_not_found_body:Lb,user_not_found_cta:Db,validate_code:Vb,validate_email_body:Mb,validate_email_title:Hb,verify_email_click_to_verify:qb,verify_email_subject:Kb,verify_email_title:Fb,verify_email_verify:Wb,verify_your_email:Gb,we_sent_a_code_to:Jb,welcome:Zb,welcome_to_your_account:Yb,yes_continue:Xb,yes_continue_with:Qb,yes_continue_with_existing_account:ek},nk="Konto oppdaget",ik="Vi har oppdaget at du allerede har opprettet en konto gjennom",rk="Ved å logge på godtar du vår",sk="og",ok="Callback-URLen samsvarer ikke",ak="Den oppgitte redirect_uri er ikke på listen over tillatte tilbakeringings-URLer.",ck="fortsett med bruker",lk="Klikk på knappen for å opprette en ny passordkonto.",uk="Skriv inn koden på {{vendorName}} for å fullføre påloggingen",dk="Velkommen til {{vendorName}} ! {{code}} er påloggingskoden",pk="Velkommen til {{vendorName}}! {{code}} er påloggingskoden",fk="Koden er gyldig i 30 minutter",hk="Bekreft passord",gk="Trenger hjelp?",_k="Kontakt oss",mk="eller fortsett med sosial konto",yk="Fortsett med {{provider}}",vk="Vil du fortsette med din eksisterende konto?",wk="Opphavsrett © 2023 SESAMY. Alle rettigheter forbeholdt.",bk="©2023 Sesamy",kk="Velg et passord med en blanding av store og små bokstaver, tall og symboler.",xk="Vennligst skriv inn en gyldig e-postadresse.",Sk="Passordene stemte ikke overens. Prøv igjen.",Ak="Velg passord",Ik="Passordet må være på minst 8 tegn og inneholde minst én liten bokstav, én stor bokstav, ett tall og ett symbol.",jk="Opprett ny konto",zk="Registrer deg med passord",Ek="Du er logget på som <0> {{email}}</0>",$k="E-post",Ck="E-postadresse",Ok="E-postadressen din har blitt validert",Bk="Skriv nå inn passordet ditt for å logge inn igjen",Nk="En e-post har blitt sendt til <0>{{email}}</0> med en bekreftelseslenke. Klikk på lenken for å bekrefte e-postadressen din og angi et passord.",Rk="E-postbekreftelse sendt",Tk="Angi en kode",Pk="Vi sender deg en bekreftelseskobling for å sikre at du eier denne e-postadressen.",Uk="Skriv inn nytt passord",Lk="Oppgi passord",Dk="Skriv inn e-postadressen og passordet ditt for å logge inn.",Vk="Skriv inn passordet ditt",Mk="Den magiske lenken er utløpt. Vennligst klikk på knappen nedenfor for å motta en ny lenke i innboksen din.",Hk="Hei! Vi oppdaterte påloggingsopplevelsen vår. <0>Klikk her for å lære mer om det.</0>",qk="Send e-post om tilbakestilling av passord",Kk="Klikk på knappen nedenfor, så sender vi deg instruksjoner om hvordan du tilbakestiller passordet ditt.",Fk="E-post om tilbakestilling av passord sendt",Wk="Har du glemt passordet?",Gk="Har du glemt passordet?",Jk="Gå tilbake",Zk="Ugyldig passord",Yk=`Lenken er ikke lenger gyldig.
200
+ Potete fare clic sul link sottostante per iniziare un nuovo accesso.`,B1="Collegamento non valido",T1="Fare clic sul pulsante per accedere",R1="Accedi",P1="Oppure inserire il codice all'indirizzo {{vendorName}} per completare il login.",L1="Inserisci il tuo indirizzo e-mail per sbloccare questo spettacolo su {{service}}",U1="Collegate il vostro account con {{service}}",V1="L'utente ha effettuato l'accesso come",M1="Accesso",H1="Inserire l'indirizzo e-mail per accedere.",D1="Inserite il vostro indirizzo e-mail e vi invieremo un codice di accesso.",F1="Inserite il vostro indirizzo e-mail e vi invieremo un link di accesso.",q1="Disconnettersi",K1="No, voglio usare un altro account",W1="o",G1="Password",J1="La password è stata reimpostata",Z1="Il successo",Y1="Modifica della password dell'account {{vendorName}}",X1="Modifica della password dell'account {{vendorName}} ",Q1="Informativa sulla privacy",ek="Reindirizzamento",tk="Confermare la password",nk="Registrazione di una nuova password",ik="Reinvio del codice",rk="Modifica della password",sk="Immettere di seguito la nuova password per l'account e-mail: ",ok="Fare clic sul pulsante per reimpostare la password",ak="Fare clic sul pulsante per reimpostare la password",ck="Reimpostare la password",lk="Modifica della password dell'account {{vendorName}} ",uk="Reimpostare la password",dk="Inviare",pk="Inviami un nuovo link magico",fk="Ricordate di controllare la cartella spam se l'e-mail non è arrivata.",hk="Impostare la password",gk="Accedi",_k="Iscriviti",mk="Iscriviti con successo",yk="Sembra che il vostro account Spotify sia attualmente collegato a un altro account Sesamy. Ma non temete, siamo qui per guidarvi attraverso la procedura per risolvere il problema.",vk="Vai alla pagina di accesso ai contenuti di Spotify",wk=`Cominciamo con lo scollegare il vostro account Spotify. Fare clic sul pulsante sottostante per accedere alla pagina di accesso ai contenuti di Spotify. Dopo aver effettuato l'accesso al vostro account Spotify, trovate Sesamy nell'elenco delle piattaforme collegate. Fate clic su "Unlink" accanto al logo di Sesamy.`,bk="Passo 1: Disconnettere l'account Spotify",kk="Dopo aver scollegato con successo il proprio account Spotify, è possibile ricollegarlo a Sesamy. È sufficiente ripetere i passaggi precedenti che vi hanno portato a questa pagina.",xk="Passo 2: ricollegare l'account Spotify a Sesamy",Sk="Ops! Il tuo account Spotify è già collegato",Ak="Se avete domande o bisogno di assistenza, potete contattare il nostro team di supporto",Ik="Termini e condizioni",Ek="Il tuo indirizzo e-mail deve essere convalidato. Abbiamo inviato una nuova e-mail alla tua casella di posta.",$k="L'account utente non esiste",Ck="L'account utente non esiste",jk="Non è stato possibile trovare un utente con l'indirizzo e-mail fornito. Si prega di riprovare.",zk="Riprova.",Nk="Convalida del codice",Ok="Controllate la vostra casella di posta per le istruzioni di convalida dell'e-mail.",Bk="Iscritta",Tk="Fare clic sul pulsante per verificare l'indirizzo e-mail",Rk="Convalidare l'indirizzo e-mail",Pk="Convalidare l'indirizzo e-mail",Lk="Verifica dell'account",Uk="Verificare l'e-mail",Vk="Controllate la vostra e-mail all'indirizzo <0>{{email}}</0> e inserisca il codice a sei cifre che le abbiamo inviato.",Mk="Benvenuti",Hk="Benvenuto nel tuo account {{vendorName}}!",Dk="Continuare con questo account",Fk="Sì, continuare con {{text}}",qk="Sì, continuare con l'account esistente",Kk={"Server error: Invalid code":"Codice non valido","Wrong email or verification code":{"":"Email o codice di verifica errati."},account_detected:Lb,account_with_sso_provider:Ub,agree_to:Vb,and:Mb,callback_url_mismatch:Hb,callback_url_not_allowed:Db,check_email_title:Fb,click_to_sign_up_description:qb,code_email_enter_code:Kb,code_email_subject:Wb,code_email_title:Gb,code_valid_30_minutes:Jb,confirm_password:Zb,contact_support:Yb,contact_us:Xb,continue:"Continua",continue_social_login:Qb,continue_with:e1,continue_with_sso_provider_headline:t1,copyright:n1,copyright_sesamy:i1,create_account_description:r1,create_account_email_invalid:s1,create_account_passwords_didnt_match:o1,create_account_title:a1,create_account_weak_password:c1,create_new_account_link:l1,create_password_account_title:u1,currently_logged_in_as:d1,email:p1,email_placeholder:f1,email_validated:h1,email_validated_cta:g1,email_verification_for_signup_sent_description:_1,email_verification_for_signup_sent_title:m1,enter_a_code_btn:y1,enter_email_for_verification_description:v1,enter_new_password_placeholder:w1,enter_password:b1,enter_password_description:k1,enter_your_password_btn:x1,expired_code:S1,fokus_info_message:A1,forgot_password_cta:I1,forgot_password_description:E1,forgot_password_email_sent:$1,forgot_password_link:C1,forgot_password_title:j1,go_back:z1,"invalid-email":"Email non valida",invalid_password:N1,invalid_session_body:O1,invalid_session_title:B1,link_email_click_to_login:T1,link_email_login:R1,link_email_or_enter_code:P1,link_page_body:L1,link_page_headline:U1,logged_in_as:V1,login:M1,login_description:H1,login_description_code:D1,login_description_link:F1,logout:q1,no_use_another:K1,or:W1,password:G1,password_has_been_reset:J1,password_has_been_reset_title:Z1,password_reset_subject:Y1,password_reset_title:X1,privacy_policy:Q1,redirecting:ek,reenter_new_password_placeholder:tk,register_password_account:nk,resend_code:ik,reset_password_cta:rk,reset_password_description:sk,reset_password_email_click_to_reset:ok,reset_password_email_cta:ak,reset_password_email_reset:ck,reset_password_subject:lk,reset_password_title:uk,send:dk,send_me_a_new_magic_link:pk,sent_code_spam:fk,set_password:hk,sign_in:gk,signup:_k,signup_success:mk,spotify_already_linked_body:yk,spotify_already_linked_cta:vk,spotify_already_linked_step1_body:wk,spotify_already_linked_step1_title:bk,spotify_already_linked_step2_body:kk,spotify_already_linked_step2_title:xk,spotify_already_linked_title:Sk,support_info:Ak,terms:Ik,unverified_email:Ek,user_account_does_not_exist:$k,user_not_found:Ck,user_not_found_body:jk,user_not_found_cta:zk,validate_code:Nk,validate_email_body:Ok,validate_email_title:Bk,verify_email_click_to_verify:Tk,verify_email_subject:Rk,verify_email_title:Pk,verify_email_verify:Lk,verify_your_email:Uk,we_sent_a_code_to:Vk,welcome:Mk,welcome_to_your_account:Hk,yes_continue:Dk,yes_continue_with:Fk,yes_continue_with_existing_account:qk},Wk="Konto oppdaget",Gk="Vi har oppdaget at du allerede har opprettet en konto gjennom",Jk="Ved å logge på godtar du vår",Zk="og",Yk="Callback-URLen samsvarer ikke",Xk="Den oppgitte redirect_uri er ikke på listen over tillatte tilbakeringings-URLer.",Qk="fortsett med bruker",ex="Klikk på knappen for å opprette en ny passordkonto.",tx="Skriv inn koden på {{vendorName}} for å fullføre påloggingen",nx="Velkommen til {{vendorName}} ! {{code}} er påloggingskoden",ix="Velkommen til {{vendorName}}! {{code}} er påloggingskoden",rx="Koden er gyldig i 30 minutter",sx="Bekreft passord",ox="Trenger hjelp?",ax="Kontakt oss",cx="eller fortsett med sosial konto",lx="Fortsett med {{provider}}",ux="Vil du fortsette med din eksisterende konto?",dx="Opphavsrett © 2023 SESAMY. Alle rettigheter forbeholdt.",px="©2023 Sesamy",fx="Velg et passord med en blanding av store og små bokstaver, tall og symboler.",hx="Vennligst skriv inn en gyldig e-postadresse.",gx="Passordene stemte ikke overens. Prøv igjen.",_x="Velg passord",mx="Passordet må være på minst 8 tegn og inneholde minst én liten bokstav, én stor bokstav, ett tall og ett symbol.",yx="Opprett ny konto",vx="Registrer deg med passord",wx="Du er logget på som <0> {{email}}</0>",bx="E-post",kx="E-postadresse",xx="E-postadressen din har blitt validert",Sx="Skriv nå inn passordet ditt for å logge inn igjen",Ax="En e-post har blitt sendt til <0>{{email}}</0> med en bekreftelseslenke. Klikk på lenken for å bekrefte e-postadressen din og angi et passord.",Ix="E-postbekreftelse sendt",Ex="Angi en kode",$x="Vi sender deg en bekreftelseskobling for å sikre at du eier denne e-postadressen.",Cx="Skriv inn nytt passord",jx="Oppgi passord",zx="Skriv inn e-postadressen og passordet ditt for å logge inn.",Nx="Skriv inn passordet ditt",Ox="Den magiske lenken er utløpt. Vennligst klikk på knappen nedenfor for å motta en ny lenke i innboksen din.",Bx="Hei! Vi oppdaterte påloggingsopplevelsen vår. <0>Klikk her for å lære mer om det.</0>",Tx="Send e-post om tilbakestilling av passord",Rx="Klikk på knappen nedenfor, så sender vi deg instruksjoner om hvordan du tilbakestiller passordet ditt.",Px="E-post om tilbakestilling av passord sendt",Lx="Har du glemt passordet?",Ux="Har du glemt passordet?",Vx="Gå tilbake",Mx="Ugyldig passord",Hx=`Lenken er ikke lenger gyldig.
177
201
 
178
202
  Sørg for å åpne påloggingslenken i samme nettleser som du startet påloggingen med.
179
203
 
180
- Du kan klikke på lenken nedenfor for å starte en ny pålogging.`,Xk="Ugyldig lenke",Qk="Klikk på knappen for å logge inn",e1="Logg inn",t1="Eller skriv inn koden på {{vendorName}} for å fullføre påloggingen.",n1="Skriv inn e-postadressen din for å låse opp dette programmet på {{service}}",i1="Koble kontoen din til {{service}}",r1="Du er innlogget som",s1="Logg inn",o1="Skriv inn e-postadressen din for å logge på.",a1="Skriv inn e-postadressen din og vi sender deg en påloggingskode.",c1="Skriv inn e-postadressen din og vi sender deg en påloggingslenke.",l1="Logg ut",u1="Nei, jeg vil bruke en annen konto",d1="eller",p1="Passord",f1="Passordet har blitt tilbakestilt",h1="Suksess",g1="Endre passord for {{vendorName}} kontoen din",_1="Endre passord for {{vendorName}} kontoen din",m1="Personvernerklæring",y1="Omdirigerer",v1="Bekreft passord",w1="Registrer et nytt passord",b1="Send kode på nytt",k1="Endre passord",x1="Skriv inn det nye passordet for e-postkontoen nedenfor: ",S1="Klikk på knappen for å tilbakestille passordet ditt",A1="Klikk på knappen for å tilbakestille passordet ditt",I1="Tilbakestill passordet ditt",j1="Endre passord for {{vendorName}} -kontoen din",z1="Tilbakestill passord",E1="Send",$1="Send meg en ny magisk lenke",C1="Husk å sjekke søppelpostmappen din hvis e-posten ikke kom.",O1="Angi passord",B1="Logg inn",N1="Påmelding",R1="Vellykket registrering",T1="Det ser ut til at Spotify-kontoen din for øyeblikket er koblet til en annen Sesamy-konto. Men ikke vær redd, vi er her for å veilede deg gjennom prosessen for å få dette fikset.",P1="Gå til Spotifys innholdstilgangsside",U1='La oss starte med å koble fra Spotify-kontoen din. Klikk på knappen nedenfor for å gå til Spotifys innholdstilgang-side. Etter at du har logget på Spotify-kontoen din, finner du Sesamy på listen over tilkoblede plattformer. Klikk "Fjern kobling" ved siden av Sesamy-logoen.',L1="Trinn 1: Koble fra Spotify-kontoen din",D1="Når du har koblet fra Spotify-kontoen din, kan du koble den til Sesamy på nytt. Bare gjenta trinnene du tidligere tok som førte deg til denne siden.",V1="Trinn 2: Koble Spotify-kontoen din til Sesamy på nytt",M1="Oops! Spotify-kontoen din er allerede koblet",H1="Hvis du har spørsmål eller trenger hjelp, kan du kontakte supportteamet vårt",q1="vilkår",K1="E-postadressen din må bekreftes. Vi har sendt en ny e-post til innboksen din.",F1="Brukerkonto eksisterer ikke",W1="Brukerkonto eksisterer ikke",G1="Vi kunne ikke finne en bruker med den oppgitte e-postadressen. Vær så snill, prøv på nytt.",J1="Prøv igjen.",Z1="Bekreft koden",Y1="Sjekk innboksen din for instruksjoner om e-postvalidering.",X1="Registrerte seg",Q1="Klikk på knappen for å bekrefte e-postadressen din",ex="Bekreft e-postadressen din",tx="Bekreft e-postadressen din",nx="Bekreft konto",ix="Bekreft e-posten din",rx="Vennligst sjekk e-posten din på <0>{{email}}</0> og skriv inn den sekssifrede koden som vi har sendt deg.",sx="Velkommen",ox="Velkommen til din brukerkonto hos {{vendorName}} !",ax="Fortsett med denne kontoen",cx="Ja, fortsett med {{text}}",lx="Ja, fortsett med eksisterende konto",ux={"Server error: Invalid code":"Ugyldig kode","Wrong email or verification code":{"":"Feil e-post eller bekreftelseskode."},account_detected:nk,account_with_sso_provider:ik,agree_to:rk,and:sk,callback_url_mismatch:ok,callback_url_not_allowed:ak,check_email_title:ck,click_to_sign_up_description:lk,code_email_enter_code:uk,code_email_subject:dk,code_email_title:pk,code_valid_30_minutes:fk,confirm_password:hk,contact_support:gk,contact_us:_k,continue:"Fortsette",continue_social_login:mk,continue_with:yk,continue_with_sso_provider_headline:vk,copyright:wk,copyright_sesamy:bk,create_account_description:kk,create_account_email_invalid:xk,create_account_passwords_didnt_match:Sk,create_account_title:Ak,create_account_weak_password:Ik,create_new_account_link:jk,create_password_account_title:zk,currently_logged_in_as:Ek,email:$k,email_placeholder:Ck,email_validated:Ok,email_validated_cta:Bk,email_verification_for_signup_sent_description:Nk,email_verification_for_signup_sent_title:Rk,enter_a_code_btn:Tk,enter_email_for_verification_description:Pk,enter_new_password_placeholder:Uk,enter_password:Lk,enter_password_description:Dk,enter_your_password_btn:Vk,expired_code:Mk,fokus_info_message:Hk,forgot_password_cta:qk,forgot_password_description:Kk,forgot_password_email_sent:Fk,forgot_password_link:Wk,forgot_password_title:Gk,go_back:Jk,"invalid-email":"Ugyldig epost",invalid_password:Zk,invalid_session_body:Yk,invalid_session_title:Xk,link_email_click_to_login:Qk,link_email_login:e1,link_email_or_enter_code:t1,link_page_body:n1,link_page_headline:i1,logged_in_as:r1,login:s1,login_description:o1,login_description_code:a1,login_description_link:c1,logout:l1,no_use_another:u1,or:d1,password:p1,password_has_been_reset:f1,password_has_been_reset_title:h1,password_reset_subject:g1,password_reset_title:_1,privacy_policy:m1,redirecting:y1,reenter_new_password_placeholder:v1,register_password_account:w1,resend_code:b1,reset_password_cta:k1,reset_password_description:x1,reset_password_email_click_to_reset:S1,reset_password_email_cta:A1,reset_password_email_reset:I1,reset_password_subject:j1,reset_password_title:z1,send:E1,send_me_a_new_magic_link:$1,sent_code_spam:C1,set_password:O1,sign_in:B1,signup:N1,signup_success:R1,spotify_already_linked_body:T1,spotify_already_linked_cta:P1,spotify_already_linked_step1_body:U1,spotify_already_linked_step1_title:L1,spotify_already_linked_step2_body:D1,spotify_already_linked_step2_title:V1,spotify_already_linked_title:M1,support_info:H1,terms:q1,unverified_email:K1,user_account_does_not_exist:F1,user_not_found:W1,user_not_found_body:G1,user_not_found_cta:J1,validate_code:Z1,validate_email_body:Y1,validate_email_title:X1,verify_email_click_to_verify:Q1,verify_email_subject:ex,verify_email_title:tx,verify_email_verify:nx,verify_your_email:ix,we_sent_a_code_to:rx,welcome:sx,welcome_to_your_account:ox,yes_continue:ax,yes_continue_with:cx,yes_continue_with_existing_account:lx},dx="Fortsätt med existerande konto",px="Det verkar som att du redan har skapat ett konto genom",fx="Genom att logga in godkänner du våra",hx="och",gx="Callback URL mismatch",_x="The provided redirect_uri is not in the list of allowed callback URLs.",mx="fortsätt med användaren",yx="Klicka på knappen för att skapa ett nytt lösenordskonto.",vx="Skriv in koden på {{vendorName}} för att slutföra inloggningen",wx="Välkommen till {{vendorName}}! {{code}} är koden för att logga in",bx="Välkommen till {{vendorName}}! {{code}} är koden för att logga in",kx="Koden är giltig i 30 minuter",xx="Bekräfta lösenord",Sx="Behöver du hjälp?",Ax="Kontakta oss",Ix="eller via sociala medier",jx="Fortsätt med {{provider}}",zx="Vill du fortsätta med det här kontot?",Ex="Copyright © 2023 SESAMY. Alla rättigheter förbehållna.",$x="©2023 Sesamy",Cx="Välj ett lösenord med en blandning av stora och små bokstäver, siffror och symboler.",Ox="Ange en giltig e-postadress.",Bx="Lösenorden stämde inte överens. Försök igen.",Nx="Välj lösenord",Rx="Lösenordet måste vara minst 8 tecken långt och innehålla minst en gemen bokstav, en versal bokstav, en siffra och en symbol.",Tx="Skapa nytt konto",Px="Registrera dig med lösenord",Ux="Du är inloggad som <0>{{email}}</0>",Lx="E-postadress",Dx="E-postadress",Vx="Din e-postadress har validerats",Mx="Ange nu ditt lösenord för att logga in igen",Hx="Ett e-postmeddelande har skickats till <0>{{email}}</0> med en verifieringslänk. Vänligen klicka på länken för att verifiera din e-postadress och välja ett lösenord.",qx="E-postverifiering skickad",Kx="Logga in med kod",Fx="Vi skickar dig en verifieringslänk för att säkerställa att du äger den här e-postadressen.",Wx="Ange nytt lösenord",Gx="Ange lösenord",Jx="Ange din e-postadress och ditt lösenord för att logga in.",Zx="Logga in med lösenord",Yx="Länken är inte längre giltig. Klicka på knappen för att skicka en ny länk till din epost.",Xx="Vi har bytt inloggningssystem, <0>här kan du läsa mer om vad det innebär</0>",Qx="Skicka",eS="Klicka på knappen nedan så skickar vi instruktioner om hur du återställer ditt lösenord.",tS="Vi har skickat ett e-postmeddelande med instruktioner om hur du återställer ditt lösenord till den e-postadress du angav.",nS="Har du glömt lösenordet?",iS="Har du glömt lösenordet?",rS="Gå tillbaka",sS="Ogiltigt lösenord",oS=`Länken är inte längre giltig.
204
+ Du kan klikke på lenken nedenfor for å starte en ny pålogging.`,Dx="Ugyldig lenke",Fx="Klikk på knappen for å logge inn",qx="Logg inn",Kx="Eller skriv inn koden på {{vendorName}} for å fullføre påloggingen.",Wx="Skriv inn e-postadressen din for å låse opp dette programmet på {{service}}",Gx="Koble kontoen din til {{service}}",Jx="Du er innlogget som",Zx="Logg inn",Yx="Skriv inn e-postadressen din for å logge på.",Xx="Skriv inn e-postadressen din og vi sender deg en påloggingskode.",Qx="Skriv inn e-postadressen din og vi sender deg en påloggingslenke.",eS="Logg ut",tS="Nei, jeg vil bruke en annen konto",nS="eller",iS="Passord",rS="Passordet har blitt tilbakestilt",sS="Suksess",oS="Endre passord for {{vendorName}} kontoen din",aS="Endre passord for {{vendorName}} kontoen din",cS="Personvernerklæring",lS="Omdirigerer",uS="Bekreft passord",dS="Registrer et nytt passord",pS="Send kode på nytt",fS="Endre passord",hS="Skriv inn det nye passordet for e-postkontoen nedenfor: ",gS="Klikk på knappen for å tilbakestille passordet ditt",_S="Klikk på knappen for å tilbakestille passordet ditt",mS="Tilbakestill passordet ditt",yS="Endre passord for {{vendorName}} -kontoen din",vS="Tilbakestill passord",wS="Send",bS="Send meg en ny magisk lenke",kS="Husk å sjekke søppelpostmappen din hvis e-posten ikke kom.",xS="Angi passord",SS="Logg inn",AS="Påmelding",IS="Vellykket registrering",ES="Det ser ut til at Spotify-kontoen din for øyeblikket er koblet til en annen Sesamy-konto. Men ikke vær redd, vi er her for å veilede deg gjennom prosessen for å få dette fikset.",$S="Gå til Spotifys innholdstilgangsside",CS='La oss starte med å koble fra Spotify-kontoen din. Klikk på knappen nedenfor for å gå til Spotifys innholdstilgang-side. Etter at du har logget på Spotify-kontoen din, finner du Sesamy på listen over tilkoblede plattformer. Klikk "Fjern kobling" ved siden av Sesamy-logoen.',jS="Trinn 1: Koble fra Spotify-kontoen din",zS="Når du har koblet fra Spotify-kontoen din, kan du koble den til Sesamy på nytt. Bare gjenta trinnene du tidligere tok som førte deg til denne siden.",NS="Trinn 2: Koble Spotify-kontoen din til Sesamy på nytt",OS="Oops! Spotify-kontoen din er allerede koblet",BS="Hvis du har spørsmål eller trenger hjelp, kan du kontakte supportteamet vårt",TS="vilkår",RS="E-postadressen din må bekreftes. Vi har sendt en ny e-post til innboksen din.",PS="Brukerkonto eksisterer ikke",LS="Brukerkonto eksisterer ikke",US="Vi kunne ikke finne en bruker med den oppgitte e-postadressen. Vær så snill, prøv på nytt.",VS="Prøv igjen.",MS="Bekreft koden",HS="Sjekk innboksen din for instruksjoner om e-postvalidering.",DS="Registrerte seg",FS="Klikk på knappen for å bekrefte e-postadressen din",qS="Bekreft e-postadressen din",KS="Bekreft e-postadressen din",WS="Bekreft konto",GS="Bekreft e-posten din",JS="Vennligst sjekk e-posten din på <0>{{email}}</0> og skriv inn den sekssifrede koden som vi har sendt deg.",ZS="Velkommen",YS="Velkommen til din brukerkonto hos {{vendorName}} !",XS="Fortsett med denne kontoen",QS="Ja, fortsett med {{text}}",e2="Ja, fortsett med eksisterende konto",t2={"Server error: Invalid code":"Ugyldig kode","Wrong email or verification code":{"":"Feil e-post eller bekreftelseskode."},account_detected:Wk,account_with_sso_provider:Gk,agree_to:Jk,and:Zk,callback_url_mismatch:Yk,callback_url_not_allowed:Xk,check_email_title:Qk,click_to_sign_up_description:ex,code_email_enter_code:tx,code_email_subject:nx,code_email_title:ix,code_valid_30_minutes:rx,confirm_password:sx,contact_support:ox,contact_us:ax,continue:"Fortsette",continue_social_login:cx,continue_with:lx,continue_with_sso_provider_headline:ux,copyright:dx,copyright_sesamy:px,create_account_description:fx,create_account_email_invalid:hx,create_account_passwords_didnt_match:gx,create_account_title:_x,create_account_weak_password:mx,create_new_account_link:yx,create_password_account_title:vx,currently_logged_in_as:wx,email:bx,email_placeholder:kx,email_validated:xx,email_validated_cta:Sx,email_verification_for_signup_sent_description:Ax,email_verification_for_signup_sent_title:Ix,enter_a_code_btn:Ex,enter_email_for_verification_description:$x,enter_new_password_placeholder:Cx,enter_password:jx,enter_password_description:zx,enter_your_password_btn:Nx,expired_code:Ox,fokus_info_message:Bx,forgot_password_cta:Tx,forgot_password_description:Rx,forgot_password_email_sent:Px,forgot_password_link:Lx,forgot_password_title:Ux,go_back:Vx,"invalid-email":"Ugyldig epost",invalid_password:Mx,invalid_session_body:Hx,invalid_session_title:Dx,link_email_click_to_login:Fx,link_email_login:qx,link_email_or_enter_code:Kx,link_page_body:Wx,link_page_headline:Gx,logged_in_as:Jx,login:Zx,login_description:Yx,login_description_code:Xx,login_description_link:Qx,logout:eS,no_use_another:tS,or:nS,password:iS,password_has_been_reset:rS,password_has_been_reset_title:sS,password_reset_subject:oS,password_reset_title:aS,privacy_policy:cS,redirecting:lS,reenter_new_password_placeholder:uS,register_password_account:dS,resend_code:pS,reset_password_cta:fS,reset_password_description:hS,reset_password_email_click_to_reset:gS,reset_password_email_cta:_S,reset_password_email_reset:mS,reset_password_subject:yS,reset_password_title:vS,send:wS,send_me_a_new_magic_link:bS,sent_code_spam:kS,set_password:xS,sign_in:SS,signup:AS,signup_success:IS,spotify_already_linked_body:ES,spotify_already_linked_cta:$S,spotify_already_linked_step1_body:CS,spotify_already_linked_step1_title:jS,spotify_already_linked_step2_body:zS,spotify_already_linked_step2_title:NS,spotify_already_linked_title:OS,support_info:BS,terms:TS,unverified_email:RS,user_account_does_not_exist:PS,user_not_found:LS,user_not_found_body:US,user_not_found_cta:VS,validate_code:MS,validate_email_body:HS,validate_email_title:DS,verify_email_click_to_verify:FS,verify_email_subject:qS,verify_email_title:KS,verify_email_verify:WS,verify_your_email:GS,we_sent_a_code_to:JS,welcome:ZS,welcome_to_your_account:YS,yes_continue:XS,yes_continue_with:QS,yes_continue_with_existing_account:e2},n2="Fortsätt med existerande konto",i2="Det verkar som att du redan har skapat ett konto genom",r2="Genom att logga in godkänner du våra",s2="och",o2="Callback URL mismatch",a2="The provided redirect_uri is not in the list of allowed callback URLs.",c2="fortsätt med användaren",l2="Klicka på knappen för att skapa ett nytt lösenordskonto.",u2="Skriv in koden på {{vendorName}} för att slutföra inloggningen",d2="Välkommen till {{vendorName}}! {{code}} är koden för att logga in",p2="Välkommen till {{vendorName}}! {{code}} är koden för att logga in",f2="Koden är giltig i 30 minuter",h2="Bekräfta lösenord",g2="Behöver du hjälp?",_2="Kontakta oss",m2="eller via sociala medier",y2="Fortsätt med {{provider}}",v2="Vill du fortsätta med det här kontot?",w2="Copyright © 2023 SESAMY. Alla rättigheter förbehållna.",b2="©2023 Sesamy",k2="Välj ett lösenord med en blandning av stora och små bokstäver, siffror och symboler.",x2="Ange en giltig e-postadress.",S2="Lösenorden stämde inte överens. Försök igen.",A2="Välj lösenord",I2="Lösenordet måste vara minst 8 tecken långt och innehålla minst en gemen bokstav, en versal bokstav, en siffra och en symbol.",E2="Skapa nytt konto",$2="Registrera dig med lösenord",C2="Du är inloggad som <0>{{email}}</0>",j2="E-postadress",z2="E-postadress",N2="Din e-postadress har validerats",O2="Ange nu ditt lösenord för att logga in igen",B2="Ett e-postmeddelande har skickats till <0>{{email}}</0> med en verifieringslänk. Vänligen klicka på länken för att verifiera din e-postadress och välja ett lösenord.",T2="E-postverifiering skickad",R2="Logga in med kod",P2="Vi skickar dig en verifieringslänk för att säkerställa att du äger den här e-postadressen.",L2="Ange nytt lösenord",U2="Ange lösenord",V2="Ange din e-postadress och ditt lösenord för att logga in.",M2="Logga in med lösenord",H2="Länken är inte längre giltig. Klicka på knappen för att skicka en ny länk till din epost.",D2="Vi har bytt inloggningssystem, <0>här kan du läsa mer om vad det innebär</0>",F2="Skicka",q2="Klicka på knappen nedan så skickar vi instruktioner om hur du återställer ditt lösenord.",K2="Vi har skickat ett e-postmeddelande med instruktioner om hur du återställer ditt lösenord till den e-postadress du angav.",W2="Har du glömt lösenordet?",G2="Har du glömt lösenordet?",J2="Gå tillbaka",Z2="Ogiltigt lösenord",Y2=`Länken är inte längre giltig.
181
205
 
182
206
  Vänligen se till att öppna inloggningslänken i samma webbläsare som du startade inloggningen med.
183
207
 
184
- Du kan klicka på länken nedan för att starta en ny inloggning.`,aS="Ogiltig länk",cS="Klicka på knappen för att logga in",lS="Logga in",uS="Eller skriv in koden på {{vendorName}} för att slutföra inloggningen.",dS="Ange din epost för att låsa upp den här showen på {{service}}",pS="Koppla ditt konto till {{service}}",fS="Du är inloggad som",hS="Logga in",gS="Ange din e-postadress för att logga in.",_S="Ange din mejladress, så skickar vi en kod till dig som du kan logga in med.",mS="Ange din mejladress, så skickar vi en länk till dig som du kan logga in med.",yS="Logga ut",vS="Nej, jag vill använda ett annat konto",wS="eller",bS="Lösenord",kS="Lösenordet har återställts",xS="Framgång",SS="Byt lösenord för ditt {{vendorName}} konto",AS="Byt lösenord för ditt {{vendorName}} konto",IS="Integritetspolicy",jS="Du skickas vidare",zS="Bekräfta lösenord",ES="Registrera ett nytt lösenord",$S="Skicka koden igen",CS="Ändra lösenord",OS="Ange ditt nya lösenord nedan för e-postkontot: ",BS="Klicka på knappen för att återställa ditt lösenord",NS="Klicka på knappen för att återställa ditt lösenord",RS="Återställ ditt lösenord",TS="Byt lösenord för ditt {{vendorName}} konto",PS="Återställ lösenord",US="Skicka",LS="Skicka en ny inloggninglänk",DS="Kom ihåg att kontrollera din skräppost om du inte kan hitta mailet vi har skickat.",VS="Välj lösenord",MS="Logga in",HS="Registrera dig",qS="Registrera dig framgångsrik",KS="Det verkar som att ditt Spotify-konto för närvarande är kopplat till ett annat Sesamy-konto. Ingen fara, vi är här för att guida dig genom processen för att lösa detta.",FS="Gå till Spotify's Content Access sida",WS=`Vi börjar med att avlänka ditt Spotify-konto. Klicka på knappen nedan för att komma till Spotify's Content Access sida. När du har loggat in på ditt Spotify-konto, leta upp Sesamy i listan över anslutna plattformar. Klicka på "Unlink" bredvid Sesamys logotyp.`,GS="Steg 1: Avlänka ditt Spotify-konto",JS="När du har avlänkat ditt Spotify-konto kan du koppla det till Sesamy igen. Upprepa helt enkelt de steg du tog som ledde dig till den här sidan.",ZS="Steg 2: Koppla ditt Spotify-konto till Sesamy igen",YS="Oj! Ditt Spotify-konto är redan kopplat",XS="Om du har frågor eller behöver hjälp kan du kontakta vårt supportteam",QS="Villkor",e2="Din e-postadress behöver valideras. Vi har skickat ett nytt e-postmeddelande till din inkorg",t2="Kontot existerar inte",n2="Kontot extisterar inte",i2="Vi kan inte hitta en användare med denna eposten. Vänligen försök igen.",r2="Försök igen.",s2="Validera kod",o2="Kontrollera din inkorg för instruktioner om validering av e-post.",a2="Registrerad",c2="Klicka på knappen för att verifiera din e-postadress",l2="Bekräfta din e-postadress",u2="Bekräfta din e-postadress",d2="Verifiera konto",p2="Ange engångskod",f2="Vänligen kontrollera din e-post för <0>{{email}}</0> och ange den sexsiffriga koden som vi har skickat till dig.",h2="Välkommen",g2="Välkommen till ditt {{vendorName}}-konto!",_2="Fortsätt med konto",m2="Ja, fortsätt med {{text}}",y2="Ja, fortsätt med detta kontot",v2={"Server error: Invalid code":"Koden är inte giltig","Wrong email or verification code":{"":"Fel e-post eller verifieringskod."},account_detected:dx,account_with_sso_provider:px,agree_to:fx,and:hx,callback_url_mismatch:gx,callback_url_not_allowed:_x,check_email_title:mx,click_to_sign_up_description:yx,code_email_enter_code:vx,code_email_subject:wx,code_email_title:bx,code_valid_30_minutes:kx,confirm_password:xx,contact_support:Sx,contact_us:Ax,continue:"Fortsätt",continue_social_login:Ix,continue_with:jx,continue_with_sso_provider_headline:zx,copyright:Ex,copyright_sesamy:$x,create_account_description:Cx,create_account_email_invalid:Ox,create_account_passwords_didnt_match:Bx,create_account_title:Nx,create_account_weak_password:Rx,create_new_account_link:Tx,create_password_account_title:Px,currently_logged_in_as:Ux,email:Lx,email_placeholder:Dx,email_validated:Vx,email_validated_cta:Mx,email_verification_for_signup_sent_description:Hx,email_verification_for_signup_sent_title:qx,enter_a_code_btn:Kx,enter_email_for_verification_description:Fx,enter_new_password_placeholder:Wx,enter_password:Gx,enter_password_description:Jx,enter_your_password_btn:Zx,expired_code:Yx,fokus_info_message:Xx,forgot_password_cta:Qx,forgot_password_description:eS,forgot_password_email_sent:tS,forgot_password_link:nS,forgot_password_title:iS,go_back:rS,"invalid-email":"Ogiltig e-postadress",invalid_password:sS,invalid_session_body:oS,invalid_session_title:aS,link_email_click_to_login:cS,link_email_login:lS,link_email_or_enter_code:uS,link_page_body:dS,link_page_headline:pS,logged_in_as:fS,login:hS,login_description:gS,login_description_code:_S,login_description_link:mS,logout:yS,no_use_another:vS,or:wS,password:bS,password_has_been_reset:kS,password_has_been_reset_title:xS,password_reset_subject:SS,password_reset_title:AS,privacy_policy:IS,redirecting:jS,reenter_new_password_placeholder:zS,register_password_account:ES,resend_code:$S,reset_password_cta:CS,reset_password_description:OS,reset_password_email_click_to_reset:BS,reset_password_email_cta:NS,reset_password_email_reset:RS,reset_password_subject:TS,reset_password_title:PS,send:US,send_me_a_new_magic_link:LS,sent_code_spam:DS,set_password:VS,sign_in:MS,signup:HS,signup_success:qS,spotify_already_linked_body:KS,spotify_already_linked_cta:FS,spotify_already_linked_step1_body:WS,spotify_already_linked_step1_title:GS,spotify_already_linked_step2_body:JS,spotify_already_linked_step2_title:ZS,spotify_already_linked_title:YS,support_info:XS,terms:QS,unverified_email:e2,user_account_does_not_exist:t2,user_not_found:n2,user_not_found_body:i2,user_not_found_cta:r2,validate_code:s2,validate_email_body:o2,validate_email_title:a2,verify_email_click_to_verify:c2,verify_email_subject:l2,verify_email_title:u2,verify_email_verify:d2,verify_your_email:p2,we_sent_a_code_to:f2,welcome:h2,welcome_to_your_account:g2,yes_continue:_2,yes_continue_with:m2,yes_continue_with_existing_account:y2},w2="Wykryto konto",b2="Wykryliśmy, że użytkownik utworzył już konto za pośrednictwem",k2="Logując się, wyrażasz zgodę na nasze",x2="i",S2="Niezgodność adresu URL wywołania zwrotnego",A2="Podany adres redirect_uri nie znajduje się na liście dozwolonych adresów URL wywołania zwrotnego.",I2="kontynuować z użytkownikiem",j2="Kliknij przycisk, aby utworzyć nowe konto z hasłem.",z2="Wpisz kod na stronie {{vendorName}}, aby się zalogować.",E2="Witamy na {{vendorName}}! {{code}} to kod logowania do Twojego konta.",$2="Witamy na {{vendorName}}! {{code}} to kod logowania.",C2="Kod jest ważny przez 30 minut",O2="Potwierdź hasło",B2="Potrzebujesz pomocy?",N2="Skontaktuj się z nami",R2="lub kontynuować korzystanie z konta społecznościowego",T2="Kontynuuj {{provider}}",P2="Czy chcesz kontynuować korzystanie z istniejącego konta?",U2="Copyright © 2023 SESAMY. Wszelkie prawa zastrzeżone.",L2="©2023 Sesamy",D2="Wybierz hasło składające się z małych i wielkich liter, cyfr i symboli.",V2="Wprowadź prawidłowy adres e-mail.",M2="Hasła nie są zgodne. Spróbuj ponownie.",H2="Wybierz hasło",q2="Hasło musi mieć co najmniej 8 znaków i zawierać co najmniej jedną małą literę, jedną wielką literę, jedną cyfrę i jeden symbol.",K2="Utwórz nowe konto",F2="Zarejestruj się przy użyciu hasła",W2="Jesteś obecnie zalogowany jako <0>{{email}}</0>",G2="E-mail",J2="Adres e-mail",Z2="Twój adres e-mail został zweryfikowany",Y2="Teraz wprowadź hasło, aby zalogować się ponownie",X2="Wiadomość e-mail została wysłana do <0>{{email}}</0> z linkiem weryfikacyjnym. Kliknij łącze, aby zweryfikować swój adres e-mail i ustawić hasło.",Q2="Wysłano weryfikację e-mail",eA="Wprowadź kod",tA="Wyślemy Ci link weryfikacyjny, aby upewnić się, że posiadasz ten adres e-mail.",nA="Wprowadź nowe hasło",iA="Wprowadź hasło",rA="Wprowadź swój adres e-mail i hasło, aby się zalogować.",sA="Wprowadź hasło",oA="Magiczny link wygasł. Kliknij poniższy przycisk, aby otrzymać nowy link w skrzynce odbiorczej.",aA="Zaktualizowaliśmy sposób logowania. <0>Kliknij tutaj, aby dowiedzieć się więcej.</0>",cA="Wyślij wiadomość e-mail z resetem hasła",lA="Kliknij poniższy przycisk, a my wyślemy Ci instrukcje, jak zresetować hasło.",uA="Wysłano wiadomość e-mail z resetem hasła",dA="Zapomniałeś hasła?",pA="Zapomniałeś hasła?",fA="Wróć",hA="Nieprawidłowe hasło",gA=`Link jest już nieaktualny.
208
+ Du kan klicka på länken nedan för att starta en ny inloggning.`,X2="Ogiltig länk",Q2="Klicka på knappen för att logga in",eA="Logga in",tA="Eller skriv in koden på {{vendorName}} för att slutföra inloggningen.",nA="Ange din epost för att låsa upp den här showen på {{service}}",iA="Koppla ditt konto till {{service}}",rA="Du är inloggad som",sA="Logga in",oA="Ange din e-postadress för att logga in.",aA="Ange din mejladress, så skickar vi en kod till dig som du kan logga in med.",cA="Ange din mejladress, så skickar vi en länk till dig som du kan logga in med.",lA="Logga ut",uA="Nej, jag vill använda ett annat konto",dA="eller",pA="Lösenord",fA="Lösenordet har återställts",hA="Framgång",gA="Byt lösenord för ditt {{vendorName}} konto",_A="Byt lösenord för ditt {{vendorName}} konto",mA="Integritetspolicy",yA="Du skickas vidare",vA="Bekräfta lösenord",wA="Registrera ett nytt lösenord",bA="Skicka koden igen",kA="Ändra lösenord",xA="Ange ditt nya lösenord nedan för e-postkontot: ",SA="Klicka på knappen för att återställa ditt lösenord",AA="Klicka på knappen för att återställa ditt lösenord",IA="Återställ ditt lösenord",EA="Byt lösenord för ditt {{vendorName}} konto",$A="Återställ lösenord",CA="Skicka",jA="Skicka en ny inloggninglänk",zA="Kom ihåg att kontrollera din skräppost om du inte kan hitta mailet vi har skickat.",NA="Välj lösenord",OA="Logga in",BA="Registrera dig",TA="Registrera dig framgångsrik",RA="Det verkar som att ditt Spotify-konto för närvarande är kopplat till ett annat Sesamy-konto. Ingen fara, vi är här för att guida dig genom processen för att lösa detta.",PA="Gå till Spotify's Content Access sida",LA=`Vi börjar med att avlänka ditt Spotify-konto. Klicka på knappen nedan för att komma till Spotify's Content Access sida. När du har loggat in på ditt Spotify-konto, leta upp Sesamy i listan över anslutna plattformar. Klicka på "Unlink" bredvid Sesamys logotyp.`,UA="Steg 1: Avlänka ditt Spotify-konto",VA="När du har avlänkat ditt Spotify-konto kan du koppla det till Sesamy igen. Upprepa helt enkelt de steg du tog som ledde dig till den här sidan.",MA="Steg 2: Koppla ditt Spotify-konto till Sesamy igen",HA="Oj! Ditt Spotify-konto är redan kopplat",DA="Om du har frågor eller behöver hjälp kan du kontakta vårt supportteam",FA="Villkor",qA="Din e-postadress behöver valideras. Vi har skickat ett nytt e-postmeddelande till din inkorg",KA="Kontot existerar inte",WA="Kontot extisterar inte",GA="Vi kan inte hitta en användare med denna eposten. Vänligen försök igen.",JA="Försök igen.",ZA="Validera kod",YA="Kontrollera din inkorg för instruktioner om validering av e-post.",XA="Registrerad",QA="Klicka på knappen för att verifiera din e-postadress",eI="Bekräfta din e-postadress",tI="Bekräfta din e-postadress",nI="Verifiera konto",iI="Ange engångskod",rI="Vänligen kontrollera din e-post för <0>{{email}}</0> och ange den sexsiffriga koden som vi har skickat till dig.",sI="Välkommen",oI="Välkommen till ditt {{vendorName}}-konto!",aI="Fortsätt med konto",cI="Ja, fortsätt med {{text}}",lI="Ja, fortsätt med detta kontot",uI={"Server error: Invalid code":"Koden är inte giltig","Wrong email or verification code":{"":"Fel e-post eller verifieringskod."},account_detected:n2,account_with_sso_provider:i2,agree_to:r2,and:s2,callback_url_mismatch:o2,callback_url_not_allowed:a2,check_email_title:c2,click_to_sign_up_description:l2,code_email_enter_code:u2,code_email_subject:d2,code_email_title:p2,code_valid_30_minutes:f2,confirm_password:h2,contact_support:g2,contact_us:_2,continue:"Fortsätt",continue_social_login:m2,continue_with:y2,continue_with_sso_provider_headline:v2,copyright:w2,copyright_sesamy:b2,create_account_description:k2,create_account_email_invalid:x2,create_account_passwords_didnt_match:S2,create_account_title:A2,create_account_weak_password:I2,create_new_account_link:E2,create_password_account_title:$2,currently_logged_in_as:C2,email:j2,email_placeholder:z2,email_validated:N2,email_validated_cta:O2,email_verification_for_signup_sent_description:B2,email_verification_for_signup_sent_title:T2,enter_a_code_btn:R2,enter_email_for_verification_description:P2,enter_new_password_placeholder:L2,enter_password:U2,enter_password_description:V2,enter_your_password_btn:M2,expired_code:H2,fokus_info_message:D2,forgot_password_cta:F2,forgot_password_description:q2,forgot_password_email_sent:K2,forgot_password_link:W2,forgot_password_title:G2,go_back:J2,"invalid-email":"Ogiltig e-postadress",invalid_password:Z2,invalid_session_body:Y2,invalid_session_title:X2,link_email_click_to_login:Q2,link_email_login:eA,link_email_or_enter_code:tA,link_page_body:nA,link_page_headline:iA,logged_in_as:rA,login:sA,login_description:oA,login_description_code:aA,login_description_link:cA,logout:lA,no_use_another:uA,or:dA,password:pA,password_has_been_reset:fA,password_has_been_reset_title:hA,password_reset_subject:gA,password_reset_title:_A,privacy_policy:mA,redirecting:yA,reenter_new_password_placeholder:vA,register_password_account:wA,resend_code:bA,reset_password_cta:kA,reset_password_description:xA,reset_password_email_click_to_reset:SA,reset_password_email_cta:AA,reset_password_email_reset:IA,reset_password_subject:EA,reset_password_title:$A,send:CA,send_me_a_new_magic_link:jA,sent_code_spam:zA,set_password:NA,sign_in:OA,signup:BA,signup_success:TA,spotify_already_linked_body:RA,spotify_already_linked_cta:PA,spotify_already_linked_step1_body:LA,spotify_already_linked_step1_title:UA,spotify_already_linked_step2_body:VA,spotify_already_linked_step2_title:MA,spotify_already_linked_title:HA,support_info:DA,terms:FA,unverified_email:qA,user_account_does_not_exist:KA,user_not_found:WA,user_not_found_body:GA,user_not_found_cta:JA,validate_code:ZA,validate_email_body:YA,validate_email_title:XA,verify_email_click_to_verify:QA,verify_email_subject:eI,verify_email_title:tI,verify_email_verify:nI,verify_your_email:iI,we_sent_a_code_to:rI,welcome:sI,welcome_to_your_account:oI,yes_continue:aI,yes_continue_with:cI,yes_continue_with_existing_account:lI},dI="Wykryto konto",pI="Wykryliśmy, że użytkownik utworzył już konto za pośrednictwem",fI="Logując się, wyrażasz zgodę na nasze",hI="i",gI="Niezgodność adresu URL wywołania zwrotnego",_I="Podany adres redirect_uri nie znajduje się na liście dozwolonych adresów URL wywołania zwrotnego.",mI="kontynuować z użytkownikiem",yI="Kliknij przycisk, aby utworzyć nowe konto z hasłem.",vI="Wpisz kod na stronie {{vendorName}}, aby się zalogować.",wI="Witamy na {{vendorName}}! {{code}} to kod logowania do Twojego konta.",bI="Witamy na {{vendorName}}! {{code}} to kod logowania.",kI="Kod jest ważny przez 30 minut",xI="Potwierdź hasło",SI="Potrzebujesz pomocy?",AI="Skontaktuj się z nami",II="lub kontynuować korzystanie z konta społecznościowego",EI="Kontynuuj {{provider}}",$I="Czy chcesz kontynuować korzystanie z istniejącego konta?",CI="Copyright © 2023 SESAMY. Wszelkie prawa zastrzeżone.",jI="©2023 Sesamy",zI="Wybierz hasło składające się z małych i wielkich liter, cyfr i symboli.",NI="Wprowadź prawidłowy adres e-mail.",OI="Hasła nie są zgodne. Spróbuj ponownie.",BI="Wybierz hasło",TI="Hasło musi mieć co najmniej 8 znaków i zawierać co najmniej jedną małą literę, jedną wielką literę, jedną cyfrę i jeden symbol.",RI="Utwórz nowe konto",PI="Zarejestruj się przy użyciu hasła",LI="Jesteś obecnie zalogowany jako <0>{{email}}</0>",UI="E-mail",VI="Adres e-mail",MI="Twój adres e-mail został zweryfikowany",HI="Teraz wprowadź hasło, aby zalogować się ponownie",DI="Wiadomość e-mail została wysłana do <0>{{email}}</0> z linkiem weryfikacyjnym. Kliknij łącze, aby zweryfikować swój adres e-mail i ustawić hasło.",FI="Wysłano weryfikację e-mail",qI="Wprowadź kod",KI="Wyślemy Ci link weryfikacyjny, aby upewnić się, że posiadasz ten adres e-mail.",WI="Wprowadź nowe hasło",GI="Wprowadź hasło",JI="Wprowadź swój adres e-mail i hasło, aby się zalogować.",ZI="Wprowadź hasło",YI="Magiczny link wygasł. Kliknij poniższy przycisk, aby otrzymać nowy link w skrzynce odbiorczej.",XI="Zaktualizowaliśmy sposób logowania. <0>Kliknij tutaj, aby dowiedzieć się więcej.</0>",QI="Wyślij wiadomość e-mail z resetem hasła",eE="Kliknij poniższy przycisk, a my wyślemy Ci instrukcje, jak zresetować hasło.",tE="Wysłano wiadomość e-mail z resetem hasła",nE="Zapomniałeś hasła?",iE="Zapomniałeś hasła?",rE="Wróć",sE="Nieprawidłowe hasło",oE=`Link jest już nieaktualny.
185
209
 
186
210
  Upewnij się, że otworzyłeś link logowania w tej samej przeglądarce, w której rozpocząłeś logowanie.
187
211
 
188
- Możesz kliknąć poniższy link, aby rozpocząć nowe logowanie.`,_A="Nieprawidłowy link",mA="Kliknij przycisk, aby się zalogować",yA="Zaloguj się",vA="Lub wprowadź kod na stronie {{vendorName}}, aby dokończyć logowanie.",wA="Wprowadź swój adres e-mail, aby odblokować ten program na {{service}}",bA="Połącz swoje konto z {{service}}",kA="Jesteś zalogowany jako",xA="Logowanie",SA="Wprowadź swój adres e-mail, aby się zalogować.",AA="Wprowadź swój adres e-mail, a my wyślemy Ci kod logowania.",IA="Wprowadź swój adres e-mail, a my wyślemy Ci link do logowania.",jA="Wylogowanie",zA="Nie, chcę użyć innego konta",EA="lub",$A="Hasło",CA="Hasło zostało zresetowane",OA="Sukces",BA="Zmień hasło do konta {{vendorName}} ",NA="Zmiana hasła do konta {{vendorName}} ",RA="Polityka prywatności",TA="Przekierowanie",PA="Potwierdź hasło",UA="Zarejestruj nowe hasło",LA="Wyślij ponownie kod",DA="Zmiana hasła",VA="Wprowadź poniżej nowe hasło do konta e-mail: ",MA="Kliknij przycisk, aby zresetować hasło",HA="Kliknij przycisk, aby zresetować hasło",qA="Zmień hasło",KA="Zmiana hasła do konta {{vendorName}} ",FA="Resetowanie hasła",WA="Wyślij",GA="Wyślij mi nowy magiczny link",JA="Pamiętaj, aby sprawdzić folder spamu, jeśli wiadomość e-mail nie dotarła.",ZA="Ustaw hasło",YA="Zaloguj się",XA="Rejestracja",QA="Rejestracja zakończona sukcesem",e4="Wygląda na to, że Twoje konto Spotify jest obecnie połączone z innym kontem Sesamy. Ale nie martw się, jesteśmy tutaj, aby poprowadzić Cię przez proces, aby to naprawić.",t4="Przejdź do strony dostępu do treści Spotify",n4='Zacznijmy od odłączenia konta Spotify. Kliknij poniższy przycisk, aby przejść do strony dostępu do treści Spotify. Po zalogowaniu się na swoje konto Spotify, znajdź Sesamy na liście połączonych platform. Kliknij "Odłącz" obok logo Sesamy.',i4="Krok 1: Odłącz swoje konto Spotify",r4="Po pomyślnym odłączeniu konta Spotify możesz ponownie połączyć je z Sesamy. Wystarczy powtórzyć poprzednie kroki, które doprowadziły Cię do tej strony.",s4="Krok 2: Połącz ponownie swoje konto Spotify z Sesamy",o4="Ups! Twoje konto Spotify jest już połączone",a4="Jeśli masz pytania lub potrzebujesz pomocy, skontaktuj się z nami",c4="Zasady i warunki",l4="Twój adres e-mail wymaga weryfikacji. Wysłaliśmy nową wiadomość e-mail na Twoją skrzynkę odbiorczą",u4="Konto użytkownika nie istnieje",d4="Konto użytkownika nie istnieje",p4="Nie mogliśmy znaleźć użytkownika o podanym adresie e-mail. Spróbuj ponownie.",f4="Spróbuj ponownie.",h4="Sprawdź poprawność kodu",g4="Sprawdź swoją skrzynkę odbiorczą, aby uzyskać instrukcje dotyczące weryfikacji wiadomości e-mail.",_4="Zarejestrowany",m4="Kliknij przycisk, aby zweryfikować swój adres e-mail",y4="Potwierdź swój adres e-mail",v4="Potwierdź swój adres e-mail",w4="Zweryfikuj konto",b4="Zweryfikuj swój adres e-mail",k4="Sprawdź swoją skrzynkę e-mail pod adresem <0>{{email}}</0> i wprowadź sześciocyfrowy kod, który wysłaliśmy.",x4="Witamy",S4="Witamy na koncie {{vendorName}}!",A4="Kontynuuj korzystanie z tego konta",I4="Tak, kontynuuj {{text}}",j4="Tak, kontynuuj korzystanie z istniejącego konta",z4={"Server error: Invalid code":"Nieprawidłowy kod","Wrong email or verification code":{"":"Nieprawidłowy adres e-mail lub kod weryfikacyjny."},account_detected:w2,account_with_sso_provider:b2,agree_to:k2,and:x2,callback_url_mismatch:S2,callback_url_not_allowed:A2,check_email_title:I2,click_to_sign_up_description:j2,code_email_enter_code:z2,code_email_subject:E2,code_email_title:$2,code_valid_30_minutes:C2,confirm_password:O2,contact_support:B2,contact_us:N2,continue:"Kontynuuj",continue_social_login:R2,continue_with:T2,continue_with_sso_provider_headline:P2,copyright:U2,copyright_sesamy:L2,create_account_description:D2,create_account_email_invalid:V2,create_account_passwords_didnt_match:M2,create_account_title:H2,create_account_weak_password:q2,create_new_account_link:K2,create_password_account_title:F2,currently_logged_in_as:W2,email:G2,email_placeholder:J2,email_validated:Z2,email_validated_cta:Y2,email_verification_for_signup_sent_description:X2,email_verification_for_signup_sent_title:Q2,enter_a_code_btn:eA,enter_email_for_verification_description:tA,enter_new_password_placeholder:nA,enter_password:iA,enter_password_description:rA,enter_your_password_btn:sA,expired_code:oA,fokus_info_message:aA,forgot_password_cta:cA,forgot_password_description:lA,forgot_password_email_sent:uA,forgot_password_link:dA,forgot_password_title:pA,go_back:fA,"invalid-email":"Nieprawidłowy adres e-mail",invalid_password:hA,invalid_session_body:gA,invalid_session_title:_A,link_email_click_to_login:mA,link_email_login:yA,link_email_or_enter_code:vA,link_page_body:wA,link_page_headline:bA,logged_in_as:kA,login:xA,login_description:SA,login_description_code:AA,login_description_link:IA,logout:jA,no_use_another:zA,or:EA,password:$A,password_has_been_reset:CA,password_has_been_reset_title:OA,password_reset_subject:BA,password_reset_title:NA,privacy_policy:RA,redirecting:TA,reenter_new_password_placeholder:PA,register_password_account:UA,resend_code:LA,reset_password_cta:DA,reset_password_description:VA,reset_password_email_click_to_reset:MA,reset_password_email_cta:HA,reset_password_email_reset:qA,reset_password_subject:KA,reset_password_title:FA,send:WA,send_me_a_new_magic_link:GA,sent_code_spam:JA,set_password:ZA,sign_in:YA,signup:XA,signup_success:QA,spotify_already_linked_body:e4,spotify_already_linked_cta:t4,spotify_already_linked_step1_body:n4,spotify_already_linked_step1_title:i4,spotify_already_linked_step2_body:r4,spotify_already_linked_step2_title:s4,spotify_already_linked_title:o4,support_info:a4,terms:c4,unverified_email:l4,user_account_does_not_exist:u4,user_not_found:d4,user_not_found_body:p4,user_not_found_cta:f4,validate_code:h4,validate_email_body:g4,validate_email_title:_4,verify_email_click_to_verify:m4,verify_email_subject:y4,verify_email_title:v4,verify_email_verify:w4,verify_your_email:b4,we_sent_a_code_to:k4,welcome:x4,welcome_to_your_account:S4,yes_continue:A4,yes_continue_with:I4,yes_continue_with_existing_account:j4},E4="Zjištěný účet",$4="Zjistili jsme, že jste si již vytvořili účet prostřednictvím",C4="Přihlášením souhlasíte s našimi",O4="a",B4="Neshoda adresy URL zpětného volání",N4="Zadané redirect_uri není v seznamu povolených zpětných adres URL.",R4="pokračovat s uživatelem",T4="Klikněte na tlačítko pro vytvoření nového účtu s heslem.",P4="Pro dokončení přihlášení zadejte kód na adrese {{vendorName}}.",U4="Vítejte na {{vendorName}}! {{code}} je přihlašovací kód.",L4="Vítejte na {{vendorName}}! {{code}} je přihlašovací kód.",D4="Kód je platný po dobu 30 minut",V4="Potvrzení hesla",M4="Potřebujete pomoc?",H4="Kontaktujte nás",q4="nebo pokračovat v sociálním účtu",K4="Pokračovat s {{provider}}",F4="Chcete pokračovat ve svém stávajícím účtu?",W4="Copyright © 2023 SESAMY. Všechna práva vyhrazena.",G4="©2023 Sesamy",J4="Zvolte heslo složené z velkých a malých písmen, číslic a symbolů.",Z4="Zadejte prosím platnou e-mailovou adresu.",Y4="Hesla se neshodovala. Zkuste to znovu.",X4="Zvolte heslo",Q4="Heslo musí mít alespoň 8 znaků a obsahovat alespoň jedno malé písmeno, jedno velké písmeno, jednu číslici a jeden symbol.",eI="Vytvořit nový účet",tI="Zaregistrujte se pomocí hesla",nI="V současné době jste přihlášeni jako <0>{{email}}</0>",iI="E-mail",rI="E-mailová adresa",sI="Vaše e-mailová adresa byla ověřena",oI="Nyní zadejte své heslo a znovu se přihlaste",aI="E-mail byl odeslán na adresu <0>{{email}}</0> s ověřovacím odkazem. Kliknutím na odkaz ověřte svou e-mailovou adresu a nastavte heslo.",cI="Ověření e-mailem odesláno",lI="Zadejte kód",uI="Pošleme vám ověřovací odkaz, abychom se ujistili, že tuto e-mailovou adresu vlastníte.",dI="Zadejte nové heslo",pI="Zadejte heslo",fI="Pro přihlášení zadejte svou e-mailovou adresu a heslo.",hI="Zadejte své heslo",gI="Platnost kouzelného odkazu vypršela. Klikněte na tlačítko níže, abyste obdrželi nový odkaz do své e-mailové schránky.",_I="Ahoj! Aktualizovali jsme naše přihlašovací prostředí. <0>Klikněte sem a dozvíte se o něm více.</0>",mI="Odeslání e-mailu pro obnovení hesla",yI="Klikněte na tlačítko níže a my vám zašleme pokyny k obnovení hesla.",vI="Odeslání e-mailu s žádostí o obnovení hesla",wI="Zapomněli jste heslo?",bI="Zapomněli jste heslo?",kI="Vrátit se zpět",xI="Neplatné heslo",SI=`Odkaz již není platný.
212
+ Możesz kliknąć poniższy link, aby rozpocząć nowe logowanie.`,aE="Nieprawidłowy link",cE="Kliknij przycisk, aby się zalogować",lE="Zaloguj się",uE="Lub wprowadź kod na stronie {{vendorName}}, aby dokończyć logowanie.",dE="Wprowadź swój adres e-mail, aby odblokować ten program na {{service}}",pE="Połącz swoje konto z {{service}}",fE="Jesteś zalogowany jako",hE="Logowanie",gE="Wprowadź swój adres e-mail, aby się zalogować.",_E="Wprowadź swój adres e-mail, a my wyślemy Ci kod logowania.",mE="Wprowadź swój adres e-mail, a my wyślemy Ci link do logowania.",yE="Wylogowanie",vE="Nie, chcę użyć innego konta",wE="lub",bE="Hasło",kE="Hasło zostało zresetowane",xE="Sukces",SE="Zmień hasło do konta {{vendorName}} ",AE="Zmiana hasła do konta {{vendorName}} ",IE="Polityka prywatności",EE="Przekierowanie",$E="Potwierdź hasło",CE="Zarejestruj nowe hasło",jE="Wyślij ponownie kod",zE="Zmiana hasła",NE="Wprowadź poniżej nowe hasło do konta e-mail: ",OE="Kliknij przycisk, aby zresetować hasło",BE="Kliknij przycisk, aby zresetować hasło",TE="Zmień hasło",RE="Zmiana hasła do konta {{vendorName}} ",PE="Resetowanie hasła",LE="Wyślij",UE="Wyślij mi nowy magiczny link",VE="Pamiętaj, aby sprawdzić folder spamu, jeśli wiadomość e-mail nie dotarła.",ME="Ustaw hasło",HE="Zaloguj się",DE="Rejestracja",FE="Rejestracja zakończona sukcesem",qE="Wygląda na to, że Twoje konto Spotify jest obecnie połączone z innym kontem Sesamy. Ale nie martw się, jesteśmy tutaj, aby poprowadzić Cię przez proces, aby to naprawić.",KE="Przejdź do strony dostępu do treści Spotify",WE='Zacznijmy od odłączenia konta Spotify. Kliknij poniższy przycisk, aby przejść do strony dostępu do treści Spotify. Po zalogowaniu się na swoje konto Spotify, znajdź Sesamy na liście połączonych platform. Kliknij "Odłącz" obok logo Sesamy.',GE="Krok 1: Odłącz swoje konto Spotify",JE="Po pomyślnym odłączeniu konta Spotify możesz ponownie połączyć je z Sesamy. Wystarczy powtórzyć poprzednie kroki, które doprowadziły Cię do tej strony.",ZE="Krok 2: Połącz ponownie swoje konto Spotify z Sesamy",YE="Ups! Twoje konto Spotify jest już połączone",XE="Jeśli masz pytania lub potrzebujesz pomocy, skontaktuj się z nami",QE="Zasady i warunki",e4="Twój adres e-mail wymaga weryfikacji. Wysłaliśmy nową wiadomość e-mail na Twoją skrzynkę odbiorczą",t4="Konto użytkownika nie istnieje",n4="Konto użytkownika nie istnieje",i4="Nie mogliśmy znaleźć użytkownika o podanym adresie e-mail. Spróbuj ponownie.",r4="Spróbuj ponownie.",s4="Sprawdź poprawność kodu",o4="Sprawdź swoją skrzynkę odbiorczą, aby uzyskać instrukcje dotyczące weryfikacji wiadomości e-mail.",a4="Zarejestrowany",c4="Kliknij przycisk, aby zweryfikować swój adres e-mail",l4="Potwierdź swój adres e-mail",u4="Potwierdź swój adres e-mail",d4="Zweryfikuj konto",p4="Zweryfikuj swój adres e-mail",f4="Sprawdź swoją skrzynkę e-mail pod adresem <0>{{email}}</0> i wprowadź sześciocyfrowy kod, który wysłaliśmy.",h4="Witamy",g4="Witamy na koncie {{vendorName}}!",_4="Kontynuuj korzystanie z tego konta",m4="Tak, kontynuuj {{text}}",y4="Tak, kontynuuj korzystanie z istniejącego konta",v4={"Server error: Invalid code":"Nieprawidłowy kod","Wrong email or verification code":{"":"Nieprawidłowy adres e-mail lub kod weryfikacyjny."},account_detected:dI,account_with_sso_provider:pI,agree_to:fI,and:hI,callback_url_mismatch:gI,callback_url_not_allowed:_I,check_email_title:mI,click_to_sign_up_description:yI,code_email_enter_code:vI,code_email_subject:wI,code_email_title:bI,code_valid_30_minutes:kI,confirm_password:xI,contact_support:SI,contact_us:AI,continue:"Kontynuuj",continue_social_login:II,continue_with:EI,continue_with_sso_provider_headline:$I,copyright:CI,copyright_sesamy:jI,create_account_description:zI,create_account_email_invalid:NI,create_account_passwords_didnt_match:OI,create_account_title:BI,create_account_weak_password:TI,create_new_account_link:RI,create_password_account_title:PI,currently_logged_in_as:LI,email:UI,email_placeholder:VI,email_validated:MI,email_validated_cta:HI,email_verification_for_signup_sent_description:DI,email_verification_for_signup_sent_title:FI,enter_a_code_btn:qI,enter_email_for_verification_description:KI,enter_new_password_placeholder:WI,enter_password:GI,enter_password_description:JI,enter_your_password_btn:ZI,expired_code:YI,fokus_info_message:XI,forgot_password_cta:QI,forgot_password_description:eE,forgot_password_email_sent:tE,forgot_password_link:nE,forgot_password_title:iE,go_back:rE,"invalid-email":"Nieprawidłowy adres e-mail",invalid_password:sE,invalid_session_body:oE,invalid_session_title:aE,link_email_click_to_login:cE,link_email_login:lE,link_email_or_enter_code:uE,link_page_body:dE,link_page_headline:pE,logged_in_as:fE,login:hE,login_description:gE,login_description_code:_E,login_description_link:mE,logout:yE,no_use_another:vE,or:wE,password:bE,password_has_been_reset:kE,password_has_been_reset_title:xE,password_reset_subject:SE,password_reset_title:AE,privacy_policy:IE,redirecting:EE,reenter_new_password_placeholder:$E,register_password_account:CE,resend_code:jE,reset_password_cta:zE,reset_password_description:NE,reset_password_email_click_to_reset:OE,reset_password_email_cta:BE,reset_password_email_reset:TE,reset_password_subject:RE,reset_password_title:PE,send:LE,send_me_a_new_magic_link:UE,sent_code_spam:VE,set_password:ME,sign_in:HE,signup:DE,signup_success:FE,spotify_already_linked_body:qE,spotify_already_linked_cta:KE,spotify_already_linked_step1_body:WE,spotify_already_linked_step1_title:GE,spotify_already_linked_step2_body:JE,spotify_already_linked_step2_title:ZE,spotify_already_linked_title:YE,support_info:XE,terms:QE,unverified_email:e4,user_account_does_not_exist:t4,user_not_found:n4,user_not_found_body:i4,user_not_found_cta:r4,validate_code:s4,validate_email_body:o4,validate_email_title:a4,verify_email_click_to_verify:c4,verify_email_subject:l4,verify_email_title:u4,verify_email_verify:d4,verify_your_email:p4,we_sent_a_code_to:f4,welcome:h4,welcome_to_your_account:g4,yes_continue:_4,yes_continue_with:m4,yes_continue_with_existing_account:y4},w4="Zjištěný účet",b4="Zjistili jsme, že jste si již vytvořili účet prostřednictvím",k4="Přihlášením souhlasíte s našimi",x4="a",S4="Neshoda adresy URL zpětného volání",A4="Zadané redirect_uri není v seznamu povolených zpětných adres URL.",I4="pokračovat s uživatelem",E4="Klikněte na tlačítko pro vytvoření nového účtu s heslem.",$4="Pro dokončení přihlášení zadejte kód na adrese {{vendorName}}.",C4="Vítejte na {{vendorName}}! {{code}} je přihlašovací kód.",j4="Vítejte na {{vendorName}}! {{code}} je přihlašovací kód.",z4="Kód je platný po dobu 30 minut",N4="Potvrzení hesla",O4="Potřebujete pomoc?",B4="Kontaktujte nás",T4="nebo pokračovat v sociálním účtu",R4="Pokračovat s {{provider}}",P4="Chcete pokračovat ve svém stávajícím účtu?",L4="Copyright © 2023 SESAMY. Všechna práva vyhrazena.",U4="©2023 Sesamy",V4="Zvolte heslo složené z velkých a malých písmen, číslic a symbolů.",M4="Zadejte prosím platnou e-mailovou adresu.",H4="Hesla se neshodovala. Zkuste to znovu.",D4="Zvolte heslo",F4="Heslo musí mít alespoň 8 znaků a obsahovat alespoň jedno malé písmeno, jedno velké písmeno, jednu číslici a jeden symbol.",q4="Vytvořit nový účet",K4="Zaregistrujte se pomocí hesla",W4="V současné době jste přihlášeni jako <0>{{email}}</0>",G4="E-mail",J4="E-mailová adresa",Z4="Vaše e-mailová adresa byla ověřena",Y4="Nyní zadejte své heslo a znovu se přihlaste",X4="E-mail byl odeslán na adresu <0>{{email}}</0> s ověřovacím odkazem. Kliknutím na odkaz ověřte svou e-mailovou adresu a nastavte heslo.",Q4="Ověření e-mailem odesláno",e6="Zadejte kód",t6="Pošleme vám ověřovací odkaz, abychom se ujistili, že tuto e-mailovou adresu vlastníte.",n6="Zadejte nové heslo",i6="Zadejte heslo",r6="Pro přihlášení zadejte svou e-mailovou adresu a heslo.",s6="Zadejte své heslo",o6="Platnost kouzelného odkazu vypršela. Klikněte na tlačítko níže, abyste obdrželi nový odkaz do své e-mailové schránky.",a6="Ahoj! Aktualizovali jsme naše přihlašovací prostředí. <0>Klikněte sem a dozvíte se o něm více.</0>",c6="Odeslání e-mailu pro obnovení hesla",l6="Klikněte na tlačítko níže a my vám zašleme pokyny k obnovení hesla.",u6="Odeslání e-mailu s žádostí o obnovení hesla",d6="Zapomněli jste heslo?",p6="Zapomněli jste heslo?",f6="Vrátit se zpět",h6="Neplatné heslo",g6=`Odkaz již není platný.
189
213
 
190
214
  Ujistěte se, že jste odkaz na přihlášení otevřeli ve stejném prohlížeči, ve kterém jste přihlášení zahájili.
191
215
 
192
- Kliknutím na odkaz níže můžete zahájit nové přihlášení.`,AI="Neplatný odkaz",II="Kliknutím na tlačítko se přihlásíte",jI="Přihlášení",zI="Nebo zadejte kód na adrese {{vendorName}} a dokončete přihlášení.",EI="Zadejte svou e-mailovou adresu pro odemknutí tohoto pořadu na {{service}}",$I="Propojte svůj účet s {{service}}",CI="Jste přihlášeni jako",OI="Přihlášení",BI="Pro přihlášení zadejte svou e-mailovou adresu.",NI="Zadejte svou e-mailovou adresu a my vám zašleme přihlašovací kód.",RI="Zadejte svou e-mailovou adresu a my vám zašleme odkaz pro přihlášení.",TI="Odhlášení",PI="Ne, chci použít jiný účet",UI="nebo",LI="Heslo",DI="Heslo bylo resetováno",VI="Úspěch",MI="Změna hesla k účtu {{vendorName}} ",HI="Změna hesla k účtu {{vendorName}} ",qI="Zásady ochrany osobních údajů",KI="Přesměrování",FI="Potvrzení hesla",WI="Registrace nového hesla",GI="Opětovné odeslání kódu",JI="Změna hesla",ZI="Níže zadejte nové heslo k e-mailovému účtu: ",YI="Kliknutím na tlačítko obnovíte své heslo",XI="Kliknutím na tlačítko obnovíte své heslo",QI="Obnovení hesla",e6="Změna hesla k účtu {{vendorName}} ",t6="Obnovení hesla",n6="Odeslat",i6="Pošlete mi nový kouzelný odkaz",r6="Pokud e-mail nedorazil, nezapomeňte zkontrolovat složku nevyžádané pošty.",s6="Nastavení hesla",o6="Přihlásit se",a6="Registrace",c6="Úspěšná registrace",l6="Zdá se, že váš účet Spotify je v současné době propojen s jiným účtem Sesamy. Ale nebojte se, jsme tu, abychom vás provedli procesem, jak to napravit.",u6="Přejděte na stránku Spotify pro přístup k obsahu",d6='Začněme odpojením účtu Spotify. Kliknutím na tlačítko níže přejděte na stránku přístupu k obsahu služby Spotify. Po přihlášení k účtu Spotify najděte v seznamu připojených platforem položku Sesamy. Klikněte na tlačítko "Unlink" vedle loga Sesamy.',p6="Krok 1: Odpojení účtu Spotify",f6="Po úspěšném odpojení účtu Spotify jej můžete znovu propojit se službou Sesamy. Stačí zopakovat předchozí kroky, které vás přivedly na tuto stránku.",h6="Krok 2: Propojení účtu Spotify s aplikací Sesamy",g6="Ups! Váš účet Spotify je již propojen",_6="Pokud máte dotazy nebo potřebujete pomoc, můžete se obrátit na náš tým podpory.",m6="Podmínky a pravidla",y6="Vaši e-mailovou adresu je třeba ověřit. Do vaší e-mailové schránky jsme odeslali nový e-mail.",v6="Uživatelský účet neexistuje",w6="Uživatelský účet neexistuje",b6="Nepodařilo se nám najít uživatele se zadanou e-mailovou adresou. Zkuste to prosím znovu.",k6="Zkuste to znovu.",x6="Ověření kódu",S6="Pokyny k ověření e-mailu najdete ve své e-mailové schránce.",A6="Zaregistrovali jste se",I6="Klikněte na tlačítko pro ověření e-mailové adresy",j6="Ověřte svou e-mailovou adresu",z6="Ověřte svou e-mailovou adresu",E6="Ověření účtu",$6="Ověření e-mailu",C6="Zkontrolujte si prosím svůj e-mail na adrese <0>{{email}}</0> a zadejte šestimístný kód, který jsme vám zaslali.",O6="Vítejte na",B6="Vítejte na svém účtu {{vendorName}}!",N6="Pokračujte s tímto účtem",R6="Ano, pokračujte {{text}}",T6="Ano, pokračujte ve stávajícím účtu",P6={"Server error: Invalid code":"Neplatný kód","Wrong email or verification code":{"":"Špatný e-mail nebo ověřovací kód."},account_detected:E4,account_with_sso_provider:$4,agree_to:C4,and:O4,callback_url_mismatch:B4,callback_url_not_allowed:N4,check_email_title:R4,click_to_sign_up_description:T4,code_email_enter_code:P4,code_email_subject:U4,code_email_title:L4,code_valid_30_minutes:D4,confirm_password:V4,contact_support:M4,contact_us:H4,continue:"Pokračovat",continue_social_login:q4,continue_with:K4,continue_with_sso_provider_headline:F4,copyright:W4,copyright_sesamy:G4,create_account_description:J4,create_account_email_invalid:Z4,create_account_passwords_didnt_match:Y4,create_account_title:X4,create_account_weak_password:Q4,create_new_account_link:eI,create_password_account_title:tI,currently_logged_in_as:nI,email:iI,email_placeholder:rI,email_validated:sI,email_validated_cta:oI,email_verification_for_signup_sent_description:aI,email_verification_for_signup_sent_title:cI,enter_a_code_btn:lI,enter_email_for_verification_description:uI,enter_new_password_placeholder:dI,enter_password:pI,enter_password_description:fI,enter_your_password_btn:hI,expired_code:gI,fokus_info_message:_I,forgot_password_cta:mI,forgot_password_description:yI,forgot_password_email_sent:vI,forgot_password_link:wI,forgot_password_title:bI,go_back:kI,"invalid-email":"Neplatný e-mail",invalid_password:xI,invalid_session_body:SI,invalid_session_title:AI,link_email_click_to_login:II,link_email_login:jI,link_email_or_enter_code:zI,link_page_body:EI,link_page_headline:$I,logged_in_as:CI,login:OI,login_description:BI,login_description_code:NI,login_description_link:RI,logout:TI,no_use_another:PI,or:UI,password:LI,password_has_been_reset:DI,password_has_been_reset_title:VI,password_reset_subject:MI,password_reset_title:HI,privacy_policy:qI,redirecting:KI,reenter_new_password_placeholder:FI,register_password_account:WI,resend_code:GI,reset_password_cta:JI,reset_password_description:ZI,reset_password_email_click_to_reset:YI,reset_password_email_cta:XI,reset_password_email_reset:QI,reset_password_subject:e6,reset_password_title:t6,send:n6,send_me_a_new_magic_link:i6,sent_code_spam:r6,set_password:s6,sign_in:o6,signup:a6,signup_success:c6,spotify_already_linked_body:l6,spotify_already_linked_cta:u6,spotify_already_linked_step1_body:d6,spotify_already_linked_step1_title:p6,spotify_already_linked_step2_body:f6,spotify_already_linked_step2_title:h6,spotify_already_linked_title:g6,support_info:_6,terms:m6,unverified_email:y6,user_account_does_not_exist:v6,user_not_found:w6,user_not_found_body:b6,user_not_found_cta:k6,validate_code:x6,validate_email_body:S6,validate_email_title:A6,verify_email_click_to_verify:I6,verify_email_subject:j6,verify_email_title:z6,verify_email_verify:E6,verify_your_email:$6,we_sent_a_code_to:C6,welcome:O6,welcome_to_your_account:B6,yes_continue:N6,yes_continue_with:R6,yes_continue_with_existing_account:T6},U6="Tili havaittu",L6="Olemme havainneet, että olet jo luonut tilin kautta",D6="Kirjautumalla sisään hyväksyt",V6="ja",M6="Takaisinkutsun URL-osoite ei vastaa toisiaan",H6="Annettu redirect_uri ei ole sallittujen takaisinsoitto-URL-osoitteiden luettelossa.",q6="jatka käyttäjän kanssa",K6="Klikkaa painiketta luodaksesi uuden salasanatilin.",F6="Kirjoita koodi osoitteessa {{vendorName}} kirjautumisen loppuun saattamiseksi.",W6="Tervetuloa osoitteeseen {{vendorName}}! {{code}} on kirjautumiskoodi.",G6="Tervetuloa osoitteeseen {{vendorName}}! {{code}} on kirjautumiskoodi.",J6="Koodi on voimassa 30 minuuttia",Z6="Vahvista salasana",Y6="Tarvitsetko apua?",X6="Ota yhteyttä",Q6="tai jatka sosiaalisella tilillä",ej="Jatka {{provider}}",tj="Haluatko jatkaa olemassa olevalla tililläsi?",nj="Copyright © 2023 SESAMY. Kaikki oikeudet pidätetään.",ij="©2023 Sesamy",rj="Valitse salasana, jossa on isoja ja pieniä kirjaimia, numeroita ja symboleja.",sj="Kirjoita voimassa oleva sähköpostiosoite.",oj="Salasanat eivät vastanneet toisiaan. Yritä uudelleen.",aj="Valitse salasana",cj="Salasanan on oltava vähintään 8 merkkiä pitkä ja sisällettävä vähintään yksi pieni kirjain, yksi iso kirjain, yksi numero ja yksi symboli.",lj="Luo uusi tili",uj="Rekisteröidy salasanalla",dj="Olet tällä hetkellä kirjautuneena sisään nimellä <0>{{email}}</0>",pj="Sähköposti",fj="Sähköpostiosoite",hj="Sähköpostiosoitteesi on vahvistettu",gj="Kirjoita nyt salasanasi kirjautuaksesi uudelleen",_j="Sähköposti on lähetetty osoitteeseen <0>{{email}}</0> jossa on vahvistuslinkki. Klikkaa linkkiä vahvistaaksesi sähköpostiosoitteesi ja asettaaksesi salasanan.",mj="Sähköpostivarmennus lähetetty",yj="Syötä koodi",vj="Lähetämme sinulle vahvistuslinkin varmistaaksemme, että omistat tämän sähköpostiosoitteen.",wj="Anna uusi salasana",bj="Anna salasana",kj="Anna sähköpostiosoitteesi ja salasanasi kirjautuaksesi sisään.",xj="Syötä salasanasi",Sj="Taikalinkki on vanhentunut. Klikkaa alla olevaa painiketta saadaksesi uuden linkin sähköpostiisi.",Aj="Hei! Päivitimme kirjautumiskokemuksemme. <0>Klikkaa tästä saadaksesi lisätietoja siitä.</0>",Ij="Lähetä salasanan palautussähköposti",jj="Napsauta alla olevaa painiketta, niin lähetämme ohjeet salasanasi palauttamiseen.",zj="Salasanan palautussähköposti lähetetty",Ej="Unohditko salasanan?",$j="Unohditko salasanan?",Cj="Palaa takaisin",Oj="Virheellinen salasana",Bj=`Linkki ei ole enää voimassa.
216
+ Kliknutím na odkaz níže můžete zahájit nové přihlášení.`,_6="Neplatný odkaz",m6="Kliknutím na tlačítko se přihlásíte",y6="Přihlášení",v6="Nebo zadejte kód na adrese {{vendorName}} a dokončete přihlášení.",w6="Zadejte svou e-mailovou adresu pro odemknutí tohoto pořadu na {{service}}",b6="Propojte svůj účet s {{service}}",k6="Jste přihlášeni jako",x6="Přihlášení",S6="Pro přihlášení zadejte svou e-mailovou adresu.",A6="Zadejte svou e-mailovou adresu a my vám zašleme přihlašovací kód.",I6="Zadejte svou e-mailovou adresu a my vám zašleme odkaz pro přihlášení.",E6="Odhlášení",$6="Ne, chci použít jiný účet",C6="nebo",j6="Heslo",z6="Heslo bylo resetováno",N6="Úspěch",O6="Změna hesla k účtu {{vendorName}} ",B6="Změna hesla k účtu {{vendorName}} ",T6="Zásady ochrany osobních údajů",R6="Přesměrování",P6="Potvrzení hesla",L6="Registrace nového hesla",U6="Opětovné odeslání kódu",V6="Změna hesla",M6="Níže zadejte nové heslo k e-mailovému účtu: ",H6="Kliknutím na tlačítko obnovíte své heslo",D6="Kliknutím na tlačítko obnovíte své heslo",F6="Obnovení hesla",q6="Změna hesla k účtu {{vendorName}} ",K6="Obnovení hesla",W6="Odeslat",G6="Pošlete mi nový kouzelný odkaz",J6="Pokud e-mail nedorazil, nezapomeňte zkontrolovat složku nevyžádané pošty.",Z6="Nastavení hesla",Y6="Přihlásit se",X6="Registrace",Q6="Úspěšná registrace",e$="Zdá se, že váš účet Spotify je v současné době propojen s jiným účtem Sesamy. Ale nebojte se, jsme tu, abychom vás provedli procesem, jak to napravit.",t$="Přejděte na stránku Spotify pro přístup k obsahu",n$='Začněme odpojením účtu Spotify. Kliknutím na tlačítko níže přejděte na stránku přístupu k obsahu služby Spotify. Po přihlášení k účtu Spotify najděte v seznamu připojených platforem položku Sesamy. Klikněte na tlačítko "Unlink" vedle loga Sesamy.',i$="Krok 1: Odpojení účtu Spotify",r$="Po úspěšném odpojení účtu Spotify jej můžete znovu propojit se službou Sesamy. Stačí zopakovat předchozí kroky, které vás přivedly na tuto stránku.",s$="Krok 2: Propojení účtu Spotify s aplikací Sesamy",o$="Ups! Váš účet Spotify je již propojen",a$="Pokud máte dotazy nebo potřebujete pomoc, můžete se obrátit na náš tým podpory.",c$="Podmínky a pravidla",l$="Vaši e-mailovou adresu je třeba ověřit. Do vaší e-mailové schránky jsme odeslali nový e-mail.",u$="Uživatelský účet neexistuje",d$="Uživatelský účet neexistuje",p$="Nepodařilo se nám najít uživatele se zadanou e-mailovou adresou. Zkuste to prosím znovu.",f$="Zkuste to znovu.",h$="Ověření kódu",g$="Pokyny k ověření e-mailu najdete ve své e-mailové schránce.",_$="Zaregistrovali jste se",m$="Klikněte na tlačítko pro ověření e-mailové adresy",y$="Ověřte svou e-mailovou adresu",v$="Ověřte svou e-mailovou adresu",w$="Ověření účtu",b$="Ověření e-mailu",k$="Zkontrolujte si prosím svůj e-mail na adrese <0>{{email}}</0> a zadejte šestimístný kód, který jsme vám zaslali.",x$="Vítejte na",S$="Vítejte na svém účtu {{vendorName}}!",A$="Pokračujte s tímto účtem",I$="Ano, pokračujte {{text}}",E$="Ano, pokračujte ve stávajícím účtu",$$={"Server error: Invalid code":"Neplatný kód","Wrong email or verification code":{"":"Špatný e-mail nebo ověřovací kód."},account_detected:w4,account_with_sso_provider:b4,agree_to:k4,and:x4,callback_url_mismatch:S4,callback_url_not_allowed:A4,check_email_title:I4,click_to_sign_up_description:E4,code_email_enter_code:$4,code_email_subject:C4,code_email_title:j4,code_valid_30_minutes:z4,confirm_password:N4,contact_support:O4,contact_us:B4,continue:"Pokračovat",continue_social_login:T4,continue_with:R4,continue_with_sso_provider_headline:P4,copyright:L4,copyright_sesamy:U4,create_account_description:V4,create_account_email_invalid:M4,create_account_passwords_didnt_match:H4,create_account_title:D4,create_account_weak_password:F4,create_new_account_link:q4,create_password_account_title:K4,currently_logged_in_as:W4,email:G4,email_placeholder:J4,email_validated:Z4,email_validated_cta:Y4,email_verification_for_signup_sent_description:X4,email_verification_for_signup_sent_title:Q4,enter_a_code_btn:e6,enter_email_for_verification_description:t6,enter_new_password_placeholder:n6,enter_password:i6,enter_password_description:r6,enter_your_password_btn:s6,expired_code:o6,fokus_info_message:a6,forgot_password_cta:c6,forgot_password_description:l6,forgot_password_email_sent:u6,forgot_password_link:d6,forgot_password_title:p6,go_back:f6,"invalid-email":"Neplatný e-mail",invalid_password:h6,invalid_session_body:g6,invalid_session_title:_6,link_email_click_to_login:m6,link_email_login:y6,link_email_or_enter_code:v6,link_page_body:w6,link_page_headline:b6,logged_in_as:k6,login:x6,login_description:S6,login_description_code:A6,login_description_link:I6,logout:E6,no_use_another:$6,or:C6,password:j6,password_has_been_reset:z6,password_has_been_reset_title:N6,password_reset_subject:O6,password_reset_title:B6,privacy_policy:T6,redirecting:R6,reenter_new_password_placeholder:P6,register_password_account:L6,resend_code:U6,reset_password_cta:V6,reset_password_description:M6,reset_password_email_click_to_reset:H6,reset_password_email_cta:D6,reset_password_email_reset:F6,reset_password_subject:q6,reset_password_title:K6,send:W6,send_me_a_new_magic_link:G6,sent_code_spam:J6,set_password:Z6,sign_in:Y6,signup:X6,signup_success:Q6,spotify_already_linked_body:e$,spotify_already_linked_cta:t$,spotify_already_linked_step1_body:n$,spotify_already_linked_step1_title:i$,spotify_already_linked_step2_body:r$,spotify_already_linked_step2_title:s$,spotify_already_linked_title:o$,support_info:a$,terms:c$,unverified_email:l$,user_account_does_not_exist:u$,user_not_found:d$,user_not_found_body:p$,user_not_found_cta:f$,validate_code:h$,validate_email_body:g$,validate_email_title:_$,verify_email_click_to_verify:m$,verify_email_subject:y$,verify_email_title:v$,verify_email_verify:w$,verify_your_email:b$,we_sent_a_code_to:k$,welcome:x$,welcome_to_your_account:S$,yes_continue:A$,yes_continue_with:I$,yes_continue_with_existing_account:E$},C$="Tili havaittu",j$="Olemme havainneet, että olet jo luonut tilin kautta",z$="Kirjautumalla sisään hyväksyt",N$="ja",O$="Takaisinkutsun URL-osoite ei vastaa toisiaan",B$="Annettu redirect_uri ei ole sallittujen takaisinsoitto-URL-osoitteiden luettelossa.",T$="jatka käyttäjän kanssa",R$="Klikkaa painiketta luodaksesi uuden salasanatilin.",P$="Kirjoita koodi osoitteessa {{vendorName}} kirjautumisen loppuun saattamiseksi.",L$="Tervetuloa osoitteeseen {{vendorName}}! {{code}} on kirjautumiskoodi.",U$="Tervetuloa osoitteeseen {{vendorName}}! {{code}} on kirjautumiskoodi.",V$="Koodi on voimassa 30 minuuttia",M$="Vahvista salasana",H$="Tarvitsetko apua?",D$="Ota yhteyttä",F$="tai jatka sosiaalisella tilillä",q$="Jatka {{provider}}",K$="Haluatko jatkaa olemassa olevalla tililläsi?",W$="Copyright © 2023 SESAMY. Kaikki oikeudet pidätetään.",G$="©2023 Sesamy",J$="Valitse salasana, jossa on isoja ja pieniä kirjaimia, numeroita ja symboleja.",Z$="Kirjoita voimassa oleva sähköpostiosoite.",Y$="Salasanat eivät vastanneet toisiaan. Yritä uudelleen.",X$="Valitse salasana",Q$="Salasanan on oltava vähintään 8 merkkiä pitkä ja sisällettävä vähintään yksi pieni kirjain, yksi iso kirjain, yksi numero ja yksi symboli.",eC="Luo uusi tili",tC="Rekisteröidy salasanalla",nC="Olet tällä hetkellä kirjautuneena sisään nimellä <0>{{email}}</0>",iC="Sähköposti",rC="Sähköpostiosoite",sC="Sähköpostiosoitteesi on vahvistettu",oC="Kirjoita nyt salasanasi kirjautuaksesi uudelleen",aC="Sähköposti on lähetetty osoitteeseen <0>{{email}}</0> jossa on vahvistuslinkki. Klikkaa linkkiä vahvistaaksesi sähköpostiosoitteesi ja asettaaksesi salasanan.",cC="Sähköpostivarmennus lähetetty",lC="Syötä koodi",uC="Lähetämme sinulle vahvistuslinkin varmistaaksemme, että omistat tämän sähköpostiosoitteen.",dC="Anna uusi salasana",pC="Anna salasana",fC="Anna sähköpostiosoitteesi ja salasanasi kirjautuaksesi sisään.",hC="Syötä salasanasi",gC="Taikalinkki on vanhentunut. Klikkaa alla olevaa painiketta saadaksesi uuden linkin sähköpostiisi.",_C="Hei! Päivitimme kirjautumiskokemuksemme. <0>Klikkaa tästä saadaksesi lisätietoja siitä.</0>",mC="Lähetä salasanan palautussähköposti",yC="Napsauta alla olevaa painiketta, niin lähetämme ohjeet salasanasi palauttamiseen.",vC="Salasanan palautussähköposti lähetetty",wC="Unohditko salasanan?",bC="Unohditko salasanan?",kC="Palaa takaisin",xC="Virheellinen salasana",SC=`Linkki ei ole enää voimassa.
193
217
 
194
218
  Varmista, että avaat kirjautumislinkin samalla selaimella, jolla aloitit kirjautumisen.
195
219
 
196
- Voit aloittaa uuden kirjautumisen klikkaamalla alla olevaa linkkiä.`,Nj="Virheellinen linkki",Rj="Kirjaudu sisään napsauttamalla painiketta",Tj="Kirjaudu sisään",Pj="Tai kirjoita koodi osoitteessa {{vendorName}} kirjautumisen loppuun saattamiseksi.",Uj="Kirjoita sähköpostiosoitteesi avataksesi tämän ohjelman osoitteessa {{service}}",Lj="Yhdistä tilisi {{service}}",Dj="Olet kirjautunut sisään nimellä",Vj="Kirjaudu sisään",Mj="Kirjoita sähköpostiosoitteesi kirjautuaksesi sisään.",Hj="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumiskoodin.",qj="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumislinkin.",Kj="Kirjaudu ulos",Fj="Ei, haluan käyttää toista tiliä",Wj="tai",Gj="Salasana",Jj="Salasana on nollattu",Zj="Menestys",Yj="Vaihda salasana tilillesi {{vendorName}} ",Xj="Vaihda salasana tilillesi {{vendorName}} ",Qj="Tietosuojakäytäntö",ez="Uudelleenohjaus",tz="Vahvista salasana",nz="Rekisteröi uusi salasana",iz="Lähetä koodi uudelleen",rz="Vaihda salasana",sz="Kirjoita alla oleva uusi salasanasi sähköpostitiliä varten: ",oz="Napsauta painiketta salasanasi palauttamiseksi",az="Napsauta painiketta salasanasi palauttamiseksi",cz="Nollaa salasanasi",lz="Vaihda salasana tilillesi {{vendorName}} ",uz="Nollaa salasana",dz="Lähetä",pz="Lähetä minulle uusi maaginen linkki",fz="Muista tarkistaa roskapostikansiosi, jos sähköposti ei ole saapunut.",hz="Aseta salasana",gz="Kirjaudu sisään",_z="Rekisteröityminen",mz="Rekisteröidy onnistuneesti",yz="Näyttää siltä, että Spotify-tilisi on tällä hetkellä yhdistetty toiseen Sesamy-tiliin. Mutta älä pelkää, me opastamme sinua prosessin läpi, jotta saat tämän korjattua.",vz="Siirry Spotifyn Content Access -sivulle",wz='Aloitetaan poistamalla Spotify-tilisi linkitys. Klikkaa alla olevaa painiketta siirtyäksesi Spotifyn Content Access -sivulle. Kun olet kirjautunut sisään Spotify-tilillesi, etsi Sesamy yhdistettyjen alustojen luettelosta. Napsauta "Unlink" Sesamyn logon vieressä.',bz="Vaihe 1: Poista Spotify-tilisi linkitys",kz="Kun olet onnistuneesti irrottanut Spotify-tilisi, voit yhdistää sen uudelleen Sesamyn kanssa. Toista vain aiemmin tekemäsi vaiheet, jotka johtivat sinut tälle sivulle.",xz="Vaihe 2: Yhdistä Spotify-tilisi uudelleen Sesamyn kanssa",Sz="Hups! Spotify-tilisi on jo linkitetty",Az="Jos sinulla on kysyttävää tai tarvitset apua, voit ottaa yhteyttä tukitiimiimme.",Iz="Ehdot ja edellytykset",jz="Sähköpostiosoitteesi on vahvistettava. Olemme lähettäneet uuden sähköpostiviestin sähköpostiisi.",zz="Käyttäjätiliä ei ole olemassa",Ez="Käyttäjätiliä ei ole olemassa",$z="Emme löytäneet käyttäjää, jolla on annettu sähköpostiosoite. Yritä uudelleen.",Cz="Yritä uudelleen.",Oz="Validoi koodi",Bz="Tarkista sähköpostin vahvistusohjeet postilaatikostasi.",Nz="Rekisteröitynyt",Rz="Vahvista sähköpostiosoitteesi napsauttamalla painiketta",Tz="Vahvista sähköpostiosoitteesi",Pz="Vahvista sähköpostiosoitteesi",Uz="Vahvista tili",Lz="Vahvista sähköpostiosoitteesi",Dz="Tarkista sähköpostisi osoitteesta <0>{{email}}</0> ja syötä lähettämämme kuusinumeroinen koodi.",Vz="Tervetuloa",Mz="Tervetuloa tilillesi {{vendorName}}!",Hz="Jatka tällä tilillä",qz="Kyllä, jatka {{text}}",Kz="Kyllä, jatka olemassa olevalla tilillä",Fz={"Server error: Invalid code":"Virheellinen koodi","Wrong email or verification code":{"":"Väärä sähköpostiosoite tai vahvistuskoodi."},account_detected:U6,account_with_sso_provider:L6,agree_to:D6,and:V6,callback_url_mismatch:M6,callback_url_not_allowed:H6,check_email_title:q6,click_to_sign_up_description:K6,code_email_enter_code:F6,code_email_subject:W6,code_email_title:G6,code_valid_30_minutes:J6,confirm_password:Z6,contact_support:Y6,contact_us:X6,continue:"Jatka",continue_social_login:Q6,continue_with:ej,continue_with_sso_provider_headline:tj,copyright:nj,copyright_sesamy:ij,create_account_description:rj,create_account_email_invalid:sj,create_account_passwords_didnt_match:oj,create_account_title:aj,create_account_weak_password:cj,create_new_account_link:lj,create_password_account_title:uj,currently_logged_in_as:dj,email:pj,email_placeholder:fj,email_validated:hj,email_validated_cta:gj,email_verification_for_signup_sent_description:_j,email_verification_for_signup_sent_title:mj,enter_a_code_btn:yj,enter_email_for_verification_description:vj,enter_new_password_placeholder:wj,enter_password:bj,enter_password_description:kj,enter_your_password_btn:xj,expired_code:Sj,fokus_info_message:Aj,forgot_password_cta:Ij,forgot_password_description:jj,forgot_password_email_sent:zj,forgot_password_link:Ej,forgot_password_title:$j,go_back:Cj,"invalid-email":"Virheellinen sähköpostiosoite",invalid_password:Oj,invalid_session_body:Bj,invalid_session_title:Nj,link_email_click_to_login:Rj,link_email_login:Tj,link_email_or_enter_code:Pj,link_page_body:Uj,link_page_headline:Lj,logged_in_as:Dj,login:Vj,login_description:Mj,login_description_code:Hj,login_description_link:qj,logout:Kj,no_use_another:Fj,or:Wj,password:Gj,password_has_been_reset:Jj,password_has_been_reset_title:Zj,password_reset_subject:Yj,password_reset_title:Xj,privacy_policy:Qj,redirecting:ez,reenter_new_password_placeholder:tz,register_password_account:nz,resend_code:iz,reset_password_cta:rz,reset_password_description:sz,reset_password_email_click_to_reset:oz,reset_password_email_cta:az,reset_password_email_reset:cz,reset_password_subject:lz,reset_password_title:uz,send:dz,send_me_a_new_magic_link:pz,sent_code_spam:fz,set_password:hz,sign_in:gz,signup:_z,signup_success:mz,spotify_already_linked_body:yz,spotify_already_linked_cta:vz,spotify_already_linked_step1_body:wz,spotify_already_linked_step1_title:bz,spotify_already_linked_step2_body:kz,spotify_already_linked_step2_title:xz,spotify_already_linked_title:Sz,support_info:Az,terms:Iz,unverified_email:jz,user_account_does_not_exist:zz,user_not_found:Ez,user_not_found_body:$z,user_not_found_cta:Cz,validate_code:Oz,validate_email_body:Bz,validate_email_title:Nz,verify_email_click_to_verify:Rz,verify_email_subject:Tz,verify_email_title:Pz,verify_email_verify:Uz,verify_your_email:Lz,we_sent_a_code_to:Dz,welcome:Vz,welcome_to_your_account:Mz,yes_continue:Hz,yes_continue_with:qz,yes_continue_with_existing_account:Kz};Ce.init({supportedLngs:["en","it","nb","sv","pl","cs","fi"],fallbackLng:"en",resources:{en:{translation:Fv},it:{translation:tk},nb:{translation:ux},sv:{translation:v2},pl:{translation:z4},cs:{translation:P6},fi:{translation:Fz}}});function Wz(n){const e=new o.OpenAPIHono;e.use(async(s,a)=>(s.env.data=lm(s,n.dataAdapter),a())),e.get("/",s=>s.json({name:"authhero"}));const t=u0();e.route("/api/v2",t);const i=Tm();e.route("/",i);const r=Pm();return e.route("/u",r),{app:e,managementApp:t,oauthApp:i,universalApp:r,createX509Certificate:Oa}}exports.Auth0Client=dd;exports.AuthorizationResponseMode=Tn;exports.AuthorizationResponseType=Rt;exports.CodeChallengeMethod=Yr;exports.GrantType=ur;exports.LogTypes=_e;exports.applicationInsertSchema=sr;exports.applicationSchema=Ft;exports.auth0UserResponseSchema=dt;exports.authParamsSchema=Ra;exports.baseUserSchema=Zr;exports.bordersSchema=hd;exports.brandingSchema=uo;exports.codeInsertSchema=ad;exports.codeSchema=xh;exports.codeTypeSchema=od;exports.colorsSchema=gd;exports.connectionInsertSchema=or;exports.connectionSchema=Et;exports.domainInsertSchema=cd;exports.domainSchema=Sh;exports.emailProviderSchema=Wi;exports.fontDetailsSchema=qt;exports.fontsSchema=_d;exports.hookInsertSchema=cr;exports.hookSchema=yn;exports.identitySchema=rd;exports.init=Wz;exports.jwksKeySchema=ld;exports.jwksSchema=Ta;exports.logSchema=lr;exports.loginInsertSchema=ud;exports.loginSchema=Ah;exports.openIDConfigurationSchema=po;exports.pageBackgroundSchema=md;exports.parseUserId=Eh;exports.passwordInsertSchema=pd;exports.passwordSchema=jh;exports.profileDataSchema=id;exports.promptSettingSchema=Fi;exports.samlpAddon=sd;exports.sessionInsertSchema=fd;exports.sessionSchema=Pa;exports.signingKeySchema=fo;exports.tenantInsertSchema=ar;exports.tenantSchema=wn;exports.themeInsertSchema=vd;exports.themeSchema=zh;exports.totalsSchema=Lt;exports.userInsertSchema=rr;exports.userResponseSchema=yh;exports.userSchema=Na;exports.vendorSettingsSchema=bh;exports.widgetSchema=yd;
220
+ Voit aloittaa uuden kirjautumisen klikkaamalla alla olevaa linkkiä.`,AC="Virheellinen linkki",IC="Kirjaudu sisään napsauttamalla painiketta",EC="Kirjaudu sisään",$C="Tai kirjoita koodi osoitteessa {{vendorName}} kirjautumisen loppuun saattamiseksi.",CC="Kirjoita sähköpostiosoitteesi avataksesi tämän ohjelman osoitteessa {{service}}",jC="Yhdistä tilisi {{service}}",zC="Olet kirjautunut sisään nimellä",NC="Kirjaudu sisään",OC="Kirjoita sähköpostiosoitteesi kirjautuaksesi sisään.",BC="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumiskoodin.",TC="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumislinkin.",RC="Kirjaudu ulos",PC="Ei, haluan käyttää toista tiliä",LC="tai",UC="Salasana",VC="Salasana on nollattu",MC="Menestys",HC="Vaihda salasana tilillesi {{vendorName}} ",DC="Vaihda salasana tilillesi {{vendorName}} ",FC="Tietosuojakäytäntö",qC="Uudelleenohjaus",KC="Vahvista salasana",WC="Rekisteröi uusi salasana",GC="Lähetä koodi uudelleen",JC="Vaihda salasana",ZC="Kirjoita alla oleva uusi salasanasi sähköpostitiliä varten: ",YC="Napsauta painiketta salasanasi palauttamiseksi",XC="Napsauta painiketta salasanasi palauttamiseksi",QC="Nollaa salasanasi",e3="Vaihda salasana tilillesi {{vendorName}} ",t3="Nollaa salasana",n3="Lähetä",i3="Lähetä minulle uusi maaginen linkki",r3="Muista tarkistaa roskapostikansiosi, jos sähköposti ei ole saapunut.",s3="Aseta salasana",o3="Kirjaudu sisään",a3="Rekisteröityminen",c3="Rekisteröidy onnistuneesti",l3="Näyttää siltä, että Spotify-tilisi on tällä hetkellä yhdistetty toiseen Sesamy-tiliin. Mutta älä pelkää, me opastamme sinua prosessin läpi, jotta saat tämän korjattua.",u3="Siirry Spotifyn Content Access -sivulle",d3='Aloitetaan poistamalla Spotify-tilisi linkitys. Klikkaa alla olevaa painiketta siirtyäksesi Spotifyn Content Access -sivulle. Kun olet kirjautunut sisään Spotify-tilillesi, etsi Sesamy yhdistettyjen alustojen luettelosta. Napsauta "Unlink" Sesamyn logon vieressä.',p3="Vaihe 1: Poista Spotify-tilisi linkitys",f3="Kun olet onnistuneesti irrottanut Spotify-tilisi, voit yhdistää sen uudelleen Sesamyn kanssa. Toista vain aiemmin tekemäsi vaiheet, jotka johtivat sinut tälle sivulle.",h3="Vaihe 2: Yhdistä Spotify-tilisi uudelleen Sesamyn kanssa",g3="Hups! Spotify-tilisi on jo linkitetty",_3="Jos sinulla on kysyttävää tai tarvitset apua, voit ottaa yhteyttä tukitiimiimme.",m3="Ehdot ja edellytykset",y3="Sähköpostiosoitteesi on vahvistettava. Olemme lähettäneet uuden sähköpostiviestin sähköpostiisi.",v3="Käyttäjätiliä ei ole olemassa",w3="Käyttäjätiliä ei ole olemassa",b3="Emme löytäneet käyttäjää, jolla on annettu sähköpostiosoite. Yritä uudelleen.",k3="Yritä uudelleen.",x3="Validoi koodi",S3="Tarkista sähköpostin vahvistusohjeet postilaatikostasi.",A3="Rekisteröitynyt",I3="Vahvista sähköpostiosoitteesi napsauttamalla painiketta",E3="Vahvista sähköpostiosoitteesi",$3="Vahvista sähköpostiosoitteesi",C3="Vahvista tili",j3="Vahvista sähköpostiosoitteesi",z3="Tarkista sähköpostisi osoitteesta <0>{{email}}</0> ja syötä lähettämämme kuusinumeroinen koodi.",N3="Tervetuloa",O3="Tervetuloa tilillesi {{vendorName}}!",B3="Jatka tällä tilillä",T3="Kyllä, jatka {{text}}",R3="Kyllä, jatka olemassa olevalla tilillä",P3={"Server error: Invalid code":"Virheellinen koodi","Wrong email or verification code":{"":"Väärä sähköpostiosoite tai vahvistuskoodi."},account_detected:C$,account_with_sso_provider:j$,agree_to:z$,and:N$,callback_url_mismatch:O$,callback_url_not_allowed:B$,check_email_title:T$,click_to_sign_up_description:R$,code_email_enter_code:P$,code_email_subject:L$,code_email_title:U$,code_valid_30_minutes:V$,confirm_password:M$,contact_support:H$,contact_us:D$,continue:"Jatka",continue_social_login:F$,continue_with:q$,continue_with_sso_provider_headline:K$,copyright:W$,copyright_sesamy:G$,create_account_description:J$,create_account_email_invalid:Z$,create_account_passwords_didnt_match:Y$,create_account_title:X$,create_account_weak_password:Q$,create_new_account_link:eC,create_password_account_title:tC,currently_logged_in_as:nC,email:iC,email_placeholder:rC,email_validated:sC,email_validated_cta:oC,email_verification_for_signup_sent_description:aC,email_verification_for_signup_sent_title:cC,enter_a_code_btn:lC,enter_email_for_verification_description:uC,enter_new_password_placeholder:dC,enter_password:pC,enter_password_description:fC,enter_your_password_btn:hC,expired_code:gC,fokus_info_message:_C,forgot_password_cta:mC,forgot_password_description:yC,forgot_password_email_sent:vC,forgot_password_link:wC,forgot_password_title:bC,go_back:kC,"invalid-email":"Virheellinen sähköpostiosoite",invalid_password:xC,invalid_session_body:SC,invalid_session_title:AC,link_email_click_to_login:IC,link_email_login:EC,link_email_or_enter_code:$C,link_page_body:CC,link_page_headline:jC,logged_in_as:zC,login:NC,login_description:OC,login_description_code:BC,login_description_link:TC,logout:RC,no_use_another:PC,or:LC,password:UC,password_has_been_reset:VC,password_has_been_reset_title:MC,password_reset_subject:HC,password_reset_title:DC,privacy_policy:FC,redirecting:qC,reenter_new_password_placeholder:KC,register_password_account:WC,resend_code:GC,reset_password_cta:JC,reset_password_description:ZC,reset_password_email_click_to_reset:YC,reset_password_email_cta:XC,reset_password_email_reset:QC,reset_password_subject:e3,reset_password_title:t3,send:n3,send_me_a_new_magic_link:i3,sent_code_spam:r3,set_password:s3,sign_in:o3,signup:a3,signup_success:c3,spotify_already_linked_body:l3,spotify_already_linked_cta:u3,spotify_already_linked_step1_body:d3,spotify_already_linked_step1_title:p3,spotify_already_linked_step2_body:f3,spotify_already_linked_step2_title:h3,spotify_already_linked_title:g3,support_info:_3,terms:m3,unverified_email:y3,user_account_does_not_exist:v3,user_not_found:w3,user_not_found_body:b3,user_not_found_cta:k3,validate_code:x3,validate_email_body:S3,validate_email_title:A3,verify_email_click_to_verify:I3,verify_email_subject:E3,verify_email_title:$3,verify_email_verify:C3,verify_your_email:j3,we_sent_a_code_to:z3,welcome:N3,welcome_to_your_account:O3,yes_continue:B3,yes_continue_with:T3,yes_continue_with_existing_account:R3};Ne.init({supportedLngs:["en","it","nb","sv","pl","cs","fi"],fallbackLng:"en",resources:{en:{translation:Pb},it:{translation:Kk},nb:{translation:t2},sv:{translation:uI},pl:{translation:v4},cs:{translation:$$},fi:{translation:P3}}});function L3(n){const e=new a.OpenAPIHono;e.use(async(s,o)=>(s.env.data=ev(s,n.dataAdapter),o())),e.get("/",s=>s.json({name:"authhero"}));const t=B0();e.route("/api/v2",t);const i=Ev();e.route("/",i);const r=$v();return e.route("/u",r),{app:e,managementApp:t,oauthApp:i,universalApp:r,createX509Certificate:Ua}}exports.Auth0Client=Cd;exports.AuthorizationResponseMode=nn;exports.AuthorizationResponseType=Pt;exports.CodeChallengeMethod=is;exports.GrantType=_r;exports.LogTypes=_e;exports.applicationInsertSchema=dr;exports.applicationSchema=Jt;exports.auth0UserResponseSchema=ft;exports.authParamsSchema=Fa;exports.baseUserSchema=ns;exports.bordersSchema=Nd;exports.brandingSchema=yo;exports.codeInsertSchema=Ad;exports.codeSchema=Wh;exports.codeTypeSchema=Sd;exports.colorsSchema=Od;exports.connectionInsertSchema=pr;exports.connectionSchema=zt;exports.domainInsertSchema=Id;exports.domainSchema=Gh;exports.emailProviderSchema=Qi;exports.fontDetailsSchema=Wt;exports.fontsSchema=Bd;exports.hookInsertSchema=hr;exports.hookSchema=xn;exports.identitySchema=kd;exports.init=L3;exports.jwksKeySchema=Ed;exports.jwksSchema=qa;exports.logSchema=gr;exports.loginInsertSchema=$d;exports.loginSchema=Jh;exports.openIDConfigurationSchema=vo;exports.pageBackgroundSchema=Td;exports.parseUserId=Qh;exports.passwordInsertSchema=jd;exports.passwordSchema=Yh;exports.profileDataSchema=bd;exports.promptSettingSchema=Xi;exports.samlpAddon=xd;exports.sessionInsertSchema=zd;exports.sessionSchema=Ka;exports.signingKeySchema=wo;exports.tenantInsertSchema=fr;exports.tenantSchema=An;exports.themeInsertSchema=Pd;exports.themeSchema=Xh;exports.totalsSchema=Mt;exports.userInsertSchema=ur;exports.userResponseSchema=Hh;exports.userSchema=Da;exports.vendorSettingsSchema=qh;exports.widgetSchema=Rd;