@undefineds.co/xpod 0.3.55 → 0.3.57
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/api/container/index.js +3 -0
- package/dist/api/container/index.js.map +1 -1
- package/dist/api/container/local.js +53 -13
- package/dist/api/container/local.js.map +1 -1
- package/dist/api/container/types.d.ts +6 -0
- package/dist/api/container/types.js.map +1 -1
- package/dist/api/handlers/AdminHandler.d.ts +15 -0
- package/dist/api/handlers/AdminHandler.js +128 -7
- package/dist/api/handlers/AdminHandler.js.map +1 -1
- package/dist/cli/commands/obj.d.ts +36 -0
- package/dist/cli/commands/obj.js +235 -30
- package/dist/cli/commands/obj.js.map +1 -1
- package/dist/components/components.jsonld +1 -0
- package/dist/components/context.jsonld +36 -0
- package/dist/edge/DdnsManager.d.ts +1 -1
- package/dist/edge/DdnsManager.js.map +1 -1
- package/dist/edge/reachability/P2PRealnetAcceptance.js +4 -3
- package/dist/edge/reachability/P2PRealnetAcceptance.js.map +1 -1
- package/dist/edge/reachability/TcpP2PSignalingSession.js +26 -17
- package/dist/edge/reachability/TcpP2PSignalingSession.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/tunnel/NgrokTunnelProvider.d.ts +46 -0
- package/dist/tunnel/NgrokTunnelProvider.js +344 -0
- package/dist/tunnel/NgrokTunnelProvider.js.map +1 -0
- package/dist/tunnel/NgrokTunnelProvider.jsonld +215 -0
- package/dist/tunnel/TunnelProvider.d.ts +2 -2
- package/dist/tunnel/TunnelProvider.js.map +1 -1
- package/dist/tunnel/index.d.ts +1 -0
- package/dist/tunnel/index.js +3 -1
- package/dist/tunnel/index.js.map +1 -1
- package/node_modules/@undefineds.co/drizzle-solid/dist/core/pod-database.d.ts +62 -0
- package/node_modules/@undefineds.co/drizzle-solid/dist/core/pod-database.d.ts.map +1 -1
- package/node_modules/@undefineds.co/drizzle-solid/dist/core/pod-database.js +197 -0
- package/node_modules/@undefineds.co/drizzle-solid/dist/core/pod-database.js.map +1 -1
- package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/pod-database.d.ts +62 -0
- package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/pod-database.d.ts.map +1 -1
- package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/pod-database.js +197 -0
- package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/pod-database.js.map +1 -1
- package/node_modules/@undefineds.co/drizzle-solid/dist/esm/pod.d.ts.map +1 -1
- package/node_modules/@undefineds.co/drizzle-solid/dist/pod.d.ts.map +1 -1
- package/node_modules/@undefineds.co/drizzle-solid/package.json +1 -1
- package/package.json +10 -6
- package/static/app/assets/{index-AaQ1qxhy.js → index-C1yksyT4.js} +28 -28
- package/static/app/assets/inrupt-smoke.js +2 -2
- package/static/app/assets/main.css +1 -1
- package/static/app/assets/main.js +10 -50
- package/static/app/auth.html +1 -1
- package/static/dashboard/assets/dashboard-BssaVKTn.css +1 -0
- package/static/dashboard/assets/dashboard-Ckuadl3C.js +54 -0
- package/static/dashboard/auth.html +1 -1
- package/static/dashboard/dashboard.html +2 -2
- package/static/dashboard/reachability.html +221 -0
- package/static/dashboard/reachability.svg +7 -0
- package/static/dashboard/reachability.webmanifest +18 -0
- package/static/dashboard/signal-pod.html +293 -0
- package/static/landing/index.html +1 -1
- package/static/dashboard/assets/dashboard-CTk9cn1-.js +0 -52
- package/static/dashboard/assets/dashboard-VQRsvXx9.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-C1yksyT4.js","assets/_commonjsHelpers-B-UnjaXt.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{g as Oi}from"./_commonjsHelpers-B-UnjaXt.js";const Hi="modulepreload",Bi=function(o){return"/app/"+o},Fn={},Mi=function(i,c,s){let y=Promise.resolve();if(c&&c.length>0){let w=function(h){return Promise.all(h.map(l=>Promise.resolve(l).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),b=d?.nonce||d?.getAttribute("nonce");y=w(c.map(h=>{if(h=Bi(h),h in Fn)return;Fn[h]=!0;const l=h.endsWith(".css"),u=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${u}`))return;const S=document.createElement("link");if(S.rel=l?"stylesheet":Hi,l||(S.as="script"),S.crossOrigin="",S.href=h,b&&S.setAttribute("nonce",b),document.head.appendChild(S),l)return new Promise((R,A)=>{S.addEventListener("load",R),S.addEventListener("error",()=>A(new Error(`Unable to preload CSS for ${h}`)))})}))}function v(d){const b=new Event("vite:preloadError",{cancelable:!0});if(b.payload=d,window.dispatchEvent(b),!b.defaultPrevented)throw d}return y.then(d=>{for(const b of d||[])b.status==="rejected"&&v(b.reason);return i().catch(v)})},Wt=crypto,zr=o=>o instanceof CryptoKey,bt=new TextEncoder,jt=new TextDecoder;function jn(...o){const i=o.reduce((y,{length:v})=>y+v,0),c=new Uint8Array(i);let s=0;for(const y of o)c.set(y,s),s+=y.length;return c}const ji=o=>{let i=o;typeof i=="string"&&(i=bt.encode(i));const c=32768,s=[];for(let y=0;y<i.length;y+=c)s.push(String.fromCharCode.apply(null,i.subarray(y,y+c)));return btoa(s.join(""))},yr=o=>ji(o).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),Ki=o=>{const i=atob(o),c=new Uint8Array(i.length);for(let s=0;s<i.length;s++)c[s]=i.charCodeAt(s);return c},Ut=o=>{let i=o;i instanceof Uint8Array&&(i=jt.decode(i)),i=i.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return Ki(i)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}};class $e extends Error{constructor(i,c){super(i,c),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}$e.code="ERR_JOSE_GENERIC";class vt extends $e{constructor(i,c,s="unspecified",y="unspecified"){super(i,{cause:{claim:s,reason:y,payload:c}}),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=s,this.reason=y,this.payload=c}}vt.code="ERR_JWT_CLAIM_VALIDATION_FAILED";class Hr extends $e{constructor(i,c,s="unspecified",y="unspecified"){super(i,{cause:{claim:s,reason:y,payload:c}}),this.code="ERR_JWT_EXPIRED",this.claim=s,this.reason=y,this.payload=c}}Hr.code="ERR_JWT_EXPIRED";class Kn extends $e{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}}Kn.code="ERR_JOSE_ALG_NOT_ALLOWED";class ut extends $e{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}}ut.code="ERR_JOSE_NOT_SUPPORTED";class Vi extends $e{constructor(i="decryption operation failed",c){super(i,c),this.code="ERR_JWE_DECRYPTION_FAILED"}}Vi.code="ERR_JWE_DECRYPTION_FAILED";class Wi extends $e{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}}Wi.code="ERR_JWE_INVALID";class Te extends $e{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}}Te.code="ERR_JWS_INVALID";class br extends $e{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}}br.code="ERR_JWT_INVALID";class Ji extends $e{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}}Ji.code="ERR_JWK_INVALID";class Gr extends $e{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}}Gr.code="ERR_JWKS_INVALID";class Yr extends $e{constructor(i="no applicable key found in the JSON Web Key Set",c){super(i,c),this.code="ERR_JWKS_NO_MATCHING_KEY"}}Yr.code="ERR_JWKS_NO_MATCHING_KEY";class Vn extends $e{constructor(i="multiple matching keys found in the JSON Web Key Set",c){super(i,c),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS"}}Vn.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";class Wn extends $e{constructor(i="request timed out",c){super(i,c),this.code="ERR_JWKS_TIMEOUT"}}Wn.code="ERR_JWKS_TIMEOUT";class Jn extends $e{constructor(i="signature verification failed",c){super(i,c),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}Jn.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";function St(o,i="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${i} must be ${o}`)}function tr(o,i){return o.name===i}function Rr(o){return parseInt(o.name.slice(4),10)}function qi(o){switch(o){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function $i(o,i){if(i.length&&!i.some(c=>o.usages.includes(c))){let c="CryptoKey does not support this operation, its usages must include ";if(i.length>2){const s=i.pop();c+=`one of ${i.join(", ")}, or ${s}.`}else i.length===2?c+=`one of ${i[0]} or ${i[1]}.`:c+=`${i[0]}.`;throw new TypeError(c)}}function zi(o,i,...c){switch(i){case"HS256":case"HS384":case"HS512":{if(!tr(o.algorithm,"HMAC"))throw St("HMAC");const s=parseInt(i.slice(2),10);if(Rr(o.algorithm.hash)!==s)throw St(`SHA-${s}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!tr(o.algorithm,"RSASSA-PKCS1-v1_5"))throw St("RSASSA-PKCS1-v1_5");const s=parseInt(i.slice(2),10);if(Rr(o.algorithm.hash)!==s)throw St(`SHA-${s}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!tr(o.algorithm,"RSA-PSS"))throw St("RSA-PSS");const s=parseInt(i.slice(2),10);if(Rr(o.algorithm.hash)!==s)throw St(`SHA-${s}`,"algorithm.hash");break}case"EdDSA":{if(o.algorithm.name!=="Ed25519"&&o.algorithm.name!=="Ed448")throw St("Ed25519 or Ed448");break}case"Ed25519":{if(!tr(o.algorithm,"Ed25519"))throw St("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!tr(o.algorithm,"ECDSA"))throw St("ECDSA");const s=qi(i);if(o.algorithm.namedCurve!==s)throw St(s,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}$i(o,c)}function qn(o,i,...c){if(c=c.filter(Boolean),c.length>2){const s=c.pop();o+=`one of type ${c.join(", ")}, or ${s}.`}else c.length===2?o+=`one of type ${c[0]} or ${c[1]}.`:o+=`of type ${c[0]}.`;return i==null?o+=` Received ${i}`:typeof i=="function"&&i.name?o+=` Received function ${i.name}`:typeof i=="object"&&i!=null&&i.constructor?.name&&(o+=` Received an instance of ${i.constructor.name}`),o}const Br=(o,...i)=>qn("Key must be ",o,...i);function $n(o,i,...c){return qn(`Key for the ${o} algorithm must be `,i,...c)}const zn=o=>zr(o)?!0:o?.[Symbol.toStringTag]==="KeyObject",ir=["CryptoKey"],Gn=(...o)=>{const i=o.filter(Boolean);if(i.length===0||i.length===1)return!0;let c;for(const s of i){const y=Object.keys(s);if(!c||c.size===0){c=new Set(y);continue}for(const v of y){if(c.has(v))return!1;c.add(v)}}return!0};function Gi(o){return typeof o=="object"&&o!==null}function kt(o){if(!Gi(o)||Object.prototype.toString.call(o)!=="[object Object]")return!1;if(Object.getPrototypeOf(o)===null)return!0;let i=o;for(;Object.getPrototypeOf(i)!==null;)i=Object.getPrototypeOf(i);return Object.getPrototypeOf(o)===i}const Yn=(o,i)=>{if(o.startsWith("RS")||o.startsWith("PS")){const{modulusLength:c}=i.algorithm;if(typeof c!="number"||c<2048)throw new TypeError(`${o} requires key modulusLength to be 2048 bits or larger`)}};function Jt(o){return kt(o)&&typeof o.kty=="string"}function Yi(o){return o.kty!=="oct"&&typeof o.d=="string"}function Xi(o){return o.kty!=="oct"&&typeof o.d>"u"}function Qi(o){return Jt(o)&&o.kty==="oct"&&typeof o.k=="string"}function Zi(o){let i,c;switch(o.kty){case"RSA":{switch(o.alg){case"PS256":case"PS384":case"PS512":i={name:"RSA-PSS",hash:`SHA-${o.alg.slice(-3)}`},c=o.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":i={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${o.alg.slice(-3)}`},c=o.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":i={name:"RSA-OAEP",hash:`SHA-${parseInt(o.alg.slice(-3),10)||1}`},c=o.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new ut('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(o.alg){case"ES256":i={name:"ECDSA",namedCurve:"P-256"},c=o.d?["sign"]:["verify"];break;case"ES384":i={name:"ECDSA",namedCurve:"P-384"},c=o.d?["sign"]:["verify"];break;case"ES512":i={name:"ECDSA",namedCurve:"P-521"},c=o.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":i={name:"ECDH",namedCurve:o.crv},c=o.d?["deriveBits"]:[];break;default:throw new ut('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(o.alg){case"Ed25519":i={name:"Ed25519"},c=o.d?["sign"]:["verify"];break;case"EdDSA":i={name:o.crv},c=o.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":i={name:o.crv},c=o.d?["deriveBits"]:[];break;default:throw new ut('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new ut('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:i,keyUsages:c}}const Xn=async o=>{if(!o.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:i,keyUsages:c}=Zi(o),s=[i,o.ext??!1,o.key_ops??c],y={...o};return delete y.alg,delete y.use,Wt.subtle.importKey("jwk",y,...s)},Qn=o=>Ut(o);let Ht,Bt;const Zn=o=>o?.[Symbol.toStringTag]==="KeyObject",wr=async(o,i,c,s,y=!1)=>{let v=o.get(i);if(v?.[s])return v[s];const d=await Xn({...c,alg:s});return y&&Object.freeze(i),v?v[s]=d:o.set(i,{[s]:d}),d},eo=(o,i)=>{if(Zn(o)){let c=o.export({format:"jwk"});return delete c.d,delete c.dp,delete c.dq,delete c.p,delete c.q,delete c.qi,c.k?Qn(c.k):(Bt||(Bt=new WeakMap),wr(Bt,o,c,i))}return Jt(o)?o.k?Ut(o.k):(Bt||(Bt=new WeakMap),wr(Bt,o,o,i,!0)):o},to=(o,i)=>{if(Zn(o)){let c=o.export({format:"jwk"});return c.k?Qn(c.k):(Ht||(Ht=new WeakMap),wr(Ht,o,c,i))}return Jt(o)?o.k?Ut(o.k):(Ht||(Ht=new WeakMap),wr(Ht,o,o,i,!0)):o},xn={normalizePublicKey:eo,normalizePrivateKey:to};async function ei(o,i){if(!kt(o))throw new TypeError("JWK must be an object");switch(i||(i=o.alg),o.kty){case"oct":if(typeof o.k!="string"||!o.k)throw new TypeError('missing "k" (Key Value) Parameter value');return Ut(o.k);case"RSA":if("oth"in o&&o.oth!==void 0)throw new ut('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return Xn({...o,alg:i});default:throw new ut('Unsupported "kty" (Key Type) Parameter value')}}const Mt=o=>o?.[Symbol.toStringTag],Mr=(o,i,c)=>{if(i.use!==void 0&&i.use!=="sig")throw new TypeError("Invalid key for this operation, when present its use must be sig");if(i.key_ops!==void 0&&i.key_ops.includes?.(c)!==!0)throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${c}`);if(i.alg!==void 0&&i.alg!==o)throw new TypeError(`Invalid key for this operation, when present its alg must be ${o}`);return!0},ro=(o,i,c,s)=>{if(!(i instanceof Uint8Array)){if(s&&Jt(i)){if(Qi(i)&&Mr(o,i,c))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!zn(i))throw new TypeError($n(o,i,...ir,"Uint8Array",s?"JSON Web Key":null));if(i.type!=="secret")throw new TypeError(`${Mt(i)} instances for symmetric algorithms must be of type "secret"`)}},no=(o,i,c,s)=>{if(s&&Jt(i))switch(c){case"sign":if(Yi(i)&&Mr(o,i,c))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"verify":if(Xi(i)&&Mr(o,i,c))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!zn(i))throw new TypeError($n(o,i,...ir,s?"JSON Web Key":null));if(i.type==="secret")throw new TypeError(`${Mt(i)} instances for asymmetric algorithms must not be of type "secret"`);if(c==="sign"&&i.type==="public")throw new TypeError(`${Mt(i)} instances for asymmetric algorithm signing must be of type "private"`);if(c==="decrypt"&&i.type==="public")throw new TypeError(`${Mt(i)} instances for asymmetric algorithm decryption must be of type "private"`);if(i.algorithm&&c==="verify"&&i.type==="private")throw new TypeError(`${Mt(i)} instances for asymmetric algorithm verifying must be of type "public"`);if(i.algorithm&&c==="encrypt"&&i.type==="private")throw new TypeError(`${Mt(i)} instances for asymmetric algorithm encryption must be of type "public"`)};function ti(o,i,c,s){i.startsWith("HS")||i==="dir"||i.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(i)?ro(i,c,s,o):no(i,c,s,o)}ti.bind(void 0,!1);const jr=ti.bind(void 0,!0);function ri(o,i,c,s,y){if(y.crit!==void 0&&s?.crit===void 0)throw new o('"crit" (Critical) Header Parameter MUST be integrity protected');if(!s||s.crit===void 0)return new Set;if(!Array.isArray(s.crit)||s.crit.length===0||s.crit.some(d=>typeof d!="string"||d.length===0))throw new o('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let v;c!==void 0?v=new Map([...Object.entries(c),...i.entries()]):v=i;for(const d of s.crit){if(!v.has(d))throw new ut(`Extension Header Parameter "${d}" is not recognized`);if(y[d]===void 0)throw new o(`Extension Header Parameter "${d}" is missing`);if(v.get(d)&&s[d]===void 0)throw new o(`Extension Header Parameter "${d}" MUST be integrity protected`)}return new Set(s.crit)}const io=(o,i)=>{if(i!==void 0&&(!Array.isArray(i)||i.some(c=>typeof c!="string")))throw new TypeError(`"${o}" option must be an array of strings`);if(i)return new Set(i)},oo=async o=>{if(o instanceof Uint8Array)return{kty:"oct",k:yr(o)};if(!zr(o))throw new TypeError(Br(o,...ir,"Uint8Array"));if(!o.extractable)throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK");const{ext:i,key_ops:c,alg:s,use:y,...v}=await Wt.subtle.exportKey("jwk",o);return v};async function so(o){return oo(o)}function ni(o,i){const c=`SHA-${o.slice(-3)}`;switch(o){case"HS256":case"HS384":case"HS512":return{hash:c,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:c,name:"RSA-PSS",saltLength:o.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:c,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:c,name:"ECDSA",namedCurve:i.namedCurve};case"Ed25519":return{name:"Ed25519"};case"EdDSA":return{name:i.name};default:throw new ut(`alg ${o} is not supported either by JOSE or your javascript runtime`)}}async function ii(o,i,c){if(c==="sign"&&(i=await xn.normalizePrivateKey(i,o)),c==="verify"&&(i=await xn.normalizePublicKey(i,o)),zr(i))return zi(i,o,c),i;if(i instanceof Uint8Array){if(!o.startsWith("HS"))throw new TypeError(Br(i,...ir));return Wt.subtle.importKey("raw",i,{hash:`SHA-${o.slice(-3)}`,name:"HMAC"},!1,[c])}throw new TypeError(Br(i,...ir,"Uint8Array","JSON Web Key"))}const ao=async(o,i,c,s)=>{const y=await ii(o,i,"verify");Yn(o,y);const v=ni(o,y.algorithm);try{return await Wt.subtle.verify(v,y,c,s)}catch{return!1}};async function uo(o,i,c){if(!kt(o))throw new Te("Flattened JWS must be an object");if(o.protected===void 0&&o.header===void 0)throw new Te('Flattened JWS must have either of the "protected" or "header" members');if(o.protected!==void 0&&typeof o.protected!="string")throw new Te("JWS Protected Header incorrect type");if(o.payload===void 0)throw new Te("JWS Payload missing");if(typeof o.signature!="string")throw new Te("JWS Signature missing or incorrect type");if(o.header!==void 0&&!kt(o.header))throw new Te("JWS Unprotected Header incorrect type");let s={};if(o.protected)try{const J=Ut(o.protected);s=JSON.parse(jt.decode(J))}catch{throw new Te("JWS Protected Header is invalid")}if(!Gn(s,o.header))throw new Te("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const y={...s,...o.header},v=ri(Te,new Map([["b64",!0]]),c?.crit,s,y);let d=!0;if(v.has("b64")&&(d=s.b64,typeof d!="boolean"))throw new Te('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:b}=y;if(typeof b!="string"||!b)throw new Te('JWS "alg" (Algorithm) Header Parameter missing or invalid');const w=c&&io("algorithms",c.algorithms);if(w&&!w.has(b))throw new Kn('"alg" (Algorithm) Header Parameter value not allowed');if(d){if(typeof o.payload!="string")throw new Te("JWS Payload must be a string")}else if(typeof o.payload!="string"&&!(o.payload instanceof Uint8Array))throw new Te("JWS Payload must be a string or an Uint8Array instance");let h=!1;typeof i=="function"?(i=await i(s,o),h=!0,jr(b,i,"verify"),Jt(i)&&(i=await ei(i,b))):jr(b,i,"verify");const l=jn(bt.encode(o.protected??""),bt.encode("."),typeof o.payload=="string"?bt.encode(o.payload):o.payload);let u;try{u=Ut(o.signature)}catch{throw new Te("Failed to base64url decode the signature")}if(!await ao(b,i,u,l))throw new Jn;let R;if(d)try{R=Ut(o.payload)}catch{throw new Te("Failed to base64url decode the payload")}else typeof o.payload=="string"?R=bt.encode(o.payload):R=o.payload;const A={payload:R};return o.protected!==void 0&&(A.protectedHeader=s),o.header!==void 0&&(A.unprotectedHeader=o.header),h?{...A,key:i}:A}async function co(o,i,c){if(o instanceof Uint8Array&&(o=jt.decode(o)),typeof o!="string")throw new Te("Compact JWS must be a string or Uint8Array");const{0:s,1:y,2:v,length:d}=o.split(".");if(d!==3)throw new Te("Invalid Compact JWS");const b=await uo({payload:y,protected:s,signature:v},i,c),w={payload:b.payload,protectedHeader:b.protectedHeader};return typeof i=="function"?{...w,key:b.key}:w}const Pt=o=>Math.floor(o.getTime()/1e3),oi=60,si=oi*60,Xr=si*24,lo=Xr*7,ho=Xr*365.25,fo=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,nr=o=>{const i=fo.exec(o);if(!i||i[4]&&i[1])throw new TypeError("Invalid time period format");const c=parseFloat(i[2]),s=i[3].toLowerCase();let y;switch(s){case"sec":case"secs":case"second":case"seconds":case"s":y=Math.round(c);break;case"minute":case"minutes":case"min":case"mins":case"m":y=Math.round(c*oi);break;case"hour":case"hours":case"hr":case"hrs":case"h":y=Math.round(c*si);break;case"day":case"days":case"d":y=Math.round(c*Xr);break;case"week":case"weeks":case"w":y=Math.round(c*lo);break;default:y=Math.round(c*ho);break}return i[1]==="-"||i[4]==="ago"?-y:y},An=o=>o.toLowerCase().replace(/^application\//,""),go=(o,i)=>typeof o=="string"?i.includes(o):Array.isArray(o)?i.some(Set.prototype.has.bind(new Set(o))):!1,po=(o,i,c={})=>{let s;try{s=JSON.parse(jt.decode(i))}catch{}if(!kt(s))throw new br("JWT Claims Set must be a top-level JSON object");const{typ:y}=c;if(y&&(typeof o.typ!="string"||An(o.typ)!==An(y)))throw new vt('unexpected "typ" JWT header value',s,"typ","check_failed");const{requiredClaims:v=[],issuer:d,subject:b,audience:w,maxTokenAge:h}=c,l=[...v];h!==void 0&&l.push("iat"),w!==void 0&&l.push("aud"),b!==void 0&&l.push("sub"),d!==void 0&&l.push("iss");for(const A of new Set(l.reverse()))if(!(A in s))throw new vt(`missing required "${A}" claim`,s,A,"missing");if(d&&!(Array.isArray(d)?d:[d]).includes(s.iss))throw new vt('unexpected "iss" claim value',s,"iss","check_failed");if(b&&s.sub!==b)throw new vt('unexpected "sub" claim value',s,"sub","check_failed");if(w&&!go(s.aud,typeof w=="string"?[w]:w))throw new vt('unexpected "aud" claim value',s,"aud","check_failed");let u;switch(typeof c.clockTolerance){case"string":u=nr(c.clockTolerance);break;case"number":u=c.clockTolerance;break;case"undefined":u=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:S}=c,R=Pt(S||new Date);if((s.iat!==void 0||h)&&typeof s.iat!="number")throw new vt('"iat" claim must be a number',s,"iat","invalid");if(s.nbf!==void 0){if(typeof s.nbf!="number")throw new vt('"nbf" claim must be a number',s,"nbf","invalid");if(s.nbf>R+u)throw new vt('"nbf" claim timestamp check failed',s,"nbf","check_failed")}if(s.exp!==void 0){if(typeof s.exp!="number")throw new vt('"exp" claim must be a number',s,"exp","invalid");if(s.exp<=R-u)throw new Hr('"exp" claim timestamp check failed',s,"exp","check_failed")}if(h){const A=R-s.iat,J=typeof h=="number"?h:nr(h);if(A-u>J)throw new Hr('"iat" claim timestamp check failed (too far in the past)',s,"iat","check_failed");if(A<0-u)throw new vt('"iat" claim timestamp check failed (it should be in the past)',s,"iat","check_failed")}return s};async function yo(o,i,c){const s=await co(o,i,c);if(s.protectedHeader.crit?.includes("b64")&&s.protectedHeader.b64===!1)throw new br("JWTs MUST NOT use unencoded payload");const v={payload:po(s.protectedHeader,s.payload,c),protectedHeader:s.protectedHeader};return typeof i=="function"?{...v,key:s.key}:v}const vo=async(o,i,c)=>{const s=await ii(o,i,"sign");Yn(o,s);const y=await Wt.subtle.sign(ni(o,s.algorithm),s,c);return new Uint8Array(y)};class mo{constructor(i){if(!(i instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=i}setProtectedHeader(i){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=i,this}setUnprotectedHeader(i){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=i,this}async sign(i,c){if(!this._protectedHeader&&!this._unprotectedHeader)throw new Te("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!Gn(this._protectedHeader,this._unprotectedHeader))throw new Te("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const s={...this._protectedHeader,...this._unprotectedHeader},y=ri(Te,new Map([["b64",!0]]),c?.crit,this._protectedHeader,s);let v=!0;if(y.has("b64")&&(v=this._protectedHeader.b64,typeof v!="boolean"))throw new Te('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:d}=s;if(typeof d!="string"||!d)throw new Te('JWS "alg" (Algorithm) Header Parameter missing or invalid');jr(d,i,"sign");let b=this._payload;v&&(b=bt.encode(yr(b)));let w;this._protectedHeader?w=bt.encode(yr(JSON.stringify(this._protectedHeader))):w=bt.encode("");const h=jn(w,bt.encode("."),b),l=await vo(d,i,h),u={signature:yr(l),payload:""};return v&&(u.payload=jt.decode(b)),this._unprotectedHeader&&(u.header=this._unprotectedHeader),this._protectedHeader&&(u.protected=jt.decode(w)),u}}class _o{constructor(i){this._flattened=new mo(i)}setProtectedHeader(i){return this._flattened.setProtectedHeader(i),this}async sign(i,c){const s=await this._flattened.sign(i,c);if(s.payload===void 0)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${s.protected}.${s.payload}.${s.signature}`}}function Ct(o,i){if(!Number.isFinite(i))throw new TypeError(`Invalid ${o} input`);return i}class wo{constructor(i={}){if(!kt(i))throw new TypeError("JWT Claims Set MUST be an object");this._payload=i}setIssuer(i){return this._payload={...this._payload,iss:i},this}setSubject(i){return this._payload={...this._payload,sub:i},this}setAudience(i){return this._payload={...this._payload,aud:i},this}setJti(i){return this._payload={...this._payload,jti:i},this}setNotBefore(i){return typeof i=="number"?this._payload={...this._payload,nbf:Ct("setNotBefore",i)}:i instanceof Date?this._payload={...this._payload,nbf:Ct("setNotBefore",Pt(i))}:this._payload={...this._payload,nbf:Pt(new Date)+nr(i)},this}setExpirationTime(i){return typeof i=="number"?this._payload={...this._payload,exp:Ct("setExpirationTime",i)}:i instanceof Date?this._payload={...this._payload,exp:Ct("setExpirationTime",Pt(i))}:this._payload={...this._payload,exp:Pt(new Date)+nr(i)},this}setIssuedAt(i){return typeof i>"u"?this._payload={...this._payload,iat:Pt(new Date)}:i instanceof Date?this._payload={...this._payload,iat:Ct("setIssuedAt",Pt(i))}:typeof i=="string"?this._payload={...this._payload,iat:Ct("setIssuedAt",Pt(new Date)+nr(i))}:this._payload={...this._payload,iat:Ct("setIssuedAt",i)},this}}class So extends wo{setProtectedHeader(i){return this._protectedHeader=i,this}async sign(i,c){const s=new _o(bt.encode(JSON.stringify(this._payload)));if(s.setProtectedHeader(this._protectedHeader),Array.isArray(this._protectedHeader?.crit)&&this._protectedHeader.crit.includes("b64")&&this._protectedHeader.b64===!1)throw new br("JWTs MUST NOT use unencoded payload");return s.sign(i,c)}}function bo(o){switch(typeof o=="string"&&o.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new ut('Unsupported "alg" value for a JSON Web Key Set')}}function Eo(o){return o&&typeof o=="object"&&Array.isArray(o.keys)&&o.keys.every(Fo)}function Fo(o){return kt(o)}function ai(o){return typeof structuredClone=="function"?structuredClone(o):JSON.parse(JSON.stringify(o))}class xo{constructor(i){if(this._cached=new WeakMap,!Eo(i))throw new Gr("JSON Web Key Set malformed");this._jwks=ai(i)}async getKey(i,c){const{alg:s,kid:y}={...i,...c?.header},v=bo(s),d=this._jwks.keys.filter(h=>{let l=v===h.kty;if(l&&typeof y=="string"&&(l=y===h.kid),l&&typeof h.alg=="string"&&(l=s===h.alg),l&&typeof h.use=="string"&&(l=h.use==="sig"),l&&Array.isArray(h.key_ops)&&(l=h.key_ops.includes("verify")),l)switch(s){case"ES256":l=h.crv==="P-256";break;case"ES256K":l=h.crv==="secp256k1";break;case"ES384":l=h.crv==="P-384";break;case"ES512":l=h.crv==="P-521";break;case"Ed25519":l=h.crv==="Ed25519";break;case"EdDSA":l=h.crv==="Ed25519"||h.crv==="Ed448";break}return l}),{0:b,length:w}=d;if(w===0)throw new Yr;if(w!==1){const h=new Vn,{_cached:l}=this;throw h[Symbol.asyncIterator]=async function*(){for(const u of d)try{yield await kn(l,u,s)}catch{}},h}return kn(this._cached,b,s)}}async function kn(o,i,c){const s=o.get(i)||o.set(i,{}).get(i);if(s[c]===void 0){const y=await ei({...i,ext:!0},c);if(y instanceof Uint8Array||y.type!=="public")throw new Gr("JSON Web Key Set members must be public keys");s[c]=y}return s[c]}function Pn(o){const i=new xo(o),c=async(s,y)=>i.getKey(s,y);return Object.defineProperties(c,{jwks:{value:()=>ai(i._jwks),enumerable:!0,configurable:!1,writable:!1}}),c}const Ao=async(o,i,c)=>{let s,y,v=!1;typeof AbortController=="function"&&(s=new AbortController,y=setTimeout(()=>{v=!0,s.abort()},i));const d=await fetch(o.href,{signal:s?s.signal:void 0,redirect:"manual",headers:c.headers}).catch(b=>{throw v?new Wn:b});if(y!==void 0&&clearTimeout(y),d.status!==200)throw new $e("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await d.json()}catch{throw new $e("Failed to parse the JSON Web Key Set HTTP response as JSON")}};function ko(){return typeof WebSocketPair<"u"||typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"||typeof EdgeRuntime<"u"&&EdgeRuntime==="vercel"}let Kr;(typeof navigator>"u"||!navigator.userAgent?.startsWith?.("Mozilla/5.0 "))&&(Kr="jose/v5.10.0");const Cr=Symbol();function Po(o,i){return!(typeof o!="object"||o===null||!("uat"in o)||typeof o.uat!="number"||Date.now()-o.uat>=i||!("jwks"in o)||!kt(o.jwks)||!Array.isArray(o.jwks.keys)||!Array.prototype.every.call(o.jwks.keys,kt))}class To{constructor(i,c){if(!(i instanceof URL))throw new TypeError("url must be an instance of URL");this._url=new URL(i.href),this._options={agent:c?.agent,headers:c?.headers},this._timeoutDuration=typeof c?.timeoutDuration=="number"?c?.timeoutDuration:5e3,this._cooldownDuration=typeof c?.cooldownDuration=="number"?c?.cooldownDuration:3e4,this._cacheMaxAge=typeof c?.cacheMaxAge=="number"?c?.cacheMaxAge:6e5,c?.[Cr]!==void 0&&(this._cache=c?.[Cr],Po(c?.[Cr],this._cacheMaxAge)&&(this._jwksTimestamp=this._cache.uat,this._local=Pn(this._cache.jwks)))}coolingDown(){return typeof this._jwksTimestamp=="number"?Date.now()<this._jwksTimestamp+this._cooldownDuration:!1}fresh(){return typeof this._jwksTimestamp=="number"?Date.now()<this._jwksTimestamp+this._cacheMaxAge:!1}async getKey(i,c){(!this._local||!this.fresh())&&await this.reload();try{return await this._local(i,c)}catch(s){if(s instanceof Yr&&this.coolingDown()===!1)return await this.reload(),this._local(i,c);throw s}}async reload(){this._pendingFetch&&ko()&&(this._pendingFetch=void 0);const i=new Headers(this._options.headers);Kr&&!i.has("User-Agent")&&(i.set("User-Agent",Kr),this._options.headers=Object.fromEntries(i.entries())),this._pendingFetch||(this._pendingFetch=Ao(this._url,this._timeoutDuration,this._options).then(c=>{this._local=Pn(c),this._cache&&(this._cache.uat=Date.now(),this._cache.jwks=c),this._jwksTimestamp=Date.now(),this._pendingFetch=void 0}).catch(c=>{throw this._pendingFetch=void 0,c})),await this._pendingFetch}}function Io(o,i){const c=new To(o,i),s=async(y,v)=>c.getKey(y,v);return Object.defineProperties(s,{coolingDown:{get:()=>c.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>c.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>c.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>!!c._pendingFetch,enumerable:!0,configurable:!1},jwks:{value:()=>c._local?.jwks(),enumerable:!0,configurable:!1,writable:!1}}),s}function Ur(o){const i=o?.modulusLength??2048;if(typeof i!="number"||i<2048)throw new ut("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");return i}async function Ro(o,i){let c,s;switch(o){case"PS256":case"PS384":case"PS512":c={name:"RSA-PSS",hash:`SHA-${o.slice(-3)}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:Ur(i)},s=["sign","verify"];break;case"RS256":case"RS384":case"RS512":c={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${o.slice(-3)}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:Ur(i)},s=["sign","verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":c={name:"RSA-OAEP",hash:`SHA-${parseInt(o.slice(-3),10)||1}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:Ur(i)},s=["decrypt","unwrapKey","encrypt","wrapKey"];break;case"ES256":c={name:"ECDSA",namedCurve:"P-256"},s=["sign","verify"];break;case"ES384":c={name:"ECDSA",namedCurve:"P-384"},s=["sign","verify"];break;case"ES512":c={name:"ECDSA",namedCurve:"P-521"},s=["sign","verify"];break;case"Ed25519":c={name:"Ed25519"},s=["sign","verify"];break;case"EdDSA":{s=["sign","verify"];const y="Ed25519";switch(y){case"Ed25519":case"Ed448":c={name:y};break;default:throw new ut("Invalid or unsupported crv option provided")}break}case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{s=["deriveKey","deriveBits"];const y="P-256";switch(y){case"P-256":case"P-384":case"P-521":{c={name:"ECDH",namedCurve:y};break}case"X25519":case"X448":c={name:y};break;default:throw new ut("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448")}break}default:throw new ut('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return Wt.subtle.generateKey(c,!1,s)}async function Co(o,i){return Ro(o,i)}const qe=[];for(let o=0;o<256;++o)qe.push((o+256).toString(16).slice(1));function Uo(o,i=0){return(qe[o[i+0]]+qe[o[i+1]]+qe[o[i+2]]+qe[o[i+3]]+"-"+qe[o[i+4]]+qe[o[i+5]]+"-"+qe[o[i+6]]+qe[o[i+7]]+"-"+qe[o[i+8]]+qe[o[i+9]]+"-"+qe[o[i+10]]+qe[o[i+11]]+qe[o[i+12]]+qe[o[i+13]]+qe[o[i+14]]+qe[o[i+15]]).toLowerCase()}let Dr;const Do=new Uint8Array(16);function Lo(){if(!Dr){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Dr=crypto.getRandomValues.bind(crypto)}return Dr(Do)}const No=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Tn={randomUUID:No};function Qr(o,i,c){if(Tn.randomUUID&&!o)return Tn.randomUUID();o=o||{};const s=o.random??o.rng?.()??Lo();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,Uo(s)}const ui="solidClientAuthn:",Sr=["ES256","RS256"],Ve={ERROR:"error",LOGIN:"login",LOGOUT:"logout",NEW_REFRESH_TOKEN:"newRefreshToken",NEW_TOKENS:"newTokens",AUTHORIZATION_REQUEST:"authorizationRequest",SESSION_EXPIRED:"sessionExpired",SESSION_EXTENDED:"sessionExtended",SESSION_RESTORED:"sessionRestore",TIMEOUT_SET:"timeoutSet"},In=5,Oo="openid",Ho="offline_access",Bo="webid",Rn=[Oo,Ho,Bo];class Mo{handleables;constructor(i){this.handleables=i,this.handleables=i}async getProperHandler(i){const c=await Promise.all(this.handleables.map(s=>s.canHandle(...i)));for(let s=0;s<c.length;s+=1)if(c[s])return this.handleables[s];return null}async canHandle(...i){return await this.getProperHandler(i)!==null}async handle(...i){const c=await this.getProperHandler(i);if(c)return c.handle(...i);throw new Error(`[${this.constructor.name}] cannot find a suitable handler for: ${i.map(s=>{try{return JSON.stringify(s)}catch{return s.toString()}}).join(", ")}`)}}async function ci(o,i,c,s){let y,v;try{const{payload:d}=await yo(o,Io(new URL(i)),{issuer:c,audience:s});y=d}catch(d){throw new Error(`Token verification failed: ${d.stack}`)}if(typeof y.azp=="string"&&(v=y.azp),typeof y.webid=="string")return{webId:y.webid,clientId:v};if(typeof y.sub!="string")throw new Error(`The token ${JSON.stringify(y)} is invalid: it has no 'webid' claim and no 'sub' claim.`);try{return new URL(y.sub),{webId:y.sub,clientId:v}}catch(d){throw new Error(`The token has no 'webid' claim, and its 'sub' claim of [${y.sub}] is invalid as a URL - error [${d}].`)}}function jo(o){return Array.isArray(o)?Array.from(new Set([...Rn,...o.filter(i=>typeof i=="string"&&!i.includes(" "))])):Rn}function li(o){try{const i=new URL(o),c=!i.searchParams.has("code")&&!i.searchParams.has("state"),s=i.hash==="";return c&&s}catch{return!1}}function hi(o){const i=new URL(o);return i.searchParams.delete("state"),i.searchParams.delete("code"),i.searchParams.delete("error"),i.searchParams.delete("error_description"),i.searchParams.delete("iss"),i}function Ko(o,i){return typeof o=="boolean"?!!o:!!i}class Vo{storageUtility;redirector;constructor(i,c){this.storageUtility=i,this.redirector=c,this.storageUtility=i,this.redirector=c}parametersGuard=i=>i.issuerConfiguration.grantTypesSupported!==void 0&&i.issuerConfiguration.grantTypesSupported.indexOf("authorization_code")>-1&&i.redirectUrl!==void 0;async canHandle(i){return this.parametersGuard(i)}async setupRedirectHandler({oidcLoginOptions:i,state:c,codeVerifier:s,targetUrl:y}){if(!this.parametersGuard(i))throw new Error("The authorization code grant requires a redirectUrl.");await Promise.all([this.storageUtility.setForUser(c,{sessionId:i.sessionId}),this.storageUtility.setForUser(i.sessionId,{codeVerifier:s,issuer:i.issuer.toString(),redirectUrl:i.redirectUrl,dpop:(!!i.dpop).toString(),keepAlive:Ko(i.keepAlive,!0).toString()})]),this.redirector.redirect(y,{handleRedirect:i.handleRedirect})}}class Wo{sessionInfoManager;constructor(i){this.sessionInfoManager=i,this.sessionInfoManager=i}async canHandle(){return!0}async handle(i){await this.sessionInfoManager.clear(i)}}class Jo{redirector;constructor(i){this.redirector=i,this.redirector=i}async canHandle(i,c){return c?.logoutType==="idp"}async handle(i,c){if(c?.logoutType!=="idp")throw new Error("Attempting to call idp logout handler to perform app logout");if(c.toLogoutUrl===void 0)throw new Error("Cannot perform IDP logout. Did you log in using the OIDC authentication flow?");this.redirector.redirect(c.toLogoutUrl(c),{handleRedirect:c.handleRedirect})}}class qo{handlers;constructor(i,c){this.handlers=[new Wo(i),new Jo(c)]}async canHandle(){return!0}async handle(i,c){for(const s of this.handlers)await s.canHandle(i,c)&&await s.handle(i,c)}}function di(){return{isLoggedIn:!1,sessionId:Qr(),fetch:(...o)=>fetch(...o)}}async function fi(o,i){await Promise.all([i.deleteAllUserData(o,{secure:!1}),i.deleteAllUserData(o,{secure:!0})])}class $o{storageUtility;constructor(i){this.storageUtility=i,this.storageUtility=i}update(i,c){throw new Error("Not Implemented")}set(i,c){throw new Error("Not Implemented")}get(i){throw new Error("Not implemented")}async getAll(){throw new Error("Not implemented")}async clear(i){return fi(i,this.storageUtility)}async register(i){throw new Error("Not implemented")}async getRegisteredSessionIdAll(){throw new Error("Not implemented")}async clearAll(){throw new Error("Not implemented")}async setOidcContext(i,c){throw new Error("Not implemented")}}function zo({endSessionEndpoint:o,idTokenHint:i,postLogoutRedirectUri:c,state:s}){const y=new URL(o);return i!==void 0&&y.searchParams.append("id_token_hint",i),c!==void 0&&(y.searchParams.append("post_logout_redirect_uri",c),s!==void 0&&y.searchParams.append("state",s)),y.toString()}function Go({endSessionEndpoint:o,idTokenHint:i}){if(o!==void 0)return function({state:s,postLogoutUrl:y}){return zo({endSessionEndpoint:o,idTokenHint:i,state:s,postLogoutRedirectUri:y})}}function Yo(o){return typeof o=="string"&&["DPoP","Bearer"].includes(o)}function gi(o){try{return new URL(o),!0}catch{return!1}}function Xo(o,i){return i.find(c=>o.includes(c))??null}function Qo(o){return o.clientId!==void 0&&!gi(o.clientId)}function Zo(o,i){return i.scopesSupported.includes("webid")&&o.clientId!==void 0&&gi(o.clientId)}function es(o){return typeof o=="string"&&["dynamic","static","solid-oidc"].includes(o)}async function ts(o,i,c,s){let y;if(Zo(o,i))y={clientId:o.clientId,clientName:o.clientName,clientType:"solid-oidc"};else if(Qo(o))y={clientId:o.clientId,clientSecret:o.clientSecret,clientName:o.clientName,clientType:"static"};else return s.getClient({sessionId:o.sessionId,clientName:o.clientName,redirectUrl:o.redirectUrl},i);const v={clientId:y.clientId,clientType:y.clientType};return y.clientType==="static"&&(v.clientSecret=y.clientSecret),y.clientName&&(v.clientName=y.clientName),await c.setForUser(o.sessionId,v),y}const Cn=(o,i)=>fetch(o,i);let rs=class{loginHandler;redirectHandler;logoutHandler;sessionInfoManager;issuerConfigFetcher;boundLogout;constructor(i,c,s,y,v){this.loginHandler=i,this.redirectHandler=c,this.logoutHandler=s,this.sessionInfoManager=y,this.issuerConfigFetcher=v,this.loginHandler=i,this.redirectHandler=c,this.logoutHandler=s,this.sessionInfoManager=y,this.issuerConfigFetcher=v}fetch=Cn;logout=async(i,c)=>{await this.logoutHandler.handle(i,c?.logoutType==="idp"?{...c,toLogoutUrl:this.boundLogout}:c),this.fetch=Cn,delete this.boundLogout};getSessionInfo=async i=>this.sessionInfoManager.get(i);getAllSessionInfo=async()=>this.sessionInfoManager.getAll()};async function pi(o,i,c){try{const[s,y,v,d,b]=await Promise.all([i.getForUser(o,"issuer",{errorIfNull:!0}),i.getForUser(o,"codeVerifier"),i.getForUser(o,"redirectUrl"),i.getForUser(o,"dpop",{errorIfNull:!0}),i.getForUser(o,"keepAlive")]);await i.deleteForUser(o,"codeVerifier");const w=await c.fetchConfig(s);return{codeVerifier:y,redirectUrl:v,issuerConfig:w,dpop:d==="true",keepAlive:typeof b=="string"?b==="true":!0}}catch(s){throw new Error(`Failed to retrieve OIDC context from storage associated with session [${o}]: ${s}`)}}async function ns(o,i,c,s,y,v,d,b){c!==void 0&&await o.setForUser(i,{webId:c},{secure:d}),s!==void 0&&await o.setForUser(i,{clientId:s},{secure:d}),await o.setForUser(i,{isLoggedIn:y},{secure:d})}class is{secureStorage;insecureStorage;constructor(i,c){this.secureStorage=i,this.insecureStorage=c,this.secureStorage=i,this.insecureStorage=c}getKey(i){return`solidClientAuthenticationUser:${i}`}async getUserData(i,c){const s=await(c?this.secureStorage:this.insecureStorage).get(this.getKey(i));if(s===void 0)return{};try{return JSON.parse(s)}catch{throw new Error(`Data for user [${i}] in [${c?"secure":"unsecure"}] storage is corrupted - expected valid JSON, but got: ${s}`)}}async setUserData(i,c,s){await(s?this.secureStorage:this.insecureStorage).set(this.getKey(i),JSON.stringify(c))}async get(i,c){const s=await(c?.secure?this.secureStorage:this.insecureStorage).get(i);if(s===void 0&&c?.errorIfNull)throw new Error(`[${i}] is not stored`);return s}async set(i,c,s){return(s?.secure?this.secureStorage:this.insecureStorage).set(i,c)}async delete(i,c){return(c?.secure?this.secureStorage:this.insecureStorage).delete(i)}async getForUser(i,c,s){const y=await this.getUserData(i,s?.secure);let v;if((!y||!y[c])&&(v=void 0),v=y[c],v===void 0&&s?.errorIfNull)throw new Error(`Field [${c}] for user [${i}] is not stored`);return v||void 0}async setForUser(i,c,s){let y;try{y=await this.getUserData(i,s?.secure)}catch{y={}}await this.setUserData(i,{...y,...c},s?.secure)}async deleteForUser(i,c,s){const y=await this.getUserData(i,s?.secure);delete y[c],await this.setUserData(i,y,s?.secure)}async deleteAllUserData(i,c){await(c?.secure?this.secureStorage:this.insecureStorage).delete(this.getKey(i))}}class os{map={};async get(i){return this.map[i]||void 0}async set(i,c){this.map[i]=c}async delete(i){delete this.map[i]}}class Vr extends Error{constructor(i){super(i)}}class rr extends Error{missingFields;constructor(i){super(`Invalid response from OIDC provider: missing fields ${i}`),this.missingFields=i}}class yi extends Error{error;errorDescription;constructor(i,c,s){super(i),this.error=c,this.errorDescription=s}}function ss(o){const i=new URL(o);return new URL(i.pathname,i.origin).toString()}async function Zr(o,i,c){return new So({htu:ss(o),htm:i.toUpperCase(),jti:Qr()}).setProtectedHeader({alg:Sr[0],jwk:c.publicKey,typ:"dpop+jwt"}).setIssuedAt().sign(c.privateKey,{})}async function as(){const{privateKey:o,publicKey:i}=await Co(Sr[0]),c={privateKey:o,publicKey:await so(i)};return[c.publicKey.alg]=Sr,c}const vi=600;function us(o){return[401,403].includes(o)}async function cs(o,i,c,s){const y=new Headers(s?.headers);return y.set("Authorization",`DPoP ${i}`),y.set("DPoP",await Zr(o,s?.method??"get",c)),{...s,headers:y}}async function ls(o,i,c,s){if(c!==void 0)return cs(o,i,c,s);const y=new Headers(s?.headers);return y.set("Authorization",`Bearer ${i}`),{...s,headers:y}}async function Un(o,i,c,s,y=fetch){return y(i,await ls(i.toString(),o,s,c))}async function hs(o,i,c){const s=await o.tokenRefresher.refresh(o.sessionId,o.refreshToken,i);return c?.emit(Ve.SESSION_EXTENDED,s.expiresIn??vi),{accessToken:s.accessToken,refreshToken:s.refreshToken,expiresIn:s.expiresIn}}const Lr=o=>o!==void 0?o-In>0?o-In:o:vi;function ds(o,i){let c=o,s;const y=i?.refreshOptions;if(y!==void 0){const v=async()=>{try{const{accessToken:d,refreshToken:b,expiresIn:w}=await hs(y,i.dpopKey,i.eventEmitter);c=d,b!==void 0&&(y.refreshToken=b),clearTimeout(s),s=setTimeout(v,Lr(w)*1e3),i.eventEmitter?.emit(Ve.TIMEOUT_SET,s)}catch(d){d instanceof yi&&(i?.eventEmitter?.emit(Ve.ERROR,d.error,d.errorDescription),i?.eventEmitter?.emit(Ve.SESSION_EXPIRED)),d instanceof rr&&d.missingFields.includes("access_token")&&i?.eventEmitter?.emit(Ve.SESSION_EXPIRED)}};s=setTimeout(v,Lr(i.expiresIn)*1e3),i.eventEmitter?.emit(Ve.TIMEOUT_SET,s)}else if(i!==void 0&&i.eventEmitter!==void 0){const v=setTimeout(()=>{i.eventEmitter.emit(Ve.SESSION_EXPIRED)},Lr(i.expiresIn)*1e3);i.eventEmitter.emit(Ve.TIMEOUT_SET,v)}return async(v,d)=>{let b=await Un(c,v,d,i?.dpopKey,i?.fetch);const w=!b.ok&&!us(b.status);return b.ok||w||b.url!==v&&i?.dpopKey!==void 0&&(b=await Un(c,b.url,d,i.dpopKey,i.fetch)),b}}var gr={exports:{}},Dn;function fs(){if(Dn)return gr.exports;Dn=1;var o=typeof Reflect=="object"?Reflect:null,i=o&&typeof o.apply=="function"?o.apply:function(B,T,I){return Function.prototype.apply.call(B,T,I)},c;o&&typeof o.ownKeys=="function"?c=o.ownKeys:Object.getOwnPropertySymbols?c=function(B){return Object.getOwnPropertyNames(B).concat(Object.getOwnPropertySymbols(B))}:c=function(B){return Object.getOwnPropertyNames(B)};function s(x){console&&console.warn&&console.warn(x)}var y=Number.isNaN||function(B){return B!==B};function v(){v.init.call(this)}gr.exports=v,gr.exports.once=C,v.EventEmitter=v,v.prototype._events=void 0,v.prototype._eventsCount=0,v.prototype._maxListeners=void 0;var d=10;function b(x){if(typeof x!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof x)}Object.defineProperty(v,"defaultMaxListeners",{enumerable:!0,get:function(){return d},set:function(x){if(typeof x!="number"||x<0||y(x))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+x+".");d=x}}),v.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},v.prototype.setMaxListeners=function(B){if(typeof B!="number"||B<0||y(B))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+B+".");return this._maxListeners=B,this};function w(x){return x._maxListeners===void 0?v.defaultMaxListeners:x._maxListeners}v.prototype.getMaxListeners=function(){return w(this)},v.prototype.emit=function(B){for(var T=[],I=1;I<arguments.length;I++)T.push(arguments[I]);var Q=B==="error",ne=this._events;if(ne!==void 0)Q=Q&&ne.error===void 0;else if(!Q)return!1;if(Q){var N;if(T.length>0&&(N=T[0]),N instanceof Error)throw N;var ie=new Error("Unhandled error."+(N?" ("+N.message+")":""));throw ie.context=N,ie}var ye=ne[B];if(ye===void 0)return!1;if(typeof ye=="function")i(ye,this,T);else for(var me=ye.length,je=A(ye,me),I=0;I<me;++I)i(je[I],this,T);return!0};function h(x,B,T,I){var Q,ne,N;if(b(T),ne=x._events,ne===void 0?(ne=x._events=Object.create(null),x._eventsCount=0):(ne.newListener!==void 0&&(x.emit("newListener",B,T.listener?T.listener:T),ne=x._events),N=ne[B]),N===void 0)N=ne[B]=T,++x._eventsCount;else if(typeof N=="function"?N=ne[B]=I?[T,N]:[N,T]:I?N.unshift(T):N.push(T),Q=w(x),Q>0&&N.length>Q&&!N.warned){N.warned=!0;var ie=new Error("Possible EventEmitter memory leak detected. "+N.length+" "+String(B)+" listeners added. Use emitter.setMaxListeners() to increase limit");ie.name="MaxListenersExceededWarning",ie.emitter=x,ie.type=B,ie.count=N.length,s(ie)}return x}v.prototype.addListener=function(B,T){return h(this,B,T,!1)},v.prototype.on=v.prototype.addListener,v.prototype.prependListener=function(B,T){return h(this,B,T,!0)};function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(x,B,T){var I={fired:!1,wrapFn:void 0,target:x,type:B,listener:T},Q=l.bind(I);return Q.listener=T,I.wrapFn=Q,Q}v.prototype.once=function(B,T){return b(T),this.on(B,u(this,B,T)),this},v.prototype.prependOnceListener=function(B,T){return b(T),this.prependListener(B,u(this,B,T)),this},v.prototype.removeListener=function(B,T){var I,Q,ne,N,ie;if(b(T),Q=this._events,Q===void 0)return this;if(I=Q[B],I===void 0)return this;if(I===T||I.listener===T)--this._eventsCount===0?this._events=Object.create(null):(delete Q[B],Q.removeListener&&this.emit("removeListener",B,I.listener||T));else if(typeof I!="function"){for(ne=-1,N=I.length-1;N>=0;N--)if(I[N]===T||I[N].listener===T){ie=I[N].listener,ne=N;break}if(ne<0)return this;ne===0?I.shift():J(I,ne),I.length===1&&(Q[B]=I[0]),Q.removeListener!==void 0&&this.emit("removeListener",B,ie||T)}return this},v.prototype.off=v.prototype.removeListener,v.prototype.removeAllListeners=function(B){var T,I,Q;if(I=this._events,I===void 0)return this;if(I.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):I[B]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete I[B]),this;if(arguments.length===0){var ne=Object.keys(I),N;for(Q=0;Q<ne.length;++Q)N=ne[Q],N!=="removeListener"&&this.removeAllListeners(N);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(T=I[B],typeof T=="function")this.removeListener(B,T);else if(T!==void 0)for(Q=T.length-1;Q>=0;Q--)this.removeListener(B,T[Q]);return this};function S(x,B,T){var I=x._events;if(I===void 0)return[];var Q=I[B];return Q===void 0?[]:typeof Q=="function"?T?[Q.listener||Q]:[Q]:T?H(Q):A(Q,Q.length)}v.prototype.listeners=function(B){return S(this,B,!0)},v.prototype.rawListeners=function(B){return S(this,B,!1)},v.listenerCount=function(x,B){return typeof x.listenerCount=="function"?x.listenerCount(B):R.call(x,B)},v.prototype.listenerCount=R;function R(x){var B=this._events;if(B!==void 0){var T=B[x];if(typeof T=="function")return 1;if(T!==void 0)return T.length}return 0}v.prototype.eventNames=function(){return this._eventsCount>0?c(this._events):[]};function A(x,B){for(var T=new Array(B),I=0;I<B;++I)T[I]=x[I];return T}function J(x,B){for(;B+1<x.length;B++)x[B]=x[B+1];x.pop()}function H(x){for(var B=new Array(x.length),T=0;T<B.length;++T)B[T]=x[T].listener||x[T];return B}function C(x,B){return new Promise(function(T,I){function Q(N){x.removeListener(B,ne),I(N)}function ne(){typeof x.removeListener=="function"&&x.removeListener("error",Q),T([].slice.call(arguments))}W(x,B,ne,{once:!0}),B!=="error"&&U(x,Q,{once:!0})})}function U(x,B,T){typeof x.on=="function"&&W(x,"error",B,T)}function W(x,B,T,I){if(typeof x.on=="function")I.once?x.once(B,T):x.on(B,T);else if(typeof x.addEventListener=="function")x.addEventListener(B,function Q(ne){I.once&&x.removeEventListener(B,Q),T(ne)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof x)}return gr.exports}var gs=fs();const ps=Oi(gs);var vr={exports:{}},ys=vr.exports,Ln;function vs(){return Ln||(Ln=1,(function(o,i){(function(s,y){o.exports=y()})(ys,(function(){return(function(c){var s={};function y(v){if(s[v])return s[v].exports;var d=s[v]={i:v,l:!1,exports:{}};return c[v].call(d.exports,d,d.exports,y),d.l=!0,d.exports}return y.m=c,y.c=s,y.d=function(v,d,b){y.o(v,d)||Object.defineProperty(v,d,{enumerable:!0,get:b})},y.r=function(v){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(v,"__esModule",{value:!0})},y.t=function(v,d){if(1&d&&(v=y(v)),8&d||4&d&&typeof v=="object"&&v&&v.__esModule)return v;var b=Object.create(null);if(y.r(b),Object.defineProperty(b,"default",{enumerable:!0,value:v}),2&d&&typeof v!="string")for(var w in v)y.d(b,w,(function(h){return v[h]}).bind(null,w));return b},y.n=function(v){var d=v&&v.__esModule?function(){return v.default}:function(){return v};return y.d(d,"a",d),d},y.o=function(v,d){return Object.prototype.hasOwnProperty.call(v,d)},y.p="",y(y.s=22)})([function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0});var v=(function(){function h(l,u){for(var S=0;S<u.length;S++){var R=u[S];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(l,R.key,R)}}return function(l,u,S){return u&&h(l.prototype,u),S&&h(l,S),l}})(),d={debug:function(){},info:function(){},warn:function(){},error:function(){}},b=void 0,w=void 0;(s.Log=(function(){function h(){(function(u,S){if(!(u instanceof S))throw new TypeError("Cannot call a class as a function")})(this,h)}return h.reset=function(){w=3,b=d},h.debug=function(){if(w>=4){for(var u=arguments.length,S=Array(u),R=0;R<u;R++)S[R]=arguments[R];b.debug.apply(b,Array.from(S))}},h.info=function(){if(w>=3){for(var u=arguments.length,S=Array(u),R=0;R<u;R++)S[R]=arguments[R];b.info.apply(b,Array.from(S))}},h.warn=function(){if(w>=2){for(var u=arguments.length,S=Array(u),R=0;R<u;R++)S[R]=arguments[R];b.warn.apply(b,Array.from(S))}},h.error=function(){if(w>=1){for(var u=arguments.length,S=Array(u),R=0;R<u;R++)S[R]=arguments[R];b.error.apply(b,Array.from(S))}},v(h,null,[{key:"NONE",get:function(){return 0}},{key:"ERROR",get:function(){return 1}},{key:"WARN",get:function(){return 2}},{key:"INFO",get:function(){return 3}},{key:"DEBUG",get:function(){return 4}},{key:"level",get:function(){return w},set:function(u){if(!(0<=u&&u<=4))throw new Error("Invalid log level");w=u}},{key:"logger",get:function(){return b},set:function(u){if(!u.debug&&u.info&&(u.debug=u.info),!(u.debug&&u.info&&u.warn&&u.error))throw new Error("Invalid logger");b=u}}]),h})()).reset()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0});var v=(function(){function h(l,u){for(var S=0;S<u.length;S++){var R=u[S];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(l,R.key,R)}}return function(l,u,S){return u&&h(l.prototype,u),S&&h(l,S),l}})(),d={setInterval:(function(h){function l(u,S){return h.apply(this,arguments)}return l.toString=function(){return h.toString()},l})((function(h,l){return setInterval(h,l)})),clearInterval:(function(h){function l(u){return h.apply(this,arguments)}return l.toString=function(){return h.toString()},l})((function(h){return clearInterval(h)}))},b=!1,w=null;s.Global=(function(){function h(){(function(u,S){if(!(u instanceof S))throw new TypeError("Cannot call a class as a function")})(this,h)}return h._testing=function(){b=!0},h.setXMLHttpRequest=function(u){w=u},v(h,null,[{key:"location",get:function(){if(!b)return location}},{key:"localStorage",get:function(){if(!b&&typeof window<"u")return localStorage}},{key:"sessionStorage",get:function(){if(!b&&typeof window<"u")return sessionStorage}},{key:"XMLHttpRequest",get:function(){if(!b&&typeof window<"u")return w||XMLHttpRequest}},{key:"timer",get:function(){if(!b)return d}}]),h})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.MetadataService=void 0;var v=(function(){function l(u,S){for(var R=0;R<S.length;R++){var A=S[R];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(u,A.key,A)}}return function(u,S,R){return S&&l(u.prototype,S),R&&l(u,R),u}})(),d=y(0),b=y(7);function w(l,u){if(!(l instanceof u))throw new TypeError("Cannot call a class as a function")}var h=".well-known/openid-configuration";s.MetadataService=(function(){function l(u){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:b.JsonService;if(w(this,l),!u)throw d.Log.error("MetadataService: No settings passed to MetadataService"),new Error("settings");this._settings=u,this._jsonService=new S(["application/jwk-set+json"])}return l.prototype.resetSigningKeys=function(){this._settings=this._settings||{},this._settings.signingKeys=void 0},l.prototype.getMetadata=function(){var S=this;return this._settings.metadata?(d.Log.debug("MetadataService.getMetadata: Returning metadata from settings"),Promise.resolve(this._settings.metadata)):this.metadataUrl?(d.Log.debug("MetadataService.getMetadata: getting metadata from",this.metadataUrl),this._jsonService.getJson(this.metadataUrl).then((function(R){d.Log.debug("MetadataService.getMetadata: json received");var A=S._settings.metadataSeed||{};return S._settings.metadata=Object.assign({},A,R),S._settings.metadata}))):(d.Log.error("MetadataService.getMetadata: No authority or metadataUrl configured on settings"),Promise.reject(new Error("No authority or metadataUrl configured on settings")))},l.prototype.getIssuer=function(){return this._getMetadataProperty("issuer")},l.prototype.getAuthorizationEndpoint=function(){return this._getMetadataProperty("authorization_endpoint")},l.prototype.getUserInfoEndpoint=function(){return this._getMetadataProperty("userinfo_endpoint")},l.prototype.getTokenEndpoint=function(){var S=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];return this._getMetadataProperty("token_endpoint",S)},l.prototype.getCheckSessionIframe=function(){return this._getMetadataProperty("check_session_iframe",!0)},l.prototype.getEndSessionEndpoint=function(){return this._getMetadataProperty("end_session_endpoint",!0)},l.prototype.getRevocationEndpoint=function(){return this._getMetadataProperty("revocation_endpoint",!0)},l.prototype.getKeysEndpoint=function(){return this._getMetadataProperty("jwks_uri",!0)},l.prototype._getMetadataProperty=function(S){var R=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return d.Log.debug("MetadataService.getMetadataProperty for: "+S),this.getMetadata().then((function(A){if(d.Log.debug("MetadataService.getMetadataProperty: metadata recieved"),A[S]===void 0){if(R===!0)return void d.Log.warn("MetadataService.getMetadataProperty: Metadata does not contain optional property "+S);throw d.Log.error("MetadataService.getMetadataProperty: Metadata does not contain property "+S),new Error("Metadata does not contain property "+S)}return A[S]}))},l.prototype.getSigningKeys=function(){var S=this;return this._settings.signingKeys?(d.Log.debug("MetadataService.getSigningKeys: Returning signingKeys from settings"),Promise.resolve(this._settings.signingKeys)):this._getMetadataProperty("jwks_uri").then((function(R){return d.Log.debug("MetadataService.getSigningKeys: jwks_uri received",R),S._jsonService.getJson(R).then((function(A){if(d.Log.debug("MetadataService.getSigningKeys: key set received",A),!A.keys)throw d.Log.error("MetadataService.getSigningKeys: Missing keys on keyset"),new Error("Missing keys on keyset");return S._settings.signingKeys=A.keys,S._settings.signingKeys}))}))},v(l,[{key:"metadataUrl",get:function(){return this._metadataUrl||(this._settings.metadataUrl?this._metadataUrl=this._settings.metadataUrl:(this._metadataUrl=this._settings.authority,this._metadataUrl&&this._metadataUrl.indexOf(h)<0&&(this._metadataUrl[this._metadataUrl.length-1]!=="/"&&(this._metadataUrl+="/"),this._metadataUrl+=h))),this._metadataUrl}}]),l})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.UrlUtility=void 0;var v=y(0),d=y(1);s.UrlUtility=(function(){function b(){(function(h,l){if(!(h instanceof l))throw new TypeError("Cannot call a class as a function")})(this,b)}return b.addQueryParam=function(h,l,u){return h.indexOf("?")<0&&(h+="?"),h[h.length-1]!=="?"&&(h+="&"),h+=encodeURIComponent(l),h+="=",h+=encodeURIComponent(u)},b.parseUrlFragment=function(h){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"#",u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:d.Global;typeof h!="string"&&(h=u.location.href);var S=h.lastIndexOf(l);S>=0&&(h=h.substr(S+1)),l==="?"&&(S=h.indexOf("#"))>=0&&(h=h.substr(0,S));for(var R,A={},J=/([^&=]+)=([^&]*)/g,H=0;R=J.exec(h);)if(A[decodeURIComponent(R[1])]=decodeURIComponent(R[2].replace(/\+/g," ")),H++>50)return v.Log.error("UrlUtility.parseUrlFragment: response exceeded expected number of parameters",h),{error:"Response exceeded expected number of parameters"};for(var C in A)return A;return{}},b})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.JoseUtil=void 0;var v=y(26),d=(function(w){return w&&w.__esModule?w:{default:w}})(y(33));s.JoseUtil=(0,d.default)({jws:v.jws,KeyUtil:v.KeyUtil,X509:v.X509,crypto:v.crypto,hextob64u:v.hextob64u,b64tohex:v.b64tohex,AllowedSigningAlgs:v.AllowedSigningAlgs})},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.OidcClientSettings=void 0;var v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(C){return typeof C}:function(C){return C&&typeof Symbol=="function"&&C.constructor===Symbol&&C!==Symbol.prototype?"symbol":typeof C},d=(function(){function C(U,W){for(var x=0;x<W.length;x++){var B=W[x];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(U,B.key,B)}}return function(U,W,x){return W&&C(U.prototype,W),x&&C(U,x),U}})(),b=y(0),w=y(23),h=y(6),l=y(24),u=y(2);function S(C,U){if(!(C instanceof U))throw new TypeError("Cannot call a class as a function")}var R=".well-known/openid-configuration",A="id_token",J="openid",H="client_secret_post";s.OidcClientSettings=(function(){function C(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},W=U.authority,x=U.metadataUrl,B=U.metadata,T=U.signingKeys,I=U.metadataSeed,Q=U.client_id,ne=U.client_secret,N=U.response_type,ie=N===void 0?A:N,ye=U.scope,me=ye===void 0?J:ye,je=U.redirect_uri,Re=U.post_logout_redirect_uri,ze=U.client_authentication,Le=ze===void 0?H:ze,Ge=U.prompt,fe=U.display,ve=U.max_age,We=U.ui_locales,Ye=U.acr_values,rt=U.resource,nt=U.response_mode,ct=U.filterProtocolClaims,Et=ct===void 0||ct,Xe=U.loadUserInfo,it=Xe===void 0||Xe,Ke=U.staleStateAge,xe=Ke===void 0?900:Ke,q=U.clockSkew,g=q===void 0?300:q,p=U.clockService,j=p===void 0?new w.ClockService:p,$=U.userInfoJwtIssuer,X=$===void 0?"OP":$,re=U.mergeClaims,ce=re!==void 0&&re,de=U.stateStore,we=de===void 0?new h.WebStorageStateStore:de,_e=U.ResponseValidatorCtor,Se=_e===void 0?l.ResponseValidator:_e,ot=U.MetadataServiceCtor,ft=ot===void 0?u.MetadataService:ot,le=U.extraQueryParams,Pe=le===void 0?{}:le,pe=U.extraTokenParams,lt=pe===void 0?{}:pe;S(this,C),this._authority=W,this._metadataUrl=x,this._metadata=B,this._metadataSeed=I,this._signingKeys=T,this._client_id=Q,this._client_secret=ne,this._response_type=ie,this._scope=me,this._redirect_uri=je,this._post_logout_redirect_uri=Re,this._client_authentication=Le,this._prompt=Ge,this._display=fe,this._max_age=ve,this._ui_locales=We,this._acr_values=Ye,this._resource=rt,this._response_mode=nt,this._filterProtocolClaims=!!Et,this._loadUserInfo=!!it,this._staleStateAge=xe,this._clockSkew=g,this._clockService=j,this._userInfoJwtIssuer=X,this._mergeClaims=!!ce,this._stateStore=we,this._validator=new Se(this),this._metadataService=new ft(this),this._extraQueryParams=(Pe===void 0?"undefined":v(Pe))==="object"?Pe:{},this._extraTokenParams=(lt===void 0?"undefined":v(lt))==="object"?lt:{}}return C.prototype.getEpochTime=function(){return this._clockService.getEpochTime()},d(C,[{key:"client_id",get:function(){return this._client_id},set:function(W){if(this._client_id)throw b.Log.error("OidcClientSettings.set_client_id: client_id has already been assigned."),new Error("client_id has already been assigned.");this._client_id=W}},{key:"client_secret",get:function(){return this._client_secret}},{key:"response_type",get:function(){return this._response_type}},{key:"scope",get:function(){return this._scope}},{key:"redirect_uri",get:function(){return this._redirect_uri}},{key:"post_logout_redirect_uri",get:function(){return this._post_logout_redirect_uri}},{key:"client_authentication",get:function(){return this._client_authentication}},{key:"prompt",get:function(){return this._prompt}},{key:"display",get:function(){return this._display}},{key:"max_age",get:function(){return this._max_age}},{key:"ui_locales",get:function(){return this._ui_locales}},{key:"acr_values",get:function(){return this._acr_values}},{key:"resource",get:function(){return this._resource}},{key:"response_mode",get:function(){return this._response_mode}},{key:"authority",get:function(){return this._authority},set:function(W){if(this._authority)throw b.Log.error("OidcClientSettings.set_authority: authority has already been assigned."),new Error("authority has already been assigned.");this._authority=W}},{key:"metadataUrl",get:function(){return this._metadataUrl||(this._metadataUrl=this.authority,this._metadataUrl&&this._metadataUrl.indexOf(R)<0&&(this._metadataUrl[this._metadataUrl.length-1]!=="/"&&(this._metadataUrl+="/"),this._metadataUrl+=R)),this._metadataUrl}},{key:"metadata",get:function(){return this._metadata},set:function(W){this._metadata=W}},{key:"metadataSeed",get:function(){return this._metadataSeed},set:function(W){this._metadataSeed=W}},{key:"signingKeys",get:function(){return this._signingKeys},set:function(W){this._signingKeys=W}},{key:"filterProtocolClaims",get:function(){return this._filterProtocolClaims}},{key:"loadUserInfo",get:function(){return this._loadUserInfo}},{key:"staleStateAge",get:function(){return this._staleStateAge}},{key:"clockSkew",get:function(){return this._clockSkew}},{key:"userInfoJwtIssuer",get:function(){return this._userInfoJwtIssuer}},{key:"mergeClaims",get:function(){return this._mergeClaims}},{key:"stateStore",get:function(){return this._stateStore}},{key:"validator",get:function(){return this._validator}},{key:"metadataService",get:function(){return this._metadataService}},{key:"extraQueryParams",get:function(){return this._extraQueryParams},set:function(W){(W===void 0?"undefined":v(W))==="object"?this._extraQueryParams=W:this._extraQueryParams={}}},{key:"extraTokenParams",get:function(){return this._extraTokenParams},set:function(W){(W===void 0?"undefined":v(W))==="object"?this._extraTokenParams=W:this._extraTokenParams={}}}]),C})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.WebStorageStateStore=void 0;var v=y(0),d=y(1);function b(w,h){if(!(w instanceof h))throw new TypeError("Cannot call a class as a function")}s.WebStorageStateStore=(function(){function w(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},l=h.prefix,u=l===void 0?"oidc.":l,S=h.store,R=S===void 0?d.Global.localStorage:S;b(this,w),this._store=R,this._prefix=u}return w.prototype.set=function(l,u){return v.Log.debug("WebStorageStateStore.set",l),l=this._prefix+l,this._store.setItem(l,u),Promise.resolve()},w.prototype.get=function(l){v.Log.debug("WebStorageStateStore.get",l),l=this._prefix+l;var u=this._store.getItem(l);return Promise.resolve(u)},w.prototype.remove=function(l){v.Log.debug("WebStorageStateStore.remove",l),l=this._prefix+l;var u=this._store.getItem(l);return this._store.removeItem(l),Promise.resolve(u)},w.prototype.getAllKeys=function(){v.Log.debug("WebStorageStateStore.getAllKeys");for(var l=[],u=0;u<this._store.length;u++){var S=this._store.key(u);S.indexOf(this._prefix)===0&&l.push(S.substr(this._prefix.length))}return Promise.resolve(l)},w})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.JsonService=void 0;var v=y(0),d=y(1);function b(w,h){if(!(w instanceof h))throw new TypeError("Cannot call a class as a function")}s.JsonService=(function(){function w(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d.Global.XMLHttpRequest,u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;b(this,w),h&&Array.isArray(h)?this._contentTypes=h.slice():this._contentTypes=[],this._contentTypes.push("application/json"),u&&this._contentTypes.push("application/jwt"),this._XMLHttpRequest=l,this._jwtHandler=u}return w.prototype.getJson=function(l,u){var S=this;if(!l)throw v.Log.error("JsonService.getJson: No url passed"),new Error("url");return v.Log.debug("JsonService.getJson, url: ",l),new Promise((function(R,A){var J=new S._XMLHttpRequest;J.open("GET",l);var H=S._contentTypes,C=S._jwtHandler;J.onload=function(){if(v.Log.debug("JsonService.getJson: HTTP response received, status",J.status),J.status===200){var U=J.getResponseHeader("Content-Type");if(U){var W=H.find((function(x){if(U.startsWith(x))return!0}));if(W=="application/jwt")return void C(J).then(R,A);if(W)try{return void R(JSON.parse(J.responseText))}catch(x){return v.Log.error("JsonService.getJson: Error parsing JSON response",x.message),void A(x)}}A(Error("Invalid response Content-Type: "+U+", from URL: "+l))}else A(Error(J.statusText+" ("+J.status+")"))},J.onerror=function(){v.Log.error("JsonService.getJson: network error"),A(Error("Network Error"))},u&&(v.Log.debug("JsonService.getJson: token passed, setting Authorization header"),J.setRequestHeader("Authorization","Bearer "+u)),J.send()}))},w.prototype.postForm=function(l,u,S){var R=this;if(!l)throw v.Log.error("JsonService.postForm: No url passed"),new Error("url");return v.Log.debug("JsonService.postForm, url: ",l),new Promise((function(A,J){var H=new R._XMLHttpRequest;H.open("POST",l);var C=R._contentTypes;H.onload=function(){if(v.Log.debug("JsonService.postForm: HTTP response received, status",H.status),H.status!==200){if(H.status===400&&(T=H.getResponseHeader("Content-Type"))&&C.find((function(I){if(T.startsWith(I))return!0})))try{var B=JSON.parse(H.responseText);if(B&&B.error)return v.Log.error("JsonService.postForm: Error from server: ",B.error),void J(new Error(B.error))}catch(I){return v.Log.error("JsonService.postForm: Error parsing JSON response",I.message),void J(I)}J(Error(H.statusText+" ("+H.status+")"))}else{var T;if((T=H.getResponseHeader("Content-Type"))&&C.find((function(I){if(T.startsWith(I))return!0})))try{return void A(JSON.parse(H.responseText))}catch(I){return v.Log.error("JsonService.postForm: Error parsing JSON response",I.message),void J(I)}J(Error("Invalid response Content-Type: "+T+", from URL: "+l))}},H.onerror=function(){v.Log.error("JsonService.postForm: network error"),J(Error("Network Error"))};var U="";for(var W in u){var x=u[W];x&&(U.length>0&&(U+="&"),U+=encodeURIComponent(W),U+="=",U+=encodeURIComponent(x))}H.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),S!==void 0&&H.setRequestHeader("Authorization","Basic "+btoa(S)),H.send(U)}))},w})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.SigninRequest=void 0;var v=y(0),d=y(3),b=y(13);s.SigninRequest=(function(){function w(h){var l=h.url,u=h.client_id,S=h.redirect_uri,R=h.response_type,A=h.scope,J=h.authority,H=h.data,C=h.prompt,U=h.display,W=h.max_age,x=h.ui_locales,B=h.id_token_hint,T=h.login_hint,I=h.acr_values,Q=h.resource,ne=h.response_mode,N=h.request,ie=h.request_uri,ye=h.extraQueryParams,me=h.request_type,je=h.client_secret,Re=h.extraTokenParams,ze=h.skipUserInfo;if((function(rt,nt){if(!(rt instanceof nt))throw new TypeError("Cannot call a class as a function")})(this,w),!l)throw v.Log.error("SigninRequest.ctor: No url passed"),new Error("url");if(!u)throw v.Log.error("SigninRequest.ctor: No client_id passed"),new Error("client_id");if(!S)throw v.Log.error("SigninRequest.ctor: No redirect_uri passed"),new Error("redirect_uri");if(!R)throw v.Log.error("SigninRequest.ctor: No response_type passed"),new Error("response_type");if(!A)throw v.Log.error("SigninRequest.ctor: No scope passed"),new Error("scope");if(!J)throw v.Log.error("SigninRequest.ctor: No authority passed"),new Error("authority");var Le=w.isOidc(R),Ge=w.isCode(R);ne||(ne=w.isCode(R)?"query":null),this.state=new b.SigninState({nonce:Le,data:H,client_id:u,authority:J,redirect_uri:S,code_verifier:Ge,request_type:me,response_mode:ne,client_secret:je,scope:A,extraTokenParams:Re,skipUserInfo:ze}),l=d.UrlUtility.addQueryParam(l,"client_id",u),l=d.UrlUtility.addQueryParam(l,"redirect_uri",S),l=d.UrlUtility.addQueryParam(l,"response_type",R),l=d.UrlUtility.addQueryParam(l,"scope",A),l=d.UrlUtility.addQueryParam(l,"state",this.state.id),Le&&(l=d.UrlUtility.addQueryParam(l,"nonce",this.state.nonce)),Ge&&(l=d.UrlUtility.addQueryParam(l,"code_challenge",this.state.code_challenge),l=d.UrlUtility.addQueryParam(l,"code_challenge_method","S256"));var fe={prompt:C,display:U,max_age:W,ui_locales:x,id_token_hint:B,login_hint:T,acr_values:I,resource:Q,request:N,request_uri:ie,response_mode:ne};for(var ve in fe)fe[ve]&&(l=d.UrlUtility.addQueryParam(l,ve,fe[ve]));for(var We in ye)l=d.UrlUtility.addQueryParam(l,We,ye[We]);this.url=l}return w.isOidc=function(l){return!!l.split(/\s+/g).filter((function(u){return u==="id_token"}))[0]},w.isOAuth=function(l){return!!l.split(/\s+/g).filter((function(u){return u==="token"}))[0]},w.isCode=function(l){return!!l.split(/\s+/g).filter((function(u){return u==="code"}))[0]},w})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.State=void 0;var v=(function(){function h(l,u){for(var S=0;S<u.length;S++){var R=u[S];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(l,R.key,R)}}return function(l,u,S){return u&&h(l.prototype,u),S&&h(l,S),l}})(),d=y(0),b=(function(l){return l&&l.__esModule?l:{default:l}})(y(14));function w(h,l){if(!(h instanceof l))throw new TypeError("Cannot call a class as a function")}s.State=(function(){function h(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=l.id,S=l.data,R=l.created,A=l.request_type;w(this,h),this._id=u||(0,b.default)(),this._data=S,this._created=typeof R=="number"&&R>0?R:parseInt(Date.now()/1e3),this._request_type=A}return h.prototype.toStorageString=function(){return d.Log.debug("State.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})},h.fromStorageString=function(u){return d.Log.debug("State.fromStorageString"),new h(JSON.parse(u))},h.clearStaleState=function(u,S){var R=Date.now()/1e3-S;return u.getAllKeys().then((function(A){d.Log.debug("State.clearStaleState: got keys",A);for(var J=[],H=function(x){var B=A[x];U=u.get(B).then((function(T){var I=!1;if(T)try{var Q=h.fromStorageString(T);d.Log.debug("State.clearStaleState: got item from key: ",B,Q.created),Q.created<=R&&(I=!0)}catch(ne){d.Log.error("State.clearStaleState: Error parsing state for key",B,ne.message),I=!0}else d.Log.debug("State.clearStaleState: no item in storage for key: ",B),I=!0;if(I)return d.Log.debug("State.clearStaleState: removed item for key: ",B),u.remove(B)})),J.push(U)},C=0;C<A.length;C++){var U;H(C)}return d.Log.debug("State.clearStaleState: waiting on promise count:",J.length),Promise.all(J)}))},v(h,[{key:"id",get:function(){return this._id}},{key:"data",get:function(){return this._data}},{key:"created",get:function(){return this._created}},{key:"request_type",get:function(){return this._request_type}}]),h})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.OidcClient=void 0;var v=(function(){function H(C,U){for(var W=0;W<U.length;W++){var x=U[W];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(C,x.key,x)}}return function(C,U,W){return U&&H(C.prototype,U),W&&H(C,W),C}})(),d=y(0),b=y(5),w=y(12),h=y(8),l=y(34),u=y(35),S=y(36),R=y(13),A=y(9);function J(H,C){if(!(H instanceof C))throw new TypeError("Cannot call a class as a function")}s.OidcClient=(function(){function H(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};J(this,H),C instanceof b.OidcClientSettings?this._settings=C:this._settings=new b.OidcClientSettings(C)}return H.prototype.createSigninRequest=function(){var U=this,W=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},x=W.response_type,B=W.scope,T=W.redirect_uri,I=W.data,Q=W.state,ne=W.prompt,N=W.display,ie=W.max_age,ye=W.ui_locales,me=W.id_token_hint,je=W.login_hint,Re=W.acr_values,ze=W.resource,Le=W.request,Ge=W.request_uri,fe=W.response_mode,ve=W.extraQueryParams,We=W.extraTokenParams,Ye=W.request_type,rt=W.skipUserInfo,nt=arguments[1];d.Log.debug("OidcClient.createSigninRequest");var ct=this._settings.client_id;x=x||this._settings.response_type,B=B||this._settings.scope,T=T||this._settings.redirect_uri,ne=ne||this._settings.prompt,N=N||this._settings.display,ie=ie||this._settings.max_age,ye=ye||this._settings.ui_locales,Re=Re||this._settings.acr_values,ze=ze||this._settings.resource,fe=fe||this._settings.response_mode,ve=ve||this._settings.extraQueryParams,We=We||this._settings.extraTokenParams;var Et=this._settings.authority;return h.SigninRequest.isCode(x)&&x!=="code"?Promise.reject(new Error("OpenID Connect hybrid flow is not supported")):this._metadataService.getAuthorizationEndpoint().then((function(Xe){d.Log.debug("OidcClient.createSigninRequest: Received authorization endpoint",Xe);var it=new h.SigninRequest({url:Xe,client_id:ct,redirect_uri:T,response_type:x,scope:B,data:I||Q,authority:Et,prompt:ne,display:N,max_age:ie,ui_locales:ye,id_token_hint:me,login_hint:je,acr_values:Re,resource:ze,request:Le,request_uri:Ge,extraQueryParams:ve,extraTokenParams:We,request_type:Ye,response_mode:fe,client_secret:U._settings.client_secret,skipUserInfo:rt}),Ke=it.state;return(nt=nt||U._stateStore).set(Ke.id,Ke.toStorageString()).then((function(){return it}))}))},H.prototype.readSigninResponseState=function(U,W){var x=arguments.length>2&&arguments[2]!==void 0&&arguments[2];d.Log.debug("OidcClient.readSigninResponseState");var B=this._settings.response_mode==="query"||!this._settings.response_mode&&h.SigninRequest.isCode(this._settings.response_type),T=B?"?":"#",I=new l.SigninResponse(U,T);if(!I.state)return d.Log.error("OidcClient.readSigninResponseState: No state in response"),Promise.reject(new Error("No state in response"));W=W||this._stateStore;var Q=x?W.remove.bind(W):W.get.bind(W);return Q(I.state).then((function(ne){if(!ne)throw d.Log.error("OidcClient.readSigninResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:R.SigninState.fromStorageString(ne),response:I}}))},H.prototype.processSigninResponse=function(U,W){var x=this;return d.Log.debug("OidcClient.processSigninResponse"),this.readSigninResponseState(U,W,!0).then((function(B){var T=B.state,I=B.response;return d.Log.debug("OidcClient.processSigninResponse: Received state from storage; validating response"),x._validator.validateSigninResponse(T,I)}))},H.prototype.createSignoutRequest=function(){var U=this,W=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},x=W.id_token_hint,B=W.data,T=W.state,I=W.post_logout_redirect_uri,Q=W.extraQueryParams,ne=W.request_type,N=arguments[1];return d.Log.debug("OidcClient.createSignoutRequest"),I=I||this._settings.post_logout_redirect_uri,Q=Q||this._settings.extraQueryParams,this._metadataService.getEndSessionEndpoint().then((function(ie){if(!ie)throw d.Log.error("OidcClient.createSignoutRequest: No end session endpoint url returned"),new Error("no end session endpoint");d.Log.debug("OidcClient.createSignoutRequest: Received end session endpoint",ie);var ye=new u.SignoutRequest({url:ie,id_token_hint:x,post_logout_redirect_uri:I,data:B||T,extraQueryParams:Q,request_type:ne}),me=ye.state;return me&&(d.Log.debug("OidcClient.createSignoutRequest: Signout request has state to persist"),(N=N||U._stateStore).set(me.id,me.toStorageString())),ye}))},H.prototype.readSignoutResponseState=function(U,W){var x=arguments.length>2&&arguments[2]!==void 0&&arguments[2];d.Log.debug("OidcClient.readSignoutResponseState");var B=new S.SignoutResponse(U);if(!B.state)return d.Log.debug("OidcClient.readSignoutResponseState: No state in response"),B.error?(d.Log.warn("OidcClient.readSignoutResponseState: Response was error: ",B.error),Promise.reject(new w.ErrorResponse(B))):Promise.resolve({state:void 0,response:B});var T=B.state;W=W||this._stateStore;var I=x?W.remove.bind(W):W.get.bind(W);return I(T).then((function(Q){if(!Q)throw d.Log.error("OidcClient.readSignoutResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:A.State.fromStorageString(Q),response:B}}))},H.prototype.processSignoutResponse=function(U,W){var x=this;return d.Log.debug("OidcClient.processSignoutResponse"),this.readSignoutResponseState(U,W,!0).then((function(B){var T=B.state,I=B.response;return T?(d.Log.debug("OidcClient.processSignoutResponse: Received state from storage; validating response"),x._validator.validateSignoutResponse(T,I)):(d.Log.debug("OidcClient.processSignoutResponse: No state from storage; skipping validating response"),I)}))},H.prototype.clearStaleState=function(U){return d.Log.debug("OidcClient.clearStaleState"),U=U||this._stateStore,A.State.clearStaleState(U,this.settings.staleStateAge)},v(H,[{key:"_stateStore",get:function(){return this.settings.stateStore}},{key:"_validator",get:function(){return this.settings.validator}},{key:"_metadataService",get:function(){return this.settings.metadataService}},{key:"settings",get:function(){return this._settings}},{key:"metadataService",get:function(){return this._metadataService}}]),H})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.TokenClient=void 0;var v=y(7),d=y(2),b=y(0);function w(h,l){if(!(h instanceof l))throw new TypeError("Cannot call a class as a function")}s.TokenClient=(function(){function h(l){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:v.JsonService,S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:d.MetadataService;if(w(this,h),!l)throw b.Log.error("TokenClient.ctor: No settings passed"),new Error("settings");this._settings=l,this._jsonService=new u,this._metadataService=new S(this._settings)}return h.prototype.exchangeCode=function(){var u=this,S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(S=Object.assign({},S)).grant_type=S.grant_type||"authorization_code",S.client_id=S.client_id||this._settings.client_id,S.client_secret=S.client_secret||this._settings.client_secret,S.redirect_uri=S.redirect_uri||this._settings.redirect_uri;var R=void 0,A=S._client_authentication||this._settings._client_authentication;return delete S._client_authentication,S.code?S.redirect_uri?S.code_verifier?S.client_id?S.client_secret||A!="client_secret_basic"?(A=="client_secret_basic"&&(R=S.client_id+":"+S.client_secret,delete S.client_id,delete S.client_secret),this._metadataService.getTokenEndpoint(!1).then((function(J){return b.Log.debug("TokenClient.exchangeCode: Received token endpoint"),u._jsonService.postForm(J,S,R).then((function(H){return b.Log.debug("TokenClient.exchangeCode: response received"),H}))}))):(b.Log.error("TokenClient.exchangeCode: No client_secret passed"),Promise.reject(new Error("A client_secret is required"))):(b.Log.error("TokenClient.exchangeCode: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(b.Log.error("TokenClient.exchangeCode: No code_verifier passed"),Promise.reject(new Error("A code_verifier is required"))):(b.Log.error("TokenClient.exchangeCode: No redirect_uri passed"),Promise.reject(new Error("A redirect_uri is required"))):(b.Log.error("TokenClient.exchangeCode: No code passed"),Promise.reject(new Error("A code is required")))},h.prototype.exchangeRefreshToken=function(){var u=this,S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(S=Object.assign({},S)).grant_type=S.grant_type||"refresh_token",S.client_id=S.client_id||this._settings.client_id,S.client_secret=S.client_secret||this._settings.client_secret;var R=void 0,A=S._client_authentication||this._settings._client_authentication;return delete S._client_authentication,S.refresh_token?S.client_id?(A=="client_secret_basic"&&(R=S.client_id+":"+S.client_secret,delete S.client_id,delete S.client_secret),this._metadataService.getTokenEndpoint(!1).then((function(J){return b.Log.debug("TokenClient.exchangeRefreshToken: Received token endpoint"),u._jsonService.postForm(J,S,R).then((function(H){return b.Log.debug("TokenClient.exchangeRefreshToken: response received"),H}))}))):(b.Log.error("TokenClient.exchangeRefreshToken: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(b.Log.error("TokenClient.exchangeRefreshToken: No refresh_token passed"),Promise.reject(new Error("A refresh_token is required")))},h})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.ErrorResponse=void 0;var v=y(0);function d(w,h){if(!(w instanceof h))throw new TypeError("Cannot call a class as a function")}function b(w,h){if(!w)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!h||typeof h!="object"&&typeof h!="function"?w:h}s.ErrorResponse=(function(w){function h(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=l.error,S=l.error_description,R=l.error_uri,A=l.state,J=l.session_state;if(d(this,h),!u)throw v.Log.error("No error passed to ErrorResponse"),new Error("error");var H=b(this,w.call(this,S||u));return H.name="ErrorResponse",H.error=u,H.error_description=S,H.error_uri=R,H.state=A,H.session_state=J,H}return(function(u,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);u.prototype=Object.create(S&&S.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(u,S):u.__proto__=S)})(h,w),h})(Error)},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.SigninState=void 0;var v=(function(){function S(R,A){for(var J=0;J<A.length;J++){var H=A[J];H.enumerable=H.enumerable||!1,H.configurable=!0,"value"in H&&(H.writable=!0),Object.defineProperty(R,H.key,H)}}return function(R,A,J){return A&&S(R.prototype,A),J&&S(R,J),R}})(),d=y(0),b=y(9),w=y(4),h=(function(R){return R&&R.__esModule?R:{default:R}})(y(14));function l(S,R){if(!(S instanceof R))throw new TypeError("Cannot call a class as a function")}function u(S,R){if(!S)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!R||typeof R!="object"&&typeof R!="function"?S:R}s.SigninState=(function(S){function R(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},J=A.nonce,H=A.authority,C=A.client_id,U=A.redirect_uri,W=A.code_verifier,x=A.response_mode,B=A.client_secret,T=A.scope,I=A.extraTokenParams,Q=A.skipUserInfo;l(this,R);var ne=u(this,S.call(this,arguments[0]));if(J===!0?ne._nonce=(0,h.default)():J&&(ne._nonce=J),W===!0?ne._code_verifier=(0,h.default)()+(0,h.default)()+(0,h.default)():W&&(ne._code_verifier=W),ne.code_verifier){var N=w.JoseUtil.hashString(ne.code_verifier,"SHA256");ne._code_challenge=w.JoseUtil.hexToBase64Url(N)}return ne._redirect_uri=U,ne._authority=H,ne._client_id=C,ne._response_mode=x,ne._client_secret=B,ne._scope=T,ne._extraTokenParams=I,ne._skipUserInfo=Q,ne}return(function(J,H){if(typeof H!="function"&&H!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof H);J.prototype=Object.create(H&&H.prototype,{constructor:{value:J,enumerable:!1,writable:!0,configurable:!0}}),H&&(Object.setPrototypeOf?Object.setPrototypeOf(J,H):J.__proto__=H)})(R,S),R.prototype.toStorageString=function(){return d.Log.debug("SigninState.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,nonce:this.nonce,code_verifier:this.code_verifier,redirect_uri:this.redirect_uri,authority:this.authority,client_id:this.client_id,response_mode:this.response_mode,client_secret:this.client_secret,scope:this.scope,extraTokenParams:this.extraTokenParams,skipUserInfo:this.skipUserInfo})},R.fromStorageString=function(J){return d.Log.debug("SigninState.fromStorageString"),new R(JSON.parse(J))},v(R,[{key:"nonce",get:function(){return this._nonce}},{key:"authority",get:function(){return this._authority}},{key:"client_id",get:function(){return this._client_id}},{key:"redirect_uri",get:function(){return this._redirect_uri}},{key:"code_verifier",get:function(){return this._code_verifier}},{key:"code_challenge",get:function(){return this._code_challenge}},{key:"response_mode",get:function(){return this._response_mode}},{key:"client_secret",get:function(){return this._client_secret}},{key:"scope",get:function(){return this._scope}},{key:"extraTokenParams",get:function(){return this._extraTokenParams}},{key:"skipUserInfo",get:function(){return this._skipUserInfo}}]),R})(b.State)},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.default=function(){return(v!="undefined"&&v!==null&&v.getRandomValues!==void 0?d:b)().replace(/-/g,"")};var v=typeof window<"u"?window.crypto||window.msCrypto:null;function d(){return("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,(function(w){return(w^v.getRandomValues(new Uint8Array(1))[0]&15>>w/4).toString(16)}))}function b(){return("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,(function(w){return(w^16*Math.random()>>w/4).toString(16)}))}c.exports=s.default},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.User=void 0;var v=(function(){function b(w,h){for(var l=0;l<h.length;l++){var u=h[l];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(w,u.key,u)}}return function(w,h,l){return h&&b(w.prototype,h),l&&b(w,l),w}})(),d=y(0);s.User=(function(){function b(w){var h=w.id_token,l=w.session_state,u=w.access_token,S=w.refresh_token,R=w.token_type,A=w.scope,J=w.profile,H=w.expires_at,C=w.state;(function(W,x){if(!(W instanceof x))throw new TypeError("Cannot call a class as a function")})(this,b),this.id_token=h,this.session_state=l,this.access_token=u,this.refresh_token=S,this.token_type=R,this.scope=A,this.profile=J,this.expires_at=H,this.state=C}return b.prototype.toStorageString=function(){return d.Log.debug("User.toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})},b.fromStorageString=function(h){return d.Log.debug("User.fromStorageString"),new b(JSON.parse(h))},v(b,[{key:"expires_in",get:function(){if(this.expires_at){var h=parseInt(Date.now()/1e3);return this.expires_at-h}},set:function(h){var l=parseInt(h);if(typeof l=="number"&&l>0){var u=parseInt(Date.now()/1e3);this.expires_at=u+l}}},{key:"expired",get:function(){var h=this.expires_in;if(h!==void 0)return h<=0}},{key:"scopes",get:function(){return(this.scope||"").split(" ")}}]),b})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.AccessTokenEvents=void 0;var v=y(0),d=y(46);function b(w,h){if(!(w instanceof h))throw new TypeError("Cannot call a class as a function")}s.AccessTokenEvents=(function(){function w(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},l=h.accessTokenExpiringNotificationTime,u=l===void 0?60:l,S=h.accessTokenExpiringTimer,R=S===void 0?new d.Timer("Access token expiring"):S,A=h.accessTokenExpiredTimer,J=A===void 0?new d.Timer("Access token expired"):A;b(this,w),this._accessTokenExpiringNotificationTime=u,this._accessTokenExpiring=R,this._accessTokenExpired=J}return w.prototype.load=function(l){if(l.access_token&&l.expires_in!==void 0){var u=l.expires_in;if(v.Log.debug("AccessTokenEvents.load: access token present, remaining duration:",u),u>0){var S=u-this._accessTokenExpiringNotificationTime;S<=0&&(S=1),v.Log.debug("AccessTokenEvents.load: registering expiring timer in:",S),this._accessTokenExpiring.init(S)}else v.Log.debug("AccessTokenEvents.load: canceling existing expiring timer becase we're past expiration."),this._accessTokenExpiring.cancel();var R=u+1;v.Log.debug("AccessTokenEvents.load: registering expired timer in:",R),this._accessTokenExpired.init(R)}else this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},w.prototype.unload=function(){v.Log.debug("AccessTokenEvents.unload: canceling existing access token timers"),this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},w.prototype.addAccessTokenExpiring=function(l){this._accessTokenExpiring.addHandler(l)},w.prototype.removeAccessTokenExpiring=function(l){this._accessTokenExpiring.removeHandler(l)},w.prototype.addAccessTokenExpired=function(l){this._accessTokenExpired.addHandler(l)},w.prototype.removeAccessTokenExpired=function(l){this._accessTokenExpired.removeHandler(l)},w})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.Event=void 0;var v=y(0);s.Event=(function(){function d(b){(function(h,l){if(!(h instanceof l))throw new TypeError("Cannot call a class as a function")})(this,d),this._name=b,this._callbacks=[]}return d.prototype.addHandler=function(w){this._callbacks.push(w)},d.prototype.removeHandler=function(w){var h=this._callbacks.findIndex((function(l){return l===w}));h>=0&&this._callbacks.splice(h,1)},d.prototype.raise=function(){v.Log.debug("Event: Raising event: "+this._name);for(var w=0;w<this._callbacks.length;w++){var h;(h=this._callbacks)[w].apply(h,arguments)}},d})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.SessionMonitor=void 0;var v=(function(){function l(u,S){for(var R=0;R<S.length;R++){var A=S[R];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(u,A.key,A)}}return function(u,S,R){return S&&l(u.prototype,S),R&&l(u,R),u}})(),d=y(0),b=y(19),w=y(1);function h(l,u){if(!(l instanceof u))throw new TypeError("Cannot call a class as a function")}s.SessionMonitor=(function(){function l(u){var S=this,R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:b.CheckSessionIFrame,A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:w.Global.timer;if(h(this,l),!u)throw d.Log.error("SessionMonitor.ctor: No user manager passed to SessionMonitor"),new Error("userManager");this._userManager=u,this._CheckSessionIFrameCtor=R,this._timer=A,this._userManager.events.addUserLoaded(this._start.bind(this)),this._userManager.events.addUserUnloaded(this._stop.bind(this)),Promise.resolve(this._userManager.getUser().then((function(J){J?S._start(J):S._settings.monitorAnonymousSession&&S._userManager.querySessionStatus().then((function(H){var C={session_state:H.session_state};H.sub&&H.sid&&(C.profile={sub:H.sub,sid:H.sid}),S._start(C)})).catch((function(H){d.Log.error("SessionMonitor ctor: error from querySessionStatus:",H.message)}))})).catch((function(J){d.Log.error("SessionMonitor ctor: error from getUser:",J.message)})))}return l.prototype._start=function(S){var R=this,A=S.session_state;A&&(S.profile?(this._sub=S.profile.sub,this._sid=S.profile.sid,d.Log.debug("SessionMonitor._start: session_state:",A,", sub:",this._sub)):(this._sub=void 0,this._sid=void 0,d.Log.debug("SessionMonitor._start: session_state:",A,", anonymous user")),this._checkSessionIFrame?this._checkSessionIFrame.start(A):this._metadataService.getCheckSessionIframe().then((function(J){if(J){d.Log.debug("SessionMonitor._start: Initializing check session iframe");var H=R._client_id,C=R._checkSessionInterval,U=R._stopCheckSessionOnError;R._checkSessionIFrame=new R._CheckSessionIFrameCtor(R._callback.bind(R),H,J,C,U),R._checkSessionIFrame.load().then((function(){R._checkSessionIFrame.start(A)}))}else d.Log.warn("SessionMonitor._start: No check session iframe found in the metadata")})).catch((function(J){d.Log.error("SessionMonitor._start: Error from getCheckSessionIframe:",J.message)})))},l.prototype._stop=function(){var S=this;if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&(d.Log.debug("SessionMonitor._stop"),this._checkSessionIFrame.stop()),this._settings.monitorAnonymousSession)var R=this._timer.setInterval((function(){S._timer.clearInterval(R),S._userManager.querySessionStatus().then((function(A){var J={session_state:A.session_state};A.sub&&A.sid&&(J.profile={sub:A.sub,sid:A.sid}),S._start(J)})).catch((function(A){d.Log.error("SessionMonitor: error from querySessionStatus:",A.message)}))}),1e3)},l.prototype._callback=function(){var S=this;this._userManager.querySessionStatus().then((function(R){var A=!0;R?R.sub===S._sub?(A=!1,S._checkSessionIFrame.start(R.session_state),R.sid===S._sid?d.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:",R.session_state):(d.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, session state has changed, restarting check session iframe; session_state:",R.session_state),S._userManager.events._raiseUserSessionChanged())):d.Log.debug("SessionMonitor._callback: Different subject signed into OP:",R.sub):d.Log.debug("SessionMonitor._callback: Subject no longer signed into OP"),A&&(S._sub?(d.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed out event"),S._userManager.events._raiseUserSignedOut()):(d.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed in event"),S._userManager.events._raiseUserSignedIn()))})).catch((function(R){S._sub&&(d.Log.debug("SessionMonitor._callback: Error calling queryCurrentSigninSession; raising signed out event",R.message),S._userManager.events._raiseUserSignedOut())}))},v(l,[{key:"_settings",get:function(){return this._userManager.settings}},{key:"_metadataService",get:function(){return this._userManager.metadataService}},{key:"_client_id",get:function(){return this._settings.client_id}},{key:"_checkSessionInterval",get:function(){return this._settings.checkSessionInterval}},{key:"_stopCheckSessionOnError",get:function(){return this._settings.stopCheckSessionOnError}}]),l})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.CheckSessionIFrame=void 0;var v=y(0);function d(b,w){if(!(b instanceof w))throw new TypeError("Cannot call a class as a function")}s.CheckSessionIFrame=(function(){function b(w,h,l,u){var S=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4];d(this,b),this._callback=w,this._client_id=h,this._url=l,this._interval=u||2e3,this._stopOnError=S;var R=l.indexOf("/",l.indexOf("//")+2);this._frame_origin=l.substr(0,R),this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="absolute",this._frame.style.display="none",this._frame.width=0,this._frame.height=0,this._frame.src=l}return b.prototype.load=function(){var h=this;return new Promise((function(l){h._frame.onload=function(){l()},window.document.body.appendChild(h._frame),h._boundMessageEvent=h._message.bind(h),window.addEventListener("message",h._boundMessageEvent,!1)}))},b.prototype._message=function(h){h.origin===this._frame_origin&&h.source===this._frame.contentWindow&&(h.data==="error"?(v.Log.error("CheckSessionIFrame: error message from check session op iframe"),this._stopOnError&&this.stop()):h.data==="changed"?(v.Log.debug("CheckSessionIFrame: changed message from check session op iframe"),this.stop(),this._callback()):v.Log.debug("CheckSessionIFrame: "+h.data+" message from check session op iframe"))},b.prototype.start=function(h){var l=this;if(this._session_state!==h){v.Log.debug("CheckSessionIFrame.start"),this.stop(),this._session_state=h;var u=function(){l._frame.contentWindow.postMessage(l._client_id+" "+l._session_state,l._frame_origin)};u(),this._timer=window.setInterval(u,this._interval)}},b.prototype.stop=function(){this._session_state=null,this._timer&&(v.Log.debug("CheckSessionIFrame.stop"),window.clearInterval(this._timer),this._timer=null)},b})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.TokenRevocationClient=void 0;var v=y(0),d=y(2),b=y(1);function w(u,S){if(!(u instanceof S))throw new TypeError("Cannot call a class as a function")}var h="access_token",l="refresh_token";s.TokenRevocationClient=(function(){function u(S){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:b.Global.XMLHttpRequest,A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:d.MetadataService;if(w(this,u),!S)throw v.Log.error("TokenRevocationClient.ctor: No settings provided"),new Error("No settings provided.");this._settings=S,this._XMLHttpRequestCtor=R,this._metadataService=new A(this._settings)}return u.prototype.revoke=function(R,A){var J=this,H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"access_token";if(!R)throw v.Log.error("TokenRevocationClient.revoke: No token provided"),new Error("No token provided.");if(H!==h&&H!=l)throw v.Log.error("TokenRevocationClient.revoke: Invalid token type"),new Error("Invalid token type.");return this._metadataService.getRevocationEndpoint().then((function(C){if(C){v.Log.debug("TokenRevocationClient.revoke: Revoking "+H);var U=J._settings.client_id,W=J._settings.client_secret;return J._revoke(C,U,W,R,H)}if(A)throw v.Log.error("TokenRevocationClient.revoke: Revocation not supported"),new Error("Revocation not supported")}))},u.prototype._revoke=function(R,A,J,H,C){var U=this;return new Promise((function(W,x){var B=new U._XMLHttpRequestCtor;B.open("POST",R),B.onload=function(){v.Log.debug("TokenRevocationClient.revoke: HTTP response received, status",B.status),B.status===200?W():x(Error(B.statusText+" ("+B.status+")"))},B.onerror=function(){v.Log.debug("TokenRevocationClient.revoke: Network Error."),x("Network Error")};var T="client_id="+encodeURIComponent(A);J&&(T+="&client_secret="+encodeURIComponent(J)),T+="&token_type_hint="+encodeURIComponent(C),T+="&token="+encodeURIComponent(H),B.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),B.send(T)}))},u})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.CordovaPopupWindow=void 0;var v=(function(){function b(w,h){for(var l=0;l<h.length;l++){var u=h[l];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(w,u.key,u)}}return function(w,h,l){return h&&b(w.prototype,h),l&&b(w,l),w}})(),d=y(0);s.CordovaPopupWindow=(function(){function b(w){var h=this;(function(u,S){if(!(u instanceof S))throw new TypeError("Cannot call a class as a function")})(this,b),this._promise=new Promise((function(l,u){h._resolve=l,h._reject=u})),this.features=w.popupWindowFeatures||"location=no,toolbar=no,zoom=no",this.target=w.popupWindowTarget||"_blank",this.redirect_uri=w.startUrl,d.Log.debug("CordovaPopupWindow.ctor: redirect_uri: "+this.redirect_uri)}return b.prototype._isInAppBrowserInstalled=function(h){return["cordova-plugin-inappbrowser","cordova-plugin-inappbrowser.inappbrowser","org.apache.cordova.inappbrowser"].some((function(l){return h.hasOwnProperty(l)}))},b.prototype.navigate=function(h){if(h&&h.url){if(!window.cordova)return this._error("cordova is undefined");var l=window.cordova.require("cordova/plugin_list").metadata;if(this._isInAppBrowserInstalled(l)===!1)return this._error("InAppBrowser plugin not found");this._popup=cordova.InAppBrowser.open(h.url,this.target,this.features),this._popup?(d.Log.debug("CordovaPopupWindow.navigate: popup successfully created"),this._exitCallbackEvent=this._exitCallback.bind(this),this._loadStartCallbackEvent=this._loadStartCallback.bind(this),this._popup.addEventListener("exit",this._exitCallbackEvent,!1),this._popup.addEventListener("loadstart",this._loadStartCallbackEvent,!1)):this._error("Error opening popup window")}else this._error("No url provided");return this.promise},b.prototype._loadStartCallback=function(h){h.url.indexOf(this.redirect_uri)===0&&this._success({url:h.url})},b.prototype._exitCallback=function(h){this._error(h)},b.prototype._success=function(h){this._cleanup(),d.Log.debug("CordovaPopupWindow: Successful response from cordova popup window"),this._resolve(h)},b.prototype._error=function(h){this._cleanup(),d.Log.error(h),this._reject(new Error(h))},b.prototype.close=function(){this._cleanup()},b.prototype._cleanup=function(){this._popup&&(d.Log.debug("CordovaPopupWindow: cleaning up popup"),this._popup.removeEventListener("exit",this._exitCallbackEvent,!1),this._popup.removeEventListener("loadstart",this._loadStartCallbackEvent,!1),this._popup.close()),this._popup=null},v(b,[{key:"promise",get:function(){return this._promise}}]),b})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0});var v=y(0),d=y(10),b=y(5),w=y(6),h=y(37),l=y(38),u=y(16),S=y(2),R=y(48),A=y(49),J=y(19),H=y(20),C=y(18),U=y(1),W=y(15),x=y(50);s.default={Version:x.Version,Log:v.Log,OidcClient:d.OidcClient,OidcClientSettings:b.OidcClientSettings,WebStorageStateStore:w.WebStorageStateStore,InMemoryWebStorage:h.InMemoryWebStorage,UserManager:l.UserManager,AccessTokenEvents:u.AccessTokenEvents,MetadataService:S.MetadataService,CordovaPopupNavigator:R.CordovaPopupNavigator,CordovaIFrameNavigator:A.CordovaIFrameNavigator,CheckSessionIFrame:J.CheckSessionIFrame,TokenRevocationClient:H.TokenRevocationClient,SessionMonitor:C.SessionMonitor,Global:U.Global,User:W.User},c.exports=s.default},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.ClockService=(function(){function v(){(function(b,w){if(!(b instanceof w))throw new TypeError("Cannot call a class as a function")})(this,v)}return v.prototype.getEpochTime=function(){return Promise.resolve(Date.now()/1e3|0)},v})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.ResponseValidator=void 0;var v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},d=y(0),b=y(2),w=y(25),h=y(11),l=y(12),u=y(4);function S(A,J){if(!(A instanceof J))throw new TypeError("Cannot call a class as a function")}var R=["nonce","at_hash","iat","nbf","exp","aud","iss","c_hash"];s.ResponseValidator=(function(){function A(J){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:b.MetadataService,C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:w.UserInfoService,U=arguments.length>3&&arguments[3]!==void 0?arguments[3]:u.JoseUtil,W=arguments.length>4&&arguments[4]!==void 0?arguments[4]:h.TokenClient;if(S(this,A),!J)throw d.Log.error("ResponseValidator.ctor: No settings passed to ResponseValidator"),new Error("settings");this._settings=J,this._metadataService=new H(this._settings),this._userInfoService=new C(this._settings),this._joseUtil=U,this._tokenClient=new W(this._settings)}return A.prototype.validateSigninResponse=function(H,C){var U=this;return d.Log.debug("ResponseValidator.validateSigninResponse"),this._processSigninParams(H,C).then((function(W){return d.Log.debug("ResponseValidator.validateSigninResponse: state processed"),U._validateTokens(H,W).then((function(x){return d.Log.debug("ResponseValidator.validateSigninResponse: tokens validated"),U._processClaims(H,x).then((function(B){return d.Log.debug("ResponseValidator.validateSigninResponse: claims processed"),B}))}))}))},A.prototype.validateSignoutResponse=function(H,C){return H.id!==C.state?(d.Log.error("ResponseValidator.validateSignoutResponse: State does not match"),Promise.reject(new Error("State does not match"))):(d.Log.debug("ResponseValidator.validateSignoutResponse: state validated"),C.state=H.data,C.error?(d.Log.warn("ResponseValidator.validateSignoutResponse: Response was error",C.error),Promise.reject(new l.ErrorResponse(C))):Promise.resolve(C))},A.prototype._processSigninParams=function(H,C){if(H.id!==C.state)return d.Log.error("ResponseValidator._processSigninParams: State does not match"),Promise.reject(new Error("State does not match"));if(!H.client_id)return d.Log.error("ResponseValidator._processSigninParams: No client_id on state"),Promise.reject(new Error("No client_id on state"));if(!H.authority)return d.Log.error("ResponseValidator._processSigninParams: No authority on state"),Promise.reject(new Error("No authority on state"));if(this._settings.authority){if(this._settings.authority&&this._settings.authority!==H.authority)return d.Log.error("ResponseValidator._processSigninParams: authority mismatch on settings vs. signin state"),Promise.reject(new Error("authority mismatch on settings vs. signin state"))}else this._settings.authority=H.authority;if(this._settings.client_id){if(this._settings.client_id&&this._settings.client_id!==H.client_id)return d.Log.error("ResponseValidator._processSigninParams: client_id mismatch on settings vs. signin state"),Promise.reject(new Error("client_id mismatch on settings vs. signin state"))}else this._settings.client_id=H.client_id;return d.Log.debug("ResponseValidator._processSigninParams: state validated"),C.state=H.data,C.error?(d.Log.warn("ResponseValidator._processSigninParams: Response was error",C.error),Promise.reject(new l.ErrorResponse(C))):H.nonce&&!C.id_token?(d.Log.error("ResponseValidator._processSigninParams: Expecting id_token in response"),Promise.reject(new Error("No id_token in response"))):!H.nonce&&C.id_token?(d.Log.error("ResponseValidator._processSigninParams: Not expecting id_token in response"),Promise.reject(new Error("Unexpected id_token in response"))):H.code_verifier&&!C.code?(d.Log.error("ResponseValidator._processSigninParams: Expecting code in response"),Promise.reject(new Error("No code in response"))):!H.code_verifier&&C.code?(d.Log.error("ResponseValidator._processSigninParams: Not expecting code in response"),Promise.reject(new Error("Unexpected code in response"))):(C.scope||(C.scope=H.scope),Promise.resolve(C))},A.prototype._processClaims=function(H,C){var U=this;if(C.isOpenIdConnect){if(d.Log.debug("ResponseValidator._processClaims: response is OIDC, processing claims"),C.profile=this._filterProtocolClaims(C.profile),H.skipUserInfo!==!0&&this._settings.loadUserInfo&&C.access_token)return d.Log.debug("ResponseValidator._processClaims: loading user info"),this._userInfoService.getClaims(C.access_token).then((function(W){return d.Log.debug("ResponseValidator._processClaims: user info claims received from user info endpoint"),W.sub!==C.profile.sub?(d.Log.error("ResponseValidator._processClaims: sub from user info endpoint does not match sub in id_token"),Promise.reject(new Error("sub from user info endpoint does not match sub in id_token"))):(C.profile=U._mergeClaims(C.profile,W),d.Log.debug("ResponseValidator._processClaims: user info claims received, updated profile:",C.profile),C)}));d.Log.debug("ResponseValidator._processClaims: not loading user info")}else d.Log.debug("ResponseValidator._processClaims: response is not OIDC, not processing claims");return Promise.resolve(C)},A.prototype._mergeClaims=function(H,C){var U=Object.assign({},H);for(var W in C){var x=C[W];Array.isArray(x)||(x=[x]);for(var B=0;B<x.length;B++){var T=x[B];U[W]?Array.isArray(U[W])?U[W].indexOf(T)<0&&U[W].push(T):U[W]!==T&&((T===void 0?"undefined":v(T))==="object"&&this._settings.mergeClaims?U[W]=this._mergeClaims(U[W],T):U[W]=[U[W],T]):U[W]=T}}return U},A.prototype._filterProtocolClaims=function(H){d.Log.debug("ResponseValidator._filterProtocolClaims, incoming claims:",H);var C=Object.assign({},H);return this._settings._filterProtocolClaims?(R.forEach((function(U){delete C[U]})),d.Log.debug("ResponseValidator._filterProtocolClaims: protocol claims filtered",C)):d.Log.debug("ResponseValidator._filterProtocolClaims: protocol claims not filtered"),C},A.prototype._validateTokens=function(H,C){return C.code?(d.Log.debug("ResponseValidator._validateTokens: Validating code"),this._processCode(H,C)):C.id_token?C.access_token?(d.Log.debug("ResponseValidator._validateTokens: Validating id_token and access_token"),this._validateIdTokenAndAccessToken(H,C)):(d.Log.debug("ResponseValidator._validateTokens: Validating id_token"),this._validateIdToken(H,C)):(d.Log.debug("ResponseValidator._validateTokens: No code to process or id_token to validate"),Promise.resolve(C))},A.prototype._processCode=function(H,C){var U=this,W={client_id:H.client_id,client_secret:H.client_secret,code:C.code,redirect_uri:H.redirect_uri,code_verifier:H.code_verifier};return H.extraTokenParams&&v(H.extraTokenParams)==="object"&&Object.assign(W,H.extraTokenParams),this._tokenClient.exchangeCode(W).then((function(x){for(var B in x)C[B]=x[B];return C.id_token?(d.Log.debug("ResponseValidator._processCode: token response successful, processing id_token"),U._validateIdTokenAttributes(H,C)):(d.Log.debug("ResponseValidator._processCode: token response successful, returning response"),C)}))},A.prototype._validateIdTokenAttributes=function(H,C){var U=this;return this._metadataService.getIssuer().then((function(W){var x=H.client_id,B=U._settings.clockSkew;return d.Log.debug("ResponseValidator._validateIdTokenAttributes: Validaing JWT attributes; using clock skew (in seconds) of: ",B),U._settings.getEpochTime().then((function(T){return U._joseUtil.validateJwtAttributes(C.id_token,W,x,B,T).then((function(I){return H.nonce&&H.nonce!==I.nonce?(d.Log.error("ResponseValidator._validateIdTokenAttributes: Invalid nonce in id_token"),Promise.reject(new Error("Invalid nonce in id_token"))):I.sub?(C.profile=I,C):(d.Log.error("ResponseValidator._validateIdTokenAttributes: No sub present in id_token"),Promise.reject(new Error("No sub present in id_token")))}))}))}))},A.prototype._validateIdTokenAndAccessToken=function(H,C){var U=this;return this._validateIdToken(H,C).then((function(W){return U._validateAccessToken(W)}))},A.prototype._getSigningKeyForJwt=function(H){var C=this;return this._metadataService.getSigningKeys().then((function(U){var W=H.header.kid;if(!U)return d.Log.error("ResponseValidator._validateIdToken: No signing keys from metadata"),Promise.reject(new Error("No signing keys from metadata"));d.Log.debug("ResponseValidator._validateIdToken: Received signing keys");var x=void 0;if(W)x=U.filter((function(B){return B.kid===W}))[0];else{if((U=C._filterByAlg(U,H.header.alg)).length>1)return d.Log.error("ResponseValidator._validateIdToken: No kid found in id_token and more than one key found in metadata"),Promise.reject(new Error("No kid found in id_token and more than one key found in metadata"));x=U[0]}return Promise.resolve(x)}))},A.prototype._getSigningKeyForJwtWithSingleRetry=function(H){var C=this;return this._getSigningKeyForJwt(H).then((function(U){return U?Promise.resolve(U):(C._metadataService.resetSigningKeys(),C._getSigningKeyForJwt(H))}))},A.prototype._validateIdToken=function(H,C){var U=this;if(!H.nonce)return d.Log.error("ResponseValidator._validateIdToken: No nonce on state"),Promise.reject(new Error("No nonce on state"));var W=this._joseUtil.parseJwt(C.id_token);return W&&W.header&&W.payload?H.nonce!==W.payload.nonce?(d.Log.error("ResponseValidator._validateIdToken: Invalid nonce in id_token"),Promise.reject(new Error("Invalid nonce in id_token"))):this._metadataService.getIssuer().then((function(x){return d.Log.debug("ResponseValidator._validateIdToken: Received issuer"),U._getSigningKeyForJwtWithSingleRetry(W).then((function(B){if(!B)return d.Log.error("ResponseValidator._validateIdToken: No key matching kid or alg found in signing keys"),Promise.reject(new Error("No key matching kid or alg found in signing keys"));var T=H.client_id,I=U._settings.clockSkew;return d.Log.debug("ResponseValidator._validateIdToken: Validaing JWT; using clock skew (in seconds) of: ",I),U._joseUtil.validateJwt(C.id_token,B,x,T,I).then((function(){return d.Log.debug("ResponseValidator._validateIdToken: JWT validation successful"),W.payload.sub?(C.profile=W.payload,C):(d.Log.error("ResponseValidator._validateIdToken: No sub present in id_token"),Promise.reject(new Error("No sub present in id_token")))}))}))})):(d.Log.error("ResponseValidator._validateIdToken: Failed to parse id_token",W),Promise.reject(new Error("Failed to parse id_token")))},A.prototype._filterByAlg=function(H,C){var U=null;if(C.startsWith("RS"))U="RSA";else if(C.startsWith("PS"))U="PS";else{if(!C.startsWith("ES"))return d.Log.debug("ResponseValidator._filterByAlg: alg not supported: ",C),[];U="EC"}return d.Log.debug("ResponseValidator._filterByAlg: Looking for keys that match kty: ",U),H=H.filter((function(W){return W.kty===U})),d.Log.debug("ResponseValidator._filterByAlg: Number of keys that match kty: ",U,H.length),H},A.prototype._validateAccessToken=function(H){if(!H.profile)return d.Log.error("ResponseValidator._validateAccessToken: No profile loaded from id_token"),Promise.reject(new Error("No profile loaded from id_token"));if(!H.profile.at_hash)return d.Log.error("ResponseValidator._validateAccessToken: No at_hash in id_token"),Promise.reject(new Error("No at_hash in id_token"));if(!H.id_token)return d.Log.error("ResponseValidator._validateAccessToken: No id_token"),Promise.reject(new Error("No id_token"));var C=this._joseUtil.parseJwt(H.id_token);if(!C||!C.header)return d.Log.error("ResponseValidator._validateAccessToken: Failed to parse id_token",C),Promise.reject(new Error("Failed to parse id_token"));var U=C.header.alg;if(!U||U.length!==5)return d.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",U),Promise.reject(new Error("Unsupported alg: "+U));var W=U.substr(2,3);if(!W)return d.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",U,W),Promise.reject(new Error("Unsupported alg: "+U));if((W=parseInt(W))!==256&&W!==384&&W!==512)return d.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",U,W),Promise.reject(new Error("Unsupported alg: "+U));var x="sha"+W,B=this._joseUtil.hashString(H.access_token,x);if(!B)return d.Log.error("ResponseValidator._validateAccessToken: access_token hash failed:",x),Promise.reject(new Error("Failed to validate at_hash"));var T=B.substr(0,B.length/2),I=this._joseUtil.hexToBase64Url(T);return I!==H.profile.at_hash?(d.Log.error("ResponseValidator._validateAccessToken: Failed to validate at_hash",I,H.profile.at_hash),Promise.reject(new Error("Failed to validate at_hash"))):(d.Log.debug("ResponseValidator._validateAccessToken: success"),Promise.resolve(H))},A})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.UserInfoService=void 0;var v=y(7),d=y(2),b=y(0),w=y(4);function h(l,u){if(!(l instanceof u))throw new TypeError("Cannot call a class as a function")}s.UserInfoService=(function(){function l(u){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:v.JsonService,R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:d.MetadataService,A=arguments.length>3&&arguments[3]!==void 0?arguments[3]:w.JoseUtil;if(h(this,l),!u)throw b.Log.error("UserInfoService.ctor: No settings passed"),new Error("settings");this._settings=u,this._jsonService=new S(void 0,void 0,this._getClaimsFromJwt.bind(this)),this._metadataService=new R(this._settings),this._joseUtil=A}return l.prototype.getClaims=function(S){var R=this;return S?this._metadataService.getUserInfoEndpoint().then((function(A){return b.Log.debug("UserInfoService.getClaims: received userinfo url",A),R._jsonService.getJson(A,S).then((function(J){return b.Log.debug("UserInfoService.getClaims: claims received",J),J}))})):(b.Log.error("UserInfoService.getClaims: No token passed"),Promise.reject(new Error("A token is required")))},l.prototype._getClaimsFromJwt=function(S){var R=this;try{var A=this._joseUtil.parseJwt(S.responseText);if(!A||!A.header||!A.payload)return b.Log.error("UserInfoService._getClaimsFromJwt: Failed to parse JWT",A),Promise.reject(new Error("Failed to parse id_token"));var J=A.header.kid,H=void 0;switch(this._settings.userInfoJwtIssuer){case"OP":H=this._metadataService.getIssuer();break;case"ANY":H=Promise.resolve(A.payload.iss);break;default:H=Promise.resolve(this._settings.userInfoJwtIssuer)}return H.then((function(C){return b.Log.debug("UserInfoService._getClaimsFromJwt: Received issuer:"+C),R._metadataService.getSigningKeys().then((function(U){if(!U)return b.Log.error("UserInfoService._getClaimsFromJwt: No signing keys from metadata"),Promise.reject(new Error("No signing keys from metadata"));b.Log.debug("UserInfoService._getClaimsFromJwt: Received signing keys");var W=void 0;if(J)W=U.filter((function(T){return T.kid===J}))[0];else{if((U=R._filterByAlg(U,A.header.alg)).length>1)return b.Log.error("UserInfoService._getClaimsFromJwt: No kid found in id_token and more than one key found in metadata"),Promise.reject(new Error("No kid found in id_token and more than one key found in metadata"));W=U[0]}if(!W)return b.Log.error("UserInfoService._getClaimsFromJwt: No key matching kid or alg found in signing keys"),Promise.reject(new Error("No key matching kid or alg found in signing keys"));var x=R._settings.client_id,B=R._settings.clockSkew;return b.Log.debug("UserInfoService._getClaimsFromJwt: Validaing JWT; using clock skew (in seconds) of: ",B),R._joseUtil.validateJwt(S.responseText,W,C,x,B,void 0,!0).then((function(){return b.Log.debug("UserInfoService._getClaimsFromJwt: JWT validation successful"),A.payload}))}))}))}catch(C){return b.Log.error("UserInfoService._getClaimsFromJwt: Error parsing JWT response",C.message),void reject(C)}},l.prototype._filterByAlg=function(S,R){var A=null;if(R.startsWith("RS"))A="RSA";else if(R.startsWith("PS"))A="PS";else{if(!R.startsWith("ES"))return b.Log.debug("UserInfoService._filterByAlg: alg not supported: ",R),[];A="EC"}return b.Log.debug("UserInfoService._filterByAlg: Looking for keys that match kty: ",A),S=S.filter((function(J){return J.kty===A})),b.Log.debug("UserInfoService._filterByAlg: Number of keys that match kty: ",A,S.length),S},l})()},function(c,s,y){Object.defineProperty(s,"__esModule",{value:!0}),s.AllowedSigningAlgs=s.b64tohex=s.hextob64u=s.crypto=s.X509=s.KeyUtil=s.jws=void 0;var v=y(27);s.jws=v.jws,s.KeyUtil=v.KEYUTIL,s.X509=v.X509,s.crypto=v.crypto,s.hextob64u=v.hextob64u,s.b64tohex=v.b64tohex,s.AllowedSigningAlgs=["RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"]},function(c,s,y){(function(v){Object.defineProperty(s,"__esModule",{value:!0});var d,b,w,h,l,u,S,R,A,J,H,C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},U={},W={},x=x||(d=Math,w=(b={}).lib={},h=w.Base=(function(){function t(){}return{extend:function(r){t.prototype=this;var n=new t;return r&&n.mixIn(r),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var r=this.extend();return r.init.apply(r,arguments),r},init:function(){},mixIn:function(r){for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);r.hasOwnProperty("toString")&&(this.toString=r.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),l=w.WordArray=h.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r??4*e.length},toString:function(e){return(e||S).stringify(this)},concat:function(e){var r=this.words,n=e.words,a=this.sigBytes,f=e.sigBytes;if(this.clamp(),a%4)for(var _=0;_<f;_++){var P=n[_>>>2]>>>24-_%4*8&255;r[a+_>>>2]|=P<<24-(a+_)%4*8}else for(_=0;_<f;_+=4)r[a+_>>>2]=n[_>>>2];return this.sigBytes+=f,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=d.ceil(r/4)},clone:function(){var e=h.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var r=[],n=0;n<e;n+=4)r.push(4294967296*d.random()|0);return new l.init(r,e)}}),u=b.enc={},S=u.Hex={stringify:function(e){for(var r=e.words,n=e.sigBytes,a=[],f=0;f<n;f++){var _=r[f>>>2]>>>24-f%4*8&255;a.push((_>>>4).toString(16)),a.push((15&_).toString(16))}return a.join("")},parse:function(e){for(var r=e.length,n=[],a=0;a<r;a+=2)n[a>>>3]|=parseInt(e.substr(a,2),16)<<24-a%8*4;return new l.init(n,r/2)}},R=u.Latin1={stringify:function(e){for(var r=e.words,n=e.sigBytes,a=[],f=0;f<n;f++){var _=r[f>>>2]>>>24-f%4*8&255;a.push(String.fromCharCode(_))}return a.join("")},parse:function(e){for(var r=e.length,n=[],a=0;a<r;a++)n[a>>>2]|=(255&e.charCodeAt(a))<<24-a%4*8;return new l.init(n,r)}},A=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(R.stringify(e)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(e){return R.parse(unescape(encodeURIComponent(e)))}},J=w.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){typeof e=="string"&&(e=A.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(e){var r=this._data,n=r.words,a=r.sigBytes,f=this.blockSize,_=a/(4*f),P=(_=e?d.ceil(_):d.max((0|_)-this._minBufferSize,0))*f,F=d.min(4*P,a);if(P){for(var k=0;k<P;k+=f)this._doProcessBlock(n,k);var D=n.splice(0,P);r.sigBytes-=F}return new l.init(D,F)},clone:function(){var e=h.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),w.Hasher=J.extend({cfg:h.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){J.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(r,n){return new e.init(n).finalize(r)}},_createHmacHelper:function(e){return function(r,n){return new H.HMAC.init(e,n).finalize(r)}}}),H=b.algo={},b);(function(t){var e,r=(e=x).lib,n=r.Base,a=r.WordArray;(e=e.x64={}).Word=n.extend({init:function(_,P){this.high=_,this.low=P}}),e.WordArray=n.extend({init:function(_,P){_=this.words=_||[],this.sigBytes=P??8*_.length},toX32:function(){for(var _=this.words,P=_.length,F=[],k=0;k<P;k++){var D=_[k];F.push(D.high),F.push(D.low)}return a.create(F,this.sigBytes)},clone:function(){for(var _=n.clone.call(this),P=_.words=this.words.slice(0),F=P.length,k=0;k<F;k++)P[k]=P[k].clone();return _}})})(),(function(){var t=x,e=t.lib.WordArray;t.enc.Base64={stringify:function(n){var a=n.words,f=n.sigBytes,_=this._map;n.clamp(),n=[];for(var P=0;P<f;P+=3)for(var F=(a[P>>>2]>>>24-P%4*8&255)<<16|(a[P+1>>>2]>>>24-(P+1)%4*8&255)<<8|a[P+2>>>2]>>>24-(P+2)%4*8&255,k=0;4>k&&P+.75*k<f;k++)n.push(_.charAt(F>>>6*(3-k)&63));if(a=_.charAt(64))for(;n.length%4;)n.push(a);return n.join("")},parse:function(n){var a=n.length,f=this._map;(_=f.charAt(64))&&(_=n.indexOf(_))!=-1&&(a=_);for(var _=[],P=0,F=0;F<a;F++)if(F%4){var k=f.indexOf(n.charAt(F-1))<<F%4*2,D=f.indexOf(n.charAt(F))>>>6-F%4*2;_[P>>>2]|=(k|D)<<24-P%4*8,P++}return e.create(_,P)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})(),(function(t){for(var e=x,r=(a=e.lib).WordArray,n=a.Hasher,a=e.algo,f=[],_=[],P=function(Z){return 4294967296*(Z-(0|Z))|0},F=2,k=0;64>k;){var D;e:{D=F;for(var O=t.sqrt(D),V=2;V<=O;V++)if(!(D%V)){D=!1;break e}D=!0}D&&(8>k&&(f[k]=P(t.pow(F,.5))),_[k]=P(t.pow(F,1/3)),k++),F++}var z=[];a=a.SHA256=n.extend({_doReset:function(){this._hash=new r.init(f.slice(0))},_doProcessBlock:function(Z,ee){for(var m=this._hash.words,L=m[0],M=m[1],K=m[2],Y=m[3],te=m[4],ue=m[5],oe=m[6],ge=m[7],ae=0;64>ae;ae++){if(16>ae)z[ae]=0|Z[ee+ae];else{var he=z[ae-15],be=z[ae-2];z[ae]=((he<<25|he>>>7)^(he<<14|he>>>18)^he>>>3)+z[ae-7]+((be<<15|be>>>17)^(be<<13|be>>>19)^be>>>10)+z[ae-16]}he=ge+((te<<26|te>>>6)^(te<<21|te>>>11)^(te<<7|te>>>25))+(te&ue^~te&oe)+_[ae]+z[ae],be=((L<<30|L>>>2)^(L<<19|L>>>13)^(L<<10|L>>>22))+(L&M^L&K^M&K),ge=oe,oe=ue,ue=te,te=Y+he|0,Y=K,K=M,M=L,L=he+be|0}m[0]=m[0]+L|0,m[1]=m[1]+M|0,m[2]=m[2]+K|0,m[3]=m[3]+Y|0,m[4]=m[4]+te|0,m[5]=m[5]+ue|0,m[6]=m[6]+oe|0,m[7]=m[7]+ge|0},_doFinalize:function(){var Z=this._data,ee=Z.words,m=8*this._nDataBytes,L=8*Z.sigBytes;return ee[L>>>5]|=128<<24-L%32,ee[14+(L+64>>>9<<4)]=t.floor(m/4294967296),ee[15+(L+64>>>9<<4)]=m,Z.sigBytes=4*ee.length,this._process(),this._hash},clone:function(){var Z=n.clone.call(this);return Z._hash=this._hash.clone(),Z}}),e.SHA256=n._createHelper(a),e.HmacSHA256=n._createHmacHelper(a)})(Math),(function(){function t(){return n.create.apply(n,arguments)}for(var e=x,r=e.lib.Hasher,n=(f=e.x64).Word,a=f.WordArray,f=e.algo,_=[t(1116352408,3609767458),t(1899447441,602891725),t(3049323471,3964484399),t(3921009573,2173295548),t(961987163,4081628472),t(1508970993,3053834265),t(2453635748,2937671579),t(2870763221,3664609560),t(3624381080,2734883394),t(310598401,1164996542),t(607225278,1323610764),t(1426881987,3590304994),t(1925078388,4068182383),t(2162078206,991336113),t(2614888103,633803317),t(3248222580,3479774868),t(3835390401,2666613458),t(4022224774,944711139),t(264347078,2341262773),t(604807628,2007800933),t(770255983,1495990901),t(1249150122,1856431235),t(1555081692,3175218132),t(1996064986,2198950837),t(2554220882,3999719339),t(2821834349,766784016),t(2952996808,2566594879),t(3210313671,3203337956),t(3336571891,1034457026),t(3584528711,2466948901),t(113926993,3758326383),t(338241895,168717936),t(666307205,1188179964),t(773529912,1546045734),t(1294757372,1522805485),t(1396182291,2643833823),t(1695183700,2343527390),t(1986661051,1014477480),t(2177026350,1206759142),t(2456956037,344077627),t(2730485921,1290863460),t(2820302411,3158454273),t(3259730800,3505952657),t(3345764771,106217008),t(3516065817,3606008344),t(3600352804,1432725776),t(4094571909,1467031594),t(275423344,851169720),t(430227734,3100823752),t(506948616,1363258195),t(659060556,3750685593),t(883997877,3785050280),t(958139571,3318307427),t(1322822218,3812723403),t(1537002063,2003034995),t(1747873779,3602036899),t(1955562222,1575990012),t(2024104815,1125592928),t(2227730452,2716904306),t(2361852424,442776044),t(2428436474,593698344),t(2756734187,3733110249),t(3204031479,2999351573),t(3329325298,3815920427),t(3391569614,3928383900),t(3515267271,566280711),t(3940187606,3454069534),t(4118630271,4000239992),t(116418474,1914138554),t(174292421,2731055270),t(289380356,3203993006),t(460393269,320620315),t(685471733,587496836),t(852142971,1086792851),t(1017036298,365543100),t(1126000580,2618297676),t(1288033470,3409855158),t(1501505948,4234509866),t(1607167915,987167468),t(1816402316,1246189591)],P=[],F=0;80>F;F++)P[F]=t();f=f.SHA512=r.extend({_doReset:function(){this._hash=new a.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(D,O){for(var V=(M=this._hash.words)[0],z=M[1],G=M[2],Z=M[3],ee=M[4],m=M[5],L=M[6],M=M[7],K=V.high,Y=V.low,te=z.high,ue=z.low,oe=G.high,ge=G.low,ae=Z.high,he=Z.low,be=ee.high,Ae=ee.low,Fe=m.high,at=m.low,Qe=L.high,Ze=L.low,Ce=M.high,Be=M.low,Je=K,et=Y,Gt=te,Lt=ue,Yt=oe,Nt=ge,Pr=ae,Xt=he,pt=be,dt=Ae,dr=Fe,Qt=at,fr=Qe,Zt=Ze,Tr=Ce,er=Be,yt=0;80>yt;yt++){var Tt=P[yt];if(16>yt)var xt=Tt.high=0|D[O+2*yt],ke=Tt.low=0|D[O+2*yt+1];else{xt=((ke=(xt=P[yt-15]).high)>>>1|(At=xt.low)<<31)^(ke>>>8|At<<24)^ke>>>7;var At=(At>>>1|ke<<31)^(At>>>8|ke<<24)^(At>>>7|ke<<25),Ot=((ke=(Ot=P[yt-2]).high)>>>19|(Me=Ot.low)<<13)^(ke<<3|Me>>>29)^ke>>>6,Me=(Me>>>19|ke<<13)^(Me<<3|ke>>>29)^(Me>>>6|ke<<26),Ir=(ke=P[yt-7]).high,It=(Rt=P[yt-16]).high,Rt=Rt.low;xt=(xt=(xt=xt+Ir+((ke=At+ke.low)>>>0<At>>>0?1:0))+Ot+((ke=ke+Me)>>>0<Me>>>0?1:0))+It+((ke=ke+Rt)>>>0<Rt>>>0?1:0),Tt.high=xt,Tt.low=ke}Ir=pt&dr^~pt&fr,Rt=dt&Qt^~dt&Zt,Tt=Je&Gt^Je&Yt^Gt&Yt;var Li=et&Lt^et&Nt^Lt&Nt,Ni=(At=(Je>>>28|et<<4)^(Je<<30|et>>>2)^(Je<<25|et>>>7),Ot=(et>>>28|Je<<4)^(et<<30|Je>>>2)^(et<<25|Je>>>7),(Me=_[yt]).high),En=Me.low;It=Tr+((pt>>>14|dt<<18)^(pt>>>18|dt<<14)^(pt<<23|dt>>>9))+((Me=er+((dt>>>14|pt<<18)^(dt>>>18|pt<<14)^(dt<<23|pt>>>9)))>>>0<er>>>0?1:0),Tr=fr,er=Zt,fr=dr,Zt=Qt,dr=pt,Qt=dt,pt=Pr+(It=(It=(It=It+Ir+((Me=Me+Rt)>>>0<Rt>>>0?1:0))+Ni+((Me=Me+En)>>>0<En>>>0?1:0))+xt+((Me=Me+ke)>>>0<ke>>>0?1:0))+((dt=Xt+Me|0)>>>0<Xt>>>0?1:0)|0,Pr=Yt,Xt=Nt,Yt=Gt,Nt=Lt,Gt=Je,Lt=et,Je=It+(Tt=At+Tt+((ke=Ot+Li)>>>0<Ot>>>0?1:0))+((et=Me+ke|0)>>>0<Me>>>0?1:0)|0}Y=V.low=Y+et,V.high=K+Je+(Y>>>0<et>>>0?1:0),ue=z.low=ue+Lt,z.high=te+Gt+(ue>>>0<Lt>>>0?1:0),ge=G.low=ge+Nt,G.high=oe+Yt+(ge>>>0<Nt>>>0?1:0),he=Z.low=he+Xt,Z.high=ae+Pr+(he>>>0<Xt>>>0?1:0),Ae=ee.low=Ae+dt,ee.high=be+pt+(Ae>>>0<dt>>>0?1:0),at=m.low=at+Qt,m.high=Fe+dr+(at>>>0<Qt>>>0?1:0),Ze=L.low=Ze+Zt,L.high=Qe+fr+(Ze>>>0<Zt>>>0?1:0),Be=M.low=Be+er,M.high=Ce+Tr+(Be>>>0<er>>>0?1:0)},_doFinalize:function(){var D=this._data,O=D.words,V=8*this._nDataBytes,z=8*D.sigBytes;return O[z>>>5]|=128<<24-z%32,O[30+(z+128>>>10<<5)]=Math.floor(V/4294967296),O[31+(z+128>>>10<<5)]=V,D.sigBytes=4*O.length,this._process(),this._hash.toX32()},clone:function(){var D=r.clone.call(this);return D._hash=this._hash.clone(),D},blockSize:32}),e.SHA512=r._createHelper(f),e.HmacSHA512=r._createHmacHelper(f)})(),(function(){var t=x,e=(a=t.x64).Word,r=a.WordArray,n=(a=t.algo).SHA512,a=a.SHA384=n.extend({_doReset:function(){this._hash=new r.init([new e.init(3418070365,3238371032),new e.init(1654270250,914150663),new e.init(2438529370,812702999),new e.init(355462360,4144912697),new e.init(1731405415,4290775857),new e.init(2394180231,1750603025),new e.init(3675008525,1694076839),new e.init(1203062813,3204075428)])},_doFinalize:function(){var _=n._doFinalize.call(this);return _.sigBytes-=16,_}});t.SHA384=n._createHelper(a),t.HmacSHA384=n._createHmacHelper(a)})();var B,T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function I(t){var e,r,n="";for(e=0;e+3<=t.length;e+=3)r=parseInt(t.substring(e,e+3),16),n+=T.charAt(r>>6)+T.charAt(63&r);for(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),n+=T.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),n+=T.charAt(r>>2)+T.charAt((3&r)<<4)),"=";(3&n.length)>0;)n+="=";return n}function Q(t){var e,r,n,a="",f=0;for(e=0;e<t.length&&t.charAt(e)!="=";++e)(n=T.indexOf(t.charAt(e)))<0||(f==0?(a+=Re(n>>2),r=3&n,f=1):f==1?(a+=Re(r<<2|n>>4),r=15&n,f=2):f==2?(a+=Re(r),a+=Re(n>>2),r=3&n,f=3):(a+=Re(r<<2|n>>4),a+=Re(15&n),f=0));return f==1&&(a+=Re(r<<2)),a}function ne(t){var e,r=Q(t),n=new Array;for(e=0;2*e<r.length;++e)n[e]=parseInt(r.substring(2*e,2*e+2),16);return n}function N(t,e,r){t!=null&&(typeof t=="number"?this.fromNumber(t,e,r):e==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,e))}function ie(){return new N(null)}U.appName=="Microsoft Internet Explorer"?(N.prototype.am=function(e,r,n,a,f,_){for(var P=32767&r,F=r>>15;--_>=0;){var k=32767&this[e],D=this[e++]>>15,O=F*k+D*P;f=((k=P*k+((32767&O)<<15)+n[a]+(1073741823&f))>>>30)+(O>>>15)+F*D+(f>>>30),n[a++]=1073741823&k}return f},B=30):U.appName!="Netscape"?(N.prototype.am=function(e,r,n,a,f,_){for(;--_>=0;){var P=r*this[e++]+n[a]+f;f=Math.floor(P/67108864),n[a++]=67108863&P}return f},B=26):(N.prototype.am=function(e,r,n,a,f,_){for(var P=16383&r,F=r>>14;--_>=0;){var k=16383&this[e],D=this[e++]>>14,O=F*k+D*P;f=((k=P*k+((16383&O)<<14)+n[a]+f)>>28)+(O>>14)+F*D,n[a++]=268435455&k}return f},B=28),N.prototype.DB=B,N.prototype.DM=(1<<B)-1,N.prototype.DV=1<<B,N.prototype.FV=Math.pow(2,52),N.prototype.F1=52-B,N.prototype.F2=2*B-52;var ye,me,je=new Array;for(ye=48,me=0;me<=9;++me)je[ye++]=me;for(ye=97,me=10;me<36;++me)je[ye++]=me;for(ye=65,me=10;me<36;++me)je[ye++]=me;function Re(t){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)}function ze(t,e){var r=je[t.charCodeAt(e)];return r??-1}function Le(t){var e=ie();return e.fromInt(t),e}function Ge(t){var e,r=1;return(e=t>>>16)!=0&&(t=e,r+=16),(e=t>>8)!=0&&(t=e,r+=8),(e=t>>4)!=0&&(t=e,r+=4),(e=t>>2)!=0&&(t=e,r+=2),(e=t>>1)!=0&&(t=e,r+=1),r}function fe(t){this.m=t}function ve(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function We(t,e){return t&e}function Ye(t,e){return t|e}function rt(t,e){return t^e}function nt(t,e){return t&~e}function ct(t){if(t==0)return-1;var e=0;return(65535&t)==0&&(t>>=16,e+=16),(255&t)==0&&(t>>=8,e+=8),(15&t)==0&&(t>>=4,e+=4),(3&t)==0&&(t>>=2,e+=2),(1&t)==0&&++e,e}function Et(t){for(var e=0;t!=0;)t&=t-1,++e;return e}function Xe(){}function it(t){return t}function Ke(t){this.r2=ie(),this.q3=ie(),N.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}fe.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},fe.prototype.revert=function(e){return e},fe.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},fe.prototype.mulTo=function(e,r,n){e.multiplyTo(r,n),this.reduce(n)},fe.prototype.sqrTo=function(e,r){e.squareTo(r),this.reduce(r)},ve.prototype.convert=function(e){var r=ie();return e.abs().dlShiftTo(this.m.t,r),r.divRemTo(this.m,null,r),e.s<0&&r.compareTo(N.ZERO)>0&&this.m.subTo(r,r),r},ve.prototype.revert=function(e){var r=ie();return e.copyTo(r),this.reduce(r),r},ve.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var r=0;r<this.m.t;++r){var n=32767&e[r],a=n*this.mpl+((n*this.mph+(e[r]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[n=r+this.m.t]+=this.m.am(0,a,e,r,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},ve.prototype.mulTo=function(e,r,n){e.multiplyTo(r,n),this.reduce(n)},ve.prototype.sqrTo=function(e,r){e.squareTo(r),this.reduce(r)},N.prototype.copyTo=function(e){for(var r=this.t-1;r>=0;--r)e[r]=this[r];e.t=this.t,e.s=this.s},N.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},N.prototype.fromString=function(e,r){var n;if(r==16)n=4;else if(r==8)n=3;else if(r==256)n=8;else if(r==2)n=1;else if(r==32)n=5;else{if(r!=4)return void this.fromRadix(e,r);n=2}this.t=0,this.s=0;for(var a=e.length,f=!1,_=0;--a>=0;){var P=n==8?255&e[a]:ze(e,a);P<0?e.charAt(a)=="-"&&(f=!0):(f=!1,_==0?this[this.t++]=P:_+n>this.DB?(this[this.t-1]|=(P&(1<<this.DB-_)-1)<<_,this[this.t++]=P>>this.DB-_):this[this.t-1]|=P<<_,(_+=n)>=this.DB&&(_-=this.DB))}n==8&&(128&e[0])!=0&&(this.s=-1,_>0&&(this[this.t-1]|=(1<<this.DB-_)-1<<_)),this.clamp(),f&&N.ZERO.subTo(this,this)},N.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},N.prototype.dlShiftTo=function(e,r){var n;for(n=this.t-1;n>=0;--n)r[n+e]=this[n];for(n=e-1;n>=0;--n)r[n]=0;r.t=this.t+e,r.s=this.s},N.prototype.drShiftTo=function(e,r){for(var n=e;n<this.t;++n)r[n-e]=this[n];r.t=Math.max(this.t-e,0),r.s=this.s},N.prototype.lShiftTo=function(e,r){var n,a=e%this.DB,f=this.DB-a,_=(1<<f)-1,P=Math.floor(e/this.DB),F=this.s<<a&this.DM;for(n=this.t-1;n>=0;--n)r[n+P+1]=this[n]>>f|F,F=(this[n]&_)<<a;for(n=P-1;n>=0;--n)r[n]=0;r[P]=F,r.t=this.t+P+1,r.s=this.s,r.clamp()},N.prototype.rShiftTo=function(e,r){r.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)r.t=0;else{var a=e%this.DB,f=this.DB-a,_=(1<<a)-1;r[0]=this[n]>>a;for(var P=n+1;P<this.t;++P)r[P-n-1]|=(this[P]&_)<<f,r[P-n]=this[P]>>a;a>0&&(r[this.t-n-1]|=(this.s&_)<<f),r.t=this.t-n,r.clamp()}},N.prototype.subTo=function(e,r){for(var n=0,a=0,f=Math.min(e.t,this.t);n<f;)a+=this[n]-e[n],r[n++]=a&this.DM,a>>=this.DB;if(e.t<this.t){for(a-=e.s;n<this.t;)a+=this[n],r[n++]=a&this.DM,a>>=this.DB;a+=this.s}else{for(a+=this.s;n<e.t;)a-=e[n],r[n++]=a&this.DM,a>>=this.DB;a-=e.s}r.s=a<0?-1:0,a<-1?r[n++]=this.DV+a:a>0&&(r[n++]=a),r.t=n,r.clamp()},N.prototype.multiplyTo=function(e,r){var n=this.abs(),a=e.abs(),f=n.t;for(r.t=f+a.t;--f>=0;)r[f]=0;for(f=0;f<a.t;++f)r[f+n.t]=n.am(0,a[f],r,f,0,n.t);r.s=0,r.clamp(),this.s!=e.s&&N.ZERO.subTo(r,r)},N.prototype.squareTo=function(e){for(var r=this.abs(),n=e.t=2*r.t;--n>=0;)e[n]=0;for(n=0;n<r.t-1;++n){var a=r.am(n,r[n],e,2*n,0,1);(e[n+r.t]+=r.am(n+1,2*r[n],e,2*n+1,a,r.t-n-1))>=r.DV&&(e[n+r.t]-=r.DV,e[n+r.t+1]=1)}e.t>0&&(e[e.t-1]+=r.am(n,r[n],e,2*n,0,1)),e.s=0,e.clamp()},N.prototype.divRemTo=function(e,r,n){var a=e.abs();if(!(a.t<=0)){var f=this.abs();if(f.t<a.t)return r?.fromInt(0),void(n!=null&&this.copyTo(n));n==null&&(n=ie());var _=ie(),P=this.s,F=e.s,k=this.DB-Ge(a[a.t-1]);k>0?(a.lShiftTo(k,_),f.lShiftTo(k,n)):(a.copyTo(_),f.copyTo(n));var D=_.t,O=_[D-1];if(O!=0){var V=O*(1<<this.F1)+(D>1?_[D-2]>>this.F2:0),z=this.FV/V,G=(1<<this.F1)/V,Z=1<<this.F2,ee=n.t,m=ee-D,L=r??ie();for(_.dlShiftTo(m,L),n.compareTo(L)>=0&&(n[n.t++]=1,n.subTo(L,n)),N.ONE.dlShiftTo(D,L),L.subTo(_,_);_.t<D;)_[_.t++]=0;for(;--m>=0;){var M=n[--ee]==O?this.DM:Math.floor(n[ee]*z+(n[ee-1]+Z)*G);if((n[ee]+=_.am(0,M,n,m,0,D))<M)for(_.dlShiftTo(m,L),n.subTo(L,n);n[ee]<--M;)n.subTo(L,n)}r!=null&&(n.drShiftTo(D,r),P!=F&&N.ZERO.subTo(r,r)),n.t=D,n.clamp(),k>0&&n.rShiftTo(k,n),P<0&&N.ZERO.subTo(n,n)}}},N.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if((1&e)==0)return 0;var r=3&e;return(r=(r=(r=(r=r*(2-(15&e)*r)&15)*(2-(255&e)*r)&255)*(2-((65535&e)*r&65535))&65535)*(2-e*r%this.DV)%this.DV)>0?this.DV-r:-r},N.prototype.isEven=function(){return(this.t>0?1&this[0]:this.s)==0},N.prototype.exp=function(e,r){if(e>4294967295||e<1)return N.ONE;var n=ie(),a=ie(),f=r.convert(this),_=Ge(e)-1;for(f.copyTo(n);--_>=0;)if(r.sqrTo(n,a),(e&1<<_)>0)r.mulTo(a,f,n);else{var P=n;n=a,a=P}return r.revert(n)},N.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var r;if(e==16)r=4;else if(e==8)r=3;else if(e==2)r=1;else if(e==32)r=5;else{if(e!=4)return this.toRadix(e);r=2}var n,a=(1<<r)-1,f=!1,_="",P=this.t,F=this.DB-P*this.DB%r;if(P-- >0)for(F<this.DB&&(n=this[P]>>F)>0&&(f=!0,_=Re(n));P>=0;)F<r?(n=(this[P]&(1<<F)-1)<<r-F,n|=this[--P]>>(F+=this.DB-r)):(n=this[P]>>(F-=r)&a,F<=0&&(F+=this.DB,--P)),n>0&&(f=!0),f&&(_+=Re(n));return f?_:"0"},N.prototype.negate=function(){var e=ie();return N.ZERO.subTo(this,e),e},N.prototype.abs=function(){return this.s<0?this.negate():this},N.prototype.compareTo=function(e){var r=this.s-e.s;if(r!=0)return r;var n=this.t;if((r=n-e.t)!=0)return this.s<0?-r:r;for(;--n>=0;)if((r=this[n]-e[n])!=0)return r;return 0},N.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+Ge(this[this.t-1]^this.s&this.DM)},N.prototype.mod=function(e){var r=ie();return this.abs().divRemTo(e,null,r),this.s<0&&r.compareTo(N.ZERO)>0&&e.subTo(r,r),r},N.prototype.modPowInt=function(e,r){var n;return n=e<256||r.isEven()?new fe(r):new ve(r),this.exp(e,n)},N.ZERO=Le(0),N.ONE=Le(1),Xe.prototype.convert=it,Xe.prototype.revert=it,Xe.prototype.mulTo=function(e,r,n){e.multiplyTo(r,n)},Xe.prototype.sqrTo=function(e,r){e.squareTo(r)},Ke.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var r=ie();return e.copyTo(r),this.reduce(r),r},Ke.prototype.revert=function(e){return e},Ke.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},Ke.prototype.mulTo=function(e,r,n){e.multiplyTo(r,n),this.reduce(n)},Ke.prototype.sqrTo=function(e,r){e.squareTo(r),this.reduce(r)};var xe=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],q=(1<<26)/xe[xe.length-1];function g(){this.i=0,this.j=0,this.S=new Array}N.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},N.prototype.toRadix=function(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var r=this.chunkSize(e),n=Math.pow(e,r),a=Le(n),f=ie(),_=ie(),P="";for(this.divRemTo(a,f,_);f.signum()>0;)P=(n+_.intValue()).toString(e).substr(1)+P,f.divRemTo(a,f,_);return _.intValue().toString(e)+P},N.prototype.fromRadix=function(e,r){this.fromInt(0),r==null&&(r=10);for(var n=this.chunkSize(r),a=Math.pow(r,n),f=!1,_=0,P=0,F=0;F<e.length;++F){var k=ze(e,F);k<0?e.charAt(F)=="-"&&this.signum()==0&&(f=!0):(P=r*P+k,++_>=n&&(this.dMultiply(a),this.dAddOffset(P,0),_=0,P=0))}_>0&&(this.dMultiply(Math.pow(r,_)),this.dAddOffset(P,0)),f&&N.ZERO.subTo(this,this)},N.prototype.fromNumber=function(e,r,n){if(typeof r=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(N.ONE.shiftLeft(e-1),Ye,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(r);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(N.ONE.shiftLeft(e-1),this);else{var a=new Array,f=7&e;a.length=1+(e>>3),r.nextBytes(a),f>0?a[0]&=(1<<f)-1:a[0]=0,this.fromString(a,256)}},N.prototype.bitwiseTo=function(e,r,n){var a,f,_=Math.min(e.t,this.t);for(a=0;a<_;++a)n[a]=r(this[a],e[a]);if(e.t<this.t){for(f=e.s&this.DM,a=_;a<this.t;++a)n[a]=r(this[a],f);n.t=this.t}else{for(f=this.s&this.DM,a=_;a<e.t;++a)n[a]=r(f,e[a]);n.t=e.t}n.s=r(this.s,e.s),n.clamp()},N.prototype.changeBit=function(e,r){var n=N.ONE.shiftLeft(e);return this.bitwiseTo(n,r,n),n},N.prototype.addTo=function(e,r){for(var n=0,a=0,f=Math.min(e.t,this.t);n<f;)a+=this[n]+e[n],r[n++]=a&this.DM,a>>=this.DB;if(e.t<this.t){for(a+=e.s;n<this.t;)a+=this[n],r[n++]=a&this.DM,a>>=this.DB;a+=this.s}else{for(a+=this.s;n<e.t;)a+=e[n],r[n++]=a&this.DM,a>>=this.DB;a+=e.s}r.s=a<0?-1:0,a>0?r[n++]=a:a<-1&&(r[n++]=this.DV+a),r.t=n,r.clamp()},N.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},N.prototype.dAddOffset=function(e,r){if(e!=0){for(;this.t<=r;)this[this.t++]=0;for(this[r]+=e;this[r]>=this.DV;)this[r]-=this.DV,++r>=this.t&&(this[this.t++]=0),++this[r]}},N.prototype.multiplyLowerTo=function(e,r,n){var a,f=Math.min(this.t+e.t,r);for(n.s=0,n.t=f;f>0;)n[--f]=0;for(a=n.t-this.t;f<a;++f)n[f+this.t]=this.am(0,e[f],n,f,0,this.t);for(a=Math.min(e.t,r);f<a;++f)this.am(0,e[f],n,f,0,r-f);n.clamp()},N.prototype.multiplyUpperTo=function(e,r,n){--r;var a=n.t=this.t+e.t-r;for(n.s=0;--a>=0;)n[a]=0;for(a=Math.max(r-this.t,0);a<e.t;++a)n[this.t+a-r]=this.am(r-a,e[a],n,0,0,this.t+a-r);n.clamp(),n.drShiftTo(1,n)},N.prototype.modInt=function(e){if(e<=0)return 0;var r=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(r==0)n=this[0]%e;else for(var a=this.t-1;a>=0;--a)n=(r*n+this[a])%e;return n},N.prototype.millerRabin=function(e){var r=this.subtract(N.ONE),n=r.getLowestSetBit();if(n<=0)return!1;var a=r.shiftRight(n);(e=e+1>>1)>xe.length&&(e=xe.length);for(var f=ie(),_=0;_<e;++_){f.fromInt(xe[Math.floor(Math.random()*xe.length)]);var P=f.modPow(a,this);if(P.compareTo(N.ONE)!=0&&P.compareTo(r)!=0){for(var F=1;F++<n&&P.compareTo(r)!=0;)if((P=P.modPowInt(2,this)).compareTo(N.ONE)==0)return!1;if(P.compareTo(r)!=0)return!1}}return!0},N.prototype.clone=function(){var e=ie();return this.copyTo(e),e},N.prototype.intValue=function(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},N.prototype.byteValue=function(){return this.t==0?this.s:this[0]<<24>>24},N.prototype.shortValue=function(){return this.t==0?this.s:this[0]<<16>>16},N.prototype.signum=function(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1},N.prototype.toByteArray=function(){var e=this.t,r=new Array;r[0]=this.s;var n,a=this.DB-e*this.DB%8,f=0;if(e-- >0)for(a<this.DB&&(n=this[e]>>a)!=(this.s&this.DM)>>a&&(r[f++]=n|this.s<<this.DB-a);e>=0;)a<8?(n=(this[e]&(1<<a)-1)<<8-a,n|=this[--e]>>(a+=this.DB-8)):(n=this[e]>>(a-=8)&255,a<=0&&(a+=this.DB,--e)),(128&n)!=0&&(n|=-256),f==0&&(128&this.s)!=(128&n)&&++f,(f>0||n!=this.s)&&(r[f++]=n);return r},N.prototype.equals=function(e){return this.compareTo(e)==0},N.prototype.min=function(e){return this.compareTo(e)<0?this:e},N.prototype.max=function(e){return this.compareTo(e)>0?this:e},N.prototype.and=function(e){var r=ie();return this.bitwiseTo(e,We,r),r},N.prototype.or=function(e){var r=ie();return this.bitwiseTo(e,Ye,r),r},N.prototype.xor=function(e){var r=ie();return this.bitwiseTo(e,rt,r),r},N.prototype.andNot=function(e){var r=ie();return this.bitwiseTo(e,nt,r),r},N.prototype.not=function(){for(var e=ie(),r=0;r<this.t;++r)e[r]=this.DM&~this[r];return e.t=this.t,e.s=~this.s,e},N.prototype.shiftLeft=function(e){var r=ie();return e<0?this.rShiftTo(-e,r):this.lShiftTo(e,r),r},N.prototype.shiftRight=function(e){var r=ie();return e<0?this.lShiftTo(-e,r):this.rShiftTo(e,r),r},N.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+ct(this[e]);return this.s<0?this.t*this.DB:-1},N.prototype.bitCount=function(){for(var e=0,r=this.s&this.DM,n=0;n<this.t;++n)e+=Et(this[n]^r);return e},N.prototype.testBit=function(e){var r=Math.floor(e/this.DB);return r>=this.t?this.s!=0:(this[r]&1<<e%this.DB)!=0},N.prototype.setBit=function(e){return this.changeBit(e,Ye)},N.prototype.clearBit=function(e){return this.changeBit(e,nt)},N.prototype.flipBit=function(e){return this.changeBit(e,rt)},N.prototype.add=function(e){var r=ie();return this.addTo(e,r),r},N.prototype.subtract=function(e){var r=ie();return this.subTo(e,r),r},N.prototype.multiply=function(e){var r=ie();return this.multiplyTo(e,r),r},N.prototype.divide=function(e){var r=ie();return this.divRemTo(e,r,null),r},N.prototype.remainder=function(e){var r=ie();return this.divRemTo(e,null,r),r},N.prototype.divideAndRemainder=function(e){var r=ie(),n=ie();return this.divRemTo(e,r,n),new Array(r,n)},N.prototype.modPow=function(e,r){var n,a,f=e.bitLength(),_=Le(1);if(f<=0)return _;n=f<18?1:f<48?3:f<144?4:f<768?5:6,a=f<8?new fe(r):r.isEven()?new Ke(r):new ve(r);var P=new Array,F=3,k=n-1,D=(1<<n)-1;if(P[1]=a.convert(this),n>1){var O=ie();for(a.sqrTo(P[1],O);F<=D;)P[F]=ie(),a.mulTo(O,P[F-2],P[F]),F+=2}var V,z,G=e.t-1,Z=!0,ee=ie();for(f=Ge(e[G])-1;G>=0;){for(f>=k?V=e[G]>>f-k&D:(V=(e[G]&(1<<f+1)-1)<<k-f,G>0&&(V|=e[G-1]>>this.DB+f-k)),F=n;(1&V)==0;)V>>=1,--F;if((f-=F)<0&&(f+=this.DB,--G),Z)P[V].copyTo(_),Z=!1;else{for(;F>1;)a.sqrTo(_,ee),a.sqrTo(ee,_),F-=2;F>0?a.sqrTo(_,ee):(z=_,_=ee,ee=z),a.mulTo(ee,P[V],_)}for(;G>=0&&(e[G]&1<<f)==0;)a.sqrTo(_,ee),z=_,_=ee,ee=z,--f<0&&(f=this.DB-1,--G)}return a.revert(_)},N.prototype.modInverse=function(e){var r=e.isEven();if(this.isEven()&&r||e.signum()==0)return N.ZERO;for(var n=e.clone(),a=this.clone(),f=Le(1),_=Le(0),P=Le(0),F=Le(1);n.signum()!=0;){for(;n.isEven();)n.rShiftTo(1,n),r?(f.isEven()&&_.isEven()||(f.addTo(this,f),_.subTo(e,_)),f.rShiftTo(1,f)):_.isEven()||_.subTo(e,_),_.rShiftTo(1,_);for(;a.isEven();)a.rShiftTo(1,a),r?(P.isEven()&&F.isEven()||(P.addTo(this,P),F.subTo(e,F)),P.rShiftTo(1,P)):F.isEven()||F.subTo(e,F),F.rShiftTo(1,F);n.compareTo(a)>=0?(n.subTo(a,n),r&&f.subTo(P,f),_.subTo(F,_)):(a.subTo(n,a),r&&P.subTo(f,P),F.subTo(_,F))}return a.compareTo(N.ONE)!=0?N.ZERO:F.compareTo(e)>=0?F.subtract(e):F.signum()<0?(F.addTo(e,F),F.signum()<0?F.add(e):F):F},N.prototype.pow=function(e){return this.exp(e,new Xe)},N.prototype.gcd=function(e){var r=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(r.compareTo(n)<0){var a=r;r=n,n=a}var f=r.getLowestSetBit(),_=n.getLowestSetBit();if(_<0)return r;for(f<_&&(_=f),_>0&&(r.rShiftTo(_,r),n.rShiftTo(_,n));r.signum()>0;)(f=r.getLowestSetBit())>0&&r.rShiftTo(f,r),(f=n.getLowestSetBit())>0&&n.rShiftTo(f,n),r.compareTo(n)>=0?(r.subTo(n,r),r.rShiftTo(1,r)):(n.subTo(r,n),n.rShiftTo(1,n));return _>0&&n.lShiftTo(_,n),n},N.prototype.isProbablePrime=function(e){var r,n=this.abs();if(n.t==1&&n[0]<=xe[xe.length-1]){for(r=0;r<xe.length;++r)if(n[0]==xe[r])return!0;return!1}if(n.isEven())return!1;for(r=1;r<xe.length;){for(var a=xe[r],f=r+1;f<xe.length&&a<q;)a*=xe[f++];for(a=n.modInt(a);r<f;)if(a%xe[r++]==0)return!1}return n.millerRabin(e)},N.prototype.square=function(){var e=ie();return this.squareTo(e),e},g.prototype.init=function(e){var r,n,a;for(r=0;r<256;++r)this.S[r]=r;for(n=0,r=0;r<256;++r)n=n+this.S[r]+e[r%e.length]&255,a=this.S[r],this.S[r]=this.S[n],this.S[n]=a;this.i=0,this.j=0},g.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]};var p,j,$;function X(){(function(e){j[$++]^=255&e,j[$++]^=e>>8&255,j[$++]^=e>>16&255,j[$++]^=e>>24&255,$>=256&&($-=256)})(new Date().getTime())}if(j==null){var re;if(j=new Array,$=0,W!==void 0&&(W.crypto!==void 0||W.msCrypto!==void 0)){var ce=W.crypto||W.msCrypto;if(ce.getRandomValues){var de=new Uint8Array(32);for(ce.getRandomValues(de),re=0;re<32;++re)j[$++]=de[re]}else if(U.appName=="Netscape"&&U.appVersion<"5"){var we=W.crypto.random(32);for(re=0;re<we.length;++re)j[$++]=255&we.charCodeAt(re)}}for(;$<256;)re=Math.floor(65536*Math.random()),j[$++]=re>>>8,j[$++]=255&re;$=0,X()}function _e(){if(p==null){for(X(),(p=(function(){return new g})()).init(j),$=0;$<j.length;++$)j[$]=0;$=0}return p.next()}function Se(){}function ot(t,e){return new N(t,e)}function ft(t,e,r){for(var n="",a=0;n.length<e;)n+=r(String.fromCharCode.apply(String,t.concat([(4278190080&a)>>24,(16711680&a)>>16,(65280&a)>>8,255&a]))),a+=1;return n}function le(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function Pe(t,e){this.x=e,this.q=t}function pe(t,e,r,n){this.curve=t,this.x=e,this.y=r,this.z=n??N.ONE,this.zinv=null}function lt(t,e,r){this.q=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(r),this.infinity=new pe(this,null,null)}Se.prototype.nextBytes=function(e){var r;for(r=0;r<e.length;++r)e[r]=_e()},le.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},le.prototype.setPublic=function(e,r){if(this.isPublic=!0,this.isPrivate=!1,typeof e!="string")this.n=e,this.e=r;else{if(!(e!=null&&r!=null&&e.length>0&&r.length>0))throw"Invalid RSA public key";this.n=ot(e,16),this.e=parseInt(r,16)}},le.prototype.encrypt=function(e){var r=(function(_,P){if(P<_.length+11)throw"Message too long for RSA";for(var F=new Array,k=_.length-1;k>=0&&P>0;){var D=_.charCodeAt(k--);D<128?F[--P]=D:D>127&&D<2048?(F[--P]=63&D|128,F[--P]=D>>6|192):(F[--P]=63&D|128,F[--P]=D>>6&63|128,F[--P]=D>>12|224)}F[--P]=0;for(var O=new Se,V=new Array;P>2;){for(V[0]=0;V[0]==0;)O.nextBytes(V);F[--P]=V[0]}return F[--P]=2,F[--P]=0,new N(F)})(e,this.n.bitLength()+7>>3);if(r==null)return null;var n=this.doPublic(r);if(n==null)return null;var a=n.toString(16);return(1&a.length)==0?a:"0"+a},le.prototype.encryptOAEP=function(e,r,n){var a=(function(F,k,D,O){var V=E.crypto.MessageDigest,z=E.crypto.Util,G=null;if(D||(D="sha1"),typeof D=="string"&&(G=V.getCanonicalAlgName(D),O=V.getHashLength(G),D=function(oe){return ht(z.hashHex(_t(oe),G))}),F.length+2*O+2>k)throw"Message too long for RSA";var Z,ee="";for(Z=0;Z<k-F.length-2*O-2;Z+=1)ee+="\0";var m=D("")+ee+""+F,L=new Array(O);new Se().nextBytes(L);var M=ft(L,m.length,D),K=[];for(Z=0;Z<m.length;Z+=1)K[Z]=m.charCodeAt(Z)^M.charCodeAt(Z);var Y=ft(K,L.length,D),te=[0];for(Z=0;Z<L.length;Z+=1)te[Z+1]=L[Z]^Y.charCodeAt(Z);return new N(te.concat(K))})(e,this.n.bitLength()+7>>3,r,n);if(a==null)return null;var f=this.doPublic(a);if(f==null)return null;var _=f.toString(16);return(1&_.length)==0?_:"0"+_},le.prototype.type="RSA",Pe.prototype.equals=function(e){return e==this||this.q.equals(e.q)&&this.x.equals(e.x)},Pe.prototype.toBigInteger=function(){return this.x},Pe.prototype.negate=function(){return new Pe(this.q,this.x.negate().mod(this.q))},Pe.prototype.add=function(e){return new Pe(this.q,this.x.add(e.toBigInteger()).mod(this.q))},Pe.prototype.subtract=function(e){return new Pe(this.q,this.x.subtract(e.toBigInteger()).mod(this.q))},Pe.prototype.multiply=function(e){return new Pe(this.q,this.x.multiply(e.toBigInteger()).mod(this.q))},Pe.prototype.square=function(){return new Pe(this.q,this.x.square().mod(this.q))},Pe.prototype.divide=function(e){return new Pe(this.q,this.x.multiply(e.toBigInteger().modInverse(this.q)).mod(this.q))},pe.prototype.getX=function(){return this.zinv==null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},pe.prototype.getY=function(){return this.zinv==null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},pe.prototype.equals=function(e){return e==this||(this.isInfinity()?e.isInfinity():e.isInfinity()?this.isInfinity():!!e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q).equals(N.ZERO)&&e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q).equals(N.ZERO))},pe.prototype.isInfinity=function(){return this.x==null&&this.y==null||this.z.equals(N.ZERO)&&!this.y.toBigInteger().equals(N.ZERO)},pe.prototype.negate=function(){return new pe(this.curve,this.x,this.y.negate(),this.z)},pe.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q),n=e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q);if(N.ZERO.equals(n))return N.ZERO.equals(r)?this.twice():this.curve.getInfinity();var a=new N("3"),f=this.x.toBigInteger(),_=this.y.toBigInteger(),P=(e.x.toBigInteger(),e.y.toBigInteger(),n.square()),F=P.multiply(n),k=f.multiply(P),D=r.square().multiply(this.z),O=D.subtract(k.shiftLeft(1)).multiply(e.z).subtract(F).multiply(n).mod(this.curve.q),V=k.multiply(a).multiply(r).subtract(_.multiply(F)).subtract(D.multiply(r)).multiply(e.z).add(r.multiply(F)).mod(this.curve.q),z=F.multiply(this.z).multiply(e.z).mod(this.curve.q);return new pe(this.curve,this.curve.fromBigInteger(O),this.curve.fromBigInteger(V),z)},pe.prototype.twice=function(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var e=new N("3"),r=this.x.toBigInteger(),n=this.y.toBigInteger(),a=n.multiply(this.z),f=a.multiply(n).mod(this.curve.q),_=this.curve.a.toBigInteger(),P=r.square().multiply(e);N.ZERO.equals(_)||(P=P.add(this.z.square().multiply(_)));var F=(P=P.mod(this.curve.q)).square().subtract(r.shiftLeft(3).multiply(f)).shiftLeft(1).multiply(a).mod(this.curve.q),k=P.multiply(e).multiply(r).subtract(f.shiftLeft(1)).shiftLeft(2).multiply(f).subtract(P.square().multiply(P)).mod(this.curve.q),D=a.square().multiply(a).shiftLeft(3).mod(this.curve.q);return new pe(this.curve,this.curve.fromBigInteger(F),this.curve.fromBigInteger(k),D)},pe.prototype.multiply=function(e){if(this.isInfinity())return this;if(e.signum()==0)return this.curve.getInfinity();var r,n=e,a=n.multiply(new N("3")),f=this.negate(),_=this,P=this.curve.q.subtract(e),F=P.multiply(new N("3")),k=new pe(this.curve,this.x,this.y),D=k.negate();for(r=a.bitLength()-2;r>0;--r){_=_.twice();var O=a.testBit(r);O!=n.testBit(r)&&(_=_.add(O?this:f))}for(r=F.bitLength()-2;r>0;--r){k=k.twice();var V=F.testBit(r);V!=P.testBit(r)&&(k=k.add(V?k:D))}return _},pe.prototype.multiplyTwo=function(e,r,n){var a;a=e.bitLength()>n.bitLength()?e.bitLength()-1:n.bitLength()-1;for(var f=this.curve.getInfinity(),_=this.add(r);a>=0;)f=f.twice(),e.testBit(a)?f=n.testBit(a)?f.add(_):f.add(this):n.testBit(a)&&(f=f.add(r)),--a;return f},lt.prototype.getQ=function(){return this.q},lt.prototype.getA=function(){return this.a},lt.prototype.getB=function(){return this.b},lt.prototype.equals=function(e){return e==this||this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)},lt.prototype.getInfinity=function(){return this.infinity},lt.prototype.fromBigInteger=function(e){return new Pe(this.q,e)},lt.prototype.decodePointHex=function(e){switch(parseInt(e.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var r=(e.length-2)/2,n=e.substr(2,r),a=e.substr(r+2,r);return new pe(this,this.fromBigInteger(new N(n,16)),this.fromBigInteger(new N(a,16)));default:return null}},Pe.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},pe.prototype.getEncoded=function(t){var e=function(_,P){var F=_.toByteArrayUnsigned();if(P<F.length)F=F.slice(F.length-P);else for(;P>F.length;)F.unshift(0);return F},r=this.getX().toBigInteger(),n=this.getY().toBigInteger(),a=e(r,32);return t?n.isEven()?a.unshift(2):a.unshift(3):(a.unshift(4),a=a.concat(e(n,32))),a},pe.decodeFrom=function(t,e){e[0];var r=e.length-1,n=e.slice(1,1+r/2),a=e.slice(1+r/2,1+r);n.unshift(0),a.unshift(0);var f=new N(n),_=new N(a);return new pe(t,t.fromBigInteger(f),t.fromBigInteger(_))},pe.decodeFromHex=function(t,e){e.substr(0,2);var r=e.length-2,n=e.substr(2,r/2),a=e.substr(2+r/2,r/2),f=new N(n,16),_=new N(a,16);return new pe(t,t.fromBigInteger(f),t.fromBigInteger(_))},pe.prototype.add2D=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;if(this.x.equals(t.x))return this.y.equals(t.y)?this.twice():this.curve.getInfinity();var e=t.x.subtract(this.x),r=t.y.subtract(this.y).divide(e),n=r.square().subtract(this.x).subtract(t.x),a=r.multiply(this.x.subtract(n)).subtract(this.y);return new pe(this.curve,n,a)},pe.prototype.twice2D=function(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var t=this.curve.fromBigInteger(N.valueOf(2)),e=this.curve.fromBigInteger(N.valueOf(3)),r=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(t)),n=r.square().subtract(this.x.multiply(t)),a=r.multiply(this.x.subtract(n)).subtract(this.y);return new pe(this.curve,n,a)},pe.prototype.multiply2D=function(t){if(this.isInfinity())return this;if(t.signum()==0)return this.curve.getInfinity();var e,r=t,n=r.multiply(new N("3")),a=this.negate(),f=this;for(e=n.bitLength()-2;e>0;--e){f=f.twice();var _=n.testBit(e);_!=r.testBit(e)&&(f=f.add2D(_?this:a))}return f},pe.prototype.isOnCurve=function(){var t=this.getX().toBigInteger(),e=this.getY().toBigInteger(),r=this.curve.getA().toBigInteger(),n=this.curve.getB().toBigInteger(),a=this.curve.getQ(),f=e.multiply(e).mod(a),_=t.multiply(t).multiply(t).add(r.multiply(t)).add(n).mod(a);return f.equals(_)},pe.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"},pe.prototype.validate=function(){var t=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var e=this.getX().toBigInteger(),r=this.getY().toBigInteger();if(e.compareTo(N.ONE)<0||e.compareTo(t.subtract(N.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(N.ONE)<0||r.compareTo(t.subtract(N.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(t).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};var un=(function(){var t=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]|(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)|(?:"(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))*"))',"g"),e=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),r={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:`
|
|
3
3
|
`,r:"\r",t:" "};function n(_,P,F){return P?r[P]:String.fromCharCode(parseInt(F,16))}var a=new String(""),f=Object.hasOwnProperty;return function(_,P){var F,k,D=_.match(t),O=D[0],V=!1;O==="{"?F={}:O==="["?F=[]:(F=[],V=!0);for(var z=[F],G=1-V,Z=D.length;G<Z;++G){var ee;switch((O=D[G]).charCodeAt(0)){default:(ee=z[0])[k||ee.length]=+O,k=void 0;break;case 34:if((O=O.substring(1,O.length-1)).indexOf("\\")!==-1&&(O=O.replace(e,n)),ee=z[0],!k){if(!(ee instanceof Array)){k=O||a;break}k=ee.length}ee[k]=O,k=void 0;break;case 91:ee=z[0],z.unshift(ee[k||ee.length]=[]),k=void 0;break;case 93:z.shift();break;case 102:(ee=z[0])[k||ee.length]=!1,k=void 0;break;case 110:(ee=z[0])[k||ee.length]=null,k=void 0;break;case 116:(ee=z[0])[k||ee.length]=!0,k=void 0;break;case 123:ee=z[0],z.unshift(ee[k||ee.length]={}),k=void 0;break;case 125:z.shift()}}if(V){if(z.length!==1)throw new Error;F=F[0]}else if(z.length)throw new Error;return P&&(F=(function m(L,M){var K=L[M];if(K&&(K===void 0?"undefined":C(K))==="object"){var Y=null;for(var te in K)if(f.call(K,te)&&K!==L){var ue=m(K,te);ue!==void 0?K[te]=ue:(Y||(Y=[]),Y.push(te))}if(Y)for(var oe=Y.length;--oe>=0;)delete K[Y[oe]]}return P.call(L,M,K)})({"":F},"")),F}})();E!==void 0&&E||(s.KJUR=E={}),E.asn1!==void 0&&E.asn1||(E.asn1={}),E.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){var e=t.toString(16);if(e.substr(0,1)!="-")e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e);else{var r=e.substr(1).length;r%2==1?r+=1:e.match(/^[0-7]/)||(r+=2);for(var n="",a=0;a<r;a++)n+="f";e=new N(n,16).xor(t).add(N.ONE).toString(16).replace(/^-/,"")}return e},this.getPEMStringFromHex=function(t,e){return st(t,e)},this.newObject=function(t){var e=E.asn1,r=e.ASN1Object,n=e.DERBoolean,a=e.DERInteger,f=e.DERBitString,_=e.DEROctetString,P=e.DERNull,F=e.DERObjectIdentifier,k=e.DEREnumerated,D=e.DERUTF8String,O=e.DERNumericString,V=e.DERPrintableString,z=e.DERTeletexString,G=e.DERIA5String,Z=e.DERUTCTime,ee=e.DERGeneralizedTime,m=e.DERVisibleString,L=e.DERBMPString,M=e.DERSequence,K=e.DERSet,Y=e.DERTaggedObject,te=e.ASN1Util.newObject;if(t instanceof e.ASN1Object)return t;var ue=Object.keys(t);if(ue.length!=1)throw new Error("key of param shall be only one.");var oe=ue[0];if(":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+oe+":")==-1)throw new Error("undefined key: "+oe);if(oe=="bool")return new n(t[oe]);if(oe=="int")return new a(t[oe]);if(oe=="bitstr")return new f(t[oe]);if(oe=="octstr")return new _(t[oe]);if(oe=="null")return new P(t[oe]);if(oe=="oid")return new F(t[oe]);if(oe=="enum")return new k(t[oe]);if(oe=="utf8str")return new D(t[oe]);if(oe=="numstr")return new O(t[oe]);if(oe=="prnstr")return new V(t[oe]);if(oe=="telstr")return new z(t[oe]);if(oe=="ia5str")return new G(t[oe]);if(oe=="utctime")return new Z(t[oe]);if(oe=="gentime")return new ee(t[oe]);if(oe=="visstr")return new m(t[oe]);if(oe=="bmpstr")return new L(t[oe]);if(oe=="asn1")return new r(t[oe]);if(oe=="seq"){for(var ge=t[oe],ae=[],he=0;he<ge.length;he++){var be=te(ge[he]);ae.push(be)}return new M({array:ae})}if(oe=="set"){for(ge=t[oe],ae=[],he=0;he<ge.length;he++)be=te(ge[he]),ae.push(be);return new K({array:ae})}if(oe=="tag"){var Ae=t[oe];if(Object.prototype.toString.call(Ae)==="[object Array]"&&Ae.length==3){var Fe=te(Ae[2]);return new Y({tag:Ae[0],explicit:Ae[1],obj:Fe})}return new Y(Ae)}},this.jsonToASN1HEX=function(t){return this.newObject(t).getEncodedHex()}},E.asn1.ASN1Util.oidHexToInt=function(t){for(var e="",r=parseInt(t.substr(0,2),16),n=(e=Math.floor(r/40)+"."+r%40,""),a=2;a<t.length;a+=2){var f=("00000000"+parseInt(t.substr(a,2),16).toString(2)).slice(-8);n+=f.substr(1,7),f.substr(0,1)=="0"&&(e=e+"."+new N(n,2).toString(10),n="")}return e},E.asn1.ASN1Util.oidIntToHex=function(t){var e=function(F){var k=F.toString(16);return k.length==1&&(k="0"+k),k},r=function(F){var k="",D=new N(F,10).toString(2),O=7-D.length%7;O==7&&(O=0);for(var V="",z=0;z<O;z++)V+="0";for(D=V+D,z=0;z<D.length-1;z+=7){var G=D.substr(z,7);z!=D.length-7&&(G="1"+G),k+=e(parseInt(G,2))}return k};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var n="",a=t.split("."),f=40*parseInt(a[0])+parseInt(a[1]);n+=e(f),a.splice(0,2);for(var _=0;_<a.length;_++)n+=r(a[_]);return n},E.asn1.ASN1Object=function(t){this.params=null,this.getLengthHexFromValue=function(){if(this.hV===void 0||this.hV==null)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n=0,v="+this.hV);var e=this.hV.length/2,r=e.toString(16);if(r.length%2==1&&(r="0"+r),e<128)return r;var n=r.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);return(128+n).toString(16)+r},this.getEncodedHex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(e){this.params=e},t!=null&&t.tlv!=null&&(this.hTLV=t.tlv,this.isModified=!1)},E.asn1.DERAbstractString=function(t){E.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=Fr(this.s).toLowerCase()},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},t!==void 0&&(typeof t=="string"?this.setString(t):t.str!==void 0?this.setString(t.str):t.hex!==void 0&&this.setStringHex(t.hex))},Ie(E.asn1.DERAbstractString,E.asn1.ASN1Object),E.asn1.DERAbstractTime=function(t){E.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(e){var r=e.getTime()+6e4*e.getTimezoneOffset();return new Date(r)},this.formatDate=function(e,r,n){var a=this.zeroPadding,f=this.localDateToUTC(e),_=String(f.getFullYear());r=="utc"&&(_=_.substr(2,2));var P=_+a(String(f.getMonth()+1),2)+a(String(f.getDate()),2)+a(String(f.getHours()),2)+a(String(f.getMinutes()),2)+a(String(f.getSeconds()),2);if(n===!0){var F=f.getMilliseconds();if(F!=0){var k=a(String(F),3);P=P+"."+(k=k.replace(/[0]+$/,""))}}return P+"Z"},this.zeroPadding=function(e,r){return e.length>=r?e:new Array(r-e.length+1).join("0")+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=Ft(e)},this.setByDateValue=function(e,r,n,a,f,_){var P=new Date(Date.UTC(e,r-1,n,a,f,_,0));this.setByDate(P)},this.getFreshValueHex=function(){return this.hV}},Ie(E.asn1.DERAbstractTime,E.asn1.ASN1Object),E.asn1.DERAbstractStructured=function(t){E.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,t!==void 0&&t.array!==void 0&&(this.asn1Array=t.array)},Ie(E.asn1.DERAbstractStructured,E.asn1.ASN1Object),E.asn1.DERBoolean=function(t){E.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=t==0?"010100":"0101ff"},Ie(E.asn1.DERBoolean,E.asn1.ASN1Object),E.asn1.DERInteger=function(t){E.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=E.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var r=new N(String(e),10);this.setByBigInteger(r)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},t!==void 0&&(t.bigint!==void 0?this.setByBigInteger(t.bigint):t.int!==void 0?this.setByInteger(t.int):typeof t=="number"?this.setByInteger(t):t.hex!==void 0&&this.setValueHex(t.hex))},Ie(E.asn1.DERInteger,E.asn1.ASN1Object),E.asn1.DERBitString=function(t){if(t!==void 0&&t.obj!==void 0){var e=E.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}E.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(r){this.hTLV=null,this.isModified=!0,this.hV=r},this.setUnusedBitsAndHexValue=function(r,n){if(r<0||7<r)throw"unused bits shall be from 0 to 7: u = "+r;var a="0"+r;this.hTLV=null,this.isModified=!0,this.hV=a+n},this.setByBinaryString=function(r){var n=8-(r=r.replace(/0+$/,"")).length%8;n==8&&(n=0);for(var a=0;a<=n;a++)r+="0";var f="";for(a=0;a<r.length-1;a+=8){var _=r.substr(a,8),P=parseInt(_,2).toString(16);P.length==1&&(P="0"+P),f+=P}this.hTLV=null,this.isModified=!0,this.hV="0"+n+f},this.setByBooleanArray=function(r){for(var n="",a=0;a<r.length;a++)r[a]==1?n+="1":n+="0";this.setByBinaryString(n)},this.newFalseArray=function(r){for(var n=new Array(r),a=0;a<r;a++)n[a]=!1;return n},this.getFreshValueHex=function(){return this.hV},t!==void 0&&(typeof t=="string"&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):t.hex!==void 0?this.setHexValueIncludingUnusedBits(t.hex):t.bin!==void 0?this.setByBinaryString(t.bin):t.array!==void 0&&this.setByBooleanArray(t.array))},Ie(E.asn1.DERBitString,E.asn1.ASN1Object),E.asn1.DEROctetString=function(t){if(t!==void 0&&t.obj!==void 0){var e=E.asn1.ASN1Util.newObject(t.obj);t.hex=e.getEncodedHex()}E.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},Ie(E.asn1.DEROctetString,E.asn1.DERAbstractString),E.asn1.DERNull=function(){E.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},Ie(E.asn1.DERNull,E.asn1.ASN1Object),E.asn1.DERObjectIdentifier=function(t){E.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){var r=(function(a){var f=function(V){var z=V.toString(16);return z.length==1&&(z="0"+z),z},_=function(V){var z="",G=parseInt(V,10).toString(2),Z=7-G.length%7;Z==7&&(Z=0);for(var ee="",m=0;m<Z;m++)ee+="0";for(G=ee+G,m=0;m<G.length-1;m+=7){var L=G.substr(m,7);m!=G.length-7&&(L="1"+L),z+=f(parseInt(L,2))}return z};try{if(!a.match(/^[0-9.]+$/))return null;var P="",F=a.split("."),k=40*parseInt(F[0],10)+parseInt(F[1],10);P+=f(k),F.splice(0,2);for(var D=0;D<F.length;D++)P+=_(F[D]);return P}catch{return null}})(e);if(r==null)throw new Error("malformed oid string: "+e);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.setValueName=function(e){var r=E.asn1.x509.OID.name2oid(e);if(r==="")throw new Error("DERObjectIdentifier oidName undefined: "+e);this.setValueOidString(r)},this.setValueNameOrOid=function(e){e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(e){typeof e=="string"?this.setValueNameOrOid(e):e.oid!==void 0?this.setValueNameOrOid(e.oid):e.name!==void 0?this.setValueNameOrOid(e.name):e.hex!==void 0&&this.setValueHex(e.hex)},t!==void 0&&this.setByParam(t)},Ie(E.asn1.DERObjectIdentifier,E.asn1.ASN1Object),E.asn1.DEREnumerated=function(t){E.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=E.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var r=new N(String(e),10);this.setByBigInteger(r)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},t!==void 0&&(t.int!==void 0?this.setByInteger(t.int):typeof t=="number"?this.setByInteger(t):t.hex!==void 0&&this.setValueHex(t.hex))},Ie(E.asn1.DEREnumerated,E.asn1.ASN1Object),E.asn1.DERUTF8String=function(t){E.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},Ie(E.asn1.DERUTF8String,E.asn1.DERAbstractString),E.asn1.DERNumericString=function(t){E.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},Ie(E.asn1.DERNumericString,E.asn1.DERAbstractString),E.asn1.DERPrintableString=function(t){E.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},Ie(E.asn1.DERPrintableString,E.asn1.DERAbstractString),E.asn1.DERTeletexString=function(t){E.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},Ie(E.asn1.DERTeletexString,E.asn1.DERAbstractString),E.asn1.DERIA5String=function(t){E.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},Ie(E.asn1.DERIA5String,E.asn1.DERAbstractString),E.asn1.DERVisibleString=function(t){E.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="1a"},Ie(E.asn1.DERVisibleString,E.asn1.DERAbstractString),E.asn1.DERBMPString=function(t){E.asn1.DERBMPString.superclass.constructor.call(this,t),this.hT="1e"},Ie(E.asn1.DERBMPString,E.asn1.DERAbstractString),E.asn1.DERUTCTime=function(t){E.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"utc"),this.hV=Ft(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=Ft(this.s)),this.hV},t!==void 0&&(t.str!==void 0?this.setString(t.str):typeof t=="string"&&t.match(/^[0-9]{12}Z$/)?this.setString(t):t.hex!==void 0?this.setStringHex(t.hex):t.date!==void 0&&this.setByDate(t.date))},Ie(E.asn1.DERUTCTime,E.asn1.DERAbstractTime),E.asn1.DERGeneralizedTime=function(t){E.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=Ft(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=Ft(this.s)),this.hV},t!==void 0&&(t.str!==void 0?this.setString(t.str):typeof t=="string"&&t.match(/^[0-9]{14}Z$/)?this.setString(t):t.hex!==void 0?this.setStringHex(t.hex):t.date!==void 0&&this.setByDate(t.date),t.millis===!0&&(this.withMillis=!0))},Ie(E.asn1.DERGeneralizedTime,E.asn1.DERAbstractTime),E.asn1.DERSequence=function(t){E.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var e="",r=0;r<this.asn1Array.length;r++)e+=this.asn1Array[r].getEncodedHex();return this.hV=e,this.hV}},Ie(E.asn1.DERSequence,E.asn1.DERAbstractStructured),E.asn1.DERSet=function(t){E.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=new Array,r=0;r<this.asn1Array.length;r++){var n=this.asn1Array[r];e.push(n.getEncodedHex())}return this.sortFlag==1&&e.sort(),this.hV=e.join(""),this.hV},t!==void 0&&t.sortflag!==void 0&&t.sortflag==0&&(this.sortFlag=!1)},Ie(E.asn1.DERSet,E.asn1.DERAbstractStructured),E.asn1.DERTaggedObject=function(t){E.asn1.DERTaggedObject.superclass.constructor.call(this);var e=E.asn1;this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(r,n,a){this.hT=n,this.isExplicit=r,this.asn1Object=a,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=a.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,n),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(r){r.tag!=null&&(this.hT=r.tag),r.explicit!=null&&(this.isExplicit=r.explicit),r.tage!=null&&(this.hT=r.tage,this.isExplicit=!0),r.tagi!=null&&(this.hT=r.tagi,this.isExplicit=!1),r.obj!=null&&(r.obj instanceof e.ASN1Object?(this.asn1Object=r.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)):C(r.obj)=="object"&&(this.asn1Object=e.ASN1Util.newObject(r.obj),this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},t!=null&&this.setByParam(t)},Ie(E.asn1.DERTaggedObject,E.asn1.ASN1Object);var E,$t,gt,se=new function(){};function cn(t){for(var e=new Array,r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}function ln(t){for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e}function ar(t){for(var e="",r=0;r<t.length;r++){var n=t[r].toString(16);n.length==1&&(n="0"+n),e+=n}return e}function Ft(t){return ar(cn(t))}function ur(t){return t=(t=(t=t.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}function zt(t){return t.length%4==2?t+="==":t.length%4==3&&(t+="="),t=(t=t.replace(/-/g,"+")).replace(/_/g,"/")}function Ne(t){return t.length%2==1&&(t="0"+t),ur(I(t))}function Ee(t){return Q(zt(t))}function Fr(t){return cr(hr(t))}function Oe(t){return decodeURIComponent(lr(t))}function ht(t){for(var e="",r=0;r<t.length-1;r+=2)e+=String.fromCharCode(parseInt(t.substr(r,2),16));return e}function _t(t){for(var e="",r=0;r<t.length;r++)e+=("0"+t.charCodeAt(r).toString(16)).slice(-2);return e}function hn(t){return I(t)}function dn(t){var e=hn(t).replace(/(.{64})/g,`$1\r
|
|
4
4
|
`);return e=e.replace(/\r\n$/,"")}function fn(t){return Q(t.replace(/[^0-9A-Za-z\/+=]*/g,""))}function st(t,e){return"-----BEGIN "+e+`-----\r
|
|
@@ -128,4 +128,4 @@ import{g as Oi}from"./_commonjsHelpers-B-UnjaXt.js";const Hi="modulepreload",Bi=
|
|
|
128
128
|
<h2>Report</h2>
|
|
129
129
|
<textarea id="report" readonly></textarea>
|
|
130
130
|
</section>
|
|
131
|
-
`}function pr(o){return o.replace(/[&<>"]/g,i=>({"&":"&","<":"<",">":">",'"':"""})[i]??i)}function De(o){return document.getElementById(o)}function mt(o,i=""){const c=De("status");c.textContent=o,c.className=i}function tn(){return De("cloudIssuer").value.trim()}function Kt(){return De("podHomeUrl").value.trim()}function _i(o){De("podHomeUrl").value=qt(o),De("storageHome").textContent=De("podHomeUrl").value}function or(){const o=nn(De("storagePath").value);return De("storagePath").value=o,o}function Vt(){return De("spResourceUrl").value.trim()}function rn(o){De("spResourceUrl").value=o}function qt(o){const i=new URL(o||window.location.origin,`${window.location.origin}/`);return i.hash="",i.search="",i.pathname.endsWith("/")||(i.pathname=`${i.pathname}/`),i.href}function nn(o){const i=String(o||"").trim();if(!i)return _r;if(/^https?:\/\//iu.test(i)){const c=new URL(i);return`${c.pathname.replace(/^\/+/,"")}${c.hash}`||_r}return i.replace(/^\/+/,"")||_r}function wi(o){const i=nn(o),c=i.indexOf("#"),s=c>=0?i.slice(0,c):i,y=c>=0?i.slice(c):"",v=s.lastIndexOf("/"),d=v>=0?s.slice(0,v+1):"",b=v>=0?s.slice(v+1):s;if(!b)throw new Error(`Storage path must include a file name: ${i}`);return{storagePath:i,documentPath:s,tableBase:`/${d}`,recordId:`${b}${y||"#this"}`}}function on(o,i){const c=wi(i);return new URL(c.documentPath,qt(o)).href}function sn(){De("loggedIn").textContent=String(tt.info.isLoggedIn),De("webId").textContent=tt.info.webId??"-",De("storageHome").textContent=Kt()||"-"}function Dt(o={}){De("report").value=JSON.stringify({generatedAt:new Date().toISOString(),cloudIssuer:tn(),podHomeUrl:Kt(),storagePath:or(),spResourceUrl:Vt(),session:{isLoggedIn:tt.info.isLoggedIn,webId:tt.info.webId,sessionId:tt.info.sessionId},...o},null,2)}async function aa(){const o=qt(tn()),i=new URL("/app/inrupt-smoke.html",window.location.origin);i.searchParams.set("issuer",o),i.searchParams.set("storagePath",or()),Kt()&&i.searchParams.set("home",Kt()),Vt()&&i.searchParams.set("sp",Vt()),await tt.login({oidcIssuer:o,redirectUrl:i.href,clientName:"Xpod Inrupt Smoke",tokenType:"DPoP"})}async function an(o){const i=performance.now(),c=await tt.fetch(o,{method:"GET",cache:"no-store"}),s=await c.text();return{url:o,status:c.status,ok:c.ok,elapsedMs:Math.round(performance.now()-i),headers:Array.from(c.headers.entries()),bodyPreview:s.slice(0,8192)}}async function ua(){try{mt("checking cloud discovery...","warn");const o=new URL("/.well-known/openid-configuration",qt(tn())).href,i=await an(o);mt(`discovery HTTP ${i.status}`,i.ok?"ok":"fail"),Dt({discovery:i})}catch(o){sr(o)}}async function Si(){if(!tt.info.isLoggedIn||!tt.info.webId)throw new Error("Login first; storage discovery needs session.info.webId.");const o=tt.info.webId,i=ga(o),c=await an(i);if(!c.ok)throw new Error(`Failed to read WebID profile ${i}: HTTP ${c.status}`);const s=qt(da(o,c.bodyPreview));return _i(s),Vt()||rn(on(s,or())),sn(),{webId:o,profileUrl:i,storageUrl:s,profile:c}}async function ca(){try{mt("discovering storage home from WebID profile...","warn");const o=await Si();mt(`storage home ${o.storageUrl}`,"ok"),Dt({storage:o})}catch(o){sr(o)}}async function bi(){if(Kt()){const o=qt(Kt());return _i(o),o}return(await Si()).storageUrl}async function la(){if(Vt())return new URL(Vt()).href;const o=await bi(),i=on(o,or());return rn(i),i}async function ha(){try{mt("fetching SP resource with Inrupt session...","warn");const o=await an(await la());mt(`SP resource HTTP ${o.status}`,o.ok?"ok":"fail"),Dt({spResource:o})}catch(o){sr(o)}}function da(o,i){const c=fa(i);if(c)return c;const s=[mr,qr].map(l=>l.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),y=new RegExp(`<(?:${s})>\\s+<([^>]+)>`,"iu"),v=i.match(y);if(v?.[1])return v[1];const d=/\b(?:solid|pim):storage\s+<([^>]+)>/iu,b=i.match(d);if(b?.[1])return b[1];const w=new RegExp(`<${Or(o)}>[^.]+(?:<${Or(mr)}>|solid:storage|<${Or(qr)}>|pim:storage)\\s+<([^>]+)>`,"isu"),h=i.match(w);if(h?.[1])return h[1];throw new Error(`WebID profile has no solid:storage / ${mr} binding.`)}function fa(o){try{return $r(JSON.parse(o))}catch{return null}}function $r(o){if(Array.isArray(o)){for(const i of o){const c=$r(i);if(c)return c}return null}if(!Fi(o))return null;for(const i of Object.keys(o))if(i===mr||i===qr||i==="solid:storage"||i==="pim:storage"){const c=Ei(o[i]);if(c)return c}for(const i of Object.values(o)){const c=$r(i);if(c)return c}return null}function Ei(o){if(typeof o=="string"&&/^https?:\/\//iu.test(o))return o;if(Array.isArray(o)){for(const i of o){const c=Ei(i);if(c)return c}return null}if(Fi(o)){const i=o["@id"];if(typeof i=="string"&&/^https?:\/\//iu.test(i))return i}return null}function Fi(o){return typeof o=="object"&&o!==null}function ga(o){const i=new URL(o);return i.hash="",i.href}function Or(o){return o.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function pa(){return typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2)}async function ya(){try{mt("writing smoke data through drizzle-solid...","warn");const o=await bi(),i=wi(or()),{drizzle:c,podTable:s,string:y}=await Mi(async()=>{const{drizzle:S,podTable:R,string:A}=await import("./index-
|
|
131
|
+
`}function pr(o){return o.replace(/[&<>"]/g,i=>({"&":"&","<":"<",">":">",'"':"""})[i]??i)}function De(o){return document.getElementById(o)}function mt(o,i=""){const c=De("status");c.textContent=o,c.className=i}function tn(){return De("cloudIssuer").value.trim()}function Kt(){return De("podHomeUrl").value.trim()}function _i(o){De("podHomeUrl").value=qt(o),De("storageHome").textContent=De("podHomeUrl").value}function or(){const o=nn(De("storagePath").value);return De("storagePath").value=o,o}function Vt(){return De("spResourceUrl").value.trim()}function rn(o){De("spResourceUrl").value=o}function qt(o){const i=new URL(o||window.location.origin,`${window.location.origin}/`);return i.hash="",i.search="",i.pathname.endsWith("/")||(i.pathname=`${i.pathname}/`),i.href}function nn(o){const i=String(o||"").trim();if(!i)return _r;if(/^https?:\/\//iu.test(i)){const c=new URL(i);return`${c.pathname.replace(/^\/+/,"")}${c.hash}`||_r}return i.replace(/^\/+/,"")||_r}function wi(o){const i=nn(o),c=i.indexOf("#"),s=c>=0?i.slice(0,c):i,y=c>=0?i.slice(c):"",v=s.lastIndexOf("/"),d=v>=0?s.slice(0,v+1):"",b=v>=0?s.slice(v+1):s;if(!b)throw new Error(`Storage path must include a file name: ${i}`);return{storagePath:i,documentPath:s,tableBase:`/${d}`,recordId:`${b}${y||"#this"}`}}function on(o,i){const c=wi(i);return new URL(c.documentPath,qt(o)).href}function sn(){De("loggedIn").textContent=String(tt.info.isLoggedIn),De("webId").textContent=tt.info.webId??"-",De("storageHome").textContent=Kt()||"-"}function Dt(o={}){De("report").value=JSON.stringify({generatedAt:new Date().toISOString(),cloudIssuer:tn(),podHomeUrl:Kt(),storagePath:or(),spResourceUrl:Vt(),session:{isLoggedIn:tt.info.isLoggedIn,webId:tt.info.webId,sessionId:tt.info.sessionId},...o},null,2)}async function aa(){const o=qt(tn()),i=new URL("/app/inrupt-smoke.html",window.location.origin);i.searchParams.set("issuer",o),i.searchParams.set("storagePath",or()),Kt()&&i.searchParams.set("home",Kt()),Vt()&&i.searchParams.set("sp",Vt()),await tt.login({oidcIssuer:o,redirectUrl:i.href,clientName:"Xpod Inrupt Smoke",tokenType:"DPoP"})}async function an(o){const i=performance.now(),c=await tt.fetch(o,{method:"GET",cache:"no-store"}),s=await c.text();return{url:o,status:c.status,ok:c.ok,elapsedMs:Math.round(performance.now()-i),headers:Array.from(c.headers.entries()),bodyPreview:s.slice(0,8192)}}async function ua(){try{mt("checking cloud discovery...","warn");const o=new URL("/.well-known/openid-configuration",qt(tn())).href,i=await an(o);mt(`discovery HTTP ${i.status}`,i.ok?"ok":"fail"),Dt({discovery:i})}catch(o){sr(o)}}async function Si(){if(!tt.info.isLoggedIn||!tt.info.webId)throw new Error("Login first; storage discovery needs session.info.webId.");const o=tt.info.webId,i=ga(o),c=await an(i);if(!c.ok)throw new Error(`Failed to read WebID profile ${i}: HTTP ${c.status}`);const s=qt(da(o,c.bodyPreview));return _i(s),Vt()||rn(on(s,or())),sn(),{webId:o,profileUrl:i,storageUrl:s,profile:c}}async function ca(){try{mt("discovering storage home from WebID profile...","warn");const o=await Si();mt(`storage home ${o.storageUrl}`,"ok"),Dt({storage:o})}catch(o){sr(o)}}async function bi(){if(Kt()){const o=qt(Kt());return _i(o),o}return(await Si()).storageUrl}async function la(){if(Vt())return new URL(Vt()).href;const o=await bi(),i=on(o,or());return rn(i),i}async function ha(){try{mt("fetching SP resource with Inrupt session...","warn");const o=await an(await la());mt(`SP resource HTTP ${o.status}`,o.ok?"ok":"fail"),Dt({spResource:o})}catch(o){sr(o)}}function da(o,i){const c=fa(i);if(c)return c;const s=[mr,qr].map(l=>l.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),y=new RegExp(`<(?:${s})>\\s+<([^>]+)>`,"iu"),v=i.match(y);if(v?.[1])return v[1];const d=/\b(?:solid|pim):storage\s+<([^>]+)>/iu,b=i.match(d);if(b?.[1])return b[1];const w=new RegExp(`<${Or(o)}>[^.]+(?:<${Or(mr)}>|solid:storage|<${Or(qr)}>|pim:storage)\\s+<([^>]+)>`,"isu"),h=i.match(w);if(h?.[1])return h[1];throw new Error(`WebID profile has no solid:storage / ${mr} binding.`)}function fa(o){try{return $r(JSON.parse(o))}catch{return null}}function $r(o){if(Array.isArray(o)){for(const i of o){const c=$r(i);if(c)return c}return null}if(!Fi(o))return null;for(const i of Object.keys(o))if(i===mr||i===qr||i==="solid:storage"||i==="pim:storage"){const c=Ei(o[i]);if(c)return c}for(const i of Object.values(o)){const c=$r(i);if(c)return c}return null}function Ei(o){if(typeof o=="string"&&/^https?:\/\//iu.test(o))return o;if(Array.isArray(o)){for(const i of o){const c=Ei(i);if(c)return c}return null}if(Fi(o)){const i=o["@id"];if(typeof i=="string"&&/^https?:\/\//iu.test(i))return i}return null}function Fi(o){return typeof o=="object"&&o!==null}function ga(o){const i=new URL(o);return i.hash="",i.href}function Or(o){return o.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function pa(){return typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2)}async function ya(){try{mt("writing smoke data through drizzle-solid...","warn");const o=await bi(),i=wi(or()),{drizzle:c,podTable:s,string:y}=await Mi(async()=>{const{drizzle:S,podTable:R,string:A}=await import("./index-C1yksyT4.js");return{drizzle:S,podTable:R,string:A}},__vite__mapDeps([0,1])),v=s("inruptSmokeData",{id:y("id").primaryKey(),value:y("value").predicate("http://schema.org/text"),createdAt:y("createdAt").predicate("http://schema.org/dateCreated")},{base:i.tableBase,type:ta}),d=c(tt,{podUrl:o,resourcePreparation:"best-effort",schema:{inruptSmokeData:v}});await d.init(v),await d.deleteById(v,i.recordId).catch(()=>{});const b=`xpod-inrupt-smoke ${new Date().toISOString()} ${pa()}`,w=new Date().toISOString();await d.insert(v).values({id:i.recordId,value:b,createdAt:w});const h=await d.findById(v,i.recordId),l=h?.value===b;if(await d.deleteById(v,i.recordId).catch(()=>{}),!l)throw new Error(`drizzle-solid readback mismatch for ${i.recordId}`);const u=on(o,i.storagePath);rn(u),mt("drizzle-solid write/read/delete OK","ok"),Dt({drizzleSolid:{ok:!0,podUrl:o,storagePath:i.storagePath,tableBase:i.tableBase,recordId:i.recordId,resourceUrl:u,wrote:{value:b,createdAt:w},readBack:h,deleted:!0}})}catch(o){sr(o)}}async function va(){await tt.logout({logoutType:"app"}),sn(),mt("logged out","warn"),Dt()}function sr(o){const i=o instanceof Error?o.message:String(o);mt(i,"fail"),Dt({error:i})}async function ma(){sa(),De("loginButton").addEventListener("click",()=>{aa()}),De("discoveryButton").addEventListener("click",()=>{ua()}),De("storageButton").addEventListener("click",()=>{ca()}),De("resourceButton").addEventListener("click",()=>{ha()}),De("drizzleButton").addEventListener("click",()=>{ya()}),De("logoutButton").addEventListener("click",()=>{va()});try{await tt.handleIncomingRedirect({restorePreviousSession:!0}),sn(),mt(tt.info.isLoggedIn?"logged in":"not logged in",tt.info.isLoggedIn?"ok":"warn"),Dt()}catch(o){sr(o)}}ma();export{Mi as _,fs as r,Qr as v};
|