@versini/auth-provider 6.3.1 → 6.3.3

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 +374 -369
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- var _t = Object.defineProperty;
2
- var vt = (e, t, n) => t in e ? _t(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var z = (e, t, n) => vt(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { jsx as ke } from "react/jsx-runtime";
5
- import kt, { useSyncExternalStore as Ct, useCallback as W, useEffect as Te, createContext as Pt, useReducer as Ot, useRef as Ce, useContext as Nt } from "react";
1
+ var It = Object.defineProperty;
2
+ var _t = (e, t, n) => t in e ? It(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var Q = (e, t, n) => _t(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { jsx as ve } from "react/jsx-runtime";
5
+ import vt, { useSyncExternalStore as kt, useCallback as x, useEffect as Ae, createContext as Ct, useReducer as Pt, useRef as ke, useContext as Ot } from "react";
6
6
  /*!
7
- @versini/auth-provider v6.3.1
7
+ @versini/auth-provider v6.3.3
8
8
  © 2024 gizmette.com
9
9
  */
10
10
  try {
11
11
  window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
12
- version: "6.3.1",
13
- buildTime: "07/22/2024 07:45 AM EDT",
12
+ version: "6.3.3",
13
+ buildTime: "07/24/2024 07:46 AM EDT",
14
14
  homepage: "https://github.com/aversini/auth-client",
15
15
  license: "MIT"
16
16
  });
@@ -29,10 +29,10 @@ function ie(e) {
29
29
  o[i] = a.charCodeAt(i);
30
30
  return s;
31
31
  }
32
- function Re() {
32
+ function Te() {
33
33
  return (window == null ? void 0 : window.PublicKeyCredential) !== void 0 && typeof window.PublicKeyCredential == "function";
34
34
  }
35
- function Ye(e) {
35
+ function Je(e) {
36
36
  const { id: t } = e;
37
37
  return {
38
38
  ...e,
@@ -40,7 +40,7 @@ function Ye(e) {
40
40
  transports: e.transports
41
41
  };
42
42
  }
43
- function Ve(e) {
43
+ function Ye(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 Dt({ error: e, options: t }) {
51
+ function Nt({ error: e, options: t }) {
52
52
  var r, a;
53
53
  const { publicKey: n } = t;
54
54
  if (!n)
@@ -98,7 +98,7 @@ function Dt({ error: e, options: t }) {
98
98
  });
99
99
  if (e.name === "SecurityError") {
100
100
  const s = window.location.hostname;
101
- if (Ve(s)) {
101
+ if (Ye(s)) {
102
102
  if (n.rp.id !== s)
103
103
  return new b({
104
104
  message: `The RP ID "${n.rp.id}" is invalid for this domain`,
@@ -126,7 +126,7 @@ function Dt({ error: e, options: t }) {
126
126
  }
127
127
  return e;
128
128
  }
129
- class Ut {
129
+ class Dt {
130
130
  createNewAbortSignal() {
131
131
  if (this.controller) {
132
132
  const n = new Error("Cancelling existing WebAuthn API call for new one");
@@ -142,14 +142,14 @@ class Ut {
142
142
  }
143
143
  }
144
144
  }
145
- const je = new Ut(), $t = ["cross-platform", "platform"];
146
- function Fe(e) {
147
- if (e && !($t.indexOf(e) < 0))
145
+ const Ve = new Dt(), Ut = ["cross-platform", "platform"];
146
+ function je(e) {
147
+ if (e && !(Ut.indexOf(e) < 0))
148
148
  return e;
149
149
  }
150
- async function Kt(e) {
150
+ async function $t(e) {
151
151
  var m;
152
- if (!Re())
152
+ if (!Te())
153
153
  throw new Error("WebAuthn is not supported in this browser");
154
154
  const n = { publicKey: {
155
155
  ...e,
@@ -158,14 +158,14 @@ async function Kt(e) {
158
158
  ...e.user,
159
159
  id: ie(e.user.id)
160
160
  },
161
- excludeCredentials: (m = e.excludeCredentials) == null ? void 0 : m.map(Ye)
161
+ excludeCredentials: (m = e.excludeCredentials) == null ? void 0 : m.map(Je)
162
162
  } };
163
- n.signal = je.createNewAbortSignal();
163
+ n.signal = Ve.createNewAbortSignal();
164
164
  let r;
165
165
  try {
166
166
  r = await navigator.credentials.create(n);
167
167
  } catch (u) {
168
- throw Dt({ error: u, options: n });
168
+ throw Nt({ error: u, options: n });
169
169
  }
170
170
  if (!r)
171
171
  throw new Error("Registration was not completed");
@@ -207,20 +207,20 @@ async function Kt(e) {
207
207
  },
208
208
  type: i,
209
209
  clientExtensionResults: r.getClientExtensionResults(),
210
- authenticatorAttachment: Fe(r.authenticatorAttachment)
210
+ authenticatorAttachment: je(r.authenticatorAttachment)
211
211
  };
212
212
  }
213
213
  function fe(e, t) {
214
214
  console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
215
215
  `, t);
216
216
  }
217
- function Ht() {
218
- if (!Re())
217
+ function Kt() {
218
+ if (!Te())
219
219
  return new Promise((t) => t(!1));
220
220
  const e = window.PublicKeyCredential;
221
221
  return e.isConditionalMediationAvailable === void 0 ? new Promise((t) => t(!1)) : e.isConditionalMediationAvailable();
222
222
  }
223
- function Lt({ error: e, options: t }) {
223
+ function Ht({ error: e, options: t }) {
224
224
  const { publicKey: n } = t;
225
225
  if (!n)
226
226
  throw Error("options was missing required publicKey property");
@@ -240,7 +240,7 @@ function Lt({ error: e, options: t }) {
240
240
  });
241
241
  if (e.name === "SecurityError") {
242
242
  const r = window.location.hostname;
243
- if (Ve(r)) {
243
+ if (Ye(r)) {
244
244
  if (n.rpId !== r)
245
245
  return new b({
246
246
  message: `The RP ID "${n.rpId}" is invalid for this domain`,
@@ -261,30 +261,30 @@ function Lt({ error: e, options: t }) {
261
261
  }
262
262
  return e;
263
263
  }
264
- async function Wt(e, t = !1) {
264
+ async function Lt(e, t = !1) {
265
265
  var p, m;
266
- if (!Re())
266
+ if (!Te())
267
267
  throw new Error("WebAuthn is not supported in this browser");
268
268
  let n;
269
- ((p = e.allowCredentials) == null ? void 0 : p.length) !== 0 && (n = (m = e.allowCredentials) == null ? void 0 : m.map(Ye));
269
+ ((p = e.allowCredentials) == null ? void 0 : p.length) !== 0 && (n = (m = e.allowCredentials) == null ? void 0 : m.map(Je));
270
270
  const r = {
271
271
  ...e,
272
272
  challenge: ie(e.challenge),
273
273
  allowCredentials: n
274
274
  }, a = {};
275
275
  if (t) {
276
- if (!await Ht())
276
+ if (!await Kt())
277
277
  throw Error("Browser does not support WebAuthn autofill");
278
278
  if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1)
279
279
  throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');
280
280
  a.mediation = "conditional", r.allowCredentials = [];
281
281
  }
282
- a.publicKey = r, a.signal = je.createNewAbortSignal();
282
+ a.publicKey = r, a.signal = Ve.createNewAbortSignal();
283
283
  let s;
284
284
  try {
285
285
  s = await navigator.credentials.get(a);
286
286
  } catch (u) {
287
- throw Lt({ error: u, options: a });
287
+ throw Ht({ error: u, options: a });
288
288
  }
289
289
  if (!s)
290
290
  throw new Error("Authentication was not completed");
@@ -301,7 +301,7 @@ async function Wt(e, t = !1) {
301
301
  },
302
302
  type: y,
303
303
  clientExtensionResults: s.getClientExtensionResults(),
304
- authenticatorAttachment: Fe(s.authenticatorAttachment)
304
+ authenticatorAttachment: je(s.authenticatorAttachment)
305
305
  };
306
306
  }
307
307
  /*!
@@ -311,20 +311,20 @@ async function Wt(e, t = !1) {
311
311
  try {
312
312
  window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
313
313
  version: "3.3.0",
314
- buildTime: "07/22/2024 07:45 AM EDT",
314
+ buildTime: "07/24/2024 07:46 AM EDT",
315
315
  homepage: "https://github.com/aversini/auth-client",
316
316
  license: "MIT"
317
317
  });
318
318
  } catch {
319
319
  }
320
- const j = {
320
+ const F = {
321
321
  ID_TOKEN: "id_token",
322
322
  ACCESS_TOKEN: "token",
323
323
  ID_AND_ACCESS_TOKEN: "id_token token",
324
324
  CODE: "code",
325
325
  REFRESH_TOKEN: "refresh_token",
326
326
  PASSKEY: "passkey"
327
- }, Be = {
327
+ }, Fe = {
328
328
  CLIENT_ID: "X-Auth-ClientId"
329
329
  }, T = {
330
330
  ALG: "RS256",
@@ -337,7 +337,7 @@ const j = {
337
337
  CREATED_AT_KEY: "iat",
338
338
  SCOPES_KEY: "scopes",
339
339
  ISSUER: "gizmette.com"
340
- }, xt = `-----BEGIN PUBLIC KEY-----
340
+ }, Wt = `-----BEGIN PUBLIC KEY-----
341
341
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
342
342
  w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
343
343
  i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
@@ -349,24 +349,24 @@ awIDAQAB
349
349
  AUTHENTICATE: "authenticate",
350
350
  CODE: "code",
351
351
  LOGOUT: "logout"
352
- }, he = crypto, qe = (e) => e instanceof CryptoKey, Q = new TextEncoder(), F = new TextDecoder();
353
- function Mt(...e) {
352
+ }, he = crypto, Be = (e) => e instanceof CryptoKey, X = new TextEncoder(), B = new TextDecoder();
353
+ function xt(...e) {
354
354
  const t = e.reduce((a, { length: s }) => a + s, 0), n = new Uint8Array(t);
355
355
  let r = 0;
356
356
  for (const a of e)
357
357
  n.set(a, r), r += a.length;
358
358
  return n;
359
359
  }
360
- const Gt = (e) => {
360
+ const Mt = (e) => {
361
361
  const t = atob(e), n = new Uint8Array(t.length);
362
362
  for (let r = 0; r < t.length; r++)
363
363
  n[r] = t.charCodeAt(r);
364
364
  return n;
365
- }, V = (e) => {
365
+ }, j = (e) => {
366
366
  let t = e;
367
- t instanceof Uint8Array && (t = F.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
367
+ t instanceof Uint8Array && (t = B.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
368
368
  try {
369
- return Gt(t);
369
+ return Mt(t);
370
370
  } catch {
371
371
  throw new TypeError("The input to be decoded is not correctly encoded.");
372
372
  }
@@ -386,7 +386,7 @@ let D = class extends Error {
386
386
  constructor(t, n, r = "unspecified", a = "unspecified") {
387
387
  super(t), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = r, this.reason = a, this.payload = n;
388
388
  }
389
- }, Pe = class extends D {
389
+ }, Ce = class extends D {
390
390
  static get code() {
391
391
  return "ERR_JWT_EXPIRED";
392
392
  }
@@ -394,7 +394,7 @@ let D = class extends Error {
394
394
  super(t), this.code = "ERR_JWT_EXPIRED", this.claim = r, this.reason = a, this.payload = n;
395
395
  }
396
396
  };
397
- class Jt extends D {
397
+ class Gt extends D {
398
398
  constructor() {
399
399
  super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
400
400
  }
@@ -426,7 +426,7 @@ let C = class extends D {
426
426
  return "ERR_JWT_INVALID";
427
427
  }
428
428
  };
429
- class Yt extends D {
429
+ class Jt extends D {
430
430
  constructor() {
431
431
  super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
432
432
  }
@@ -437,13 +437,13 @@ class Yt extends D {
437
437
  function k(e, t = "algorithm.name") {
438
438
  return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
439
439
  }
440
- function X(e, t) {
440
+ function Z(e, t) {
441
441
  return e.name === t;
442
442
  }
443
443
  function ye(e) {
444
444
  return parseInt(e.name.slice(4), 10);
445
445
  }
446
- function Vt(e) {
446
+ function Yt(e) {
447
447
  switch (e) {
448
448
  case "ES256":
449
449
  return "P-256";
@@ -455,7 +455,7 @@ function Vt(e) {
455
455
  throw new Error("unreachable");
456
456
  }
457
457
  }
458
- function jt(e, t) {
458
+ function Vt(e, t) {
459
459
  if (t.length && !t.some((n) => e.usages.includes(n))) {
460
460
  let n = "CryptoKey does not support this operation, its usages must include ";
461
461
  if (t.length > 2) {
@@ -465,12 +465,12 @@ function jt(e, t) {
465
465
  throw new TypeError(n);
466
466
  }
467
467
  }
468
- function Ft(e, t, ...n) {
468
+ function jt(e, t, ...n) {
469
469
  switch (t) {
470
470
  case "HS256":
471
471
  case "HS384":
472
472
  case "HS512": {
473
- if (!X(e.algorithm, "HMAC"))
473
+ if (!Z(e.algorithm, "HMAC"))
474
474
  throw k("HMAC");
475
475
  const r = parseInt(t.slice(2), 10);
476
476
  if (ye(e.algorithm.hash) !== r)
@@ -480,7 +480,7 @@ function Ft(e, t, ...n) {
480
480
  case "RS256":
481
481
  case "RS384":
482
482
  case "RS512": {
483
- if (!X(e.algorithm, "RSASSA-PKCS1-v1_5"))
483
+ if (!Z(e.algorithm, "RSASSA-PKCS1-v1_5"))
484
484
  throw k("RSASSA-PKCS1-v1_5");
485
485
  const r = parseInt(t.slice(2), 10);
486
486
  if (ye(e.algorithm.hash) !== r)
@@ -490,7 +490,7 @@ function Ft(e, t, ...n) {
490
490
  case "PS256":
491
491
  case "PS384":
492
492
  case "PS512": {
493
- if (!X(e.algorithm, "RSA-PSS"))
493
+ if (!Z(e.algorithm, "RSA-PSS"))
494
494
  throw k("RSA-PSS");
495
495
  const r = parseInt(t.slice(2), 10);
496
496
  if (ye(e.algorithm.hash) !== r)
@@ -505,9 +505,9 @@ function Ft(e, t, ...n) {
505
505
  case "ES256":
506
506
  case "ES384":
507
507
  case "ES512": {
508
- if (!X(e.algorithm, "ECDSA"))
508
+ if (!Z(e.algorithm, "ECDSA"))
509
509
  throw k("ECDSA");
510
- const r = Vt(t);
510
+ const r = Yt(t);
511
511
  if (e.algorithm.namedCurve !== r)
512
512
  throw k(r, "algorithm.namedCurve");
513
513
  break;
@@ -515,9 +515,9 @@ function Ft(e, t, ...n) {
515
515
  default:
516
516
  throw new TypeError("CryptoKey does not support this operation");
517
517
  }
518
- jt(e, n);
518
+ Vt(e, n);
519
519
  }
520
- function ze(e, t, ...n) {
520
+ function qe(e, t, ...n) {
521
521
  var r;
522
522
  if (n.length > 2) {
523
523
  const a = n.pop();
@@ -525,11 +525,11 @@ function ze(e, t, ...n) {
525
525
  } else n.length === 2 ? e += `one of type ${n[0]} or ${n[1]}.` : e += `of type ${n[0]}.`;
526
526
  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;
527
527
  }
528
- const Oe = (e, ...t) => ze("Key must be ", e, ...t);
529
- function Qe(e, t, ...n) {
530
- return ze(`Key for the ${e} algorithm must be `, t, ...n);
528
+ const Pe = (e, ...t) => qe("Key must be ", e, ...t);
529
+ function ze(e, t, ...n) {
530
+ return qe(`Key for the ${e} algorithm must be `, t, ...n);
531
531
  }
532
- const Xe = (e) => qe(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", ce = ["CryptoKey"], Bt = (...e) => {
532
+ const Qe = (e) => Be(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", ce = ["CryptoKey"], Ft = (...e) => {
533
533
  const t = e.filter(Boolean);
534
534
  if (t.length === 0 || t.length === 1)
535
535
  return !0;
@@ -548,11 +548,11 @@ const Xe = (e) => qe(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) ===
548
548
  }
549
549
  return !0;
550
550
  };
551
- function qt(e) {
551
+ function Bt(e) {
552
552
  return typeof e == "object" && e !== null;
553
553
  }
554
554
  function ue(e) {
555
- if (!qt(e) || Object.prototype.toString.call(e) !== "[object Object]")
555
+ if (!Bt(e) || Object.prototype.toString.call(e) !== "[object Object]")
556
556
  return !1;
557
557
  if (Object.getPrototypeOf(e) === null)
558
558
  return !0;
@@ -561,14 +561,14 @@ function ue(e) {
561
561
  t = Object.getPrototypeOf(t);
562
562
  return Object.getPrototypeOf(e) === t;
563
563
  }
564
- const zt = (e, t) => {
564
+ const qt = (e, t) => {
565
565
  if (e.startsWith("RS") || e.startsWith("PS")) {
566
566
  const { modulusLength: n } = t.algorithm;
567
567
  if (typeof n != "number" || n < 2048)
568
568
  throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
569
569
  }
570
570
  };
571
- function Qt(e) {
571
+ function zt(e) {
572
572
  let t, n;
573
573
  switch (e.kty) {
574
574
  case "RSA": {
@@ -640,43 +640,43 @@ function Qt(e) {
640
640
  }
641
641
  return { algorithm: t, keyUsages: n };
642
642
  }
643
- const Xt = async (e) => {
643
+ const Qt = async (e) => {
644
644
  if (!e.alg)
645
645
  throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
646
- const { algorithm: t, keyUsages: n } = Qt(e), r = [
646
+ const { algorithm: t, keyUsages: n } = zt(e), r = [
647
647
  t,
648
648
  e.ext ?? !1,
649
649
  e.key_ops ?? n
650
650
  ], a = { ...e };
651
651
  return delete a.alg, delete a.use, he.subtle.importKey("jwk", a, ...r);
652
- }, Ze = (e) => V(e);
652
+ }, Xe = (e) => j(e);
653
653
  let ge, me;
654
- const et = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", tt = async (e, t, n, r) => {
654
+ const Ze = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", et = async (e, t, n, r) => {
655
655
  let a = e.get(t);
656
656
  if (a != null && a[r])
657
657
  return a[r];
658
- const s = await Xt({ ...n, alg: r });
658
+ const s = await Qt({ ...n, alg: r });
659
659
  return a ? a[r] = s : e.set(t, { [r]: s }), s;
660
- }, Zt = (e, t) => {
661
- if (et(e)) {
660
+ }, Xt = (e, t) => {
661
+ if (Ze(e)) {
662
662
  let n = e.export({ format: "jwk" });
663
- return delete n.d, delete n.dp, delete n.dq, delete n.p, delete n.q, delete n.qi, n.k ? Ze(n.k) : (me || (me = /* @__PURE__ */ new WeakMap()), tt(me, e, n, t));
663
+ return delete n.d, delete n.dp, delete n.dq, delete n.p, delete n.q, delete n.qi, n.k ? Xe(n.k) : (me || (me = /* @__PURE__ */ new WeakMap()), et(me, e, n, t));
664
664
  }
665
665
  return e;
666
- }, en = (e, t) => {
667
- if (et(e)) {
666
+ }, Zt = (e, t) => {
667
+ if (Ze(e)) {
668
668
  let n = e.export({ format: "jwk" });
669
- return n.k ? Ze(n.k) : (ge || (ge = /* @__PURE__ */ new WeakMap()), tt(ge, e, n, t));
669
+ return n.k ? Xe(n.k) : (ge || (ge = /* @__PURE__ */ new WeakMap()), et(ge, e, n, t));
670
670
  }
671
671
  return e;
672
- }, tn = { normalizePublicKey: Zt, normalizePrivateKey: en }, P = (e, t, n = 0) => {
672
+ }, en = { normalizePublicKey: Xt, normalizePrivateKey: Zt }, P = (e, t, n = 0) => {
673
673
  n === 0 && (t.unshift(t.length), t.unshift(6));
674
674
  const r = e.indexOf(t[0], n);
675
675
  if (r === -1)
676
676
  return !1;
677
677
  const a = e.subarray(r, r + t.length);
678
678
  return a.length !== t.length ? !1 : a.every((s, o) => s === t[o]) || P(e, t, r + 1);
679
- }, Ne = (e) => {
679
+ }, Oe = (e) => {
680
680
  switch (!0) {
681
681
  case P(e, [42, 134, 72, 206, 61, 3, 1, 7]):
682
682
  return "P-256";
@@ -695,7 +695,7 @@ const et = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject",
695
695
  default:
696
696
  throw new O("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
697
697
  }
698
- }, nn = async (e, t, n, r, a) => {
698
+ }, tn = async (e, t, n, r, a) => {
699
699
  let s, o;
700
700
  const i = new Uint8Array(atob(n.replace(e, "")).split("").map((l) => l.charCodeAt(0)));
701
701
  switch (r) {
@@ -731,43 +731,43 @@ const et = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject",
731
731
  case "ECDH-ES+A128KW":
732
732
  case "ECDH-ES+A192KW":
733
733
  case "ECDH-ES+A256KW": {
734
- const l = Ne(i);
734
+ const l = Oe(i);
735
735
  s = l.startsWith("P-") ? { name: "ECDH", namedCurve: l } : { name: l }, o = [];
736
736
  break;
737
737
  }
738
738
  case "EdDSA":
739
- s = { name: Ne(i) }, o = ["verify"];
739
+ s = { name: Oe(i) }, o = ["verify"];
740
740
  break;
741
741
  default:
742
742
  throw new O('Invalid or unsupported "alg" (Algorithm) value');
743
743
  }
744
744
  return he.subtle.importKey(t, i, s, !1, o);
745
- }, rn = (e, t, n) => nn(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
746
- async function an(e, t, n) {
745
+ }, nn = (e, t, n) => tn(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
746
+ async function rn(e, t, n) {
747
747
  if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
748
748
  throw new TypeError('"spki" must be SPKI formatted string');
749
- return rn(e, t);
749
+ return nn(e, t);
750
750
  }
751
- const se = (e) => e == null ? void 0 : e[Symbol.toStringTag], on = (e, t) => {
751
+ const se = (e) => e == null ? void 0 : e[Symbol.toStringTag], an = (e, t) => {
752
752
  if (!(t instanceof Uint8Array)) {
753
- if (!Xe(t))
754
- throw new TypeError(Qe(e, t, ...ce, "Uint8Array"));
753
+ if (!Qe(t))
754
+ throw new TypeError(ze(e, t, ...ce, "Uint8Array"));
755
755
  if (t.type !== "secret")
756
756
  throw new TypeError(`${se(t)} instances for symmetric algorithms must be of type "secret"`);
757
757
  }
758
- }, sn = (e, t, n) => {
759
- if (!Xe(t))
760
- throw new TypeError(Qe(e, t, ...ce));
758
+ }, on = (e, t, n) => {
759
+ if (!Qe(t))
760
+ throw new TypeError(ze(e, t, ...ce));
761
761
  if (t.type === "secret")
762
762
  throw new TypeError(`${se(t)} instances for asymmetric algorithms must not be of type "secret"`);
763
763
  if (t.algorithm && n === "verify" && t.type === "private")
764
764
  throw new TypeError(`${se(t)} instances for asymmetric algorithm verifying must be of type "public"`);
765
765
  if (t.algorithm && n === "encrypt" && t.type === "private")
766
766
  throw new TypeError(`${se(t)} instances for asymmetric algorithm encryption must be of type "public"`);
767
- }, cn = (e, t, n) => {
768
- e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? on(e, t) : sn(e, t, n);
767
+ }, sn = (e, t, n) => {
768
+ e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? an(e, t) : on(e, t, n);
769
769
  };
770
- function un(e, t, n, r, a) {
770
+ function cn(e, t, n, r, a) {
771
771
  if (a.crit !== void 0 && (r == null ? void 0 : r.crit) === void 0)
772
772
  throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
773
773
  if (!r || r.crit === void 0)
@@ -786,13 +786,13 @@ function un(e, t, n, r, a) {
786
786
  }
787
787
  return new Set(r.crit);
788
788
  }
789
- const ln = (e, t) => {
789
+ const un = (e, t) => {
790
790
  if (t !== void 0 && (!Array.isArray(t) || t.some((n) => typeof n != "string")))
791
791
  throw new TypeError(`"${e}" option must be an array of strings`);
792
792
  if (t)
793
793
  return new Set(t);
794
794
  };
795
- function dn(e, t) {
795
+ function ln(e, t) {
796
796
  const n = `SHA-${e.slice(-3)}`;
797
797
  switch (e) {
798
798
  case "HS256":
@@ -817,27 +817,27 @@ function dn(e, t) {
817
817
  throw new O(`alg ${e} is not supported either by JOSE or your javascript runtime`);
818
818
  }
819
819
  }
820
- async function hn(e, t, n) {
821
- if (t = await tn.normalizePublicKey(t, e), qe(t))
822
- return Ft(t, e, n), t;
820
+ async function dn(e, t, n) {
821
+ if (t = await en.normalizePublicKey(t, e), Be(t))
822
+ return jt(t, e, n), t;
823
823
  if (t instanceof Uint8Array) {
824
824
  if (!e.startsWith("HS"))
825
- throw new TypeError(Oe(t, ...ce));
825
+ throw new TypeError(Pe(t, ...ce));
826
826
  return he.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [n]);
827
827
  }
828
- throw new TypeError(Oe(t, ...ce, "Uint8Array"));
828
+ throw new TypeError(Pe(t, ...ce, "Uint8Array"));
829
829
  }
830
- const pn = async (e, t, n, r) => {
831
- const a = await hn(e, t, "verify");
832
- zt(e, a);
833
- const s = dn(e, a.algorithm);
830
+ const hn = async (e, t, n, r) => {
831
+ const a = await dn(e, t, "verify");
832
+ qt(e, a);
833
+ const s = ln(e, a.algorithm);
834
834
  try {
835
835
  return await he.subtle.verify(s, a, n, r);
836
836
  } catch {
837
837
  return !1;
838
838
  }
839
839
  };
840
- async function fn(e, t, n) {
840
+ async function pn(e, t, n) {
841
841
  if (!ue(e))
842
842
  throw new A("Flattened JWS must be an object");
843
843
  if (e.protected === void 0 && e.header === void 0)
@@ -853,64 +853,64 @@ async function fn(e, t, n) {
853
853
  let r = {};
854
854
  if (e.protected)
855
855
  try {
856
- const d = V(e.protected);
857
- r = JSON.parse(F.decode(d));
856
+ const d = j(e.protected);
857
+ r = JSON.parse(B.decode(d));
858
858
  } catch {
859
859
  throw new A("JWS Protected Header is invalid");
860
860
  }
861
- if (!Bt(r, e.header))
861
+ if (!Ft(r, e.header))
862
862
  throw new A("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
863
863
  const a = {
864
864
  ...r,
865
865
  ...e.header
866
- }, s = un(A, /* @__PURE__ */ new Map([["b64", !0]]), n == null ? void 0 : n.crit, r, a);
866
+ }, s = cn(A, /* @__PURE__ */ new Map([["b64", !0]]), n == null ? void 0 : n.crit, r, a);
867
867
  let o = !0;
868
868
  if (s.has("b64") && (o = r.b64, typeof o != "boolean"))
869
869
  throw new A('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
870
870
  const { alg: i } = a;
871
871
  if (typeof i != "string" || !i)
872
872
  throw new A('JWS "alg" (Algorithm) Header Parameter missing or invalid');
873
- const l = n && ln("algorithms", n.algorithms);
873
+ const l = n && un("algorithms", n.algorithms);
874
874
  if (l && !l.has(i))
875
- throw new Jt('"alg" (Algorithm) Header Parameter value not allowed');
875
+ throw new Gt('"alg" (Algorithm) Header Parameter value not allowed');
876
876
  if (o) {
877
877
  if (typeof e.payload != "string")
878
878
  throw new A("JWS Payload must be a string");
879
879
  } else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
880
880
  throw new A("JWS Payload must be a string or an Uint8Array instance");
881
881
  let y = !1;
882
- typeof t == "function" && (t = await t(r, e), y = !0), cn(i, t, "verify");
883
- const h = Mt(Q.encode(e.protected ?? ""), Q.encode("."), typeof e.payload == "string" ? Q.encode(e.payload) : e.payload);
882
+ typeof t == "function" && (t = await t(r, e), y = !0), sn(i, t, "verify");
883
+ const h = xt(X.encode(e.protected ?? ""), X.encode("."), typeof e.payload == "string" ? X.encode(e.payload) : e.payload);
884
884
  let p;
885
885
  try {
886
- p = V(e.signature);
886
+ p = j(e.signature);
887
887
  } catch {
888
888
  throw new A("Failed to base64url decode the signature");
889
889
  }
890
- if (!await pn(i, t, p, h))
891
- throw new Yt();
890
+ if (!await hn(i, t, p, h))
891
+ throw new Jt();
892
892
  let m;
893
893
  if (o)
894
894
  try {
895
- m = V(e.payload);
895
+ m = j(e.payload);
896
896
  } catch {
897
897
  throw new A("Failed to base64url decode the payload");
898
898
  }
899
- else typeof e.payload == "string" ? m = Q.encode(e.payload) : m = e.payload;
899
+ else typeof e.payload == "string" ? m = X.encode(e.payload) : m = e.payload;
900
900
  const u = { payload: m };
901
901
  return e.protected !== void 0 && (u.protectedHeader = r), e.header !== void 0 && (u.unprotectedHeader = e.header), y ? { ...u, key: t } : u;
902
902
  }
903
- async function yn(e, t, n) {
904
- if (e instanceof Uint8Array && (e = F.decode(e)), typeof e != "string")
903
+ async function fn(e, t, n) {
904
+ if (e instanceof Uint8Array && (e = B.decode(e)), typeof e != "string")
905
905
  throw new A("Compact JWS must be a string or Uint8Array");
906
906
  const { 0: r, 1: a, 2: s, length: o } = e.split(".");
907
907
  if (o !== 3)
908
908
  throw new A("Invalid Compact JWS");
909
- const i = await fn({ payload: a, protected: r, signature: s }, t, n), l = { payload: i.payload, protectedHeader: i.protectedHeader };
909
+ const i = await pn({ payload: a, protected: r, signature: s }, t, n), l = { payload: i.payload, protectedHeader: i.protectedHeader };
910
910
  return typeof t == "function" ? { ...l, key: i.key } : l;
911
911
  }
912
- const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, be = rt * 24, mn = be * 7, wn = be * 365.25, En = /^(\+|\-)? ?(\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) => {
913
- const t = En.exec(e);
912
+ const yn = (e) => Math.floor(e.getTime() / 1e3), tt = 60, nt = tt * 60, Re = nt * 24, gn = Re * 7, mn = Re * 365.25, wn = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, Ne = (e) => {
913
+ const t = wn.exec(e);
914
914
  if (!t || t[4] && t[1])
915
915
  throw new TypeError("Invalid time period format");
916
916
  const n = parseFloat(t[2]), r = t[3].toLowerCase();
@@ -928,40 +928,40 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, be = rt
928
928
  case "min":
929
929
  case "mins":
930
930
  case "m":
931
- a = Math.round(n * nt);
931
+ a = Math.round(n * tt);
932
932
  break;
933
933
  case "hour":
934
934
  case "hours":
935
935
  case "hr":
936
936
  case "hrs":
937
937
  case "h":
938
- a = Math.round(n * rt);
938
+ a = Math.round(n * nt);
939
939
  break;
940
940
  case "day":
941
941
  case "days":
942
942
  case "d":
943
- a = Math.round(n * be);
943
+ a = Math.round(n * Re);
944
944
  break;
945
945
  case "week":
946
946
  case "weeks":
947
947
  case "w":
948
- a = Math.round(n * mn);
948
+ a = Math.round(n * gn);
949
949
  break;
950
950
  default:
951
- a = Math.round(n * wn);
951
+ a = Math.round(n * mn);
952
952
  break;
953
953
  }
954
954
  return t[1] === "-" || t[4] === "ago" ? -a : a;
955
- }, Ue = (e) => e.toLowerCase().replace(/^application\//, ""), Sn = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, An = (e, t, n = {}) => {
955
+ }, De = (e) => e.toLowerCase().replace(/^application\//, ""), En = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, Sn = (e, t, n = {}) => {
956
956
  let r;
957
957
  try {
958
- r = JSON.parse(F.decode(t));
958
+ r = JSON.parse(B.decode(t));
959
959
  } catch {
960
960
  }
961
961
  if (!ue(r))
962
962
  throw new C("JWT Claims Set must be a top-level JSON object");
963
963
  const { typ: a } = n;
964
- if (a && (typeof e.typ != "string" || Ue(e.typ) !== Ue(a)))
964
+ if (a && (typeof e.typ != "string" || De(e.typ) !== De(a)))
965
965
  throw new _('unexpected "typ" JWT header value', r, "typ", "check_failed");
966
966
  const { requiredClaims: s = [], issuer: o, subject: i, audience: l, maxTokenAge: y } = n, h = [...s];
967
967
  y !== void 0 && h.push("iat"), l !== void 0 && h.push("aud"), i !== void 0 && h.push("sub"), o !== void 0 && h.push("iss");
@@ -972,12 +972,12 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, be = rt
972
972
  throw new _('unexpected "iss" claim value', r, "iss", "check_failed");
973
973
  if (i && r.sub !== i)
974
974
  throw new _('unexpected "sub" claim value', r, "sub", "check_failed");
975
- if (l && !Sn(r.aud, typeof l == "string" ? [l] : l))
975
+ if (l && !En(r.aud, typeof l == "string" ? [l] : l))
976
976
  throw new _('unexpected "aud" claim value', r, "aud", "check_failed");
977
977
  let p;
978
978
  switch (typeof n.clockTolerance) {
979
979
  case "string":
980
- p = De(n.clockTolerance);
980
+ p = Ne(n.clockTolerance);
981
981
  break;
982
982
  case "number":
983
983
  p = n.clockTolerance;
@@ -988,7 +988,7 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, be = rt
988
988
  default:
989
989
  throw new TypeError("Invalid clockTolerance option type");
990
990
  }
991
- const { currentDate: m } = n, u = gn(m || /* @__PURE__ */ new Date());
991
+ const { currentDate: m } = n, u = yn(m || /* @__PURE__ */ new Date());
992
992
  if ((r.iat !== void 0 || y) && typeof r.iat != "number")
993
993
  throw new _('"iat" claim must be a number', r, "iat", "invalid");
994
994
  if (r.nbf !== void 0) {
@@ -1001,27 +1001,27 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, be = rt
1001
1001
  if (typeof r.exp != "number")
1002
1002
  throw new _('"exp" claim must be a number', r, "exp", "invalid");
1003
1003
  if (r.exp <= u - p)
1004
- throw new Pe('"exp" claim timestamp check failed', r, "exp", "check_failed");
1004
+ throw new Ce('"exp" claim timestamp check failed', r, "exp", "check_failed");
1005
1005
  }
1006
1006
  if (y) {
1007
- const d = u - r.iat, g = typeof y == "number" ? y : De(y);
1007
+ const d = u - r.iat, g = typeof y == "number" ? y : Ne(y);
1008
1008
  if (d - p > g)
1009
- throw new Pe('"iat" claim timestamp check failed (too far in the past)', r, "iat", "check_failed");
1009
+ throw new Ce('"iat" claim timestamp check failed (too far in the past)', r, "iat", "check_failed");
1010
1010
  if (d < 0 - p)
1011
1011
  throw new _('"iat" claim timestamp check failed (it should be in the past)', r, "iat", "check_failed");
1012
1012
  }
1013
1013
  return r;
1014
1014
  };
1015
- async function Tn(e, t, n) {
1015
+ async function An(e, t, n) {
1016
1016
  var r;
1017
- const a = await yn(e, t, n);
1017
+ const a = await fn(e, t, n);
1018
1018
  if ((r = a.protectedHeader.crit) != null && r.includes("b64") && a.protectedHeader.b64 === !1)
1019
1019
  throw new C("JWTs MUST NOT use unencoded payload");
1020
- const s = { payload: An(a.protectedHeader, a.payload, n), protectedHeader: a.protectedHeader };
1020
+ const s = { payload: Sn(a.protectedHeader, a.payload, n), protectedHeader: a.protectedHeader };
1021
1021
  return typeof t == "function" ? { ...s, key: a.key } : s;
1022
1022
  }
1023
- const Rn = V;
1024
- function bn(e) {
1023
+ const Tn = j;
1024
+ function Rn(e) {
1025
1025
  if (typeof e != "string")
1026
1026
  throw new C("JWTs must use Compact JWS serialization, JWT must be a string");
1027
1027
  const { 1: t, length: n } = e.split(".");
@@ -1033,13 +1033,13 @@ function bn(e) {
1033
1033
  throw new C("JWTs must contain a payload");
1034
1034
  let r;
1035
1035
  try {
1036
- r = Rn(t);
1036
+ r = Tn(t);
1037
1037
  } catch {
1038
1038
  throw new C("Failed to base64url decode the payload");
1039
1039
  }
1040
1040
  let a;
1041
1041
  try {
1042
- a = JSON.parse(F.decode(r));
1042
+ a = JSON.parse(B.decode(r));
1043
1043
  } catch {
1044
1044
  throw new C("Failed to parse the decoded payload as JSON");
1045
1045
  }
@@ -1047,18 +1047,18 @@ function bn(e) {
1047
1047
  throw new C("Invalid JWT Claims Set");
1048
1048
  return a;
1049
1049
  }
1050
- const x = async (e) => {
1050
+ const M = async (e) => {
1051
1051
  try {
1052
- const t = T.ALG, n = await an(xt, t);
1053
- return await Tn(e, n, {
1052
+ const t = T.ALG, n = await rn(Wt, t);
1053
+ return await An(e, n, {
1054
1054
  issuer: T.ISSUER
1055
1055
  });
1056
1056
  } catch {
1057
1057
  return;
1058
1058
  }
1059
- }, In = (e) => {
1059
+ }, bn = (e) => {
1060
1060
  try {
1061
- return bn(e);
1061
+ return Rn(e);
1062
1062
  } catch {
1063
1063
  return;
1064
1064
  }
@@ -1066,39 +1066,39 @@ const x = async (e) => {
1066
1066
  var E = [];
1067
1067
  for (var we = 0; we < 256; ++we)
1068
1068
  E.push((we + 256).toString(16).slice(1));
1069
- function _n(e, t = 0) {
1069
+ function In(e, t = 0) {
1070
1070
  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();
1071
1071
  }
1072
- var Z, vn = new Uint8Array(16);
1073
- function kn() {
1074
- if (!Z && (Z = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Z))
1072
+ var ee, _n = new Uint8Array(16);
1073
+ function vn() {
1074
+ if (!ee && (ee = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ee))
1075
1075
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1076
- return Z(vn);
1076
+ return ee(_n);
1077
1077
  }
1078
- var Cn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1079
- const $e = {
1080
- randomUUID: Cn
1078
+ var kn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1079
+ const Ue = {
1080
+ randomUUID: kn
1081
1081
  };
1082
- function Ke(e, t, n) {
1083
- if ($e.randomUUID && !t && !e)
1084
- return $e.randomUUID();
1082
+ function $e(e, t, n) {
1083
+ if (Ue.randomUUID && !t && !e)
1084
+ return Ue.randomUUID();
1085
1085
  e = e || {};
1086
- var r = e.random || (e.rng || kn)();
1087
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, _n(r);
1086
+ var r = e.random || (e.rng || vn)();
1087
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, In(r);
1088
1088
  }
1089
- const He = globalThis.crypto, Pn = (e) => `${Ke()}${Ke()}`.slice(0, e), On = (e) => btoa(
1089
+ const Ke = globalThis.crypto, Cn = (e) => `${$e()}${$e()}`.slice(0, e), Pn = (e) => btoa(
1090
1090
  [...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
1091
1091
  );
1092
- async function Nn(e) {
1093
- if (!He.subtle)
1092
+ async function On(e) {
1093
+ if (!Ke.subtle)
1094
1094
  throw new Error(
1095
1095
  "crypto.subtle is available only in secure contexts (HTTPS)."
1096
1096
  );
1097
- const t = new TextEncoder().encode(e), n = await He.subtle.digest("SHA-256", t);
1098
- return On(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1097
+ const t = new TextEncoder().encode(e), n = await Ke.subtle.digest("SHA-256", t);
1098
+ return Pn(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1099
1099
  }
1100
- async function Dn(e) {
1101
- const n = Pn(43), r = await Nn(n);
1100
+ async function Nn(e) {
1101
+ const n = Cn(43), r = await On(n);
1102
1102
  return {
1103
1103
  code_verifier: n,
1104
1104
  code_challenge: r
@@ -1106,7 +1106,7 @@ async function Dn(e) {
1106
1106
  }
1107
1107
  const Pr = async (e, t) => {
1108
1108
  var n;
1109
- const r = await x(e);
1109
+ const r = await M(e);
1110
1110
  if (!r || !Array.isArray((n = r.payload) == null ? void 0 : n[T.SCOPES_KEY]))
1111
1111
  return !1;
1112
1112
  const a = r.payload[T.SCOPES_KEY];
@@ -1114,39 +1114,39 @@ const Pr = async (e, t) => {
1114
1114
  (s) => t[s].every((o) => a.includes(o))
1115
1115
  );
1116
1116
  };
1117
- function at(e, t) {
1117
+ function rt(e, t) {
1118
1118
  window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
1119
1119
  }
1120
- const Le = (e, t) => {
1120
+ const He = (e, t) => {
1121
1121
  const n = JSON.stringify(
1122
1122
  typeof t == "function" ? t() : t
1123
1123
  );
1124
- window.localStorage.setItem(e, n), at(e, n);
1125
- }, Un = (e) => {
1126
- window.localStorage.removeItem(e), at(e, null);
1127
- }, We = (e) => window.localStorage.getItem(e), $n = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1128
- function ee({
1124
+ window.localStorage.setItem(e, n), rt(e, n);
1125
+ }, Dn = (e) => {
1126
+ window.localStorage.removeItem(e), rt(e, null);
1127
+ }, Le = (e) => window.localStorage.getItem(e), Un = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1128
+ function te({
1129
1129
  key: e,
1130
1130
  initialValue: t
1131
1131
  }) {
1132
- const n = Ct($n, () => We(e)), r = W(
1132
+ const n = kt(Un, () => Le(e)), r = x(
1133
1133
  (o) => {
1134
1134
  try {
1135
1135
  const i = typeof o == "function" ? o(JSON.parse(n)) : o;
1136
- i == null ? Un(e) : Le(e, i);
1136
+ i == null ? Dn(e) : He(e, i);
1137
1137
  } catch (i) {
1138
1138
  console.warn(i);
1139
1139
  }
1140
1140
  },
1141
1141
  [e, n]
1142
- ), a = W(() => {
1142
+ ), a = x(() => {
1143
1143
  r(t);
1144
- }, [t, r]), s = W(() => {
1144
+ }, [t, r]), s = x(() => {
1145
1145
  r(null);
1146
1146
  }, [r]);
1147
- return Te(() => {
1147
+ return Ae(() => {
1148
1148
  try {
1149
- We(e) === null && typeof t < "u" && Le(e, t);
1149
+ Le(e) === null && typeof t < "u" && He(e, t);
1150
1150
  } catch (o) {
1151
1151
  console.warn(o);
1152
1152
  }
@@ -1155,25 +1155,25 @@ function ee({
1155
1155
  var S = [];
1156
1156
  for (var Ee = 0; Ee < 256; ++Ee)
1157
1157
  S.push((Ee + 256).toString(16).slice(1));
1158
- function Kn(e, t = 0) {
1158
+ function $n(e, t = 0) {
1159
1159
  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();
1160
1160
  }
1161
- var te, Hn = new Uint8Array(16);
1162
- function Ln() {
1163
- if (!te && (te = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !te))
1161
+ var ne, Kn = new Uint8Array(16);
1162
+ function Hn() {
1163
+ if (!ne && (ne = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ne))
1164
1164
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1165
- return te(Hn);
1165
+ return ne(Kn);
1166
1166
  }
1167
- var Wn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1168
- const xe = {
1169
- randomUUID: Wn
1167
+ var Ln = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1168
+ const We = {
1169
+ randomUUID: Ln
1170
1170
  };
1171
1171
  function Se(e, t, n) {
1172
- if (xe.randomUUID && !t && !e)
1173
- return xe.randomUUID();
1172
+ if (We.randomUUID && !t && !e)
1173
+ return We.randomUUID();
1174
1174
  e = e || {};
1175
- var r = e.random || (e.rng || Ln)();
1176
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Kn(r);
1175
+ var r = e.random || (e.rng || Hn)();
1176
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, $n(r);
1177
1177
  }
1178
1178
  /*!
1179
1179
  @versini/ui-fingerprint v1.0.1
@@ -1188,20 +1188,20 @@ try {
1188
1188
  });
1189
1189
  } catch {
1190
1190
  }
1191
- const xn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join(""), ot = async (e) => {
1191
+ const Wn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join(""), at = async (e) => {
1192
1192
  if (e === "")
1193
1193
  return "";
1194
1194
  const t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
1195
1195
  return Array.from(new Uint8Array(n)).map((r) => r.toString(16).padStart(2, "0")).join("");
1196
1196
  };
1197
- function Me(e, t) {
1197
+ function xe(e, t) {
1198
1198
  return new Promise((n) => setTimeout(n, e, t));
1199
1199
  }
1200
- async function Mn(e, t, n = 50) {
1200
+ async function xn(e, t, n = 50) {
1201
1201
  var r, a, s;
1202
1202
  const o = document;
1203
1203
  for (; !o.body; )
1204
- await Me(n);
1204
+ await xe(n);
1205
1205
  const i = o.createElement("iframe");
1206
1206
  try {
1207
1207
  for (await new Promise((l, y) => {
@@ -1220,20 +1220,20 @@ async function Mn(e, t, n = 50) {
1220
1220
  };
1221
1221
  d();
1222
1222
  }); !((a = (r = i.contentWindow) == null ? void 0 : r.document) != null && a.body); )
1223
- await Me(n);
1223
+ await xe(n);
1224
1224
  return await e(i, i.contentWindow);
1225
1225
  } finally {
1226
1226
  (s = i.parentNode) == null || s.removeChild(i);
1227
1227
  }
1228
1228
  }
1229
- const Gn = {
1229
+ const Mn = {
1230
1230
  audio: {
1231
1231
  sampleHash: "",
1232
1232
  oscillator: "",
1233
1233
  maxChannels: 0,
1234
1234
  channelCountMode: ""
1235
1235
  }
1236
- }, Jn = async (e) => new Promise((t) => {
1236
+ }, Gn = async (e) => new Promise((t) => {
1237
1237
  try {
1238
1238
  const n = new window.OfflineAudioContext(1, 5e3, 44100), r = n.createBufferSource(), a = n.createOscillator();
1239
1239
  a.frequency.value = 1e3;
@@ -1242,7 +1242,7 @@ const Gn = {
1242
1242
  const i = o.renderedBuffer.getChannelData(0);
1243
1243
  a.disconnect(), s.disconnect(), t({
1244
1244
  audio: {
1245
- sampleHash: xn(i),
1245
+ sampleHash: Wn(i),
1246
1246
  oscillator: a.type,
1247
1247
  maxChannels: n.destination.maxChannelCount,
1248
1248
  channelCountMode: r.channelCountMode
@@ -1259,25 +1259,25 @@ const Gn = {
1259
1259
  }
1260
1260
  });
1261
1261
  }
1262
- }), st = { browser: "" }, Yn = async (e) => typeof navigator > "u" ? st : { browser: navigator.userAgent }, it = {
1262
+ }), ot = { browser: "" }, Jn = async (e) => typeof navigator > "u" ? ot : { browser: navigator.userAgent }, st = {
1263
1263
  canvas: {
1264
1264
  data: ""
1265
1265
  }
1266
- }, Vn = async (e) => {
1266
+ }, Yn = async (e) => {
1267
1267
  try {
1268
1268
  const t = Array.from(
1269
1269
  { length: 3 },
1270
- () => jn(300, 30)
1271
- ), n = Bn(t, 300, 30);
1270
+ () => Vn(300, 30)
1271
+ ), n = Fn(t, 300, 30);
1272
1272
  return {
1273
1273
  canvas: {
1274
- data: (await ot(n.data.toString())).toString()
1274
+ data: (await at(n.data.toString())).toString()
1275
1275
  }
1276
1276
  };
1277
1277
  } catch {
1278
- return it;
1278
+ return st;
1279
1279
  }
1280
- }, jn = (e, t) => {
1280
+ }, Vn = (e, t) => {
1281
1281
  const n = document.createElement("canvas"), r = n.getContext("2d");
1282
1282
  if (!r)
1283
1283
  return new ImageData(1, 1);
@@ -1286,7 +1286,7 @@ const Gn = {
1286
1286
  a.addColorStop(0, "red"), a.addColorStop(1 / 6, "orange"), a.addColorStop(2 / 6, "yellow"), a.addColorStop(3 / 6, "green"), a.addColorStop(4 / 6, "blue"), a.addColorStop(5 / 6, "indigo"), a.addColorStop(1, "violet"), r.fillStyle = a, r.fillRect(0, 0, n.width, n.height);
1287
1287
  const s = "mmMwWLliI0O&1 - Les sanglots longs des violons de l'automne blessent mon coeur d'une langueur monotone";
1288
1288
  return r.font = "26.321px Arial", r.fillStyle = "black", r.fillText(s, -5, 15), r.fillStyle = "rgba(0, 0, 255, 0.5)", r.fillText(s, -3.3, 17.7), r.beginPath(), r.moveTo(0, 0), r.lineTo(n.width * 2 / 7, n.height), r.strokeStyle = "white", r.lineWidth = 2, r.stroke(), r.getImageData(0, 0, n.width, n.height);
1289
- }, Fn = (e) => {
1289
+ }, jn = (e) => {
1290
1290
  if (e.length === 0)
1291
1291
  return 0;
1292
1292
  const t = {};
@@ -1296,17 +1296,17 @@ const Gn = {
1296
1296
  for (const r in t)
1297
1297
  t[r] > t[n] && (n = parseInt(r, 10));
1298
1298
  return n;
1299
- }, Bn = (e, t, n) => {
1299
+ }, Fn = (e, t, n) => {
1300
1300
  const r = [];
1301
1301
  for (let o = 0; o < e[0].data.length; o++) {
1302
1302
  const i = [];
1303
1303
  for (let l = 0; l < e.length; l++)
1304
1304
  i.push(e[l].data[o]);
1305
- r.push(Fn(i));
1305
+ r.push(jn(i));
1306
1306
  }
1307
1307
  const a = r, s = new Uint8ClampedArray(a);
1308
1308
  return new ImageData(s, t, n);
1309
- }, qn = [], zn = "mmMwWLliI0O&1", Qn = "48px", $ = ["monospace", "sans-serif", "serif"], Ge = [
1309
+ }, Bn = [], qn = "mmMwWLliI0O&1", zn = "48px", $ = ["monospace", "sans-serif", "serif"], Me = [
1310
1310
  "sans-serif-thin",
1311
1311
  "ARNO PRO",
1312
1312
  "Agency FB",
@@ -1344,17 +1344,17 @@ const Gn = {
1344
1344
  "TRAJAN PRO",
1345
1345
  "Univers CE 55 Medium",
1346
1346
  "ZWAdobeF"
1347
- ], Xn = async (e) => Mn(async (t, { document: n }) => {
1347
+ ], Qn = async (e) => xn(async (t, { document: n }) => {
1348
1348
  const r = n.body;
1349
- r.style.fontSize = Qn;
1349
+ r.style.fontSize = zn;
1350
1350
  const a = n.createElement("div");
1351
1351
  a.style.setProperty("visibility", "hidden", "important");
1352
1352
  const s = {}, o = {}, i = (d) => {
1353
1353
  const g = n.createElement("span"), { style: R } = g;
1354
- return R.position = "absolute", R.top = "0", R.left = "0", R.fontFamily = d, g.textContent = zn, a.appendChild(g), g;
1354
+ return R.position = "absolute", R.top = "0", R.left = "0", R.fontFamily = d, g.textContent = qn, a.appendChild(g), g;
1355
1355
  }, l = (d, g) => i(`'${d}',${g}`), y = () => $.map(i), h = () => {
1356
1356
  const d = {};
1357
- for (const g of Ge)
1357
+ for (const g of Me)
1358
1358
  d[g] = $.map(
1359
1359
  (R) => l(g, R)
1360
1360
  );
@@ -1365,23 +1365,23 @@ const Gn = {
1365
1365
  r.appendChild(a);
1366
1366
  for (let d = 0; d < $.length; d++)
1367
1367
  s[$[d]] = m[d].offsetWidth, o[$[d]] = m[d].offsetHeight;
1368
- return Ge.filter((d) => p(u[d]));
1369
- }), ct = {
1368
+ return Me.filter((d) => p(u[d]));
1369
+ }), it = {
1370
1370
  vendor: "",
1371
1371
  vendorUnmasked: "",
1372
1372
  renderer: "",
1373
1373
  rendererUnmasked: "",
1374
1374
  version: "",
1375
1375
  shadingLanguageVersion: ""
1376
- }, ut = {
1376
+ }, ct = {
1377
1377
  hardware: {
1378
- videocard: ct,
1378
+ videocard: it,
1379
1379
  architecture: 0,
1380
1380
  deviceMemory: "undefined",
1381
1381
  jsHeapSizeLimit: 0
1382
1382
  }
1383
1383
  };
1384
- function Zn() {
1384
+ function Xn() {
1385
1385
  const e = document.createElement("canvas"), t = e.getContext("webgl") ?? e.getContext("experimental-webgl");
1386
1386
  if (t && "getParameter" in t) {
1387
1387
  const n = t.getExtension("WEBGL_debug_renderer_info");
@@ -1394,41 +1394,41 @@ function Zn() {
1394
1394
  shadingLanguageVersion: (t.getParameter(t.SHADING_LANGUAGE_VERSION) || "").toString()
1395
1395
  };
1396
1396
  }
1397
- return ct;
1397
+ return it;
1398
1398
  }
1399
- function er() {
1399
+ function Zn() {
1400
1400
  const e = new Float32Array(1), t = new Uint8Array(e.buffer);
1401
1401
  return e[0] = 1 / 0, e[0] = e[0] - e[0], t[3];
1402
1402
  }
1403
- const tr = () => navigator.deviceMemory || 0, nr = () => window.performance && window.performance.memory || {
1403
+ const er = () => navigator.deviceMemory || 0, tr = () => window.performance && window.performance.memory || {
1404
1404
  jsHeapSizeLimit: 0
1405
- }, rr = async (e) => new Promise((t) => {
1405
+ }, nr = async (e) => new Promise((t) => {
1406
1406
  try {
1407
- const n = tr(), r = nr();
1407
+ const n = er(), r = tr();
1408
1408
  t({
1409
1409
  hardware: {
1410
- videocard: Zn(),
1411
- architecture: er(),
1410
+ videocard: Xn(),
1411
+ architecture: Zn(),
1412
1412
  deviceMemory: n.toString() || "undefined",
1413
1413
  jsHeapSizeLimit: r.jsHeapSizeLimit || 0
1414
1414
  }
1415
1415
  });
1416
1416
  } catch {
1417
- t(ut);
1417
+ t(ct);
1418
1418
  }
1419
- }), ar = {
1419
+ }), rr = {
1420
1420
  locales: {
1421
1421
  languages: "",
1422
1422
  timezone: ""
1423
1423
  }
1424
- }, or = async (e) => new Promise((t) => {
1424
+ }, ar = async (e) => new Promise((t) => {
1425
1425
  t({
1426
1426
  locales: {
1427
1427
  languages: navigator.language,
1428
1428
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
1429
1429
  }
1430
1430
  });
1431
- }), lt = {
1431
+ }), ut = {
1432
1432
  screen: {
1433
1433
  colorDepth: 0,
1434
1434
  pixelDepth: 0,
@@ -1436,7 +1436,7 @@ const tr = () => navigator.deviceMemory || 0, nr = () => window.performance && w
1436
1436
  maxTouchPoints: 0,
1437
1437
  mediaMatches: []
1438
1438
  }
1439
- }, sr = async (e) => new Promise((t) => {
1439
+ }, or = async (e) => new Promise((t) => {
1440
1440
  try {
1441
1441
  const n = window.screen, r = {
1442
1442
  screen: {
@@ -1444,15 +1444,15 @@ const tr = () => navigator.deviceMemory || 0, nr = () => window.performance && w
1444
1444
  pixelDepth: n.pixelDepth,
1445
1445
  isTouchScreen: navigator.maxTouchPoints > 0,
1446
1446
  maxTouchPoints: navigator.maxTouchPoints,
1447
- mediaMatches: ir()
1447
+ mediaMatches: sr()
1448
1448
  }
1449
1449
  };
1450
1450
  t(r);
1451
1451
  } catch {
1452
- t(lt);
1452
+ t(ut);
1453
1453
  }
1454
1454
  });
1455
- function ir() {
1455
+ function sr() {
1456
1456
  const e = [], t = {
1457
1457
  "prefers-contrast": [
1458
1458
  "high",
@@ -1480,7 +1480,7 @@ function ir() {
1480
1480
  });
1481
1481
  }), e;
1482
1482
  }
1483
- const cr = async (e) => {
1483
+ const ir = async (e) => {
1484
1484
  try {
1485
1485
  return {
1486
1486
  system: {
@@ -1491,52 +1491,52 @@ const cr = async (e) => {
1491
1491
  }
1492
1492
  };
1493
1493
  } catch {
1494
- return dt;
1494
+ return lt;
1495
1495
  }
1496
- }, dt = {
1496
+ }, lt = {
1497
1497
  system: {
1498
1498
  platform: "",
1499
1499
  cookieEnabled: !1,
1500
1500
  productSub: "",
1501
1501
  product: ""
1502
1502
  }
1503
- }, ur = async (e) => {
1503
+ }, cr = async (e) => {
1504
1504
  try {
1505
1505
  return Promise.all([
1506
+ Gn(),
1506
1507
  Jn(),
1507
1508
  Yn(),
1508
- Vn(),
1509
- Xn(),
1510
- rr(),
1509
+ Qn(),
1510
+ nr(),
1511
+ ar(),
1511
1512
  or(),
1512
- sr(),
1513
- cr()
1513
+ ir()
1514
1514
  ]);
1515
1515
  } catch {
1516
1516
  return [
1517
- Gn,
1517
+ Mn,
1518
+ ot,
1518
1519
  st,
1519
- it,
1520
- qn,
1520
+ Bn,
1521
+ ct,
1522
+ rr,
1521
1523
  ut,
1522
- ar,
1523
- lt,
1524
- dt
1524
+ lt
1525
1525
  ];
1526
1526
  }
1527
- }, lr = async (e) => {
1527
+ }, ur = async (e) => {
1528
1528
  try {
1529
- const t = await ur();
1530
- return await ot(JSON.stringify(t));
1529
+ const t = await cr();
1530
+ return await at(JSON.stringify(t));
1531
1531
  } catch {
1532
1532
  return "";
1533
1533
  }
1534
- }, ne = "Oops! It looks like your session has expired. For your security, please log in again to continue.", dr = "Your session has been successfully terminated.", re = "Login failed. Please try again.", Ae = "Error getting access token, please re-authenticate.", hr = "You forgot to wrap your component in <AuthProvider>.", le = {
1534
+ }, K = "Oops! It looks like your session has expired. For your security, please log in again to continue.", lr = "Your session has been successfully terminated.", re = "Login failed. Please try again.", dr = "Error getting access token, please re-authenticate.", hr = "You forgot to wrap your component in <AuthProvider>.", le = {
1535
1535
  dev: "https://auth.gizmette.local.com:3003",
1536
1536
  prod: "https://mylogin.gizmette.com/auth"
1537
- }, ae = "@@auth@@", J = "LOADING", Y = "LOGIN", ht = "LOGOUT", pr = process.env.NODE_ENV === "production", pt = !pr, fr = (e) => {
1537
+ }, ae = "@@auth@@", Y = "LOADING", V = "LOGIN", dt = "LOGOUT", pr = process.env.NODE_ENV === "production", ht = !pr, fr = (e) => {
1538
1538
  try {
1539
- const t = In(e);
1539
+ const t = bn(e);
1540
1540
  return t ? t[T.USER_ID_KEY] : "";
1541
1541
  } catch {
1542
1542
  return "";
@@ -1548,13 +1548,13 @@ const cr = async (e) => {
1548
1548
  }) => {
1549
1549
  try {
1550
1550
  const r = await fetch(
1551
- pt ? `${le.dev}/${e}` : `${le.prod}/${e}`,
1551
+ ht ? `${le.dev}/${e}` : `${le.prod}/${e}`,
1552
1552
  {
1553
1553
  credentials: "include",
1554
1554
  method: "POST",
1555
1555
  headers: {
1556
1556
  "Content-Type": "application/json",
1557
- [Be.CLIENT_ID]: `${t}`
1557
+ [Fe.CLIENT_ID]: `${t}`
1558
1558
  },
1559
1559
  body: JSON.stringify(n)
1560
1560
  }
@@ -1597,7 +1597,7 @@ const cr = async (e) => {
1597
1597
  status: !1
1598
1598
  };
1599
1599
  }
1600
- }, Je = async ({
1600
+ }, Ge = async ({
1601
1601
  username: e,
1602
1602
  password: t,
1603
1603
  clientId: n,
@@ -1614,7 +1614,7 @@ const cr = async (e) => {
1614
1614
  type: de.AUTHENTICATE,
1615
1615
  clientId: n,
1616
1616
  params: {
1617
- type: a || j.ID_AND_ACCESS_TOKEN,
1617
+ type: a || F.ID_AND_ACCESS_TOKEN,
1618
1618
  username: e,
1619
1619
  password: t,
1620
1620
  sessionExpiration: s,
@@ -1624,7 +1624,7 @@ const cr = async (e) => {
1624
1624
  domain: l,
1625
1625
  fingerprint: y
1626
1626
  }
1627
- }), p = await x(h.data.idToken);
1627
+ }), p = await M(h.data.idToken);
1628
1628
  return p && p.payload[T.USER_ID_KEY] !== "" && p.payload[T.NONCE_KEY] === r ? {
1629
1629
  idToken: h.data.idToken,
1630
1630
  accessToken: h.data.accessToken,
@@ -1649,7 +1649,7 @@ const cr = async (e) => {
1649
1649
  type: de.CODE,
1650
1650
  clientId: t,
1651
1651
  params: {
1652
- type: j.CODE,
1652
+ type: F.CODE,
1653
1653
  nonce: e,
1654
1654
  code_challenge: n
1655
1655
  }
@@ -1678,15 +1678,15 @@ const cr = async (e) => {
1678
1678
  type: de.AUTHENTICATE,
1679
1679
  clientId: e,
1680
1680
  params: {
1681
- type: j.REFRESH_TOKEN,
1681
+ type: F.REFRESH_TOKEN,
1682
1682
  userId: t,
1683
1683
  nonce: n,
1684
1684
  refreshToken: r,
1685
1685
  accessToken: a,
1686
1686
  domain: s,
1687
- fingerprint: await ft()
1687
+ fingerprint: await pt()
1688
1688
  }
1689
- }), i = await x(o.data.accessToken);
1689
+ }), i = await M(o.data.accessToken);
1690
1690
  return i && i.payload[T.USER_ID_KEY] !== "" && i.payload[T.NONCE_KEY] === n ? {
1691
1691
  accessToken: o.data.accessToken,
1692
1692
  refreshToken: o.data.refreshToken,
@@ -1721,7 +1721,6 @@ const cr = async (e) => {
1721
1721
  alg
1722
1722
  }
1723
1723
  timeout
1724
-
1725
1724
  attestation
1726
1725
  }
1727
1726
  }`,
@@ -1748,7 +1747,11 @@ const cr = async (e) => {
1748
1747
  clientId: $clientId) {
1749
1748
  rpId,
1750
1749
  challenge,
1751
- allowCredentials,
1750
+ allowCredentials {
1751
+ id,
1752
+ type,
1753
+ transports
1754
+ }
1752
1755
  timeout,
1753
1756
  userVerification,
1754
1757
  }
@@ -1775,7 +1778,7 @@ const cr = async (e) => {
1775
1778
  username,
1776
1779
  }
1777
1780
  }`
1778
- }, K = {
1781
+ }, H = {
1779
1782
  GET_REGISTRATION_OPTIONS: {
1780
1783
  schema: oe.GET_REGISTRATION_OPTIONS,
1781
1784
  method: "getPasskeyRegistrationOptions"
@@ -1792,7 +1795,7 @@ const cr = async (e) => {
1792
1795
  schema: oe.VERIFY_AUTHENTICATION,
1793
1796
  method: "verifyPasskeyAuthentication"
1794
1797
  }
1795
- }, H = async ({
1798
+ }, L = async ({
1796
1799
  accessToken: e,
1797
1800
  type: t,
1798
1801
  clientId: n,
@@ -1800,7 +1803,7 @@ const cr = async (e) => {
1800
1803
  }) => {
1801
1804
  try {
1802
1805
  const a = t != null && t.data ? t.data(r) : r, s = `Bearer ${e}`, o = await fetch(
1803
- pt ? `${le.dev}/graphql` : `${le.prod}/graphql`,
1806
+ ht ? `${le.dev}/graphql` : `${le.prod}/graphql`,
1804
1807
  {
1805
1808
  method: "POST",
1806
1809
  credentials: "include",
@@ -1808,7 +1811,7 @@ const cr = async (e) => {
1808
1811
  authorization: s,
1809
1812
  "Content-Type": "application/json",
1810
1813
  Accept: "application/json",
1811
- [Be.CLIENT_ID]: `${n}`
1814
+ [Fe.CLIENT_ID]: `${n}`
1812
1815
  },
1813
1816
  body: JSON.stringify({
1814
1817
  query: t.schema,
@@ -1827,18 +1830,18 @@ const cr = async (e) => {
1827
1830
  } catch (a) {
1828
1831
  return console.error(a), { status: 500, data: [] };
1829
1832
  }
1830
- }, ft = async () => {
1833
+ }, pt = async () => {
1831
1834
  try {
1832
- return await lr();
1835
+ return await ur();
1833
1836
  } catch {
1834
1837
  return "";
1835
1838
  }
1836
1839
  };
1837
1840
  class wr {
1838
1841
  constructor(t = null, n = null) {
1839
- z(this, "refreshTokenPromise", null);
1840
- z(this, "accessToken");
1841
- z(this, "refreshToken");
1842
+ Q(this, "refreshTokenPromise", null);
1843
+ Q(this, "accessToken");
1844
+ Q(this, "refreshToken");
1842
1845
  this.accessToken = t || "", this.refreshToken = n || "";
1843
1846
  }
1844
1847
  async refreshtoken({
@@ -1865,7 +1868,7 @@ class wr {
1865
1868
  nonce: r,
1866
1869
  domain: a
1867
1870
  }) {
1868
- const s = await x(this.refreshToken);
1871
+ const s = await M(this.refreshToken);
1869
1872
  if (s && s.payload[T.USER_ID_KEY] !== "") {
1870
1873
  const o = await mr({
1871
1874
  clientId: t,
@@ -1888,25 +1891,25 @@ class wr {
1888
1891
  };
1889
1892
  }
1890
1893
  }
1891
- const Er = (e) => W(
1894
+ const Er = (e) => x(
1892
1895
  (...t) => {
1893
1896
  e && console.info(`==> [Auth ${Date.now()}]: `, ...t);
1894
1897
  },
1895
1898
  [e]
1896
- ), L = () => {
1899
+ ), W = () => {
1897
1900
  throw new Error(hr);
1898
- }, yt = Pt({
1901
+ }, ft = Ct({
1899
1902
  isAuthenticated: !1,
1900
1903
  isLoading: !1,
1901
1904
  authenticationType: null,
1902
- login: L,
1903
- logout: L,
1904
- getAccessToken: L,
1905
- getIdToken: L,
1906
- registeringForPasskey: L,
1907
- loginWithPasskey: L,
1905
+ login: W,
1906
+ logout: W,
1907
+ getAccessToken: W,
1908
+ getIdToken: W,
1909
+ registeringForPasskey: W,
1910
+ loginWithPasskey: W,
1908
1911
  logoutReason: ""
1909
- }), Sr = kt.createContext({
1912
+ }), Sr = vt.createContext({
1910
1913
  state: {
1911
1914
  isLoading: !0,
1912
1915
  isAuthenticated: !1,
@@ -1917,17 +1920,17 @@ const Er = (e) => W(
1917
1920
  },
1918
1921
  dispatch: () => {
1919
1922
  }
1920
- }), Ar = (e, t) => (t == null ? void 0 : t.type) === J ? {
1923
+ }), Ar = (e, t) => (t == null ? void 0 : t.type) === Y ? {
1921
1924
  ...e,
1922
1925
  isLoading: t.payload.isLoading
1923
- } : (t == null ? void 0 : t.type) === Y ? {
1926
+ } : (t == null ? void 0 : t.type) === V ? {
1924
1927
  ...e,
1925
1928
  isLoading: !1,
1926
1929
  isAuthenticated: !0,
1927
1930
  user: t.payload.user,
1928
1931
  authenticationType: t.payload.authenticationType,
1929
1932
  logoutReason: ""
1930
- } : (t == null ? void 0 : t.type) === ht ? {
1933
+ } : (t == null ? void 0 : t.type) === dt ? {
1931
1934
  ...e,
1932
1935
  isLoading: !1,
1933
1936
  isAuthenticated: !1,
@@ -1941,37 +1944,37 @@ const Er = (e) => W(
1941
1944
  domain: r = "",
1942
1945
  debug: a = !1
1943
1946
  }) => {
1944
- const [s, o] = Ot(Ar, {
1947
+ const [s, o] = Pt(Ar, {
1945
1948
  isLoading: !0,
1946
1949
  isAuthenticated: !1,
1947
1950
  authenticationType: null,
1948
1951
  user: void 0,
1949
1952
  logoutReason: "",
1950
1953
  debug: a
1951
- }), i = Er(a), l = Ce(!1), y = Ce(""), [h, p, , m] = ee({
1954
+ }), i = Er(a), l = ke(!1), y = ke(""), [h, p, , m] = te({
1952
1955
  key: `${ae}::${n}::@@user@@`
1953
- }), [u, d, , g] = ee({
1956
+ }), [u, d, , g] = te({
1954
1957
  key: `${ae}::${n}::@@access@@`
1955
- }), [R, B, , q] = ee(
1958
+ }), [R, q, , z] = te(
1956
1959
  {
1957
1960
  key: `${ae}::${n}::@@refresh@@`
1958
1961
  }
1959
- ), [gt, Ie, , _e] = ee({
1962
+ ), [yt, be, , Ie] = te({
1960
1963
  key: `${ae}::${n}::@@nonce@@`
1961
- }), mt = new wr(u, R), U = W(
1964
+ }), gt = new wr(u, R), U = x(
1962
1965
  (c) => {
1963
1966
  i(
1964
1967
  "removeStateAndLocalStorage: removing state and local storage with reason: ",
1965
1968
  c
1966
1969
  ), o({
1967
- type: ht,
1970
+ type: dt,
1968
1971
  payload: {
1969
- logoutReason: c || ne
1972
+ logoutReason: c || K
1970
1973
  }
1971
- }), m(), g(), q(), _e(), o({ type: J, payload: { isLoading: !1 } });
1974
+ }), m(), g(), z(), Ie(), o({ type: Y, payload: { isLoading: !1 } });
1972
1975
  },
1973
- [g, m, _e, q, i]
1974
- ), N = W(
1976
+ [g, m, Ie, z, i]
1977
+ ), N = x(
1975
1978
  async (c) => {
1976
1979
  i("invalidateAndLogout: invalidating and logging out");
1977
1980
  const { user: w } = s, f = (w == null ? void 0 : w.userId) || fr(h);
@@ -1984,7 +1987,7 @@ const Er = (e) => W(
1984
1987
  refreshToken: R,
1985
1988
  clientId: n,
1986
1989
  domain: r
1987
- }), U(c || ne);
1990
+ }), U(c || K);
1988
1991
  },
1989
1992
  [
1990
1993
  u,
@@ -1997,15 +2000,15 @@ const Er = (e) => W(
1997
2000
  i
1998
2001
  ]
1999
2002
  );
2000
- Te(() => ((async () => (i("useEffect: setting the fingerprint"), y.current = await ft()))(), () => {
2003
+ Ae(() => ((async () => (i("useEffect: setting the fingerprint"), y.current = await pt()))(), () => {
2001
2004
  i("useEffect: cleaning up the fingerprint"), y.current = "";
2002
- }), []), Te(() => {
2005
+ }), []), Ae(() => {
2003
2006
  if (!l.current)
2004
2007
  return s.isLoading && h !== null ? (async () => {
2005
2008
  try {
2006
- const c = await x(h);
2009
+ const c = await M(h);
2007
2010
  c && c.payload[T.USER_ID_KEY] !== "" ? (i("useEffect: setting the authentication state"), o({
2008
- type: Y,
2011
+ type: V,
2009
2012
  payload: {
2010
2013
  authenticationType: c.payload[T.AUTH_TYPE_KEY],
2011
2014
  user: {
@@ -2013,43 +2016,43 @@ const Er = (e) => W(
2013
2016
  username: c.payload[T.USERNAME_KEY]
2014
2017
  }
2015
2018
  }
2016
- })) : (i("useEffect: invalid JWT, invalidating and logging out"), await N(ne));
2019
+ })) : (i("useEffect: invalid JWT, invalidating and logging out"), await N(K));
2017
2020
  } catch {
2018
2021
  i(
2019
2022
  "useEffect: exception validating JWT, invalidating and logging out"
2020
- ), await N(ne);
2023
+ ), await N(K);
2021
2024
  }
2022
- })() : (i("useEffect: setting the loading state to false"), o({ type: J, payload: { isLoading: !1 } })), () => {
2025
+ })() : (i("useEffect: setting the loading state to false"), o({ type: Y, payload: { isLoading: !1 } })), () => {
2023
2026
  l.current = !0;
2024
2027
  };
2025
2028
  }, [s.isLoading, h, N, i]);
2026
- const wt = async (c, w, f) => {
2029
+ const mt = async (c, w, f) => {
2027
2030
  const I = Se();
2028
- if (Ie(I), o({ type: J, payload: { isLoading: !0 } }), m(), g(), q(), i("login: Logging in with type: ", f), f === j.CODE) {
2029
- const { code_verifier: bt, code_challenge: It } = await Dn(), ve = await gr({
2031
+ if (be(I), o({ type: Y, payload: { isLoading: !0 } }), m(), g(), z(), i("login: Logging in with type: ", f), f === F.CODE) {
2032
+ const { code_verifier: Rt, code_challenge: bt } = await Nn(), _e = await gr({
2030
2033
  nonce: I,
2031
2034
  clientId: n,
2032
- code_challenge: It
2035
+ code_challenge: bt
2033
2036
  });
2034
- if (ve.status) {
2035
- const G = await Je({
2037
+ if (_e.status) {
2038
+ const J = await Ge({
2036
2039
  username: c,
2037
2040
  password: w,
2038
2041
  clientId: n,
2039
2042
  sessionExpiration: t,
2040
2043
  nonce: I,
2041
2044
  type: f,
2042
- code: ve.code,
2043
- code_verifier: bt,
2045
+ code: _e.code,
2046
+ code_verifier: Rt,
2044
2047
  domain: r,
2045
2048
  fingerprint: y.current
2046
2049
  });
2047
- return G.status ? (p(G.idToken), d(G.accessToken), B(G.refreshToken), o({
2048
- type: Y,
2050
+ return J.status ? (p(J.idToken), d(J.accessToken), q(J.refreshToken), o({
2051
+ type: V,
2049
2052
  payload: {
2050
2053
  authenticationType: f,
2051
2054
  user: {
2052
- userId: G.userId,
2055
+ userId: J.userId,
2053
2056
  username: c
2054
2057
  }
2055
2058
  }
@@ -2057,7 +2060,7 @@ const Er = (e) => W(
2057
2060
  }
2058
2061
  return !1;
2059
2062
  }
2060
- const M = await Je({
2063
+ const G = await Ge({
2061
2064
  username: c,
2062
2065
  password: w,
2063
2066
  clientId: n,
@@ -2067,54 +2070,56 @@ const Er = (e) => W(
2067
2070
  domain: r,
2068
2071
  fingerprint: y.current
2069
2072
  });
2070
- return M.status ? (p(M.idToken), d(M.accessToken), B(M.refreshToken), o({
2071
- type: Y,
2073
+ return G.status ? (p(G.idToken), d(G.accessToken), q(G.refreshToken), o({
2074
+ type: V,
2072
2075
  payload: {
2073
2076
  authenticationType: f,
2074
2077
  user: {
2075
- userId: M.userId,
2078
+ userId: G.userId,
2076
2079
  username: c
2077
2080
  }
2078
2081
  }
2079
2082
  }), !0) : (U(re), !1);
2080
- }, Et = async (c) => {
2081
- c == null || c.preventDefault(), await N(dr);
2082
- }, St = async () => {
2083
+ }, wt = async (c) => {
2084
+ c == null || c.preventDefault(), await N(lr);
2085
+ }, Et = async () => {
2083
2086
  const { isAuthenticated: c, user: w } = s;
2084
2087
  try {
2085
2088
  if (c && w && w.userId) {
2086
2089
  if (u) {
2087
2090
  i("getAccessToken");
2088
- const I = await x(u);
2091
+ const I = await M(u);
2089
2092
  if (I && I.payload[T.USER_ID_KEY] !== "")
2090
2093
  return u;
2091
2094
  }
2092
- i("getAccessToken: invalid access token, refreshing it");
2093
- const f = await mt.refreshtoken({
2095
+ i("getAccessToken: invalid access token, trying to refresh it");
2096
+ const f = await gt.refreshtoken({
2094
2097
  clientId: n,
2095
2098
  userId: w.userId,
2096
- nonce: gt,
2099
+ nonce: yt,
2097
2100
  domain: r
2098
2101
  });
2099
- return f.status && f.status === "success" ? (d(f.newAccessToken), B(f.newRefreshToken), f.newAccessToken) : (i("getAccessToken: invalid refresh token, re-authenticating user"), await N(Ae), "");
2102
+ return f.status && f.status === "success" ? (d(f.newAccessToken), q(f.newRefreshToken), f.newAccessToken) : (i(
2103
+ "getAccessToken: invalid refresh token, need to re-authenticate"
2104
+ ), await N(K), "");
2100
2105
  }
2101
2106
  return i(
2102
2107
  "getAccessToken: user is not authenticated, cannot get access token"
2103
- ), await N(Ae), "";
2108
+ ), await N(K), "";
2104
2109
  } catch {
2105
2110
  return i(
2106
2111
  "getAccessToken: exception occurred, invalidating and logging out"
2107
- ), await N(Ae), "";
2112
+ ), await N(dr), "";
2108
2113
  }
2109
- }, At = () => {
2114
+ }, St = () => {
2110
2115
  if (s.isAuthenticated && h)
2111
2116
  return h;
2112
- }, Tt = async () => {
2117
+ }, At = async () => {
2113
2118
  const { user: c } = s;
2114
- let w = await H({
2119
+ let w = await L({
2115
2120
  accessToken: u,
2116
2121
  clientId: n,
2117
- type: K.GET_REGISTRATION_OPTIONS,
2122
+ type: H.GET_REGISTRATION_OPTIONS,
2118
2123
  params: {
2119
2124
  clientId: n,
2120
2125
  id: c == null ? void 0 : c.userId,
@@ -2123,11 +2128,11 @@ const Er = (e) => W(
2123
2128
  });
2124
2129
  if (w.status)
2125
2130
  try {
2126
- const f = await Kt(w.data);
2127
- w = await H({
2131
+ const f = await $t(w.data);
2132
+ w = await L({
2128
2133
  accessToken: u,
2129
2134
  clientId: n,
2130
- type: K.VERIFY_REGISTRATION,
2135
+ type: H.VERIFY_REGISTRATION,
2131
2136
  params: {
2132
2137
  clientId: n,
2133
2138
  id: c == null ? void 0 : c.userId,
@@ -2136,10 +2141,10 @@ const Er = (e) => W(
2136
2141
  }
2137
2142
  });
2138
2143
  } catch {
2139
- return await H({
2144
+ return await L({
2140
2145
  accessToken: u,
2141
2146
  clientId: n,
2142
- type: K.VERIFY_REGISTRATION,
2147
+ type: H.VERIFY_REGISTRATION,
2143
2148
  params: {
2144
2149
  clientId: n,
2145
2150
  id: c == null ? void 0 : c.userId,
@@ -2148,14 +2153,14 @@ const Er = (e) => W(
2148
2153
  }
2149
2154
  }), !1;
2150
2155
  }
2151
- }, Rt = async () => {
2156
+ }, Tt = async () => {
2152
2157
  const c = Se();
2153
- Ie(c), o({ type: J, payload: { isLoading: !0 } }), m(), g(), q(), i("loginWithPasskey");
2158
+ be(c), o({ type: Y, payload: { isLoading: !0 } }), m(), g(), z(), i("loginWithPasskey");
2154
2159
  const w = Se();
2155
- let f = await H({
2160
+ let f = await L({
2156
2161
  accessToken: u,
2157
2162
  clientId: n,
2158
- type: K.GET_AUTHENTICATION_OPTIONS,
2163
+ type: H.GET_AUTHENTICATION_OPTIONS,
2159
2164
  params: {
2160
2165
  id: w,
2161
2166
  clientId: n
@@ -2163,11 +2168,11 @@ const Er = (e) => W(
2163
2168
  });
2164
2169
  if (f.status)
2165
2170
  try {
2166
- const I = await Wt(f.data);
2167
- return f = await H({
2171
+ const I = await Lt(f.data);
2172
+ return f = await L({
2168
2173
  accessToken: u,
2169
2174
  clientId: n,
2170
- type: K.VERIFY_AUTHENTICATION,
2175
+ type: H.VERIFY_AUTHENTICATION,
2171
2176
  params: {
2172
2177
  clientId: n,
2173
2178
  id: w,
@@ -2176,10 +2181,10 @@ const Er = (e) => W(
2176
2181
  domain: r,
2177
2182
  fingerprint: y.current
2178
2183
  }
2179
- }), f.data.status === "success" ? (p(f.data.idToken), d(f.data.accessToken), B(f.data.refreshToken), o({
2180
- type: Y,
2184
+ }), f.data.status === "success" ? (p(f.data.idToken), d(f.data.accessToken), q(f.data.refreshToken), o({
2185
+ type: V,
2181
2186
  payload: {
2182
- authenticationType: j.PASSKEY,
2187
+ authenticationType: F.PASSKEY,
2183
2188
  user: {
2184
2189
  userId: f.data.userId,
2185
2190
  username: f.data.username
@@ -2187,10 +2192,10 @@ const Er = (e) => W(
2187
2192
  }
2188
2193
  }), !0) : (U(re), !1);
2189
2194
  } catch {
2190
- return await H({
2195
+ return await L({
2191
2196
  accessToken: u,
2192
2197
  clientId: n,
2193
- type: K.VERIFY_AUTHENTICATION,
2198
+ type: H.VERIFY_AUTHENTICATION,
2194
2199
  params: {
2195
2200
  clientId: n,
2196
2201
  id: w,
@@ -2201,24 +2206,24 @@ const Er = (e) => W(
2201
2206
  }), U(re), !1;
2202
2207
  }
2203
2208
  };
2204
- return /* @__PURE__ */ ke(Sr.Provider, { value: { state: s, dispatch: o }, children: /* @__PURE__ */ ke(
2205
- yt.Provider,
2209
+ return /* @__PURE__ */ ve(Sr.Provider, { value: { state: s, dispatch: o }, children: /* @__PURE__ */ ve(
2210
+ ft.Provider,
2206
2211
  {
2207
2212
  value: {
2208
2213
  ...s,
2209
- login: wt,
2210
- logout: Et,
2211
- getAccessToken: St,
2212
- getIdToken: At,
2213
- registeringForPasskey: Tt,
2214
- loginWithPasskey: Rt
2214
+ login: mt,
2215
+ logout: wt,
2216
+ getAccessToken: Et,
2217
+ getIdToken: St,
2218
+ registeringForPasskey: At,
2219
+ loginWithPasskey: Tt
2215
2220
  },
2216
2221
  children: e
2217
2222
  }
2218
2223
  ) });
2219
- }, Nr = (e = yt) => Nt(e);
2224
+ }, Nr = (e = ft) => Ot(e);
2220
2225
  export {
2221
- j as AUTH_TYPES,
2226
+ F as AUTH_TYPES,
2222
2227
  Or as AuthProvider,
2223
2228
  Pr as isGranted,
2224
2229
  Nr as useAuth