@axa-fr/oidc-client 7.27.18 → 7.27.19

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
@@ -207,7 +207,7 @@ var e = {
207
207
  } : t,
208
208
  prompt: "none"
209
209
  }, n, o);
210
- if (c) return a.tokens = c.tokens, i(e.token_acquired, {}), a.timeoutId = z(a, a.tokens.expiresAt, t, o), {};
210
+ if (c) return a.tokens = c.tokens, i(e.token_acquired, {}), a.timeoutId = H(a, a.tokens.expiresAt, t, o), {};
211
211
  } catch (e) {
212
212
  return e;
213
213
  }
@@ -359,21 +359,21 @@ var _ = {
359
359
  else for (let n = 0; n < e; n += 1) t[n] = Math.random() * 62 | 0;
360
360
  return T(t);
361
361
  };
362
- function te(e) {
362
+ function D(e) {
363
363
  let t = new ArrayBuffer(e.length), n = new Uint8Array(t);
364
364
  for (let t = 0; t < e.length; t++) n[t] = e.charCodeAt(t);
365
365
  return n;
366
366
  }
367
- function ne(e) {
367
+ function te(e) {
368
368
  return new Promise((t, n) => {
369
- crypto.subtle.digest("SHA-256", te(e)).then((e) => t(h(new Uint8Array(e))), (e) => n(e));
369
+ crypto.subtle.digest("SHA-256", D(e)).then((e) => t(h(new Uint8Array(e))), (e) => n(e));
370
370
  });
371
371
  }
372
- var re = (e) => {
372
+ var ne = (e) => {
373
373
  if (e.length < 43 || e.length > 128) return Promise.reject(/* @__PURE__ */ Error("Invalid code length."));
374
374
  let { hasSubtleCrypto: t } = C();
375
- return t ? ne(e) : Promise.reject(/* @__PURE__ */ Error("window.crypto.subtle is unavailable."));
376
- }, ie = (e) => !!(e.os === "iOS" && e.osVersion.startsWith("12") || e.os === "Mac OS X" && e.osVersion.startsWith("10_15_6")), ae = (e) => {
375
+ return t ? te(e) : Promise.reject(/* @__PURE__ */ Error("window.crypto.subtle is unavailable."));
376
+ }, re = (e) => !!(e.os === "iOS" && e.osVersion.startsWith("12") || e.os === "Mac OS X" && e.osVersion.startsWith("10_15_6")), ie = (e) => {
377
377
  let t = e.appVersion, n = e.userAgent, r = "-", i = [
378
378
  {
379
379
  s: "Windows 10",
@@ -509,7 +509,7 @@ var re = (e) => {
509
509
  osVersion: a
510
510
  };
511
511
  };
512
- function oe() {
512
+ function ae() {
513
513
  let e = navigator.userAgent, t, n = e.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
514
514
  if (/trident/i.test(n[1])) return t = /\brv[ :]+(\d+)/g.exec(e) || [], {
515
515
  name: "ie",
@@ -535,10 +535,10 @@ function oe() {
535
535
  version: n[1]
536
536
  };
537
537
  }
538
- var se = () => {
539
- let { name: e, version: t } = oe();
540
- return e === "chrome" && parseInt(t) <= 70 || e === "opera" && (!t || parseInt(t.split(".")[0]) < 80) || e === "ie" ? !1 : !ie(ae(navigator));
541
- }, ce = async (t) => {
538
+ var oe = () => {
539
+ let { name: e, version: t } = ae();
540
+ return e === "chrome" && parseInt(t) <= 70 || e === "opera" && (!t || parseInt(t.split(".")[0]) < 80) || e === "ie" ? !1 : !re(ie(navigator));
541
+ }, se = async (t) => {
542
542
  let n;
543
543
  if (t.tokens != null) return !1;
544
544
  t.publishEvent(e.tryKeepExistingSessionAsync_begin, {});
@@ -549,7 +549,7 @@ var se = () => {
549
549
  if (i) {
550
550
  n.startKeepAliveServiceWorker(), t.tokens = i;
551
551
  let o = n.getLoginParams(t.configurationName);
552
- t.timeoutId = z(t, t.tokens.expiresAt, o.extras, o.scope);
552
+ t.timeoutId = H(t, t.tokens.expiresAt, o.extras, o.scope);
553
553
  let s = await n.getSessionStateAsync();
554
554
  return await t.startCheckSessionAsync(a.checkSessionIframe, r.client_id, s), r.preload_user_info && await t.userInfoAsync(), t.publishEvent(e.tryKeepExistingSessionAsync_end, {
555
555
  success: !0,
@@ -564,9 +564,9 @@ var se = () => {
564
564
  r.service_worker_relative_url && t.publishEvent(e.service_worker_not_supported_by_browser, { message: "service worker is not supported by this browser" });
565
565
  let n = i(t.configurationName, r.storage ?? sessionStorage, r.login_state_storage ?? r.storage ?? sessionStorage), { tokens: o } = await n.initAsync();
566
566
  if (o) {
567
- t.tokens = W(o, null, r.token_renew_mode);
567
+ t.tokens = Ve(o, null, r.token_renew_mode);
568
568
  let i = n.getLoginParams();
569
- t.timeoutId = z(t, t.tokens.expiresAt, i.extras, i.scope);
569
+ t.timeoutId = H(t, t.tokens.expiresAt, i.extras, i.scope);
570
570
  let s = await n.getSessionStateAsync();
571
571
  return await t.startCheckSessionAsync(a.checkSessionIframe, r.client_id, s), r.preload_user_info && await t.userInfoAsync(), t.publishEvent(e.tryKeepExistingSessionAsync_end, {
572
572
  success: !0,
@@ -581,7 +581,7 @@ var se = () => {
581
581
  } catch (r) {
582
582
  return console.error(r), n && await n.clearAsync(), t.publishEvent(e.tryKeepExistingSessionAsync_error, "tokens inside ServiceWorker are invalid"), !1;
583
583
  }
584
- }, D = class {
584
+ }, O = class {
585
585
  open(e) {
586
586
  window.location.href = e;
587
587
  }
@@ -598,38 +598,38 @@ var se = () => {
598
598
  getOrigin() {
599
599
  return window.origin;
600
600
  }
601
- }, O = {
601
+ }, k = {
602
602
  STATE_MISSING: "STATE_MISSING",
603
603
  STATE_MISMATCH: "STATE_MISMATCH",
604
604
  NONCE_MISSING: "NONCE_MISSING"
605
- }, k = class e extends Error {
605
+ }, A = class e extends Error {
606
606
  constructor(t, n) {
607
607
  super(n), this.name = "OidcStateError", this.code = t, Object.setPrototypeOf(this, e.prototype);
608
608
  }
609
- }, le = (e) => e instanceof k, A = {}, ue = (e, t = window.sessionStorage, n) => {
610
- if (!A[e] && t) {
609
+ }, ce = (e) => e instanceof A, j = {}, le = (e, t = window.sessionStorage, n) => {
610
+ if (!j[e] && t) {
611
611
  let n = t.getItem(e);
612
- n && (A[e] = JSON.parse(n));
612
+ n && (j[e] = JSON.parse(n));
613
613
  }
614
614
  let r = 1e3 * n;
615
- return A[e] && A[e].timestamp + r > Date.now() ? A[e].result : null;
616
- }, de = (e, t, n = window.sessionStorage) => {
615
+ return j[e] && j[e].timestamp + r > Date.now() ? j[e].result : null;
616
+ }, ue = (e, t, n = window.sessionStorage) => {
617
617
  let r = Date.now();
618
- A[e] = {
618
+ j[e] = {
619
619
  result: t,
620
620
  timestamp: r
621
621
  }, n && n.setItem(e, JSON.stringify({
622
622
  result: t,
623
623
  timestamp: r
624
624
  }));
625
- }, fe = 3600, pe = (e) => async (t, n = fe, r = window.sessionStorage, i = 1e4) => {
626
- let a = `${t}/.well-known/openid-configuration`, o = `oidc.server:${t}`, s = ue(o, r, n);
627
- if (s) return new Me(s);
628
- let c = await j(e)(a, {}, i);
625
+ }, de = 3600, fe = (e) => async (t, n = de, r = window.sessionStorage, i = 1e4) => {
626
+ let a = `${t}/.well-known/openid-configuration`, o = `oidc.server:${t}`, s = le(o, r, n);
627
+ if (s) return new z(s);
628
+ let c = await M(e)(a, {}, i);
629
629
  if (c.status !== 200) return null;
630
630
  let l = await c.json();
631
- return de(o, l, r), new Me(l);
632
- }, j = (e) => async (t, n = {}, r = 1e4, i = 0) => {
631
+ return ue(o, l, r), new z(l);
632
+ }, M = (e) => async (t, n = {}, r = 1e4, i = 0) => {
633
633
  let a;
634
634
  try {
635
635
  let i = new AbortController();
@@ -639,15 +639,15 @@ var se = () => {
639
639
  });
640
640
  } catch (a) {
641
641
  if (a.name === "AbortError" || a.message === "Network request failed") {
642
- if (i <= 1) return await j(e)(t, n, r, i + 1);
642
+ if (i <= 1) return await M(e)(t, n, r, i + 1);
643
643
  throw a;
644
644
  } else throw console.error(a.message), a;
645
645
  }
646
646
  return a;
647
- }, me = {
647
+ }, N = {
648
648
  refresh_token: "refresh_token",
649
649
  access_token: "access_token"
650
- }, he = (e) => async (t, n, r = me.refresh_token, i, a = {}, o = 1e4) => {
650
+ }, pe = (e) => async (t, n, r = N.refresh_token, i, a = {}, o = 1e4) => {
651
651
  let s = {
652
652
  token: n,
653
653
  token_type_hint: r,
@@ -660,19 +660,19 @@ var se = () => {
660
660
  c.push(`${t}=${n}`);
661
661
  }
662
662
  let l = c.join("&");
663
- return (await j(e)(t, {
663
+ return (await M(e)(t, {
664
664
  method: "POST",
665
665
  headers: { "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8" },
666
666
  body: l
667
667
  }, o)).status === 200 ? { success: !0 } : { success: !1 };
668
- }, ge = (e) => async (t, n, r, i, a = {}, o, s = 1e4) => {
668
+ }, me = (e) => async (t, n, r, i, a = {}, o, s = 1e4) => {
669
669
  for (let [e, t] of Object.entries(r)) n[e] === void 0 && (n[e] = t);
670
670
  let c = [];
671
671
  for (let e in n) {
672
672
  let t = encodeURIComponent(e), r = encodeURIComponent(n[e]);
673
673
  c.push(`${t}=${r}`);
674
674
  }
675
- let l = c.join("&"), u = await j(e)(t, {
675
+ let l = c.join("&"), u = await M(e)(t, {
676
676
  method: "POST",
677
677
  headers: {
678
678
  "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
@@ -686,27 +686,27 @@ var se = () => {
686
686
  demonstratingProofOfPossessionNonce: null
687
687
  };
688
688
  let d = await u.json(), f = null;
689
- return u.headers.has(M) && (f = u.headers.get(M)), {
689
+ return u.headers.has(P) && (f = u.headers.get(P)), {
690
690
  success: !0,
691
691
  status: u.status,
692
- data: G(d, i, o),
692
+ data: He(d, i, o),
693
693
  demonstratingProofOfPossessionNonce: f
694
694
  };
695
- }, _e = (e, t) => async (n, r) => {
695
+ }, he = (e, t) => async (n, r) => {
696
696
  r = r ? { ...r } : {};
697
- let i = E(128), a = await re(i);
697
+ let i = E(128), a = await ne(i);
698
698
  await e.setCodeVerifierAsync(i), await e.setStateAsync(r.state), r.code_challenge = a, r.code_challenge_method = "S256";
699
699
  let o = "";
700
700
  if (r) for (let [e, t] of Object.entries(r)) o === "" ? o += "?" : o += "&", o += `${e}=${encodeURIComponent(t)}`;
701
701
  t.open(`${n}${o}`);
702
- }, M = "DPoP-Nonce", ve = (e) => async (t, n, r, i, a = 1e4) => {
702
+ }, P = "DPoP-Nonce", ge = (e) => async (t, n, r, i, a = 1e4) => {
703
703
  n = n ? { ...n } : {}, n.code_verifier = await e.getCodeVerifierAsync();
704
704
  let o = [];
705
705
  for (let e in n) {
706
706
  let t = encodeURIComponent(e), r = encodeURIComponent(n[e]);
707
707
  o.push(`${t}=${r}`);
708
708
  }
709
- let s = o.join("&"), c = await j(fetch)(t, {
709
+ let s = o.join("&"), c = await M(fetch)(t, {
710
710
  method: "POST",
711
711
  headers: {
712
712
  "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
@@ -719,17 +719,17 @@ var se = () => {
719
719
  status: c.status
720
720
  };
721
721
  let l = null;
722
- c.headers.has(M) && (l = c.headers.get(M));
722
+ c.headers.has(P) && (l = c.headers.get(P));
723
723
  let u = await c.json();
724
724
  return {
725
725
  success: !0,
726
726
  data: {
727
727
  state: n.state,
728
- tokens: G(u, null, i),
728
+ tokens: He(u, null, i),
729
729
  demonstratingProofOfPossessionNonce: l
730
730
  }
731
731
  };
732
- }, ye = (e) => {
732
+ }, _e = (e) => {
733
733
  let t = e.match(/^([a-z][\w-]+\:)\/\/(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/);
734
734
  if (!t) throw Error("Invalid URL");
735
735
  let n = t[6], r = t[7];
@@ -747,19 +747,19 @@ var se = () => {
747
747
  search: n,
748
748
  hash: r
749
749
  };
750
- }, be = (e) => {
751
- let t = ye(e), { path: n } = t;
750
+ }, ve = (e) => {
751
+ let t = _e(e), { path: n } = t;
752
752
  n.endsWith("/") && (n = n.slice(0, -1));
753
753
  let { hash: r } = t;
754
754
  return r === "#_=_" && (r = ""), r && (n += r), n;
755
- }, N = (e) => {
756
- let { search: t } = ye(e);
757
- return xe(t);
758
- }, xe = (e) => {
755
+ }, F = (e) => {
756
+ let { search: t } = _e(e);
757
+ return ye(t);
758
+ }, ye = (e) => {
759
759
  let t = {}, n, r, i, a = e.split("&");
760
760
  for (r = 0, i = a.length; r < i; r++) n = a[r].split("="), t[decodeURIComponent(n[0])] = decodeURIComponent(n[1]);
761
761
  return t;
762
- }, Se = (t, n, r, a, o) => (s = void 0, c = null, l = !1, u = void 0) => {
762
+ }, be = (t, n, r, a, o) => (s = void 0, c = null, l = !1, u = void 0) => {
763
763
  let d = c;
764
764
  return c = { ...c }, (async () => {
765
765
  let f = s || o.getPath();
@@ -793,15 +793,15 @@ var se = () => {
793
793
  response_type: "code",
794
794
  ...r
795
795
  };
796
- await _e(h, o)(m.authorizationEndpoint, g);
796
+ await he(h, o)(m.authorizationEndpoint, g);
797
797
  } catch (t) {
798
798
  throw r(e.loginAsync_error, t), t;
799
799
  }
800
800
  })();
801
- }, Ce = (t) => async (n = !1) => {
801
+ }, xe = (t) => async (n = !1) => {
802
802
  try {
803
803
  t.publishEvent(e.loginCallbackAsync_begin, {});
804
- let r = t.configuration, a = r.client_id, o = n ? r.silent_redirect_uri : r.redirect_uri, s = r.authority, c = r.token_request_timeout, l = await t.initAsync(s, r.authority_configuration), u = N(t.location.getCurrentHref()), d = u.session_state, f = await $(r, t.configurationName), p, m, h, g;
804
+ let r = t.configuration, a = r.client_id, o = n ? r.silent_redirect_uri : r.redirect_uri, s = r.authority, c = r.token_request_timeout, l = await t.initAsync(s, r.authority_configuration), u = F(t.location.getCurrentHref()), d = u.session_state, f = await $(r, t.configurationName), p, m, h, g;
805
805
  if (f) await f.initAsync(l, "loginCallbackAsync", r), await f.setSessionStateAsync(d), m = await f.getNonceAsync(), h = f.getLoginParams(), g = await f.getStateAsync(), f.startKeepAliveServiceWorker(), p = f;
806
806
  else {
807
807
  let e = i(t.configurationName, r.storage ?? sessionStorage, r.login_state_storage ?? r.storage ?? sessionStorage);
@@ -810,10 +810,10 @@ var se = () => {
810
810
  if (u.error || u.error_description) throw Error(`Error from OIDC server: ${u.error} - ${u.error_description}`);
811
811
  if (u.iss && u.iss !== l.issuer) throw console.error(), Error(`Issuer not valid (expected: ${l.issuer}, received: ${u.iss})`);
812
812
  if (u.state) {
813
- if (!g) throw new k(O.STATE_MISSING, "OIDC state is missing from storage. The login state may have been cleared between the authorization redirect and the callback (e.g., private browsing, storage cleared, or browser eviction).");
814
- if (u.state !== g) throw new k(O.STATE_MISMATCH, `OIDC state does not match the stored one (expected: ${g}, received: ${u.state}).`);
813
+ if (!g) throw new A(k.STATE_MISSING, "OIDC state is missing from storage. The login state may have been cleared between the authorization redirect and the callback (e.g., private browsing, storage cleared, or browser eviction).");
814
+ if (u.state !== g) throw new A(k.STATE_MISMATCH, `OIDC state does not match the stored one (expected: ${g}, received: ${u.state}).`);
815
815
  }
816
- if (!m || !m.nonce) throw new k(O.NONCE_MISSING, "OIDC nonce is missing from storage. The login state may have been cleared between the authorization redirect and the callback (e.g., private browsing, storage cleared, or browser eviction).");
816
+ if (!m || !m.nonce) throw new A(k.NONCE_MISSING, "OIDC nonce is missing from storage. The login state may have been cleared between the authorization redirect and the callback (e.g., private browsing, storage cleared, or browser eviction).");
817
817
  let _ = {
818
818
  code: u.code,
819
819
  grant_type: "authorization_code",
@@ -828,15 +828,15 @@ var se = () => {
828
828
  let e = await x(window)(r.demonstrating_proof_of_possession_configuration.generateKeyAlgorithm);
829
829
  await i(t.configurationName, r.storage, r.login_state_storage ?? r.storage).setDemonstratingProofOfPossessionJwkAsync(e), b.DPoP = await ee(window)(r.demonstrating_proof_of_possession_configuration)(e, "POST", y);
830
830
  }
831
- let S = await ve(p)(y, {
831
+ let S = await ge(p)(y, {
832
832
  ..._,
833
833
  ...v
834
834
  }, b, t.configuration.token_renew_mode, c);
835
835
  if (!S.success) throw Error("Token request failed");
836
836
  let C, w = S.data.tokens, T = S.data.demonstratingProofOfPossessionNonce;
837
837
  if (S.data.state !== v.state) throw Error("state is not valid");
838
- let { isValid: E, reason: te } = Ge(w, m.nonce, l);
839
- if (!E) throw Error(`Tokens are not OpenID valid, reason: ${te}`);
838
+ let { isValid: E, reason: D } = Ge(w, m.nonce, l);
839
+ if (!E) throw Error(`Tokens are not OpenID valid, reason: ${D}`);
840
840
  if (f) {
841
841
  if (w.refreshToken && !w.refreshToken.includes("SECURED_BY_OIDC_SERVICE_WORKER")) throw Error("Refresh token should be hidden by service worker");
842
842
  if (T && w?.accessToken.includes("SECURED_BY_OIDC_SERVICE_WORKER")) throw Error("Demonstration of proof of possession require Access token not hidden by service worker");
@@ -856,10 +856,10 @@ var se = () => {
856
856
  } catch (n) {
857
857
  throw console.error(n), t.publishEvent(e.loginCallbackAsync_error, n), n;
858
858
  }
859
- }, we = {
859
+ }, Se = {
860
860
  access_token: "access_token",
861
861
  refresh_token: "refresh_token"
862
- }, P = (e, t) => {
862
+ }, I = (e, t) => {
863
863
  let n = {};
864
864
  if (e) {
865
865
  for (let [r, i] of Object.entries(e)) if (r.endsWith(t)) {
@@ -869,27 +869,27 @@ var se = () => {
869
869
  return n;
870
870
  }
871
871
  return n;
872
- }, Te = (e) => {
872
+ }, Ce = (e) => {
873
873
  let t = {};
874
874
  if (e) {
875
875
  for (let [n, r] of Object.entries(e)) n.includes(":") || (t[n] = r);
876
876
  return t;
877
877
  }
878
878
  return t;
879
- }, Ee = (e) => async (t) => {
879
+ }, we = (e) => async (t) => {
880
880
  c.clearTimeout(e.timeoutId), e.timeoutId = null, e.checkSessionIFrame && e.checkSessionIFrame.stop();
881
881
  let n = await $(e.configuration, e.configurationName);
882
882
  n ? await n.clearAsync(t) : await i(e.configurationName, e.configuration.storage, e.configuration.login_state_storage ?? e.configuration.storage).clearAsync(t), e.tokens = null, e.userInfo = null;
883
- }, F = (t, n) => async () => {
883
+ }, L = (t, n) => async () => {
884
884
  let r = t.tokens?.idTokenPayload?.sub ?? null;
885
885
  await t.destroyAsync("LOGGED_OUT");
886
886
  for (let [, i] of Object.entries(n)) i === t ? t.publishEvent(e.logout_from_same_tab, {}) : await t.logoutSameTabAsync(t.configuration.client_id, r);
887
- }, De = (e, t, n, r) => {
887
+ }, Te = (e, t, n, r) => {
888
888
  "id_token_hint" in t || (t.id_token_hint = n), !("post_logout_redirect_uri" in t) && r !== null && (t.post_logout_redirect_uri = r);
889
889
  let i = "";
890
890
  for (let [e, n] of Object.entries(t)) n != null && (i === "" ? i += "?" : i += "&", i += `${e}=${encodeURIComponent(n)}`);
891
891
  return `${e}${i}`;
892
- }, Oe = (e, t, n, r, i) => async (a = void 0, o = null) => {
892
+ }, Ee = (e, t, n, r, i) => async (a = void 0, o = null) => {
893
893
  let s = e.configuration, c = await e.initAsync(s.authority, s.authority_configuration);
894
894
  a && typeof a != "string" && (a = void 0, r.warn("callbackPathOrUrl path is not a string"));
895
895
  let l = a ?? i.getPath(), u = !1;
@@ -901,13 +901,13 @@ var se = () => {
901
901
  let t = c.revocationEndpoint;
902
902
  if (t) {
903
903
  let r = [], i = e.tokens ? e.tokens.accessToken : null;
904
- if (i && s.logout_tokens_to_invalidate.includes(we.access_token)) {
905
- let e = P(o, ":revoke_access_token"), a = he(n)(t, i, me.access_token, s.client_id, e);
904
+ if (i && s.logout_tokens_to_invalidate.includes(Se.access_token)) {
905
+ let e = I(o, ":revoke_access_token"), a = pe(n)(t, i, N.access_token, s.client_id, e);
906
906
  r.push(a);
907
907
  }
908
908
  let a = e.tokens ? e.tokens.refreshToken : null;
909
- if (a && s.logout_tokens_to_invalidate.includes(we.refresh_token)) {
910
- let e = P(o, ":revoke_refresh_token"), i = he(n)(t, a, me.refresh_token, s.client_id, e);
909
+ if (a && s.logout_tokens_to_invalidate.includes(Se.refresh_token)) {
910
+ let e = I(o, ":revoke_refresh_token"), i = pe(n)(t, a, N.refresh_token, s.client_id, e);
911
911
  r.push(i);
912
912
  }
913
913
  r.length > 0 && await Promise.all(r);
@@ -915,23 +915,23 @@ var se = () => {
915
915
  } catch (e) {
916
916
  r.warn("logoutAsync: error when revoking tokens, if the error persist, you ay configure property logout_tokens_to_invalidate from configuration to avoid this error"), r.warn(e);
917
917
  }
918
- let a = P(o, ":oidc");
918
+ let a = I(o, ":oidc");
919
919
  if (a && a.no_reload === "true") {
920
- await F(e, t)(), e.isLoggingOut = !1;
920
+ await L(e, t)(), e.isLoggingOut = !1;
921
921
  return;
922
922
  }
923
- let l = Te(o);
923
+ let l = Ce(o);
924
924
  if (c.endSessionEndpoint) {
925
- let e = De(c.endSessionEndpoint, l, f, d);
925
+ let e = Te(c.endSessionEndpoint, l, f, d);
926
926
  i.open(e);
927
927
  } else i.reload();
928
- await F(e, t)();
928
+ await L(e, t)();
929
929
  } catch (t) {
930
930
  throw e.isLoggingOut = !1, t;
931
931
  }
932
- }, I = /* @__PURE__ */ function(e) {
932
+ }, R = /* @__PURE__ */ function(e) {
933
933
  return e.AutomaticBeforeTokenExpiration = "AutomaticBeforeTokensExpiration", e.AutomaticOnlyWhenFetchExecuted = "AutomaticOnlyWhenFetchExecuted", e;
934
- }({}), ke = (e, t, n = !1) => async (...r) => {
934
+ }({}), De = (e, t, n = !1) => async (...r) => {
935
935
  let [i, a, ...o] = r, s = a ? { ...a } : { method: "GET" }, c = new Headers();
936
936
  s.headers && (c = s.headers instanceof Headers ? s.headers : new Headers(s.headers));
937
937
  let l = (await We({
@@ -941,7 +941,7 @@ var se = () => {
941
941
  refresh_time_before_tokens_expiration_in_second: t.configuration.refresh_time_before_tokens_expiration_in_second
942
942
  },
943
943
  syncTokensInfoAsync: async () => {
944
- let { status: e } = await V(t)(t.configuration, t.configurationName, t.tokens, !1);
944
+ let { status: e } = await Fe(t)(t.configuration, t.configurationName, t.tokens, !1);
945
945
  return e;
946
946
  },
947
947
  renewTokensAsync: t.renewTokensAsync.bind(t)
@@ -957,46 +957,46 @@ var se = () => {
957
957
  ...s,
958
958
  headers: c
959
959
  }, ...o);
960
- }, Ae = (e) => async (t = !1, n = !1) => {
960
+ }, Oe = (e) => async (t = !1, n = !1) => {
961
961
  if (e.userInfo != null && !t) return e.userInfo;
962
962
  let r = !t && e.configuration.storage?.getItem(`oidc.${e.configurationName}.userInfo`);
963
963
  if (r) return e.userInfo = JSON.parse(r), e.userInfo;
964
964
  let i = e.configuration, a = (await e.initAsync(i.authority, i.authority_configuration)).userInfoEndpoint, o = await (async () => {
965
- let t = await ke(fetch, e, n)(a);
965
+ let t = await De(fetch, e, n)(a);
966
966
  return t.status === 200 ? t.json() : null;
967
967
  })();
968
968
  return e.userInfo = o, o && e.configuration.storage?.setItem(`oidc.${e.configurationName}.userInfo`, JSON.stringify(o)), o;
969
- }, je = () => fetch, Me = class {
969
+ }, ke = () => fetch, z = class {
970
970
  constructor(e) {
971
971
  this.authorizationEndpoint = e.authorization_endpoint, this.tokenEndpoint = e.token_endpoint, this.revocationEndpoint = e.revocation_endpoint, this.userInfoEndpoint = e.userinfo_endpoint, this.checkSessionIframe = e.check_session_iframe, this.issuer = e.issuer, this.endSessionEndpoint = e.end_session_endpoint;
972
972
  }
973
- }, L = {}, Ne = (e, t = new D()) => (n, r = "default") => (L[r] || (L[r] = new R(n, r, e, t)), L[r]), Pe = async (e) => {
973
+ }, B = {}, Ae = (e, t = new O()) => (n, r = "default") => (B[r] || (B[r] = new V(n, r, e, t)), B[r]), je = async (e) => {
974
974
  let { parsedTokens: t, callbackPath: n, extras: r, scope: i } = await e.loginCallbackAsync();
975
- return e.timeoutId = z(e, t.expiresAt, r, i), { callbackPath: n };
976
- }, Fe = (e) => Math.floor(Math.random() * e), R = class t {
977
- constructor(e, t = "default", n, r = new D()) {
975
+ return e.timeoutId = H(e, t.expiresAt, r, i), { callbackPath: n };
976
+ }, Me = (e) => Math.floor(Math.random() * e), V = class t {
977
+ constructor(e, t = "default", n, r = new O()) {
978
978
  this.isLoggingOut = !1, this.initPromise = null, this.tryKeepExistingSessionPromise = null, this.loginPromise = null, this.loginCallbackPromise = null, this.loginCallbackWithAutoTokensRenewPromise = null, this.userInfoPromise = null, this.renewTokensPromise = null, this.clearSessionPromise = null, this.logoutPromise = null;
979
979
  let i = e.silent_login_uri;
980
980
  e.silent_redirect_uri && !e.silent_login_uri && (i = `${e.silent_redirect_uri.replace("-callback", "").replace("callback", "")}-login`);
981
981
  let a = e.refresh_time_before_tokens_expiration_in_second ?? 120;
982
- a > 60 && (a -= Math.floor(Math.random() * 40)), this.location = r ?? new D(), this.configuration = {
982
+ a > 60 && (a -= Math.floor(Math.random() * 40)), this.location = r ?? new O(), this.configuration = {
983
983
  ...e,
984
984
  silent_login_uri: i,
985
- token_automatic_renew_mode: e.token_automatic_renew_mode ?? I.AutomaticBeforeTokenExpiration,
985
+ token_automatic_renew_mode: e.token_automatic_renew_mode ?? R.AutomaticBeforeTokenExpiration,
986
986
  monitor_session: e.monitor_session ?? !1,
987
987
  refresh_time_before_tokens_expiration_in_second: a,
988
988
  silent_login_timeout: e.silent_login_timeout ?? 12e3,
989
- token_renew_mode: e.token_renew_mode ?? U.access_token_or_id_token_invalid,
989
+ token_renew_mode: e.token_renew_mode ?? G.access_token_or_id_token_invalid,
990
990
  demonstrating_proof_of_possession: e.demonstrating_proof_of_possession ?? !1,
991
991
  authority_timeout_wellknowurl_in_millisecond: e.authority_timeout_wellknowurl_in_millisecond ?? 1e4,
992
992
  logout_tokens_to_invalidate: e.logout_tokens_to_invalidate ?? ["access_token", "refresh_token"],
993
- service_worker_activate: e.service_worker_activate ?? se,
993
+ service_worker_activate: e.service_worker_activate ?? oe,
994
994
  demonstrating_proof_of_possession_configuration: e.demonstrating_proof_of_possession_configuration ?? _,
995
995
  preload_user_info: e.preload_user_info ?? !1
996
- }, this.getFetch = n ?? je, this.configurationName = t, this.tokens = null, this.userInfo = null, this.events = [], this.timeoutId = null, this.loginCallbackWithAutoTokensRenewAsync.bind(this), this.initAsync.bind(this), this.loginCallbackAsync.bind(this), this.subscribeEvents.bind(this), this.removeEventSubscription.bind(this), this.publishEvent.bind(this), this.destroyAsync.bind(this), this.logoutAsync.bind(this), this.renewTokensAsync.bind(this), this.initAsync(this.configuration.authority, this.configuration.authority_configuration);
996
+ }, this.getFetch = n ?? ke, this.configurationName = t, this.tokens = null, this.userInfo = null, this.events = [], this.timeoutId = null, this.loginCallbackWithAutoTokensRenewAsync.bind(this), this.initAsync.bind(this), this.loginCallbackAsync.bind(this), this.subscribeEvents.bind(this), this.removeEventSubscription.bind(this), this.publishEvent.bind(this), this.destroyAsync.bind(this), this.logoutAsync.bind(this), this.renewTokensAsync.bind(this), this.initAsync(this.configuration.authority, this.configuration.authority_configuration);
997
997
  }
998
998
  subscribeEvents(e) {
999
- let t = Fe(9999999999999).toString();
999
+ let t = Me(9999999999999).toString();
1000
1000
  return this.events.push({
1001
1001
  id: t,
1002
1002
  func: e
@@ -1012,10 +1012,10 @@ var se = () => {
1012
1012
  });
1013
1013
  }
1014
1014
  static {
1015
- this.getOrCreate = (e, t) => (n, r = "default") => Ne(e, t)(n, r);
1015
+ this.getOrCreate = (e, t) => (n, r = "default") => Ae(e, t)(n, r);
1016
1016
  }
1017
1017
  static get(e = "default") {
1018
- return Object.prototype.hasOwnProperty.call(L, e) ? L[e] : null;
1018
+ return Object.prototype.hasOwnProperty.call(B, e) ? B[e] : null;
1019
1019
  }
1020
1020
  static getOrThrow(e = "default") {
1021
1021
  let n = t.get(e);
@@ -1028,7 +1028,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1028
1028
  }
1029
1029
  _silentLoginCallbackFromIFrame() {
1030
1030
  if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
1031
- let e = this.location, t = N(e.getCurrentHref());
1031
+ let e = this.location, t = F(e.getCurrentHref());
1032
1032
  window.parent.postMessage(`${this.configurationName}_oidc_tokens:${JSON.stringify({
1033
1033
  tokens: this.tokens,
1034
1034
  sessionState: t.session_state
@@ -1037,7 +1037,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1037
1037
  }
1038
1038
  _silentLoginErrorCallbackFromIFrame(e = null) {
1039
1039
  if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
1040
- let t = this.location, n = N(t.getCurrentHref());
1040
+ let t = this.location, n = F(t.getCurrentHref());
1041
1041
  n.error ? window.parent.postMessage(`${this.configurationName}_oidc_error:${JSON.stringify({ error: n.error })}`, t.getOrigin()) : window.parent.postMessage(`${this.configurationName}_oidc_exception:${JSON.stringify({ error: e == null ? "" : e.toString() })}`, t.getOrigin());
1042
1042
  }
1043
1043
  }
@@ -1051,7 +1051,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1051
1051
  async initAsync(e, t) {
1052
1052
  if (this.initPromise !== null) return this.initPromise;
1053
1053
  let n = async () => {
1054
- if (t != null) return new Me({
1054
+ if (t != null) return new z({
1055
1055
  authorization_endpoint: t.authorization_endpoint,
1056
1056
  end_session_endpoint: t.end_session_endpoint,
1057
1057
  revocation_endpoint: t.revocation_endpoint,
@@ -1061,29 +1061,29 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1061
1061
  issuer: t.issuer
1062
1062
  });
1063
1063
  let n = await $(this.configuration, this.configurationName) ? this.configuration.storage || window.sessionStorage : this.configuration.storage;
1064
- return await pe(this.getFetch())(e, this.configuration.authority_time_cache_wellknowurl_in_second ?? 3600, n, this.configuration.authority_timeout_wellknowurl_in_millisecond);
1064
+ return await fe(this.getFetch())(e, this.configuration.authority_time_cache_wellknowurl_in_second ?? 3600, n, this.configuration.authority_timeout_wellknowurl_in_millisecond);
1065
1065
  };
1066
1066
  return this.initPromise = n(), this.initPromise.finally(() => {
1067
1067
  this.initPromise = null;
1068
1068
  });
1069
1069
  }
1070
1070
  async tryKeepExistingSessionAsync() {
1071
- return this.tryKeepExistingSessionPromise === null ? (this.tryKeepExistingSessionPromise = ce(this), this.tryKeepExistingSessionPromise.finally(() => {
1071
+ return this.tryKeepExistingSessionPromise === null ? (this.tryKeepExistingSessionPromise = se(this), this.tryKeepExistingSessionPromise.finally(() => {
1072
1072
  this.tryKeepExistingSessionPromise = null;
1073
1073
  })) : this.tryKeepExistingSessionPromise;
1074
1074
  }
1075
1075
  async startCheckSessionAsync(e, t, n, r = !1) {
1076
- await d(this, L, this.configuration)(e, t, n, r);
1076
+ await d(this, B, this.configuration)(e, t, n, r);
1077
1077
  }
1078
1078
  async loginAsync(e = void 0, t = null, n = !1, r = void 0, i = !1) {
1079
- return this.logoutPromise && await this.logoutPromise, this.loginPromise === null ? (i ? this.loginPromise = u(window, this.configurationName, this.configuration, this.publishEvent.bind(this), this)(t, r) : this.loginPromise = Se(this.configurationName, this.configuration, this.publishEvent.bind(this), this.initAsync.bind(this), this.location)(e, t, n, r), this.loginPromise.finally(() => {
1079
+ return this.logoutPromise && await this.logoutPromise, this.loginPromise === null ? (i ? this.loginPromise = u(window, this.configurationName, this.configuration, this.publishEvent.bind(this), this)(t, r) : this.loginPromise = be(this.configurationName, this.configuration, this.publishEvent.bind(this), this.initAsync.bind(this), this.location)(e, t, n, r), this.loginPromise.finally(() => {
1080
1080
  this.loginPromise = null;
1081
1081
  })) : this.loginPromise;
1082
1082
  }
1083
1083
  async loginCallbackAsync(e = !1) {
1084
1084
  if (this.loginCallbackPromise !== null) return this.loginCallbackPromise;
1085
1085
  let n = async () => {
1086
- let n = await Ce(this)(e), r = n.tokens;
1086
+ let n = await xe(this)(e), r = n.tokens;
1087
1087
  return this.tokens = r, await $(this.configuration, this.configurationName) || i(this.configurationName, this.configuration.storage, this.configuration.login_state_storage ?? this.configuration.storage).setTokens(r), this.publishEvent(t.eventNames.token_acquired, r), this.configuration.preload_user_info && await this.userInfoAsync(), {
1088
1088
  parsedTokens: r,
1089
1089
  state: n.state,
@@ -1098,7 +1098,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1098
1098
  }
1099
1099
  async generateDemonstrationOfProofOfPossessionAsync(e, t, n, r = {}) {
1100
1100
  let a = this.configuration, o = {
1101
- ath: await ne(e),
1101
+ ath: await te(e),
1102
1102
  ...r
1103
1103
  };
1104
1104
  if (await $(a, this.configurationName)) return `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${this.configurationName}#tabId=${Ye(this.configurationName)}`;
@@ -1106,26 +1106,26 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1106
1106
  return l && (o.nonce = l), await ee(window)(a.demonstrating_proof_of_possession_configuration)(c, n, t, o);
1107
1107
  }
1108
1108
  loginCallbackWithAutoTokensRenewAsync() {
1109
- return this.loginCallbackWithAutoTokensRenewPromise === null ? (this.loginCallbackWithAutoTokensRenewPromise = Pe(this), this.loginCallbackWithAutoTokensRenewPromise.finally(() => {
1109
+ return this.loginCallbackWithAutoTokensRenewPromise === null ? (this.loginCallbackWithAutoTokensRenewPromise = je(this), this.loginCallbackWithAutoTokensRenewPromise.finally(() => {
1110
1110
  this.loginCallbackWithAutoTokensRenewPromise = null;
1111
1111
  })) : this.loginCallbackWithAutoTokensRenewPromise;
1112
1112
  }
1113
1113
  userInfoAsync(e = !1, t = !1) {
1114
- return this.userInfoPromise === null ? (this.userInfoPromise = Ae(this)(e, t), this.userInfoPromise.finally(() => {
1114
+ return this.userInfoPromise === null ? (this.userInfoPromise = Oe(this)(e, t), this.userInfoPromise.finally(() => {
1115
1115
  this.userInfoPromise = null;
1116
1116
  })) : this.userInfoPromise;
1117
1117
  }
1118
1118
  async renewTokensAsync(e = null, t = null) {
1119
1119
  if (this.renewTokensPromise !== null) return this.renewTokensPromise;
1120
- if (this.timeoutId) return c.clearTimeout(this.timeoutId), this.renewTokensPromise = Le(this, !0, e, t), this.renewTokensPromise.finally(() => {
1120
+ if (this.timeoutId) return c.clearTimeout(this.timeoutId), this.renewTokensPromise = Pe(this, !0, e, t), this.renewTokensPromise.finally(() => {
1121
1121
  this.renewTokensPromise = null;
1122
1122
  });
1123
1123
  }
1124
1124
  async destroyAsync(e) {
1125
- return await Ee(this)(e);
1125
+ return await we(this)(e);
1126
1126
  }
1127
1127
  async clearSessionAsync() {
1128
- return this.clearSessionPromise ? this.clearSessionPromise : (this.clearSessionPromise = F(this, L)(), this.clearSessionPromise.finally(() => {
1128
+ return this.clearSessionPromise ? this.clearSessionPromise : (this.clearSessionPromise = L(this, B)(), this.clearSessionPromise.finally(() => {
1129
1129
  this.clearSessionPromise = null;
1130
1130
  }));
1131
1131
  }
@@ -1142,36 +1142,36 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1142
1142
  }));
1143
1143
  }
1144
1144
  async logoutAsync(e = void 0, t = null) {
1145
- return this.logoutPromise ? this.logoutPromise : (this.logoutPromise = Oe(this, L, this.getFetch(), console, this.location)(e, t), this.logoutPromise.finally(() => {
1145
+ return this.logoutPromise ? this.logoutPromise : (this.logoutPromise = Ee(this, B, this.getFetch(), console, this.location)(e, t), this.logoutPromise.finally(() => {
1146
1146
  this.logoutPromise = null;
1147
1147
  }));
1148
1148
  }
1149
1149
  };
1150
1150
  //#endregion
1151
1151
  //#region src/renewTokens.ts
1152
- async function Ie(e, t, n, r = null) {
1153
- let { tokens: a, status: o } = await H(e)((t) => {
1152
+ async function Ne(e, t, n, r = null) {
1153
+ let { tokens: a, status: o } = await W(e)((t) => {
1154
1154
  e.tokens = t;
1155
1155
  }, 0, 0, t, n, r);
1156
1156
  return await $(e.configuration, e.configurationName) || i(e.configurationName, e.configuration.storage, e.configuration.login_state_storage ?? e.configuration.storage).setTokens(e.tokens), e.tokens ? a : (await e.destroyAsync(o), null);
1157
1157
  }
1158
- async function Le(e, t = !1, n = null, r = null) {
1158
+ async function Pe(e, t = !1, n = null, r = null) {
1159
1159
  let i = e.configuration, a = `${i.client_id}_${e.configurationName}_${i.authority}`, o, s = await $(e.configuration, e.configurationName);
1160
- if (i?.storage === window?.sessionStorage && !s || !navigator.locks) o = await Ie(e, t, n, r);
1160
+ if (i?.storage === window?.sessionStorage && !s || !navigator.locks) o = await Ne(e, t, n, r);
1161
1161
  else {
1162
1162
  let i = "retry";
1163
- for (; i === "retry";) i = await navigator.locks.request(a, { ifAvailable: !0 }, async (i) => i ? await Ie(e, t, n, r) : (e.publishEvent(R.eventNames.syncTokensAsync_lock_not_available, { lock: "lock not available" }), "retry"));
1163
+ for (; i === "retry";) i = await navigator.locks.request(a, { ifAvailable: !0 }, async (i) => i ? await Ne(e, t, n, r) : (e.publishEvent(V.eventNames.syncTokensAsync_lock_not_available, { lock: "lock not available" }), "retry"));
1164
1164
  o = i;
1165
1165
  }
1166
- return o ? (e.timeoutId &&= z(e, e.tokens.expiresAt, n, r), e.tokens) : null;
1166
+ return o ? (e.timeoutId &&= H(e, e.tokens.expiresAt, n, r), e.tokens) : null;
1167
1167
  }
1168
- var z = (e, t, n = null, r = null) => {
1168
+ var H = (e, t, n = null, r = null) => {
1169
1169
  let i = e.configuration.refresh_time_before_tokens_expiration_in_second;
1170
1170
  return e.timeoutId && c.clearTimeout(e.timeoutId), c.setTimeout(async () => {
1171
1171
  let a = { timeLeft: K(i, t) };
1172
- e.publishEvent(R.eventNames.token_timer, a), await Le(e, !1, n, r);
1172
+ e.publishEvent(V.eventNames.token_timer, a), await Pe(e, !1, n, r);
1173
1173
  }, 1e3);
1174
- }, B = {
1174
+ }, U = {
1175
1175
  FORCE_REFRESH: "FORCE_REFRESH",
1176
1176
  SESSION_LOST: "SESSION_LOST",
1177
1177
  NOT_CONNECTED: "NOT_CONNECTED",
@@ -1181,11 +1181,11 @@ var z = (e, t, n = null, r = null) => {
1181
1181
  LOGOUT_FROM_ANOTHER_TAB: "LOGOUT_FROM_ANOTHER_TAB",
1182
1182
  REQUIRE_SYNC_TOKENS: "REQUIRE_SYNC_TOKENS",
1183
1183
  TOKENS_INVALID: "TOKENS_INVALID"
1184
- }, V = (e) => async (t, n, r, a = !1) => {
1184
+ }, Fe = (e) => async (t, n, r, a = !1) => {
1185
1185
  let o = { nonce: null };
1186
1186
  if (!r) return {
1187
1187
  tokens: null,
1188
- status: B.NOT_CONNECTED,
1188
+ status: U.NOT_CONNECTED,
1189
1189
  nonce: o
1190
1190
  };
1191
1191
  let s, c = await e.initAsync(t.authority, t.authority_configuration), l = await $(t, n);
@@ -1193,39 +1193,39 @@ var z = (e, t, n = null, r = null) => {
1193
1193
  let { status: e, tokens: n } = await l.initAsync(c, "syncTokensAsync", t);
1194
1194
  if (e === "LOGGED_OUT") return {
1195
1195
  tokens: null,
1196
- status: B.LOGOUT_FROM_ANOTHER_TAB,
1196
+ status: U.LOGOUT_FROM_ANOTHER_TAB,
1197
1197
  nonce: o
1198
1198
  };
1199
1199
  if (e === "SESSIONS_LOST") return {
1200
1200
  tokens: null,
1201
- status: B.SESSION_LOST,
1201
+ status: U.SESSION_LOST,
1202
1202
  nonce: o
1203
1203
  };
1204
1204
  if (!e || !n) return {
1205
1205
  tokens: null,
1206
- status: B.REQUIRE_SYNC_TOKENS,
1206
+ status: U.REQUIRE_SYNC_TOKENS,
1207
1207
  nonce: o
1208
1208
  };
1209
1209
  if (n.issuedAt !== r.issuedAt) return {
1210
1210
  tokens: n,
1211
- status: K(t.refresh_time_before_tokens_expiration_in_second, n.expiresAt) > 0 ? B.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : B.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID,
1211
+ status: K(t.refresh_time_before_tokens_expiration_in_second, n.expiresAt) > 0 ? U.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : U.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID,
1212
1212
  nonce: await l.getNonceAsync()
1213
1213
  };
1214
1214
  s = await l.getNonceAsync();
1215
1215
  } else {
1216
1216
  let a = i(n, t.storage ?? sessionStorage, t.login_state_storage ?? t.storage ?? sessionStorage), c = await a.initAsync(), { tokens: l } = c, { status: u } = c;
1217
- if (l &&= W(l, e.tokens, t.token_renew_mode), !l) return {
1217
+ if (l &&= Ve(l, e.tokens, t.token_renew_mode), !l) return {
1218
1218
  tokens: null,
1219
- status: B.LOGOUT_FROM_ANOTHER_TAB,
1219
+ status: U.LOGOUT_FROM_ANOTHER_TAB,
1220
1220
  nonce: o
1221
1221
  };
1222
1222
  if (u === "SESSIONS_LOST") return {
1223
1223
  tokens: null,
1224
- status: B.SESSION_LOST,
1224
+ status: U.SESSION_LOST,
1225
1225
  nonce: o
1226
1226
  };
1227
1227
  if (l.issuedAt !== r.issuedAt) {
1228
- let e = K(t.refresh_time_before_tokens_expiration_in_second, l.expiresAt) > 0 ? B.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : B.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID, n = await a.getNonceAsync();
1228
+ let e = K(t.refresh_time_before_tokens_expiration_in_second, l.expiresAt) > 0 ? U.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : U.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID, n = await a.getNonceAsync();
1229
1229
  return {
1230
1230
  tokens: l,
1231
1231
  status: e,
@@ -1244,7 +1244,7 @@ var z = (e, t, n = null, r = null) => {
1244
1244
  status: u,
1245
1245
  nonce: s
1246
1246
  };
1247
- }, H = (t) => async (n, r = 0, a = 0, o = !1, s = null, c = null) => {
1247
+ }, W = (t) => async (n, r = 0, a = 0, o = !1, s = null, c = null) => {
1248
1248
  if (!navigator.onLine && document.hidden) return {
1249
1249
  tokens: t.tokens,
1250
1250
  status: "GIVE_UP"
@@ -1269,7 +1269,7 @@ var z = (e, t, n = null, r = null) => {
1269
1269
  return l ? l.error ? (n(null), t.publishEvent(e.refreshTokensAsync_error, { message: "refresh token silent" }), {
1270
1270
  tokens: null,
1271
1271
  status: "SESSION_LOST"
1272
- }) : (n(l.tokens), t.publishEvent(R.eventNames.token_renewed, {}), {
1272
+ }) : (n(l.tokens), t.publishEvent(V.eventNames.token_renewed, {}), {
1273
1273
  tokens: l.tokens,
1274
1274
  status: "LOGGED"
1275
1275
  }) : (n(null), t.publishEvent(e.refreshTokensAsync_error, { message: "refresh token silent not active" }), {
@@ -1280,38 +1280,38 @@ var z = (e, t, n = null, r = null) => {
1280
1280
  return console.error(r), t.publishEvent(e.refreshTokensAsync_silent_error, {
1281
1281
  message: "exceptionSilent",
1282
1282
  exception: r.message
1283
- }), await H(t)(n, p, m, o, s, c);
1283
+ }), await W(t)(n, p, m, o, s, c);
1284
1284
  }
1285
1285
  };
1286
1286
  try {
1287
- let { status: l, tokens: u, nonce: d } = await V(t)(h, t.configurationName, t.tokens, o);
1287
+ let { status: l, tokens: u, nonce: d } = await Fe(t)(h, t.configurationName, t.tokens, o);
1288
1288
  switch (l) {
1289
- case B.SESSION_LOST: return n(null), t.publishEvent(e.refreshTokensAsync_error, { message: "refresh token session lost" }), {
1289
+ case U.SESSION_LOST: return n(null), t.publishEvent(e.refreshTokensAsync_error, { message: "refresh token session lost" }), {
1290
1290
  tokens: null,
1291
1291
  status: "SESSION_LOST"
1292
1292
  };
1293
- case B.NOT_CONNECTED: return n(null), {
1293
+ case U.NOT_CONNECTED: return n(null), {
1294
1294
  tokens: null,
1295
1295
  status: null
1296
1296
  };
1297
- case B.TOKENS_VALID: return n(u), {
1297
+ case U.TOKENS_VALID: return n(u), {
1298
1298
  tokens: u,
1299
1299
  status: "LOGGED_IN"
1300
1300
  };
1301
- case B.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID: return n(u), t.publishEvent(R.eventNames.token_renewed, { reason: "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID" }), {
1301
+ case U.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID: return n(u), t.publishEvent(V.eventNames.token_renewed, { reason: "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID" }), {
1302
1302
  tokens: u,
1303
1303
  status: "LOGGED_IN"
1304
1304
  };
1305
- case B.LOGOUT_FROM_ANOTHER_TAB: return n(null), t.publishEvent(e.logout_from_another_tab, { status: "session syncTokensAsync" }), {
1305
+ case U.LOGOUT_FROM_ANOTHER_TAB: return n(null), t.publishEvent(e.logout_from_another_tab, { status: "session syncTokensAsync" }), {
1306
1306
  tokens: null,
1307
1307
  status: "LOGGED_OUT"
1308
1308
  };
1309
- case B.REQUIRE_SYNC_TOKENS: return h.token_automatic_renew_mode == I.AutomaticOnlyWhenFetchExecuted && !o ? (t.publishEvent(e.tokensInvalidAndWaitingActionsToRefresh, {}), {
1309
+ case U.REQUIRE_SYNC_TOKENS: return h.token_automatic_renew_mode == R.AutomaticOnlyWhenFetchExecuted && !o ? (t.publishEvent(e.tokensInvalidAndWaitingActionsToRefresh, {}), {
1310
1310
  tokens: t.tokens,
1311
1311
  status: "GIVE_UP"
1312
1312
  }) : (t.publishEvent(e.refreshTokensAsync_begin, { tryNumber: r }), await _());
1313
1313
  default: {
1314
- if (h.token_automatic_renew_mode == I.AutomaticOnlyWhenFetchExecuted && B.FORCE_REFRESH !== l) return t.publishEvent(e.tokensInvalidAndWaitingActionsToRefresh, {}), {
1314
+ if (h.token_automatic_renew_mode == R.AutomaticOnlyWhenFetchExecuted && U.FORCE_REFRESH !== l) return t.publishEvent(e.tokensInvalidAndWaitingActionsToRefresh, {}), {
1315
1315
  tokens: t.tokens,
1316
1316
  status: "GIVE_UP"
1317
1317
  };
@@ -1331,7 +1331,7 @@ var z = (e, t, n = null, r = null) => {
1331
1331
  refresh_token: u.refreshToken
1332
1332
  }, a = await t.initAsync(v, h.authority_configuration), l = document.hidden ? 1e4 : 3e4 * 10, _ = a.tokenEndpoint, b = {};
1333
1333
  h.demonstrating_proof_of_possession && (b.DPoP = await t.generateDemonstrationOfProofOfPossessionAsync(u.accessToken, _, "POST"));
1334
- let x = await ge(t.getFetch())(_, r, y, u, b, h.token_renew_mode, l);
1334
+ let x = await me(t.getFetch())(_, r, y, u, b, h.token_renew_mode, l);
1335
1335
  if (x.success) {
1336
1336
  if (!d || !d.nonce) return n(null), t.publishEvent(e.refreshTokensAsync_error, { message: "refresh token: nonce missing from storage" }), {
1337
1337
  tokens: null,
@@ -1346,7 +1346,7 @@ var z = (e, t, n = null, r = null) => {
1346
1346
  let e = await $(h, t.configurationName);
1347
1347
  e ? await e.setDemonstratingProofOfPossessionNonce(x.demonstratingProofOfPossessionNonce) : await i(t.configurationName, h.storage, h.login_state_storage ?? h.storage).setDemonstratingProofOfPossessionNonce(x.demonstratingProofOfPossessionNonce);
1348
1348
  }
1349
- return t.publishEvent(e.refreshTokensAsync_end, { success: x.success }), t.publishEvent(R.eventNames.token_renewed, { reason: "REFRESH_TOKEN" }), {
1349
+ return t.publishEvent(e.refreshTokensAsync_end, { success: x.success }), t.publishEvent(V.eventNames.token_renewed, { reason: "REFRESH_TOKEN" }), {
1350
1350
  tokens: x.data,
1351
1351
  status: "LOGGED_IN"
1352
1352
  };
@@ -1356,7 +1356,7 @@ var z = (e, t, n = null, r = null) => {
1356
1356
  }), x.status >= 400 && x.status < 500 ? (n(null), t.publishEvent(e.refreshTokensAsync_error, { message: `session lost: ${x.status}` }), {
1357
1357
  tokens: null,
1358
1358
  status: "SESSION_LOST"
1359
- }) : await H(t)(n, p, m, o, s, c);
1359
+ }) : await W(t)(n, p, m, o, s, c);
1360
1360
  })();
1361
1361
  }
1362
1362
  }
@@ -1366,35 +1366,35 @@ var z = (e, t, n = null, r = null) => {
1366
1366
  exception: r.message
1367
1367
  }), new Promise((e, r) => {
1368
1368
  setTimeout(() => {
1369
- H(t)(n, p, m, o, s, c).then(e).catch(r);
1369
+ W(t)(n, p, m, o, s, c).then(e).catch(r);
1370
1370
  }, 1e3);
1371
1371
  });
1372
1372
  }
1373
- }, Re = (e) => decodeURIComponent(Array.prototype.map.call(atob(e), (e) => "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2)).join("")), ze = (e) => JSON.parse(Re(e.replaceAll(/-/g, "+").replaceAll(/_/g, "/"))), Be = (e) => {
1373
+ }, Ie = (e) => decodeURIComponent(Array.prototype.map.call(atob(e), (e) => "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2)).join("")), Le = (e) => JSON.parse(Ie(e.replaceAll(/-/g, "+").replaceAll(/_/g, "/"))), Re = (e) => {
1374
1374
  try {
1375
- return e && Ve(e, ".") === 2 ? ze(e.split(".")[1]) : null;
1375
+ return e && ze(e, ".") === 2 ? Le(e.split(".")[1]) : null;
1376
1376
  } catch (e) {
1377
1377
  console.warn(e);
1378
1378
  }
1379
1379
  return null;
1380
- }, Ve = (e, t) => e.split(t).length - 1, U = {
1380
+ }, ze = (e, t) => e.split(t).length - 1, G = {
1381
1381
  access_token_or_id_token_invalid: "access_token_or_id_token_invalid",
1382
1382
  access_token_invalid: "access_token_invalid",
1383
1383
  id_token_invalid: "id_token_invalid"
1384
1384
  };
1385
- function He(e, t, n) {
1385
+ function Be(e, t, n) {
1386
1386
  return e.issuedAt ? typeof e.issuedAt == "string" ? parseInt(e.issuedAt, 10) : e.issuedAt : t && t.iat ? t.iat : n && n.iat ? n.iat : (/* @__PURE__ */ new Date()).getTime() / 1e3;
1387
1387
  }
1388
- var W = (e, t = null, n) => {
1388
+ var Ve = (e, t = null, n) => {
1389
1389
  if (!e) return null;
1390
1390
  let r, i = typeof e.expiresIn == "string" ? parseInt(e.expiresIn, 10) : e.expiresIn;
1391
- r = e.accessTokenPayload === void 0 ? Be(e.accessToken) : e.accessTokenPayload;
1391
+ r = e.accessTokenPayload === void 0 ? Re(e.accessToken) : e.accessTokenPayload;
1392
1392
  let a;
1393
1393
  a = t != null && "idToken" in t && !("idToken" in e) ? t.idToken : e.idToken;
1394
- let o = e.idTokenPayload ? e.idTokenPayload : Be(a), s = o && o.exp ? o.exp : Number.MAX_VALUE, c = r && r.exp ? r.exp : e.issuedAt + i;
1395
- e.issuedAt = He(e, r, o);
1394
+ let o = e.idTokenPayload ? e.idTokenPayload : Re(a), s = o && o.exp ? o.exp : Number.MAX_VALUE, c = r && r.exp ? r.exp : e.issuedAt + i;
1395
+ e.issuedAt = Be(e, r, o);
1396
1396
  let l;
1397
- l = e.expiresAt ? e.expiresAt : n === U.access_token_invalid ? c : n === U.id_token_invalid || s < c ? s : c;
1397
+ l = e.expiresAt ? e.expiresAt : n === G.access_token_invalid ? c : n === G.id_token_invalid || s < c ? s : c;
1398
1398
  let u = {
1399
1399
  ...e,
1400
1400
  idTokenPayload: o,
@@ -1410,7 +1410,7 @@ var W = (e, t = null, n) => {
1410
1410
  };
1411
1411
  }
1412
1412
  return u;
1413
- }, G = (e, t, n) => {
1413
+ }, He = (e, t, n) => {
1414
1414
  if (!e) return null;
1415
1415
  e.issued_at ||= (/* @__PURE__ */ new Date()).getTime() / 1e3;
1416
1416
  let r = {
@@ -1421,18 +1421,18 @@ var W = (e, t = null, n) => {
1421
1421
  tokenType: e.token_type,
1422
1422
  issuedAt: e.issued_at
1423
1423
  };
1424
- return "refresh_token" in e && (r.refreshToken = e.refresh_token), e.accessTokenPayload !== void 0 && (r.accessTokenPayload = e.accessTokenPayload), e.idTokenPayload !== void 0 && (r.idTokenPayload = e.idTokenPayload), W(r, t, n);
1424
+ return "refresh_token" in e && (r.refreshToken = e.refresh_token), e.accessTokenPayload !== void 0 && (r.accessTokenPayload = e.accessTokenPayload), e.idTokenPayload !== void 0 && (r.idTokenPayload = e.idTokenPayload), Ve(r, t, n);
1425
1425
  }, K = (e, t) => {
1426
1426
  let n = t - (/* @__PURE__ */ new Date()).getTime() / 1e3;
1427
1427
  return Math.round(n - e);
1428
1428
  }, Ue = (e, t = 0) => e ? K(t, e.expiresAt) > 0 : !1, We = async (e, t = 200, n = 50) => {
1429
1429
  let r = n, i = await e.syncTokensInfoAsync();
1430
1430
  for (; [
1431
- B.REQUIRE_SYNC_TOKENS,
1432
- B.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID,
1433
- B.TOKENS_INVALID
1431
+ U.REQUIRE_SYNC_TOKENS,
1432
+ U.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID,
1433
+ U.TOKENS_INVALID
1434
1434
  ].includes(i) && r > 0;) {
1435
- if (e.configuration.token_automatic_renew_mode == I.AutomaticOnlyWhenFetchExecuted) {
1435
+ if (e.configuration.token_automatic_renew_mode == R.AutomaticOnlyWhenFetchExecuted) {
1436
1436
  await e.renewTokensAsync({});
1437
1437
  break;
1438
1438
  } else await J({ milliseconds: t });
@@ -1469,7 +1469,7 @@ var W = (e, t = null, n) => {
1469
1469
  isValid: !0,
1470
1470
  reason: ""
1471
1471
  };
1472
- }, Ke = "7.27.18", qe = null, q, J = ({ milliseconds: e }) => new Promise((t) => c.setTimeout(t, e)), Je = (e = "/") => {
1472
+ }, Ke = "7.27.19", qe = null, q, J = ({ milliseconds: e }) => new Promise((t) => c.setTimeout(t, e)), Je = (e = "/") => {
1473
1473
  try {
1474
1474
  q = new AbortController(), fetch(`${e}OidcKeepAliveServiceWorker.json?minSleepSeconds=150`, { signal: q.signal }).catch((e) => {
1475
1475
  console.log(e);
@@ -1521,28 +1521,35 @@ var W = (e, t = null, n) => {
1521
1521
  navigator.serviceWorker.addEventListener("controllerchange", r), c.setTimeout(() => {
1522
1522
  n || (n = !0, navigator.serviceWorker.removeEventListener("controllerchange", r), t(navigator.serviceWorker.controller ?? null));
1523
1523
  }, e);
1524
- }), Qe = !1, Z = !1, Q = /* @__PURE__ */ new Map(), $e = "oidc.sw.controllerchange_reload_count", et = 3, tt = () => {
1524
+ }), Qe = !1, Z = !1, Q = /* @__PURE__ */ new Map(), $e = (e) => e instanceof DOMException ? e.name === "AbortError" : e?.name === "AbortError", et = "oidc.sw.controllerchange_reload_count", tt = 3, nt = () => {
1525
1525
  try {
1526
- return parseInt(sessionStorage.getItem($e) ?? "0", 10);
1526
+ return parseInt(sessionStorage.getItem(et) ?? "0", 10);
1527
1527
  } catch {
1528
1528
  return 0;
1529
1529
  }
1530
- }, nt = () => {
1531
- let e = tt() + 1;
1530
+ }, rt = () => {
1531
+ let e = nt() + 1;
1532
1532
  try {
1533
- sessionStorage.setItem($e, String(e));
1533
+ sessionStorage.setItem(et, String(e));
1534
1534
  } catch {}
1535
1535
  return e;
1536
- }, rt = () => {
1536
+ }, it = () => {
1537
1537
  try {
1538
- sessionStorage.removeItem($e);
1538
+ sessionStorage.removeItem(et);
1539
1539
  } catch {}
1540
1540
  }, $ = async (e, t) => {
1541
1541
  let n = e.service_worker_relative_url;
1542
1542
  if (typeof window > "u" || typeof navigator > "u" || !navigator.serviceWorker || !n || e.service_worker_activate() === !1) return null;
1543
- let r = `${n}?v=${Ke}`, i = null;
1544
- e.service_worker_register ? (Q.has(n) || Q.set(n, e.service_worker_register(n)), i = await Q.get(n)) : (Q.has(r) || Q.set(r, navigator.serviceWorker.register(r, { updateViaCache: "none" })), i = await Q.get(r));
1545
- let a = `oidc.sw.version_mismatch_reload.${t}`, o = async (e) => {
1543
+ let r = `${n}?v=${Ke}`, i = e.service_worker_register ? n : r;
1544
+ Q.has(i) || Q.set(i, e.service_worker_register ? e.service_worker_register(n) : navigator.serviceWorker.register(r, { updateViaCache: "none" }));
1545
+ let a = null;
1546
+ try {
1547
+ a = await Q.get(i);
1548
+ } catch (e) {
1549
+ if ($e(e)) return Q.delete(i), console.warn("oidc-client: service worker registration was aborted (likely tab shutdown or backgrounding); falling back to non–service-worker mode.", e), null;
1550
+ throw e;
1551
+ }
1552
+ let o = `oidc.sw.version_mismatch_reload.${t}`, s = async (e) => {
1546
1553
  Y(), console.log("New SW waiting – SKIP_WAITING");
1547
1554
  try {
1548
1555
  await new Promise((n, r) => {
@@ -1572,28 +1579,28 @@ var W = (e, t = null, n) => {
1572
1579
  } catch (e) {
1573
1580
  console.warn("SKIP_WAITING failed", e);
1574
1581
  }
1575
- }, s = async () => {
1576
- let e = i.waiting;
1577
- e ? await o(e) : console.warn("sendSkipWaiting called but no waiting service worker found");
1578
- }, l = (e) => {
1582
+ }, l = async () => {
1583
+ let e = a.waiting;
1584
+ e ? await s(e) : console.warn("sendSkipWaiting called but no waiting service worker found");
1585
+ }, u = (e) => {
1579
1586
  Y(), e.addEventListener("statechange", async () => {
1580
1587
  if (e.state === "installed" && navigator.serviceWorker.controller) {
1581
- if (tt() >= et) {
1588
+ if (nt() >= tt) {
1582
1589
  console.warn("SW trackInstallingWorker: skipping SKIP_WAITING because the reload budget is exhausted");
1583
1590
  return;
1584
1591
  }
1585
- await o(e);
1592
+ await s(e);
1586
1593
  }
1587
1594
  });
1588
1595
  };
1589
- i.addEventListener("updatefound", () => {
1590
- let e = i.installing;
1591
- e && l(e);
1592
- }), i.installing ? l(i.installing) : i.waiting && navigator.serviceWorker.controller && (tt() < et ? s() : console.warn("SW: a waiting worker exists but reload budget is exhausted – skipping activation")), i.update().catch((e) => {
1596
+ a.addEventListener("updatefound", () => {
1597
+ let e = a.installing;
1598
+ e && u(e);
1599
+ }), a.installing ? u(a.installing) : a.waiting && navigator.serviceWorker.controller && (nt() < tt ? l() : console.warn("SW: a waiting worker exists but reload budget is exhausted – skipping activation")), a.update().catch((e) => {
1593
1600
  console.error(e);
1594
1601
  });
1595
1602
  try {
1596
- await navigator.serviceWorker.ready, navigator.serviceWorker.controller || (await X(i, { timeoutMs: 8e3 })({
1603
+ await navigator.serviceWorker.ready, navigator.serviceWorker.controller || (await X(a, { timeoutMs: 8e3 })({
1597
1604
  type: "claim",
1598
1605
  configurationName: t,
1599
1606
  data: null
@@ -1603,19 +1610,19 @@ var W = (e, t = null, n) => {
1603
1610
  }
1604
1611
  Qe || (Qe = !0, navigator.serviceWorker.addEventListener("controllerchange", () => {
1605
1612
  if (Z) return;
1606
- let e = nt();
1607
- if (e > et) {
1613
+ let e = rt();
1614
+ if (e > tt) {
1608
1615
  console.warn(`SW controllerchange: reload budget exhausted (${e - 1} reloads). Skipping reload to avoid infinite loop.`);
1609
1616
  return;
1610
1617
  }
1611
1618
  Z = !0, console.log("SW controller changed – reloading page"), Y(), window.location.reload();
1612
1619
  }));
1613
- let u = async (e) => X(i)({
1620
+ let d = async (e) => X(a)({
1614
1621
  type: "clear",
1615
1622
  data: { status: e },
1616
1623
  configurationName: t
1617
- }), d = async (e, n, r) => {
1618
- let o = await X(i)({
1624
+ }), f = async (e, n, r) => {
1625
+ let i = await X(a)({
1619
1626
  type: "init",
1620
1627
  data: {
1621
1628
  oidcServerConfiguration: e,
@@ -1626,140 +1633,140 @@ var W = (e, t = null, n) => {
1626
1633
  }
1627
1634
  },
1628
1635
  configurationName: t
1629
- }), c = o.version;
1630
- if (c !== "7.27.18") {
1631
- console.warn(`Service worker ${c} version mismatch with js client version ${Ke}, unregistering and reloading`);
1632
- let e = parseInt(sessionStorage.getItem(a) ?? "0", 10);
1636
+ }), s = i.version;
1637
+ if (s !== "7.27.19") {
1638
+ console.warn(`Service worker ${s} version mismatch with js client version ${Ke}, unregistering and reloading`);
1639
+ let e = parseInt(sessionStorage.getItem(o) ?? "0", 10);
1633
1640
  if (e < 3) {
1634
- if (sessionStorage.setItem(a, String(e + 1)), i.waiting) return await s(), await J({ milliseconds: 500 }), Z || (Z = !0, window.location.reload()), new Promise(() => {});
1641
+ if (sessionStorage.setItem(o, String(e + 1)), a.waiting) return await l(), await J({ milliseconds: 500 }), Z || (Z = !0, window.location.reload()), new Promise(() => {});
1635
1642
  {
1636
1643
  Y();
1637
1644
  try {
1638
- await i.update();
1645
+ await a.update();
1639
1646
  } catch (e) {
1640
1647
  console.error(e);
1641
1648
  }
1642
- let e = await i.unregister();
1649
+ let e = await a.unregister();
1643
1650
  return console.log(`Service worker unregistering ${e}`), await J({ milliseconds: 500 }), Z || (Z = !0, window.location.reload()), new Promise(() => {});
1644
1651
  }
1645
1652
  } else console.error(`Service worker version mismatch persists after ${e} attempt(s). Continuing with mismatched version.`);
1646
- } else sessionStorage.removeItem(a), rt();
1653
+ } else sessionStorage.removeItem(o), it();
1647
1654
  return {
1648
- tokens: G(o.tokens, null, r.token_renew_mode),
1649
- status: o.status
1655
+ tokens: He(i.tokens, null, r.token_renew_mode),
1656
+ status: i.status
1650
1657
  };
1651
- }, f = (e = "/") => {
1658
+ }, p = (e = "/") => {
1652
1659
  qe ?? (qe = "not_null", Je(e));
1653
- }, p = (e) => X(i)({
1660
+ }, m = (e) => X(a)({
1654
1661
  type: "setSessionState",
1655
1662
  data: { sessionState: e },
1656
1663
  configurationName: t
1657
- }), m = async () => (await X(i)({
1664
+ }), h = async () => (await X(a)({
1658
1665
  type: "getSessionState",
1659
1666
  data: null,
1660
1667
  configurationName: t
1661
- })).sessionState, h = (e) => (sessionStorage[`oidc.nonce.${t}`] = e.nonce, X(i)({
1668
+ })).sessionState, g = (e) => (sessionStorage[`oidc.nonce.${t}`] = e.nonce, X(a)({
1662
1669
  type: "setNonce",
1663
1670
  data: { nonce: e },
1664
1671
  configurationName: t
1665
- })), g = async (e = !0) => {
1666
- let n = (await X(i)({
1672
+ })), _ = async (e = !0) => {
1673
+ let n = (await X(a)({
1667
1674
  type: "getNonce",
1668
1675
  data: null,
1669
1676
  configurationName: t
1670
1677
  })).nonce;
1671
- return n || (n = sessionStorage[`oidc.nonce.${t}`], console.warn("nonce not found in service worker, using sessionStorage"), e && (await h(n), n = (await g(!1)).nonce)), { nonce: n };
1672
- }, _ = {}, v = (e) => {
1678
+ return n || (n = sessionStorage[`oidc.nonce.${t}`], console.warn("nonce not found in service worker, using sessionStorage"), e && (await g(n), n = (await _(!1)).nonce)), { nonce: n };
1679
+ }, v = {}, y = (e) => {
1673
1680
  if (e == null) {
1674
- delete _[t], delete localStorage[`oidc.login.${t}`];
1681
+ delete v[t], delete localStorage[`oidc.login.${t}`];
1675
1682
  return;
1676
1683
  }
1677
- _[t] = e, localStorage[`oidc.login.${t}`] = JSON.stringify(e);
1678
- }, y = () => {
1679
- if (_[t]) return _[t];
1684
+ v[t] = e, localStorage[`oidc.login.${t}`] = JSON.stringify(e);
1685
+ }, b = () => {
1686
+ if (v[t]) return v[t];
1680
1687
  let e = localStorage[`oidc.login.${t}`];
1681
1688
  if (typeof e != "string" || e === "" || e === "undefined" || e === "null") return null;
1682
1689
  try {
1683
- _[t] = JSON.parse(e);
1690
+ v[t] = JSON.parse(e);
1684
1691
  } catch {
1685
1692
  return null;
1686
1693
  }
1687
- return _[t];
1688
- }, b = async (e) => {
1689
- await X(i)({
1694
+ return v[t];
1695
+ }, x = async (e) => {
1696
+ await X(a)({
1690
1697
  type: "setDemonstratingProofOfPossessionNonce",
1691
1698
  data: { demonstratingProofOfPossessionNonce: e },
1692
1699
  configurationName: t
1693
1700
  });
1694
- }, x = async () => (await X(i)({
1701
+ }, ee = async () => (await X(a)({
1695
1702
  type: "getDemonstratingProofOfPossessionNonce",
1696
1703
  data: null,
1697
1704
  configurationName: t
1698
- })).demonstratingProofOfPossessionNonce, ee = async (e) => {
1705
+ })).demonstratingProofOfPossessionNonce, S = async (e) => {
1699
1706
  let n = JSON.stringify(e);
1700
- await X(i)({
1707
+ await X(a)({
1701
1708
  type: "setDemonstratingProofOfPossessionJwk",
1702
1709
  data: { demonstratingProofOfPossessionJwkJson: n },
1703
1710
  configurationName: t
1704
1711
  });
1705
- }, S = async () => {
1706
- let e = await X(i)({
1712
+ }, C = async () => {
1713
+ let e = await X(a)({
1707
1714
  type: "getDemonstratingProofOfPossessionJwk",
1708
1715
  data: null,
1709
1716
  configurationName: t
1710
1717
  });
1711
1718
  return e.demonstratingProofOfPossessionJwkJson ? JSON.parse(e.demonstratingProofOfPossessionJwkJson) : null;
1712
- }, C = async (e = !0) => {
1713
- let n = (await X(i)({
1719
+ }, w = async (e = !0) => {
1720
+ let n = (await X(a)({
1714
1721
  type: "getState",
1715
1722
  data: null,
1716
1723
  configurationName: t
1717
1724
  })).state;
1718
- return n || (n = sessionStorage[`oidc.state.${t}`], console.warn("state not found in service worker, using sessionStorage"), e && (await w(n), n = await C(!1))), n;
1719
- }, w = async (e) => (sessionStorage[`oidc.state.${t}`] = e, X(i)({
1725
+ return n || (n = sessionStorage[`oidc.state.${t}`], console.warn("state not found in service worker, using sessionStorage"), e && (await T(n), n = await w(!1))), n;
1726
+ }, T = async (e) => (sessionStorage[`oidc.state.${t}`] = e, X(a)({
1720
1727
  type: "setState",
1721
1728
  data: { state: e },
1722
1729
  configurationName: t
1723
- })), T = async (e = !0) => {
1724
- let n = (await X(i)({
1730
+ })), E = async (e = !0) => {
1731
+ let n = (await X(a)({
1725
1732
  type: "getCodeVerifier",
1726
1733
  data: null,
1727
1734
  configurationName: t
1728
1735
  })).codeVerifier;
1729
- return n || (n = sessionStorage[`oidc.code_verifier.${t}`], console.warn("codeVerifier not found in service worker, using sessionStorage"), e && (await E(n), n = await T(!1))), n;
1730
- }, E = async (e) => (sessionStorage[`oidc.code_verifier.${t}`] = e, X(i)({
1736
+ return n || (n = sessionStorage[`oidc.code_verifier.${t}`], console.warn("codeVerifier not found in service worker, using sessionStorage"), e && (await D(n), n = await E(!1))), n;
1737
+ }, D = async (e) => (sessionStorage[`oidc.code_verifier.${t}`] = e, X(a)({
1731
1738
  type: "setCodeVerifier",
1732
1739
  data: { codeVerifier: e },
1733
1740
  configurationName: t
1734
1741
  }));
1735
1742
  return {
1736
- clearAsync: u,
1737
- initAsync: d,
1738
- startKeepAliveServiceWorker: () => f(e.service_worker_keep_alive_path),
1739
- setSessionStateAsync: p,
1740
- getSessionStateAsync: m,
1741
- setNonceAsync: h,
1742
- getNonceAsync: g,
1743
- setLoginParams: v,
1744
- getLoginParams: y,
1745
- getStateAsync: C,
1746
- setStateAsync: w,
1747
- getCodeVerifierAsync: T,
1748
- setCodeVerifierAsync: E,
1749
- setDemonstratingProofOfPossessionNonce: b,
1750
- getDemonstratingProofOfPossessionNonce: x,
1751
- setDemonstratingProofOfPossessionJwkAsync: ee,
1752
- getDemonstratingProofOfPossessionJwkAsync: S,
1753
- signalAsync: (e, n) => X(i, n)({
1743
+ clearAsync: d,
1744
+ initAsync: f,
1745
+ startKeepAliveServiceWorker: () => p(e.service_worker_keep_alive_path),
1746
+ setSessionStateAsync: m,
1747
+ getSessionStateAsync: h,
1748
+ setNonceAsync: g,
1749
+ getNonceAsync: _,
1750
+ setLoginParams: y,
1751
+ getLoginParams: b,
1752
+ getStateAsync: w,
1753
+ setStateAsync: T,
1754
+ getCodeVerifierAsync: E,
1755
+ setCodeVerifierAsync: D,
1756
+ setDemonstratingProofOfPossessionNonce: x,
1757
+ getDemonstratingProofOfPossessionNonce: ee,
1758
+ setDemonstratingProofOfPossessionJwkAsync: S,
1759
+ getDemonstratingProofOfPossessionJwkAsync: C,
1760
+ signalAsync: (e, n) => X(a, n)({
1754
1761
  ...e,
1755
1762
  configurationName: e.configurationName ?? t
1756
1763
  })
1757
1764
  };
1758
- }, it = async (e, t, n, r) => {
1765
+ }, at = async (e, t, n, r) => {
1759
1766
  let i = await $(e, t);
1760
1767
  if (!i) throw Error(`signalServiceWorkerAsync: no service worker registered for configuration "${t}"`);
1761
1768
  return i.signalAsync(n, r);
1762
- }, at = class e {
1769
+ }, ot = class e {
1763
1770
  constructor(e) {
1764
1771
  this._oidc = e;
1765
1772
  }
@@ -1773,17 +1780,17 @@ var W = (e, t = null, n) => {
1773
1780
  this._oidc.publishEvent(e, t);
1774
1781
  }
1775
1782
  static {
1776
- this.getOrCreate = (t, n = new D()) => (r, i = "default") => new e(R.getOrCreate(t, n)(r, i));
1783
+ this.getOrCreate = (t, n = new O()) => (r, i = "default") => new e(V.getOrCreate(t, n)(r, i));
1777
1784
  }
1778
1785
  static get(t = "default") {
1779
- let n = R.get(t);
1786
+ let n = V.get(t);
1780
1787
  return n ? new e(n) : null;
1781
1788
  }
1782
1789
  static getOrThrow(t = "default") {
1783
- return new e(R.getOrThrow(t));
1790
+ return new e(V.getOrThrow(t));
1784
1791
  }
1785
1792
  static {
1786
- this.eventNames = R.eventNames;
1793
+ this.eventNames = V.eventNames;
1787
1794
  }
1788
1795
  tryKeepExistingSessionAsync() {
1789
1796
  return this._oidc.tryKeepExistingSessionAsync();
@@ -1827,14 +1834,14 @@ var W = (e, t = null, n) => {
1827
1834
  refresh_time_before_tokens_expiration_in_second: n.configuration.refresh_time_before_tokens_expiration_in_second
1828
1835
  },
1829
1836
  syncTokensInfoAsync: async () => {
1830
- let { status: e } = await V(n)(n.configuration, n.configurationName, n.tokens, !1);
1837
+ let { status: e } = await Fe(n)(n.configuration, n.configurationName, n.tokens, !1);
1831
1838
  return e;
1832
1839
  },
1833
1840
  renewTokensAsync: n.renewTokensAsync.bind(n)
1834
1841
  }, e, t);
1835
1842
  }
1836
1843
  fetchWithTokens(e, t = !1) {
1837
- return ke(e, this._oidc, t);
1844
+ return De(e, this._oidc, t);
1838
1845
  }
1839
1846
  async userInfoAsync(e = !1, t = !1) {
1840
1847
  return this._oidc.userInfoAsync(e, t);
@@ -1843,9 +1850,9 @@ var W = (e, t = null, n) => {
1843
1850
  return this._oidc.userInfo;
1844
1851
  }
1845
1852
  async signalServiceWorker(e, t) {
1846
- return it(this._oidc.configuration, this._oidc.configurationName, e, t);
1853
+ return at(this._oidc.configuration, this._oidc.configurationName, e, t);
1847
1854
  }
1848
- }, ot = "1.0.0", st = {
1855
+ }, st = "1.0.0", ct = {
1849
1856
  SKIP_WAITING: "SKIP_WAITING",
1850
1857
  CLAIM: "claim",
1851
1858
  CLEAR: "clear",
@@ -1862,18 +1869,18 @@ var W = (e, t = null, n) => {
1862
1869
  GET_DPOP_NONCE: "getDemonstratingProofOfPossessionNonce",
1863
1870
  SET_DPOP_JWK: "setDemonstratingProofOfPossessionJwk",
1864
1871
  GET_DPOP_JWK: "getDemonstratingProofOfPossessionJwk"
1865
- }, ct = {
1872
+ }, lt = {
1866
1873
  ACCESS_TOKEN: "ACCESS_TOKEN_SECURED_BY_OIDC_SERVICE_WORKER",
1867
1874
  REFRESH_TOKEN: "REFRESH_TOKEN_SECURED_BY_OIDC_SERVICE_WORKER",
1868
1875
  NONCE_TOKEN: "NONCE_SECURED_BY_OIDC_SERVICE_WORKER",
1869
1876
  CODE_VERIFIER: "CODE_VERIFIER_SECURED_BY_OIDC_SERVICE_WORKER"
1870
- }, lt = "DPOP_SECURED_BY_OIDC_SERVICE_WORKER", ut = {
1877
+ }, ut = "DPOP_SECURED_BY_OIDC_SERVICE_WORKER", dt = {
1871
1878
  TAB_ID: "oidc.tabId.",
1872
1879
  STATE: "oidc.state.",
1873
1880
  NONCE: "oidc.nonce.",
1874
1881
  CODE_VERIFIER: "oidc.code_verifier.",
1875
1882
  LOGIN_PARAMS: "oidc.login.",
1876
1883
  SW_VERSION_MISMATCH_RELOAD: "oidc.sw.version_mismatch_reload."
1877
- }, dt = "oidc.sw.controllerchange_reload_count", ft = (e, t) => `${e}${t}`, pt = (e, t, n = "default") => `${e}_${t}#tabId=${n}`, mt = (e, t = "default") => `${lt}_${e}#tabId=${t}`, ht = (e) => typeof e == "string" ? Object.values(st).includes(e) : !1;
1884
+ }, ft = "oidc.sw.controllerchange_reload_count", pt = (e, t) => `${e}${t}`, mt = (e, t, n = "default") => `${e}_${t}#tabId=${n}`, ht = (e, t = "default") => `${ut}_${e}#tabId=${t}`, gt = (e) => typeof e == "string" ? Object.values(ct).includes(e) : !1;
1878
1885
  //#endregion
1879
- export { lt as DPOP_TOKEN_PLACEHOLDER_PREFIX, at as OidcClient, D as OidcLocation, k as OidcStateError, O as OidcStateErrorCode, ot as PROTOCOL_VERSION, ut as STORAGE_KEY_PREFIX, dt as SW_CONTROLLER_CHANGE_RELOAD_COUNT_KEY, st as ServiceWorkerMessageType, ct as TOKEN_PLACEHOLDERS, I as TokenAutomaticRenewMode, U as TokenRenewMode, mt as buildDpopSecuredPlaceholder, pt as buildSecuredTokenPlaceholder, ft as buildStorageKey, je as getFetchDefault, N as getParseQueryStringFromLocation, be as getPath, le as isOidcStateError, ht as isServiceWorkerMessageType, it as signalServiceWorkerAsync };
1886
+ export { ut as DPOP_TOKEN_PLACEHOLDER_PREFIX, ot as OidcClient, O as OidcLocation, A as OidcStateError, k as OidcStateErrorCode, st as PROTOCOL_VERSION, dt as STORAGE_KEY_PREFIX, ft as SW_CONTROLLER_CHANGE_RELOAD_COUNT_KEY, ct as ServiceWorkerMessageType, lt as TOKEN_PLACEHOLDERS, R as TokenAutomaticRenewMode, G as TokenRenewMode, ht as buildDpopSecuredPlaceholder, mt as buildSecuredTokenPlaceholder, pt as buildStorageKey, ke as getFetchDefault, F as getParseQueryStringFromLocation, ve as getPath, ce as isOidcStateError, gt as isServiceWorkerMessageType, at as signalServiceWorkerAsync };