@versini/auth-provider 6.3.4 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 Q = (e, t, n) => vt(e, typeof t != "symbol" ? t + "" : t, n);
1
+ var vt = Object.defineProperty;
2
+ var Ct = (e, t, n) => t in e ? vt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var Q = (e, t, n) => Ct(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { jsx as ve } from "react/jsx-runtime";
5
- import Ct, { useSyncExternalStore as Pt, useCallback as x, useEffect as Ae, createContext as kt, useReducer as Ot, useRef as Ce, useContext as Nt } from "react";
5
+ import Pt, { useSyncExternalStore as kt, useCallback as x, useEffect as Ae, createContext as Ot, useReducer as Nt, useRef as Ce, useContext as Dt } from "react";
6
6
  /*!
7
- @versini/auth-provider v6.3.4
7
+ @versini/auth-provider v6.4.0
8
8
  © 2024 gizmette.com
9
9
  */
10
10
  try {
11
11
  window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
12
- version: "6.3.4",
13
- buildTime: "07/24/2024 07:31 PM EDT",
12
+ version: "6.4.0",
13
+ buildTime: "07/26/2024 07:51 PM EDT",
14
14
  homepage: "https://github.com/aversini/auth-client",
15
15
  license: "MIT"
16
16
  });
@@ -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 Ut({ error: e, options: t }) {
52
52
  const { publicKey: n } = t;
53
53
  if (!n)
54
54
  throw Error("options was missing required publicKey property");
@@ -125,7 +125,7 @@ function Dt({ error: e, options: t }) {
125
125
  }
126
126
  return e;
127
127
  }
