@axa-fr/oidc-client 7.27.17 → 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
  }
@@ -327,51 +327,51 @@ var _ = {
327
327
  }
328
328
  let i = await e.crypto.subtle.digest(n, f(r));
329
329
  return h(new Uint8Array(i));
330
- } }, x = (e) => async (t) => await y.generate(e)(t), S = (e) => (t) => async (n, r = "POST", i, a = {}) => {
330
+ } }, x = (e) => async (t) => await y.generate(e)(t), ee = (e) => (t) => async (n, r = "POST", i, a = {}) => {
331
331
  let o = {
332
- jti: btoa(C()),
332
+ jti: btoa(S()),
333
333
  htm: r,
334
334
  htu: i,
335
335
  iat: Math.round(Date.now() / 1e3),
336
336
  ...a
337
337
  }, s = await b.thumbprint(e)(n, t.digestAlgorithm);
338
338
  return await v.sign(e)(n, { kid: s }, o, t);
339
- }, C = () => {
339
+ }, S = () => {
340
340
  let e = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx", t = "0123456789abcdef", n = 0, r = "";
341
341
  for (let i = 0; i < 36; i++) e[i] !== "-" && e[i] !== "4" && (n = Math.random() * 16 | 0), e[i] === "x" ? r += t[n] : e[i] === "y" ? (n &= 3, n |= 8, r += t[n]) : r += e[i];
342
342
  return r;
343
- }, w = () => {
343
+ }, C = () => {
344
344
  let e = typeof window < "u" && !!window.crypto;
345
345
  return {
346
346
  hasCrypto: e,
347
347
  hasSubtleCrypto: e && !!window.crypto.subtle
348
348
  };
349
- }, T = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", E = (e) => {
349
+ }, w = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", T = (e) => {
350
350
  let t = [];
351
351
  for (let n = 0; n < e.byteLength; n += 1) {
352
352
  let r = e[n] % 62;
353
- t.push(T[r]);
353
+ t.push(w[r]);
354
354
  }
355
355
  return t.join("");
356
- }, D = (e) => {
357
- let t = new Uint8Array(e), { hasCrypto: n } = w();
356
+ }, E = (e) => {
357
+ let t = new Uint8Array(e), { hasCrypto: n } = C();
358
358
  if (n) window.crypto.getRandomValues(t);
359
359
  else for (let n = 0; n < e; n += 1) t[n] = Math.random() * 62 | 0;
360
- return E(t);
360
+ return T(t);
361
361
  };
