@axa-fr/oidc-client 7.30.2 → 7.30.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -296,7 +296,7 @@ var e = {
296
296
  phase: "login",
297
297
  retryable: !1
298
298
  });
299
- return o.timeoutId && b.clearTimeout(o.timeoutId), o.tokens = u.tokens, a(f.token_acquired, {}), o.timeoutId = q(o, o.tokens.expiresAt, t, s), {};
299
+ return o.timeoutId && b.clearTimeout(o.timeoutId), o.tokens = u.tokens, a(f.token_acquired, {}), o.timeoutId = Tt(o, o.tokens.expiresAt, t, s), {};
300
300
  }
301
301
  })().catch((e) => e);
302
302
  }, C = (e, t, n) => (r, i, a, o = !1) => {
@@ -414,7 +414,7 @@ var O = {
414
414
  }
415
415
  let i = await e.crypto.subtle.digest(n, w(r));
416
416
  return D(new Uint8Array(i));
417
- } }, te = (e) => async (t) => await A.generate(e)(t), ne = (e) => (t) => async (n, r = "POST", i, a = {}) => {
417
+ } }, te = (e) => async (t) => await A.generate(e)(t), M = (e) => (t) => async (n, r = "POST", i, a = {}) => {
418
418
  let o = new URL(i, e.location?.href);
419
419
  o.search = "", o.hash = "";
420
420
  let s = {
@@ -425,39 +425,39 @@ var O = {
425
425
  ...a
426
426
  }, c = await j.thumbprint(e)(n, t.digestAlgorithm);
427
427
  return await k.sign(e)(n, { kid: c }, s, t);
428
- }, re = () => typeof globalThis < "u" ? globalThis.crypto : void 0, ie = () => {
429
- let e = re();
428
+ }, N = () => typeof globalThis < "u" ? globalThis.crypto : void 0, ne = () => {
429
+ let e = N();
430
430
  return {
431
431
  hasCrypto: !!e,
432
432
  hasSubtleCrypto: !!e?.subtle
433
433
  };
434
- }, ae = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", oe = (e) => {
434
+ }, re = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", ie = (e) => {
435
435
  let t = [];
436
436
  for (let n = 0; n < e.byteLength; n += 1) {
437
437
  let r = e[n] % 62;
438
- t.push(ae[r]);
438
+ t.push(re[r]);
439
439
  }
440
440
  return t.join("");
441
- }, se = (e) => {
442
- let t = new Uint8Array(e), n = re();
441
+ }, ae = (e) => {
442
+ let t = new Uint8Array(e), n = N();
443
443
  if (!n?.getRandomValues) throw Error("Web Crypto API is unavailable; secure random values cannot be generated.");
444
- return n.getRandomValues(t), oe(t);
444
+ return n.getRandomValues(t), ie(t);
445
445
  };