128
- class Ut {
128
+ class $t {
129
129
  createNewAbortSignal() {
130
130
  if (this.controller) {
131
131
  const n = new Error("Cancelling existing WebAuthn API call for new one");
@@ -141,12 +141,12 @@ class Ut {
141
141
  }
142
142
  }
143
143
  }
144
- const je = new Ut(), $t = ["cross-platform", "platform"];
144
+ const je = new $t(), Kt = ["cross-platform", "platform"];
145
145
  function Fe(e) {
146
- if (e && !($t.indexOf(e) < 0))
146
+ if (e && !(Kt.indexOf(e) < 0))
147
147
  return e;
148
148
  }
149
- async function Kt(e) {
149
+ async function Ht(e) {
150
150
  if (!Te())
151
151
  throw new Error("WebAuthn is not supported in this browser");
152
152
  const n = { publicKey: {
@@ -163,7 +163,7 @@ async function Kt(e) {
163
163
  try {
164
164
  r = await navigator.credentials.create(n);
165
165
  } catch (y) {
166
- throw Dt({ error: y, options: n });
166
+ throw Ut({ error: y, options: n });
167
167
  }
168
168
  if (!r)
169
169
  throw new Error("Registration was not completed");
@@ -212,13 +212,13 @@ function fe(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 Ht() {
215
+ function Lt() {
216
216
  if (!Te())
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 Lt({ error: e, options: t }) {
221
+ function Wt({ error: e, options: t }) {
222
222
  const { publicKey: n } = t;
223
223
  if (!n)
224
224
  throw Error("options was missing required publicKey property");
@@ -259,7 +259,7 @@ function Lt({ error: e, options: t }) {
259
259
  }
260
260
  return e;
261
261
  }
262
- async function Wt(e, t = !1) {
262
+ async function xt(e, t = !1) {
263
263
  if (!Te())
264
264
  throw new Error("WebAuthn is not supported in this browser");
265
265
  let n;
@@ -270,7 +270,7 @@ async function Wt(e, t = !1) {
270
270
  allowCredentials: n
271
271
  }, a = {};
272
272
  if (t) {
273
- if (!await Ht())
273
+ if (!await Lt())
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');
@@ -281,7 +281,7 @@ async function Wt(e, t = !1) {
281
281
  try {
282
282
  s = await navigator.credentials.get(a);
283
283
  } catch (h) {
284
- throw Lt({ error: h, options: a });
284
+ throw Wt({ error: h, options: a });
285
285
  }
286
286
  if (!s)
287
287
  throw new Error("Authentication was not completed");
@@ -308,13 +308,13 @@ async function Wt(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/24/2024 07:31 PM EDT",
311
+ buildTime: "07/26/2024 07:51 PM EDT",
312
312
  homepage: "https://github.com/aversini/auth-client",
313
313
  license: "MIT"
314
314
  });
315
315
  } catch {
316
316
  }
317
- const F = {
317
+ const M = {
318
318
  ID_TOKEN: "id_token",
319
319
  ACCESS_TOKEN: "token",
320
320
  ID_AND_ACCESS_TOKEN: "id_token token",
@@ -334,7 +334,7 @@ const F = {
334
334
  CREATED_AT_KEY: "iat",
335
335
  SCOPES_KEY: "scopes",
336
336
  ISSUER: "gizmette.com"
337
- }, xt = `-----BEGIN PUBLIC KEY-----
337
+ }, Mt = `-----BEGIN PUBLIC KEY-----
338
338
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
339
339
  w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
340
340
  i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
@@ -347,23 +347,23 @@ awIDAQAB
347
347
  CODE: "code",
348
348
  LOGOUT: "logout"
349
349
  }, he = crypto, qe = (e) => e instanceof CryptoKey, X = new TextEncoder(), B = new TextDecoder();
350
- function Mt(...e) {
350
+ function Gt(...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 Gt = (e) => {
357
+ const Jt = (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
- }, j = (e) => {
362
+ }, F = (e) => {
363
363
  let t = e;
364
364
  t instanceof Uint8Array && (t = B.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
365
365
  try {
366
- return Gt(t);
366
+ return Jt(t);
367
367
  } catch {
368
368
  throw new TypeError("The input to be decoded is not correctly encoded.");
369
369
  }
@@ -391,7 +391,7 @@ let D = 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 Jt extends D {
394
+ class Yt extends D {
395
395
  constructor() {
396
396
  super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
397
397
  }
@@ -423,7 +423,7 @@ let P = class extends D {
423
423
  return "ERR_JWT_INVALID";
424
424
  }
425
425
  };
426
- class Yt extends D {
426
+ class Vt extends D {
427
427
  constructor() {
428
428
  super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
429
429
  }
@@ -440,7 +440,7 @@ function Z(e, t) {
440
440
  function ye(e) {
441
441
  return parseInt(e.name.slice(4), 10);
442
442
  }
443
- function Vt(e) {
443
+ function jt(e) {
444
444
  switch (e) {
445
445
  case "ES256":
446
446
  return "P-256";
@@ -452,7 +452,7 @@ function Vt(e) {
452
452
  throw new Error("unreachable");
453
453
  }
454
454
  }
455
- function jt(e, t) {
455
+ function Ft(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,7 +462,7 @@ function jt(e, t) {
462
462
  throw new TypeError(n);
463
463
  }
464
464
  }
465
- function Ft(e, t, ...n) {
465
+ function Bt(e, t, ...n) {
466
466
  switch (t) {
467
467
  case "HS256":
468
468
  case "HS384":
@@ -504,7 +504,7 @@ function Ft(e, t, ...n) {
504
504
  case "ES512": {
505
505
  if (!Z(e.algorithm, "ECDSA"))
506
506
  throw C("ECDSA");
507
- const r = Vt(t);
507
+ const r = jt(t);
508
508
  if (e.algorithm.namedCurve !== r)
509
509
  throw C(r, "algorithm.namedCurve");
510
510
  break;
@@ -512,7 +512,7 @@ function Ft(e, t, ...n) {
512
512
  default:
513
513
  throw new TypeError("CryptoKey does not support this operation");
514
514
  }
515
- jt(e, n);
515
+ Ft(e, n);
516
516
  }
517
517
  function ze(e, t, ...n) {
518
518
  var r;
@@ -526,7 +526,7 @@ const ke = (e, ...t) => ze("Key must be ", e, ...t);
526
526
  function Qe(e, t, ...n) {
527
527
  return ze(`Key for the ${e} algorithm must be `, t, ...n);
528
528
  }
529
- const Xe = (e) => qe(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", ce = ["CryptoKey"], Bt = (...e) => {
529
+ const Xe = (e) => qe(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", ce = ["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 Xe = (e) => qe(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", ce = ["C
545
545
  }
546
546
  return !0;
547
547
  };
548
- function qt(e) {
548
+ function zt(e) {
549
549
  return typeof e == "object" && e !== null;
550
550
  }
551
551
  function ue(e) {
552
- if (!qt(e) || Object.prototype.toString.call(e) !== "[object Object]")
552
+ if (!zt(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 zt = (e, t) => {
561
+ const Qt = (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 Qt(e) {
568
+ function Xt(e) {
569
569
  let t, n;
570
570
  switch (e.kty) {
571
571
  case "RSA": {
@@ -637,36 +637,36 @@ function Qt(e) {
637
637
  }
638
638
  return { algorithm: t, keyUsages: n };
639
639
  }
640
- const Xt = async (e) => {
640
+ const Zt = 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 } = Qt(e), r = [
643
+ const { algorithm: t, keyUsages: n } = Xt(e), r = [
644
644
  t,
645
645
  e.ext ?? !1,
646
646
  e.key_ops ?? n
647
647
  ], a = { ...e };
648
648
  return delete a.alg, delete a.use, he.subtle.importKey("jwk", a, ...r);
649
- }, Ze = (e) => j(e);
649
+ }, Ze = (e) => F(e);
650
650
  let ge, me;
651
651
  const et = (e) => e?.[Symbol.toStringTag] === "KeyObject", tt = 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 Xt({ ...n, alg: r });
655
+ const s = await Zt({ ...n, alg: r });
656
656
  return a ? a[r] = s : e.set(t, { [r]: s }), s;
657
- }, Zt = (e, t) => {
657
+ }, en = (e, t) => {
658
658
  if (et(e)) {
659
659
  let n = e.export({ format: "jwk" });
660
660
  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));
661
661
  }
662
662
  return e;
663
- }, en = (e, t) => {
663
+ }, tn = (e, t) => {
664
664
  if (et(e)) {
665
665
  let n = e.export({ format: "jwk" });
666
666
  return n.k ? Ze(n.k) : (ge || (ge = /* @__PURE__ */ new WeakMap()), tt(ge, e, n, t));
667
667
  }
668
668
  return e;
669
- }, tn = { normalizePublicKey: Zt, normalizePrivateKey: en }, k = (e, t, n = 0) => {
669
+ }, nn = { normalizePublicKey: en, normalizePrivateKey: tn }, k = (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)
@@ -692,7 +692,7 @@ const et = (e) => e?.[Symbol.toStringTag] === "KeyObject", tt = async (e, t, n,
692
692
  default:
693
693
  throw new O("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
694
694
  }
695
- }, nn = async (e, t, n, r, a) => {
695
+ }, rn = 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) {
@@ -739,20 +739,20 @@ const et = (e) => e?.[Symbol.toStringTag] === "KeyObject", tt = async (e, t, n,
739
739
  throw new O('Invalid or unsupported "alg" (Algorithm) value');
740
740
  }
741
741
  return he.subtle.importKey(t, i, s, !1, o);
742
- }, rn = (e, t, n) => nn(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
743
- async function an(e, t, n) {
742
+ }, an = (e, t, n) => rn(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
743
+ async function on(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 rn(e, t);
746
+ return an(e, t);
747
747
  }
748
- const se = (e) => e?.[Symbol.toStringTag], on = (e, t) => {
748
+ const se = (e) => e?.[Symbol.toStringTag], sn = (e, t) => {
749
749
  if (!(t instanceof Uint8Array)) {
750
750
  if (!Xe(t))
751
751
  throw new TypeError(Qe(e, t, ...ce, "Uint8Array"));
752
752
  if (t.type !== "secret")
753
753
  throw new TypeError(`${se(t)} instances for symmetric algorithms must be of type "secret"`);
754
754
  }
755
- }, sn = (e, t, n) => {
755
+ }, cn = (e, t, n) => {
756
756
  if (!Xe(t))
757
757
  throw new TypeError(Qe(e, t, ...ce));
758
758
  if (t.type === "secret")
@@ -761,10 +761,10 @@ const se = (e) => e?.[Symbol.toStringTag], on = (e, t) => {
761
761
  throw new TypeError(`${se(t)} instances for asymmetric algorithm verifying must be of type "public"`);
762
762
  if (t.algorithm && n === "encrypt" && t.type === "private")
763
763
  throw new TypeError(`${se(t)} instances for asymmetric algorithm encryption must be of type "public"`);
764
- }, cn = (e, t, n) => {
765
- e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? on(e, t) : sn(e, t, n);
764
+ }, un = (e, t, n) => {
765
+ e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? sn(e, t) : cn(e, t, n);
766
766
  };
767
- function un(e, t, n, r, a) {
767
+ function ln(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)
@@ -783,13 +783,13 @@ function un(e, t, n, r, a) {
783
783
  }
784
784
  return new Set(r.crit);
785
785
  }
786
- const ln = (e, t) => {
786
+ const dn = (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 dn(e, t) {
792
+ function hn(e, t) {
793
793
  const n = `SHA-${e.slice(-3)}`;
794
794
  switch (e) {
795
795
  case "HS256":
@@ -814,9 +814,9 @@ function dn(e, t) {
814
814
  throw new O(`alg ${e} is not supported either by JOSE or your javascript runtime`);
815
815
  }
816
816
  }
817
- async function hn(e, t, n) {
818
- if (t = await tn.normalizePublicKey(t, e), qe(t))
819
- return Ft(t, e, n), t;
817
+ async function pn(e, t, n) {
818
+ if (t = await nn.normalizePublicKey(t, e), qe(t))
819
+ return Bt(t, e, n), t;
820
820
  if (t instanceof Uint8Array) {
821
821
  if (!e.startsWith("HS"))
822
822
  throw new TypeError(ke(t, ...ce));
@@ -824,17 +824,17 @@ async function hn(e, t, n) {
824
824
  }
825
825
  throw new TypeError(ke(t, ...ce, "Uint8Array"));
826
826
  }
827
- const pn = async (e, t, n, r) => {
828
- const a = await hn(e, t, "verify");
829
- zt(e, a);
830
- const s = dn(e, a.algorithm);
827
+ const fn = async (e, t, n, r) => {
828
+ const a = await pn(e, t, "verify");
829
+ Qt(e, a);
830
+ const s = hn(e, a.algorithm);
831
831
  try {
832
832
  return await he.subtle.verify(s, a, n, r);
833
833
  } catch {
834
834
  return !1;
835
835
  }
836
836
  };
837
- async function fn(e, t, n) {
837
+ async function yn(e, t, n) {
838
838
  if (!ue(e))
839
839
  throw new S("Flattened JWS must be an object");
840
840
  if (e.protected === void 0 && e.header === void 0)
@@ -850,46 +850,46 @@ async function fn(e, t, n) {
850
850
  let r = {};
851
851
  if (e.protected)
852
852
  try {
853
- const u = j(e.protected);
853
+ const u = F(e.protected);
854
854
  r = JSON.parse(B.decode(u));
855
855
  } catch {
856
856
  throw new S("JWS Protected Header is invalid");
857
857
  }
858
- if (!Bt(r, e.header))
858
+ if (!qt(r, e.header))
859
859
  throw new S("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
860
860
  const a = {
861
861
  ...r,
862
862
  ...e.header
863
- }, s = un(S, /* @__PURE__ */ new Map([["b64", !0]]), n?.crit, r, a);
863
+ }, s = ln(S, /* @__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
866
  throw new S('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
869
  throw new S('JWS "alg" (Algorithm) Header Parameter missing or invalid');
870
- const c = n && ln("algorithms", n.algorithms);
870
+ const c = n && dn("algorithms", n.algorithms);
871
871
  if (c && !c.has(i))
872
- throw new Jt('"alg" (Algorithm) Header Parameter value not allowed');
872
+ throw new Yt('"alg" (Algorithm) Header Parameter value not allowed');
873
873
  if (o) {
874
874
  if (typeof e.payload != "string")
875
875
  throw new S("JWS Payload must be a string");
876
876
  } else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
877
877
  throw new S("JWS Payload must be a string or an Uint8Array instance");
878
878
  let g = !1;
879
- typeof t == "function" && (t = await t(r, e), g = !0), cn(i, t, "verify");
880
- const l = Mt(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), g = !0), un(i, t, "verify");
880
+ const l = Gt(X.encode(e.protected ?? ""), X.encode("."), typeof e.payload == "string" ? X.encode(e.payload) : e.payload);
881
881
  let h;
882
882
  try {
883
- h = j(e.signature);
883
+ h = F(e.signature);
884
884
  } catch {
885
885
  throw new S("Failed to base64url decode the signature");
886
886
  }
887
- if (!await pn(i, t, h, l))
888
- throw new Yt();
887
+ if (!await fn(i, t, h, l))
888
+ throw new Vt();
889
889
  let y;
890
890
  if (o)
891
891
  try {
892
- y = j(e.payload);
892
+ y = F(e.payload);
893
893
  } catch {
894
894
  throw new S("Failed to base64url decode the payload");
895
895
  }
@@ -897,17 +897,17 @@ async function fn(e, t, n) {
897
897
  const p = { payload: y };
898
898
  return e.protected !== void 0 && (p.protectedHeader = r), e.header !== void 0 && (p.unprotectedHeader = e.header), g ? { ...p, key: t } : p;
899
899
  }
900
- async function yn(e, t, n) {
900
+ async function gn(e, t, n) {
901
901
  if (e instanceof Uint8Array && (e = B.decode(e)), typeof e != "string")
902
902
  throw new S("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
905
  throw new S("Invalid Compact JWS");
906
- const i = await fn({ payload: a, protected: r, signature: s }, t, n), c = { payload: i.payload, protectedHeader: i.protectedHeader };
906
+ const i = await yn({ 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 gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt * 24, mn = Re * 7, wn = Re * 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, Ne = (e) => {
910
- const t = En.exec(e);
909
+ const mn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt * 24, wn = Re * 7, En = Re * 365.25, Sn = /^(\+|\-)? ?(\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) => {
910
+ const t = Sn.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();
@@ -942,14 +942,14 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt
942
942
  case "week":
943
943
  case "weeks":
944
944
  case "w":
945
- a = Math.round(n * mn);
945
+ a = Math.round(n * wn);
946
946
  break;
947
947
  default:
948
- a = Math.round(n * wn);
948
+ a = Math.round(n * En);
949
949
  break;
950
950
  }
951
951
  return t[1] === "-" || t[4] === "ago" ? -a : a;
952
- }, De = (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 = {}) => {
952
+ }, De = (e) => e.toLowerCase().replace(/^application\//, ""), An = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, Tn = (e, t, n = {}) => {
953
953
  let r;
954
954
  try {
955
955
  r = JSON.parse(B.decode(t));
@@ -969,7 +969,7 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt
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 && !Sn(r.aud, typeof c == "string" ? [c] : c))
972
+ if (c && !An(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) {
@@ -985,7 +985,7 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt
985
985
  default:
986
986
  throw new TypeError("Invalid clockTolerance option type");
987
987
  }
988
- const { currentDate: y } = n, p = gn(y || /* @__PURE__ */ new Date());
988
+ const { currentDate: y } = n, p = mn(y || /* @__PURE__ */ new Date());
989
989
  if ((r.iat !== void 0 || g) && typeof r.iat != "number")
990
990
  throw new _('"iat" claim must be a number', r, "iat", "invalid");
991
991
  if (r.nbf !== void 0) {
@@ -1009,16 +1009,16 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt
1009
1009
  }
1010
1010
  return r;
1011
1011
  };
1012
- async function Tn(e, t, n) {
1012
+ async function Rn(e, t, n) {
1013
1013
  var r;
1014
- const a = await yn(e, t, n);
1014
+ const a = await gn(e, t, n);
1015
1015
  if ((r = a.protectedHeader.crit) != null && r.includes("b64") && a.protectedHeader.b64 === !1)
1016
1016
  throw new P("JWTs MUST NOT use unencoded payload");
1017
- const s = { payload: An(a.protectedHeader, a.payload, n), protectedHeader: a.protectedHeader };
1017
+ const s = { payload: Tn(a.protectedHeader, a.payload, n), protectedHeader: a.protectedHeader };
1018
1018
  return typeof t == "function" ? { ...s, key: a.key } : s;
1019
1019
  }
1020
- const Rn = j;
1021
- function bn(e) {
1020
+ const bn = F;
1021
+ function In(e) {
1022
1022
  if (typeof e != "string")
1023
1023
  throw new P("JWTs must use Compact JWS serialization, JWT must be a string");
1024
1024
  const { 1: t, length: n } = e.split(".");
@@ -1030,7 +1030,7 @@ function bn(e) {
1030
1030
  throw new P("JWTs must contain a payload");
1031
1031
  let r;
1032
1032
  try {
1033
- r = Rn(t);
1033
+ r = bn(t);
1034
1034
  } catch {
1035
1035
  throw new P("Failed to base64url decode the payload");
1036
1036
  }
@@ -1044,18 +1044,18 @@ function bn(e) {
1044
1044
  throw new P("Invalid JWT Claims Set");
1045
1045
  return a;
1046
1046
  }
1047
- const M = async (e) => {
1047
+ const G = async (e) => {
1048
1048
  try {
1049
- const t = A.ALG, n = await an(xt, t);
1050
- return await Tn(e, n, {
1049
+ const t = A.ALG, n = await on(Mt, t);
1050
+ return await Rn(e, n, {
1051
1051
  issuer: A.ISSUER
1052
1052
  });
1053
1053
  } catch {
1054
1054
  return;
1055
1055
  }
1056
- }, In = (e) => {
1056
+ }, _n = (e) => {
1057
1057
  try {
1058
- return bn(e);
1058
+ return In(e);
1059
1059
  } catch {
1060
1060
  return;
1061
1061
  }
@@ -1063,47 +1063,47 @@ const M = async (e) => {
1063
1063
  var w = [];
1064
1064
  for (var we = 0; we < 256; ++we)
1065
1065
  w.push((we + 256).toString(16).slice(1));
1066
- function _n(e, t = 0) {
1066
+ function vn(e, t = 0) {
1067
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();
1068
1068
  }
1069
- var ee, vn = new Uint8Array(16);
1070
- function Cn() {
1069
+ var ee, Cn = new Uint8Array(16);
1070
+ function Pn() {
1071
1071
  if (!ee && (ee = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ee))
1072
1072
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1073
- return ee(vn);
1073
+ return ee(Cn);
1074
1074
  }
1075
- var Pn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1075
+ var kn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1076
1076
  const Ue = {
1077
- randomUUID: Pn
1077
+ randomUUID: kn
1078
1078
  };
1079
1079
  function $e(e, t, n) {
1080
1080
  if (Ue.randomUUID && !t && !e)
1081
1081
  return Ue.randomUUID();
1082
1082
  e = e || {};
1083
- var r = e.random || (e.rng || Cn)();
1084
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, _n(r);
1083
+ var r = e.random || (e.rng || Pn)();
1084
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, vn(r);
1085
1085
  }
1086
- const Ke = globalThis.crypto, kn = (e) => `${$e()}${$e()}`.slice(0, e), On = (e) => btoa(
1086
+ const Ke = globalThis.crypto, On = (e) => `${$e()}${$e()}`.slice(0, e), Nn = (e) => btoa(
1087
1087
  [...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
1088
1088
  );
1089
- async function Nn(e) {
1089
+ async function Dn(e) {
1090
1090
  if (!Ke.subtle)
1091
1091
  throw new Error(
1092
1092
  "crypto.subtle is available only in secure contexts (HTTPS)."
1093
1093
  );
1094
1094
  const t = new TextEncoder().encode(e), n = await Ke.subtle.digest("SHA-256", t);
1095
- return On(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1095
+ return Nn(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1096
1096
  }
1097
- async function Dn(e) {
1098
- const n = kn(43), r = await Nn(n);
1097
+ async function Un(e) {
1098
+ const n = On(43), r = await Dn(n);
1099
1099
  return {
1100
1100
  code_verifier: n,
1101
1101
  code_challenge: r
1102
1102
  };
1103
1103
  }
1104
- const Nr = async (e, t) => {
1104
+ const Dr = async (e, t) => {
1105
1105
  var n;
1106
- const r = await M(e);
1106
+ const r = await G(e);
1107
1107
  if (!r || !Array.isArray((n = r.payload) == null ? void 0 : n[A.SCOPES_KEY]))
1108
1108
  return !1;
1109
1109
  const a = r.payload[A.SCOPES_KEY];
@@ -1119,18 +1119,18 @@ const He = (e, t) => {
1119
1119
  typeof t == "function" ? t() : t
1120
1120
  );
1121
1121
  window.localStorage.setItem(e, n), at(e, n);
1122
- }, Un = (e) => {
1122
+ }, $n = (e) => {
1123
1123
  window.localStorage.removeItem(e), at(e, null);
1124
- }, Le = (e) => window.localStorage.getItem(e), $n = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1124
+ }, Le = (e) => window.localStorage.getItem(e), Kn = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1125
1125
  function te({
1126
1126
  key: e,
1127
1127
  initialValue: t
1128
1128
  }) {
1129
- const n = Pt($n, () => Le(e)), r = x(
1129
+ const n = kt(Kn, () => Le(e)), r = x(
1130
1130
  (o) => {
1131
1131
  try {
1132
1132
  const i = typeof o == "function" ? o(JSON.parse(n)) : o;
1133
- i == null ? Un(e) : He(e, i);
1133
+ i == null ? $n(e) : He(e, i);
1134
1134
  } catch (i) {
1135
1135
  console.warn(i);
1136
1136
  }
@@ -1152,30 +1152,30 @@ function te({
1152
1152
  var E = [];
1153
1153
  for (var Ee = 0; Ee < 256; ++Ee)
1154
1154
  E.push((Ee + 256).toString(16).slice(1));
1155
- function Kn(e, t = 0) {
1155
+ function Hn(e, t = 0) {
1156
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();
1157
1157
  }
1158
- var ne, Hn = new Uint8Array(16);
1159
- function Ln() {
1158
+ var ne, Ln = new Uint8Array(16);
1159
+ function Wn() {
1160
1160
  if (!ne && (ne = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ne))
1161
1161
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1162
- return ne(Hn);
1162
+ return ne(Ln);
1163
1163
  }
1164
- var Wn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1164
+ var xn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1165
1165
  const We = {
1166
- randomUUID: Wn
1166
+ randomUUID: xn
1167
1167
  };
1168
1168
  function Se(e, t, n) {
1169
1169
  if (We.randomUUID && !t && !e)
1170
1170
  return We.randomUUID();
1171
1171
  e = e || {};
1172
- var r = e.random || (e.rng || Ln)();
1173
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Kn(r);
1172
+ var r = e.random || (e.rng || Wn)();
1173
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Hn(r);
1174
1174
  }
1175
- const $ = "Oops! It looks like your session has expired. For your security, please log in again to continue.", xn = "Your session has been successfully terminated.", re = "Login failed. Please try again.", Mn = "Error getting access token, please re-authenticate.", Gn = "You forgot to wrap your component in <AuthProvider>.", le = {
1175
+ const $ = "Oops! It looks like your session has expired. For your security, please log in again to continue.", Mn = "Your session has been successfully terminated.", re = "Login failed. Please try again.", Gn = "Error getting access token, please re-authenticate.", Jn = "You forgot to wrap your component in <AuthProvider>.", le = {
1176
1176
  dev: "https://auth.gizmette.local.com:3003",
1177
1177
  prod: "https://mylogin.gizmette.com/auth"
1178
- }, ae = "@@auth@@", Y = "LOADING", V = "LOGIN", ot = "LOGOUT", Jn = "success", xe = "failure";
1178
+ }, ae = "@@auth@@", V = "LOADING", j = "LOGIN", ot = "LOGOUT", Yn = "success", xe = "failure";
1179
1179
  /*!
1180
1180
  @versini/ui-fingerprint v1.0.1
1181
1181
  © 2024 gizmette.com
@@ -1189,7 +1189,7 @@ try {
1189
1189
  });
1190
1190
  } catch {
1191
1191
  }
1192
- const Yn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join(""), st = async (e) => {
1192
+ const Vn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join(""), st = 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);
@@ -1198,7 +1198,7 @@ const Yn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join
1198
1198
  function Me(e, t) {
1199
1199
  return new Promise((n) => setTimeout(n, e, t));
1200
1200
  }
1201
- async function Vn(e, t, n = 50) {
1201
+ async function jn(e, t, n = 50) {
1202
1202
  var r, a, s;
1203
1203
  const o = document;
1204
1204
  for (; !o.body; )
@@ -1227,14 +1227,14 @@ async function Vn(e, t, n = 50) {
1227
1227
  (s = i.parentNode) == null || s.removeChild(i);
1228
1228
  }
1229
1229
  }
1230
- const jn = {
1230
+ const Fn = {
1231
1231
  audio: {
1232
1232
  sampleHash: "",
1233
1233
  oscillator: "",
1234
1234
  maxChannels: 0,
1235
1235
  channelCountMode: ""
1236
1236
  }
1237
- }, Fn = async (e) => new Promise((t) => {
1237
+ }, Bn = async (e) => new Promise((t) => {
1238
1238
  try {
1239
1239
  const n = new window.OfflineAudioContext(1, 5e3, 44100), r = n.createBufferSource(), a = n.createOscillator();
1240
1240
  a.frequency.value = 1e3;
@@ -1243,7 +1243,7 @@ const jn = {
1243
1243
  const i = o.renderedBuffer.getChannelData(0);
1244
1244
  a.disconnect(), s.disconnect(), t({
1245
1245
  audio: {
1246
- sampleHash: Yn(i),
1246
+ sampleHash: Vn(i),
1247
1247
  oscillator: a.type,
1248
1248
  maxChannels: n.destination.maxChannelCount,
1249
1249
  channelCountMode: r.channelCountMode
@@ -1260,16 +1260,16 @@ const jn = {
1260
1260
  }
1261
1261
  });
1262
1262
  }
1263
- }), it = { browser: "" }, Bn = async (e) => typeof navigator > "u" ? it : { browser: navigator.userAgent }, ct = {
1263
+ }), it = { browser: "" }, qn = async (e) => typeof navigator > "u" ? it : { browser: navigator.userAgent }, ct = {
1264
1264
  canvas: {
1265
1265
  data: ""
1266
1266
  }
1267
- }, qn = async (e) => {
1267
+ }, zn = async (e) => {
1268
1268
  try {
1269
1269
  const t = Array.from(
1270
1270
  { length: 3 },
1271
- () => zn(300, 30)
1272
- ), n = Xn(t, 300, 30);
1271
+ () => Qn(300, 30)
1272
+ ), n = Zn(t, 300, 30);
1273
1273
  return {
1274
1274
  canvas: {
1275
1275
  data: (await st(n.data.toString())).toString()
@@ -1278,7 +1278,7 @@ const jn = {
1278
1278
  } catch {
1279
1279
  return ct;
1280
1280
  }
1281
- }, zn = (e, t) => {
1281
+ }, Qn = (e, t) => {
1282
1282
  const n = document.createElement("canvas"), r = n.getContext("2d");
1283
1283
  if (!r)
1284
1284
  return new ImageData(1, 1);
@@ -1287,7 +1287,7 @@ const jn = {
1287
1287
  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);
1288
1288
  const s = "mmMwWLliI0O&1 - Les sanglots longs des violons de l'automne blessent mon coeur d'une langueur monotone";
1289
1289
  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);
1290
- }, Qn = (e) => {
1290
+ }, Xn = (e) => {
1291
1291
  if (e.length === 0)
1292
1292
  return 0;
1293
1293
  const t = {};
@@ -1297,17 +1297,17 @@ const jn = {
1297
1297
  for (const r in t)
1298
1298
  t[r] > t[n] && (n = parseInt(r, 10));
1299
1299
  return n;
1300
- }, Xn = (e, t, n) => {
1300
+ }, Zn = (e, t, n) => {
1301
1301
  const r = [];
1302
1302
  for (let o = 0; o < e[0].data.length; o++) {
1303
1303
  const i = [];
1304
1304
  for (let c = 0; c < e.length; c++)
1305
1305
  i.push(e[c].data[o]);
1306
- r.push(Qn(i));
1306
+ r.push(Xn(i));
1307
1307
  }
1308
1308
  const a = r, s = new Uint8ClampedArray(a);
1309
1309
  return new ImageData(s, t, n);
1310
- }, Zn = [], er = "mmMwWLliI0O&1", tr = "48px", K = ["monospace", "sans-serif", "serif"], Ge = [
1310
+ }, er = [], tr = "mmMwWLliI0O&1", nr = "48px", K = ["monospace", "sans-serif", "serif"], Ge = [
1311
1311
  "sans-serif-thin",
1312
1312
  "ARNO PRO",
1313
1313
  "Agency FB",
@@ -1345,14 +1345,14 @@ const jn = {
1345
1345
  "TRAJAN PRO",
1346
1346
  "Univers CE 55 Medium",
1347
1347
  "ZWAdobeF"
1348
- ], nr = async (e) => Vn(async (t, { document: n }) => {
1348
+ ], rr = async (e) => jn(async (t, { document: n }) => {
1349
1349
  const r = n.body;
1350
- r.style.fontSize = tr;
1350
+ r.style.fontSize = nr;
1351
1351
  const a = n.createElement("div");
1352
1352
  a.style.setProperty("visibility", "hidden", "important");
1353
1353
  const s = {}, o = {}, i = (u) => {
1354
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 = er, a.appendChild(m), m;
1355
+ return T.position = "absolute", T.top = "0", T.left = "0", T.fontFamily = u, m.textContent = tr, a.appendChild(m), m;
1356
1356
  }, c = (u, m) => i(`'${u}',${m}`), g = () => K.map(i), l = () => {
1357
1357
  const u = {};
1358
1358
  for (const m of Ge)
@@ -1382,7 +1382,7 @@ const jn = {
1382
1382
  jsHeapSizeLimit: 0
1383
1383
  }
1384
1384
  };
1385
- function rr() {
1385
+ function ar() {
1386
1386
  const e = document.createElement("canvas"), t = e.getContext("webgl") ?? e.getContext("experimental-webgl");
1387
1387
  if (t && "getParameter" in t) {
1388
1388
  const n = t.getExtension("WEBGL_debug_renderer_info");
@@ -1397,19 +1397,19 @@ function rr() {
1397
1397
  }
1398
1398
  return ut;
1399
1399
  }
1400
- function ar() {
1400
+ function or() {
1401
1401
  const e = new Float32Array(1), t = new Uint8Array(e.buffer);
1402
1402
  return e[0] = 1 / 0, e[0] = e[0] - e[0], t[3];
1403
1403
  }
1404
- const or = () => navigator.deviceMemory || 0, sr = () => window.performance && window.performance.memory || {
1404
+ const sr = () => navigator.deviceMemory || 0, ir = () => window.performance && window.performance.memory || {
1405
1405
  jsHeapSizeLimit: 0
1406
- }, ir = async (e) => new Promise((t) => {
1406
+ }, cr = async (e) => new Promise((t) => {
1407
1407
  try {
1408
- const n = or(), r = sr();
1408
+ const n = sr(), r = ir();
1409
1409
  t({
1410
1410
  hardware: {
1411
- videocard: rr(),
1412
- architecture: ar(),
1411
+ videocard: ar(),
1412
+ architecture: or(),
1413
1413
  deviceMemory: n.toString() || "undefined",
1414
1414
  jsHeapSizeLimit: r.jsHeapSizeLimit || 0
1415
1415
  }
@@ -1417,12 +1417,12 @@ const or = () => navigator.deviceMemory || 0, sr = () => window.performance && w
1417
1417
  } catch {
1418
1418
  t(lt);
1419
1419
  }
1420
- }), cr = {
1420
+ }), ur = {
1421
1421
  locales: {
1422
1422
  languages: "",
1423
1423
  timezone: ""
1424
1424
  }
1425
- }, ur = async (e) => new Promise((t) => {
1425
+ }, lr = async (e) => new Promise((t) => {
1426
1426
  t({
1427
1427
  locales: {
1428
1428
  languages: navigator.language,
@@ -1437,7 +1437,7 @@ const or = () => navigator.deviceMemory || 0, sr = () => window.performance && w
1437
1437
  maxTouchPoints: 0,
1438
1438
  mediaMatches: []
1439
1439
  }
1440
- }, lr = async (e) => new Promise((t) => {
1440
+ }, dr = async (e) => new Promise((t) => {
1441
1441
  try {
1442
1442
  const n = window.screen, r = {
1443
1443
  screen: {
@@ -1445,7 +1445,7 @@ const or = () => navigator.deviceMemory || 0, sr = () => window.performance && w
1445
1445
  pixelDepth: n.pixelDepth,
1446
1446
  isTouchScreen: navigator.maxTouchPoints > 0,
1447
1447
  maxTouchPoints: navigator.maxTouchPoints,
1448
- mediaMatches: dr()
1448
+ mediaMatches: hr()
1449
1449
  }
1450
1450
  };
1451
1451
  t(r);
@@ -1453,7 +1453,7 @@ const or = () => navigator.deviceMemory || 0, sr = () => window.performance && w
1453
1453
  t(dt);
1454
1454
  }
1455
1455
  });
1456
- function dr() {
1456
+ function hr() {
1457
1457
  const e = [], t = {
1458
1458
  "prefers-contrast": [
1459
1459
  "high",
@@ -1481,7 +1481,7 @@ function dr() {
1481
1481
  });
1482
1482
  }), e;
1483
1483
  }
1484
- const hr = async (e) => {
1484
+ const pr = async (e) => {
1485
1485
  try {
1486
1486
  return {
1487
1487
  system: {
@@ -1501,33 +1501,33 @@ const hr = async (e) => {
1501
1501
  productSub: "",
1502
1502
  product: ""
1503
1503
  }
1504
- }, pr = async (e) => {
1504
+ }, fr = async (e) => {
1505
1505
  try {
1506
1506
  return Promise.all([
1507
- Fn(e),
1508
- Bn(),
1509
- qn(e),
1510
- nr(),
1511
- ir(e),
1512
- ur(),
1513
- lr(e),
1514
- hr(e)
1507
+ Bn(e),
1508
+ qn(),
1509
+ zn(e),
1510
+ rr(),
1511
+ cr(e),
1512
+ lr(),
1513
+ dr(e),
1514
+ pr(e)
1515
1515
  ]);
1516
1516
  } catch {
1517
1517
  return [
1518
- jn,
1518
+ Fn,
1519
1519
  it,
1520
1520
  ct,
1521
- Zn,
1521
+ er,
1522
1522
  lt,
1523
- cr,
1523
+ ur,
1524
1524
  dt,
1525
1525
  ht
1526
1526
  ];
1527
1527
  }
1528
- }, fr = async (e) => {
1528
+ }, yr = async (e) => {
1529
1529
  try {
1530
- const t = await pr(e);
1530
+ const t = await fr(e);
1531
1531
  return await st(JSON.stringify(t));
1532
1532
  } catch {
1533
1533
  return "";
@@ -1691,14 +1691,21 @@ const hr = async (e) => {
1691
1691
  } catch (r) {
1692
1692
  return console.error(r), { status: 500, data: [] };
1693
1693
  }
1694
- }, yr = process.env.NODE_ENV === "production", pt = !yr, gr = (e) => {
1694
+ }, gr = process.env.NODE_ENV === "production", pt = !gr, ft = {
1695
+ isLoading: !0,
1696
+ isAuthenticated: !1,
1697
+ authenticationType: null,
1698
+ user: void 0,
1699
+ logoutReason: "",
1700
+ debug: !1
1701
+ }, mr = (e) => {
1695
1702
  try {
1696
- const t = In(e);
1703
+ const t = _n(e);
1697
1704
  return t ? t[A.USER_ID_KEY] : "";
1698
1705
  } catch {
1699
1706
  return "";
1700
1707
  }
1701
- }, mr = async ({
1708
+ }, wr = async ({
1702
1709
  userId: e,
1703
1710
  idToken: t,
1704
1711
  accessToken: n,
@@ -1742,7 +1749,7 @@ const hr = async (e) => {
1742
1749
  type: de.AUTHENTICATE,
1743
1750
  clientId: n,
1744
1751
  params: {
1745
- type: a || F.ID_AND_ACCESS_TOKEN,
1752
+ type: a || M.ID_AND_ACCESS_TOKEN,
1746
1753
  username: e,
1747
1754
  password: t,
1748
1755
  sessionExpiration: s,
@@ -1752,7 +1759,7 @@ const hr = async (e) => {
1752
1759
  domain: c,
1753
1760
  fingerprint: g
1754
1761
  }
1755
- }), h = await M(l?.data?.idToken);
1762
+ }), h = await G(l?.data?.idToken);
1756
1763
  return h && h.payload[A.USER_ID_KEY] !== "" && h.payload[A.NONCE_KEY] === r ? {
1757
1764
  idToken: l.data.idToken,
1758
1765
  accessToken: l.data.accessToken,
@@ -1767,7 +1774,7 @@ const hr = async (e) => {
1767
1774
  status: !1
1768
1775
  };
1769
1776
  }
1770
- }, wr = async ({
1777
+ }, Er = async ({
1771
1778
  nonce: e,
1772
1779
  clientId: t,
1773
1780
  code_challenge: n
@@ -1777,7 +1784,7 @@ const hr = async (e) => {
1777
1784
  type: de.CODE,
1778
1785
  clientId: t,
1779
1786
  params: {
1780
- type: F.CODE,
1787
+ type: M.CODE,
1781
1788
  nonce: e,
1782
1789
  code_challenge: n
1783
1790
  }
@@ -1793,7 +1800,7 @@ const hr = async (e) => {
1793
1800
  status: !1
1794
1801
  };
1795
1802
  }
1796
- }, Er = async ({
1803
+ }, Sr = async ({
1797
1804
  clientId: e,
1798
1805
  userId: t,
1799
1806
  nonce: n,
@@ -1806,15 +1813,15 @@ const hr = async (e) => {
1806
1813
  type: de.AUTHENTICATE,
1807
1814
  clientId: e,
1808
1815
  params: {
1809
- type: F.REFRESH_TOKEN,
1816
+ type: M.REFRESH_TOKEN,
1810
1817
  userId: t,
1811
1818
  nonce: n,
1812
1819
  refreshToken: r,
1813
1820
  accessToken: a,
1814
1821
  domain: s,
1815
- fingerprint: await ft()
1822
+ fingerprint: await yt()
1816
1823
  }
1817
- }), i = await M(o?.data?.accessToken);
1824
+ }), i = await G(o?.data?.accessToken);
1818
1825
  return i && i.payload[A.USER_ID_KEY] !== "" && i.payload[A.NONCE_KEY] === n ? {
1819
1826
  accessToken: o.data.accessToken,
1820
1827
  refreshToken: o.data.refreshToken,
@@ -1828,14 +1835,14 @@ const hr = async (e) => {
1828
1835
  status: !1
1829
1836
  };
1830
1837
  }
1831
- }, ft = async () => {
1838
+ }, yt = async () => {
1832
1839
  try {
1833
- return await fr();
1840
+ return await yr();
1834
1841
  } catch {
1835
1842
  return "";
1836
1843
  }
1837
1844
  };
1838
- class Sr {
1845
+ class Ar {
1839
1846
  constructor(t = null, n = null) {
1840
1847
  Q(this, "refreshTokenPromise", null);
1841
1848
  Q(this, "accessToken");
@@ -1866,9 +1873,9 @@ class Sr {
1866
1873
  nonce: r,
1867
1874
  domain: a
1868
1875
  }) {
1869
- const s = await M(this.refreshToken);
1876
+ const s = await G(this.refreshToken);
1870
1877
  if (s && s.payload[A.USER_ID_KEY] !== "") {
1871
- const o = await Er({
1878
+ const o = await Sr({
1872
1879
  clientId: t,
1873
1880
  userId: n,
1874
1881
  nonce: r,
@@ -1877,7 +1884,7 @@ class Sr {
1877
1884
  domain: a
1878
1885
  });
1879
1886
  return o.status ? (this.accessToken = o.accessToken, this.refreshToken = o.refreshToken, {
1880
- status: Jn,
1887
+ status: Yn,
1881
1888
  newAccessToken: o.accessToken,
1882
1889
  newRefreshToken: o.refreshToken
1883
1890
  }) : {
@@ -1889,14 +1896,14 @@ class Sr {
1889
1896
  };
1890
1897
  }
1891
1898
  }
1892
- const Ar = (e) => x(
1899
+ const Tr = (e) => x(
1893
1900
  (...t) => {
1894
1901
  e && console.info(`==> [Auth ${Date.now()}]: `, ...t);
1895
1902
  },
1896
1903
  [e]
1897
1904
  ), W = () => {
1898
- throw new Error(Gn);
1899
- }, yt = kt({
1905
+ throw new Error(Jn);
1906
+ }, gt = Ot({
1900
1907
  isAuthenticated: !1,
1901
1908
  isLoading: !1,
1902
1909
  authenticationType: null,
@@ -1907,21 +1914,14 @@ const Ar = (e) => x(
1907
1914
  registeringForPasskey: W,
1908
1915
  loginWithPasskey: W,
1909
1916
  logoutReason: ""
1910
- }), Tr = Ct.createContext({
1911
- state: {
1912
- isLoading: !0,
1913
- isAuthenticated: !1,
1914
- authenticationType: null,
1915
- user: void 0,
1916
- logoutReason: "",
1917
- debug: !1
1918
- },
1917
+ }), Rr = Pt.createContext({
1918
+ state: ft,
1919
1919
  dispatch: () => {
1920
1920
  }
1921
- }), Rr = (e, t) => t?.type === Y ? {
1921
+ }), br = (e, t) => t?.type === V ? {
1922
1922
  ...e,
1923
1923
  isLoading: t.payload.isLoading
1924
- } : t?.type === V ? {
1924
+ } : t?.type === j ? {
1925
1925
  ...e,
1926
1926
  isLoading: !1,
1927
1927
  isAuthenticated: !0,
@@ -1935,21 +1935,17 @@ const Ar = (e) => x(
1935
1935
  user: void 0,
1936
1936
  authenticationType: null,
1937
1937
  logoutReason: t.payload.logoutReason
1938
- } : e, Dr = ({
1938
+ } : e, Ur = ({
1939
1939
  children: e,
1940
1940
  sessionExpiration: t,
1941
1941
  clientId: n,
1942
1942
  domain: r = "",
1943
1943
  debug: a = !1
1944
1944
  }) => {
1945
- const [s, o] = Ot(Rr, {
1946
- isLoading: !0,
1947
- isAuthenticated: !1,
1948
- authenticationType: null,
1949
- user: void 0,
1950
- logoutReason: "",
1945
+ const [s, o] = Nt(br, {
1946
+ ...ft,
1951
1947
  debug: a
1952
- }), i = Ar(a), c = Ce(!1), g = Ce(""), [l, h, , y] = te({
1948
+ }), i = Tr(a), c = Ce(!1), g = Ce(""), [l, h, , y] = te({
1953
1949
  key: `${ae}::${n}::@@user@@`
1954
1950
  }), [p, u, , m] = te({
1955
1951
  key: `${ae}::${n}::@@access@@`
@@ -1957,9 +1953,9 @@ const Ar = (e) => x(
1957
1953
  {
1958
1954
  key: `${ae}::${n}::@@refresh@@`
1959
1955
  }
1960
- ), [gt, be, , Ie] = te({
1956
+ ), [mt, be, , Ie] = te({
1961
1957
  key: `${ae}::${n}::@@nonce@@`
1962
- }), mt = new Sr(p, T), U = x(
1958
+ }), wt = new Ar(p, T), U = x(
1963
1959
  (d) => {
1964
1960
  i(
1965
1961
  "removeStateAndLocalStorage: removing state and local storage with reason: ",
@@ -1969,16 +1965,16 @@ const Ar = (e) => x(
1969
1965
  payload: {
1970
1966
  logoutReason: d || $
1971
1967
  }
1972
- }), y(), m(), z(), Ie(), o({ type: Y, payload: { isLoading: !1 } });
1968
+ }), y(), m(), z(), Ie(), o({ type: V, payload: { isLoading: !1 } });
1973
1969
  },
1974
1970
  [m, y, Ie, z, i]
1975
1971
  ), N = x(
1976
1972
  async (d) => {
1977
1973
  i("invalidateAndLogout: invalidating and logging out");
1978
- const { user: R } = s, f = R?.userId || gr(l);
1974
+ const { user: R } = s, f = R?.userId || mr(l);
1979
1975
  f || i(
1980
1976
  "invalidateAndLogout: user cannot be identified, logging out without userId"
1981
- ), await mr({
1977
+ ), await wr({
1982
1978
  userId: f,
1983
1979
  idToken: l,
1984
1980
  accessToken: p,
@@ -1998,15 +1994,15 @@ const Ar = (e) => x(
1998
1994
  i
1999
1995
  ]
2000
1996
  );
2001
- Ae(() => ((async () => (i("useEffect: setting the fingerprint"), g.current = await ft()))(), () => {
2002
- i("useEffect: cleaning up the fingerprint"), g.current = "";
1997
+ Ae(() => ((async () => g.current = await yt())(), () => {
1998
+ g.current = "";
2003
1999
  }), []), Ae(() => {
2004
2000
  if (!c.current)
2005
2001
  return s.isLoading && l !== null ? (async () => {
2006
2002
  try {
2007
- const d = await M(l);
2003
+ const d = await G(l);
2008
2004
  d && d.payload[A.USER_ID_KEY] !== "" ? (i("useEffect: setting the authentication state"), o({
2009
- type: V,
2005
+ type: j,
2010
2006
  payload: {
2011
2007
  authenticationType: d.payload[A.AUTH_TYPE_KEY],
2012
2008
  user: {
@@ -2020,20 +2016,20 @@ const Ar = (e) => x(
2020
2016
  "useEffect: exception validating JWT, invalidating and logging out"
2021
2017
  ), await N($);
2022
2018
  }
2023
- })() : (i("useEffect: setting the loading state to false"), o({ type: Y, payload: { isLoading: !1 } })), () => {
2019
+ })() : (i("useEffect: setting the loading state to false"), o({ type: V, payload: { isLoading: !1 } })), () => {
2024
2020
  c.current = !0;
2025
2021
  };
2026
2022
  }, [s.isLoading, l, N, i]);
2027
- const wt = async (d, R, f) => {
2023
+ const Et = async (d, R, f = M.CODE) => {
2028
2024
  const I = Se();
2029
- if (be(I), o({ type: Y, payload: { isLoading: !0 } }), y(), m(), z(), i("login: Logging in with type: ", f), f === F.CODE) {
2030
- const { code_verifier: bt, code_challenge: It } = await Dn(), _e = await wr({
2025
+ if (be(I), o({ type: V, payload: { isLoading: !0 } }), y(), m(), z(), i("login: Logging in with type: ", f), f === M.CODE) {
2026
+ const { code_verifier: It, code_challenge: _t } = await Un(), _e = await Er({
2031
2027
  nonce: I,
2032
2028
  clientId: n,
2033
- code_challenge: It
2029
+ code_challenge: _t
2034
2030
  });
2035
2031
  if (_e.status) {
2036
- const J = await Je({
2032
+ const Y = await Je({
2037
2033
  username: d,
2038
2034
  password: R,
2039
2035
  clientId: n,
@@ -2041,16 +2037,16 @@ const Ar = (e) => x(
2041
2037
  nonce: I,
2042
2038
  type: f,
2043
2039
  code: _e.code,
2044
- code_verifier: bt,
2040
+ code_verifier: It,
2045
2041
  domain: r,
2046
2042
  fingerprint: g.current
2047
2043
  });
2048
- return J.status ? (h(J.idToken), u(J.accessToken), q(J.refreshToken), o({
2049
- type: V,
2044
+ return Y.status ? (h(Y.idToken), u(Y.accessToken), q(Y.refreshToken), o({
2045
+ type: j,
2050
2046
  payload: {
2051
2047
  authenticationType: f,
2052
2048
  user: {
2053
- userId: J.userId,
2049
+ userId: Y.userId,
2054
2050
  username: d
2055
2051
  }
2056
2052
  }
@@ -2058,7 +2054,7 @@ const Ar = (e) => x(
2058
2054
  }
2059
2055
  return !1;
2060
2056
  }
2061
- const G = await Je({
2057
+ const J = await Je({
2062
2058
  username: d,
2063
2059
  password: R,
2064
2060
  clientId: n,
@@ -2068,33 +2064,33 @@ const Ar = (e) => x(
2068
2064
  domain: r,
2069
2065
  fingerprint: g.current
2070
2066
  });
2071
- return G.status ? (h(G.idToken), u(G.accessToken), q(G.refreshToken), o({
2072
- type: V,
2067
+ return J.status ? (h(J.idToken), u(J.accessToken), q(J.refreshToken), o({
2068
+ type: j,
2073
2069
  payload: {
2074
2070
  authenticationType: f,
2075
2071
  user: {
2076
- userId: G.userId,
2072
+ userId: J.userId,
2077
2073
  username: d
2078
2074
  }
2079
2075
  }
2080
2076
  }), !0) : (U(re), !1);
2081
- }, Et = async (d) => {
2082
- d?.preventDefault(), await N(xn);
2083
- }, St = async () => {
2077
+ }, St = async (d) => {
2078
+ d?.preventDefault(), await N(Mn);
2079
+ }, At = async () => {
2084
2080
  const { isAuthenticated: d, user: R } = s;
2085
2081
  try {
2086
2082
  if (d && R && R.userId) {
2087
2083
  if (p) {
2088
2084
  i("getAccessToken");
2089
- const I = await M(p);
2085
+ const I = await G(p);
2090
2086
  if (I && I.payload[A.USER_ID_KEY] !== "")
2091
2087
  return p;
2092
2088
  }
2093
2089
  i("getAccessToken: invalid access token, trying to refresh it");
2094
- const f = await mt.refreshtoken({
2090
+ const f = await wt.refreshtoken({
2095
2091
  clientId: n,
2096
2092
  userId: R.userId,
2097
- nonce: gt,
2093
+ nonce: mt,
2098
2094
  domain: r
2099
2095
  });
2100
2096
  return f.status && f.status === "success" ? (u(f.newAccessToken), q(f.newRefreshToken), f.newAccessToken) : (i(
@@ -2107,12 +2103,12 @@ const Ar = (e) => x(
2107
2103
  } catch {
2108
2104
  return i(
2109
2105
  "getAccessToken: exception occurred, invalidating and logging out"
2110
- ), await N(Mn), "";
2106
+ ), await N(Gn), "";
2111
2107
  }
2112
- }, At = () => {
2108
+ }, Tt = () => {
2113
2109
  if (s.isAuthenticated && l)
2114
2110
  return l;
2115
- }, Tt = async () => {
2111
+ }, Rt = async () => {
2116
2112
  const { user: d } = s;
2117
2113
  let R = await L({
2118
2114
  accessToken: p,
@@ -2126,7 +2122,7 @@ const Ar = (e) => x(
2126
2122
  });
2127
2123
  if (R.status)
2128
2124
  try {
2129
- const f = await Kt(R.data);
2125
+ const f = await Ht(R.data);
2130
2126
  R = await L({
2131
2127
  accessToken: p,
2132
2128
  clientId: n,
@@ -2151,9 +2147,9 @@ const Ar = (e) => x(
2151
2147
  }
2152
2148
  }), !1;
2153
2149
  }
2154
- }, Rt = async () => {
2150
+ }, bt = async () => {
2155
2151
  const d = Se();
2156
- be(d), o({ type: Y, payload: { isLoading: !0 } }), y(), m(), z(), i("loginWithPasskey");
2152
+ be(d), o({ type: V, payload: { isLoading: !0 } }), y(), m(), z(), i("loginWithPasskey");
2157
2153
  const R = Se();
2158
2154
  let f = await L({
2159
2155
  accessToken: p,
@@ -2166,7 +2162,7 @@ const Ar = (e) => x(
2166
2162
  });
2167
2163
  if (f.status)
2168
2164
  try {
2169
- const I = await Wt(f.data);
2165
+ const I = await xt(f.data);
2170
2166
  return f = await L({
2171
2167
  accessToken: p,
2172
2168
  clientId: n,
@@ -2180,9 +2176,9 @@ const Ar = (e) => x(
2180
2176
  fingerprint: g.current
2181
2177
  }
2182
2178
  }), f.data.status === "success" ? (h(f.data.idToken), u(f.data.accessToken), q(f.data.refreshToken), o({
2183
- type: V,
2179
+ type: j,
2184
2180
  payload: {
2185
- authenticationType: F.PASSKEY,
2181
+ authenticationType: M.PASSKEY,
2186
2182
  user: {
2187
2183
  userId: f.data.userId,
2188
2184
  username: f.data.username
@@ -2204,25 +2200,25 @@ const Ar = (e) => x(
2204
2200
  }), U(re), !1;
2205
2201
  }
2206
2202
  };
2207
- return /* @__PURE__ */ ve(Tr.Provider, { value: { state: s, dispatch: o }, children: /* @__PURE__ */ ve(
2208
- yt.Provider,
2203
+ return /* @__PURE__ */ ve(Rr.Provider, { value: { state: s, dispatch: o }, children: /* @__PURE__ */ ve(
2204
+ gt.Provider,
2209
2205
  {
2210
2206
  value: {
2211
2207
  ...s,
2212
- login: wt,
2213
- logout: Et,
2214
- getAccessToken: St,
2215
- getIdToken: At,
2216
- registeringForPasskey: Tt,
2217
- loginWithPasskey: Rt
2208
+ login: Et,
2209
+ logout: St,
2210
+ getAccessToken: At,
2211
+ getIdToken: Tt,
2212
+ registeringForPasskey: Rt,
2213
+ loginWithPasskey: bt
2218
2214
  },
2219
2215
  children: e
2220
2216
  }
2221
2217
  ) });
2222
- }, Ur = (e = yt) => Nt(e);
2218
+ }, $r = (e = gt) => Dt(e);
2223
2219
  export {
2224
- F as AUTH_TYPES,
2225
- Dr as AuthProvider,
2226
- Nr as isGranted,
2227
- Ur as useAuth
2220
+ M as AUTH_TYPES,
2221
+ Ur as AuthProvider,
2222
+ Dr as isGranted,
2223
+ $r as useAuth
2228
2224
  };