362
- function ee(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
367
  function te(e) {
368
368
  return new Promise((t, n) => {
369
- crypto.subtle.digest("SHA-256", ee(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
372
  var ne = (e) => {
373
373
  if (e.length < 43 || e.length > 128) return Promise.reject(/* @__PURE__ */ Error("Invalid code length."));
374
- let { hasSubtleCrypto: t } = w();
374
+ let { hasSubtleCrypto: t } = C();
375
375
  return t ? te(e) : Promise.reject(/* @__PURE__ */ Error("window.crypto.subtle is unavailable."));
376
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 = [
@@ -549,7 +549,7 @@ var oe = () => {
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 oe = () => {
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,
@@ -598,30 +598,38 @@ var oe = () => {
598
598
  getOrigin() {
599
599
  return window.origin;
600
600
  }
601
- }, k = {}, ce = (e, t = window.sessionStorage, n) => {
602
- if (!k[e] && t) {
601
+ }, k = {
602
+ STATE_MISSING: "STATE_MISSING",
603
+ STATE_MISMATCH: "STATE_MISMATCH",
604
+ NONCE_MISSING: "NONCE_MISSING"
605
+ }, A = class e extends Error {
606
+ constructor(t, n) {
607
+ super(n), this.name = "OidcStateError", this.code = t, Object.setPrototypeOf(this, e.prototype);
608
+ }
609
+ }, ce = (e) => e instanceof A, j = {}, le = (e, t = window.sessionStorage, n) => {
610
+ if (!j[e] && t) {
603
611
  let n = t.getItem(e);
604
- n && (k[e] = JSON.parse(n));
612
+ n && (j[e] = JSON.parse(n));
605
613
  }
606
614
  let r = 1e3 * n;
607
- return k[e] && k[e].timestamp + r > Date.now() ? k[e].result : null;
608
- }, le = (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) => {
609
617
  let r = Date.now();
610
- k[e] = {
618
+ j[e] = {
611
619
  result: t,
612
620
  timestamp: r
613
621
  }, n && n.setItem(e, JSON.stringify({
614
622
  result: t,
615
623
  timestamp: r
616
624
  }));
617
- }, ue = 3600, de = (e) => async (t, n = ue, r = window.sessionStorage, i = 1e4) => {
618
- let a = `${t}/.well-known/openid-configuration`, o = `oidc.server:${t}`, s = ce(o, r, n);
619
- if (s) return new I(s);
620
- let c = await A(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);
621
629
  if (c.status !== 200) return null;
622
630
  let l = await c.json();
623
- return le(o, l, r), new I(l);
624
- }, A = (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) => {
625
633
  let a;
626
634
  try {
627
635
  let i = new AbortController();
@@ -631,15 +639,15 @@ var oe = () => {
631
639
  });
632
640
  } catch (a) {
633
641
  if (a.name === "AbortError" || a.message === "Network request failed") {
634
- if (i <= 1) return await A(e)(t, n, r, i + 1);
642
+ if (i <= 1) return await M(e)(t, n, r, i + 1);
635
643
  throw a;
636
644
  } else throw console.error(a.message), a;
637
645
  }
638
646
  return a;
639
- }, fe = {
647
+ }, N = {
640
648
  refresh_token: "refresh_token",
641
649
  access_token: "access_token"
642
- }, pe = (e) => async (t, n, r = fe.refresh_token, i, a = {}, o = 1e4) => {
650
+ }, pe = (e) => async (t, n, r = N.refresh_token, i, a = {}, o = 1e4) => {
643
651
  let s = {
644
652
  token: n,
645
653
  token_type_hint: r,
@@ -652,7 +660,7 @@ var oe = () => {
652
660
  c.push(`${t}=${n}`);
653
661
  }
654
662
  let l = c.join("&");
655
- return (await A(e)(t, {
663
+ return (await M(e)(t, {
656
664
  method: "POST",
657
665
  headers: { "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8" },
658
666
  body: l
@@ -664,7 +672,7 @@ var oe = () => {
664
672
  let t = encodeURIComponent(e), r = encodeURIComponent(n[e]);
665
673
  c.push(`${t}=${r}`);
666
674
  }
667
- let l = c.join("&"), u = await A(e)(t, {
675
+ let l = c.join("&"), u = await M(e)(t, {
668
676
  method: "POST",
669
677
  headers: {
670
678
  "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
@@ -678,27 +686,27 @@ var oe = () => {
678
686
  demonstratingProofOfPossessionNonce: null
679
687
  };
680
688
  let d = await u.json(), f = null;
681
- return u.headers.has(j) && (f = u.headers.get(j)), {
689
+ return u.headers.has(P) && (f = u.headers.get(P)), {
682
690
  success: !0,
683
691
  status: u.status,
684
- data: G(d, i, o),
692
+ data: He(d, i, o),
685
693
  demonstratingProofOfPossessionNonce: f
686
694
  };
687
695
  }, he = (e, t) => async (n, r) => {
688
696
  r = r ? { ...r } : {};
689
- let i = D(128), a = await ne(i);
697
+ let i = E(128), a = await ne(i);
690
698
  await e.setCodeVerifierAsync(i), await e.setStateAsync(r.state), r.code_challenge = a, r.code_challenge_method = "S256";
691
699
  let o = "";
692
700
  if (r) for (let [e, t] of Object.entries(r)) o === "" ? o += "?" : o += "&", o += `${e}=${encodeURIComponent(t)}`;
693
701
  t.open(`${n}${o}`);
694
- }, j = "DPoP-Nonce", ge = (e) => async (t, n, r, i, a = 1e4) => {
702
+ }, P = "DPoP-Nonce", ge = (e) => async (t, n, r, i, a = 1e4) => {
695
703
  n = n ? { ...n } : {}, n.code_verifier = await e.getCodeVerifierAsync();
696
704
  let o = [];
697
705
  for (let e in n) {
698
706
  let t = encodeURIComponent(e), r = encodeURIComponent(n[e]);
699
707
  o.push(`${t}=${r}`);
700
708
  }
701
- let s = o.join("&"), c = await A(fetch)(t, {
709
+ let s = o.join("&"), c = await M(fetch)(t, {
702
710
  method: "POST",
703
711
  headers: {
704
712
  "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
@@ -711,13 +719,13 @@ var oe = () => {
711
719
  status: c.status
712
720
  };
713
721
  let l = null;
714
- c.headers.has(j) && (l = c.headers.get(j));
722
+ c.headers.has(P) && (l = c.headers.get(P));
715
723
  let u = await c.json();
716
724
  return {
717
725
  success: !0,
718
726
  data: {
719
727
  state: n.state,
720
- tokens: G(u, null, i),
728
+ tokens: He(u, null, i),
721
729
  demonstratingProofOfPossessionNonce: l
722
730
  }
723
731
  };
@@ -744,7 +752,7 @@ var oe = () => {
744
752
  n.endsWith("/") && (n = n.slice(0, -1));
745
753
  let { hash: r } = t;
746
754
  return r === "#_=_" && (r = ""), r && (n += r), n;
747
- }, M = (e) => {
755
+ }, F = (e) => {
748
756
  let { search: t } = _e(e);
749
757
  return ye(t);
750
758
  }, ye = (e) => {
@@ -755,7 +763,7 @@ var oe = () => {
755
763
  let d = c;
756
764
  return c = { ...c }, (async () => {
757
765
  let f = s || o.getPath();
758
- if ("state" in c || (c.state = D(16)), r(e.loginAsync_begin, {}), c) for (let e of Object.keys(c)) e.endsWith(":token_request") && delete c[e];
766
+ if ("state" in c || (c.state = E(16)), r(e.loginAsync_begin, {}), c) for (let e of Object.keys(c)) e.endsWith(":token_request") && delete c[e];
759
767
  try {
760
768
  let e = l ? n.silent_redirect_uri : n.redirect_uri;
761
769
  u ||= n.scope;
@@ -763,7 +771,7 @@ var oe = () => {
763
771
  ...n.extras,
764
772
  ...c
765
773
  } : c;
766
- r.nonce ||= D(12);
774
+ r.nonce ||= E(12);
767
775
  let s = { nonce: r.nonce }, p = await $(n, t), m = await a(n.authority, n.authority_configuration), h;
768
776
  if (p) p.setLoginParams({
769
777
  callbackPath: f,
@@ -793,7 +801,7 @@ var oe = () => {
793
801
  }, xe = (t) => async (n = !1) => {
794
802
  try {
795
803
  t.publishEvent(e.loginCallbackAsync_begin, {});
796
- 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 = M(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;
797
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;
798
806
  else {
799
807
  let e = i(t.configurationName, r.storage ?? sessionStorage, r.login_state_storage ?? r.storage ?? sessionStorage);
@@ -801,7 +809,11 @@ var oe = () => {
801
809
  }
802
810
  if (u.error || u.error_description) throw Error(`Error from OIDC server: ${u.error} - ${u.error_description}`);
803
811
  if (u.iss && u.iss !== l.issuer) throw console.error(), Error(`Issuer not valid (expected: ${l.issuer}, received: ${u.iss})`);
804
- if (u.state && u.state !== g) throw Error(`State not valid (expected: ${g}, received: ${u.state})`);
812
+ if (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
+ }
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).");
805
817
  let _ = {
806
818
  code: u.code,
807
819
  grant_type: "authorization_code",
@@ -814,32 +826,32 @@ var oe = () => {
814
826
  if (r.demonstrating_proof_of_possession) if (f) b.DPoP = `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${t.configurationName}`;
815
827
  else {
816
828
  let e = await x(window)(r.demonstrating_proof_of_possession_configuration.generateKeyAlgorithm);
817
- await i(t.configurationName, r.storage, r.login_state_storage ?? r.storage).setDemonstratingProofOfPossessionJwkAsync(e), b.DPoP = await S(window)(r.demonstrating_proof_of_possession_configuration)(e, "POST", y);
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);
818
830
  }
819
- let C = await ge(p)(y, {
831
+ let S = await ge(p)(y, {
820
832
  ..._,
821
833
  ...v
822
834
  }, b, t.configuration.token_renew_mode, c);
823
- if (!C.success) throw Error("Token request failed");
824
- let w, T = C.data.tokens, E = C.data.demonstratingProofOfPossessionNonce;
825
- if (C.data.state !== v.state) throw Error("state is not valid");
826
- let { isValid: D, reason: ee } = He(T, m.nonce, l);
827
- if (!D) throw Error(`Tokens are not OpenID valid, reason: ${ee}`);
835
+ if (!S.success) throw Error("Token request failed");
836
+ let C, w = S.data.tokens, T = S.data.demonstratingProofOfPossessionNonce;
837
+ if (S.data.state !== v.state) throw Error("state is not valid");
838
+ let { isValid: E, reason: D } = Ge(w, m.nonce, l);
839
+ if (!E) throw Error(`Tokens are not OpenID valid, reason: ${D}`);
828
840
  if (f) {
829
- if (T.refreshToken && !T.refreshToken.includes("SECURED_BY_OIDC_SERVICE_WORKER")) throw Error("Refresh token should be hidden by service worker");
830
- if (E && T?.accessToken.includes("SECURED_BY_OIDC_SERVICE_WORKER")) throw Error("Demonstration of proof of possession require Access token not hidden by service worker");
841
+ if (w.refreshToken && !w.refreshToken.includes("SECURED_BY_OIDC_SERVICE_WORKER")) throw Error("Refresh token should be hidden by service worker");
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");
831
843
  }
832
- if (f) await f.initAsync(l, "syncTokensAsync", r), w = f.getLoginParams(), E && await f.setDemonstratingProofOfPossessionNonce(E);
844
+ if (f) await f.initAsync(l, "syncTokensAsync", r), C = f.getLoginParams(), T && await f.setDemonstratingProofOfPossessionNonce(T);
833
845
  else {
834
846
  let e = i(t.configurationName, r.storage, r.login_state_storage ?? r.storage);
835
- w = e.getLoginParams(), E && await e.setDemonstratingProofOfPossessionNonce(E);
847
+ C = e.getLoginParams(), T && await e.setDemonstratingProofOfPossessionNonce(T);
836
848
  }
837
849
  return await t.startCheckSessionAsync(l.checkSessionIframe, a, d, n), t.publishEvent(e.loginCallbackAsync_end, {}), {
838
- tokens: T,
850
+ tokens: w,
839
851
  state: "request.state",
840
- callbackPath: w.callbackPath,
852
+ callbackPath: C.callbackPath,
841
853
  scope: u.scope,
842
- extras: w.extras
854
+ extras: C.extras
843
855
  };
844
856
  } catch (n) {
845
857
  throw console.error(n), t.publishEvent(e.loginCallbackAsync_error, n), n;
@@ -847,7 +859,7 @@ var oe = () => {
847
859
  }, Se = {
848
860
  access_token: "access_token",
849
861
  refresh_token: "refresh_token"
850
- }, N = (e, t) => {
862
+ }, I = (e, t) => {
851
863
  let n = {};
852
864
  if (e) {
853
865
  for (let [r, i] of Object.entries(e)) if (r.endsWith(t)) {
@@ -868,7 +880,7 @@ var oe = () => {
868
880
  c.clearTimeout(e.timeoutId), e.timeoutId = null, e.checkSessionIFrame && e.checkSessionIFrame.stop();
869
881
  let n = await $(e.configuration, e.configurationName);
870
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;
871
- }, P = (t, n) => async () => {
883
+ }, L = (t, n) => async () => {
872
884
  let r = t.tokens?.idTokenPayload?.sub ?? null;
873
885
  await t.destroyAsync("LOGGED_OUT");
874
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);
@@ -890,12 +902,12 @@ var oe = () => {
890
902
  if (t) {
891
903
  let r = [], i = e.tokens ? e.tokens.accessToken : null;
892
904
  if (i && s.logout_tokens_to_invalidate.includes(Se.access_token)) {
893
- let e = N(o, ":revoke_access_token"), a = pe(n)(t, i, fe.access_token, s.client_id, e);
905
+ let e = I(o, ":revoke_access_token"), a = pe(n)(t, i, N.access_token, s.client_id, e);
894
906
  r.push(a);
895
907
  }
896
908
  let a = e.tokens ? e.tokens.refreshToken : null;
897
909
  if (a && s.logout_tokens_to_invalidate.includes(Se.refresh_token)) {
898
- let e = N(o, ":revoke_refresh_token"), i = pe(n)(t, a, fe.refresh_token, s.client_id, e);
910
+ let e = I(o, ":revoke_refresh_token"), i = pe(n)(t, a, N.refresh_token, s.client_id, e);
899
911
  r.push(i);
900
912
  }
901
913
  r.length > 0 && await Promise.all(r);
@@ -903,9 +915,9 @@ var oe = () => {
903
915
  } catch (e) {
904
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);
905
917
  }
906
- let a = N(o, ":oidc");
918
+ let a = I(o, ":oidc");
907
919
  if (a && a.no_reload === "true") {
908
- await P(e, t)(), e.isLoggingOut = !1;
920
+ await L(e, t)(), e.isLoggingOut = !1;
909
921
  return;
910
922
  }
911
923
  let l = Ce(o);
@@ -913,23 +925,23 @@ var oe = () => {
913
925
  let e = Te(c.endSessionEndpoint, l, f, d);
914
926
  i.open(e);
915
927
  } else i.reload();
916
- await P(e, t)();
928
+ await L(e, t)();
917
929
  } catch (t) {
918
930
  throw e.isLoggingOut = !1, t;
919
931
  }
920
- }, F = /* @__PURE__ */ function(e) {
932
+ }, R = /* @__PURE__ */ function(e) {
921
933
  return e.AutomaticBeforeTokenExpiration = "AutomaticBeforeTokensExpiration", e.AutomaticOnlyWhenFetchExecuted = "AutomaticOnlyWhenFetchExecuted", e;
922
934
  }({}), De = (e, t, n = !1) => async (...r) => {
923
935
  let [i, a, ...o] = r, s = a ? { ...a } : { method: "GET" }, c = new Headers();
924
936
  s.headers && (c = s.headers instanceof Headers ? s.headers : new Headers(s.headers));
925
- let l = (await Ve({
937
+ let l = (await We({
926
938
  getTokens: () => t.tokens,
927
939
  configuration: {
928
940
  token_automatic_renew_mode: t.configuration.token_automatic_renew_mode,
929
941
  refresh_time_before_tokens_expiration_in_second: t.configuration.refresh_time_before_tokens_expiration_in_second
930
942
  },
931
943
  syncTokensInfoAsync: async () => {
932
- 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);
933
945
  return e;
934
946
  },
935
947
  renewTokensAsync: t.renewTokensAsync.bind(t)
@@ -954,14 +966,14 @@ var oe = () => {
954
966
  return t.status === 200 ? t.json() : null;
955
967
  })();
956
968
  return e.userInfo = o, o && e.configuration.storage?.setItem(`oidc.${e.configurationName}.userInfo`, JSON.stringify(o)), o;
957
- }, ke = () => fetch, I = class {
969
+ }, ke = () => fetch, z = class {
958
970
  constructor(e) {
959
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;
960
972
  }
961
- }, L = {}, Ae = (e, t = new O()) => (n, r = "default") => (L[r] || (L[r] = new R(n, r, e, t)), L[r]), je = 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) => {
962
974
  let { parsedTokens: t, callbackPath: n, extras: r, scope: i } = await e.loginCallbackAsync();
963
- return e.timeoutId = z(e, t.expiresAt, r, i), { callbackPath: n };
964
- }, Me = (e) => Math.floor(Math.random() * e), R = class t {
975
+ return e.timeoutId = H(e, t.expiresAt, r, i), { callbackPath: n };
976
+ }, Me = (e) => Math.floor(Math.random() * e), V = class t {
965
977
  constructor(e, t = "default", n, r = new O()) {
966
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;
967
979
  let i = e.silent_login_uri;
@@ -970,11 +982,11 @@ var oe = () => {
970
982
  a > 60 && (a -= Math.floor(Math.random() * 40)), this.location = r ?? new O(), this.configuration = {
971
983
  ...e,
972
984
  silent_login_uri: i,
973
- token_automatic_renew_mode: e.token_automatic_renew_mode ?? F.AutomaticBeforeTokenExpiration,
985
+ token_automatic_renew_mode: e.token_automatic_renew_mode ?? R.AutomaticBeforeTokenExpiration,
974
986
  monitor_session: e.monitor_session ?? !1,
975
987
  refresh_time_before_tokens_expiration_in_second: a,
976
988
  silent_login_timeout: e.silent_login_timeout ?? 12e3,
977
- 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,
978
990
  demonstrating_proof_of_possession: e.demonstrating_proof_of_possession ?? !1,
979
991
  authority_timeout_wellknowurl_in_millisecond: e.authority_timeout_wellknowurl_in_millisecond ?? 1e4,
980
992
  logout_tokens_to_invalidate: e.logout_tokens_to_invalidate ?? ["access_token", "refresh_token"],
@@ -1003,7 +1015,7 @@ var oe = () => {
1003
1015
  this.getOrCreate = (e, t) => (n, r = "default") => Ae(e, t)(n, r);
1004
1016
  }
1005
1017
  static get(e = "default") {
1006
- return Object.prototype.hasOwnProperty.call(L, e) ? L[e] : null;
1018
+ return Object.prototype.hasOwnProperty.call(B, e) ? B[e] : null;
1007
1019
  }
1008
1020
  static getOrThrow(e = "default") {
1009
1021
  let n = t.get(e);
@@ -1016,7 +1028,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1016
1028
  }
1017
1029
  _silentLoginCallbackFromIFrame() {
1018
1030
  if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
1019
- let e = this.location, t = M(e.getCurrentHref());
1031
+ let e = this.location, t = F(e.getCurrentHref());
1020
1032
  window.parent.postMessage(`${this.configurationName}_oidc_tokens:${JSON.stringify({
1021
1033
  tokens: this.tokens,
1022
1034
  sessionState: t.session_state
@@ -1025,7 +1037,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1025
1037
  }
1026
1038
  _silentLoginErrorCallbackFromIFrame(e = null) {
1027
1039
  if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
1028
- let t = this.location, n = M(t.getCurrentHref());
1040
+ let t = this.location, n = F(t.getCurrentHref());
1029
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());
1030
1042
  }
1031
1043
  }
@@ -1039,7 +1051,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1039
1051
  async initAsync(e, t) {
1040
1052
  if (this.initPromise !== null) return this.initPromise;
1041
1053
  let n = async () => {
1042
- if (t != null) return new I({
1054
+ if (t != null) return new z({
1043
1055
  authorization_endpoint: t.authorization_endpoint,
1044
1056
  end_session_endpoint: t.end_session_endpoint,
1045
1057
  revocation_endpoint: t.revocation_endpoint,
@@ -1049,7 +1061,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1049
1061
  issuer: t.issuer
1050
1062
  });
1051
1063
  let n = await $(this.configuration, this.configurationName) ? this.configuration.storage || window.sessionStorage : this.configuration.storage;
1052
- return await de(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);
1053
1065
  };
1054
1066
  return this.initPromise = n(), this.initPromise.finally(() => {
1055
1067
  this.initPromise = null;
@@ -1061,7 +1073,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1061
1073
  })) : this.tryKeepExistingSessionPromise;
1062
1074
  }
1063
1075
  async startCheckSessionAsync(e, t, n, r = !1) {
1064
- await d(this, L, this.configuration)(e, t, n, r);
1076
+ await d(this, B, this.configuration)(e, t, n, r);
1065
1077
  }
1066
1078
  async loginAsync(e = void 0, t = null, n = !1, r = void 0, i = !1) {
1067
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(() => {
@@ -1089,9 +1101,9 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1089
1101
  ath: await te(e),
1090
1102
  ...r
1091
1103
  };
1092
- if (await $(a, this.configurationName)) return `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${this.configurationName}#tabId=${Ke(this.configurationName)}`;
1104
+ if (await $(a, this.configurationName)) return `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${this.configurationName}#tabId=${Ye(this.configurationName)}`;
1093
1105
  let s = i(this.configurationName, a.storage, a.login_state_storage ?? a.storage), c = await s.getDemonstratingProofOfPossessionJwkAsync(), l = s.getDemonstratingProofOfPossessionNonce();
1094
- return l && (o.nonce = l), await S(window)(a.demonstrating_proof_of_possession_configuration)(c, n, t, o);
1106
+ return l && (o.nonce = l), await ee(window)(a.demonstrating_proof_of_possession_configuration)(c, n, t, o);
1095
1107
  }
1096
1108
  loginCallbackWithAutoTokensRenewAsync() {
1097
1109
  return this.loginCallbackWithAutoTokensRenewPromise === null ? (this.loginCallbackWithAutoTokensRenewPromise = je(this), this.loginCallbackWithAutoTokensRenewPromise.finally(() => {
@@ -1113,7 +1125,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1113
1125
  return await we(this)(e);
1114
1126
  }
1115
1127
  async clearSessionAsync() {
1116
- return this.clearSessionPromise ? this.clearSessionPromise : (this.clearSessionPromise = P(this, L)(), this.clearSessionPromise.finally(() => {
1128
+ return this.clearSessionPromise ? this.clearSessionPromise : (this.clearSessionPromise = L(this, B)(), this.clearSessionPromise.finally(() => {
1117
1129
  this.clearSessionPromise = null;
1118
1130
  }));
1119
1131
  }
@@ -1130,7 +1142,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1130
1142
  }));
1131
1143
  }
1132
1144
  async logoutAsync(e = void 0, t = null) {
1133
- return this.logoutPromise ? this.logoutPromise : (this.logoutPromise = Ee(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(() => {
1134
1146
  this.logoutPromise = null;
1135
1147
  }));
1136
1148
  }
@@ -1138,7 +1150,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1138
1150
  //#endregion
1139
1151
  //#region src/renewTokens.ts
1140
1152
  async function Ne(e, t, n, r = null) {
1141
- let { tokens: a, status: o } = await H(e)((t) => {
1153
+ let { tokens: a, status: o } = await W(e)((t) => {
1142
1154
  e.tokens = t;
1143
1155
  }, 0, 0, t, n, r);
1144
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);
@@ -1148,18 +1160,18 @@ async function Pe(e, t = !1, n = null, r = null) {
1148
1160
  if (i?.storage === window?.sessionStorage && !s || !navigator.locks) o = await Ne(e, t, n, r);
1149
1161
  else {
1150
1162
  let i = "retry";
1151
- for (; i === "retry";) i = await navigator.locks.request(a, { ifAvailable: !0 }, async (i) => i ? await Ne(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"));
1152
1164
  o = i;
1153
1165
  }
1154
- 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;
1155
1167
  }
1156
- var z = (e, t, n = null, r = null) => {
1168
+ var H = (e, t, n = null, r = null) => {
1157
1169
  let i = e.configuration.refresh_time_before_tokens_expiration_in_second;
1158
1170
  return e.timeoutId && c.clearTimeout(e.timeoutId), c.setTimeout(async () => {
1159
1171
  let a = { timeLeft: K(i, t) };
1160
- e.publishEvent(R.eventNames.token_timer, a), await Pe(e, !1, n, r);
1172
+ e.publishEvent(V.eventNames.token_timer, a), await Pe(e, !1, n, r);
1161
1173
  }, 1e3);
1162
- }, B = {
1174
+ }, U = {
1163
1175
  FORCE_REFRESH: "FORCE_REFRESH",
1164
1176
  SESSION_LOST: "SESSION_LOST",
1165
1177
  NOT_CONNECTED: "NOT_CONNECTED",
@@ -1169,11 +1181,11 @@ var z = (e, t, n = null, r = null) => {
1169
1181
  LOGOUT_FROM_ANOTHER_TAB: "LOGOUT_FROM_ANOTHER_TAB",
1170
1182
  REQUIRE_SYNC_TOKENS: "REQUIRE_SYNC_TOKENS",
1171
1183
  TOKENS_INVALID: "TOKENS_INVALID"
1172
- }, V = (e) => async (t, n, r, a = !1) => {
1184
+ }, Fe = (e) => async (t, n, r, a = !1) => {
1173
1185
  let o = { nonce: null };
1174
1186
  if (!r) return {
1175
1187
  tokens: null,
1176
- status: B.NOT_CONNECTED,
1188
+ status: U.NOT_CONNECTED,
1177
1189
  nonce: o
1178
1190
  };
1179
1191
  let s, c = await e.initAsync(t.authority, t.authority_configuration), l = await $(t, n);
@@ -1181,39 +1193,39 @@ var z = (e, t, n = null, r = null) => {
1181
1193
  let { status: e, tokens: n } = await l.initAsync(c, "syncTokensAsync", t);
1182
1194
  if (e === "LOGGED_OUT") return {
1183
1195
  tokens: null,
1184
- status: B.LOGOUT_FROM_ANOTHER_TAB,
1196
+ status: U.LOGOUT_FROM_ANOTHER_TAB,
1185
1197
  nonce: o
1186
1198
  };
1187
1199
  if (e === "SESSIONS_LOST") return {
1188
1200
  tokens: null,
1189
- status: B.SESSION_LOST,
1201
+ status: U.SESSION_LOST,
1190
1202
  nonce: o
1191
1203
  };
1192
1204
  if (!e || !n) return {
1193
1205
  tokens: null,
1194
- status: B.REQUIRE_SYNC_TOKENS,
1206
+ status: U.REQUIRE_SYNC_TOKENS,
1195
1207
  nonce: o
1196
1208
  };
1197
1209
  if (n.issuedAt !== r.issuedAt) return {
1198
1210
  tokens: n,
1199
- 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,
1200
1212
  nonce: await l.getNonceAsync()
1201
1213
  };
1202
1214
  s = await l.getNonceAsync();
1203
1215
  } else {
1204
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;
1205
- 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 {
1206
1218
  tokens: null,
1207
- status: B.LOGOUT_FROM_ANOTHER_TAB,
1219
+ status: U.LOGOUT_FROM_ANOTHER_TAB,
1208
1220
  nonce: o
1209
1221
  };
1210
1222
  if (u === "SESSIONS_LOST") return {
1211
1223
  tokens: null,
1212
- status: B.SESSION_LOST,
1224
+ status: U.SESSION_LOST,
1213
1225
  nonce: o
1214
1226
  };
1215
1227
  if (l.issuedAt !== r.issuedAt) {
1216
- 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();
1217
1229
  return {
1218
1230
  tokens: l,
1219
1231
  status: e,
@@ -1232,7 +1244,7 @@ var z = (e, t, n = null, r = null) => {
1232
1244
  status: u,
1233
1245
  nonce: s
1234
1246
  };
1235
- }, 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) => {
1236
1248
  if (!navigator.onLine && document.hidden) return {
1237
1249
  tokens: t.tokens,
1238
1250
  status: "GIVE_UP"
@@ -1257,7 +1269,7 @@ var z = (e, t, n = null, r = null) => {
1257
1269
  return l ? l.error ? (n(null), t.publishEvent(e.refreshTokensAsync_error, { message: "refresh token silent" }), {
1258
1270
  tokens: null,
1259
1271
  status: "SESSION_LOST"
1260
- }) : (n(l.tokens), t.publishEvent(R.eventNames.token_renewed, {}), {
1272
+ }) : (n(l.tokens), t.publishEvent(V.eventNames.token_renewed, {}), {
1261
1273
  tokens: l.tokens,
1262
1274
  status: "LOGGED"
1263
1275
  }) : (n(null), t.publishEvent(e.refreshTokensAsync_error, { message: "refresh token silent not active" }), {
@@ -1268,38 +1280,38 @@ var z = (e, t, n = null, r = null) => {
1268
1280
  return console.error(r), t.publishEvent(e.refreshTokensAsync_silent_error, {
1269
1281
  message: "exceptionSilent",
1270
1282
  exception: r.message
1271
- }), await H(t)(n, p, m, o, s, c);
1283
+ }), await W(t)(n, p, m, o, s, c);
1272
1284
  }
1273
1285
  };
1274
1286
  try {
1275
- 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);
1276
1288
  switch (l) {
1277
- 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" }), {
1278
1290
  tokens: null,
1279
1291
  status: "SESSION_LOST"
1280
1292
  };
1281
- case B.NOT_CONNECTED: return n(null), {
1293
+ case U.NOT_CONNECTED: return n(null), {
1282
1294
  tokens: null,
1283
1295
  status: null
1284
1296
  };
1285
- case B.TOKENS_VALID: return n(u), {
1297
+ case U.TOKENS_VALID: return n(u), {
1286
1298
  tokens: u,
1287
1299
  status: "LOGGED_IN"
1288
1300
  };
1289
- 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" }), {
1290
1302
  tokens: u,
1291
1303
  status: "LOGGED_IN"
1292
1304
  };
1293
- 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" }), {
1294
1306
  tokens: null,
1295
1307
  status: "LOGGED_OUT"
1296
1308
  };
1297
- case B.REQUIRE_SYNC_TOKENS: return h.token_automatic_renew_mode == F.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, {}), {
1298
1310
  tokens: t.tokens,
1299
1311
  status: "GIVE_UP"
1300
1312
  }) : (t.publishEvent(e.refreshTokensAsync_begin, { tryNumber: r }), await _());
1301
1313
  default: {
1302
- if (h.token_automatic_renew_mode == F.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, {}), {
1303
1315
  tokens: t.tokens,
1304
1316
  status: "GIVE_UP"
1305
1317
  };
@@ -1321,7 +1333,11 @@ var z = (e, t, n = null, r = null) => {
1321
1333
  h.demonstrating_proof_of_possession && (b.DPoP = await t.generateDemonstrationOfProofOfPossessionAsync(u.accessToken, _, "POST"));
1322
1334
  let x = await me(t.getFetch())(_, r, y, u, b, h.token_renew_mode, l);
1323
1335
  if (x.success) {
1324
- let { isValid: r, reason: o } = He(x.data, d.nonce, a);
1336
+ if (!d || !d.nonce) return n(null), t.publishEvent(e.refreshTokensAsync_error, { message: "refresh token: nonce missing from storage" }), {
1337
+ tokens: null,
1338
+ status: "SESSION_LOST"
1339
+ };
1340
+ let { isValid: r, reason: o } = Ge(x.data, d.nonce, a);
1325
1341
  if (!r) return n(null), t.publishEvent(e.refreshTokensAsync_error, { message: `refresh token return not valid tokens, reason: ${o}` }), {
1326
1342
  tokens: null,
1327
1343
  status: "SESSION_LOST"
@@ -1330,7 +1346,7 @@ var z = (e, t, n = null, r = null) => {
1330
1346
  let e = await $(h, t.configurationName);
1331
1347
  e ? await e.setDemonstratingProofOfPossessionNonce(x.demonstratingProofOfPossessionNonce) : await i(t.configurationName, h.storage, h.login_state_storage ?? h.storage).setDemonstratingProofOfPossessionNonce(x.demonstratingProofOfPossessionNonce);
1332
1348
  }
1333
- 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" }), {
1334
1350
  tokens: x.data,
1335
1351
  status: "LOGGED_IN"
1336
1352
  };
@@ -1340,7 +1356,7 @@ var z = (e, t, n = null, r = null) => {
1340
1356
  }), x.status >= 400 && x.status < 500 ? (n(null), t.publishEvent(e.refreshTokensAsync_error, { message: `session lost: ${x.status}` }), {
1341
1357
  tokens: null,
1342
1358
  status: "SESSION_LOST"
1343
- }) : await H(t)(n, p, m, o, s, c);
1359
+ }) : await W(t)(n, p, m, o, s, c);
1344
1360
  })();
1345
1361
  }
1346
1362
  }
@@ -1350,35 +1366,35 @@ var z = (e, t, n = null, r = null) => {
1350
1366
  exception: r.message
1351
1367
  }), new Promise((e, r) => {
1352
1368
  setTimeout(() => {
1353
- 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);
1354
1370
  }, 1e3);
1355
1371
  });
1356
1372
  }
1357
- }, Fe = (e) => decodeURIComponent(Array.prototype.map.call(atob(e), (e) => "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2)).join("")), Ie = (e) => JSON.parse(Fe(e.replaceAll(/-/g, "+").replaceAll(/_/g, "/"))), Le = (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) => {
1358
1374
  try {
1359
- return e && Re(e, ".") === 2 ? Ie(e.split(".")[1]) : null;
1375
+ return e && ze(e, ".") === 2 ? Le(e.split(".")[1]) : null;
1360
1376
  } catch (e) {
1361
1377
  console.warn(e);
1362
1378
  }
1363
1379
  return null;
1364
- }, Re = (e, t) => e.split(t).length - 1, U = {
1380
+ }, ze = (e, t) => e.split(t).length - 1, G = {
1365
1381
  access_token_or_id_token_invalid: "access_token_or_id_token_invalid",
1366
1382
  access_token_invalid: "access_token_invalid",
1367
1383
  id_token_invalid: "id_token_invalid"
1368
1384
  };
1369
- function ze(e, t, n) {
1385
+ function Be(e, t, n) {
1370
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;
1371
1387
  }
1372
- var W = (e, t = null, n) => {
1388
+ var Ve = (e, t = null, n) => {
1373
1389
  if (!e) return null;
1374
1390
  let r, i = typeof e.expiresIn == "string" ? parseInt(e.expiresIn, 10) : e.expiresIn;
1375
- r = e.accessTokenPayload === void 0 ? Le(e.accessToken) : e.accessTokenPayload;
1391
+ r = e.accessTokenPayload === void 0 ? Re(e.accessToken) : e.accessTokenPayload;
1376
1392
  let a;
1377
1393
  a = t != null && "idToken" in t && !("idToken" in e) ? t.idToken : e.idToken;
1378
- let o = e.idTokenPayload ? e.idTokenPayload : Le(a), s = o && o.exp ? o.exp : Number.MAX_VALUE, c = r && r.exp ? r.exp : e.issuedAt + i;
1379
- e.issuedAt = ze(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);
1380
1396
  let l;
1381
- 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;
1382
1398
  let u = {
1383
1399
  ...e,
1384
1400
  idTokenPayload: o,
@@ -1394,7 +1410,7 @@ var W = (e, t = null, n) => {
1394
1410
  };
1395
1411
  }
1396
1412
  return u;
1397
- }, G = (e, t, n) => {
1413
+ }, He = (e, t, n) => {
1398
1414
  if (!e) return null;
1399
1415
  e.issued_at ||= (/* @__PURE__ */ new Date()).getTime() / 1e3;
1400
1416
  let r = {
@@ -1405,29 +1421,29 @@ var W = (e, t = null, n) => {
1405
1421
  tokenType: e.token_type,
1406
1422
  issuedAt: e.issued_at
1407
1423
  };
1408
- 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);
1409
1425
  }, K = (e, t) => {
1410
1426
  let n = t - (/* @__PURE__ */ new Date()).getTime() / 1e3;
1411
1427
  return Math.round(n - e);
1412
- }, Be = (e, t = 0) => e ? K(t, e.expiresAt) > 0 : !1, Ve = async (e, t = 200, n = 50) => {
1428
+ }, Ue = (e, t = 0) => e ? K(t, e.expiresAt) > 0 : !1, We = async (e, t = 200, n = 50) => {
1413
1429
  let r = n, i = await e.syncTokensInfoAsync();
1414
1430
  for (; [
1415
- B.REQUIRE_SYNC_TOKENS,
1416
- B.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID,
1417
- B.TOKENS_INVALID
1431
+ U.REQUIRE_SYNC_TOKENS,
1432
+ U.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID,
1433
+ U.TOKENS_INVALID
1418
1434
  ].includes(i) && r > 0;) {
1419
- if (e.configuration.token_automatic_renew_mode == F.AutomaticOnlyWhenFetchExecuted) {
1435
+ if (e.configuration.token_automatic_renew_mode == R.AutomaticOnlyWhenFetchExecuted) {
1420
1436
  await e.renewTokensAsync({});
1421
1437
  break;
1422
1438
  } else await J({ milliseconds: t });
1423
1439
  --r, i = await e.syncTokensInfoAsync();
1424
1440
  }
1425
1441
  return {
1426
- isTokensValid: Be(e.getTokens()),
1442
+ isTokensValid: Ue(e.getTokens()),
1427
1443
  tokens: e.getTokens(),
1428
1444
  numberWaited: r - n
1429
1445
  };
1430
- }, He = (e, t, n) => {
1446
+ }, Ge = (e, t, n) => {
1431
1447
  if (e.idTokenPayload) {
1432
1448
  let r = e.idTokenPayload;
1433
1449
  if (n.issuer !== r.iss) return {
@@ -1453,25 +1469,25 @@ var W = (e, t = null, n) => {
1453
1469
  isValid: !0,
1454
1470
  reason: ""
1455
1471
  };
1456
- }, Ue = "7.27.17", We = null, q, J = ({ milliseconds: e }) => new Promise((t) => c.setTimeout(t, e)), Ge = (e = "/") => {
1472
+ }, Ke = "7.27.19", qe = null, q, J = ({ milliseconds: e }) => new Promise((t) => c.setTimeout(t, e)), Je = (e = "/") => {
1457
1473
  try {
1458
1474
  q = new AbortController(), fetch(`${e}OidcKeepAliveServiceWorker.json?minSleepSeconds=150`, { signal: q.signal }).catch((e) => {
1459
1475
  console.log(e);
1460
- }), J({ milliseconds: 150 * 1e3 }).then(() => Ge(e));
1476
+ }), J({ milliseconds: 150 * 1e3 }).then(() => Je(e));
1461
1477
  } catch (e) {
1462
1478
  console.log(e);
1463
1479
  }
1464
1480
  }, Y = () => {
1465
1481
  q && q.abort();
1466
- }, Ke = (e) => {
1482
+ }, Ye = (e) => {
1467
1483
  let t = `oidc.tabId.${e}`, n = sessionStorage.getItem(t);
1468
1484
  if (n) return n;
1469
1485
  let r = globalThis.crypto.randomUUID();
1470
1486
  return sessionStorage.setItem(t, r), r;
1471
- }, qe = (e) => navigator.serviceWorker.controller ?? e.active ?? e.waiting ?? e.installing ?? null, X = (e, t) => (n) => {
1487
+ }, Xe = (e) => navigator.serviceWorker.controller ?? e.active ?? e.waiting ?? e.installing ?? null, X = (e, t) => (n) => {
1472
1488
  let r = t?.timeoutMs ?? 5e3;
1473
1489
  return new Promise((t, i) => {
1474
- let a = qe(e);
1490
+ let a = Xe(e);
1475
1491
  if (!a) {
1476
1492
  i(/* @__PURE__ */ Error("Service worker target not available (controller/active/waiting/installing missing)"));
1477
1493
  return;
@@ -1492,41 +1508,48 @@ var W = (e, t = null, n) => {
1492
1508
  let e = n?.configurationName;
1493
1509
  a.postMessage({
1494
1510
  ...n,
1495
- tabId: Ke(e ?? "default")
1511
+ tabId: Ye(e ?? "default")
1496
1512
  }, [o.port2]);
1497
1513
  } catch (e) {
1498
1514
  l(), i(e);
1499
1515
  }
1500
1516
  });
1501
- }, Je = async (e) => navigator.serviceWorker.controller ? navigator.serviceWorker.controller : new Promise((t) => {
1517
+ }, Ze = async (e) => navigator.serviceWorker.controller ? navigator.serviceWorker.controller : new Promise((t) => {
1502
1518
  let n = !1, r = () => {
1503
1519
  n || (n = !0, navigator.serviceWorker.removeEventListener("controllerchange", r), t(navigator.serviceWorker.controller ?? null));
1504
1520
  };
1505
1521
  navigator.serviceWorker.addEventListener("controllerchange", r), c.setTimeout(() => {
1506
1522
  n || (n = !0, navigator.serviceWorker.removeEventListener("controllerchange", r), t(navigator.serviceWorker.controller ?? null));
1507
1523
  }, e);
1508
- }), Ye = !1, Z = !1, Q = /* @__PURE__ */ new Map(), Xe = "oidc.sw.controllerchange_reload_count", Ze = 3, Qe = () => {
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 = () => {
1509
1525
  try {
1510
- return parseInt(sessionStorage.getItem(Xe) ?? "0", 10);
1526
+ return parseInt(sessionStorage.getItem(et) ?? "0", 10);
1511
1527
  } catch {
1512
1528
  return 0;
1513
1529
  }
1514
- }, $e = () => {
1515
- let e = Qe() + 1;
1530
+ }, rt = () => {
1531
+ let e = nt() + 1;
1516
1532
  try {
1517
- sessionStorage.setItem(Xe, String(e));
1533
+ sessionStorage.setItem(et, String(e));
1518
1534
  } catch {}
1519
1535
  return e;
1520
- }, et = () => {
1536
+ }, it = () => {
1521
1537
  try {
1522
- sessionStorage.removeItem(Xe);
1538
+ sessionStorage.removeItem(et);
1523
1539
  } catch {}
1524
1540
  }, $ = async (e, t) => {
1525
1541
  let n = e.service_worker_relative_url;
1526
1542
  if (typeof window > "u" || typeof navigator > "u" || !navigator.serviceWorker || !n || e.service_worker_activate() === !1) return null;
1527
- let r = `${n}?v=${Ue}`, i = null;
1528
- 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));
1529
- 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) => {
1530
1553
  Y(), console.log("New SW waiting – SKIP_WAITING");
1531
1554
  try {
1532
1555
  await new Promise((n, r) => {
@@ -1547,7 +1570,7 @@ var W = (e, t = null, n) => {
1547
1570
  type: "SKIP_WAITING",
1548
1571
  configurationName: t,
1549
1572
  data: null,
1550
- tabId: Ke(t ?? "default")
1573
+ tabId: Ye(t ?? "default")
1551
1574
  }, [i.port2]);
1552
1575
  } catch (e) {
1553
1576
  o(), r(e);
@@ -1556,50 +1579,50 @@ var W = (e, t = null, n) => {
1556
1579
  } catch (e) {
1557
1580
  console.warn("SKIP_WAITING failed", e);
1558
1581
  }
1559
- }, s = async () => {
1560
- let e = i.waiting;
1561
- e ? await o(e) : console.warn("sendSkipWaiting called but no waiting service worker found");
1562
- }, 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) => {
1563
1586
  Y(), e.addEventListener("statechange", async () => {
1564
1587
  if (e.state === "installed" && navigator.serviceWorker.controller) {
1565
- if (Qe() >= Ze) {
1588
+ if (nt() >= tt) {
1566
1589
  console.warn("SW trackInstallingWorker: skipping SKIP_WAITING because the reload budget is exhausted");
1567
1590
  return;
1568
1591
  }
1569
- await o(e);
1592
+ await s(e);
1570
1593
  }
1571
1594
  });
1572
1595
  };
1573
- i.addEventListener("updatefound", () => {
1574
- let e = i.installing;
1575
- e && l(e);
1576
- }), i.installing ? l(i.installing) : i.waiting && navigator.serviceWorker.controller && (Qe() < Ze ? 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) => {
1577
1600
  console.error(e);
1578
1601
  });
1579
1602
  try {
1580
- 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 })({
1581
1604
  type: "claim",
1582
1605
  configurationName: t,
1583
1606
  data: null
1584
- }), await Je(2e3));
1607
+ }), await Ze(2e3));
1585
1608
  } catch (e) {
1586
1609
  return console.warn(`Failed init ServiceWorker ${e?.toString?.() ?? String(e)}`), null;
1587
1610
  }
1588
- Ye || (Ye = !0, navigator.serviceWorker.addEventListener("controllerchange", () => {
1611
+ Qe || (Qe = !0, navigator.serviceWorker.addEventListener("controllerchange", () => {
1589
1612
  if (Z) return;
1590
- let e = $e();
1591
- if (e > Ze) {
1613
+ let e = rt();
1614
+ if (e > tt) {
1592
1615
  console.warn(`SW controllerchange: reload budget exhausted (${e - 1} reloads). Skipping reload to avoid infinite loop.`);
1593
1616
  return;
1594
1617
  }
1595
1618
  Z = !0, console.log("SW controller changed – reloading page"), Y(), window.location.reload();
1596
1619
  }));
1597
- let u = async (e) => X(i)({
1620
+ let d = async (e) => X(a)({
1598
1621
  type: "clear",
1599
1622
  data: { status: e },
1600
1623
  configurationName: t
1601
- }), d = async (e, n, r) => {
1602
- let o = await X(i)({
1624
+ }), f = async (e, n, r) => {
1625
+ let i = await X(a)({
1603
1626
  type: "init",
1604
1627
  data: {
1605
1628
  oidcServerConfiguration: e,
@@ -1610,140 +1633,140 @@ var W = (e, t = null, n) => {
1610
1633
  }
1611
1634
  },
1612
1635
  configurationName: t
1613
- }), c = o.version;
1614
- if (c !== "7.27.17") {
1615
- console.warn(`Service worker ${c} version mismatch with js client version ${Ue}, unregistering and reloading`);
1616
- 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);
1617
1640
  if (e < 3) {
1618
- 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(() => {});
1619
1642
  {
1620
1643
  Y();
1621
1644
  try {
1622
- await i.update();
1645
+ await a.update();
1623
1646
  } catch (e) {
1624
1647
  console.error(e);
1625
1648
  }
1626
- let e = await i.unregister();
1649
+ let e = await a.unregister();
1627
1650
  return console.log(`Service worker unregistering ${e}`), await J({ milliseconds: 500 }), Z || (Z = !0, window.location.reload()), new Promise(() => {});
1628
1651
  }
1629
1652
  } else console.error(`Service worker version mismatch persists after ${e} attempt(s). Continuing with mismatched version.`);
1630
- } else sessionStorage.removeItem(a), et();
1653
+ } else sessionStorage.removeItem(o), it();
1631
1654
  return {
1632
- tokens: G(o.tokens, null, r.token_renew_mode),
1633
- status: o.status
1655
+ tokens: He(i.tokens, null, r.token_renew_mode),
1656
+ status: i.status
1634
1657
  };
1635
- }, f = (e = "/") => {
1636
- We ?? (We = "not_null", Ge(e));
1637
- }, p = (e) => X(i)({
1658
+ }, p = (e = "/") => {
1659
+ qe ?? (qe = "not_null", Je(e));
1660
+ }, m = (e) => X(a)({
1638
1661
  type: "setSessionState",
1639
1662
  data: { sessionState: e },
1640
1663
  configurationName: t
1641
- }), m = async () => (await X(i)({
1664
+ }), h = async () => (await X(a)({
1642
1665
  type: "getSessionState",
1643
1666
  data: null,
1644
1667
  configurationName: t
1645
- })).sessionState, h = (e) => (sessionStorage[`oidc.nonce.${t}`] = e.nonce, X(i)({
1668
+ })).sessionState, g = (e) => (sessionStorage[`oidc.nonce.${t}`] = e.nonce, X(a)({
1646
1669
  type: "setNonce",
1647
1670
  data: { nonce: e },
1648
1671
  configurationName: t
1649
- })), g = async (e = !0) => {
1650
- let n = (await X(i)({
1672
+ })), _ = async (e = !0) => {
1673
+ let n = (await X(a)({
1651
1674
  type: "getNonce",
1652
1675
  data: null,
1653
1676
  configurationName: t
1654
1677
  })).nonce;
1655
- 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 };
1656
- }, _ = {}, 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) => {
1657
1680
  if (e == null) {
1658
- delete _[t], delete localStorage[`oidc.login.${t}`];
1681
+ delete v[t], delete localStorage[`oidc.login.${t}`];
1659
1682
  return;
1660
1683
  }
1661
- _[t] = e, localStorage[`oidc.login.${t}`] = JSON.stringify(e);
1662
- }, y = () => {
1663
- if (_[t]) return _[t];
1684
+ v[t] = e, localStorage[`oidc.login.${t}`] = JSON.stringify(e);
1685
+ }, b = () => {
1686
+ if (v[t]) return v[t];
1664
1687
  let e = localStorage[`oidc.login.${t}`];
1665
1688
  if (typeof e != "string" || e === "" || e === "undefined" || e === "null") return null;
1666
1689
  try {
1667
- _[t] = JSON.parse(e);
1690
+ v[t] = JSON.parse(e);
1668
1691
  } catch {
1669
1692
  return null;
1670
1693
  }
1671
- return _[t];
1672
- }, b = async (e) => {
1673
- await X(i)({
1694
+ return v[t];
1695
+ }, x = async (e) => {
1696
+ await X(a)({
1674
1697
  type: "setDemonstratingProofOfPossessionNonce",
1675
1698
  data: { demonstratingProofOfPossessionNonce: e },
1676
1699
  configurationName: t
1677
1700
  });
1678
- }, x = async () => (await X(i)({
1701
+ }, ee = async () => (await X(a)({
1679
1702
  type: "getDemonstratingProofOfPossessionNonce",
1680
1703
  data: null,
1681
1704
  configurationName: t
1682
1705
  })).demonstratingProofOfPossessionNonce, S = async (e) => {
1683
1706
  let n = JSON.stringify(e);
1684
- await X(i)({
1707
+ await X(a)({
1685
1708
  type: "setDemonstratingProofOfPossessionJwk",
1686
1709
  data: { demonstratingProofOfPossessionJwkJson: n },
1687
1710
  configurationName: t
1688
1711
  });
1689
1712
  }, C = async () => {
1690
- let e = await X(i)({
1713
+ let e = await X(a)({
1691
1714
  type: "getDemonstratingProofOfPossessionJwk",
1692
1715
  data: null,
1693
1716
  configurationName: t
1694
1717
  });
1695
1718
  return e.demonstratingProofOfPossessionJwkJson ? JSON.parse(e.demonstratingProofOfPossessionJwkJson) : null;
1696
1719
  }, w = async (e = !0) => {
1697
- let n = (await X(i)({
1720
+ let n = (await X(a)({
1698
1721
  type: "getState",
1699
1722
  data: null,
1700
1723
  configurationName: t
1701
1724
  })).state;
1702
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;
1703
- }, T = async (e) => (sessionStorage[`oidc.state.${t}`] = e, X(i)({
1726
+ }, T = async (e) => (sessionStorage[`oidc.state.${t}`] = e, X(a)({
1704
1727
  type: "setState",
1705
1728
  data: { state: e },
1706
1729
  configurationName: t
1707
1730
  })), E = async (e = !0) => {
1708
- let n = (await X(i)({
1731
+ let n = (await X(a)({
1709
1732
  type: "getCodeVerifier",
1710
1733
  data: null,
1711
1734
  configurationName: t
1712
1735
  })).codeVerifier;
1713
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;
1714
- }, D = async (e) => (sessionStorage[`oidc.code_verifier.${t}`] = e, X(i)({
1737
+ }, D = async (e) => (sessionStorage[`oidc.code_verifier.${t}`] = e, X(a)({
1715
1738
  type: "setCodeVerifier",
1716
1739
  data: { codeVerifier: e },
1717
1740
  configurationName: t
1718
1741
  }));
1719
1742
  return {
1720
- clearAsync: u,
1721
- initAsync: d,
1722
- startKeepAliveServiceWorker: () => f(e.service_worker_keep_alive_path),
1723
- setSessionStateAsync: p,
1724
- getSessionStateAsync: m,
1725
- setNonceAsync: h,
1726
- getNonceAsync: g,
1727
- setLoginParams: v,
1728
- getLoginParams: y,
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,
1729
1752
  getStateAsync: w,
1730
1753
  setStateAsync: T,
1731
1754
  getCodeVerifierAsync: E,
1732
1755
  setCodeVerifierAsync: D,
1733
- setDemonstratingProofOfPossessionNonce: b,
1734
- getDemonstratingProofOfPossessionNonce: x,
1756
+ setDemonstratingProofOfPossessionNonce: x,
1757
+ getDemonstratingProofOfPossessionNonce: ee,
1735
1758
  setDemonstratingProofOfPossessionJwkAsync: S,
1736
1759
  getDemonstratingProofOfPossessionJwkAsync: C,
1737
- signalAsync: (e, n) => X(i, n)({
1760
+ signalAsync: (e, n) => X(a, n)({
1738
1761
  ...e,
1739
1762
  configurationName: e.configurationName ?? t
1740
1763
  })
1741
1764
  };
1742
- }, tt = async (e, t, n, r) => {
1765
+ }, at = async (e, t, n, r) => {
1743
1766
  let i = await $(e, t);
1744
1767
  if (!i) throw Error(`signalServiceWorkerAsync: no service worker registered for configuration "${t}"`);
1745
1768
  return i.signalAsync(n, r);
1746
- }, nt = class e {
1769
+ }, ot = class e {
1747
1770
  constructor(e) {
1748
1771
  this._oidc = e;
1749
1772
  }
@@ -1757,17 +1780,17 @@ var W = (e, t = null, n) => {
1757
1780
  this._oidc.publishEvent(e, t);
1758
1781
  }
1759
1782
  static {
1760
- this.getOrCreate = (t, n = new O()) => (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));
1761
1784
  }
1762
1785
  static get(t = "default") {
1763
- let n = R.get(t);
1786
+ let n = V.get(t);
1764
1787
  return n ? new e(n) : null;
1765
1788
  }
1766
1789
  static getOrThrow(t = "default") {
1767
- return new e(R.getOrThrow(t));
1790
+ return new e(V.getOrThrow(t));
1768
1791
  }
1769
1792
  static {
1770
- this.eventNames = R.eventNames;
1793
+ this.eventNames = V.eventNames;
1771
1794
  }
1772
1795
  tryKeepExistingSessionAsync() {
1773
1796
  return this._oidc.tryKeepExistingSessionAsync();
@@ -1804,14 +1827,14 @@ var W = (e, t = null, n) => {
1804
1827
  }
1805
1828
  async getValidTokenAsync(e = 200, t = 50) {
1806
1829
  let n = this._oidc;
1807
- return Ve({
1830
+ return We({
1808
1831
  getTokens: () => n.tokens,
1809
1832
  configuration: {
1810
1833
  token_automatic_renew_mode: n.configuration.token_automatic_renew_mode,
1811
1834
  refresh_time_before_tokens_expiration_in_second: n.configuration.refresh_time_before_tokens_expiration_in_second
1812
1835
  },
1813
1836
  syncTokensInfoAsync: async () => {
1814
- 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);
1815
1838
  return e;
1816
1839
  },
1817
1840
  renewTokensAsync: n.renewTokensAsync.bind(n)
@@ -1827,9 +1850,9 @@ var W = (e, t = null, n) => {
1827
1850
  return this._oidc.userInfo;
1828
1851
  }
1829
1852
  async signalServiceWorker(e, t) {
1830
- return tt(this._oidc.configuration, this._oidc.configurationName, e, t);
1853
+ return at(this._oidc.configuration, this._oidc.configurationName, e, t);
1831
1854
  }
1832
- }, rt = "1.0.0", it = {
1855
+ }, st = "1.0.0", ct = {
1833
1856
  SKIP_WAITING: "SKIP_WAITING",
1834
1857
  CLAIM: "claim",
1835
1858
  CLEAR: "clear",
@@ -1846,18 +1869,18 @@ var W = (e, t = null, n) => {
1846
1869
  GET_DPOP_NONCE: "getDemonstratingProofOfPossessionNonce",
1847
1870
  SET_DPOP_JWK: "setDemonstratingProofOfPossessionJwk",
1848
1871
  GET_DPOP_JWK: "getDemonstratingProofOfPossessionJwk"
1849
- }, at = {
1872
+ }, lt = {
1850
1873
  ACCESS_TOKEN: "ACCESS_TOKEN_SECURED_BY_OIDC_SERVICE_WORKER",
1851
1874
  REFRESH_TOKEN: "REFRESH_TOKEN_SECURED_BY_OIDC_SERVICE_WORKER",
1852
1875
  NONCE_TOKEN: "NONCE_SECURED_BY_OIDC_SERVICE_WORKER",
1853
1876
  CODE_VERIFIER: "CODE_VERIFIER_SECURED_BY_OIDC_SERVICE_WORKER"
1854
- }, ot = "DPOP_SECURED_BY_OIDC_SERVICE_WORKER", st = {
1877
+ }, ut = "DPOP_SECURED_BY_OIDC_SERVICE_WORKER", dt = {
1855
1878
  TAB_ID: "oidc.tabId.",
1856
1879
  STATE: "oidc.state.",
1857
1880
  NONCE: "oidc.nonce.",
1858
1881
  CODE_VERIFIER: "oidc.code_verifier.",
1859
1882
  LOGIN_PARAMS: "oidc.login.",
1860
1883
  SW_VERSION_MISMATCH_RELOAD: "oidc.sw.version_mismatch_reload."
1861
- }, ct = "oidc.sw.controllerchange_reload_count", lt = (e, t) => `${e}${t}`, ut = (e, t, n = "default") => `${e}_${t}#tabId=${n}`, dt = (e, t = "default") => `${ot}_${e}#tabId=${t}`, ft = (e) => typeof e == "string" ? Object.values(it).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;
1862
1885
  //#endregion
1863
- export { ot as DPOP_TOKEN_PLACEHOLDER_PREFIX, nt as OidcClient, O as OidcLocation, rt as PROTOCOL_VERSION, st as STORAGE_KEY_PREFIX, ct as SW_CONTROLLER_CHANGE_RELOAD_COUNT_KEY, it as ServiceWorkerMessageType, at as TOKEN_PLACEHOLDERS, F as TokenAutomaticRenewMode, U as TokenRenewMode, dt as buildDpopSecuredPlaceholder, ut as buildSecuredTokenPlaceholder, lt as buildStorageKey, ke as getFetchDefault, M as getParseQueryStringFromLocation, ve as getPath, ft as isServiceWorkerMessageType, tt 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 };