446
- function ce(e) {
446
+ function oe(e) {
447
447
  let t = new ArrayBuffer(e.length), n = new Uint8Array(t);
448
448
  for (let t = 0; t < e.length; t++) n[t] = e.charCodeAt(t);
449
449
  return n;
450
450
  }
451
- function le(e) {
451
+ function se(e) {
452
452
  return new Promise((t, n) => {
453
- crypto.subtle.digest("SHA-256", ce(e)).then((e) => t(D(new Uint8Array(e))), (e) => n(e));
453
+ crypto.subtle.digest("SHA-256", oe(e)).then((e) => t(D(new Uint8Array(e))), (e) => n(e));
454
454
  });
455
455
  }
456
- var ue = (e) => {
456
+ var ce = (e) => {
457
457
  if (e.length < 43 || e.length > 128) return Promise.reject(/* @__PURE__ */ Error("Invalid code length."));
458
- let { hasSubtleCrypto: t } = ie();
459
- return t ? le(e) : Promise.reject(/* @__PURE__ */ Error("window.crypto.subtle is unavailable."));
460
- }, de = (e) => !!(e.os === "iOS" && e.osVersion.startsWith("12") || e.os === "Mac OS X" && e.osVersion.startsWith("10_15_6")), fe = (e) => {
458
+ let { hasSubtleCrypto: t } = ne();
459
+ return t ? se(e) : Promise.reject(/* @__PURE__ */ Error("window.crypto.subtle is unavailable."));
460
+ }, le = (e) => !!(e.os === "iOS" && e.osVersion.startsWith("12") || e.os === "Mac OS X" && e.osVersion.startsWith("10_15_6")), ue = (e) => {
461
461
  let t = e.appVersion, n = e.userAgent, r = "-", i = [
462
462
  {
463
463
  s: "Windows 10",
@@ -593,7 +593,7 @@ var ue = (e) => {
593
593
  osVersion: a
594
594
  };
595
595
  };
596
- function pe() {
596
+ function de() {
597
597
  let e = navigator.userAgent, t, n = e.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
598
598
  if (/trident/i.test(n[1])) return t = /\brv[ :]+(\d+)/g.exec(e) || [], {
599
599
  name: "ie",
@@ -619,10 +619,13 @@ function pe() {
619
619
  version: n[1]
620
620
  };
621
621
  }
622
- var me = () => {
623
- let { name: e, version: t } = pe();
624
- return e === "chrome" && parseInt(t) <= 70 || e === "opera" && (!t || parseInt(t.split(".")[0]) < 80) || e === "ie" ? !1 : !de(fe(navigator));
625
- }, he = async (e) => {
622
+ var fe = () => {
623
+ let { name: e, version: t } = de();
624
+ return e === "chrome" && parseInt(t) <= 70 || e === "opera" && (!t || parseInt(t.split(".")[0]) < 80) || e === "ie" ? !1 : !le(ue(navigator));
625
+ }, pe = async (e, t) => X(e.tokens) || X(await wt(e, !0, t?.extras, t?.scope)) ? !0 : (e.tokens = null, e.userInfo = null, e.publishEvent(f.tryKeepExistingSessionAsync_end, {
626
+ success: !1,
627
+ message: "stored tokens could not be renewed"
628
+ }), !1), me = async (e) => {
626
629
  let t;
627
630
  if (e.tokens != null) return !1;
628
631
  e.publishEvent(f.tryKeepExistingSessionAsync_begin, {});
@@ -633,7 +636,8 @@ var me = () => {
633
636
  if (i) {
634
637
  t.startKeepAliveServiceWorker(), e.tokens = i;
635
638
  let a = t.getLoginParams(e.configurationName);
636
- e.timeoutId = q(e, e.tokens.expiresAt, a?.extras, a?.scope);
639
+ if (!await pe(e, a)) return !1;
640
+ e.timeoutId = Tt(e, e.tokens.expiresAt, a?.extras, a?.scope);
637
641
  let o = await t.getSessionStateAsync();
638
642
  return await e.startCheckSessionAsync(r.checkSessionIframe, n.client_id, o), n.preload_user_info && await e.userInfoAsync(), e.publishEvent(f.tryKeepExistingSessionAsync_end, {
639
643
  success: !0,
@@ -648,9 +652,10 @@ var me = () => {
648
652
  n.service_worker_relative_url && e.publishEvent(f.service_worker_not_supported_by_browser, { message: "service worker is not supported by this browser" });
649
653
  let t = g(e.configurationName, n.storage ?? sessionStorage, n.login_state_storage ?? n.storage ?? sessionStorage), { tokens: i } = await t.initAsync();
650
654
  if (i) {
651
- e.tokens = Mt(i, null, n.token_renew_mode);
655
+ e.tokens = Nt(i, null, n.token_renew_mode);
652
656
  let a = t.getLoginParams();
653
- e.timeoutId = q(e, e.tokens.expiresAt, a?.extras, a?.scope);
657
+ if (!await pe(e, a)) return !1;
658
+ e.timeoutId = Tt(e, e.tokens.expiresAt, a?.extras, a?.scope);
654
659
  let o = await t.getSessionStateAsync();
655
660
  return await e.startCheckSessionAsync(r.checkSessionIframe, n.client_id, o), n.preload_user_info && await e.userInfoAsync(), e.publishEvent(f.tryKeepExistingSessionAsync_end, {
656
661
  success: !0,
@@ -665,7 +670,7 @@ var me = () => {
665
670
  } catch (n) {
666
671
  return e.tokens = null, e.userInfo = null, b.clearTimeout(e.timeoutId), e.timeoutId = null, e.checkSessionIFrame?.stop(), console.error(n), t && await t.clearAsync(), e.publishEvent(f.tryKeepExistingSessionAsync_error, "tokens inside ServiceWorker are invalid"), !1;
667
672
  }
668
- }, M = class {
673
+ }, he = class {
669
674
  open(e) {
670
675
  window.location.href = e;
671
676
  }
@@ -682,22 +687,22 @@ var me = () => {
682
687
  getOrigin() {
683
688
  return window.origin;
684
689
  }
685
- }, N = {
690
+ }, P = {
686
691
  STATE_MISSING: "STATE_MISSING",
687
692
  STATE_MISMATCH: "STATE_MISMATCH",
688
693
  NONCE_MISSING: "NONCE_MISSING"
689
- }, ge = new Set(Object.values(N)), _e = (e) => typeof e == "string" && ge.has(e), P = class e extends r {
694
+ }, ge = new Set(Object.values(P)), _e = (e) => typeof e == "string" && ge.has(e), F = class e extends r {
690
695
  constructor(t, n, r = "callback") {
691
696
  super(t, n, {
692
697
  phase: r,
693
698
  retryable: !1
694
699
  }), this.name = "OidcStateError", Object.setPrototypeOf(this, e.prototype);
695
700
  }
696
- }, ve = (e) => e instanceof P || i(e) && _e(e.code), F = {
701
+ }, ve = (e) => e instanceof F || i(e) && _e(e.code), I = {
697
702
  ENDPOINT_UNAVAILABLE: "ENDPOINT_UNAVAILABLE",
698
703
  REQUEST_FAILED: "REQUEST_FAILED",
699
704
  INVALID_RESPONSE: "INVALID_RESPONSE"
700
- }, I = class e extends r {
705
+ }, L = class e extends r {
701
706
  constructor(t, n, r = {}) {
702
707
  super(t, n, {
703
708
  phase: "login",
@@ -708,7 +713,7 @@ var me = () => {
708
713
  cause: r.cause
709
714
  }), this.name = "PushedAuthorizationRequestError", Object.setPrototypeOf(this, e.prototype);
710
715
  }
711
- }, ye = (e) => e instanceof I, be = {}, xe = (e, t = window.sessionStorage, n) => {
716
+ }, ye = (e) => e instanceof L, be = {}, xe = (e, t = window.sessionStorage, n) => {
712
717
  if (!be[e] && t) {
713
718
  let n = t.getItem(e);
714
719
  n && (be[e] = JSON.parse(n));
@@ -723,12 +728,12 @@ var me = () => {
723
728
  be[e] = r, n && n.setItem(e, JSON.stringify(r));
724
729
  }, Ce = 3600, we = (e) => async (t, n = Ce, r = window.sessionStorage, i = 1e4) => {
725
730
  let a = `${t}/.well-known/openid-configuration`, o = `oidc.server:${t}`, s = xe(o, r, n);
726
- if (s) return new yt(s);
727
- let c = await L(e)(a, {}, i);
731
+ if (s) return new vt(s);
732
+ let c = await R(e)(a, {}, i);
728
733
  if (c.status !== 200) return null;
729
734
  let l = await c.json();
730
- return Se(o, l, r), new yt(l);
731
- }, L = (e) => async (t, n = {}, r = 1e4, i = 0) => {
735
+ return Se(o, l, r), new vt(l);
736
+ }, R = (e) => async (t, n = {}, r = 1e4, i = 0) => {
732
737
  let a;
733
738
  try {
734
739
  let i = new AbortController(), o = setTimeout(() => i.abort(), r);
@@ -742,13 +747,13 @@ var me = () => {
742
747
  }
743
748
  } catch (a) {
744
749
  if (a.name === "AbortError" || a.message === "Network request failed") {
745
- if (i <= 1) return await L(e)(t, n, r, i + 1);
750
+ if (i <= 1) return await R(e)(t, n, r, i + 1);
746
751
  throw a;
747
752
  }
748
753
  throw console.error(a.message), a;
749
754
  }
750
755
  return a;
751
- }, R = {
756
+ }, z = {
752
757
  refresh_token: "refresh_token",
753
758
  access_token: "access_token"
754
759
  }, Te = (e) => {
@@ -758,14 +763,14 @@ var me = () => {
758
763
  for (let e of i) t.push(`${encodeURIComponent(n)}=${encodeURIComponent(e)}`);
759
764
  }
760
765
  return t.join("&");
761
- }, Ee = (e) => async (t, n, r = R.refresh_token, i, a = {}, o = 1e4) => {
766
+ }, Ee = (e) => async (t, n, r = z.refresh_token, i, a = {}, o = 1e4) => {
762
767
  let s = {
763
768
  token: n,
764
769
  token_type_hint: r,
765
770
  client_id: i
766
771
  };
767
772
  for (let [e, t] of Object.entries(a)) s[e] === void 0 && (s[e] = t);
768
- let c = Te(s), l = await L(e)(t, {
773
+ let c = Te(s), l = await R(e)(t, {
769
774
  method: "POST",
770
775
  headers: { "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8" },
771
776
  body: c
@@ -790,34 +795,34 @@ var me = () => {
790
795
  return null;
791
796
  }
792
797
  }, Oe = (e) => async (t, n, r = 1e4) => {
793
- if (n.request_uri !== void 0) throw new I(F.REQUEST_FAILED, "The request_uri parameter must not be included in a pushed authorization request.");
798
+ if (n.request_uri !== void 0) throw new L(I.REQUEST_FAILED, "The request_uri parameter must not be included in a pushed authorization request.");
794
799
  let i = Te(n), a;
795
800
  try {
796
- a = await L(e)(t, {
801
+ a = await R(e)(t, {
797
802
  method: "POST",
798
803
  headers: { "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8" },
799
804
  body: i
800
805
  }, r);
801
806
  } catch (e) {
802
- throw new I(F.REQUEST_FAILED, "The pushed authorization request could not be sent.", { cause: e });
807
+ throw new L(I.REQUEST_FAILED, "The pushed authorization request could not be sent.", { cause: e });
803
808
  }
804
809
  let o = await De(a);
805
810
  if (a.status !== 201) {
806
811
  let e = typeof o?.error == "string" ? o.error : void 0, t = typeof o?.error_description == "string" ? o.error_description : void 0, n = [e, t].filter(Boolean).join(": ");
807
- throw new I(F.REQUEST_FAILED, `The pushed authorization request failed with HTTP status ${a.status}${n ? ` (${n})` : ""}.`, {
812
+ throw new L(I.REQUEST_FAILED, `The pushed authorization request failed with HTTP status ${a.status}${n ? ` (${n})` : ""}.`, {
808
813
  status: a.status,
809
814
  oauthError: e,
810
815
  oauthErrorDescription: t
811
816
  });
812
817
  }
813
- if (typeof o?.request_uri != "string" || o.request_uri.length === 0 || !Number.isInteger(o?.expires_in) || o.expires_in <= 0) throw new I(F.INVALID_RESPONSE, "The pushed authorization response must contain a non-empty request_uri and a positive integer expires_in.", { status: a.status });
818
+ if (typeof o?.request_uri != "string" || o.request_uri.length === 0 || !Number.isInteger(o?.expires_in) || o.expires_in <= 0) throw new L(I.INVALID_RESPONSE, "The pushed authorization response must contain a non-empty request_uri and a positive integer expires_in.", { status: a.status });
814
819
  return {
815
820
  request_uri: o.request_uri,
816
821
  expires_in: o.expires_in
817
822
  };
818
823
  }, ke = (e) => async (t, n, r, i, a = {}, o, s = 1e4) => {
819
824
  for (let [e, t] of Object.entries(r)) n[e] === void 0 && (n[e] = t);
820
- let c = Te(n), l = await L(e)(t, {
825
+ let c = Te(n), l = await R(e)(t, {
821
826
  method: "POST",
822
827
  headers: {
823
828
  "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
@@ -833,19 +838,19 @@ var me = () => {
833
838
  data: e,
834
839
  oauthError: typeof e?.error == "string" ? e.error : void 0,
835
840
  oauthErrorDescription: typeof e?.error_description == "string" ? e.error_description : void 0,
836
- demonstratingProofOfPossessionNonce: l.headers?.has(z) ? l.headers.get(z) : null
841
+ demonstratingProofOfPossessionNonce: l.headers?.has(B) ? l.headers.get(B) : null
837
842
  };
838
843
  }
839
844
  let u = await l.json(), d = null;
840
- return l.headers.has(z) && (d = l.headers.get(z)), {
845
+ return l.headers.has(B) && (d = l.headers.get(B)), {
841
846
  success: !0,
842
847
  status: l.status,
843
- data: Nt(u, i, o),
848
+ data: Pt(u, i, o),
844
849
  demonstratingProofOfPossessionNonce: d
845
850
  };
846
851
  }, Ae = (e, t) => async (n, r, i) => {
847
852
  r = r ? { ...r } : {};
848
- let a = se(128), o = await ue(a);
853
+ let a = ae(128), o = await ce(a);
849
854
  if (await e.setCodeVerifierAsync(a), await e.setStateAsync(r.state), r.code_challenge = o, r.code_challenge_method = "S256", i) {
850
855
  let e = await Oe(i.fetch)(i.endpoint, r, i.timeoutMs);
851
856
  t.open(`${n}?client_id=${encodeURIComponent(String(r.client_id))}&request_uri=${encodeURIComponent(e.request_uri)}`);
@@ -854,9 +859,9 @@ var me = () => {
854
859
  let s = "";
855
860
  if (r) for (let [e, t] of Object.entries(r)) for (let n of Array.isArray(t) ? t : [String(t)]) s += s === "" ? "?" : "&", s += `${e}=${encodeURIComponent(n)}`;
856
861
  t.open(`${n}${s}`);
857
- }, z = "DPoP-Nonce", je = (e) => async (t, n, r, i, a = 1e4, o = !1) => {
862
+ }, B = "DPoP-Nonce", je = (e) => async (t, n, r, i, a = 1e4, o = !1) => {
858
863
  n = n ? { ...n } : {}, n.code_verifier = await e.getCodeVerifierAsync();
859
- let s = Te(n), c = await L(fetch)(t, {
864
+ let s = Te(n), c = await R(fetch)(t, {
860
865
  method: "POST",
861
866
  headers: {
862
867
  "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
@@ -872,18 +877,18 @@ var me = () => {
872
877
  data: t,
873
878
  oauthError: n,
874
879
  oauthErrorDescription: typeof t?.error_description == "string" ? t.error_description : void 0,
875
- demonstratingProofOfPossessionNonce: c.headers?.has(z) ? c.headers.get(z) : null
880
+ demonstratingProofOfPossessionNonce: c.headers?.has(B) ? c.headers.get(B) : null
876
881
  };
877
882
  }
878
883
  await Promise.all([e.setCodeVerifierAsync(null), e.setStateAsync(null)]);
879
884
  let l = null;
880
- c.headers.has(z) && (l = c.headers.get(z));
885
+ c.headers.has(B) && (l = c.headers.get(B));
881
886
  let u = await c.json();
882
887
  return {
883
888
  success: !0,
884
889
  data: {
885
890
  state: n.state,
886
- tokens: Nt(u, null, i),
891
+ tokens: Pt(u, null, i),
887
892
  demonstratingProofOfPossessionNonce: l
888
893
  }
889
894
  };
@@ -910,7 +915,7 @@ var me = () => {
910
915
  let t = Le(e), r = t.pathname.replace(/\/+$/, "");
911
916
  return n.origin === t.origin && (r === "" || n.pathname === r || n.pathname.startsWith(`${r}/`));
912
917
  });
913
- }, B = (e, t) => {
918
+ }, V = (e, t) => {
914
919
  Fe(t);
915
920
  let n = e?.filter((e) => e.resource === t) ?? [];
916
921
  if (n.length !== 1 || n[0].allowedUrlPrefixes.length === 0) throw Error("The resource must be registered exactly once with permitted API URL prefixes.");
@@ -968,7 +973,7 @@ var me = () => {
968
973
  n.endsWith("/") && (n = n.slice(0, -1));
969
974
  let { hash: r } = t;
970
975
  return (r === "#" || r === "#_=_") && (r = ""), r && (n += r), n;
971
- }, V = (e) => {
976
+ }, H = (e) => {
972
977
  let { search: t } = Xe(e);
973
978
  return Qe(t);
974
979
  }, Qe = (e) => {
@@ -978,7 +983,7 @@ var me = () => {
978
983
  t[decodeURIComponent(e)] = decodeURIComponent(r);
979
984
  }
980
985
  return t;
981
- }, $e = "_oidc_resource", et = "oidc.resource_transaction.", H = (e, t) => t === void 0 ? e : Ne(e, t), tt = (t, n, i) => {
986
+ }, $e = "_oidc_resource", et = "oidc.resource_transaction.", U = (e, t) => t === void 0 ? e : Ne(e, t), W = (t, n, i) => {
982
987
  let a = i ?? n.resource;
983
988
  if (a === void 0) return t;
984
989
  let o = typeof a == "string" ? [a] : a;
@@ -986,7 +991,7 @@ var me = () => {
986
991
  phase: "login",
987
992
  retryable: !1
988
993
  });
989
- for (let e of o) Fe(e), n.resources && B(n.resources, e);
994
+ for (let e of o) Fe(e), n.resources && V(n.resources, e);
990
995
  let s = t.resource;
991
996
  if (s !== void 0 && JSON.stringify(typeof s == "string" ? [s] : s) !== JSON.stringify(o)) throw new r(e.INVALID_RESOURCE, "Resource extras conflict with the selected resource.", {
992
997
  phase: "login",
@@ -996,34 +1001,34 @@ var me = () => {
996
1001
  ...t,
997
1002
  resource: a
998
1003
  };
999
- }, nt = (e, t, n) => {
1004
+ }, tt = (e, t, n) => {
1000
1005
  sessionStorage.setItem(`${et}${e}.${t}`, n);
1001
- }, rt = (e, t) => {
1002
- let { state: n } = V(t);
1006
+ }, nt = (e, t) => {
1007
+ let { state: n } = H(t);
1003
1008
  return n ? sessionStorage.getItem(`${et}${e}.${n}`) ?? void 0 : void 0;
1004
- }, it = (e, t) => {
1005
- let { state: n } = V(t);
1009
+ }, rt = (e, t) => {
1010
+ let { state: n } = H(t);
1006
1011
  n && sessionStorage.removeItem(`${et}${e}.${n}`);
1007
- }, at = (e, t) => {
1012
+ }, it = (e, t) => {
1008
1013
  let n = `${et}${e}.`;
1009
1014
  for (let e of Object.keys(sessionStorage)) e.startsWith(n) && (t === void 0 || sessionStorage.getItem(e) === t) && sessionStorage.removeItem(e);
1010
- }, ot = (e, t, n, r, i, a = () => window.fetch) => (o = void 0, s = null, u = !1, d = void 0) => {
1015
+ }, at = (e, t, n, r, i, a = () => window.fetch) => (o = void 0, s = null, u = !1, d = void 0) => {
1011
1016
  let p = s;
1012
1017
  s = { ...s };
1013
1018
  let m = s[$e];
1014
1019
  delete s[$e];
1015
- let h = H(e, m);
1020
+ let h = U(e, m);
1016
1021
  return (async () => {
1017
1022
  let _ = o || i.getPath();
1018
- if ("state" in s || (s.state = se(16)), m !== void 0 && nt(e, s.state, m), n(f.loginAsync_begin, {}), s) for (let e of Object.keys(s)) e.endsWith(":token_request") && delete s[e];
1023
+ if ("state" in s || (s.state = ae(16)), m !== void 0 && tt(e, s.state, m), n(f.loginAsync_begin, {}), s) for (let e of Object.keys(s)) e.endsWith(":token_request") && delete s[e];
1019
1024
  try {
1020
1025
  let e = u ? t.silent_redirect_uri : t.redirect_uri;
1021
1026
  d ||= t.scope;
1022
- let n = tt(t.extras ? {
1027
+ let n = W(t.extras ? {
1023
1028
  ...t.extras,
1024
1029
  ...s
1025
1030
  } : s, t, m);
1026
- typeof n.scope == "string" && (d = n.scope), n.nonce ||= se(12);
1031
+ typeof n.scope == "string" && (d = n.scope), n.nonce ||= ae(12);
1027
1032
  let o = { nonce: n.nonce }, c = await $(t, h), l = await r(t.authority, t.authority_configuration), f;
1028
1033
  if (c) c.setLoginParams({
1029
1034
  callbackPath: _,
@@ -1050,7 +1055,7 @@ var me = () => {
1050
1055
  response_type: "code",
1051
1056
  ...n
1052
1057
  }, y = t.par ?? "disabled", b = l.pushedAuthorizationRequestEndpoint, x = l.requirePushedAuthorizationRequests;
1053
- if (!b && (y === "required" || y === "auto" && x)) throw new I(F.ENDPOINT_UNAVAILABLE, "Pushed Authorization Requests are required, but the authorization server metadata does not provide a pushed_authorization_request_endpoint.");
1058
+ if (!b && (y === "required" || y === "auto" && x)) throw new L(I.ENDPOINT_UNAVAILABLE, "Pushed Authorization Requests are required, but the authorization server metadata does not provide a pushed_authorization_request_endpoint.");
1054
1059
  let S = y !== "disabled" && b ? {
1055
1060
  endpoint: b,
1056
1061
  fetch: a(),
@@ -1062,10 +1067,10 @@ var me = () => {
1062
1067
  throw n(f.loginAsync_error, t), t;
1063
1068
  }
1064
1069
  })();
1065
- }, st = (t) => async (n = !1, o) => {
1070
+ }, ot = (t) => async (n = !1, o) => {
1066
1071
  try {
1067
1072
  t.publishEvent(f.loginCallbackAsync_begin, {});
1068
- let i = t.configuration, c = H(t.configurationName, o), l = i.client_id, u = n ? i.silent_redirect_uri : i.redirect_uri, d = i.authority, p = i.token_request_timeout, m = await t.initAsync(d, i.authority_configuration), h = V(t.location.getCurrentHref()), _ = h.session_state, v = await $(i, c), y, b, x, S;
1073
+ let i = t.configuration, c = U(t.configurationName, o), l = i.client_id, u = n ? i.silent_redirect_uri : i.redirect_uri, d = i.authority, p = i.token_request_timeout, m = await t.initAsync(d, i.authority_configuration), h = H(t.location.getCurrentHref()), _ = h.session_state, v = await $(i, c), y, b, x, S;
1069
1074
  if (v) await v.initAsync(m, "loginCallbackAsync", i), await v.setSessionStateAsync(_), b = await v.getNonceAsync(), x = v.getLoginParams(), S = await v.getStateAsync(), v.startKeepAliveServiceWorker(), y = v;
1070
1075
  else {
1071
1076
  let e = g(c, i.storage ?? sessionStorage, i.login_state_storage ?? i.storage ?? sessionStorage);
@@ -1074,11 +1079,11 @@ var me = () => {
1074
1079
  if (h.error || h.error_description) throw s(h.error, h.error_description, `Error from OIDC server: ${h.error} - ${h.error_description}`, n ? "refresh" : "callback");
1075
1080
  if (h.iss && h.iss !== m.issuer) throw console.error(), Error(`Issuer not valid (expected: ${m.issuer}, received: ${h.iss})`);
1076
1081
  if (h.state) {
1077
- if (!S) throw new P(N.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).", n ? "refresh" : "callback");
1078
- if (h.state !== S) throw new P(N.STATE_MISMATCH, `OIDC state does not match the stored one (expected: ${S}, received: ${h.state}).`, n ? "refresh" : "callback");
1082
+ if (!S) throw new F(P.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).", n ? "refresh" : "callback");
1083
+ if (h.state !== S) throw new F(P.STATE_MISMATCH, `OIDC state does not match the stored one (expected: ${S}, received: ${h.state}).`, n ? "refresh" : "callback");
1079
1084
  }
1080
- if (!b || !b.nonce) throw new P(N.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).", n ? "refresh" : "callback");
1081
- let C = tt({
1085
+ if (!b || !b.nonce) throw new F(P.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).", n ? "refresh" : "callback");
1086
+ let C = W({
1082
1087
  code: h.code,
1083
1088
  grant_type: "authorization_code",
1084
1089
  client_id: i.client_id,
@@ -1094,14 +1099,14 @@ var me = () => {
1094
1099
  phase: "callback",
1095
1100
  retryable: !1
1096
1101
  });
1097
- await g(c, i.storage, i.login_state_storage ?? i.storage).setDemonstratingProofOfPossessionJwkAsync(D), E.DPoP = await ne(window)(i.demonstrating_proof_of_possession_configuration)(D, "POST", T);
1102
+ await g(c, i.storage, i.login_state_storage ?? i.storage).setDemonstratingProofOfPossessionJwkAsync(D), E.DPoP = await M(window)(i.demonstrating_proof_of_possession_configuration)(D, "POST", T);
1098
1103
  }
1099
1104
  }
1100
- let ee = tt({
1105
+ let ee = W({
1101
1106
  ...C,
1102
1107
  ...w
1103
1108
  }, i, o), O = await je(y)(T, ee, E, t.configuration.token_renew_mode, p, i.demonstrating_proof_of_possession);
1104
- if (!O.success && O.oauthError === "use_dpop_nonce" && O.demonstratingProofOfPossessionNonce && i.demonstrating_proof_of_possession ? (await y.setDemonstratingProofOfPossessionNonce(O.demonstratingProofOfPossessionNonce), v || (E.DPoP = await ne(window)(i.demonstrating_proof_of_possession_configuration)(D, "POST", T, { nonce: O.demonstratingProofOfPossessionNonce })), O = await je(y)(T, ee, E, t.configuration.token_renew_mode, p)) : !O.success && i.demonstrating_proof_of_possession && await Promise.all([y.setCodeVerifierAsync(null), y.setStateAsync(null)]), !O.success) {
1109
+ if (!O.success && O.oauthError === "use_dpop_nonce" && O.demonstratingProofOfPossessionNonce && i.demonstrating_proof_of_possession ? (await y.setDemonstratingProofOfPossessionNonce(O.demonstratingProofOfPossessionNonce), v || (E.DPoP = await M(window)(i.demonstrating_proof_of_possession_configuration)(D, "POST", T, { nonce: O.demonstratingProofOfPossessionNonce })), O = await je(y)(T, ee, E, t.configuration.token_renew_mode, p)) : !O.success && i.demonstrating_proof_of_possession && await Promise.all([y.setCodeVerifierAsync(null), y.setStateAsync(null)]), !O.success) {
1105
1110
  let t = O.oauthError === "use_dpop_nonce" ? e.DPOP_NONCE_REQUIRED : e.TOKEN_REQUEST_FAILED;
1106
1111
  throw new r(t, "Token request failed", {
1107
1112
  phase: n ? "refresh" : "callback",
@@ -1122,10 +1127,10 @@ var me = () => {
1122
1127
  phase: n ? "refresh" : "callback",
1123
1128
  retryable: !1
1124
1129
  });
1125
- let { isValid: re, reason: ie } = It(A, b.nonce, m);
1126
- if (!re) {
1127
- let t = `Tokens are not OpenID valid, reason: ${ie}`;
1128
- throw ie.startsWith("Nonce does not match") ? new r(e.INVALID_NONCE, t, {
1130
+ let { isValid: N, reason: ne } = Lt(A, b.nonce, m);
1131
+ if (!N) {
1132
+ let t = `Tokens are not OpenID valid, reason: ${ne}`;
1133
+ throw ne.startsWith("Nonce does not match") ? new r(e.INVALID_NONCE, t, {
1129
1134
  phase: n ? "refresh" : "callback",
1130
1135
  retryable: !1
1131
1136
  }) : Error(t);
@@ -1151,10 +1156,10 @@ var me = () => {
1151
1156
  let r = !i(e) && l(e) ? c(e, n ? "refresh" : "callback") : e;
1152
1157
  throw console.error(r), t.publishEvent(f.loginCallbackAsync_error, r), r;
1153
1158
  }
1154
- }, ct = {
1159
+ }, st = {
1155
1160
  access_token: "access_token",
1156
1161
  refresh_token: "refresh_token"
1157
- }, lt = (e, t) => {
1162
+ }, ct = (e, t) => {
1158
1163
  let n = {};
1159
1164
  if (e) {
1160
1165
  for (let [r, i] of Object.entries(e)) if (r.endsWith(t)) {
@@ -1164,27 +1169,27 @@ var me = () => {
1164
1169
  return n;
1165
1170
  }
1166
1171
  return n;
1167
- }, ut = (e) => {
1172
+ }, lt = (e) => {
1168
1173
  let t = {};
1169
1174
  if (e) {
1170
1175
  for (let [n, r] of Object.entries(e)) n.includes(":") || (t[n] = r);
1171
1176
  return t;
1172
1177
  }
1173
1178
  return t;
1174
- }, dt = (e) => async (t) => {
1179
+ }, ut = (e) => async (t) => {
1175
1180
  e.resourceTokens && await e.resourceTokens.clearAllAsync(), b.clearTimeout(e.timeoutId), e.timeoutId = null, e.checkSessionIFrame && e.checkSessionIFrame.stop();
1176
1181
  let n = await $(e.configuration, e.configurationName);
1177
1182
  n ? await n.clearAsync(t) : await g(e.configurationName, e.configuration.storage, e.configuration.login_state_storage ?? e.configuration.storage).clearAsync(t), e.tokens = null, e.userInfo = null;
1178
- }, ft = (e, t) => async () => {
1183
+ }, dt = (e, t) => async () => {
1179
1184
  let n = e.tokens?.idTokenPayload?.sub ?? null;
1180
1185
  await e.destroyAsync("LOGGED_OUT");
1181
1186
  for (let [, r] of Object.entries(t)) r === e ? e.publishEvent(f.logout_from_same_tab, {}) : await e.logoutSameTabAsync(e.configuration.client_id, n);
1182
- }, pt = (e, t, n, r) => {
1187
+ }, ft = (e, t, n, r) => {
1183
1188
  "id_token_hint" in t || (t.id_token_hint = n), !("post_logout_redirect_uri" in t) && r !== null && (t.post_logout_redirect_uri = r);
1184
1189
  let i = "";
1185
1190
  for (let [e, n] of Object.entries(t)) n != null && (i += i === "" ? "?" : "&", i += `${e}=${encodeURIComponent(n)}`);
1186
1191
  return `${e}${i}`;
1187
- }, mt = (t, n, o, s, u) => async (d = void 0, p = null) => {
1192
+ }, pt = (t, n, o, s, u) => async (d = void 0, p = null) => {
1188
1193
  let m = t.configuration, h;
1189
1194
  try {
1190
1195
  h = await t.initAsync(m.authority, m.authority_configuration);
@@ -1203,18 +1208,18 @@ var me = () => {
1203
1208
  let n = h.revocationEndpoint;
1204
1209
  if (n) {
1205
1210
  let i = [], s = t.tokens ? t.tokens.accessToken : null;
1206
- if (s && m.logout_tokens_to_invalidate.includes(ct.access_token)) {
1207
- let e = lt(p, ":revoke_access_token"), t = Ee(o)(n, s, R.access_token, m.client_id, e);
1211
+ if (s && m.logout_tokens_to_invalidate.includes(st.access_token)) {
1212
+ let e = ct(p, ":revoke_access_token"), t = Ee(o)(n, s, z.access_token, m.client_id, e);
1208
1213
  i.push(t);
1209
1214
  }
1210
1215
  let c = t.tokens ? t.tokens.refreshToken : null;
1211
- if (c && m.logout_tokens_to_invalidate.includes(ct.refresh_token)) {
1212
- let e = lt(p, ":revoke_refresh_token"), t = Ee(o)(n, c, R.refresh_token, m.client_id, e);
1216
+ if (c && m.logout_tokens_to_invalidate.includes(st.refresh_token)) {
1217
+ let e = ct(p, ":revoke_refresh_token"), t = Ee(o)(n, c, z.refresh_token, m.client_id, e);
1213
1218
  i.push(t);
1214
1219
  }
1215
1220
  if (t.resourceTokens) {
1216
1221
  let e = await t.resourceTokens.getTokensToRevokeAsync(), r = new Set([s, c].filter(Boolean));
1217
- for (let t of e) for (let [e, a] of [[R.access_token, t.accessToken], [R.refresh_token, t.refreshToken]]) a && !r.has(a) && m.logout_tokens_to_invalidate.includes(e) && (r.add(a), i.push(Ee(o)(n, a, e, m.client_id, lt(p, e === R.access_token ? ":revoke_access_token" : ":revoke_refresh_token"))));
1222
+ for (let t of e) for (let [e, a] of [[z.access_token, t.accessToken], [z.refresh_token, t.refreshToken]]) a && !r.has(a) && m.logout_tokens_to_invalidate.includes(e) && (r.add(a), i.push(Ee(o)(n, a, e, m.client_id, ct(p, e === z.access_token ? ":revoke_access_token" : ":revoke_refresh_token"))));
1218
1223
  }
1219
1224
  if (i.length > 0) {
1220
1225
  let n = await Promise.all(i);
@@ -1231,33 +1236,33 @@ var me = () => {
1231
1236
  let n = !i(e) && l(e) ? c(e, "logout") : e;
1232
1237
  t.publishEvent(f.logoutAsync_error, n), s.warn("logoutAsync: error when revoking tokens, if the error persist, you ay configure property logout_tokens_to_invalidate from configuration to avoid this error"), s.warn(n);
1233
1238
  }
1234
- let d = lt(p, ":oidc");
1239
+ let d = ct(p, ":oidc");
1235
1240
  if (d && d.no_reload === "true") {
1236
- await ft(t, n)(), t.isLoggingOut = !1;
1241
+ await dt(t, n)(), t.isLoggingOut = !1;
1237
1242
  return;
1238
1243
  }
1239
- let g = ut(p);
1244
+ let g = lt(p);
1240
1245
  if (h.endSessionEndpoint) {
1241
- let e = pt(h.endSessionEndpoint, g, y, v);
1246
+ let e = ft(h.endSessionEndpoint, g, y, v);
1242
1247
  u.open(e);
1243
1248
  } else u.reload();
1244
- await ft(t, n)();
1249
+ await dt(t, n)();
1245
1250
  } catch (e) {
1246
1251
  t.isLoggingOut = !1;
1247
1252
  let n = !i(e) && l(e) ? c(e, "logout") : e;
1248
1253
  throw t.publishEvent(f.logoutAsync_error, n), n;
1249
1254
  }
1250
- }, U = (t) => new r(e.RESOURCE_TOKEN_UNAVAILABLE, t, {
1255
+ }, G = (t) => new r(e.RESOURCE_TOKEN_UNAVAILABLE, t, {
1251
1256
  phase: "refresh",
1252
1257
  retryable: !1
1253
- }), ht = class {
1258
+ }), mt = class {
1254
1259
  constructor(e) {
1255
1260
  this.oidc = e, this.pending = /* @__PURE__ */ new Map(), this.cached = /* @__PURE__ */ new Map(), this.generations = /* @__PURE__ */ new Map(), this.generation = 0, this.refreshQueue = Promise.resolve(), this.renewalTimers = /* @__PURE__ */ new Map();
1256
1261
  }
1257
1262
  async contextAsync(e) {
1258
- let { oidc: t } = this, n = H(t.configurationName, e), r = await t.initAsync(t.configuration.authority, t.configuration.authority_configuration), i = await $(t.configuration, n), a = g(n, t.configuration.storage, t.configuration.login_state_storage ?? t.configuration.storage), o = i ? await i.initAsync(r, "resource-token", t.configuration) : await a.initAsync(), s = [];
1263
+ let { oidc: t } = this, n = U(t.configurationName, e), r = await t.initAsync(t.configuration.authority, t.configuration.authority_configuration), i = await $(t.configuration, n), a = g(n, t.configuration.storage, t.configuration.login_state_storage ?? t.configuration.storage), o = i ? await i.initAsync(r, "resource-token", t.configuration) : await a.initAsync(), s = [];
1259
1264
  if ("resourceContexts" in o && o.resourceContexts !== void 0) {
1260
- if (!Array.isArray(o.resourceContexts) || o.resourceContexts.some((e) => typeof e != "string")) throw U("The worker returned invalid resource context metadata.");
1265
+ if (!Array.isArray(o.resourceContexts) || o.resourceContexts.some((e) => typeof e != "string")) throw G("The worker returned invalid resource context metadata.");
1261
1266
  s.push(...o.resourceContexts);
1262
1267
  }
1263
1268
  return {
@@ -1269,7 +1274,7 @@ var me = () => {
1269
1274
  };
1270
1275
  }
1271
1276
  validate(t, n, i, a = this.oidc.tokens?.idTokenPayload?.sub) {
1272
- let { oidc: o } = this, s = B(o.configuration.resources, t), c = n.resourceContext;
1277
+ let { oidc: o } = this, s = V(o.configuration.resources, t), c = n.resourceContext;
1273
1278
  if (!c || c.resource !== t || c.issuer !== i || c.clientId !== o.configuration.client_id || c.configurationName !== o.configurationName || c.subject !== a) throw new r(e.RESOURCE_CONTEXT_MISMATCH, "The token does not belong to this resource and OIDC session.", {
1274
1279
  phase: "refresh",
1275
1280
  retryable: !1
@@ -1279,8 +1284,8 @@ var me = () => {
1279
1284
  phase: "refresh",
1280
1285
  retryable: !1
1281
1286
  });
1282
- if (typeof n.accessToken != "string" || !n.accessToken || !Number.isFinite(n.expiresAt) || !Number.isFinite(n.issuedAt) || n.refreshToken != null && (typeof n.refreshToken != "string" || !n.refreshToken)) throw U("The provider did not return a usable resource token response.");
1283
- if (s.scope && !s.scope.split(/\s+/).filter(Boolean).every((e) => (n.scope ?? "").split(/\s+/).includes(e))) throw U("The provider did not grant the required resource scopes.");
1287
+ if (typeof n.accessToken != "string" || !n.accessToken || !Number.isFinite(n.expiresAt) || !Number.isFinite(n.issuedAt) || n.refreshToken != null && (typeof n.refreshToken != "string" || !n.refreshToken)) throw G("The provider did not return a usable resource token response.");
1288
+ if (s.scope && !s.scope.split(/\s+/).filter(Boolean).every((e) => (n.scope ?? "").split(/\s+/).includes(e))) throw G("The provider did not grant the required resource scopes.");
1284
1289
  }
1285
1290
  publicToken(e, t) {
1286
1291
  return {
@@ -1328,16 +1333,16 @@ var me = () => {
1328
1333
  }
1329
1334
  async acceptAuthorizationAsync(t, n) {
1330
1335
  let i = this.generation, a = this.generations.get(t) ?? 0, o = await this.contextAsync(t), s = await this.contextAsync();
1331
- if (i !== this.generation || a !== (this.generations.get(t) ?? 0)) throw U("The resource authorization was cleared.");
1336
+ if (i !== this.generation || a !== (this.generations.get(t) ?? 0)) throw G("The resource authorization was cleared.");
1332
1337
  let c = n.idTokenPayload?.sub;
1333
1338
  if (typeof c != "string" || (this.oidc.tokens?.idTokenPayload?.sub ?? s.tokens?.idTokenPayload?.sub) !== c) throw new r(e.RESOURCE_CONTEXT_MISMATCH, "Resource authorization must preserve the authenticated subject.", {
1334
1339
  phase: "callback",
1335
1340
  retryable: !1
1336
1341
  });
1337
- if (n.refreshToken && n.refreshToken === s.tokens?.refreshToken) throw U("The provider reused a refresh token across separate authorization transactions; use a multi-resource authorization grant instead.");
1342
+ if (n.refreshToken && n.refreshToken === s.tokens?.refreshToken) throw G("The provider reused a refresh token across separate authorization transactions; use a multi-resource authorization grant instead.");
1338
1343
  let l = {
1339
1344
  ...n,
1340
- scope: n.scope ?? B(this.oidc.configuration.resources, t).scope ?? this.oidc.configuration.scope,
1345
+ scope: n.scope ?? V(this.oidc.configuration.resources, t).scope ?? this.oidc.configuration.scope,
1341
1346
  resourceContext: {
1342
1347
  resource: t,
1343
1348
  issuer: o.server.issuer,
@@ -1347,30 +1352,30 @@ var me = () => {
1347
1352
  grantResource: t
1348
1353
  }
1349
1354
  };
1350
- this.validate(t, l, o.server.issuer, c), o.isWorker || g(H(this.oidc.configurationName, t), this.oidc.configuration.storage).setTokens(l), this.cached.set(t, l);
1355
+ this.validate(t, l, o.server.issuer, c), o.isWorker || g(U(this.oidc.configurationName, t), this.oidc.configuration.storage).setTokens(l), this.cached.set(t, l);
1351
1356
  }
1352
1357
  getAccessTokenAsync(t, n = {}) {
1353
1358
  let a = this.pending.get(t);
1354
1359
  if (a) return a;
1355
1360
  let o = this.generation, u = this.generations.get(t) ?? 0, d = this.oidc.tokens?.idTokenPayload?.sub, p = this.oidc.tokens?.idTokenPayload?.nonce, m = () => this.generation === o && (this.generations.get(t) ?? 0) === u && !this.oidc.isLoggingOut && this.oidc.tokens?.idTokenPayload?.sub === d && this.oidc.tokens?.idTokenPayload?.nonce === p, h = this.withRefreshLockAsync(async () => {
1356
- let { oidc: i } = this, a = B(i.configuration.resources, t);
1357
- if (!Number.isFinite(i.configuration.refresh_time_before_tokens_expiration_in_second) || i.configuration.refresh_time_before_tokens_expiration_in_second < 0) throw U("Configure a finite, non-negative renewal margin.");
1358
- if (!i.tokens || typeof i.tokens.idTokenPayload?.sub != "string" || !m()) throw U("Sign in before requesting a resource token.");
1361
+ let { oidc: i } = this, a = V(i.configuration.resources, t);
1362
+ if (!Number.isFinite(i.configuration.refresh_time_before_tokens_expiration_in_second) || i.configuration.refresh_time_before_tokens_expiration_in_second < 0) throw G("Configure a finite, non-negative renewal margin.");
1363
+ if (!i.tokens || typeof i.tokens.idTokenPayload?.sub != "string" || !m()) throw G("Sign in before requesting a resource token.");
1359
1364
  if (i.configuration.token_request_extras?.resource !== void 0 && i.configuration.token_request_extras.resource !== t) throw new r(e.INVALID_RESOURCE, "Token extras conflict with the selected resource.", {
1360
1365
  phase: "refresh",
1361
1366
  retryable: !1
1362
1367
  });
1363
1368
  let c = await this.contextAsync(t), l = await this.contextAsync();
1364
- if (!m()) throw U("The resource transaction was cleared.");
1369
+ if (!m()) throw G("The resource transaction was cleared.");
1365
1370
  let h = l.tokens?.idTokenPayload?.nonce;
1366
- if (!l.tokens || l.tokens.idTokenPayload?.sub !== d || !l.isWorker && h !== i.tokens.idTokenPayload?.nonce) throw U("The original OIDC session changed or is unavailable; restore it before requesting resource tokens.");
1371
+ if (!l.tokens || l.tokens.idTokenPayload?.sub !== d || !l.isWorker && h !== i.tokens.idTokenPayload?.nonce) throw G("The original OIDC session changed or is unavailable; restore it before requesting resource tokens.");
1367
1372
  let _ = c.tokens;
1368
- if (_ && (this.validate(t, _, c.server.issuer), !n.forceRenew && Pt(_, this.renewalMargin(_)))) {
1373
+ if (_ && (this.validate(t, _, c.server.issuer), !n.forceRenew && X(_, this.renewalMargin(_)))) {
1369
1374
  let e = this.cached.get(t);
1370
1375
  return this.cached.set(t, _), this.scheduleRenewal(t, _), (e?.accessToken !== _.accessToken || e?.expiresAt !== _.expiresAt || e?.scope !== _.scope || e?.tokenType !== _.tokenType) && i.publishEvent(f.resource_token_acquired, { resource: t }), this.publicToken(t, _);
1371
1376
  }
1372
1377
  let v = typeof i.configuration.resource == "string" ? [i.configuration.resource] : i.configuration.resource ?? [], y = (l.tokens.scope ?? i.configuration.scope).split(/\s+/), b = !a.scope || a.scope.split(/\s+/).filter(Boolean).every((e) => y.includes(e)), S = _?.resourceContext ? _.resourceContext.grantResource : v.includes(t) && b ? null : t, C = S === null ? await this.contextAsync() : c, w = S === null && !b ? void 0 : C.tokens?.refreshToken, T = i.configuration.demonstrating_proof_of_possession || C.tokens?.tokenType?.toLowerCase() === "dpop";
1373
- if (!m()) throw U("The resource transaction was cleared.");
1378
+ if (!m()) throw G("The resource transaction was cleared.");
1374
1379
  if (w) {
1375
1380
  let n = await C.storage.getNonceAsync(), l = c.isWorker ? { [Me]: encodeURIComponent(t) } : {};
1376
1381
  T && (l.DPoP = await this.generateProofAsync(t, {
@@ -1385,7 +1390,7 @@ var me = () => {
1385
1390
  refresh_token: w,
1386
1391
  resource: t,
1387
1392
  ...a.scope ? { scope: a.scope } : {}
1388
- }, v = () => ke(i.getFetch())(c.server.tokenEndpoint, f, i.configuration.token_request_extras ?? {}, _, l, Y.access_token_invalid, i.configuration.token_request_timeout), y = await v();
1393
+ }, v = () => ke(i.getFetch())(c.server.tokenEndpoint, f, i.configuration.token_request_extras ?? {}, _, l, jt.access_token_invalid, i.configuration.token_request_timeout), y = await v();
1389
1394
  if (!y.success && y.oauthError === "use_dpop_nonce" && y.demonstratingProofOfPossessionNonce && T && (await C.storage.setDemonstratingProofOfPossessionNonce(y.demonstratingProofOfPossessionNonce), l.DPoP = await this.generateProofAsync(t, {
1390
1395
  accessToken: C.tokens.accessToken,
1391
1396
  url: c.server.tokenEndpoint,
@@ -1393,15 +1398,15 @@ var me = () => {
1393
1398
  grantResource: S
1394
1399
  }), y = await v()), y.success) {
1395
1400
  let s = await this.contextAsync();
1396
- if (!s.tokens || s.tokens.idTokenPayload?.sub !== d || !s.isWorker && s.tokens.idTokenPayload?.nonce !== h) throw U("The original OIDC session changed during resource renewal.");
1401
+ if (!s.tokens || s.tokens.idTokenPayload?.sub !== d || !s.isWorker && s.tokens.idTokenPayload?.nonce !== h) throw G("The original OIDC session changed during resource renewal.");
1397
1402
  _ = y.data;
1398
1403
  let l = this.generation === o && i.tokens?.idTokenPayload?.sub === d && i.tokens?.idTokenPayload?.nonce === p;
1399
1404
  if (l && S === null && this.updateSharedRefreshToken(_, c.isWorker), _.idTokenPayload?.sub !== void 0 && _.idTokenPayload.sub !== d) throw new r(e.RESOURCE_CONTEXT_MISMATCH, "Resource renewal changed the authenticated subject.", {
1400
1405
  phase: "refresh",
1401
1406
  retryable: !1
1402
1407
  });
1403
- let f = It(_, n?.nonce, c.server);
1404
- if (!f.isValid) throw U(f.reason);
1408
+ let f = Lt(_, n?.nonce, c.server);
1409
+ if (!f.isValid) throw G(f.reason);
1405
1410
  if (_ = {
1406
1411
  ..._,
1407
1412
  scope: _.scope ?? a.scope ?? C.tokens.scope ?? i.configuration.scope,
@@ -1413,26 +1418,26 @@ var me = () => {
1413
1418
  subject: d,
1414
1419
  grantResource: S
1415
1420
  }
1416
- }, this.validate(t, _, c.server.issuer, d), !m()) throw l && i.isLoggingOut && u === (this.generations.get(t) ?? 0) && !c.isWorker && g(H(i.configurationName, t), i.configuration.storage).setTokens(_), U("The resource transaction was cleared.");
1417
- y.demonstratingProofOfPossessionNonce && await C.storage.setDemonstratingProofOfPossessionNonce(y.demonstratingProofOfPossessionNonce), c.isWorker || g(H(i.configurationName, t), i.configuration.storage).setTokens(_), S === null && this.updateSharedRefreshToken(_, c.isWorker);
1421
+ }, this.validate(t, _, c.server.issuer, d), !m()) throw l && i.isLoggingOut && u === (this.generations.get(t) ?? 0) && !c.isWorker && g(U(i.configurationName, t), i.configuration.storage).setTokens(_), G("The resource transaction was cleared.");
1422
+ y.demonstratingProofOfPossessionNonce && await C.storage.setDemonstratingProofOfPossessionNonce(y.demonstratingProofOfPossessionNonce), c.isWorker || g(U(i.configurationName, t), i.configuration.storage).setTokens(_), S === null && this.updateSharedRefreshToken(_, c.isWorker);
1418
1423
  } else if (y.oauthError !== "invalid_grant") throw s(y.oauthError, y.oauthErrorDescription, "Resource token request failed.", "refresh", y.status);
1419
1424
  else _ = null;
1420
1425
  } else _ = null;
1421
1426
  if (!_) {
1422
- if (!m()) throw U("The resource transaction was cleared.");
1427
+ if (!m()) throw G("The resource transaction was cleared.");
1423
1428
  let e = a.scope ? [.../* @__PURE__ */ new Set(["openid", ...a.scope.split(" ")])].join(" ") : i.configuration.scope, n = await x(i.configurationName, i.configuration, i.publishEvent.bind(i), "refresh")({
1424
1429
  ...i.configuration.extras,
1425
1430
  prompt: "none",
1426
1431
  resource: t,
1427
1432
  [$e]: t
1428
1433
  }, null, e);
1429
- if (!n) throw U("Configure silent_redirect_uri and silent_login_uri for resource authorization.");
1434
+ if (!n) throw G("Configure silent_redirect_uri and silent_login_uri for resource authorization.");
1430
1435
  if (n.error) throw n.oidcError ?? s(n.error, void 0, "Resource silent authorization failed.", "refresh");
1431
- if (!m() || n.resource !== t) throw U("The resource authorization transaction is no longer current.");
1436
+ if (!m() || n.resource !== t) throw G("The resource authorization transaction is no longer current.");
1432
1437
  await this.acceptAuthorizationAsync(t, n.tokens), c = await this.contextAsync(t), _ = c.tokens ?? this.cached.get(t);
1433
1438
  }
1434
- if (!m()) throw U("The resource transaction was cleared.");
1435
- if (this.validate(t, _, c.server.issuer), !Pt(_)) throw U("The resource access token is expired.");
1439
+ if (!m()) throw G("The resource transaction was cleared.");
1440
+ if (this.validate(t, _, c.server.issuer), !X(_)) throw G("The resource access token is expired.");
1436
1441
  return this.cached.set(t, _), this.scheduleRenewal(t, _), i.publishEvent(f.resource_token_acquired, { resource: t }), this.publicToken(t, _);
1437
1442
  }).catch((n) => {
1438
1443
  let a = i(n) ? n : l(n) ? c(n, "refresh") : new r(e.RESOURCE_TOKEN_UNAVAILABLE, n instanceof Error ? n.message : "Resource token acquisition failed.", {
@@ -1451,24 +1456,24 @@ var me = () => {
1451
1456
  }
1452
1457
  async generateProofAsync(e, t) {
1453
1458
  let n = this.cached.get(e)?.resourceContext, r = t.grantResource === void 0 ? n ? n.grantResource : e : t.grantResource, i = await this.contextAsync(r ?? void 0);
1454
- if (i.isWorker) return `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${H(this.oidc.configurationName, e)}`;
1459
+ if (i.isWorker) return `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${U(this.oidc.configurationName, e)}`;
1455
1460
  let a = await i.storage.getDemonstratingProofOfPossessionJwkAsync();
1456
- if (!a) throw U("The resource DPoP grant key is unavailable.");
1457
- let o = t.url === i.server.tokenEndpoint ? await i.storage.getDemonstratingProofOfPossessionNonce() : g(H(this.oidc.configurationName, e), this.oidc.configuration.storage).getDemonstratingProofOfPossessionApiNonce();
1458
- return ne(window)(this.oidc.configuration.demonstrating_proof_of_possession_configuration)(a, t.method, t.url, {
1459
- ath: await le(t.accessToken),
1461
+ if (!a) throw G("The resource DPoP grant key is unavailable.");
1462
+ let o = t.url === i.server.tokenEndpoint ? await i.storage.getDemonstratingProofOfPossessionNonce() : g(U(this.oidc.configurationName, e), this.oidc.configuration.storage).getDemonstratingProofOfPossessionApiNonce();
1463
+ return M(window)(this.oidc.configuration.demonstrating_proof_of_possession_configuration)(a, t.method, t.url, {
1464
+ ath: await se(t.accessToken),
1460
1465
  ...o ? { nonce: o } : {}
1461
1466
  });
1462
1467
  }
1463
1468
  peek(e) {
1464
1469
  if (this.oidc.isLoggingOut) return null;
1465
1470
  let t = this.cached.get(e);
1466
- return t && t.resourceContext?.subject === this.oidc.tokens?.idTokenPayload?.sub && Pt(t) ? this.publicToken(e, t) : null;
1471
+ return t && t.resourceContext?.subject === this.oidc.tokens?.idTokenPayload?.sub && X(t) ? this.publicToken(e, t) : null;
1467
1472
  }
1468
1473
  createApiNonceRecorder(e) {
1469
1474
  let t = this.generation, n = this.generations.get(e) ?? 0;
1470
1475
  return async (r) => {
1471
- t !== this.generation || n !== (this.generations.get(e) ?? 0) || !this.peek(e) ? console.warn("Ignoring a resource API nonce response after its session was cleared.") : this.oidc.configuration.service_worker_relative_url || await g(H(this.oidc.configurationName, e), this.oidc.configuration.storage).setDemonstratingProofOfPossessionApiNonce(r);
1476
+ t !== this.generation || n !== (this.generations.get(e) ?? 0) || !this.peek(e) ? console.warn("Ignoring a resource API nonce response after its session was cleared.") : this.oidc.configuration.service_worker_relative_url || await g(U(this.oidc.configurationName, e), this.oidc.configuration.storage).setDemonstratingProofOfPossessionApiNonce(r);
1472
1477
  };
1473
1478
  }
1474
1479
  async getTokensToRevokeAsync() {
@@ -1481,11 +1486,11 @@ var me = () => {
1481
1486
  return n;
1482
1487
  }
1483
1488
  async clearAsync(e) {
1484
- B(this.oidc.configuration.resources, e), this.generations.set(e, (this.generations.get(e) ?? 0) + 1), at(this.oidc.configurationName, e), this.pending.delete(e), this.cached.delete(e);
1489
+ V(this.oidc.configuration.resources, e), this.generations.set(e, (this.generations.get(e) ?? 0) + 1), it(this.oidc.configurationName, e), this.pending.delete(e), this.cached.delete(e);
1485
1490
  let t = this.renewalTimers.get(e);
1486
1491
  t && b.clearTimeout(t), this.renewalTimers.delete(e);
1487
1492
  let n = await this.contextAsync(e);
1488
- await n.storage.clearAsync("LOGGED_OUT"), n.storage.setLoginParams(null), n.isWorker || (await g(H(this.oidc.configurationName, e), this.oidc.configuration.storage).setDemonstratingProofOfPossessionApiNonce(null), await Promise.all([
1493
+ await n.storage.clearAsync("LOGGED_OUT"), n.storage.setLoginParams(null), n.isWorker || (await g(U(this.oidc.configurationName, e), this.oidc.configuration.storage).setDemonstratingProofOfPossessionApiNonce(null), await Promise.all([
1489
1494
  n.storage.setStateAsync(null),
1490
1495
  n.storage.setCodeVerifierAsync(null),
1491
1496
  n.storage.setNonceAsync(null),
@@ -1495,10 +1500,10 @@ var me = () => {
1495
1500
  }
1496
1501
  async clearAllAsync() {
1497
1502
  if (this.oidc.configuration.resources?.length) {
1498
- this.generation++, at(this.oidc.configurationName), this.pending.clear(), this.cached.clear();
1503
+ this.generation++, it(this.oidc.configurationName), this.pending.clear(), this.cached.clear();
1499
1504
  for (let e of this.renewalTimers.values()) b.clearTimeout(e);
1500
1505
  if (this.renewalTimers.clear(), !this.oidc.configuration.service_worker_relative_url) for (let e of this.oidc.configuration.resources ?? []) {
1501
- let t = g(H(this.oidc.configurationName, e.resource), this.oidc.configuration.storage, this.oidc.configuration.login_state_storage ?? this.oidc.configuration.storage);
1506
+ let t = g(U(this.oidc.configurationName, e.resource), this.oidc.configuration.storage, this.oidc.configuration.login_state_storage ?? this.oidc.configuration.storage);
1502
1507
  await t.clearAsync("LOGGED_OUT"), t.setLoginParams(null), await Promise.all([
1503
1508
  t.setStateAsync(null),
1504
1509
  t.setCodeVerifierAsync(null),
@@ -1510,9 +1515,9 @@ var me = () => {
1510
1515
  }
1511
1516
  }
1512
1517
  }
1513
- }, W = /* @__PURE__ */ function(e) {
1518
+ }, K = /* @__PURE__ */ function(e) {
1514
1519
  return e.AutomaticBeforeTokenExpiration = "AutomaticBeforeTokensExpiration", e.AutomaticOnlyWhenFetchExecuted = "AutomaticOnlyWhenFetchExecuted", e;
1515
- }({}), gt = (t, n, i = !1, a = "api_request") => async (...o) => {
1520
+ }({}), ht = (t, n, i = !1, a = "api_request") => async (...o) => {
1516
1521
  let [s, l, ...u] = o, d = typeof a == "string" ? a : "api_request", p = typeof a == "string" ? void 0 : a.resource, m;
1517
1522
  if (p === void 0 && d === "api_request" && n.configuration.resources?.length) try {
1518
1523
  let e = new URL(s instanceof Request ? s.url : s.toString(), window.location.href).toString();
@@ -1527,7 +1532,7 @@ var me = () => {
1527
1532
  }
1528
1533
  if (typeof a != "string" && Object.prototype.hasOwnProperty.call(a, "resource")) try {
1529
1534
  if (typeof p != "string") throw Error("An explicit resource identifier is required.");
1530
- if (m = new URL(s instanceof Request ? s.url : s.toString(), window.location.href).toString(), !ze(B(n.configuration.resources, p), m)) throw Error("The destination does not belong to the selected resource.");
1535
+ if (m = new URL(s instanceof Request ? s.url : s.toString(), window.location.href).toString(), !ze(V(n.configuration.resources, p), m)) throw Error("The destination does not belong to the selected resource.");
1531
1536
  if (l?.redirect === "follow") throw Error("Resource fetch cannot automatically follow redirects.");
1532
1537
  } catch (t) {
1533
1538
  let i = new r(e.INVALID_RESOURCE, t instanceof Error ? t.message : "Invalid resource destination.", {
@@ -1558,7 +1563,7 @@ var me = () => {
1558
1563
  return e;
1559
1564
  },
1560
1565
  renewTokensAsync: n.renewTokensAsync.bind(n)
1561
- }, v = p === void 0 ? void 0 : await n.resourceTokens.getAccessTokenAsync(p), y = p === void 0 ? await Ft(_) : void 0, b = v?.accessToken ?? y?.tokens?.accessToken;
1566
+ }, v = p === void 0 ? void 0 : await n.resourceTokens.getAccessTokenAsync(p), y = p === void 0 ? await It(_) : void 0, b = v?.accessToken ?? y?.tokens?.accessToken;
1562
1567
  if (g.has("Accept") || g.set("Accept", "application/json"), b) {
1563
1568
  if (n.configuration.demonstrating_proof_of_possession && i || v?.tokenType?.toLowerCase() === "dpop") {
1564
1569
  let e = p === void 0 ? await n.generateDemonstrationOfProofOfPossessionAsync(b, s.toString(), h.method) : await n.resourceTokens.generateProofAsync(p, {
@@ -1599,13 +1604,13 @@ var me = () => {
1599
1604
  d === "api_request" && n.publishEvent(f.apiRequest_error, t);
1600
1605
  }
1601
1606
  return C;
1602
- }, _t = (t) => async (n = !1, o = !1) => {
1607
+ }, gt = (t) => async (n = !1, o = !1) => {
1603
1608
  try {
1604
1609
  if (t.userInfo != null && !n) return t.userInfo;
1605
1610
  let i = !n && t.configuration.storage?.getItem(`oidc.${t.configurationName}.userInfo`);
1606
1611
  if (i) return t.userInfo = JSON.parse(i), t.userInfo;
1607
1612
  let s = t.configuration, c = (await t.initAsync(s.authority, s.authority_configuration)).userInfoEndpoint, l = await (async () => {
1608
- let n = await gt(fetch, t, o, "userinfo")(c);
1613
+ let n = await ht(fetch, t, o, "userinfo")(c);
1609
1614
  if (n.status !== 200) {
1610
1615
  let i = n.headers?.has("DPoP-Nonce") && (n.status === 400 || n.status === 401 || n.headers.get("WWW-Authenticate")?.includes("use_dpop_nonce")), o = new r(i ? e.DPOP_NONCE_REQUIRED : e.REQUEST_FAILED, "UserInfo request failed", {
1611
1616
  phase: "userinfo",
@@ -1622,39 +1627,39 @@ var me = () => {
1622
1627
  let n = i(e) ? e : l(e) ? c(e, "userinfo") : e;
1623
1628
  throw t.publishEvent(f.userInfoAsync_error, n), n;
1624
1629
  }
1625
- }, vt = () => fetch, yt = class {
1630
+ }, _t = () => fetch, vt = class {
1626
1631
  constructor(e) {
1627
1632
  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, this.pushedAuthorizationRequestEndpoint = e.pushed_authorization_request_endpoint, this.requirePushedAuthorizationRequests = e.require_pushed_authorization_requests ?? !1;
1628
1633
  }
1629
- }, G = {}, bt = (e, t = new M()) => (n, r = "default") => (G[r] || (G[r] = new K(n, r, e, t)), G[r]), xt = async (e) => {
1634
+ }, q = {}, yt = (e, t = new he()) => (n, r = "default") => (q[r] || (q[r] = new J(n, r, e, t)), q[r]), bt = async (e) => {
1630
1635
  let { parsedTokens: t, callbackPath: n, extras: r, scope: i } = await e.loginCallbackAsync();
1631
- return e.timeoutId = q(e, t.expiresAt, r, i), { callbackPath: n };
1632
- }, K = class t {
1633
- constructor(e, t = "default", n, r = new M()) {
1636
+ return e.timeoutId = Tt(e, t.expiresAt, r, i), { callbackPath: n };
1637
+ }, J = class t {
1638
+ constructor(e, t = "default", n, r = new he()) {
1634
1639
  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;
1635
1640
  let i = e.silent_login_uri;
1636
1641
  e.silent_redirect_uri && !e.silent_login_uri && (i = `${e.silent_redirect_uri.replace("-callback", "").replace("callback", "")}-login`);
1637
1642
  let a = e.refresh_time_before_tokens_expiration_in_second ?? 120;
1638
- a > 60 && (a -= Math.floor(Math.random() * 40)), this.location = r ?? new M(), this.configuration = {
1643
+ a > 60 && (a -= Math.floor(Math.random() * 40)), this.location = r ?? new he(), this.configuration = {
1639
1644
  ...e,
1640
1645
  silent_login_uri: i,
1641
- token_automatic_renew_mode: e.token_automatic_renew_mode ?? W.AutomaticBeforeTokenExpiration,
1646
+ token_automatic_renew_mode: e.token_automatic_renew_mode ?? K.AutomaticBeforeTokenExpiration,
1642
1647
  monitor_session: e.monitor_session ?? !1,
1643
1648
  refresh_time_before_tokens_expiration_in_second: a,
1644
1649
  silent_login_timeout: e.silent_login_timeout ?? 12e3,
1645
- token_renew_mode: e.token_renew_mode ?? Y.access_token_or_id_token_invalid,
1650
+ token_renew_mode: e.token_renew_mode ?? jt.access_token_or_id_token_invalid,
1646
1651
  demonstrating_proof_of_possession: e.demonstrating_proof_of_possession ?? !1,
1647
1652
  authority_timeout_wellknowurl_in_millisecond: e.authority_timeout_wellknowurl_in_millisecond ?? 1e4,
1648
1653
  logout_tokens_to_invalidate: e.logout_tokens_to_invalidate ?? ["access_token", "refresh_token"],
1649
- service_worker_activate: e.service_worker_activate ?? me,
1654
+ service_worker_activate: e.service_worker_activate ?? fe,
1650
1655
  demonstrating_proof_of_possession_configuration: e.demonstrating_proof_of_possession_configuration ?? O,
1651
1656
  preload_user_info: e.preload_user_info ?? !1,
1652
1657
  par: e.par ?? "disabled",
1653
1658
  par_request_timeout: e.par_request_timeout ?? 1e4
1654
- }, this.getFetch = n ?? vt, this.configurationName = t, this.tokens = null, this.userInfo = null, this.events = [], this.timeoutId = null, this.resourceTokens = new ht(this), 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.renewTokensOrThrowAsync.bind(this), this.initAsync(this.configuration.authority, this.configuration.authority_configuration);
1659
+ }, this.getFetch = n ?? _t, this.configurationName = t, this.tokens = null, this.userInfo = null, this.events = [], this.timeoutId = null, this.resourceTokens = new mt(this), 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.renewTokensOrThrowAsync.bind(this), this.initAsync(this.configuration.authority, this.configuration.authority_configuration);
1655
1660
  }
1656
1661
  subscribeEvents(e) {
1657
- let t = se(16);
1662
+ let t = ae(16);
1658
1663
  return this.events.push({
1659
1664
  id: t,
1660
1665
  func: e
@@ -1670,10 +1675,10 @@ var me = () => {
1670
1675
  });
1671
1676
  }
1672
1677
  static {
1673
- this.getOrCreate = (e, t) => (n, r = "default") => bt(e, t)(n, r);
1678
+ this.getOrCreate = (e, t) => (n, r = "default") => yt(e, t)(n, r);
1674
1679
  }
1675
1680
  static get(e = "default") {
1676
- return Object.prototype.hasOwnProperty.call(G, e) ? G[e] : null;
1681
+ return Object.prototype.hasOwnProperty.call(q, e) ? q[e] : null;
1677
1682
  }
1678
1683
  static getOrThrow(e = "default") {
1679
1684
  let n = t.get(e);
@@ -1686,7 +1691,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1686
1691
  }
1687
1692
  _silentLoginCallbackFromIFrame(e = this.tokens, t) {
1688
1693
  if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
1689
- let n = this.location, r = V(n.getCurrentHref());
1694
+ let n = this.location, r = H(n.getCurrentHref());
1690
1695
  window.parent.postMessage(`${this.configurationName}_oidc_tokens:${JSON.stringify({
1691
1696
  tokens: e,
1692
1697
  resource: t,
@@ -1696,7 +1701,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1696
1701
  }
1697
1702
  _silentLoginErrorCallbackFromIFrame(e = null) {
1698
1703
  if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
1699
- let t = this.location, n = V(t.getCurrentHref());
1704
+ let t = this.location, n = H(t.getCurrentHref());
1700
1705
  if (n.error) {
1701
1706
  let e = s(n.error, n.error_description, `Error from OIDC server: ${n.error} - ${n.error_description}`, "refresh");
1702
1707
  window.parent.postMessage(`${this.configurationName}_oidc_error:${JSON.stringify({
@@ -1712,7 +1717,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1712
1717
  }
1713
1718
  async silentLoginCallbackAsync() {
1714
1719
  try {
1715
- let e = this.configuration.resources?.length ? rt(this.configurationName, this.location.getCurrentHref()) : void 0, t = await this.loginCallbackAsync(!0);
1720
+ let e = this.configuration.resources?.length ? nt(this.configurationName, this.location.getCurrentHref()) : void 0, t = await this.loginCallbackAsync(!0);
1716
1721
  this._silentLoginCallbackFromIFrame(t.parsedTokens, e);
1717
1722
  } catch (e) {
1718
1723
  console.error(e), this._silentLoginErrorCallbackFromIFrame(e);
@@ -1721,7 +1726,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1721
1726
  async initAsync(e, t) {
1722
1727
  if (this.initPromise !== null) return this.initPromise;
1723
1728
  let n = async () => {
1724
- if (t != null) return new yt({
1729
+ if (t != null) return new vt({
1725
1730
  authorization_endpoint: t.authorization_endpoint,
1726
1731
  end_session_endpoint: t.end_session_endpoint,
1727
1732
  revocation_endpoint: t.revocation_endpoint,
@@ -1740,15 +1745,15 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1740
1745
  });
1741
1746
  }
1742
1747
  async tryKeepExistingSessionAsync() {
1743
- return this.tryKeepExistingSessionPromise === null ? (this.tryKeepExistingSessionPromise = he(this), this.tryKeepExistingSessionPromise.finally(() => {
1748
+ return this.tryKeepExistingSessionPromise === null ? (this.tryKeepExistingSessionPromise = me(this), this.tryKeepExistingSessionPromise.finally(() => {
1744
1749
  this.tryKeepExistingSessionPromise = null;
1745
1750
  })) : this.tryKeepExistingSessionPromise;
1746
1751
  }
1747
1752
  async startCheckSessionAsync(e, t, n, r = !1) {
1748
- await C(this, G, this.configuration)(e, t, n, r);
1753
+ await C(this, q, this.configuration)(e, t, n, r);
1749
1754
  }
1750
1755
  async loginAsync(e = void 0, t = null, n = !1, r = void 0, i = !1) {
1751
- return this.logoutPromise && await this.logoutPromise, this.loginPromise === null ? (this.loginPromise = (async () => (t?._oidc_resource === void 0 && this.configuration.resources?.length && await this.resourceTokens.clearAllAsync(), i ? S(window, this.configurationName, this.configuration, this.publishEvent.bind(this), this)(t, r) : ot(this.configurationName, this.configuration, this.publishEvent.bind(this), this.initAsync.bind(this), this.location, this.getFetch)(e, t, n, r)))(), this.loginPromise.catch((e) => {
1756
+ return this.logoutPromise && await this.logoutPromise, this.loginPromise === null ? (this.loginPromise = (async () => (t?._oidc_resource === void 0 && this.configuration.resources?.length && await this.resourceTokens.clearAllAsync(), i ? S(window, this.configurationName, this.configuration, this.publishEvent.bind(this), this)(t, r) : at(this.configurationName, this.configuration, this.publishEvent.bind(this), this.initAsync.bind(this), this.location, this.getFetch)(e, t, n, r)))(), this.loginPromise.catch((e) => {
1752
1757
  throw n && this._silentLoginErrorCallbackFromIFrame(e), e;
1753
1758
  }).finally(() => {
1754
1759
  this.loginPromise = null;
@@ -1757,13 +1762,13 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1757
1762
  async loginCallbackAsync(n = !1) {
1758
1763
  if (this.loginCallbackPromise !== null) return this.loginCallbackPromise;
1759
1764
  let i = async () => {
1760
- let i = this.configuration.resources?.length ? rt(this.configurationName, this.location.getCurrentHref()) : void 0, a = await st(this)(n, i), o = a.tokens;
1765
+ let i = this.configuration.resources?.length ? nt(this.configurationName, this.location.getCurrentHref()) : void 0, a = await ot(this)(n, i), o = a.tokens;
1761
1766
  if (i !== void 0) {
1762
- if (rt(this.configurationName, this.location.getCurrentHref()) !== i) throw new r(e.RESOURCE_TOKEN_UNAVAILABLE, "The resource authorization was cleared.", {
1767
+ if (nt(this.configurationName, this.location.getCurrentHref()) !== i) throw new r(e.RESOURCE_TOKEN_UNAVAILABLE, "The resource authorization was cleared.", {
1763
1768
  phase: "callback",
1764
1769
  retryable: !1
1765
1770
  });
1766
- return await this.resourceTokens.acceptAuthorizationAsync(i, o), it(this.configurationName, this.location.getCurrentHref()), {
1771
+ return await this.resourceTokens.acceptAuthorizationAsync(i, o), rt(this.configurationName, this.location.getCurrentHref()), {
1767
1772
  parsedTokens: o,
1768
1773
  state: a.state,
1769
1774
  callbackPath: a.callbackPath,
@@ -1771,7 +1776,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1771
1776
  extras: a.extras
1772
1777
  };
1773
1778
  }
1774
- return await this.resourceTokens.clearAllAsync(), this.tokens = o, await $(this.configuration, H(this.configurationName, i)) || g(this.configurationName, this.configuration.storage, this.configuration.login_state_storage ?? this.configuration.storage).setTokens(o), this.publishEvent(t.eventNames.token_acquired, o), this.configuration.preload_user_info && await this.userInfoAsync(), {
1779
+ return await this.resourceTokens.clearAllAsync(), this.tokens = o, await $(this.configuration, U(this.configurationName, i)) || g(this.configurationName, this.configuration.storage, this.configuration.login_state_storage ?? this.configuration.storage).setTokens(o), this.publishEvent(t.eventNames.token_acquired, o), this.configuration.preload_user_info && await this.userInfoAsync(), {
1775
1780
  parsedTokens: o,
1776
1781
  state: a.state,
1777
1782
  callbackPath: a.callbackPath,
@@ -1785,20 +1790,20 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1785
1790
  }
1786
1791
  async generateDemonstrationOfProofOfPossessionAsync(e, t, n, r = {}) {
1787
1792
  let i = this.configuration, a = {
1788
- ath: await le(e),
1793
+ ath: await se(e),
1789
1794
  ...r
1790
1795
  };
1791
- if (await $(i, this.configurationName)) return `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${this.configurationName}#tabId=${Ut(this.configurationName)}`;
1796
+ if (await $(i, this.configurationName)) return `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${this.configurationName}#tabId=${Wt(this.configurationName)}`;
1792
1797
  let o = g(this.configurationName, i.storage, i.login_state_storage ?? i.storage), s = await o.getDemonstratingProofOfPossessionJwkAsync(), c = o.getDemonstratingProofOfPossessionNonce();
1793
- return c && (a.nonce = c), await ne(window)(i.demonstrating_proof_of_possession_configuration)(s, n, t, a);
1798
+ return c && (a.nonce = c), await M(window)(i.demonstrating_proof_of_possession_configuration)(s, n, t, a);
1794
1799
  }
1795
1800
  loginCallbackWithAutoTokensRenewAsync() {
1796
- return this.loginCallbackWithAutoTokensRenewPromise === null ? (this.loginCallbackWithAutoTokensRenewPromise = xt(this), this.loginCallbackWithAutoTokensRenewPromise.finally(() => {
1801
+ return this.loginCallbackWithAutoTokensRenewPromise === null ? (this.loginCallbackWithAutoTokensRenewPromise = bt(this), this.loginCallbackWithAutoTokensRenewPromise.finally(() => {
1797
1802
  this.loginCallbackWithAutoTokensRenewPromise = null;
1798
1803
  })) : this.loginCallbackWithAutoTokensRenewPromise;
1799
1804
  }
1800
1805
  userInfoAsync(e = !1, t = !1) {
1801
- return this.userInfoPromise === null ? (this.userInfoPromise = _t(this)(e, t), this.userInfoPromise.finally(() => {
1806
+ return this.userInfoPromise === null ? (this.userInfoPromise = gt(this)(e, t), this.userInfoPromise.finally(() => {
1802
1807
  this.userInfoPromise = null;
1803
1808
  })) : this.userInfoPromise;
1804
1809
  }
@@ -1806,7 +1811,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1806
1811
  if (this.renewTokensPromise !== null) return this.renewTokensPromise;
1807
1812
  if (!this.timeoutId) return null;
1808
1813
  b.clearTimeout(this.timeoutId);
1809
- let n = wt(this, !0, e, t);
1814
+ let n = Ct(this, !0, e, t);
1810
1815
  return this.renewTokensPromise = n, n.finally(() => {
1811
1816
  this.renewTokensPromise === n && (this.renewTokensPromise = null);
1812
1817
  });
@@ -1824,10 +1829,10 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1824
1829
  return i.tokens;
1825
1830
  }
1826
1831
  async destroyAsync(e) {
1827
- return await dt(this)(e);
1832
+ return await ut(this)(e);
1828
1833
  }
1829
1834
  async clearSessionAsync() {
1830
- return this.clearSessionPromise ? this.clearSessionPromise : (this.clearSessionPromise = ft(this, G)(), this.clearSessionPromise.finally(() => {
1835
+ return this.clearSessionPromise ? this.clearSessionPromise : (this.clearSessionPromise = dt(this, q)(), this.clearSessionPromise.finally(() => {
1831
1836
  this.clearSessionPromise = null;
1832
1837
  }));
1833
1838
  }
@@ -1844,11 +1849,11 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1844
1849
  }));
1845
1850
  }
1846
1851
  async logoutAsync(e = void 0, t = null) {
1847
- return this.logoutPromise ? this.logoutPromise : (this.logoutPromise = mt(this, G, this.getFetch(), console, this.location)(e, t), this.logoutPromise.finally(() => {
1852
+ return this.logoutPromise ? this.logoutPromise : (this.logoutPromise = pt(this, q, this.getFetch(), console, this.location)(e, t), this.logoutPromise.finally(() => {
1848
1853
  this.logoutPromise = null;
1849
1854
  }));
1850
1855
  }
1851
- }, St = (t, n) => {
1856
+ }, xt = (t, n) => {
1852
1857
  let i = n?.oauthError === "use_dpop_nonce" ? e.DPOP_NONCE_REQUIRED : e.TOKEN_REQUEST_FAILED;
1853
1858
  return new r(i, t, {
1854
1859
  phase: "refresh",
@@ -1858,23 +1863,23 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1858
1863
  oauthErrorDescription: n?.oauthErrorDescription
1859
1864
  });
1860
1865
  };
1861
- async function Ct(e, t, n, r = null) {
1866
+ async function St(e, t, n, r = null) {
1862
1867
  let a = (t) => {
1863
1868
  e.tokens = t;
1864
1869
  };
1865
- e.publishEvent(K.eventNames.syncTokensAsync_begin, {});
1870
+ e.publishEvent(J.eventNames.syncTokensAsync_begin, {});
1866
1871
  let o;
1867
1872
  try {
1868
1873
  o = await Dt(e)(a, 0, 0, t, n, r);
1869
1874
  } catch (t) {
1870
- throw e.publishEvent(K.eventNames.syncTokensAsync_error, {
1875
+ throw e.publishEvent(J.eventNames.syncTokensAsync_error, {
1871
1876
  message: "sync tokens error",
1872
1877
  error: i(t) ? t : void 0,
1873
1878
  exception: t
1874
1879
  }), t;
1875
1880
  }
1876
1881
  let { tokens: s, status: c } = o;
1877
- return e.publishEvent(K.eventNames.syncTokensAsync_end, { status: c }), await $(e.configuration, e.configurationName) || g(e.configurationName, e.configuration.storage, e.configuration.login_state_storage ?? e.configuration.storage).setTokens(e.tokens), e.tokens ? {
1882
+ return e.publishEvent(J.eventNames.syncTokensAsync_end, { status: c }), await $(e.configuration, e.configurationName) || g(e.configurationName, e.configuration.storage, e.configuration.login_state_storage ?? e.configuration.storage).setTokens(e.tokens), e.tokens ? {
1878
1883
  ...o,
1879
1884
  tokens: s
1880
1885
  } : (await e.destroyAsync(c), {
@@ -1882,30 +1887,30 @@ async function Ct(e, t, n, r = null) {
1882
1887
  tokens: null
1883
1888
  });
1884
1889
  }
1885
- async function wt(e, t = !1, n = null, r = null) {
1890
+ async function Ct(e, t = !1, n = null, r = null) {
1886
1891
  let i = e.configuration, a = `${i.client_id}_${e.configurationName}_${i.authority}`, o, s = await $(e.configuration, e.configurationName);
1887
- if (i.resources?.length && e.resourceTokens) o = await e.resourceTokens.withRefreshLockAsync(() => Ct(e, t, n, r));
1888
- else if (i?.storage === window?.sessionStorage && !s || !navigator.locks) o = await Ct(e, t, n, r);
1892
+ if (i.resources?.length && e.resourceTokens) o = await e.resourceTokens.withRefreshLockAsync(() => St(e, t, n, r));
1893
+ else if (i?.storage === window?.sessionStorage && !s || !navigator.locks) o = await St(e, t, n, r);
1889
1894
  else {
1890
1895
  let i = "retry";
1891
- for (; i === "retry";) i = await navigator.locks.request(a, { ifAvailable: !0 }, async (i) => i ? await Ct(e, t, n, r) : (e.publishEvent(K.eventNames.syncTokensAsync_lock_not_available, { lock: "lock not available" }), "retry"));
1896
+ for (; i === "retry";) i = await navigator.locks.request(a, { ifAvailable: !0 }, async (i) => i ? await St(e, t, n, r) : (e.publishEvent(J.eventNames.syncTokensAsync_lock_not_available, { lock: "lock not available" }), "retry"));
1892
1897
  o = i;
1893
1898
  }
1894
- return o.tokens ? (e.timeoutId &&= q(e, e.tokens.expiresAt, n, r), {
1899
+ return o.tokens ? (e.timeoutId &&= Tt(e, e.tokens.expiresAt, n, r), {
1895
1900
  ...o,
1896
1901
  tokens: e.tokens
1897
1902
  }) : o;
1898
1903
  }
1899
- async function Tt(e, t = !1, n = null, r = null) {
1900
- return (await wt(e, t, n, r)).tokens;
1904
+ async function wt(e, t = !1, n = null, r = null) {
1905
+ return (await Ct(e, t, n, r)).tokens;
1901
1906
  }
1902
- var q = (e, t, n = null, r = null) => {
1907
+ var Tt = (e, t, n = null, r = null) => {
1903
1908
  let i = e.configuration.refresh_time_before_tokens_expiration_in_second;
1904
1909
  return e.timeoutId && b.clearTimeout(e.timeoutId), b.setTimeout(async () => {
1905
- let a = { timeLeft: X(i, t) };
1906
- e.publishEvent(K.eventNames.token_timer, a), await Tt(e, !1, n, r);
1910
+ let a = { timeLeft: Ft(i, t) };
1911
+ e.publishEvent(J.eventNames.token_timer, a), await wt(e, !1, n, r);
1907
1912
  }, 1e3);
1908
- }, J = {
1913
+ }, Y = {
1909
1914
  FORCE_REFRESH: "FORCE_REFRESH",
1910
1915
  SESSION_LOST: "SESSION_LOST",
1911
1916
  NOT_CONNECTED: "NOT_CONNECTED",
@@ -1919,7 +1924,7 @@ var q = (e, t, n = null, r = null) => {
1919
1924
  let a = { nonce: null };
1920
1925
  if (!r) return {
1921
1926
  tokens: null,
1922
- status: J.NOT_CONNECTED,
1927
+ status: Y.NOT_CONNECTED,
1923
1928
  nonce: a
1924
1929
  };
1925
1930
  let o, s = await e.initAsync(t.authority, t.authority_configuration), c = await $(t, n);
@@ -1927,39 +1932,39 @@ var q = (e, t, n = null, r = null) => {
1927
1932
  let { status: e, tokens: n } = await c.initAsync(s, "syncTokensAsync", t);
1928
1933
  if (e === "LOGGED_OUT") return {
1929
1934
  tokens: null,
1930
- status: J.LOGOUT_FROM_ANOTHER_TAB,
1935
+ status: Y.LOGOUT_FROM_ANOTHER_TAB,
1931
1936
  nonce: a
1932
1937
  };
1933
1938
  if (e === "SESSIONS_LOST") return {
1934
1939
  tokens: null,
1935
- status: J.SESSION_LOST,
1940
+ status: Y.SESSION_LOST,
1936
1941
  nonce: a
1937
1942
  };
1938
1943
  if (!e || !n) return {
1939
1944
  tokens: null,
1940
- status: J.REQUIRE_SYNC_TOKENS,
1945
+ status: Y.REQUIRE_SYNC_TOKENS,
1941
1946
  nonce: a
1942
1947
  };
1943
1948
  if (n.issuedAt !== r.issuedAt) return {
1944
1949
  tokens: n,
1945
- status: X(t.refresh_time_before_tokens_expiration_in_second, n.expiresAt) > 0 ? J.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : J.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID,
1950
+ status: Ft(t.refresh_time_before_tokens_expiration_in_second, n.expiresAt) > 0 ? Y.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : Y.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID,
1946
1951
  nonce: await c.getNonceAsync()
1947
1952
  };
1948
1953
  o = await c.getNonceAsync();
1949
1954
  } else {
1950
1955
  let i = g(n, t.storage ?? sessionStorage, t.login_state_storage ?? t.storage ?? sessionStorage), s = await i.initAsync(), { tokens: c } = s, { status: l } = s;
1951
- if (c &&= Mt(c, e.tokens, t.token_renew_mode), !c) return {
1956
+ if (c &&= Nt(c, e.tokens, t.token_renew_mode), !c) return {
1952
1957
  tokens: null,
1953
- status: J.LOGOUT_FROM_ANOTHER_TAB,
1958
+ status: Y.LOGOUT_FROM_ANOTHER_TAB,
1954
1959
  nonce: a
1955
1960
  };
1956
1961
  if (l === "SESSIONS_LOST") return {
1957
1962
  tokens: null,
1958
- status: J.SESSION_LOST,
1963
+ status: Y.SESSION_LOST,
1959
1964
  nonce: a
1960
1965
  };
1961
1966
  if (c.issuedAt !== r.issuedAt) {
1962
- let e = X(t.refresh_time_before_tokens_expiration_in_second, c.expiresAt) > 0 ? J.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : J.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID, n = await i.getNonceAsync();
1967
+ let e = Ft(t.refresh_time_before_tokens_expiration_in_second, c.expiresAt) > 0 ? Y.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : Y.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID, n = await i.getNonceAsync();
1963
1968
  return {
1964
1969
  tokens: c,
1965
1970
  status: e,
@@ -1968,7 +1973,7 @@ var q = (e, t, n = null, r = null) => {
1968
1973
  }
1969
1974
  o = await i.getNonceAsync();
1970
1975
  }
1971
- let l = X(t.refresh_time_before_tokens_expiration_in_second, r.expiresAt) > 0 ? "TOKENS_VALID" : "TOKENS_INVALID";
1976
+ let l = Ft(t.refresh_time_before_tokens_expiration_in_second, r.expiresAt) > 0 ? "TOKENS_VALID" : "TOKENS_INVALID";
1972
1977
  return i ? {
1973
1978
  tokens: r,
1974
1979
  status: "FORCE_REFRESH",
@@ -1984,11 +1989,11 @@ var q = (e, t, n = null, r = null) => {
1984
1989
  status: "GIVE_UP"
1985
1990
  };
1986
1991
  let m = 6, h = s ? 2 : 5;
1987
- for (; !navigator.onLine && m > 0;) await Bt({ milliseconds: 1e3 }), m--, t.publishEvent(f.refreshTokensAsync, { message: `wait because navigator is offline try ${m}` });
1992
+ for (; !navigator.onLine && m > 0;) await Vt({ milliseconds: 1e3 }), m--, t.publishEvent(f.refreshTokensAsync, { message: `wait because navigator is offline try ${m}` });
1988
1993
  let _ = document.hidden, v = _ ? a : a + 1, y = _ ? o + 1 : o;
1989
1994
  if (a >= h || o >= 5) {
1990
1995
  n(null);
1991
- let e = p ?? St("refresh token");
1996
+ let e = p ?? xt("refresh token");
1992
1997
  return t.publishEvent(f.refreshTokensAsync_error, {
1993
1998
  message: "refresh token",
1994
1999
  error: e
@@ -2010,7 +2015,7 @@ var q = (e, t, n = null, r = null) => {
2010
2015
  let s = await S(o);
2011
2016
  if (!s) {
2012
2017
  n(null);
2013
- let e = St("refresh token silent not active");
2018
+ let e = xt("refresh token silent not active");
2014
2019
  return t.publishEvent(f.refreshTokensAsync_error, {
2015
2020
  message: "refresh token silent not active",
2016
2021
  error: e
@@ -2036,7 +2041,7 @@ var q = (e, t, n = null, r = null) => {
2036
2041
  error: i
2037
2042
  };
2038
2043
  }
2039
- return n(s.tokens), t.publishEvent(K.eventNames.token_renewed, {}), {
2044
+ return n(s.tokens), t.publishEvent(J.eventNames.token_renewed, {}), {
2040
2045
  tokens: s.tokens,
2041
2046
  status: "LOGGED"
2042
2047
  };
@@ -2052,10 +2057,10 @@ var q = (e, t, n = null, r = null) => {
2052
2057
  try {
2053
2058
  let { status: i, tokens: c, nonce: l } = await Et(t)(b, t.configurationName, t.tokens, s);
2054
2059
  switch (i) {
2055
- case J.SESSION_LOST:
2060
+ case Y.SESSION_LOST:
2056
2061
  n(null);
2057
2062
  {
2058
- let e = p ?? St("refresh token session lost");
2063
+ let e = p ?? xt("refresh token session lost");
2059
2064
  return t.publishEvent(f.refreshTokensAsync_error, {
2060
2065
  message: "refresh token session lost",
2061
2066
  error: e
@@ -2065,28 +2070,28 @@ var q = (e, t, n = null, r = null) => {
2065
2070
  error: e
2066
2071
  };
2067
2072
  }
2068
- case J.NOT_CONNECTED: return n(null), {
2073
+ case Y.NOT_CONNECTED: return n(null), {
2069
2074
  tokens: null,
2070
2075
  status: null
2071
2076
  };
2072
- case J.TOKENS_VALID: return n(c), {
2077
+ case Y.TOKENS_VALID: return n(c), {
2073
2078
  tokens: c,
2074
2079
  status: "LOGGED_IN"
2075
2080
  };
2076
- case J.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID: return n(c), t.publishEvent(K.eventNames.token_renewed, { reason: "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID" }), {
2081
+ case Y.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID: return n(c), t.publishEvent(J.eventNames.token_renewed, { reason: "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID" }), {
2077
2082
  tokens: c,
2078
2083
  status: "LOGGED_IN"
2079
2084
  };
2080
- case J.LOGOUT_FROM_ANOTHER_TAB: return n(null), t.publishEvent(f.logout_from_another_tab, { status: "session syncTokensAsync" }), {
2085
+ case Y.LOGOUT_FROM_ANOTHER_TAB: return n(null), t.publishEvent(f.logout_from_another_tab, { status: "session syncTokensAsync" }), {
2081
2086
  tokens: null,
2082
2087
  status: "LOGGED_OUT"
2083
2088
  };
2084
- case J.REQUIRE_SYNC_TOKENS: return b.token_automatic_renew_mode == W.AutomaticOnlyWhenFetchExecuted && !s ? (t.publishEvent(f.tokensInvalidAndWaitingActionsToRefresh, {}), {
2089
+ case Y.REQUIRE_SYNC_TOKENS: return b.token_automatic_renew_mode == K.AutomaticOnlyWhenFetchExecuted && !s ? (t.publishEvent(f.tokensInvalidAndWaitingActionsToRefresh, {}), {
2085
2090
  tokens: t.tokens,
2086
2091
  status: "GIVE_UP"
2087
2092
  }) : (t.publishEvent(f.refreshTokensAsync_begin, { tryNumber: a }), await C());
2088
2093
  default: {
2089
- if (b.token_automatic_renew_mode == W.AutomaticOnlyWhenFetchExecuted && J.FORCE_REFRESH !== i) return t.publishEvent(f.tokensInvalidAndWaitingActionsToRefresh, {}), {
2094
+ if (b.token_automatic_renew_mode == K.AutomaticOnlyWhenFetchExecuted && Y.FORCE_REFRESH !== i) return t.publishEvent(f.tokensInvalidAndWaitingActionsToRefresh, {}), {
2090
2095
  tokens: t.tokens,
2091
2096
  status: "GIVE_UP"
2092
2097
  };
@@ -2099,14 +2104,14 @@ var q = (e, t, n = null, r = null) => {
2099
2104
  let p = b.client_id, m = b.redirect_uri, h = b.authority, _ = { ...b.token_request_extras ? b.token_request_extras : {} };
2100
2105
  for (let [e, t] of Object.entries(u)) e.endsWith(":token_request") && (_[e.replace(":token_request", "")] = t);
2101
2106
  return await (async () => {
2102
- let i = tt({
2107
+ let i = W({
2103
2108
  client_id: p,
2104
2109
  redirect_uri: m,
2105
2110
  grant_type: "refresh_token",
2106
2111
  refresh_token: c.refreshToken
2107
2112
  }, b), a = await t.initAsync(h, b.authority_configuration), o = document.hidden ? 1e4 : 3e5, x = a.tokenEndpoint, S = {};
2108
2113
  b.demonstrating_proof_of_possession && (S.DPoP = await t.generateDemonstrationOfProofOfPossessionAsync(c.accessToken, x, "POST"));
2109
- let C = await ke(t.getFetch())(x, i, tt(_, b), c, S, b.token_renew_mode, o);
2114
+ let C = await ke(t.getFetch())(x, i, W(_, b), c, S, b.token_renew_mode, o);
2110
2115
  if (!C.success && C.oauthError === "use_dpop_nonce" && C.demonstratingProofOfPossessionNonce && b.demonstrating_proof_of_possession) {
2111
2116
  let e = await $(b, t.configurationName);
2112
2117
  e ? await e.setDemonstratingProofOfPossessionNonce(C.demonstratingProofOfPossessionNonce) : await g(t.configurationName, b.storage, b.login_state_storage ?? b.storage).setDemonstratingProofOfPossessionNonce(C.demonstratingProofOfPossessionNonce), S.DPoP = await t.generateDemonstrationOfProofOfPossessionAsync(c.accessToken, x, "POST"), C = await ke(t.getFetch())(x, i, _, c, S, b.token_renew_mode, o);
@@ -2114,7 +2119,7 @@ var q = (e, t, n = null, r = null) => {
2114
2119
  if (C.success) {
2115
2120
  if (!l || !l.nonce) {
2116
2121
  n(null);
2117
- let e = new P(N.NONCE_MISSING, "refresh token: nonce missing from storage", "refresh");
2122
+ let e = new F(P.NONCE_MISSING, "refresh token: nonce missing from storage", "refresh");
2118
2123
  return t.publishEvent(f.refreshTokensAsync_error, {
2119
2124
  message: "refresh token: nonce missing from storage",
2120
2125
  error: e
@@ -2124,7 +2129,7 @@ var q = (e, t, n = null, r = null) => {
2124
2129
  error: e
2125
2130
  };
2126
2131
  }
2127
- let { isValid: i, reason: o } = It(C.data, l.nonce, a);
2132
+ let { isValid: i, reason: o } = Lt(C.data, l.nonce, a);
2128
2133
  if (!i) {
2129
2134
  n(null);
2130
2135
  let i = new r(o.startsWith("Nonce does not match") ? e.INVALID_NONCE : e.TOKEN_REQUEST_FAILED, `refresh token return not valid tokens, reason: ${o}`, {
@@ -2144,13 +2149,13 @@ var q = (e, t, n = null, r = null) => {
2144
2149
  let e = await $(b, t.configurationName);
2145
2150
  e ? await e.setDemonstratingProofOfPossessionNonce(C.demonstratingProofOfPossessionNonce) : await g(t.configurationName, b.storage, b.login_state_storage ?? b.storage).setDemonstratingProofOfPossessionNonce(C.demonstratingProofOfPossessionNonce);
2146
2151
  }
2147
- return t.publishEvent(f.refreshTokensAsync_end, { success: C.success }), t.publishEvent(K.eventNames.token_renewed, { reason: "REFRESH_TOKEN" }), {
2152
+ return t.publishEvent(f.refreshTokensAsync_end, { success: C.success }), t.publishEvent(J.eventNames.token_renewed, { reason: "REFRESH_TOKEN" }), {
2148
2153
  tokens: C.data,
2149
2154
  status: "LOGGED_IN"
2150
2155
  };
2151
2156
  }
2152
2157
  {
2153
- let e = St("Token request failed", C);
2158
+ let e = xt("Token request failed", C);
2154
2159
  return t.publishEvent(f.refreshTokensAsync_silent_error, {
2155
2160
  message: "bad request",
2156
2161
  tokenResponse: C,
@@ -2188,24 +2193,24 @@ var q = (e, t, n = null, r = null) => {
2188
2193
  console.warn(e);
2189
2194
  }
2190
2195
  return null;
2191
- }, Y = {
2196
+ }, jt = {
2192
2197
  access_token_or_id_token_invalid: "access_token_or_id_token_invalid",
2193
2198
  access_token_invalid: "access_token_invalid",
2194
2199
  id_token_invalid: "id_token_invalid"
2195
2200
  };
2196
- function jt(e, t, n) {
2201
+ function Mt(e, t, n) {
2197
2202
  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;
2198
2203
  }
2199
- var Mt = (e, t = null, n) => {
2204
+ var Nt = (e, t = null, n) => {
2200
2205
  if (!e) return null;
2201
2206
  let r, i = typeof e.expiresIn == "string" ? parseInt(e.expiresIn, 10) : e.expiresIn;
2202
2207
  r = e.accessTokenPayload === void 0 ? At(e.accessToken) : e.accessTokenPayload;
2203
2208
  let a;
2204
2209
  a = t != null && "idToken" in t && !("idToken" in e) ? t.idToken : e.idToken;
2205
2210
  let o = e.idTokenPayload ? e.idTokenPayload : At(a), s = o && o.exp ? o.exp : Number.MAX_VALUE, c = r && r.exp ? r.exp : e.issuedAt + i;
2206
- e.issuedAt = jt(e, r, o);
2211
+ e.issuedAt = Mt(e, r, o);
2207
2212
  let l;
2208
- l = e.expiresAt ? e.expiresAt : n === Y.access_token_invalid ? c : n === Y.id_token_invalid || s < c ? s : c;
2213
+ l = e.expiresAt ? e.expiresAt : n === jt.access_token_invalid ? c : n === jt.id_token_invalid || s < c ? s : c;
2209
2214
  let u = {
2210
2215
  ...e,
2211
2216
  idTokenPayload: o,
@@ -2221,7 +2226,7 @@ var Mt = (e, t = null, n) => {
2221
2226
  };
2222
2227
  }
2223
2228
  return u;
2224
- }, Nt = (e, t, n) => {
2229
+ }, Pt = (e, t, n) => {
2225
2230
  if (!e) return null;
2226
2231
  e.issued_at ||= (/* @__PURE__ */ new Date()).getTime() / 1e3;
2227
2232
  let r = {
@@ -2232,29 +2237,29 @@ var Mt = (e, t = null, n) => {
2232
2237
  tokenType: e.token_type,
2233
2238
  issuedAt: e.issued_at
2234
2239
  };
2235
- return e.resourceContext !== void 0 && Object.assign(r, { resourceContext: e.resourceContext }), "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), Mt(r, t, n);
2236
- }, X = (e, t) => {
2240
+ return e.resourceContext !== void 0 && Object.assign(r, { resourceContext: e.resourceContext }), "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), Nt(r, t, n);
2241
+ }, Ft = (e, t) => {
2237
2242
  let n = t - (/* @__PURE__ */ new Date()).getTime() / 1e3;
2238
2243
  return Math.round(n - e);
2239
- }, Pt = (e, t = 0) => e ? X(t, e.expiresAt) > 0 : !1, Ft = async (e, t = 200, n = 50) => {
2244
+ }, X = (e, t = 0) => e ? Ft(t, e.expiresAt) > 0 : !1, It = async (e, t = 200, n = 50) => {
2240
2245
  let r = n, i = await e.syncTokensInfoAsync();
2241
2246
  for (; [
2242
- J.REQUIRE_SYNC_TOKENS,
2243
- J.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID,
2244
- J.TOKENS_INVALID
2247
+ Y.REQUIRE_SYNC_TOKENS,
2248
+ Y.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID,
2249
+ Y.TOKENS_INVALID
2245
2250
  ].includes(i) && r > 0;) {
2246
- if (e.configuration.token_automatic_renew_mode == W.AutomaticOnlyWhenFetchExecuted) {
2251
+ if (e.configuration.token_automatic_renew_mode == K.AutomaticOnlyWhenFetchExecuted) {
2247
2252
  await e.renewTokensAsync({});
2248
2253
  break;
2249
2254
  }
2250
- await Bt({ milliseconds: t }), --r, i = await e.syncTokensInfoAsync();
2255
+ await Vt({ milliseconds: t }), --r, i = await e.syncTokensInfoAsync();
2251
2256
  }
2252
2257
  return {
2253
- isTokensValid: Pt(e.getTokens()),
2258
+ isTokensValid: X(e.getTokens()),
2254
2259
  tokens: e.getTokens(),
2255
2260
  numberWaited: r - n
2256
2261
  };
2257
- }, It = (e, t, n) => {
2262
+ }, Lt = (e, t, n) => {
2258
2263
  if (e.idTokenPayload) {
2259
2264
  let r = e.idTokenPayload;
2260
2265
  if (n.issuer !== r.iss) return {
@@ -2280,26 +2285,26 @@ var Mt = (e, t = null, n) => {
2280
2285
  isValid: !0,
2281
2286
  reason: ""
2282
2287
  };
2283
- }, Lt = "7.30.2", Rt = null, zt, Bt = ({ milliseconds: e }) => new Promise((t) => b.setTimeout(t, e)), Vt = (e = "/") => {
2288
+ }, Rt = "7.30.3", zt = null, Bt, Vt = ({ milliseconds: e }) => new Promise((t) => b.setTimeout(t, e)), Ht = (e = "/") => {
2284
2289
  try {
2285
- zt = new AbortController(), fetch(`${e}OidcKeepAliveServiceWorker.json?minSleepSeconds=150`, { signal: zt.signal }).catch((e) => {
2290
+ Bt = new AbortController(), fetch(`${e}OidcKeepAliveServiceWorker.json?minSleepSeconds=150`, { signal: Bt.signal }).catch((e) => {
2286
2291
  console.log(e);
2287
- }), Bt({ milliseconds: 15e4 }).then(() => Vt(e));
2292
+ }), Vt({ milliseconds: 15e4 }).then(() => Ht(e));
2288
2293
  } catch (e) {
2289
2294
  console.log(e);
2290
2295
  }
2291
- }, Ht = () => {
2292
- zt && zt.abort();
2293
- }, Ut = (e) => {
2296
+ }, Ut = () => {
2297
+ Bt && Bt.abort();
2298
+ }, Wt = (e) => {
2294
2299
  Pe(e) !== void 0 && (e = e.split("#resource=")[0]);
2295
2300
  let t = `oidc.tabId.${e}`, n = sessionStorage.getItem(t);
2296
2301
  if (n) return n;
2297
2302
  let r = globalThis.crypto.randomUUID();
2298
2303
  return sessionStorage.setItem(t, r), r;
2299
- }, Wt = (e) => navigator.serviceWorker.controller ?? e.active ?? e.waiting ?? e.installing ?? null, Z = (e, t) => (n) => {
2304
+ }, Gt = (e) => navigator.serviceWorker.controller ?? e.active ?? e.waiting ?? e.installing ?? null, Z = (e, t) => (n) => {
2300
2305
  let r = t?.timeoutMs ?? 5e3;
2301
2306
  return new Promise((t, i) => {
2302
- let a = Wt(e);
2307
+ let a = Gt(e);
2303
2308
  if (!a) {
2304
2309
  i(/* @__PURE__ */ Error("Service worker target not available (controller/active/waiting/installing missing)"));
2305
2310
  return;
@@ -2320,34 +2325,34 @@ var Mt = (e, t = null, n) => {
2320
2325
  let e = n?.configurationName;
2321
2326
  a.postMessage({
2322
2327
  ...n,
2323
- tabId: Ut(e ?? "default")
2328
+ tabId: Wt(e ?? "default")
2324
2329
  }, [o.port2]);
2325
2330
  } catch (e) {
2326
2331
  c(), i(e);
2327
2332
  }
2328
2333
  });
2329
- }, Gt = async (e) => navigator.serviceWorker.controller ? navigator.serviceWorker.controller : new Promise((t) => {
2334
+ }, Kt = async (e) => navigator.serviceWorker.controller ? navigator.serviceWorker.controller : new Promise((t) => {
2330
2335
  let n = !1, r = () => {
2331
2336
  n || (n = !0, navigator.serviceWorker.removeEventListener("controllerchange", r), t(navigator.serviceWorker.controller ?? null));
2332
2337
  };
2333
2338
  navigator.serviceWorker.addEventListener("controllerchange", r), b.setTimeout(() => {
2334
2339
  n || (n = !0, navigator.serviceWorker.removeEventListener("controllerchange", r), t(navigator.serviceWorker.controller ?? null));
2335
2340
  }, e);
2336
- }), Kt = !1, Q = !1, qt = /* @__PURE__ */ new Map(), Jt = (e) => e instanceof DOMException ? e.name === "AbortError" : e?.name === "AbortError", Yt = "oidc.sw.controllerchange_reload_count", Xt = 3, Zt = () => {
2341
+ }), qt = !1, Q = !1, Jt = /* @__PURE__ */ new Map(), Yt = /* @__PURE__ */ new WeakMap(), Xt = /* @__PURE__ */ new WeakSet(), Zt = /* @__PURE__ */ new WeakSet(), Qt = 36e5, $t = (e) => e instanceof DOMException ? e.name === "AbortError" : e?.name === "AbortError", en = "oidc.sw.controllerchange_reload_count", tn = 3, nn = () => {
2337
2342
  try {
2338
- return parseInt(sessionStorage.getItem(Yt) ?? "0", 10);
2343
+ return parseInt(sessionStorage.getItem(en) ?? "0", 10);
2339
2344
  } catch {
2340
2345
  return 0;
2341
2346
  }
2342
- }, Qt = () => {
2343
- let e = Zt() + 1;
2347
+ }, rn = () => {
2348
+ let e = nn() + 1;
2344
2349
  try {
2345
- sessionStorage.setItem(Yt, String(e));
2350
+ sessionStorage.setItem(en, String(e));
2346
2351
  } catch {}
2347
2352
  return e;
2348
- }, $t = () => {
2353
+ }, an = () => {
2349
2354
  try {
2350
- sessionStorage.removeItem(Yt);
2355
+ sessionStorage.removeItem(en);
2351
2356
  } catch {}
2352
2357
  }, $ = async (t, n) => {
2353
2358
  let i = t.service_worker_relative_url, a = Pe(n), o = n.split("#resource=")[0], s = () => {
@@ -2358,17 +2363,17 @@ var Mt = (e, t = null, n) => {
2358
2363
  return null;
2359
2364
  };
2360
2365
  if (typeof window > "u" || typeof navigator > "u" || !navigator.serviceWorker || !i || t.service_worker_activate() === !1) return s();
2361
- let c = `${i}${i.includes("?") ? "&" : "?"}v=${Lt}`, l = t.service_worker_register ? i : c;
2362
- qt.has(l) || qt.set(l, t.service_worker_register ? t.service_worker_register(i) : navigator.serviceWorker.register(c, { updateViaCache: "none" }));
2366
+ let c = `${i}${i.includes("?") ? "&" : "?"}v=${Rt}`, l = t.service_worker_register ? i : c;
2367
+ Jt.has(l) || Jt.set(l, t.service_worker_register ? t.service_worker_register(i) : navigator.serviceWorker.register(c, { updateViaCache: "none" }));
2363
2368
  let u = null;
2364
2369
  try {
2365
- u = await qt.get(l);
2370
+ u = await Jt.get(l);
2366
2371
  } catch (e) {
2367
- if (Jt(e)) return qt.delete(l), console.warn("oidc-client: service worker registration was aborted (likely tab shutdown or backgrounding); falling back to non–service-worker mode.", e), s();
2372
+ if ($t(e)) return Jt.delete(l), console.warn("oidc-client: service worker registration was aborted (likely tab shutdown or backgrounding); falling back to non–service-worker mode.", e), s();
2368
2373
  throw e;
2369
2374
  }
2370
2375
  let d = `oidc.sw.version_mismatch_reload.${n}`, f = async (e) => {
2371
- Ht(), console.log("New SW waiting – SKIP_WAITING");
2376
+ Ut(), console.log("New SW waiting – SKIP_WAITING");
2372
2377
  try {
2373
2378
  await new Promise((t, r) => {
2374
2379
  let i = new MessageChannel(), a = null, o = () => {
@@ -2388,7 +2393,7 @@ var Mt = (e, t = null, n) => {
2388
2393
  type: "SKIP_WAITING",
2389
2394
  configurationName: n,
2390
2395
  data: null,
2391
- tabId: Ut(n ?? "default")
2396
+ tabId: Wt(n ?? "default")
2392
2397
  }, [i.port2]);
2393
2398
  } catch (e) {
2394
2399
  o(), r(e);
@@ -2401,41 +2406,43 @@ var Mt = (e, t = null, n) => {
2401
2406
  let e = u.waiting;
2402
2407
  e ? await f(e) : console.warn("sendSkipWaiting called but no waiting service worker found");
2403
2408
  }, m = (e) => {
2404
- Ht(), e.addEventListener("statechange", async () => {
2409
+ Zt.has(e) || (Zt.add(e), Ut(), e.addEventListener("statechange", async () => {
2405
2410
  if (e.state === "installed" && navigator.serviceWorker.controller) {
2406
- if (Zt() >= Xt) {
2411
+ if (nn() >= tn) {
2407
2412
  console.warn("SW trackInstallingWorker: skipping SKIP_WAITING because the reload budget is exhausted");
2408
2413
  return;
2409
2414
  }
2410
2415
  await f(e);
2411
2416
  }
2412
- });
2417
+ }));
2413
2418
  };
2414
- u.addEventListener("updatefound", () => {
2419
+ Xt.has(u) || (Xt.add(u), u.addEventListener("updatefound", () => {
2415
2420
  let e = u.installing;
2416
2421
  e && m(e);
2417
- }), u.installing ? m(u.installing) : u.waiting && navigator.serviceWorker.controller && (Zt() < Xt ? p() : console.warn("SW: a waiting worker exists but reload budget is exhausted – skipping activation")), u.update().catch((e) => {
2422
+ })), u.installing ? m(u.installing) : u.waiting && navigator.serviceWorker.controller && (nn() < tn ? p() : console.warn("SW: a waiting worker exists but reload budget is exhausted – skipping activation"));
2423
+ let h = Date.now(), g = Yt.get(u);
2424
+ (g === void 0 || h - g >= Qt) && (Yt.set(u, h), u.update().catch((e) => {
2418
2425
  console.error(e);
2419
- });
2426
+ }));
2420
2427
  try {
2421
2428
  await navigator.serviceWorker.ready, navigator.serviceWorker.controller || (await Z(u, { timeoutMs: 8e3 })({
2422
2429
  type: "claim",
2423
2430
  configurationName: n,
2424
2431
  data: null
2425
- }), await Gt(2e3));
2432
+ }), await Kt(2e3));
2426
2433
  } catch (e) {
2427
2434
  return console.warn(`Failed init ServiceWorker ${e?.toString?.() ?? String(e)}`), s();
2428
2435
  }
2429
- Kt || (Kt = !0, navigator.serviceWorker.addEventListener("controllerchange", () => {
2436
+ qt || (qt = !0, navigator.serviceWorker.addEventListener("controllerchange", () => {
2430
2437
  if (Q) return;
2431
- let e = Qt();
2432
- e > Xt ? console.warn(`SW controllerchange: reload budget exhausted (${e - 1} reloads). Skipping reload to avoid infinite loop.`) : (Q = !0, console.log("SW controller changed – reloading page"), Ht(), window.location.reload());
2438
+ let e = rn();
2439
+ e > tn ? console.warn(`SW controllerchange: reload budget exhausted (${e - 1} reloads). Skipping reload to avoid infinite loop.`) : (Q = !0, console.log("SW controller changed – reloading page"), Ut(), window.location.reload());
2433
2440
  }));
2434
- let h = async (e) => Z(u)({
2441
+ let _ = async (e) => Z(u)({
2435
2442
  type: "clear",
2436
2443
  data: { status: e },
2437
2444
  configurationName: n
2438
- }), g = async (t, i, s) => {
2445
+ }), v = async (t, i, s) => {
2439
2446
  let c = {
2440
2447
  token_renew_mode: s.token_renew_mode,
2441
2448
  client_id: s.client_id,
@@ -2465,137 +2472,137 @@ var Mt = (e, t = null, n) => {
2465
2472
  },
2466
2473
  configurationName: n
2467
2474
  }), f = l.version;
2468
- if (f !== "7.30.2") {
2469
- console.warn(`Service worker ${f} version mismatch with js client version ${Lt}, unregistering and reloading`);
2475
+ if (f !== "7.30.3") {
2476
+ console.warn(`Service worker ${f} version mismatch with js client version ${Rt}, unregistering and reloading`);
2470
2477
  let e = parseInt(sessionStorage.getItem(d) ?? "0", 10);
2471
2478
  if (e < 3) {
2472
- if (sessionStorage.setItem(d, String(e + 1)), u.waiting) return await p(), await Bt({ milliseconds: 500 }), Q || (Q = !0, window.location.reload()), new Promise(() => {});
2479
+ if (sessionStorage.setItem(d, String(e + 1)), u.waiting) return await p(), await Vt({ milliseconds: 500 }), Q || (Q = !0, window.location.reload()), new Promise(() => {});
2473
2480
  {
2474
- Ht();
2481
+ Ut();
2475
2482
  try {
2476
2483
  await u.update();
2477
2484
  } catch (e) {
2478
2485
  console.error(e);
2479
2486
  }
2480
2487
  let e = await u.unregister();
2481
- return console.log(`Service worker unregistering ${e}`), await Bt({ milliseconds: 500 }), Q || (Q = !0, window.location.reload()), new Promise(() => {});
2488
+ return console.log(`Service worker unregistering ${e}`), await Vt({ milliseconds: 500 }), Q || (Q = !0, window.location.reload()), new Promise(() => {});
2482
2489
  }
2483
2490
  }
2484
2491
  console.error(`Service worker version mismatch persists after ${e} attempt(s). Continuing with mismatched version.`);
2485
- } else sessionStorage.removeItem(d), $t();
2492
+ } else sessionStorage.removeItem(d), an();
2486
2493
  return {
2487
- tokens: Nt(l.tokens, null, s.token_renew_mode),
2494
+ tokens: Pt(l.tokens, null, s.token_renew_mode),
2488
2495
  status: l.status,
2489
2496
  resourceContexts: l.resourceContexts
2490
2497
  };
2491
- }, _ = (e = "/") => {
2492
- Rt ?? (Rt = "not_null", Vt(e));
2493
- }, v = (e) => Z(u)({
2498
+ }, y = (e = "/") => {
2499
+ zt ?? (zt = "not_null", Ht(e));
2500
+ }, x = (e) => Z(u)({
2494
2501
  type: "setSessionState",
2495
2502
  data: { sessionState: e },
2496
2503
  configurationName: n
2497
- }), y = async () => (await Z(u)({
2504
+ }), S = async () => (await Z(u)({
2498
2505
  type: "getSessionState",
2499
2506
  data: null,
2500
2507
  configurationName: n
2501
- })).sessionState, x = (e) => (a === void 0 && (sessionStorage[`oidc.nonce.${n}`] = e.nonce), Z(u)({
2508
+ })).sessionState, C = (e) => (a === void 0 && (sessionStorage[`oidc.nonce.${n}`] = e.nonce), Z(u)({
2502
2509
  type: "setNonce",
2503
2510
  data: { nonce: e },
2504
2511
  configurationName: n
2505
- })), S = async (e = !0) => {
2512
+ })), w = async (e = !0) => {
2506
2513
  let t = (await Z(u)({
2507
2514
  type: "getNonce",
2508
2515
  data: null,
2509
2516
  configurationName: n
2510
2517
  })).nonce;
2511
- return a === void 0 && (t || (t = sessionStorage[`oidc.nonce.${n}`], console.warn("nonce not found in service worker, using sessionStorage"), e && (await x(t), t = (await S(!1)).nonce))), { nonce: t };
2512
- }, C = {}, w = (e) => {
2513
- e == null ? (delete C[n], delete localStorage[`oidc.login.${n}`]) : (C[n] = e, localStorage[`oidc.login.${n}`] = JSON.stringify(e));
2514
- }, T = () => {
2515
- if (C[n]) return C[n];
2518
+ return a === void 0 && (t || (t = sessionStorage[`oidc.nonce.${n}`], console.warn("nonce not found in service worker, using sessionStorage"), e && (await C(t), t = (await w(!1)).nonce))), { nonce: t };
2519
+ }, T = {}, E = (e) => {
2520
+ e == null ? (delete T[n], delete localStorage[`oidc.login.${n}`]) : (T[n] = e, localStorage[`oidc.login.${n}`] = JSON.stringify(e));
2521
+ }, D = () => {
2522
+ if (T[n]) return T[n];
2516
2523
  let e = localStorage[`oidc.login.${n}`];
2517
2524
  if (typeof e != "string" || e === "" || e === "undefined" || e === "null") return null;
2518
2525
  try {
2519
- C[n] = JSON.parse(e);
2526
+ T[n] = JSON.parse(e);
2520
2527
  } catch {
2521
2528
  return null;
2522
2529
  }
2523
- return C[n];
2524
- }, E = async (e) => {
2530
+ return T[n];
2531
+ }, ee = async (e) => {
2525
2532
  await Z(u)({
2526
2533
  type: "setDemonstratingProofOfPossessionNonce",
2527
2534
  data: { demonstratingProofOfPossessionNonce: e },
2528
2535
  configurationName: n
2529
2536
  });
2530
- }, D = async () => (await Z(u)({
2537
+ }, O = async () => (await Z(u)({
2531
2538
  type: "getDemonstratingProofOfPossessionNonce",
2532
2539
  data: null,
2533
2540
  configurationName: n
2534
- })).demonstratingProofOfPossessionNonce, ee = async (e) => {
2541
+ })).demonstratingProofOfPossessionNonce, k = async (e) => {
2535
2542
  let t = JSON.stringify(e);
2536
2543
  await Z(u)({
2537
2544
  type: "setDemonstratingProofOfPossessionJwk",
2538
2545
  data: { demonstratingProofOfPossessionJwkJson: t },
2539
2546
  configurationName: n
2540
2547
  });
2541
- }, O = async () => {
2548
+ }, A = async () => {
2542
2549
  let e = await Z(u)({
2543
2550
  type: "getDemonstratingProofOfPossessionJwk",
2544
2551
  data: null,
2545
2552
  configurationName: n
2546
2553
  });
2547
2554
  return e.demonstratingProofOfPossessionJwkJson ? JSON.parse(e.demonstratingProofOfPossessionJwkJson) : null;
2548
- }, k = async (e = !0) => {
2555
+ }, j = async (e = !0) => {
2549
2556
  let t = (await Z(u)({
2550
2557
  type: "getState",
2551
2558
  data: null,
2552
2559
  configurationName: n
2553
2560
  })).state;
2554
- return a === void 0 && (t || (t = sessionStorage[`oidc.state.${n}`], console.warn("state not found in service worker, using sessionStorage"), e && (await A(t), t = await k(!1)))), t;
2555
- }, A = async (e) => (a === void 0 && (sessionStorage[`oidc.state.${n}`] = e), Z(u)({
2561
+ return a === void 0 && (t || (t = sessionStorage[`oidc.state.${n}`], console.warn("state not found in service worker, using sessionStorage"), e && (await te(t), t = await j(!1)))), t;
2562
+ }, te = async (e) => (a === void 0 && (sessionStorage[`oidc.state.${n}`] = e), Z(u)({
2556
2563
  type: "setState",
2557
2564
  data: { state: e },
2558
2565
  configurationName: n
2559
- })), j = async (e = !0) => {
2566
+ })), M = async (e = !0) => {
2560
2567
  let t = (await Z(u)({
2561
2568
  type: "getCodeVerifier",
2562
2569
  data: null,
2563
2570
  configurationName: n
2564
2571
  })).codeVerifier;
2565
- return a === void 0 && (t || (t = sessionStorage[`oidc.code_verifier.${n}`], console.warn("codeVerifier not found in service worker, using sessionStorage"), e && (await te(t), t = await j(!1)))), t;
2566
- }, te = async (e) => (a === void 0 && (sessionStorage[`oidc.code_verifier.${n}`] = e), Z(u)({
2572
+ return a === void 0 && (t || (t = sessionStorage[`oidc.code_verifier.${n}`], console.warn("codeVerifier not found in service worker, using sessionStorage"), e && (await N(t), t = await M(!1)))), t;
2573
+ }, N = async (e) => (a === void 0 && (sessionStorage[`oidc.code_verifier.${n}`] = e), Z(u)({
2567
2574
  type: "setCodeVerifier",
2568
2575
  data: { codeVerifier: e },
2569
2576
  configurationName: n
2570
2577
  }));
2571
2578
  return {
2572
- clearAsync: h,
2573
- initAsync: g,
2574
- startKeepAliveServiceWorker: () => _(t.service_worker_keep_alive_path),
2575
- setSessionStateAsync: v,
2576
- getSessionStateAsync: y,
2577
- setNonceAsync: x,
2578
- getNonceAsync: S,
2579
- setLoginParams: w,
2580
- getLoginParams: T,
2581
- getStateAsync: k,
2582
- setStateAsync: A,
2583
- getCodeVerifierAsync: j,
2584
- setCodeVerifierAsync: te,
2585
- setDemonstratingProofOfPossessionNonce: E,
2586
- getDemonstratingProofOfPossessionNonce: D,
2587
- setDemonstratingProofOfPossessionJwkAsync: ee,
2588
- getDemonstratingProofOfPossessionJwkAsync: O,
2579
+ clearAsync: _,
2580
+ initAsync: v,
2581
+ startKeepAliveServiceWorker: () => y(t.service_worker_keep_alive_path),
2582
+ setSessionStateAsync: x,
2583
+ getSessionStateAsync: S,
2584
+ setNonceAsync: C,
2585
+ getNonceAsync: w,
2586
+ setLoginParams: E,
2587
+ getLoginParams: D,
2588
+ getStateAsync: j,
2589
+ setStateAsync: te,
2590
+ getCodeVerifierAsync: M,
2591
+ setCodeVerifierAsync: N,
2592
+ setDemonstratingProofOfPossessionNonce: ee,
2593
+ getDemonstratingProofOfPossessionNonce: O,
2594
+ setDemonstratingProofOfPossessionJwkAsync: k,
2595
+ getDemonstratingProofOfPossessionJwkAsync: A,
2589
2596
  signalAsync: (e, t) => Z(u, t)({
2590
2597
  ...e,
2591
2598
  configurationName: e.configurationName ?? n
2592
2599
  })
2593
2600
  };
2594
- }, en = async (e, t, n, r) => {
2601
+ }, on = async (e, t, n, r) => {
2595
2602
  let i = await $(e, t);
2596
2603
  if (!i) throw Error(`signalServiceWorkerAsync: no service worker registered for configuration "${t}"`);
2597
2604
  return i.signalAsync(n, r);
2598
- }, tn = class e {
2605
+ }, sn = class e {
2599
2606
  constructor(e) {
2600
2607
  this._oidc = e;
2601
2608
  }
@@ -2609,17 +2616,17 @@ var Mt = (e, t = null, n) => {
2609
2616
  this._oidc.publishEvent(e, t);
2610
2617
  }
2611
2618
  static {
2612
- this.getOrCreate = (t, n = new M()) => (r, i = "default") => new e(K.getOrCreate(t, n)(r, i));
2619
+ this.getOrCreate = (t, n = new he()) => (r, i = "default") => new e(J.getOrCreate(t, n)(r, i));
2613
2620
  }
2614
2621
  static get(t = "default") {
2615
- let n = K.get(t);
2622
+ let n = J.get(t);
2616
2623
  return n ? new e(n) : null;
2617
2624
  }
2618
2625
  static getOrThrow(t = "default") {
2619
- return new e(K.getOrThrow(t));
2626
+ return new e(J.getOrThrow(t));
2620
2627
  }
2621
2628
  static {
2622
- this.eventNames = K.eventNames;
2629
+ this.eventNames = J.eventNames;
2623
2630
  }
2624
2631
  tryKeepExistingSessionAsync() {
2625
2632
  return this._oidc.tryKeepExistingSessionAsync();
@@ -2659,7 +2666,7 @@ var Mt = (e, t = null, n) => {
2659
2666
  }
2660
2667
  async getValidTokenAsync(e = 200, t = 50) {
2661
2668
  let n = this._oidc;
2662
- return Ft({
2669
+ return It({
2663
2670
  getTokens: () => n.tokens,
2664
2671
  configuration: {
2665
2672
  token_automatic_renew_mode: n.configuration.token_automatic_renew_mode,
@@ -2685,7 +2692,7 @@ var Mt = (e, t = null, n) => {
2685
2692
  return this.fetchWithTokens(t, n.demonstratingProofOfPossession ?? !1, { resource: e });
2686
2693
  }
2687
2694
  fetchWithTokens(e, t = !1, n = {}) {
2688
- return gt(e, this._oidc, n.demonstratingProofOfPossession ?? t, n);
2695
+ return ht(e, this._oidc, n.demonstratingProofOfPossession ?? t, n);
2689
2696
  }
2690
2697
  async userInfoAsync(e = !1, t = !1) {
2691
2698
  return this._oidc.userInfoAsync(e, t);
@@ -2694,8 +2701,8 @@ var Mt = (e, t = null, n) => {
2694
2701
  return this._oidc.userInfo;
2695
2702
  }
2696
2703
  async signalServiceWorker(e, t) {
2697
- return en(this._oidc.configuration, this._oidc.configurationName, e, t);
2704
+ return on(this._oidc.configuration, this._oidc.configurationName, e, t);
2698
2705
  }
2699
2706
  };
2700
2707
  //#endregion
2701
- export { Ue as DPOP_TOKEN_PLACEHOLDER_PREFIX, tn as OidcClient, r as OidcError, e as OidcErrorCode, M as OidcLocation, P as OidcStateError, N as OidcStateErrorCode, Be as PROTOCOL_VERSION, I as PushedAuthorizationRequestError, F as PushedAuthorizationRequestErrorCode, We as STORAGE_KEY_PREFIX, Ge as SW_CONTROLLER_CHANGE_RELOAD_COUNT_KEY, Ve as ServiceWorkerMessageType, He as TOKEN_PLACEHOLDERS, W as TokenAutomaticRenewMode, Y as TokenRenewMode, Je as buildDpopSecuredPlaceholder, qe as buildSecuredTokenPlaceholder, Ke as buildStorageKey, vt as getFetchDefault, V as getParseQueryStringFromLocation, Ze as getPath, i as isOidcError, ve as isOidcStateError, ye as isPushedAuthorizationRequestError, Ye as isServiceWorkerMessageType, en as signalServiceWorkerAsync };
2708
+ export { Ue as DPOP_TOKEN_PLACEHOLDER_PREFIX, sn as OidcClient, r as OidcError, e as OidcErrorCode, he as OidcLocation, F as OidcStateError, P as OidcStateErrorCode, Be as PROTOCOL_VERSION, L as PushedAuthorizationRequestError, I as PushedAuthorizationRequestErrorCode, We as STORAGE_KEY_PREFIX, Ge as SW_CONTROLLER_CHANGE_RELOAD_COUNT_KEY, Ve as ServiceWorkerMessageType, He as TOKEN_PLACEHOLDERS, K as TokenAutomaticRenewMode, jt as TokenRenewMode, Je as buildDpopSecuredPlaceholder, qe as buildSecuredTokenPlaceholder, Ke as buildStorageKey, _t as getFetchDefault, H as getParseQueryStringFromLocation, Ze as getPath, i as isOidcError, ve as isOidcStateError, ye as isPushedAuthorizationRequestError, Ye as isServiceWorkerMessageType, on as signalServiceWorkerAsync };