@versini/auth-provider 6.4.1 → 6.4.2

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.
Files changed (2) hide show
  1. package/dist/index.js +506 -506
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- var Ct = Object.defineProperty;
2
- var kt = (e, t, n) => t in e ? Ct(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var Q = (e, t, n) => kt(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { jsx as Ce } from "react/jsx-runtime";
5
- import Pt, { useSyncExternalStore as Ot, useCallback as D, useEffect as Ae, createContext as Nt, useReducer as Dt, useRef as ke, useContext as Ut } from "react";
1
+ var Pt = Object.defineProperty;
2
+ var kt = (e, t, n) => t in e ? Pt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var X = (e, t, n) => kt(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { jsx as ke } from "react/jsx-runtime";
5
+ import Ot, { useSyncExternalStore as Nt, useCallback as U, useEffect as Re, createContext as Dt, useReducer as Ut, useRef as Oe, useContext as $t } from "react";
6
6
  /*!
7
- @versini/auth-provider v6.4.1
7
+ @versini/auth-provider v6.4.2
8
8
  © 2024 gizmette.com
9
9
  */
10
10
  try {
11
11
  window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
12
- version: "6.4.1",
13
- buildTime: "07/27/2024 11:42 AM EDT",
12
+ version: "6.4.2",
13
+ buildTime: "07/28/2024 07:43 PM EDT",
14
14
  homepage: "https://github.com/aversini/auth-client",
15
15
  license: "MIT"
16
16
  });
@@ -23,24 +23,24 @@ function v(e) {
23
23
  n += String.fromCharCode(a);
24
24
  return btoa(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
25
25
  }
26
- function ie(e) {
26
+ function ce(e) {
27
27
  const t = e.replace(/-/g, "+").replace(/_/g, "/"), n = (4 - t.length % 4) % 4, r = t.padEnd(t.length + n, "="), a = atob(r), s = new ArrayBuffer(a.length), o = new Uint8Array(s);
28
28
  for (let i = 0; i < a.length; i++)
29
29
  o[i] = a.charCodeAt(i);
30
30
  return s;
31
31
  }
32
- function Te() {
32
+ function be() {
33
33
  return window?.PublicKeyCredential !== void 0 && typeof window.PublicKeyCredential == "function";
34
34
  }
35
- function Ve(e) {
35
+ function je(e) {
36
36
  const { id: t } = e;
37
37
  return {
38
38
  ...e,
39
- id: ie(t),
39
+ id: ce(t),
40
40
  transports: e.transports
41
41
  };
42
42
  }
43
- function je(e) {
43
+ function Fe(e) {
44
44
  return e === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e);
45
45
  }
46
46
  class b extends Error {
@@ -48,7 +48,7 @@ class b extends Error {
48
48
  super(t, { cause: r }), this.name = a ?? r.name, this.code = n;
49
49
  }
50
50
  }
51
- function $t({ error: e, options: t }) {
51
+ function Kt({ error: e, options: t }) {
52
52
  const { publicKey: n } = t;
53
53
  if (!n)
54
54
  throw Error("options was missing required publicKey property");
@@ -97,7 +97,7 @@ function $t({ error: e, options: t }) {
97
97
  });
98
98
  if (e.name === "SecurityError") {
99
99
  const r = window.location.hostname;
100
- if (je(r)) {
100
+ if (Fe(r)) {
101
101
  if (n.rp.id !== r)
102
102
  return new b({
103
103
  message: `The RP ID "${n.rp.id}" is invalid for this domain`,
@@ -125,7 +125,7 @@ function $t({ error: e, options: t }) {
125
125
  }
126
126
  return e;
127
127
  }
128
- class Kt {
128
+ class Ht {
129
129
  createNewAbortSignal() {
130
130
  if (this.controller) {
131
131
  const n = new Error("Cancelling existing WebAuthn API call for new one");
@@ -141,29 +141,29 @@ class Kt {
141
141
  }
142
142
  }
143
143
  }
144
- const Fe = new Kt(), Ht = ["cross-platform", "platform"];
145
- function Be(e) {
146
- if (e && !(Ht.indexOf(e) < 0))
144
+ const Be = new Ht(), Lt = ["cross-platform", "platform"];
145
+ function qe(e) {
146
+ if (e && !(Lt.indexOf(e) < 0))
147
147
  return e;
148
148
  }
149
- async function Lt(e) {
150
- if (!Te())
149
+ async function Wt(e) {
150
+ if (!be())
151
151
  throw new Error("WebAuthn is not supported in this browser");
152
152
  const n = { publicKey: {
153
153
  ...e,
154
- challenge: ie(e.challenge),
154
+ challenge: ce(e.challenge),
155
155
  user: {
156
156
  ...e.user,
157
- id: ie(e.user.id)
157
+ id: ce(e.user.id)
158
158
  },
159
- excludeCredentials: e.excludeCredentials?.map(Ve)
159
+ excludeCredentials: e.excludeCredentials?.map(je)
160
160
  } };
161
- n.signal = Fe.createNewAbortSignal();
161
+ n.signal = Be.createNewAbortSignal();
162
162
  let r;
163
163
  try {
164
164
  r = await navigator.credentials.create(n);
165
165
  } catch (g) {
166
- throw $t({ error: g, options: n });
166
+ throw Kt({ error: g, options: n });
167
167
  }
168
168
  if (!r)
169
169
  throw new Error("Registration was not completed");
@@ -175,7 +175,7 @@ async function Lt(e) {
175
175
  try {
176
176
  y = o.getPublicKeyAlgorithm();
177
177
  } catch (g) {
178
- fe("getPublicKeyAlgorithm()", g);
178
+ ge("getPublicKeyAlgorithm()", g);
179
179
  }
180
180
  let l;
181
181
  if (typeof o.getPublicKey == "function")
@@ -183,14 +183,14 @@ async function Lt(e) {
183
183
  const g = o.getPublicKey();
184
184
  g !== null && (l = v(g));
185
185
  } catch (g) {
186
- fe("getPublicKey()", g);
186
+ ge("getPublicKey()", g);
187
187
  }
188
188
  let h;
189
189
  if (typeof o.getAuthenticatorData == "function")
190
190
  try {
191
191
  h = v(o.getAuthenticatorData());
192
192
  } catch (g) {
193
- fe("getAuthenticatorData()", g);
193
+ ge("getAuthenticatorData()", g);
194
194
  }
195
195
  return {
196
196
  id: a,
@@ -205,20 +205,20 @@ async function Lt(e) {
205
205
  },
206
206
  type: i,
207
207
  clientExtensionResults: r.getClientExtensionResults(),
208
- authenticatorAttachment: Be(r.authenticatorAttachment)
208
+ authenticatorAttachment: qe(r.authenticatorAttachment)
209
209
  };
210
210
  }
211
- function fe(e, t) {
211
+ function ge(e, t) {
212
212
  console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
213
213
  `, t);
214
214
  }
215
- function Wt() {
216
- if (!Te())
215
+ function xt() {
216
+ if (!be())
217
217
  return new Promise((t) => t(!1));
218
218
  const e = window.PublicKeyCredential;
219
219
  return e.isConditionalMediationAvailable === void 0 ? new Promise((t) => t(!1)) : e.isConditionalMediationAvailable();
220
220
  }
221
- function xt({ error: e, options: t }) {
221
+ function Mt({ error: e, options: t }) {
222
222
  const { publicKey: n } = t;
223
223
  if (!n)
224
224
  throw Error("options was missing required publicKey property");
@@ -238,7 +238,7 @@ function xt({ error: e, options: t }) {
238
238
  });
239
239
  if (e.name === "SecurityError") {
240
240
  const r = window.location.hostname;
241
- if (je(r)) {
241
+ if (Fe(r)) {
242
242
  if (n.rpId !== r)
243
243
  return new b({
244
244
  message: `The RP ID "${n.rpId}" is invalid for this domain`,
@@ -259,29 +259,29 @@ function xt({ error: e, options: t }) {
259
259
  }
260
260
  return e;
261
261
  }
262
- async function Mt(e, t = !1) {
263
- if (!Te())
262
+ async function Gt(e, t = !1) {
263
+ if (!be())
264
264
  throw new Error("WebAuthn is not supported in this browser");
265
265
  let n;
266
- e.allowCredentials?.length !== 0 && (n = e.allowCredentials?.map(Ve));
266
+ e.allowCredentials?.length !== 0 && (n = e.allowCredentials?.map(je));
267
267
  const r = {
268
268
  ...e,
269
- challenge: ie(e.challenge),
269
+ challenge: ce(e.challenge),
270
270
  allowCredentials: n
271
271
  }, a = {};
272
272
  if (t) {
273
- if (!await Wt())
273
+ if (!await xt())
274
274
  throw Error("Browser does not support WebAuthn autofill");
275
275
  if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1)
276
276
  throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');
277
277
  a.mediation = "conditional", r.allowCredentials = [];
278
278
  }
279
- a.publicKey = r, a.signal = Fe.createNewAbortSignal();
279
+ a.publicKey = r, a.signal = Be.createNewAbortSignal();
280
280
  let s;
281
281
  try {
282
282
  s = await navigator.credentials.get(a);
283
283
  } catch (h) {
284
- throw xt({ error: h, options: a });
284
+ throw Mt({ error: h, options: a });
285
285
  }
286
286
  if (!s)
287
287
  throw new Error("Authentication was not completed");
@@ -298,7 +298,7 @@ async function Mt(e, t = !1) {
298
298
  },
299
299
  type: y,
300
300
  clientExtensionResults: s.getClientExtensionResults(),
301
- authenticatorAttachment: Be(s.authenticatorAttachment)
301
+ authenticatorAttachment: qe(s.authenticatorAttachment)
302
302
  };
303
303
  }
304
304
  /*!
@@ -308,22 +308,22 @@ async function Mt(e, t = !1) {
308
308
  try {
309
309
  window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
310
310
  version: "3.3.0",
311
- buildTime: "07/27/2024 11:42 AM EDT",
311
+ buildTime: "07/28/2024 07:43 PM EDT",
312
312
  homepage: "https://github.com/aversini/auth-client",
313
313
  license: "MIT"
314
314
  });
315
315
  } catch {
316
316
  }
317
- const M = {
317
+ const G = {
318
318
  ID_TOKEN: "id_token",
319
319
  ACCESS_TOKEN: "token",
320
320
  ID_AND_ACCESS_TOKEN: "id_token token",
321
321
  CODE: "code",
322
322
  REFRESH_TOKEN: "refresh_token",
323
323
  PASSKEY: "passkey"
324
- }, qe = {
324
+ }, ze = {
325
325
  CLIENT_ID: "X-Auth-ClientId"
326
- }, A = {
326
+ }, T = {
327
327
  ALG: "RS256",
328
328
  USER_ID_KEY: "sub",
329
329
  TOKEN_ID_KEY: "__raw",
@@ -334,7 +334,7 @@ const M = {
334
334
  CREATED_AT_KEY: "iat",
335
335
  SCOPES_KEY: "scopes",
336
336
  ISSUER: "gizmette.com"
337
- }, Gt = `-----BEGIN PUBLIC KEY-----
337
+ }, Jt = `-----BEGIN PUBLIC KEY-----
338
338
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
339
339
  w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
340
340
  i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
@@ -342,33 +342,33 @@ aMwPFOIcJH+rKfFgNcHLcaS5syp7zU1ANwZ+trgR+DifBr8TLVkBynmNeTyhDm2+
342
342
  l0haqjMk0UoNPPE8iYBWUHQJJE1Dqstj65d6Eh5g64Pao25y4cmYJbKjiblIGEkE
343
343
  sjqybA9mARAqh9k/eiIopecWSiffNQTwVQVd2I9ZH3BalhEXHlqFgrjz51kFqg81
344
344
  awIDAQAB
345
- -----END PUBLIC KEY-----`, de = {
345
+ -----END PUBLIC KEY-----`, he = {
346
346
  AUTHENTICATE: "authenticate",
347
347
  CODE: "code",
348
348
  LOGOUT: "logout"
349
- }, he = crypto, ze = (e) => e instanceof CryptoKey, X = new TextEncoder(), B = new TextDecoder();
350
- function Jt(...e) {
349
+ }, pe = crypto, Qe = (e) => e instanceof CryptoKey, Z = new TextEncoder(), q = new TextDecoder();
350
+ function Yt(...e) {
351
351
  const t = e.reduce((a, { length: s }) => a + s, 0), n = new Uint8Array(t);
352
352
  let r = 0;
353
353
  for (const a of e)
354
354
  n.set(a, r), r += a.length;
355
355
  return n;
356
356
  }
357
- const Yt = (e) => {
357
+ const Vt = (e) => {
358
358
  const t = atob(e), n = new Uint8Array(t.length);
359
359
  for (let r = 0; r < t.length; r++)
360
360
  n[r] = t.charCodeAt(r);
361
361
  return n;
362
- }, F = (e) => {
362
+ }, B = (e) => {
363
363
  let t = e;
364
- t instanceof Uint8Array && (t = B.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
364
+ t instanceof Uint8Array && (t = q.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
365
365
  try {
366
- return Yt(t);
366
+ return Vt(t);
367
367
  } catch {
368
368
  throw new TypeError("The input to be decoded is not correctly encoded.");
369
369
  }
370
370
  };
371
- let U = class extends Error {
371
+ let $ = class extends Error {
372
372
  static get code() {
373
373
  return "ERR_JOSE_GENERIC";
374
374
  }
@@ -376,14 +376,14 @@ let U = class extends Error {
376
376
  var n;
377
377
  super(t), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, (n = Error.captureStackTrace) == null || n.call(Error, this, this.constructor);
378
378
  }
379
- }, _ = class extends U {
379
+ }, _ = class extends $ {
380
380
  static get code() {
381
381
  return "ERR_JWT_CLAIM_VALIDATION_FAILED";
382
382
  }
383
383
  constructor(t, n, r = "unspecified", a = "unspecified") {
384
384
  super(t), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = r, this.reason = a, this.payload = n;
385
385
  }
386
- }, Pe = class extends U {
386
+ }, Ne = class extends $ {
387
387
  static get code() {
388
388
  return "ERR_JWT_EXPIRED";
389
389
  }
@@ -391,7 +391,7 @@ let U = class extends Error {
391
391
  super(t), this.code = "ERR_JWT_EXPIRED", this.claim = r, this.reason = a, this.payload = n;
392
392
  }
393
393
  };
394
- class Vt extends U {
394
+ class jt extends $ {
395
395
  constructor() {
396
396
  super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
397
397
  }
@@ -399,7 +399,7 @@ class Vt extends U {
399
399
  return "ERR_JOSE_ALG_NOT_ALLOWED";
400
400
  }
401
401
  }
402
- let O = class extends U {
402
+ let N = class extends $ {
403
403
  constructor() {
404
404
  super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
405
405
  }
@@ -407,7 +407,7 @@ let O = class extends U {
407
407
  return "ERR_JOSE_NOT_SUPPORTED";
408
408
  }
409
409
  };
410
- class S extends U {
410
+ class A extends $ {
411
411
  constructor() {
412
412
  super(...arguments), this.code = "ERR_JWS_INVALID";
413
413
  }
@@ -415,7 +415,7 @@ class S extends U {
415
415
  return "ERR_JWS_INVALID";
416
416
  }
417
417
  }
418
- let k = class extends U {
418
+ let k = class extends $ {
419
419
  constructor() {
420
420
  super(...arguments), this.code = "ERR_JWT_INVALID";
421
421
  }
@@ -423,7 +423,7 @@ let k = class extends U {
423
423
  return "ERR_JWT_INVALID";
424
424
  }
425
425
  };
426
- class jt extends U {
426
+ class Ft extends $ {
427
427
  constructor() {
428
428
  super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
429
429
  }
@@ -431,16 +431,16 @@ class jt extends U {
431
431
  return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
432
432
  }
433
433
  }
434
- function C(e, t = "algorithm.name") {
434
+ function P(e, t = "algorithm.name") {
435
435
  return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
436
436
  }
437
- function Z(e, t) {
437
+ function ee(e, t) {
438
438
  return e.name === t;
439
439
  }
440
- function ye(e) {
440
+ function me(e) {
441
441
  return parseInt(e.name.slice(4), 10);
442
442
  }
443
- function Ft(e) {
443
+ function Bt(e) {
444
444
  switch (e) {
445
445
  case "ES256":
446
446
  return "P-256";
@@ -452,7 +452,7 @@ function Ft(e) {
452
452
  throw new Error("unreachable");
453
453
  }
454
454
  }
455
- function Bt(e, t) {
455
+ function qt(e, t) {
456
456
  if (t.length && !t.some((n) => e.usages.includes(n))) {
457
457
  let n = "CryptoKey does not support this operation, its usages must include ";
458
458
  if (t.length > 2) {
@@ -462,59 +462,59 @@ function Bt(e, t) {
462
462
  throw new TypeError(n);
463
463
  }
464
464
  }
465
- function qt(e, t, ...n) {
465
+ function zt(e, t, ...n) {
466
466
  switch (t) {
467
467
  case "HS256":
468
468
  case "HS384":
469
469
  case "HS512": {
470
- if (!Z(e.algorithm, "HMAC"))
471
- throw C("HMAC");
470
+ if (!ee(e.algorithm, "HMAC"))
471
+ throw P("HMAC");
472
472
  const r = parseInt(t.slice(2), 10);
473
- if (ye(e.algorithm.hash) !== r)
474
- throw C(`SHA-${r}`, "algorithm.hash");
473
+ if (me(e.algorithm.hash) !== r)
474
+ throw P(`SHA-${r}`, "algorithm.hash");
475
475
  break;
476
476
  }
477
477
  case "RS256":
478
478
  case "RS384":
479
479
  case "RS512": {
480
- if (!Z(e.algorithm, "RSASSA-PKCS1-v1_5"))
481
- throw C("RSASSA-PKCS1-v1_5");
480
+ if (!ee(e.algorithm, "RSASSA-PKCS1-v1_5"))
481
+ throw P("RSASSA-PKCS1-v1_5");
482
482
  const r = parseInt(t.slice(2), 10);
483
- if (ye(e.algorithm.hash) !== r)
484
- throw C(`SHA-${r}`, "algorithm.hash");
483
+ if (me(e.algorithm.hash) !== r)
484
+ throw P(`SHA-${r}`, "algorithm.hash");
485
485
  break;
486
486
  }
487
487
  case "PS256":
488
488
  case "PS384":
489
489
  case "PS512": {
490
- if (!Z(e.algorithm, "RSA-PSS"))
491
- throw C("RSA-PSS");
490
+ if (!ee(e.algorithm, "RSA-PSS"))
491
+ throw P("RSA-PSS");
492
492
  const r = parseInt(t.slice(2), 10);
493
- if (ye(e.algorithm.hash) !== r)
494
- throw C(`SHA-${r}`, "algorithm.hash");
493
+ if (me(e.algorithm.hash) !== r)
494
+ throw P(`SHA-${r}`, "algorithm.hash");
495
495
  break;
496
496
  }
497
497
  case "EdDSA": {
498
498
  if (e.algorithm.name !== "Ed25519" && e.algorithm.name !== "Ed448")
499
- throw C("Ed25519 or Ed448");
499
+ throw P("Ed25519 or Ed448");
500
500
  break;
501
501
  }
502
502
  case "ES256":
503
503
  case "ES384":
504
504
  case "ES512": {
505
- if (!Z(e.algorithm, "ECDSA"))
506
- throw C("ECDSA");
507
- const r = Ft(t);
505
+ if (!ee(e.algorithm, "ECDSA"))
506
+ throw P("ECDSA");
507
+ const r = Bt(t);
508
508
  if (e.algorithm.namedCurve !== r)
509
- throw C(r, "algorithm.namedCurve");
509
+ throw P(r, "algorithm.namedCurve");
510
510
  break;
511
511
  }
512
512
  default:
513
513
  throw new TypeError("CryptoKey does not support this operation");
514
514
  }
515
- Bt(e, n);
515
+ qt(e, n);
516
516
  }
517
- function Qe(e, t, ...n) {
517
+ function Xe(e, t, ...n) {
518
518
  var r;
519
519
  if (n.length > 2) {
520
520
  const a = n.pop();
@@ -522,11 +522,11 @@ function Qe(e, t, ...n) {
522
522
  } else n.length === 2 ? e += `one of type ${n[0]} or ${n[1]}.` : e += `of type ${n[0]}.`;
523
523
  return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (r = t.constructor) != null && r.name && (e += ` Received an instance of ${t.constructor.name}`), e;
524
524
  }
525
- const Oe = (e, ...t) => Qe("Key must be ", e, ...t);
526
- function Xe(e, t, ...n) {
527
- return Qe(`Key for the ${e} algorithm must be `, t, ...n);
525
+ const De = (e, ...t) => Xe("Key must be ", e, ...t);
526
+ function Ze(e, t, ...n) {
527
+ return Xe(`Key for the ${e} algorithm must be `, t, ...n);
528
528
  }
529
- const Ze = (e) => ze(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", ce = ["CryptoKey"], zt = (...e) => {
529
+ const et = (e) => Qe(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", ue = ["CryptoKey"], Qt = (...e) => {
530
530
  const t = e.filter(Boolean);
531
531
  if (t.length === 0 || t.length === 1)
532
532
  return !0;
@@ -545,11 +545,11 @@ const Ze = (e) => ze(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", ce = ["C
545
545
  }
546
546
  return !0;
547
547
  };
548
- function Qt(e) {
548
+ function Xt(e) {
549
549
  return typeof e == "object" && e !== null;
550
550
  }
551
- function ue(e) {
552
- if (!Qt(e) || Object.prototype.toString.call(e) !== "[object Object]")
551
+ function le(e) {
552
+ if (!Xt(e) || Object.prototype.toString.call(e) !== "[object Object]")
553
553
  return !1;
554
554
  if (Object.getPrototypeOf(e) === null)
555
555
  return !0;
@@ -558,14 +558,14 @@ function ue(e) {
558
558
  t = Object.getPrototypeOf(t);
559
559
  return Object.getPrototypeOf(e) === t;
560
560
  }
561
- const Xt = (e, t) => {
561
+ const Zt = (e, t) => {
562
562
  if (e.startsWith("RS") || e.startsWith("PS")) {
563
563
  const { modulusLength: n } = t.algorithm;
564
564
  if (typeof n != "number" || n < 2048)
565
565
  throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
566
566
  }
567
567
  };
568
- function Zt(e) {
568
+ function en(e) {
569
569
  let t, n;
570
570
  switch (e.kty) {
571
571
  case "RSA": {
@@ -590,7 +590,7 @@ function Zt(e) {
590
590
  }, n = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
591
591
  break;
592
592
  default:
593
- throw new O('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
593
+ throw new N('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
594
594
  }
595
595
  break;
596
596
  }
@@ -612,7 +612,7 @@ function Zt(e) {
612
612
  t = { name: "ECDH", namedCurve: e.crv }, n = e.d ? ["deriveBits"] : [];
613
613
  break;
614
614
  default:
615
- throw new O('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
615
+ throw new N('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
616
616
  }
617
617
  break;
618
618
  }
@@ -628,71 +628,71 @@ function Zt(e) {
628
628
  t = { name: e.crv }, n = e.d ? ["deriveBits"] : [];
629
629
  break;
630
630
  default:
631
- throw new O('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
631
+ throw new N('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
632
632
  }
633
633
  break;
634
634
  }
635
635
  default:
636
- throw new O('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
636
+ throw new N('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
637
637
  }
638
638
  return { algorithm: t, keyUsages: n };
639
639
  }
640
- const en = async (e) => {
640
+ const tn = async (e) => {
641
641
  if (!e.alg)
642
642
  throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
643
- const { algorithm: t, keyUsages: n } = Zt(e), r = [
643
+ const { algorithm: t, keyUsages: n } = en(e), r = [
644
644
  t,
645
645
  e.ext ?? !1,
646
646
  e.key_ops ?? n
647
647
  ], a = { ...e };
648
- return delete a.alg, delete a.use, he.subtle.importKey("jwk", a, ...r);
649
- }, et = (e) => F(e);
650
- let ge, me;
651
- const tt = (e) => e?.[Symbol.toStringTag] === "KeyObject", nt = async (e, t, n, r) => {
648
+ return delete a.alg, delete a.use, pe.subtle.importKey("jwk", a, ...r);
649
+ }, tt = (e) => B(e);
650
+ let we, Ee;
651
+ const nt = (e) => e?.[Symbol.toStringTag] === "KeyObject", rt = async (e, t, n, r) => {
652
652
  let a = e.get(t);
653
653
  if (a != null && a[r])
654
654
  return a[r];
655
- const s = await en({ ...n, alg: r });
655
+ const s = await tn({ ...n, alg: r });
656
656
  return a ? a[r] = s : e.set(t, { [r]: s }), s;
657
- }, tn = (e, t) => {
658
- if (tt(e)) {
657
+ }, nn = (e, t) => {
658
+ if (nt(e)) {
659
659
  let n = e.export({ format: "jwk" });
660
- return delete n.d, delete n.dp, delete n.dq, delete n.p, delete n.q, delete n.qi, n.k ? et(n.k) : (me || (me = /* @__PURE__ */ new WeakMap()), nt(me, e, n, t));
660
+ return delete n.d, delete n.dp, delete n.dq, delete n.p, delete n.q, delete n.qi, n.k ? tt(n.k) : (Ee || (Ee = /* @__PURE__ */ new WeakMap()), rt(Ee, e, n, t));
661
661
  }
662
662
  return e;
663
- }, nn = (e, t) => {
664
- if (tt(e)) {
663
+ }, rn = (e, t) => {
664
+ if (nt(e)) {
665
665
  let n = e.export({ format: "jwk" });
666
- return n.k ? et(n.k) : (ge || (ge = /* @__PURE__ */ new WeakMap()), nt(ge, e, n, t));
666
+ return n.k ? tt(n.k) : (we || (we = /* @__PURE__ */ new WeakMap()), rt(we, e, n, t));
667
667
  }
668
668
  return e;
669
- }, rn = { normalizePublicKey: tn, normalizePrivateKey: nn }, P = (e, t, n = 0) => {
669
+ }, an = { normalizePublicKey: nn, normalizePrivateKey: rn }, O = (e, t, n = 0) => {
670
670
  n === 0 && (t.unshift(t.length), t.unshift(6));
671
671
  const r = e.indexOf(t[0], n);
672
672
  if (r === -1)
673
673
  return !1;
674
674
  const a = e.subarray(r, r + t.length);
675
- return a.length !== t.length ? !1 : a.every((s, o) => s === t[o]) || P(e, t, r + 1);
676
- }, Ne = (e) => {
675
+ return a.length !== t.length ? !1 : a.every((s, o) => s === t[o]) || O(e, t, r + 1);
676
+ }, Ue = (e) => {
677
677
  switch (!0) {
678
- case P(e, [42, 134, 72, 206, 61, 3, 1, 7]):
678
+ case O(e, [42, 134, 72, 206, 61, 3, 1, 7]):
679
679
  return "P-256";
680
- case P(e, [43, 129, 4, 0, 34]):
680
+ case O(e, [43, 129, 4, 0, 34]):
681
681
  return "P-384";
682
- case P(e, [43, 129, 4, 0, 35]):
682
+ case O(e, [43, 129, 4, 0, 35]):
683
683
  return "P-521";
684
- case P(e, [43, 101, 110]):
684
+ case O(e, [43, 101, 110]):
685
685
  return "X25519";
686
- case P(e, [43, 101, 111]):
686
+ case O(e, [43, 101, 111]):
687
687
  return "X448";
688
- case P(e, [43, 101, 112]):
688
+ case O(e, [43, 101, 112]):
689
689
  return "Ed25519";
690
- case P(e, [43, 101, 113]):
690
+ case O(e, [43, 101, 113]):
691
691
  return "Ed448";
692
692
  default:
693
- throw new O("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
693
+ throw new N("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
694
694
  }
695
- }, an = async (e, t, n, r, a) => {
695
+ }, on = async (e, t, n, r, a) => {
696
696
  let s, o;
697
697
  const i = new Uint8Array(atob(n.replace(e, "")).split("").map((c) => c.charCodeAt(0)));
698
698
  switch (r) {
@@ -728,43 +728,43 @@ const tt = (e) => e?.[Symbol.toStringTag] === "KeyObject", nt = async (e, t, n,
728
728
  case "ECDH-ES+A128KW":
729
729
  case "ECDH-ES+A192KW":
730
730
  case "ECDH-ES+A256KW": {
731
- const c = Ne(i);
731
+ const c = Ue(i);
732
732
  s = c.startsWith("P-") ? { name: "ECDH", namedCurve: c } : { name: c }, o = [];
733
733
  break;
734
734
  }
735
735
  case "EdDSA":
736
- s = { name: Ne(i) }, o = ["verify"];
736
+ s = { name: Ue(i) }, o = ["verify"];
737
737
  break;
738
738
  default:
739
- throw new O('Invalid or unsupported "alg" (Algorithm) value');
739
+ throw new N('Invalid or unsupported "alg" (Algorithm) value');
740
740
  }
741
- return he.subtle.importKey(t, i, s, !1, o);
742
- }, on = (e, t, n) => an(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
743
- async function sn(e, t, n) {
741
+ return pe.subtle.importKey(t, i, s, !1, o);
742
+ }, sn = (e, t, n) => on(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
743
+ async function cn(e, t, n) {
744
744
  if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
745
745
  throw new TypeError('"spki" must be SPKI formatted string');
746
- return on(e, t);
746
+ return sn(e, t);
747
747
  }
748
- const se = (e) => e?.[Symbol.toStringTag], cn = (e, t) => {
748
+ const ie = (e) => e?.[Symbol.toStringTag], un = (e, t) => {
749
749
  if (!(t instanceof Uint8Array)) {
750
- if (!Ze(t))
751
- throw new TypeError(Xe(e, t, ...ce, "Uint8Array"));
750
+ if (!et(t))
751
+ throw new TypeError(Ze(e, t, ...ue, "Uint8Array"));
752
752
  if (t.type !== "secret")
753
- throw new TypeError(`${se(t)} instances for symmetric algorithms must be of type "secret"`);
753
+ throw new TypeError(`${ie(t)} instances for symmetric algorithms must be of type "secret"`);
754
754
  }
755
- }, un = (e, t, n) => {
756
- if (!Ze(t))
757
- throw new TypeError(Xe(e, t, ...ce));
755
+ }, ln = (e, t, n) => {
756
+ if (!et(t))
757
+ throw new TypeError(Ze(e, t, ...ue));
758
758
  if (t.type === "secret")
759
- throw new TypeError(`${se(t)} instances for asymmetric algorithms must not be of type "secret"`);
759
+ throw new TypeError(`${ie(t)} instances for asymmetric algorithms must not be of type "secret"`);
760
760
  if (t.algorithm && n === "verify" && t.type === "private")
761
- throw new TypeError(`${se(t)} instances for asymmetric algorithm verifying must be of type "public"`);
761
+ throw new TypeError(`${ie(t)} instances for asymmetric algorithm verifying must be of type "public"`);
762
762
  if (t.algorithm && n === "encrypt" && t.type === "private")
763
- throw new TypeError(`${se(t)} instances for asymmetric algorithm encryption must be of type "public"`);
764
- }, ln = (e, t, n) => {
765
- e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? cn(e, t) : un(e, t, n);
763
+ throw new TypeError(`${ie(t)} instances for asymmetric algorithm encryption must be of type "public"`);
764
+ }, dn = (e, t, n) => {
765
+ e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? un(e, t) : ln(e, t, n);
766
766
  };
767
- function dn(e, t, n, r, a) {
767
+ function hn(e, t, n, r, a) {
768
768
  if (a.crit !== void 0 && r?.crit === void 0)
769
769
  throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
770
770
  if (!r || r.crit === void 0)
@@ -775,7 +775,7 @@ function dn(e, t, n, r, a) {
775
775
  n !== void 0 ? s = new Map([...Object.entries(n), ...t.entries()]) : s = t;
776
776
  for (const o of r.crit) {
777
777
  if (!s.has(o))
778
- throw new O(`Extension Header Parameter "${o}" is not recognized`);
778
+ throw new N(`Extension Header Parameter "${o}" is not recognized`);
779
779
  if (a[o] === void 0)
780
780
  throw new e(`Extension Header Parameter "${o}" is missing`);
781
781
  if (s.get(o) && r[o] === void 0)
@@ -783,13 +783,13 @@ function dn(e, t, n, r, a) {
783
783
  }
784
784
  return new Set(r.crit);
785
785
  }
786
- const hn = (e, t) => {
786
+ const pn = (e, t) => {
787
787
  if (t !== void 0 && (!Array.isArray(t) || t.some((n) => typeof n != "string")))
788
788
  throw new TypeError(`"${e}" option must be an array of strings`);
789
789
  if (t)
790
790
  return new Set(t);
791
791
  };
792
- function pn(e, t) {
792
+ function fn(e, t) {
793
793
  const n = `SHA-${e.slice(-3)}`;
794
794
  switch (e) {
795
795
  case "HS256":
@@ -811,103 +811,103 @@ function pn(e, t) {
811
811
  case "EdDSA":
812
812
  return { name: t.name };
813
813
  default:
814
- throw new O(`alg ${e} is not supported either by JOSE or your javascript runtime`);
814
+ throw new N(`alg ${e} is not supported either by JOSE or your javascript runtime`);
815
815
  }
816
816
  }
817
- async function fn(e, t, n) {
818
- if (t = await rn.normalizePublicKey(t, e), ze(t))
819
- return qt(t, e, n), t;
817
+ async function yn(e, t, n) {
818
+ if (t = await an.normalizePublicKey(t, e), Qe(t))
819
+ return zt(t, e, n), t;
820
820
  if (t instanceof Uint8Array) {
821
821
  if (!e.startsWith("HS"))
822
- throw new TypeError(Oe(t, ...ce));
823
- return he.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [n]);
822
+ throw new TypeError(De(t, ...ue));
823
+ return pe.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [n]);
824
824
  }
825
- throw new TypeError(Oe(t, ...ce, "Uint8Array"));
825
+ throw new TypeError(De(t, ...ue, "Uint8Array"));
826
826
  }
827
- const yn = async (e, t, n, r) => {
828
- const a = await fn(e, t, "verify");
829
- Xt(e, a);
830
- const s = pn(e, a.algorithm);
827
+ const gn = async (e, t, n, r) => {
828
+ const a = await yn(e, t, "verify");
829
+ Zt(e, a);
830
+ const s = fn(e, a.algorithm);
831
831
  try {
832
- return await he.subtle.verify(s, a, n, r);
832
+ return await pe.subtle.verify(s, a, n, r);
833
833
  } catch {
834
834
  return !1;
835
835
  }
836
836
  };
837
- async function gn(e, t, n) {
838
- if (!ue(e))
839
- throw new S("Flattened JWS must be an object");
837
+ async function mn(e, t, n) {
838
+ if (!le(e))
839
+ throw new A("Flattened JWS must be an object");
840
840
  if (e.protected === void 0 && e.header === void 0)
841
- throw new S('Flattened JWS must have either of the "protected" or "header" members');
841
+ throw new A('Flattened JWS must have either of the "protected" or "header" members');
842
842
  if (e.protected !== void 0 && typeof e.protected != "string")
843
- throw new S("JWS Protected Header incorrect type");
843
+ throw new A("JWS Protected Header incorrect type");
844
844
  if (e.payload === void 0)
845
- throw new S("JWS Payload missing");
845
+ throw new A("JWS Payload missing");
846
846
  if (typeof e.signature != "string")
847
- throw new S("JWS Signature missing or incorrect type");
848
- if (e.header !== void 0 && !ue(e.header))
849
- throw new S("JWS Unprotected Header incorrect type");
847
+ throw new A("JWS Signature missing or incorrect type");
848
+ if (e.header !== void 0 && !le(e.header))
849
+ throw new A("JWS Unprotected Header incorrect type");
850
850
  let r = {};
851
851
  if (e.protected)
852
852
  try {
853
- const u = F(e.protected);
854
- r = JSON.parse(B.decode(u));
853
+ const u = B(e.protected);
854
+ r = JSON.parse(q.decode(u));
855
855
  } catch {
856
- throw new S("JWS Protected Header is invalid");
856
+ throw new A("JWS Protected Header is invalid");
857
857
  }
858
- if (!zt(r, e.header))
859
- throw new S("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
858
+ if (!Qt(r, e.header))
859
+ throw new A("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
860
860
  const a = {
861
861
  ...r,
862
862
  ...e.header
863
- }, s = dn(S, /* @__PURE__ */ new Map([["b64", !0]]), n?.crit, r, a);
863
+ }, s = hn(A, /* @__PURE__ */ new Map([["b64", !0]]), n?.crit, r, a);
864
864
  let o = !0;
865
865
  if (s.has("b64") && (o = r.b64, typeof o != "boolean"))
866
- throw new S('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
866
+ throw new A('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
867
867
  const { alg: i } = a;
868
868
  if (typeof i != "string" || !i)
869
- throw new S('JWS "alg" (Algorithm) Header Parameter missing or invalid');
870
- const c = n && hn("algorithms", n.algorithms);
869
+ throw new A('JWS "alg" (Algorithm) Header Parameter missing or invalid');
870
+ const c = n && pn("algorithms", n.algorithms);
871
871
  if (c && !c.has(i))
872
- throw new Vt('"alg" (Algorithm) Header Parameter value not allowed');
872
+ throw new jt('"alg" (Algorithm) Header Parameter value not allowed');
873
873
  if (o) {
874
874
  if (typeof e.payload != "string")
875
- throw new S("JWS Payload must be a string");
875
+ throw new A("JWS Payload must be a string");
876
876
  } else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
877
- throw new S("JWS Payload must be a string or an Uint8Array instance");
877
+ throw new A("JWS Payload must be a string or an Uint8Array instance");
878
878
  let y = !1;
879
- typeof t == "function" && (t = await t(r, e), y = !0), ln(i, t, "verify");
880
- const l = Jt(X.encode(e.protected ?? ""), X.encode("."), typeof e.payload == "string" ? X.encode(e.payload) : e.payload);
879
+ typeof t == "function" && (t = await t(r, e), y = !0), dn(i, t, "verify");
880
+ const l = Yt(Z.encode(e.protected ?? ""), Z.encode("."), typeof e.payload == "string" ? Z.encode(e.payload) : e.payload);
881
881
  let h;
882
882
  try {
883
- h = F(e.signature);
883
+ h = B(e.signature);
884
884
  } catch {
885
- throw new S("Failed to base64url decode the signature");
885
+ throw new A("Failed to base64url decode the signature");
886
886
  }
887
- if (!await yn(i, t, h, l))
888
- throw new jt();
887
+ if (!await gn(i, t, h, l))
888
+ throw new Ft();
889
889
  let g;
890
890
  if (o)
891
891
  try {
892
- g = F(e.payload);
892
+ g = B(e.payload);
893
893
  } catch {
894
- throw new S("Failed to base64url decode the payload");
894
+ throw new A("Failed to base64url decode the payload");
895
895
  }
896
- else typeof e.payload == "string" ? g = X.encode(e.payload) : g = e.payload;
896
+ else typeof e.payload == "string" ? g = Z.encode(e.payload) : g = e.payload;
897
897
  const f = { payload: g };
898
898
  return e.protected !== void 0 && (f.protectedHeader = r), e.header !== void 0 && (f.unprotectedHeader = e.header), y ? { ...f, key: t } : f;
899
899
  }
900
- async function mn(e, t, n) {
901
- if (e instanceof Uint8Array && (e = B.decode(e)), typeof e != "string")
902
- throw new S("Compact JWS must be a string or Uint8Array");
900
+ async function wn(e, t, n) {
901
+ if (e instanceof Uint8Array && (e = q.decode(e)), typeof e != "string")
902
+ throw new A("Compact JWS must be a string or Uint8Array");
903
903
  const { 0: r, 1: a, 2: s, length: o } = e.split(".");
904
904
  if (o !== 3)
905
- throw new S("Invalid Compact JWS");
906
- const i = await gn({ payload: a, protected: r, signature: s }, t, n), c = { payload: i.payload, protectedHeader: i.protectedHeader };
905
+ throw new A("Invalid Compact JWS");
906
+ const i = await mn({ payload: a, protected: r, signature: s }, t, n), c = { payload: i.payload, protectedHeader: i.protectedHeader };
907
907
  return typeof t == "function" ? { ...c, key: i.key } : c;
908
908
  }
909
- const wn = (e) => Math.floor(e.getTime() / 1e3), rt = 60, at = rt * 60, Re = at * 24, En = Re * 7, Sn = Re * 365.25, An = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, De = (e) => {
910
- const t = An.exec(e);
909
+ const En = (e) => Math.floor(e.getTime() / 1e3), at = 60, ot = at * 60, Ie = ot * 24, Sn = Ie * 7, An = Ie * 365.25, Tn = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, $e = (e) => {
910
+ const t = Tn.exec(e);
911
911
  if (!t || t[4] && t[1])
912
912
  throw new TypeError("Invalid time period format");
913
913
  const n = parseFloat(t[2]), r = t[3].toLowerCase();
@@ -925,40 +925,40 @@ const wn = (e) => Math.floor(e.getTime() / 1e3), rt = 60, at = rt * 60, Re = at
925
925
  case "min":
926
926
  case "mins":
927
927
  case "m":
928
- a = Math.round(n * rt);
928
+ a = Math.round(n * at);
929
929
  break;
930
930
  case "hour":
931
931
  case "hours":
932
932
  case "hr":
933
933
  case "hrs":
934
934
  case "h":
935
- a = Math.round(n * at);
935
+ a = Math.round(n * ot);
936
936
  break;
937
937
  case "day":
938
938
  case "days":
939
939
  case "d":
940
- a = Math.round(n * Re);
940
+ a = Math.round(n * Ie);
941
941
  break;
942
942
  case "week":
943
943
  case "weeks":
944
944
  case "w":
945
- a = Math.round(n * En);
945
+ a = Math.round(n * Sn);
946
946
  break;
947
947
  default:
948
- a = Math.round(n * Sn);
948
+ a = Math.round(n * An);
949
949
  break;
950
950
  }
951
951
  return t[1] === "-" || t[4] === "ago" ? -a : a;
952
- }, Ue = (e) => e.toLowerCase().replace(/^application\//, ""), Tn = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, Rn = (e, t, n = {}) => {
952
+ }, Ke = (e) => e.toLowerCase().replace(/^application\//, ""), Rn = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, bn = (e, t, n = {}) => {
953
953
  let r;
954
954
  try {
955
- r = JSON.parse(B.decode(t));
955
+ r = JSON.parse(q.decode(t));
956
956
  } catch {
957
957
  }
958
- if (!ue(r))
958
+ if (!le(r))
959
959
  throw new k("JWT Claims Set must be a top-level JSON object");
960
960
  const { typ: a } = n;
961
- if (a && (typeof e.typ != "string" || Ue(e.typ) !== Ue(a)))
961
+ if (a && (typeof e.typ != "string" || Ke(e.typ) !== Ke(a)))
962
962
  throw new _('unexpected "typ" JWT header value', r, "typ", "check_failed");
963
963
  const { requiredClaims: s = [], issuer: o, subject: i, audience: c, maxTokenAge: y } = n, l = [...s];
964
964
  y !== void 0 && l.push("iat"), c !== void 0 && l.push("aud"), i !== void 0 && l.push("sub"), o !== void 0 && l.push("iss");
@@ -969,12 +969,12 @@ const wn = (e) => Math.floor(e.getTime() / 1e3), rt = 60, at = rt * 60, Re = at
969
969
  throw new _('unexpected "iss" claim value', r, "iss", "check_failed");
970
970
  if (i && r.sub !== i)
971
971
  throw new _('unexpected "sub" claim value', r, "sub", "check_failed");
972
- if (c && !Tn(r.aud, typeof c == "string" ? [c] : c))
972
+ if (c && !Rn(r.aud, typeof c == "string" ? [c] : c))
973
973
  throw new _('unexpected "aud" claim value', r, "aud", "check_failed");
974
974
  let h;
975
975
  switch (typeof n.clockTolerance) {
976
976
  case "string":
977
- h = De(n.clockTolerance);
977
+ h = $e(n.clockTolerance);
978
978
  break;
979
979
  case "number":
980
980
  h = n.clockTolerance;
@@ -985,7 +985,7 @@ const wn = (e) => Math.floor(e.getTime() / 1e3), rt = 60, at = rt * 60, Re = at
985
985
  default:
986
986
  throw new TypeError("Invalid clockTolerance option type");
987
987
  }
988
- const { currentDate: g } = n, f = wn(g || /* @__PURE__ */ new Date());
988
+ const { currentDate: g } = n, f = En(g || /* @__PURE__ */ new Date());
989
989
  if ((r.iat !== void 0 || y) && typeof r.iat != "number")
990
990
  throw new _('"iat" claim must be a number', r, "iat", "invalid");
991
991
  if (r.nbf !== void 0) {
@@ -998,27 +998,27 @@ const wn = (e) => Math.floor(e.getTime() / 1e3), rt = 60, at = rt * 60, Re = at
998
998
  if (typeof r.exp != "number")
999
999
  throw new _('"exp" claim must be a number', r, "exp", "invalid");
1000
1000
  if (r.exp <= f - h)
1001
- throw new Pe('"exp" claim timestamp check failed', r, "exp", "check_failed");
1001
+ throw new Ne('"exp" claim timestamp check failed', r, "exp", "check_failed");
1002
1002
  }
1003
1003
  if (y) {
1004
- const u = f - r.iat, m = typeof y == "number" ? y : De(y);
1004
+ const u = f - r.iat, m = typeof y == "number" ? y : $e(y);
1005
1005
  if (u - h > m)
1006
- throw new Pe('"iat" claim timestamp check failed (too far in the past)', r, "iat", "check_failed");
1006
+ throw new Ne('"iat" claim timestamp check failed (too far in the past)', r, "iat", "check_failed");
1007
1007
  if (u < 0 - h)
1008
1008
  throw new _('"iat" claim timestamp check failed (it should be in the past)', r, "iat", "check_failed");
1009
1009
  }
1010
1010
  return r;
1011
1011
  };
1012
- async function bn(e, t, n) {
1012
+ async function In(e, t, n) {
1013
1013
  var r;
1014
- const a = await mn(e, t, n);
1014
+ const a = await wn(e, t, n);
1015
1015
  if ((r = a.protectedHeader.crit) != null && r.includes("b64") && a.protectedHeader.b64 === !1)
1016
1016
  throw new k("JWTs MUST NOT use unencoded payload");
1017
- const s = { payload: Rn(a.protectedHeader, a.payload, n), protectedHeader: a.protectedHeader };
1017
+ const s = { payload: bn(a.protectedHeader, a.payload, n), protectedHeader: a.protectedHeader };
1018
1018
  return typeof t == "function" ? { ...s, key: a.key } : s;
1019
1019
  }
1020
- const In = F;
1021
- function _n(e) {
1020
+ const _n = B;
1021
+ function vn(e) {
1022
1022
  if (typeof e != "string")
1023
1023
  throw new k("JWTs must use Compact JWS serialization, JWT must be a string");
1024
1024
  const { 1: t, length: n } = e.split(".");
@@ -1030,72 +1030,72 @@ function _n(e) {
1030
1030
  throw new k("JWTs must contain a payload");
1031
1031
  let r;
1032
1032
  try {
1033
- r = In(t);
1033
+ r = _n(t);
1034
1034
  } catch {
1035
1035
  throw new k("Failed to base64url decode the payload");
1036
1036
  }
1037
1037
  let a;
1038
1038
  try {
1039
- a = JSON.parse(B.decode(r));
1039
+ a = JSON.parse(q.decode(r));
1040
1040
  } catch {
1041
1041
  throw new k("Failed to parse the decoded payload as JSON");
1042
1042
  }
1043
- if (!ue(a))
1043
+ if (!le(a))
1044
1044
  throw new k("Invalid JWT Claims Set");
1045
1045
  return a;
1046
1046
  }
1047
- const G = async (e) => {
1047
+ const J = async (e) => {
1048
1048
  try {
1049
- const t = A.ALG, n = await sn(Gt, t);
1050
- return await bn(e, n, {
1051
- issuer: A.ISSUER
1049
+ const t = T.ALG, n = await cn(Jt, t);
1050
+ return await In(e, n, {
1051
+ issuer: T.ISSUER
1052
1052
  });
1053
1053
  } catch {
1054
1054
  return;
1055
1055
  }
1056
- }, vn = (e) => {
1056
+ }, Cn = (e) => {
1057
1057
  try {
1058
- return _n(e);
1058
+ return vn(e);
1059
1059
  } catch {
1060
1060
  return;
1061
1061
  }
1062
1062
  };
1063
- var w = [];
1064
- for (var we = 0; we < 256; ++we)
1065
- w.push((we + 256).toString(16).slice(1));
1066
- function Cn(e, t = 0) {
1067
- return (w[e[t + 0]] + w[e[t + 1]] + w[e[t + 2]] + w[e[t + 3]] + "-" + w[e[t + 4]] + w[e[t + 5]] + "-" + w[e[t + 6]] + w[e[t + 7]] + "-" + w[e[t + 8]] + w[e[t + 9]] + "-" + w[e[t + 10]] + w[e[t + 11]] + w[e[t + 12]] + w[e[t + 13]] + w[e[t + 14]] + w[e[t + 15]]).toLowerCase();
1063
+ var E = [];
1064
+ for (var Se = 0; Se < 256; ++Se)
1065
+ E.push((Se + 256).toString(16).slice(1));
1066
+ function Pn(e, t = 0) {
1067
+ return (E[e[t + 0]] + E[e[t + 1]] + E[e[t + 2]] + E[e[t + 3]] + "-" + E[e[t + 4]] + E[e[t + 5]] + "-" + E[e[t + 6]] + E[e[t + 7]] + "-" + E[e[t + 8]] + E[e[t + 9]] + "-" + E[e[t + 10]] + E[e[t + 11]] + E[e[t + 12]] + E[e[t + 13]] + E[e[t + 14]] + E[e[t + 15]]).toLowerCase();
1068
1068
  }
1069
- var ee, kn = new Uint8Array(16);
1070
- function Pn() {
1071
- if (!ee && (ee = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ee))
1069
+ var te, kn = new Uint8Array(16);
1070
+ function On() {
1071
+ if (!te && (te = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !te))
1072
1072
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1073
- return ee(kn);
1073
+ return te(kn);
1074
1074
  }
1075
- var On = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1076
- const $e = {
1077
- randomUUID: On
1075
+ var Nn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1076
+ const He = {
1077
+ randomUUID: Nn
1078
1078
  };
1079
- function Ke(e, t, n) {
1080
- if ($e.randomUUID && !t && !e)
1081
- return $e.randomUUID();
1079
+ function Le(e, t, n) {
1080
+ if (He.randomUUID && !t && !e)
1081
+ return He.randomUUID();
1082
1082
  e = e || {};
1083
- var r = e.random || (e.rng || Pn)();
1084
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Cn(r);
1083
+ var r = e.random || (e.rng || On)();
1084
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Pn(r);
1085
1085
  }
1086
- const He = globalThis.crypto, Nn = (e) => `${Ke()}${Ke()}`.slice(0, e), Dn = (e) => btoa(
1086
+ const We = globalThis.crypto, Dn = (e) => `${Le()}${Le()}`.slice(0, e), Un = (e) => btoa(
1087
1087
  [...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
1088
1088
  );
1089
- async function Un(e) {
1090
- if (!He.subtle)
1089
+ async function $n(e) {
1090
+ if (!We.subtle)
1091
1091
  throw new Error(
1092
1092
  "crypto.subtle is available only in secure contexts (HTTPS)."
1093
1093
  );
1094
- const t = new TextEncoder().encode(e), n = await He.subtle.digest("SHA-256", t);
1095
- return Dn(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1094
+ const t = new TextEncoder().encode(e), n = await We.subtle.digest("SHA-256", t);
1095
+ return Un(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1096
1096
  }
1097
- async function $n(e) {
1098
- const n = Nn(43), r = await Un(n);
1097
+ async function Kn(e) {
1098
+ const n = Dn(43), r = await $n(n);
1099
1099
  return {
1100
1100
  code_verifier: n,
1101
1101
  code_challenge: r
@@ -1103,79 +1103,79 @@ async function $n(e) {
1103
1103
  }
1104
1104
  const Ur = async (e, t) => {
1105
1105
  var n;
1106
- const r = await G(e);
1107
- if (!r || !Array.isArray((n = r.payload) == null ? void 0 : n[A.SCOPES_KEY]))
1106
+ const r = await J(e);
1107
+ if (!r || !Array.isArray((n = r.payload) == null ? void 0 : n[T.SCOPES_KEY]))
1108
1108
  return !1;
1109
- const a = r.payload[A.SCOPES_KEY];
1109
+ const a = r.payload[T.SCOPES_KEY];
1110
1110
  return Array.isArray(t) ? t.every((s) => a.includes(s)) : Object.keys(t).some(
1111
1111
  (s) => t[s].every((o) => a.includes(o))
1112
1112
  );
1113
1113
  };
1114
- function ot(e, t) {
1114
+ function st(e, t) {
1115
1115
  window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
1116
1116
  }
1117
- const Le = (e, t) => {
1117
+ const xe = (e, t) => {
1118
1118
  const n = JSON.stringify(
1119
1119
  typeof t == "function" ? t() : t
1120
1120
  );
1121
- window.localStorage.setItem(e, n), ot(e, n);
1122
- }, Kn = (e) => {
1123
- window.localStorage.removeItem(e), ot(e, null);
1124
- }, We = (e) => window.localStorage.getItem(e), Hn = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1125
- function te({
1121
+ window.localStorage.setItem(e, n), st(e, n);
1122
+ }, Hn = (e) => {
1123
+ window.localStorage.removeItem(e), st(e, null);
1124
+ }, Me = (e) => window.localStorage.getItem(e), Ln = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1125
+ function ne({
1126
1126
  key: e,
1127
1127
  initialValue: t
1128
1128
  }) {
1129
- const n = Ot(Hn, () => We(e)), r = D(
1129
+ const n = Nt(Ln, () => Me(e)), r = U(
1130
1130
  (o) => {
1131
1131
  try {
1132
1132
  const i = typeof o == "function" ? o(JSON.parse(n)) : o;
1133
- i == null ? Kn(e) : Le(e, i);
1133
+ i == null ? Hn(e) : xe(e, i);
1134
1134
  } catch (i) {
1135
1135
  console.warn(i);
1136
1136
  }
1137
1137
  },
1138
1138
  [e, n]
1139
- ), a = D(() => {
1139
+ ), a = U(() => {
1140
1140
  r(t);
1141
- }, [t, r]), s = D(() => {
1141
+ }, [t, r]), s = U(() => {
1142
1142
  r(null);
1143
1143
  }, [r]);
1144
- return Ae(() => {
1144
+ return Re(() => {
1145
1145
  try {
1146
- We(e) === null && typeof t < "u" && Le(e, t);
1146
+ Me(e) === null && typeof t < "u" && xe(e, t);
1147
1147
  } catch (o) {
1148
1148
  console.warn(o);
1149
1149
  }
1150
1150
  }, [e, t]), [n ? JSON.parse(n) : null, r, a, s];
1151
1151
  }
1152
- var E = [];
1153
- for (var Ee = 0; Ee < 256; ++Ee)
1154
- E.push((Ee + 256).toString(16).slice(1));
1155
- function Ln(e, t = 0) {
1156
- return (E[e[t + 0]] + E[e[t + 1]] + E[e[t + 2]] + E[e[t + 3]] + "-" + E[e[t + 4]] + E[e[t + 5]] + "-" + E[e[t + 6]] + E[e[t + 7]] + "-" + E[e[t + 8]] + E[e[t + 9]] + "-" + E[e[t + 10]] + E[e[t + 11]] + E[e[t + 12]] + E[e[t + 13]] + E[e[t + 14]] + E[e[t + 15]]).toLowerCase();
1152
+ var S = [];
1153
+ for (var Ae = 0; Ae < 256; ++Ae)
1154
+ S.push((Ae + 256).toString(16).slice(1));
1155
+ function Wn(e, t = 0) {
1156
+ return (S[e[t + 0]] + S[e[t + 1]] + S[e[t + 2]] + S[e[t + 3]] + "-" + S[e[t + 4]] + S[e[t + 5]] + "-" + S[e[t + 6]] + S[e[t + 7]] + "-" + S[e[t + 8]] + S[e[t + 9]] + "-" + S[e[t + 10]] + S[e[t + 11]] + S[e[t + 12]] + S[e[t + 13]] + S[e[t + 14]] + S[e[t + 15]]).toLowerCase();
1157
1157
  }
1158
- var ne, Wn = new Uint8Array(16);
1159
- function xn() {
1160
- if (!ne && (ne = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ne))
1158
+ var re, xn = new Uint8Array(16);
1159
+ function Mn() {
1160
+ if (!re && (re = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !re))
1161
1161
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1162
- return ne(Wn);
1162
+ return re(xn);
1163
1163
  }
1164
- var Mn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1165
- const xe = {
1166
- randomUUID: Mn
1164
+ var Gn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1165
+ const Ge = {
1166
+ randomUUID: Gn
1167
1167
  };
1168
- function Se(e, t, n) {
1169
- if (xe.randomUUID && !t && !e)
1170
- return xe.randomUUID();
1168
+ function Te(e, t, n) {
1169
+ if (Ge.randomUUID && !t && !e)
1170
+ return Ge.randomUUID();
1171
1171
  e = e || {};
1172
- var r = e.random || (e.rng || xn)();
1173
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Ln(r);
1172
+ var r = e.random || (e.rng || Mn)();
1173
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Wn(r);
1174
1174
  }
1175
- const K = "Oops! It looks like your session has expired. For your security, please log in again to continue.", Gn = "Your session has been successfully terminated.", re = "Login failed. Please try again.", Jn = "Error getting access token, please re-authenticate.", Yn = "You forgot to wrap your component in <AuthProvider>.", le = {
1175
+ const H = "Oops! It looks like your session has expired. For your security, please log in again to continue.", Jn = "Your session has been successfully terminated.", ae = "Login failed. Please try again.", Yn = "Error getting access token, please re-authenticate.", Vn = "You forgot to wrap your component in <AuthProvider>.", de = {
1176
1176
  dev: "https://auth.gizmette.local.com:3003",
1177
1177
  prod: "https://mylogin.gizmette.com/auth"
1178
- }, ae = "@@auth@@", V = "LOADING", j = "LOGIN", st = "LOGOUT", Vn = "success", Me = "failure";
1178
+ }, oe = "@@auth@@", j = "LOADING", F = "LOGIN", it = "LOGOUT", fe = "success", C = "failure";
1179
1179
  /*!
1180
1180
  @versini/ui-fingerprint v1.0.1
1181
1181
  © 2024 gizmette.com
@@ -1189,20 +1189,20 @@ try {
1189
1189
  });
1190
1190
  } catch {
1191
1191
  }
1192
- const jn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join(""), it = async (e) => {
1192
+ const jn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join(""), ct = async (e) => {
1193
1193
  if (e === "")
1194
1194
  return "";
1195
1195
  const t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
1196
1196
  return Array.from(new Uint8Array(n)).map((r) => r.toString(16).padStart(2, "0")).join("");
1197
1197
  };
1198
- function Ge(e, t) {
1198
+ function Je(e, t) {
1199
1199
  return new Promise((n) => setTimeout(n, e, t));
1200
1200
  }
1201
1201
  async function Fn(e, t, n = 50) {
1202
1202
  var r, a, s;
1203
1203
  const o = document;
1204
1204
  for (; !o.body; )
1205
- await Ge(n);
1205
+ await Je(n);
1206
1206
  const i = o.createElement("iframe");
1207
1207
  try {
1208
1208
  for (await new Promise((c, y) => {
@@ -1216,12 +1216,12 @@ async function Fn(e, t, n = 50) {
1216
1216
  const { style: f } = i;
1217
1217
  f.setProperty("display", "block", "important"), f.position = "absolute", f.top = "0", f.left = "0", f.visibility = "hidden", i.src = "about:blank", o.body.appendChild(i);
1218
1218
  const u = () => {
1219
- var m, T;
1220
- l || (((T = (m = i.contentWindow) == null ? void 0 : m.document) == null ? void 0 : T.readyState) === "complete" ? h() : setTimeout(u, 10));
1219
+ var m, R;
1220
+ l || (((R = (m = i.contentWindow) == null ? void 0 : m.document) == null ? void 0 : R.readyState) === "complete" ? h() : setTimeout(u, 10));
1221
1221
  };
1222
1222
  u();
1223
1223
  }); !((a = (r = i.contentWindow) == null ? void 0 : r.document) != null && a.body); )
1224
- await Ge(n);
1224
+ await Je(n);
1225
1225
  return await e(i, i.contentWindow);
1226
1226
  } finally {
1227
1227
  (s = i.parentNode) == null || s.removeChild(i);
@@ -1260,7 +1260,7 @@ const Bn = {
1260
1260
  }
1261
1261
  });
1262
1262
  }
1263
- }), ct = { browser: "" }, zn = async (e) => typeof navigator > "u" ? ct : { browser: navigator.userAgent }, ut = {
1263
+ }), ut = { browser: "" }, zn = async (e) => typeof navigator > "u" ? ut : { browser: navigator.userAgent }, lt = {
1264
1264
  canvas: {
1265
1265
  data: ""
1266
1266
  }
@@ -1272,11 +1272,11 @@ const Bn = {
1272
1272
  ), n = er(t, 300, 30);
1273
1273
  return {
1274
1274
  canvas: {
1275
- data: (await it(n.data.toString())).toString()
1275
+ data: (await ct(n.data.toString())).toString()
1276
1276
  }
1277
1277
  };
1278
1278
  } catch {
1279
- return ut;
1279
+ return lt;
1280
1280
  }
1281
1281
  }, Xn = (e, t) => {
1282
1282
  const n = document.createElement("canvas"), r = n.getContext("2d");
@@ -1307,7 +1307,7 @@ const Bn = {
1307
1307
  }
1308
1308
  const a = r, s = new Uint8ClampedArray(a);
1309
1309
  return new ImageData(s, t, n);
1310
- }, tr = [], nr = "mmMwWLliI0O&1", rr = "48px", H = ["monospace", "sans-serif", "serif"], Je = [
1310
+ }, tr = [], nr = "mmMwWLliI0O&1", rr = "48px", L = ["monospace", "sans-serif", "serif"], Ye = [
1311
1311
  "sans-serif-thin",
1312
1312
  "ARNO PRO",
1313
1313
  "Agency FB",
@@ -1351,32 +1351,32 @@ const Bn = {
1351
1351
  const a = n.createElement("div");
1352
1352
  a.style.setProperty("visibility", "hidden", "important");
1353
1353
  const s = {}, o = {}, i = (u) => {
1354
- const m = n.createElement("span"), { style: T } = m;
1355
- return T.position = "absolute", T.top = "0", T.left = "0", T.fontFamily = u, m.textContent = nr, a.appendChild(m), m;
1356
- }, c = (u, m) => i(`'${u}',${m}`), y = () => H.map(i), l = () => {
1354
+ const m = n.createElement("span"), { style: R } = m;
1355
+ return R.position = "absolute", R.top = "0", R.left = "0", R.fontFamily = u, m.textContent = nr, a.appendChild(m), m;
1356
+ }, c = (u, m) => i(`'${u}',${m}`), y = () => L.map(i), l = () => {
1357
1357
  const u = {};
1358
- for (const m of Je)
1359
- u[m] = H.map(
1360
- (T) => c(m, T)
1358
+ for (const m of Ye)
1359
+ u[m] = L.map(
1360
+ (R) => c(m, R)
1361
1361
  );
1362
1362
  return u;
1363
- }, h = (u) => H.some(
1364
- (m, T) => u[T].offsetWidth !== s[m] || u[T].offsetHeight !== o[m]
1363
+ }, h = (u) => L.some(
1364
+ (m, R) => u[R].offsetWidth !== s[m] || u[R].offsetHeight !== o[m]
1365
1365
  ), g = y(), f = l();
1366
1366
  r.appendChild(a);
1367
- for (let u = 0; u < H.length; u++)
1368
- s[H[u]] = g[u].offsetWidth, o[H[u]] = g[u].offsetHeight;
1369
- return Je.filter((u) => h(f[u]));
1370
- }), lt = {
1367
+ for (let u = 0; u < L.length; u++)
1368
+ s[L[u]] = g[u].offsetWidth, o[L[u]] = g[u].offsetHeight;
1369
+ return Ye.filter((u) => h(f[u]));
1370
+ }), dt = {
1371
1371
  vendor: "",
1372
1372
  vendorUnmasked: "",
1373
1373
  renderer: "",
1374
1374
  rendererUnmasked: "",
1375
1375
  version: "",
1376
1376
  shadingLanguageVersion: ""
1377
- }, dt = {
1377
+ }, ht = {
1378
1378
  hardware: {
1379
- videocard: lt,
1379
+ videocard: dt,
1380
1380
  architecture: 0,
1381
1381
  deviceMemory: "undefined",
1382
1382
  jsHeapSizeLimit: 0
@@ -1395,7 +1395,7 @@ function or() {
1395
1395
  shadingLanguageVersion: (t.getParameter(t.SHADING_LANGUAGE_VERSION) || "").toString()
1396
1396
  };
1397
1397
  }
1398
- return lt;
1398
+ return dt;
1399
1399
  }
1400
1400
  function sr() {
1401
1401
  const e = new Float32Array(1), t = new Uint8Array(e.buffer);
@@ -1415,7 +1415,7 @@ const ir = () => navigator.deviceMemory || 0, cr = () => window.performance && w
1415
1415
  }
1416
1416
  });
1417
1417
  } catch {
1418
- t(dt);
1418
+ t(ht);
1419
1419
  }
1420
1420
  }), lr = {
1421
1421
  locales: {
@@ -1429,7 +1429,7 @@ const ir = () => navigator.deviceMemory || 0, cr = () => window.performance && w
1429
1429
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
1430
1430
  }
1431
1431
  });
1432
- }), ht = {
1432
+ }), pt = {
1433
1433
  screen: {
1434
1434
  colorDepth: 0,
1435
1435
  pixelDepth: 0,
@@ -1450,7 +1450,7 @@ const ir = () => navigator.deviceMemory || 0, cr = () => window.performance && w
1450
1450
  };
1451
1451
  t(r);
1452
1452
  } catch {
1453
- t(ht);
1453
+ t(pt);
1454
1454
  }
1455
1455
  });
1456
1456
  function pr() {
@@ -1492,9 +1492,9 @@ const fr = async (e) => {
1492
1492
  }
1493
1493
  };
1494
1494
  } catch {
1495
- return pt;
1495
+ return ft;
1496
1496
  }
1497
- }, pt = {
1497
+ }, ft = {
1498
1498
  system: {
1499
1499
  platform: "",
1500
1500
  cookieEnabled: !1,
@@ -1516,23 +1516,23 @@ const fr = async (e) => {
1516
1516
  } catch {
1517
1517
  return [
1518
1518
  Bn,
1519
- ct,
1520
1519
  ut,
1520
+ lt,
1521
1521
  tr,
1522
- dt,
1523
- lr,
1524
1522
  ht,
1525
- pt
1523
+ lr,
1524
+ pt,
1525
+ ft
1526
1526
  ];
1527
1527
  }
1528
1528
  }, gr = async (e) => {
1529
1529
  try {
1530
1530
  const t = await yr(e);
1531
- return await it(JSON.stringify(t));
1531
+ return await ct(JSON.stringify(t));
1532
1532
  } catch {
1533
1533
  return "";
1534
1534
  }
1535
- }, oe = {
1535
+ }, se = {
1536
1536
  GET_REGISTRATION_OPTIONS: `mutation GetPasskeyRegistrationOptions(
1537
1537
  $clientId: String!,
1538
1538
  $username: String!,
@@ -1610,24 +1610,24 @@ const fr = async (e) => {
1610
1610
  username,
1611
1611
  }
1612
1612
  }`
1613
- }, L = {
1613
+ }, W = {
1614
1614
  GET_REGISTRATION_OPTIONS: {
1615
- schema: oe.GET_REGISTRATION_OPTIONS,
1615
+ schema: se.GET_REGISTRATION_OPTIONS,
1616
1616
  method: "getPasskeyRegistrationOptions"
1617
1617
  },
1618
1618
  VERIFY_REGISTRATION: {
1619
- schema: oe.VERIFY_REGISTRATION,
1619
+ schema: se.VERIFY_REGISTRATION,
1620
1620
  method: "verifyPasskeyRegistration"
1621
1621
  },
1622
1622
  GET_AUTHENTICATION_OPTIONS: {
1623
- schema: oe.GET_AUTHENTICATION_OPTIONS,
1623
+ schema: se.GET_AUTHENTICATION_OPTIONS,
1624
1624
  method: "getPasskeyAuthenticationOptions"
1625
1625
  },
1626
1626
  VERIFY_AUTHENTICATION: {
1627
- schema: oe.VERIFY_AUTHENTICATION,
1627
+ schema: se.VERIFY_AUTHENTICATION,
1628
1628
  method: "verifyPasskeyAuthentication"
1629
1629
  }
1630
- }, W = async ({
1630
+ }, x = async ({
1631
1631
  accessToken: e,
1632
1632
  type: t,
1633
1633
  clientId: n,
@@ -1635,7 +1635,7 @@ const fr = async (e) => {
1635
1635
  }) => {
1636
1636
  try {
1637
1637
  const a = t?.data ? t.data(r) : r, s = `Bearer ${e}`, o = await fetch(
1638
- ft ? `${le.dev}/graphql` : `${le.prod}/graphql`,
1638
+ yt ? `${de.dev}/graphql` : `${de.prod}/graphql`,
1639
1639
  {
1640
1640
  method: "POST",
1641
1641
  credentials: "include",
@@ -1643,7 +1643,7 @@ const fr = async (e) => {
1643
1643
  authorization: s,
1644
1644
  "Content-Type": "application/json",
1645
1645
  Accept: "application/json",
1646
- [qe.CLIENT_ID]: `${n}`
1646
+ [ze.CLIENT_ID]: `${n}`
1647
1647
  },
1648
1648
  body: JSON.stringify({
1649
1649
  query: t.schema,
@@ -1652,46 +1652,44 @@ const fr = async (e) => {
1652
1652
  }
1653
1653
  );
1654
1654
  if (o.status !== 200)
1655
- return { status: o.status, data: [] };
1656
- const { data: i, errors: c } = await o.json();
1655
+ return { status: C, data: [] };
1656
+ const { data: i } = await o.json();
1657
1657
  return {
1658
- status: o.status,
1659
- data: i[t.method],
1660
- errors: c
1658
+ status: fe,
1659
+ data: i[t.method]
1661
1660
  };
1662
1661
  } catch (a) {
1663
- return console.error(a), { status: 500, data: [] };
1662
+ return console.error(a), { status: C, data: [] };
1664
1663
  }
1665
- }, pe = async ({
1664
+ }, ye = async ({
1666
1665
  type: e,
1667
1666
  clientId: t,
1668
1667
  params: n = {}
1669
1668
  }) => {
1670
1669
  try {
1671
1670
  const r = await fetch(
1672
- ft ? `${le.dev}/${e}` : `${le.prod}/${e}`,
1671
+ yt ? `${de.dev}/${e}` : `${de.prod}/${e}`,
1673
1672
  {
1674
1673
  credentials: "include",
1675
1674
  method: "POST",
1676
1675
  headers: {
1677
1676
  "Content-Type": "application/json",
1678
- [qe.CLIENT_ID]: `${t}`
1677
+ [ze.CLIENT_ID]: `${t}`
1679
1678
  },
1680
1679
  body: JSON.stringify(n)
1681
1680
  }
1682
1681
  );
1683
1682
  if (r.status !== 200)
1684
- return { status: r.status, data: [] };
1685
- const { data: a, errors: s } = await r.json();
1683
+ return { status: C, data: [] };
1684
+ const { data: a } = await r.json();
1686
1685
  return {
1687
- status: r.status,
1688
- data: a,
1689
- errors: s
1686
+ status: fe,
1687
+ data: a || []
1690
1688
  };
1691
1689
  } catch (r) {
1692
- return console.error(r), { status: 500, data: [] };
1690
+ return console.error(r), { status: C, data: [] };
1693
1691
  }
1694
- }, mr = process.env.NODE_ENV === "production", ft = !mr, yt = {
1692
+ }, mr = process.env.NODE_ENV === "production", yt = !mr, gt = {
1695
1693
  isLoading: !0,
1696
1694
  isAuthenticated: !1,
1697
1695
  authenticationType: null,
@@ -1700,8 +1698,8 @@ const fr = async (e) => {
1700
1698
  debug: !1
1701
1699
  }, wr = (e) => {
1702
1700
  try {
1703
- const t = vn(e);
1704
- return t ? t[A.USER_ID_KEY] : "";
1701
+ const t = Cn(e);
1702
+ return t ? t[T.USER_ID_KEY] : "";
1705
1703
  } catch {
1706
1704
  return "";
1707
1705
  }
@@ -1715,8 +1713,8 @@ const fr = async (e) => {
1715
1713
  }) => {
1716
1714
  try {
1717
1715
  return {
1718
- status: (await pe({
1719
- type: de.LOGOUT,
1716
+ status: (await ye({
1717
+ type: he.LOGOUT,
1720
1718
  clientId: a,
1721
1719
  params: {
1722
1720
  userId: e,
@@ -1725,14 +1723,14 @@ const fr = async (e) => {
1725
1723
  refreshToken: r,
1726
1724
  domain: s
1727
1725
  }
1728
- }))?.status === 200
1726
+ }))?.status || C
1729
1727
  };
1730
1728
  } catch {
1731
1729
  return {
1732
- status: !1
1730
+ status: C
1733
1731
  };
1734
1732
  }
1735
- }, Ye = async ({
1733
+ }, Ve = async ({
1736
1734
  username: e,
1737
1735
  password: t,
1738
1736
  clientId: n,
@@ -1745,11 +1743,11 @@ const fr = async (e) => {
1745
1743
  fingerprint: y
1746
1744
  }) => {
1747
1745
  try {
1748
- const l = await pe({
1749
- type: de.AUTHENTICATE,
1746
+ const l = await ye({
1747
+ type: he.AUTHENTICATE,
1750
1748
  clientId: n,
1751
1749
  params: {
1752
- type: a || M.ID_AND_ACCESS_TOKEN,
1750
+ type: a || G.ID_AND_ACCESS_TOKEN,
1753
1751
  username: e,
1754
1752
  password: t,
1755
1753
  sessionExpiration: s,
@@ -1759,12 +1757,12 @@ const fr = async (e) => {
1759
1757
  domain: c,
1760
1758
  fingerprint: y
1761
1759
  }
1762
- }), h = await G(l?.data?.idToken);
1763
- return h && h.payload[A.USER_ID_KEY] !== "" && h.payload[A.NONCE_KEY] === r ? {
1760
+ }), h = await J(l?.data?.idToken);
1761
+ return h && h.payload[T.USER_ID_KEY] !== "" && h.payload[T.NONCE_KEY] === r ? {
1764
1762
  idToken: l.data.idToken,
1765
1763
  accessToken: l.data.accessToken,
1766
1764
  refreshToken: l.data.refreshToken,
1767
- userId: h.payload[A.USER_ID_KEY],
1765
+ userId: h.payload[T.USER_ID_KEY],
1768
1766
  status: !0
1769
1767
  } : {
1770
1768
  status: !1
@@ -1780,24 +1778,26 @@ const fr = async (e) => {
1780
1778
  code_challenge: n
1781
1779
  }) => {
1782
1780
  try {
1783
- const r = await pe({
1784
- type: de.CODE,
1781
+ const r = await ye({
1782
+ type: he.CODE,
1785
1783
  clientId: t,
1786
1784
  params: {
1787
- type: M.CODE,
1785
+ type: G.CODE,
1788
1786
  nonce: e,
1789
1787
  code_challenge: n
1790
1788
  }
1791
1789
  });
1792
1790
  return r?.data?.code ? {
1793
- status: !0,
1794
- code: r.data.code
1791
+ status: fe,
1792
+ data: r.data.code
1795
1793
  } : {
1796
- status: !1
1794
+ status: C,
1795
+ data: ""
1797
1796
  };
1798
1797
  } catch {
1799
1798
  return {
1800
- status: !1
1799
+ status: C,
1800
+ data: ""
1801
1801
  };
1802
1802
  }
1803
1803
  }, Ar = async ({
@@ -1809,23 +1809,23 @@ const fr = async (e) => {
1809
1809
  domain: s
1810
1810
  }) => {
1811
1811
  try {
1812
- const o = await pe({
1813
- type: de.AUTHENTICATE,
1812
+ const o = await ye({
1813
+ type: he.AUTHENTICATE,
1814
1814
  clientId: e,
1815
1815
  params: {
1816
- type: M.REFRESH_TOKEN,
1816
+ type: G.REFRESH_TOKEN,
1817
1817
  userId: t,
1818
1818
  nonce: n,
1819
1819
  refreshToken: r,
1820
1820
  accessToken: a,
1821
1821
  domain: s,
1822
- fingerprint: await gt()
1822
+ fingerprint: await mt()
1823
1823
  }
1824
- }), i = await G(o?.data?.accessToken);
1825
- return i && i.payload[A.USER_ID_KEY] !== "" && i.payload[A.NONCE_KEY] === n ? {
1824
+ }), i = await J(o?.data?.accessToken);
1825
+ return i && i.payload[T.USER_ID_KEY] !== "" && i.payload[T.NONCE_KEY] === n ? {
1826
1826
  accessToken: o.data.accessToken,
1827
1827
  refreshToken: o.data.refreshToken,
1828
- userId: i.payload[A.USER_ID_KEY],
1828
+ userId: i.payload[T.USER_ID_KEY],
1829
1829
  status: !0
1830
1830
  } : {
1831
1831
  status: !1
@@ -1835,7 +1835,7 @@ const fr = async (e) => {
1835
1835
  status: !1
1836
1836
  };
1837
1837
  }
1838
- }, gt = async () => {
1838
+ }, mt = async () => {
1839
1839
  try {
1840
1840
  return await gr();
1841
1841
  } catch {
@@ -1844,9 +1844,9 @@ const fr = async (e) => {
1844
1844
  };
1845
1845
  class Tr {
1846
1846
  constructor(t = null, n = null) {
1847
- Q(this, "refreshTokenPromise", null);
1848
- Q(this, "accessToken");
1849
- Q(this, "refreshToken");
1847
+ X(this, "refreshTokenPromise", null);
1848
+ X(this, "accessToken");
1849
+ X(this, "refreshToken");
1850
1850
  this.accessToken = t || "", this.refreshToken = n || "";
1851
1851
  }
1852
1852
  async refreshtoken({
@@ -1873,8 +1873,8 @@ class Tr {
1873
1873
  nonce: r,
1874
1874
  domain: a
1875
1875
  }) {
1876
- const s = await G(this.refreshToken);
1877
- if (s && s.payload[A.USER_ID_KEY] !== "") {
1876
+ const s = await J(this.refreshToken);
1877
+ if (s && s.payload[T.USER_ID_KEY] !== "") {
1878
1878
  const o = await Ar({
1879
1879
  clientId: t,
1880
1880
  userId: n,
@@ -1884,51 +1884,51 @@ class Tr {
1884
1884
  domain: a
1885
1885
  });
1886
1886
  return o.status ? (this.accessToken = o.accessToken, this.refreshToken = o.refreshToken, {
1887
- status: Vn,
1887
+ status: fe,
1888
1888
  newAccessToken: o.accessToken,
1889
1889
  newRefreshToken: o.refreshToken
1890
1890
  }) : {
1891
- status: Me
1891
+ status: C
1892
1892
  };
1893
1893
  } else
1894
1894
  return {
1895
- status: Me
1895
+ status: C
1896
1896
  };
1897
1897
  }
1898
1898
  }
1899
- const Rr = (e) => D(
1899
+ const Rr = (e) => U(
1900
1900
  (...t) => {
1901
1901
  e && console.info(`==> [Auth ${Date.now()}]: `, ...t);
1902
1902
  },
1903
1903
  [e]
1904
- ), x = () => {
1905
- throw new Error(Yn);
1906
- }, mt = Nt({
1904
+ ), M = () => {
1905
+ throw new Error(Vn);
1906
+ }, wt = Dt({
1907
1907
  isAuthenticated: !1,
1908
1908
  isLoading: !1,
1909
1909
  authenticationType: null,
1910
- login: x,
1911
- logout: x,
1912
- getAccessToken: x,
1913
- getIdToken: x,
1914
- registeringForPasskey: x,
1915
- loginWithPasskey: x,
1910
+ login: M,
1911
+ logout: M,
1912
+ getAccessToken: M,
1913
+ getIdToken: M,
1914
+ registeringForPasskey: M,
1915
+ loginWithPasskey: M,
1916
1916
  logoutReason: ""
1917
- }), br = Pt.createContext({
1918
- state: yt,
1917
+ }), br = Ot.createContext({
1918
+ state: gt,
1919
1919
  dispatch: () => {
1920
1920
  }
1921
- }), Ir = (e, t) => t?.type === V ? {
1921
+ }), Ir = (e, t) => t?.type === j ? {
1922
1922
  ...e,
1923
1923
  isLoading: t.payload.isLoading
1924
- } : t?.type === j ? {
1924
+ } : t?.type === F ? {
1925
1925
  ...e,
1926
1926
  isLoading: !1,
1927
1927
  isAuthenticated: !0,
1928
1928
  user: t.payload.user,
1929
1929
  authenticationType: t.payload.authenticationType,
1930
1930
  logoutReason: ""
1931
- } : t?.type === st ? {
1931
+ } : t?.type === it ? {
1932
1932
  ...e,
1933
1933
  isLoading: !1,
1934
1934
  isAuthenticated: !1,
@@ -1942,54 +1942,54 @@ const Rr = (e) => D(
1942
1942
  domain: r = "",
1943
1943
  debug: a = !1
1944
1944
  }) => {
1945
- const [s, o] = Dt(Ir, {
1946
- ...yt,
1945
+ const [s, o] = Ut(Ir, {
1946
+ ...gt,
1947
1947
  debug: a
1948
- }), i = Rr(a), c = ke(!1), y = ke(""), [l, h, , g] = te({
1949
- key: `${ae}::${n}::@@user@@`
1950
- }), [f, u, , m] = te({
1951
- key: `${ae}::${n}::@@access@@`
1952
- }), [T, q, , be] = te(
1948
+ }), i = Rr(a), c = Oe(!1), y = Oe(""), [l, h, , g] = ne({
1949
+ key: `${oe}::${n}::@@user@@`
1950
+ }), [f, u, , m] = ne({
1951
+ key: `${oe}::${n}::@@access@@`
1952
+ }), [R, z, , _e] = ne(
1953
1953
  {
1954
- key: `${ae}::${n}::@@refresh@@`
1954
+ key: `${oe}::${n}::@@refresh@@`
1955
1955
  }
1956
- ), [wt, Ie, , _e] = te({
1957
- key: `${ae}::${n}::@@nonce@@`
1958
- }), Et = new Tr(f, T), z = D(() => {
1959
- i("removeLocalStorage: removing local storage"), g(), m(), be(), _e();
1956
+ ), [Et, ve, , Ce] = ne({
1957
+ key: `${oe}::${n}::@@nonce@@`
1958
+ }), St = new Tr(f, R), Q = U(() => {
1959
+ i("removeLocalStorage: removing local storage"), g(), m(), _e(), Ce();
1960
1960
  }, [
1961
1961
  m,
1962
1962
  g,
1963
+ Ce,
1963
1964
  _e,
1964
- be,
1965
1965
  i
1966
- ]), $ = D(
1966
+ ]), K = U(
1967
1967
  (d) => {
1968
1968
  i(
1969
1969
  "removeStateAndLocalStorage: removing state and local storage with reason: ",
1970
1970
  d
1971
1971
  ), o({
1972
- type: st,
1972
+ type: it,
1973
1973
  payload: {
1974
- logoutReason: d || K
1974
+ logoutReason: d || H
1975
1975
  }
1976
- }), z(), o({ type: V, payload: { isLoading: !1 } });
1976
+ }), Q(), o({ type: j, payload: { isLoading: !1 } });
1977
1977
  },
1978
- [z, i]
1979
- ), N = D(
1978
+ [Q, i]
1979
+ ), D = U(
1980
1980
  async (d) => {
1981
1981
  i("invalidateAndLogout: invalidating and logging out");
1982
- const { user: R } = s, p = R?.userId || wr(l);
1982
+ const { user: w } = s, p = w?.userId || wr(l);
1983
1983
  p || i(
1984
1984
  "invalidateAndLogout: user cannot be identified, logging out without userId"
1985
1985
  ), await Er({
1986
1986
  userId: p,
1987
1987
  idToken: l,
1988
1988
  accessToken: f,
1989
- refreshToken: T,
1989
+ refreshToken: R,
1990
1990
  clientId: n,
1991
1991
  domain: r
1992
- }), $(d || K);
1992
+ }), K(d || H);
1993
1993
  },
1994
1994
  [
1995
1995
  f,
@@ -1997,74 +1997,74 @@ const Rr = (e) => D(
1997
1997
  n,
1998
1998
  r,
1999
1999
  l,
2000
- T,
2001
- $,
2000
+ R,
2001
+ K,
2002
2002
  i
2003
2003
  ]
2004
2004
  );
2005
- Ae(() => ((async () => y.current = await gt())(), () => {
2005
+ Re(() => ((async () => y.current = await mt())(), () => {
2006
2006
  y.current = "";
2007
- }), []), Ae(() => {
2007
+ }), []), Re(() => {
2008
2008
  if (!c.current)
2009
2009
  return s.isLoading && l !== null ? (async () => {
2010
2010
  try {
2011
- const d = await G(l);
2012
- d && d.payload[A.USER_ID_KEY] !== "" ? (i("useEffect: setting the authentication state"), o({
2013
- type: j,
2011
+ const d = await J(l);
2012
+ d && d.payload[T.USER_ID_KEY] !== "" ? (i("useEffect: setting the authentication state"), o({
2013
+ type: F,
2014
2014
  payload: {
2015
- authenticationType: d.payload[A.AUTH_TYPE_KEY],
2015
+ authenticationType: d.payload[T.AUTH_TYPE_KEY],
2016
2016
  user: {
2017
- userId: d.payload[A.USER_ID_KEY],
2018
- username: d.payload[A.USERNAME_KEY]
2017
+ userId: d.payload[T.USER_ID_KEY],
2018
+ username: d.payload[T.USERNAME_KEY]
2019
2019
  }
2020
2020
  }
2021
- })) : (i("useEffect: invalid JWT, invalidating and logging out"), await N(K));
2021
+ })) : (i("useEffect: invalid JWT, invalidating and logging out"), await D(H));
2022
2022
  } catch {
2023
2023
  i(
2024
2024
  "useEffect: exception validating JWT, invalidating and logging out"
2025
- ), await N(K);
2025
+ ), await D(H);
2026
2026
  }
2027
- })() : (i("useEffect: setting the loading state to false"), o({ type: V, payload: { isLoading: !1 } })), () => {
2027
+ })() : (i("useEffect: setting the loading state to false"), o({ type: j, payload: { isLoading: !1 } })), () => {
2028
2028
  c.current = !0;
2029
2029
  };
2030
- }, [s.isLoading, l, N, i]);
2031
- const St = async (d, R, p = M.CODE) => {
2032
- const I = Se();
2033
- if (Ie(I), o({ type: V, payload: { isLoading: !0 } }), z(), i("login: Logging in with type: ", p), p === M.CODE) {
2034
- const { code_verifier: _t, code_challenge: vt } = await $n(), ve = await Sr({
2030
+ }, [s.isLoading, l, D, i]);
2031
+ const At = async (d, w, p = G.CODE) => {
2032
+ const I = Te();
2033
+ if (ve(I), o({ type: j, payload: { isLoading: !0 } }), Q(), i("login: Logging in with type: ", p), p === G.CODE) {
2034
+ const { code_verifier: vt, code_challenge: Ct } = await Kn(), Pe = await Sr({
2035
2035
  nonce: I,
2036
2036
  clientId: n,
2037
- code_challenge: vt
2037
+ code_challenge: Ct
2038
2038
  });
2039
- if (ve.status) {
2040
- const Y = await Ye({
2039
+ if (Pe.status) {
2040
+ const V = await Ve({
2041
2041
  username: d,
2042
- password: R,
2042
+ password: w,
2043
2043
  clientId: n,
2044
2044
  sessionExpiration: t,
2045
2045
  nonce: I,
2046
2046
  type: p,
2047
- code: ve.code,
2048
- code_verifier: _t,
2047
+ code: Pe.data,
2048
+ code_verifier: vt,
2049
2049
  domain: r,
2050
2050
  fingerprint: y.current
2051
2051
  });
2052
- return Y.status ? (h(Y.idToken), u(Y.accessToken), q(Y.refreshToken), o({
2053
- type: j,
2052
+ return V.status ? (h(V.idToken), u(V.accessToken), z(V.refreshToken), o({
2053
+ type: F,
2054
2054
  payload: {
2055
2055
  authenticationType: p,
2056
2056
  user: {
2057
- userId: Y.userId,
2057
+ userId: V.userId,
2058
2058
  username: d
2059
2059
  }
2060
2060
  }
2061
- }), !0) : ($(re), !1);
2061
+ }), !0) : (K(ae), !1);
2062
2062
  }
2063
2063
  return !1;
2064
2064
  }
2065
- const J = await Ye({
2065
+ const Y = await Ve({
2066
2066
  username: d,
2067
- password: R,
2067
+ password: w,
2068
2068
  clientId: n,
2069
2069
  sessionExpiration: t,
2070
2070
  nonce: I,
@@ -2072,78 +2072,78 @@ const Rr = (e) => D(
2072
2072
  domain: r,
2073
2073
  fingerprint: y.current
2074
2074
  });
2075
- return J.status ? (h(J.idToken), u(J.accessToken), q(J.refreshToken), o({
2076
- type: j,
2075
+ return Y.status ? (h(Y.idToken), u(Y.accessToken), z(Y.refreshToken), o({
2076
+ type: F,
2077
2077
  payload: {
2078
2078
  authenticationType: p,
2079
2079
  user: {
2080
- userId: J.userId,
2080
+ userId: Y.userId,
2081
2081
  username: d
2082
2082
  }
2083
2083
  }
2084
- }), !0) : ($(re), !1);
2085
- }, At = async (d) => {
2086
- d?.preventDefault(), await N(Gn);
2087
- }, Tt = async () => {
2088
- const { isAuthenticated: d, user: R } = s;
2084
+ }), !0) : (K(ae), !1);
2085
+ }, Tt = async (d) => {
2086
+ d?.preventDefault(), await D(Jn);
2087
+ }, Rt = async () => {
2088
+ const { isAuthenticated: d, user: w } = s;
2089
2089
  try {
2090
- if (d && R && R.userId) {
2090
+ if (d && w && w.userId) {
2091
2091
  if (f) {
2092
2092
  i("getAccessToken");
2093
- const I = await G(f);
2094
- if (I && I.payload[A.USER_ID_KEY] !== "")
2093
+ const I = await J(f);
2094
+ if (I && I.payload[T.USER_ID_KEY] !== "")
2095
2095
  return f;
2096
2096
  }
2097
2097
  i("getAccessToken: invalid access token, trying to refresh it");
2098
- const p = await Et.refreshtoken({
2098
+ const p = await St.refreshtoken({
2099
2099
  clientId: n,
2100
- userId: R.userId,
2101
- nonce: wt,
2100
+ userId: w.userId,
2101
+ nonce: Et,
2102
2102
  domain: r
2103
2103
  });
2104
- return p.status && p.status === "success" && p.newAccessToken ? (u(p.newAccessToken), q(p.newRefreshToken), p.newAccessToken) : (i(
2104
+ return p.status && p.status === "success" && p.newAccessToken ? (u(p.newAccessToken), z(p.newRefreshToken), p.newAccessToken) : (i(
2105
2105
  "getAccessToken: invalid refresh token, need to re-authenticate"
2106
- ), await N(K), "");
2106
+ ), await D(H), "");
2107
2107
  }
2108
2108
  return i(
2109
2109
  "getAccessToken: user is not authenticated, cannot get access token"
2110
- ), await N(K), "";
2110
+ ), await D(H), "";
2111
2111
  } catch {
2112
2112
  return i(
2113
2113
  "getAccessToken: exception occurred, invalidating and logging out"
2114
- ), await N(Jn), "";
2114
+ ), await D(Yn), "";
2115
2115
  }
2116
- }, Rt = () => s.isAuthenticated && l ? l : "", bt = async () => {
2116
+ }, bt = () => s.isAuthenticated && l ? l : "", It = async () => {
2117
2117
  const { user: d } = s;
2118
- let R = await W({
2118
+ let w = await x({
2119
2119
  accessToken: f,
2120
2120
  clientId: n,
2121
- type: L.GET_REGISTRATION_OPTIONS,
2121
+ type: W.GET_REGISTRATION_OPTIONS,
2122
2122
  params: {
2123
2123
  clientId: n,
2124
2124
  id: d?.userId,
2125
2125
  username: d?.username
2126
2126
  }
2127
2127
  });
2128
- if (R.status)
2128
+ if (w.status)
2129
2129
  try {
2130
- const p = await Lt(R.data);
2131
- R = await W({
2130
+ const p = await Wt(w.data);
2131
+ return w = await x({
2132
2132
  accessToken: f,
2133
2133
  clientId: n,
2134
- type: L.VERIFY_REGISTRATION,
2134
+ type: W.VERIFY_REGISTRATION,
2135
2135
  params: {
2136
2136
  clientId: n,
2137
2137
  id: d?.userId,
2138
2138
  username: d?.username,
2139
2139
  registration: p
2140
2140
  }
2141
- });
2141
+ }), !!(w.status && w.data.length > 0);
2142
2142
  } catch {
2143
- return await W({
2143
+ return await x({
2144
2144
  accessToken: f,
2145
2145
  clientId: n,
2146
- type: L.VERIFY_REGISTRATION,
2146
+ type: W.VERIFY_REGISTRATION,
2147
2147
  params: {
2148
2148
  clientId: n,
2149
2149
  id: d?.userId,
@@ -2153,78 +2153,78 @@ const Rr = (e) => D(
2153
2153
  }), !1;
2154
2154
  }
2155
2155
  return !1;
2156
- }, It = async () => {
2157
- const d = Se();
2158
- Ie(d), o({ type: V, payload: { isLoading: !0 } }), z(), i("loginWithPasskey");
2159
- const R = Se();
2160
- let p = await W({
2156
+ }, _t = async () => {
2157
+ const d = Te();
2158
+ ve(d), o({ type: j, payload: { isLoading: !0 } }), Q(), i("loginWithPasskey");
2159
+ const w = Te();
2160
+ let p = await x({
2161
2161
  accessToken: f,
2162
2162
  clientId: n,
2163
- type: L.GET_AUTHENTICATION_OPTIONS,
2163
+ type: W.GET_AUTHENTICATION_OPTIONS,
2164
2164
  params: {
2165
- id: R,
2165
+ id: w,
2166
2166
  clientId: n
2167
2167
  }
2168
2168
  });
2169
2169
  if (p.status)
2170
2170
  try {
2171
- const I = await Mt(p.data);
2172
- return p = await W({
2171
+ const I = await Gt(p.data);
2172
+ return p = await x({
2173
2173
  accessToken: f,
2174
2174
  clientId: n,
2175
- type: L.VERIFY_AUTHENTICATION,
2175
+ type: W.VERIFY_AUTHENTICATION,
2176
2176
  params: {
2177
2177
  clientId: n,
2178
- id: R,
2178
+ id: w,
2179
2179
  authentication: I,
2180
2180
  nonce: d,
2181
2181
  domain: r,
2182
2182
  fingerprint: y.current
2183
2183
  }
2184
- }), p.data.status === "success" ? (h(p.data.idToken), u(p.data.accessToken), q(p.data.refreshToken), o({
2185
- type: j,
2184
+ }), p.data.status === "success" ? (h(p.data.idToken), u(p.data.accessToken), z(p.data.refreshToken), o({
2185
+ type: F,
2186
2186
  payload: {
2187
- authenticationType: M.PASSKEY,
2187
+ authenticationType: G.PASSKEY,
2188
2188
  user: {
2189
2189
  userId: p.data.userId,
2190
2190
  username: p.data.username
2191
2191
  }
2192
2192
  }
2193
- }), !0) : ($(re), !1);
2193
+ }), !0) : (K(ae), !1);
2194
2194
  } catch {
2195
- return await W({
2195
+ return await x({
2196
2196
  accessToken: f,
2197
2197
  clientId: n,
2198
- type: L.VERIFY_AUTHENTICATION,
2198
+ type: W.VERIFY_AUTHENTICATION,
2199
2199
  params: {
2200
2200
  clientId: n,
2201
- id: R,
2201
+ id: w,
2202
2202
  authentication: {},
2203
2203
  nonce: d,
2204
2204
  domain: r
2205
2205
  }
2206
- }), $(re), !1;
2206
+ }), K(ae), !1;
2207
2207
  }
2208
2208
  return !1;
2209
2209
  };
2210
- return /* @__PURE__ */ Ce(br.Provider, { value: { state: s, dispatch: o }, children: /* @__PURE__ */ Ce(
2211
- mt.Provider,
2210
+ return /* @__PURE__ */ ke(br.Provider, { value: { state: s, dispatch: o }, children: /* @__PURE__ */ ke(
2211
+ wt.Provider,
2212
2212
  {
2213
2213
  value: {
2214
2214
  ...s,
2215
- login: St,
2216
- logout: At,
2217
- getAccessToken: Tt,
2218
- getIdToken: Rt,
2219
- registeringForPasskey: bt,
2220
- loginWithPasskey: It
2215
+ login: At,
2216
+ logout: Tt,
2217
+ getAccessToken: Rt,
2218
+ getIdToken: bt,
2219
+ registeringForPasskey: It,
2220
+ loginWithPasskey: _t
2221
2221
  },
2222
2222
  children: e
2223
2223
  }
2224
2224
  ) });
2225
- }, Kr = (e = mt) => Ut(e);
2225
+ }, Kr = (e = wt) => $t(e);
2226
2226
  export {
2227
- M as AUTH_TYPES,
2227
+ G as AUTH_TYPES,
2228
2228
  $r as AuthProvider,
2229
2229
  Ur as isGranted,
2230
2230
  Kr as useAuth