@axa-fr/oidc-client 7.26.7 → 7.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- class j {
1
+ class Q {
2
2
  open(n) {
3
3
  window.location.href = n;
4
4
  }
@@ -16,10 +16,10 @@ class j {
16
16
  return window.origin;
17
17
  }
18
18
  }
19
- const de = 2e3, $ = console;
20
- class De {
21
- constructor(n, t, s, o = de, i = !0) {
22
- this._callback = n, this._client_id = t, this._url = s, this._interval = o || de, this._stopOnError = i;
19
+ const ye = 2e3, K = console;
20
+ class $e {
21
+ constructor(n, t, s, o = ye, i = !0) {
22
+ this._callback = n, this._client_id = t, this._url = s, this._interval = o || ye, this._stopOnError = i;
23
23
  const r = s.indexOf("/", s.indexOf("//") + 2);
24
24
  this._frame_origin = s.substring(0, r), this._frame = window.document.createElement("iframe"), this._frame.style.visibility = "hidden", this._frame.style.position = "absolute", this._frame.style.display = "none", this._frame.width = 0, this._frame.height = 0, this._frame.src = s;
25
25
  }
@@ -31,10 +31,10 @@ class De {
31
31
  });
32
32
  }
33
33
  _message(n) {
34
- n.origin === this._frame_origin && n.source === this._frame.contentWindow && (n.data === "error" ? ($.error("CheckSessionIFrame: error message from check session op iframe"), this._stopOnError && this.stop()) : n.data === "changed" ? ($.debug(n), $.debug("CheckSessionIFrame: changed message from check session op iframe"), this.stop(), this._callback()) : $.debug("CheckSessionIFrame: " + n.data + " message from check session op iframe"));
34
+ n.origin === this._frame_origin && n.source === this._frame.contentWindow && (n.data === "error" ? (K.error("CheckSessionIFrame: error message from check session op iframe"), this._stopOnError && this.stop()) : n.data === "changed" ? (K.debug(n), K.debug("CheckSessionIFrame: changed message from check session op iframe"), this.stop(), this._callback()) : K.debug("CheckSessionIFrame: " + n.data + " message from check session op iframe"));
35
35
  }
36
36
  start(n) {
37
- $.debug("CheckSessionIFrame.start :" + n), this.stop();
37
+ K.debug("CheckSessionIFrame.start :" + n), this.stop();
38
38
  const t = () => {
39
39
  this._frame.contentWindow.postMessage(
40
40
  this._client_id + " " + n,
@@ -44,10 +44,10 @@ class De {
44
44
  t(), this._timer = window.setInterval(t, this._interval);
45
45
  }
46
46
  stop() {
47
- this._timer && ($.debug("CheckSessionIFrame.stop"), window.clearInterval(this._timer), this._timer = null);
47
+ this._timer && (K.debug("CheckSessionIFrame.stop"), window.clearInterval(this._timer), this._timer = null);
48
48
  }
49
49
  }
50
- const p = {
50
+ const k = {
51
51
  service_worker_not_supported_by_browser: "service_worker_not_supported_by_browser",
52
52
  token_acquired: "token_acquired",
53
53
  logout_from_another_tab: "logout_from_another_tab",
@@ -76,89 +76,89 @@ const p = {
76
76
  syncTokensAsync_end: "syncTokensAsync_end",
77
77
  syncTokensAsync_error: "syncTokensAsync_error",
78
78
  tokensInvalidAndWaitingActionsToRefresh: "tokensInvalidAndWaitingActionsToRefresh"
79
- }, N = (e, n = sessionStorage) => {
80
- const t = (h) => (n[`oidc.${e}`] = JSON.stringify({ tokens: null, status: h }), delete n[`oidc.${e}.userInfo`], Promise.resolve()), s = async () => {
79
+ }, C = (e, n = sessionStorage, t) => {
80
+ const s = t ?? n, o = (w) => (n[`oidc.${e}`] = JSON.stringify({ tokens: null, status: w }), delete n[`oidc.${e}.userInfo`], t && t !== n && (delete s[`oidc.login.${e}`], delete s[`oidc.state.${e}`], delete s[`oidc.code_verifier.${e}`], delete s[`oidc.nonce.${e}`]), Promise.resolve()), i = async () => {
81
81
  if (!n[`oidc.${e}`])
82
82
  return n[`oidc.${e}`] = JSON.stringify({ tokens: null, status: null }), { tokens: null, status: null };
83
- const h = JSON.parse(n[`oidc.${e}`]);
84
- return Promise.resolve({ tokens: h.tokens, status: h.status });
85
- }, o = (h) => {
86
- n[`oidc.${e}`] = JSON.stringify({ tokens: h });
87
- }, i = async (h) => {
88
- n[`oidc.session_state.${e}`] = h;
89
- }, r = async () => n[`oidc.session_state.${e}`], a = (h) => {
90
- n[`oidc.nonce.${e}`] = h.nonce;
91
- }, c = (h) => {
92
- n[`oidc.jwk.${e}`] = JSON.stringify(h);
93
- }, f = () => JSON.parse(n[`oidc.jwk.${e}`]), u = async () => ({ nonce: n[`oidc.nonce.${e}`] }), l = async (h) => {
94
- n[`oidc.dpop_nonce.${e}`] = h;
95
- }, d = () => n[`oidc.dpop_nonce.${e}`], _ = () => n[`oidc.${e}`] ? JSON.stringify({ tokens: JSON.parse(n[`oidc.${e}`]).tokens }) : null, w = {};
83
+ const w = JSON.parse(n[`oidc.${e}`]);
84
+ return Promise.resolve({ tokens: w.tokens, status: w.status });
85
+ }, r = (w) => {
86
+ n[`oidc.${e}`] = JSON.stringify({ tokens: w });
87
+ }, a = async (w) => {
88
+ n[`oidc.session_state.${e}`] = w;
89
+ }, c = async () => n[`oidc.session_state.${e}`], f = (w) => {
90
+ s[`oidc.nonce.${e}`] = w.nonce;
91
+ }, u = (w) => {
92
+ n[`oidc.jwk.${e}`] = JSON.stringify(w);
93
+ }, l = () => JSON.parse(n[`oidc.jwk.${e}`]), h = async () => ({ nonce: s[`oidc.nonce.${e}`] }), _ = async (w) => {
94
+ n[`oidc.dpop_nonce.${e}`] = w;
95
+ }, m = () => n[`oidc.dpop_nonce.${e}`], p = () => n[`oidc.${e}`] ? JSON.stringify({ tokens: JSON.parse(n[`oidc.${e}`]).tokens }) : null, g = {};
96
96
  return {
97
- clearAsync: t,
98
- initAsync: s,
99
- setTokens: o,
100
- getTokens: _,
101
- setSessionStateAsync: i,
102
- getSessionStateAsync: r,
103
- setNonceAsync: a,
104
- getNonceAsync: u,
105
- setLoginParams: (h) => {
106
- w[e] = h, n[`oidc.login.${e}`] = JSON.stringify(h);
97
+ clearAsync: o,
98
+ initAsync: i,
99
+ setTokens: r,
100
+ getTokens: p,
101
+ setSessionStateAsync: a,
102
+ getSessionStateAsync: c,
103
+ setNonceAsync: f,
104
+ getNonceAsync: h,
105
+ setLoginParams: (w) => {
106
+ g[e] = w, s[`oidc.login.${e}`] = JSON.stringify(w);
107
107
  },
108
108
  getLoginParams: () => {
109
- const h = n[`oidc.login.${e}`];
110
- return h ? (w[e] || (w[e] = JSON.parse(h)), w[e]) : (console.warn(
109
+ const w = s[`oidc.login.${e}`];
110
+ return w ? (g[e] || (g[e] = JSON.parse(w)), g[e]) : (console.warn(
111
111
  `storage[oidc.login.${e}] is empty, you should have an bad OIDC or code configuration somewhere.`
112
112
  ), null);
113
113
  },
114
- getStateAsync: async () => n[`oidc.state.${e}`],
115
- setStateAsync: async (h) => {
116
- n[`oidc.state.${e}`] = h;
114
+ getStateAsync: async () => s[`oidc.state.${e}`],
115
+ setStateAsync: async (w) => {
116
+ s[`oidc.state.${e}`] = w;
117
117
  },
118
- getCodeVerifierAsync: async () => n[`oidc.code_verifier.${e}`],
119
- setCodeVerifierAsync: async (h) => {
120
- n[`oidc.code_verifier.${e}`] = h;
118
+ getCodeVerifierAsync: async () => s[`oidc.code_verifier.${e}`],
119
+ setCodeVerifierAsync: async (w) => {
120
+ s[`oidc.code_verifier.${e}`] = w;
121
121
  },
122
- setDemonstratingProofOfPossessionNonce: l,
123
- getDemonstratingProofOfPossessionNonce: d,
124
- setDemonstratingProofOfPossessionJwkAsync: c,
125
- getDemonstratingProofOfPossessionJwkAsync: f
122
+ setDemonstratingProofOfPossessionNonce: _,
123
+ getDemonstratingProofOfPossessionNonce: m,
124
+ setDemonstratingProofOfPossessionJwkAsync: u,
125
+ getDemonstratingProofOfPossessionJwkAsync: l
126
126
  };
127
127
  };
128
- var B = /* @__PURE__ */ ((e) => (e.AutomaticBeforeTokenExpiration = "AutomaticBeforeTokensExpiration", e.AutomaticOnlyWhenFetchExecuted = "AutomaticOnlyWhenFetchExecuted", e))(B || {});
128
+ var H = /* @__PURE__ */ ((e) => (e.AutomaticBeforeTokenExpiration = "AutomaticBeforeTokensExpiration", e.AutomaticOnlyWhenFetchExecuted = "AutomaticOnlyWhenFetchExecuted", e))(H || {});
129
129
  const Re = (e) => decodeURIComponent(
130
130
  Array.prototype.map.call(atob(e), (n) => "%" + ("00" + n.charCodeAt(0).toString(16)).slice(-2)).join("")
131
- ), $e = (e) => JSON.parse(Re(e.replaceAll(/-/g, "+").replaceAll(/_/g, "/"))), he = (e) => {
131
+ ), Ke = (e) => JSON.parse(Re(e.replaceAll(/-/g, "+").replaceAll(/_/g, "/"))), ke = (e) => {
132
132
  try {
133
- return e && Ke(e, ".") === 2 ? $e(e.split(".")[1]) : null;
133
+ return e && Ue(e, ".") === 2 ? Ke(e.split(".")[1]) : null;
134
134
  } catch (n) {
135
135
  console.warn(n);
136
136
  }
137
137
  return null;
138
- }, Ke = (e, n) => e.split(n).length - 1, Z = {
138
+ }, Ue = (e, n) => e.split(n).length - 1, oe = {
139
139
  access_token_or_id_token_invalid: "access_token_or_id_token_invalid",
140
140
  access_token_invalid: "access_token_invalid",
141
141
  id_token_invalid: "id_token_invalid"
142
142
  };
143
- function Ue(e, n, t) {
143
+ function Ve(e, n, t) {
144
144
  if (e.issuedAt) {
145
145
  if (typeof e.issuedAt == "string")
146
146
  return parseInt(e.issuedAt, 10);
147
147
  } else return n && n.iat ? n.iat : t && t.iat ? t.iat : (/* @__PURE__ */ new Date()).getTime() / 1e3;
148
148
  return e.issuedAt;
149
149
  }
150
- const ie = (e, n = null, t) => {
150
+ const ue = (e, n = null, t) => {
151
151
  if (!e)
152
152
  return null;
153
153
  let s;
154
154
  const o = typeof e.expiresIn == "string" ? parseInt(e.expiresIn, 10) : e.expiresIn;
155
- e.accessTokenPayload !== void 0 ? s = e.accessTokenPayload : s = he(e.accessToken);
155
+ e.accessTokenPayload !== void 0 ? s = e.accessTokenPayload : s = ke(e.accessToken);
156
156
  let i;
157
157
  n != null && "idToken" in n && !("idToken" in e) ? i = n.idToken : i = e.idToken;
158
- const r = e.idTokenPayload ? e.idTokenPayload : he(i), a = r && r.exp ? r.exp : Number.MAX_VALUE, c = s && s.exp ? s.exp : e.issuedAt + o;
159
- e.issuedAt = Ue(e, s, r);
158
+ const r = e.idTokenPayload ? e.idTokenPayload : ke(i), a = r && r.exp ? r.exp : Number.MAX_VALUE, c = s && s.exp ? s.exp : e.issuedAt + o;
159
+ e.issuedAt = Ve(e, s, r);
160
160
  let f;
161
- e.expiresAt ? f = e.expiresAt : t === Z.access_token_invalid ? f = c : t === Z.id_token_invalid ? f = a : f = a < c ? a : c;
161
+ e.expiresAt ? f = e.expiresAt : t === oe.access_token_invalid ? f = c : t === oe.id_token_invalid ? f = a : f = a < c ? a : c;
162
162
  const u = {
163
163
  ...e,
164
164
  idTokenPayload: r,
@@ -171,7 +171,7 @@ const ie = (e, n = null, t) => {
171
171
  return { ...u, refreshToken: l };
172
172
  }
173
173
  return u;
174
- }, re = (e, n, t) => {
174
+ }, _e = (e, n, t) => {
175
175
  if (!e)
176
176
  return null;
177
177
  if (!e.issued_at) {
@@ -186,30 +186,30 @@ const ie = (e, n = null, t) => {
186
186
  tokenType: e.token_type,
187
187
  issuedAt: e.issued_at
188
188
  };
189
- return "refresh_token" in e && (s.refreshToken = e.refresh_token), e.accessTokenPayload !== void 0 && (s.accessTokenPayload = e.accessTokenPayload), e.idTokenPayload !== void 0 && (s.idTokenPayload = e.idTokenPayload), ie(s, n, t);
190
- }, F = (e, n) => {
189
+ return "refresh_token" in e && (s.refreshToken = e.refresh_token), e.accessTokenPayload !== void 0 && (s.accessTokenPayload = e.accessTokenPayload), e.idTokenPayload !== void 0 && (s.idTokenPayload = e.idTokenPayload), ue(s, n, t);
190
+ }, B = (e, n) => {
191
191
  const t = (/* @__PURE__ */ new Date()).getTime() / 1e3, s = n - t;
192
192
  return Math.round(s - e);
193
- }, Ve = (e, n = 0) => e ? F(n, e.expiresAt) > 0 : !1, Ae = async (e, n = 200, t = 50) => {
193
+ }, Fe = (e, n = 0) => e ? B(n, e.expiresAt) > 0 : !1, ve = async (e, n = 200, t = 50) => {
194
194
  let s = t, o = await e.syncTokensInfoAsync();
195
195
  for (; [
196
- E.REQUIRE_SYNC_TOKENS,
197
- E.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID,
198
- E.TOKENS_INVALID
196
+ b.REQUIRE_SYNC_TOKENS,
197
+ b.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID,
198
+ b.TOKENS_INVALID
199
199
  ].includes(o) && s > 0; ) {
200
- if (e.configuration.token_automatic_renew_mode == B.AutomaticOnlyWhenFetchExecuted) {
200
+ if (e.configuration.token_automatic_renew_mode == H.AutomaticOnlyWhenFetchExecuted) {
201
201
  await e.renewTokensAsync({});
202
202
  break;
203
203
  } else
204
- await ae({ milliseconds: n });
204
+ await ne({ milliseconds: n });
205
205
  s = s - 1, o = await e.syncTokensInfoAsync();
206
206
  }
207
207
  return {
208
- isTokensValid: Ve(e.getTokens()),
208
+ isTokensValid: Fe(e.getTokens()),
209
209
  tokens: e.getTokens(),
210
210
  numberWaited: s - t
211
211
  };
212
- }, Se = (e, n, t) => {
212
+ }, Ee = (e, n, t) => {
213
213
  if (e.idTokenPayload) {
214
214
  const s = e.idTokenPayload;
215
215
  if (t.issuer !== s.iss)
@@ -236,7 +236,7 @@ const ie = (e, n = null, t) => {
236
236
  };
237
237
  }
238
238
  return { isValid: !0, reason: "" };
239
- }, D = (function() {
239
+ }, $ = (function() {
240
240
  const e = typeof window > "u" ? global : window;
241
241
  return {
242
242
  setTimeout: setTimeout.bind(e),
@@ -244,32 +244,32 @@ const ie = (e, n = null, t) => {
244
244
  setInterval: setInterval.bind(e),
245
245
  clearInterval: clearInterval.bind(e)
246
246
  };
247
- })(), X = "7.26.7";
248
- let ge = null, q;
249
- const ae = ({ milliseconds: e }) => new Promise((n) => D.setTimeout(n, e)), Te = (e = "/") => {
247
+ })(), te = "7.27.0";
248
+ let me = null, Z;
249
+ const ne = ({ milliseconds: e }) => new Promise((n) => $.setTimeout(n, e)), Oe = (e = "/") => {
250
250
  try {
251
- q = new AbortController(), fetch(
251
+ Z = new AbortController(), fetch(
252
252
  `${e}OidcKeepAliveServiceWorker.json?minSleepSeconds=150`,
253
- { signal: q.signal }
253
+ { signal: Z.signal }
254
254
  ).catch((s) => {
255
255
  console.log(s);
256
- }), ae({ milliseconds: 150 * 1e3 }).then(
257
- () => Te(e)
256
+ }), ne({ milliseconds: 150 * 1e3 }).then(
257
+ () => Oe(e)
258
258
  );
259
259
  } catch (n) {
260
260
  console.log(n);
261
261
  }
262
- }, z = () => {
263
- q && q.abort();
264
- }, ve = (e) => {
262
+ }, X = () => {
263
+ Z && Z.abort();
264
+ }, be = (e) => {
265
265
  const n = `oidc.tabId.${e}`, t = sessionStorage.getItem(n);
266
266
  if (t) return t;
267
267
  const s = globalThis.crypto.randomUUID();
268
268
  return sessionStorage.setItem(n, s), s;
269
- }, Fe = 5e3, Me = (e) => navigator.serviceWorker.controller ?? e.active ?? e.waiting ?? e.installing ?? null, O = (e, n) => (t) => {
270
- const s = n?.timeoutMs ?? Fe;
269
+ }, Me = 5e3, Be = (e) => navigator.serviceWorker.controller ?? e.active ?? e.waiting ?? e.installing ?? null, I = (e, n) => (t) => {
270
+ const s = n?.timeoutMs ?? Me;
271
271
  return new Promise((o, i) => {
272
- const r = Me(e);
272
+ const r = Be(e);
273
273
  if (!r) {
274
274
  i(
275
275
  new Error(
@@ -282,12 +282,12 @@ const ae = ({ milliseconds: e }) => new Promise((n) => D.setTimeout(n, e)), Te =
282
282
  let c = null;
283
283
  const f = () => {
284
284
  try {
285
- c != null && (D.clearTimeout(c), c = null), a.port1.onmessage = null, a.port1.close(), a.port2.close();
285
+ c != null && ($.clearTimeout(c), c = null), a.port1.onmessage = null, a.port1.close(), a.port2.close();
286
286
  } catch (u) {
287
287
  console.error(u);
288
288
  }
289
289
  };
290
- c = D.setTimeout(() => {
290
+ c = $.setTimeout(() => {
291
291
  f(), i(
292
292
  new Error(`Service worker did not respond within ${s}ms (type=${t?.type})`)
293
293
  );
@@ -296,213 +296,238 @@ const ae = ({ milliseconds: e }) => new Promise((n) => D.setTimeout(n, e)), Te =
296
296
  };
297
297
  try {
298
298
  const u = t?.configurationName;
299
- r.postMessage({ ...t, tabId: ve(u ?? "default") }, [
299
+ r.postMessage({ ...t, tabId: be(u ?? "default") }, [
300
300
  a.port2
301
301
  ]);
302
302
  } catch (u) {
303
303
  f(), i(u);
304
304
  }
305
305
  });
306
- }, Be = async (e) => navigator.serviceWorker.controller ? navigator.serviceWorker.controller : new Promise((n) => {
306
+ }, Je = async (e) => navigator.serviceWorker.controller ? navigator.serviceWorker.controller : new Promise((n) => {
307
307
  let t = !1;
308
308
  const s = () => {
309
309
  t || (t = !0, navigator.serviceWorker.removeEventListener("controllerchange", s), n(navigator.serviceWorker.controller ?? null));
310
310
  };
311
- navigator.serviceWorker.addEventListener("controllerchange", s), D.setTimeout(() => {
311
+ navigator.serviceWorker.addEventListener("controllerchange", s), $.setTimeout(() => {
312
312
  t || (t = !0, navigator.serviceWorker.removeEventListener("controllerchange", s), n(navigator.serviceWorker.controller ?? null));
313
313
  }, e);
314
- }), C = async (e, n) => {
314
+ }), x = async (e, n) => {
315
315
  const t = e.service_worker_relative_url;
316
316
  if (typeof window > "u" || typeof navigator > "u" || !navigator.serviceWorker || !t || e.service_worker_activate() === !1)
317
317
  return null;
318
- const s = `${t}?v=${X}`;
318
+ const s = `${t}?v=${te}`;
319
319
  let o = null;
320
320
  e.service_worker_register ? o = await e.service_worker_register(t) : o = await navigator.serviceWorker.register(s, {
321
321
  updateViaCache: "none"
322
322
  });
323
+ const i = `oidc.sw.version_mismatch_reload.${n}`, r = async () => {
324
+ X(), console.log("New SW waiting – SKIP_WAITING");
325
+ try {
326
+ await I(o, { timeoutMs: 8e3 })({
327
+ type: "SKIP_WAITING",
328
+ configurationName: n,
329
+ data: null
330
+ });
331
+ } catch (d) {
332
+ console.warn("SKIP_WAITING failed", d);
333
+ }
334
+ }, a = (d) => {
335
+ X(), d.addEventListener("statechange", async () => {
336
+ d.state === "installed" && navigator.serviceWorker.controller && await r();
337
+ });
338
+ };
339
+ o.addEventListener("updatefound", () => {
340
+ const d = o.installing;
341
+ d && a(d);
342
+ }), o.installing ? a(o.installing) : o.waiting && navigator.serviceWorker.controller && r();
323
343
  try {
324
344
  await o.update();
325
- } catch (k) {
326
- console.error(k);
345
+ } catch (d) {
346
+ console.error(d);
327
347
  }
328
- o.addEventListener("updatefound", () => {
329
- const k = o.installing;
330
- z(), k?.addEventListener("statechange", async () => {
331
- if (k.state === "installed" && navigator.serviceWorker.controller) {
332
- z(), console.log("New SW waiting – SKIP_WAITING");
333
- try {
334
- await O(o, { timeoutMs: 8e3 })({
335
- type: "SKIP_WAITING",
336
- configurationName: n,
337
- data: null
338
- });
339
- } catch (b) {
340
- console.warn("SKIP_WAITING failed", b);
341
- }
342
- }
343
- });
344
- });
345
- const i = `oidc.sw.controllerchange.reloaded.${n}`;
348
+ const c = `oidc.sw.controllerchange.reloaded.${n}`;
346
349
  navigator.serviceWorker.addEventListener("controllerchange", () => {
347
350
  try {
348
- if (sessionStorage.getItem(i) === "1") return;
349
- sessionStorage.setItem(i, "1");
351
+ if (sessionStorage.getItem(c) === "1") return;
352
+ sessionStorage.setItem(c, "1");
350
353
  } catch {
351
354
  }
352
- console.log("SW controller changed – reloading page"), z(), window.location.reload();
355
+ console.log("SW controller changed – reloading page"), X(), window.location.reload();
353
356
  });
354
357
  try {
355
- await navigator.serviceWorker.ready, navigator.serviceWorker.controller || (await O(o, { timeoutMs: 8e3 })({
358
+ await navigator.serviceWorker.ready, navigator.serviceWorker.controller || (await I(o, { timeoutMs: 8e3 })({
356
359
  type: "claim",
357
360
  configurationName: n,
358
361
  data: null
359
- }), await Be(2e3));
360
- } catch (k) {
361
- return console.warn(`Failed init ServiceWorker ${k?.toString?.() ?? String(k)}`), null;
362
+ }), await Je(2e3));
363
+ } catch (d) {
364
+ return console.warn(`Failed init ServiceWorker ${d?.toString?.() ?? String(d)}`), null;
362
365
  }
363
- const r = async (k) => O(o)({ type: "clear", data: { status: k }, configurationName: n }), a = async (k, b, m) => {
364
- const W = await O(o)({
366
+ const f = async (d) => I(o)({ type: "clear", data: { status: d }, configurationName: n }), u = async (d, D, E) => {
367
+ const P = await I(o)({
365
368
  type: "init",
366
369
  data: {
367
- oidcServerConfiguration: k,
368
- where: b,
370
+ oidcServerConfiguration: d,
371
+ where: D,
369
372
  oidcConfiguration: {
370
- token_renew_mode: m.token_renew_mode,
371
- service_worker_convert_all_requests_to_cors: m.service_worker_convert_all_requests_to_cors
373
+ token_renew_mode: E.token_renew_mode,
374
+ service_worker_convert_all_requests_to_cors: E.service_worker_convert_all_requests_to_cors
372
375
  }
373
376
  },
374
377
  configurationName: n
375
- }), V = W.version;
376
- return V !== X && console.warn(
377
- `Service worker ${V} version mismatch with js client version ${X}, unregistering and reloading`
378
- ), {
379
- tokens: re(W.tokens, null, m.token_renew_mode),
380
- status: W.status
378
+ }), q = P.version;
379
+ if (q !== te) {
380
+ console.warn(
381
+ `Service worker ${q} version mismatch with js client version ${te}, unregistering and reloading`
382
+ );
383
+ const M = parseInt(sessionStorage.getItem(i) ?? "0", 10);
384
+ if (M < 3)
385
+ if (sessionStorage.setItem(i, String(M + 1)), o.waiting)
386
+ await r();
387
+ else {
388
+ X();
389
+ try {
390
+ await o.update();
391
+ } catch (he) {
392
+ console.error(he);
393
+ }
394
+ const Y = await o.unregister();
395
+ console.log(`Service worker unregistering ${Y}`), await ne({ milliseconds: 2e3 }), window.location.reload();
396
+ }
397
+ else
398
+ console.error(
399
+ `Service worker version mismatch persists after ${M} attempt(s). Continuing with mismatched version.`
400
+ ), sessionStorage.removeItem(i);
401
+ } else
402
+ sessionStorage.removeItem(i);
403
+ return {
404
+ tokens: _e(P.tokens, null, E.token_renew_mode),
405
+ status: P.status
381
406
  };
382
- }, c = (k = "/") => {
383
- ge == null && (ge = "not_null", Te(k));
384
- }, f = (k) => O(o)({
407
+ }, l = (d = "/") => {
408
+ me == null && (me = "not_null", Oe(d));
409
+ }, h = (d) => I(o)({
385
410
  type: "setSessionState",
386
- data: { sessionState: k },
411
+ data: { sessionState: d },
387
412
  configurationName: n
388
- }), u = async () => (await O(o)({
413
+ }), _ = async () => (await I(o)({
389
414
  type: "getSessionState",
390
415
  data: null,
391
416
  configurationName: n
392
- })).sessionState, l = (k) => (sessionStorage[`oidc.nonce.${n}`] = k.nonce, O(o)({
417
+ })).sessionState, m = (d) => (sessionStorage[`oidc.nonce.${n}`] = d.nonce, I(o)({
393
418
  type: "setNonce",
394
- data: { nonce: k },
419
+ data: { nonce: d },
395
420
  configurationName: n
396
- })), d = async (k = !0) => {
397
- let m = (await O(o)({
421
+ })), p = async (d = !0) => {
422
+ let E = (await I(o)({
398
423
  type: "getNonce",
399
424
  data: null,
400
425
  configurationName: n
401
426
  })).nonce;
402
- return m || (m = sessionStorage[`oidc.nonce.${n}`], console.warn("nonce not found in service worker, using sessionStorage"), k && (await l(m), m = (await d(!1)).nonce)), { nonce: m };
403
- }, _ = {}, w = (k) => {
404
- _[n] = k, localStorage[`oidc.login.${n}`] = JSON.stringify(k);
427
+ return E || (E = sessionStorage[`oidc.nonce.${n}`], console.warn("nonce not found in service worker, using sessionStorage"), d && (await m(E), E = (await p(!1)).nonce)), { nonce: E };
428
+ }, g = {}, y = (d) => {
429
+ g[n] = d, localStorage[`oidc.login.${n}`] = JSON.stringify(d);
405
430
  }, A = () => {
406
- const k = localStorage[`oidc.login.${n}`];
407
- return _[n] || (_[n] = JSON.parse(k)), _[n];
408
- }, g = async (k) => {
409
- await O(o)({
431
+ const d = localStorage[`oidc.login.${n}`];
432
+ return g[n] || (g[n] = JSON.parse(d)), g[n];
433
+ }, S = async (d) => {
434
+ await I(o)({
410
435
  type: "setDemonstratingProofOfPossessionNonce",
411
- data: { demonstratingProofOfPossessionNonce: k },
436
+ data: { demonstratingProofOfPossessionNonce: d },
412
437
  configurationName: n
413
438
  });
414
- }, y = async () => (await O(o)({
439
+ }, O = async () => (await I(o)({
415
440
  type: "getDemonstratingProofOfPossessionNonce",
416
441
  data: null,
417
442
  configurationName: n
418
- })).demonstratingProofOfPossessionNonce, S = async (k) => {
419
- const b = JSON.stringify(k);
420
- await O(o)({
443
+ })).demonstratingProofOfPossessionNonce, T = async (d) => {
444
+ const D = JSON.stringify(d);
445
+ await I(o)({
421
446
  type: "setDemonstratingProofOfPossessionJwk",
422
- data: { demonstratingProofOfPossessionJwkJson: b },
447
+ data: { demonstratingProofOfPossessionJwkJson: D },
423
448
  configurationName: n
424
449
  });
425
- }, T = async () => {
426
- const k = await O(o)({
450
+ }, N = async () => {
451
+ const d = await I(o)({
427
452
  type: "getDemonstratingProofOfPossessionJwk",
428
453
  data: null,
429
454
  configurationName: n
430
455
  });
431
- return k.demonstratingProofOfPossessionJwkJson ? JSON.parse(k.demonstratingProofOfPossessionJwkJson) : null;
432
- }, v = async (k = !0) => {
433
- let m = (await O(o)({
456
+ return d.demonstratingProofOfPossessionJwkJson ? JSON.parse(d.demonstratingProofOfPossessionJwkJson) : null;
457
+ }, w = async (d = !0) => {
458
+ let E = (await I(o)({
434
459
  type: "getState",
435
460
  data: null,
436
461
  configurationName: n
437
462
  })).state;
438
- return m || (m = sessionStorage[`oidc.state.${n}`], console.warn("state not found in service worker, using sessionStorage"), k && (await h(m), m = await v(!1))), m;
439
- }, h = async (k) => (sessionStorage[`oidc.state.${n}`] = k, O(o)({
463
+ return E || (E = sessionStorage[`oidc.state.${n}`], console.warn("state not found in service worker, using sessionStorage"), d && (await F(E), E = await w(!1))), E;
464
+ }, F = async (d) => (sessionStorage[`oidc.state.${n}`] = d, I(o)({
440
465
  type: "setState",
441
- data: { state: k },
466
+ data: { state: d },
442
467
  configurationName: n
443
- })), P = async (k = !0) => {
444
- let m = (await O(o)({
468
+ })), L = async (d = !0) => {
469
+ let E = (await I(o)({
445
470
  type: "getCodeVerifier",
446
471
  data: null,
447
472
  configurationName: n
448
473
  })).codeVerifier;
449
- return m || (m = sessionStorage[`oidc.code_verifier.${n}`], console.warn("codeVerifier not found in service worker, using sessionStorage"), k && (await x(m), m = await P(!1))), m;
450
- }, x = async (k) => (sessionStorage[`oidc.code_verifier.${n}`] = k, O(o)({
474
+ return E || (E = sessionStorage[`oidc.code_verifier.${n}`], console.warn("codeVerifier not found in service worker, using sessionStorage"), d && (await v(E), E = await L(!1))), E;
475
+ }, v = async (d) => (sessionStorage[`oidc.code_verifier.${n}`] = d, I(o)({
451
476
  type: "setCodeVerifier",
452
- data: { codeVerifier: k },
477
+ data: { codeVerifier: d },
453
478
  configurationName: n
454
479
  }));
455
480
  return {
456
- clearAsync: r,
457
- initAsync: a,
458
- startKeepAliveServiceWorker: () => c(e.service_worker_keep_alive_path),
459
- setSessionStateAsync: f,
460
- getSessionStateAsync: u,
461
- setNonceAsync: l,
462
- getNonceAsync: d,
463
- setLoginParams: w,
481
+ clearAsync: f,
482
+ initAsync: u,
483
+ startKeepAliveServiceWorker: () => l(e.service_worker_keep_alive_path),
484
+ setSessionStateAsync: h,
485
+ getSessionStateAsync: _,
486
+ setNonceAsync: m,
487
+ getNonceAsync: p,
488
+ setLoginParams: y,
464
489
  getLoginParams: A,
465
- getStateAsync: v,
466
- setStateAsync: h,
467
- getCodeVerifierAsync: P,
468
- setCodeVerifierAsync: x,
469
- setDemonstratingProofOfPossessionNonce: g,
470
- getDemonstratingProofOfPossessionNonce: y,
471
- setDemonstratingProofOfPossessionJwkAsync: S,
472
- getDemonstratingProofOfPossessionJwkAsync: T
490
+ getStateAsync: w,
491
+ setStateAsync: F,
492
+ getCodeVerifierAsync: L,
493
+ setCodeVerifierAsync: v,
494
+ setDemonstratingProofOfPossessionNonce: S,
495
+ getDemonstratingProofOfPossessionNonce: O,
496
+ setDemonstratingProofOfPossessionJwkAsync: T,
497
+ getDemonstratingProofOfPossessionJwkAsync: N
473
498
  };
474
- }, K = {}, Je = (e, n = window.sessionStorage, t) => {
475
- if (!K[e] && n) {
499
+ }, U = {}, He = (e, n = window.sessionStorage, t) => {
500
+ if (!U[e] && n) {
476
501
  const o = n.getItem(e);
477
- o && (K[e] = JSON.parse(o));
502
+ o && (U[e] = JSON.parse(o));
478
503
  }
479
504
  const s = 1e3 * t;
480
- return K[e] && K[e].timestamp + s > Date.now() ? K[e].result : null;
481
- }, He = (e, n, t = window.sessionStorage) => {
505
+ return U[e] && U[e].timestamp + s > Date.now() ? U[e].result : null;
506
+ }, Ge = (e, n, t = window.sessionStorage) => {
482
507
  const s = Date.now();
483
- K[e] = { result: n, timestamp: s }, t && t.setItem(e, JSON.stringify({ result: n, timestamp: s }));
508
+ U[e] = { result: n, timestamp: s }, t && t.setItem(e, JSON.stringify({ result: n, timestamp: s }));
484
509
  };
485
- function Ee(e) {
510
+ function Pe(e) {
486
511
  return new TextEncoder().encode(e);
487
512
  }
488
- function Oe(e) {
513
+ function Ie(e) {
489
514
  return btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+/g, "");
490
515
  }
491
- function Ge(e) {
516
+ function je(e) {
492
517
  return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g, function(t, s) {
493
518
  return String.fromCharCode(parseInt(s, 16));
494
519
  });
495
520
  }
496
- const ce = (e) => {
521
+ const fe = (e) => {
497
522
  let n = "";
498
523
  return e.forEach(function(t) {
499
524
  n += String.fromCharCode(t);
500
- }), Oe(n);
525
+ }), Ie(n);
501
526
  };
502
- function ye(e) {
503
- return Oe(Ge(e));
527
+ function we(e) {
528
+ return Ie(je(e));
504
529
  }
505
- const je = {
530
+ const qe = {
506
531
  importKeyAlgorithm: {
507
532
  name: "ECDSA",
508
533
  namedCurve: "P-256",
@@ -515,7 +540,7 @@ const je = {
515
540
  },
516
541
  digestAlgorithm: { name: "SHA-256" },
517
542
  jwtHeaderAlgorithm: "ES256"
518
- }, qe = (e) => async (n, t, s, o, i = "dpop+jwt") => {
543
+ }, Ye = (e) => async (n, t, s, o, i = "dpop+jwt") => {
519
544
  switch (n = Object.assign({}, n), t.typ = i, t.alg = o.jwtHeaderAlgorithm, t.alg) {
520
545
  case "ES256":
521
546
  t.jwk = { kty: n.kty, crv: n.crv, x: n.x, y: n.y };
@@ -529,22 +554,22 @@ const je = {
529
554
  const r = {
530
555
  // @ts-ignore
531
556
  // JWT "headers" really means JWS "protected headers"
532
- protected: ye(JSON.stringify(t)),
557
+ protected: we(JSON.stringify(t)),
533
558
  // @ts-ignore
534
559
  // JWT "claims" are really a JSON-defined JWS "payload"
535
- payload: ye(JSON.stringify(s))
536
- }, a = o.importKeyAlgorithm, c = !0, f = ["sign"], u = await e.crypto.subtle.importKey("jwk", n, a, c, f), l = Ee(`${r.protected}.${r.payload}`), d = o.signAlgorithm, _ = await e.crypto.subtle.sign(d, u, l);
537
- return r.signature = ce(new Uint8Array(_)), `${r.protected}.${r.payload}.${r.signature}`;
538
- }, Ye = { sign: qe }, Xe = (e) => async (n) => {
560
+ payload: we(JSON.stringify(s))
561
+ }, a = o.importKeyAlgorithm, c = !0, f = ["sign"], u = await e.crypto.subtle.importKey("jwk", n, a, c, f), l = Pe(`${r.protected}.${r.payload}`), h = o.signAlgorithm, _ = await e.crypto.subtle.sign(h, u, l);
562
+ return r.signature = fe(new Uint8Array(_)), `${r.protected}.${r.payload}.${r.signature}`;
563
+ }, Xe = { sign: Ye }, ze = (e) => async (n) => {
539
564
  const t = n, s = !0, o = ["sign", "verify"], i = await e.crypto.subtle.generateKey(t, s, o);
540
565
  return await e.crypto.subtle.exportKey("jwk", i.privateKey);
541
- }, ze = (e) => {
566
+ }, Qe = (e) => {
542
567
  const n = Object.assign({}, e);
543
568
  return delete n.d, n.key_ops = ["verify"], n;
544
- }, Qe = {
545
- generate: Xe,
546
- neuter: ze
547
- }, Ze = (e) => async (n, t) => {
569
+ }, Ze = {
570
+ generate: ze,
571
+ neuter: Qe
572
+ }, en = (e) => async (n, t) => {
548
573
  let s;
549
574
  switch (n.kty) {
550
575
  case "EC":
@@ -556,80 +581,80 @@ const je = {
556
581
  default:
557
582
  throw new Error("Unknown or not implemented JWK type");
558
583
  }
559
- const o = await e.crypto.subtle.digest(t, Ee(s));
560
- return ce(new Uint8Array(o));
561
- }, en = { thumbprint: Ze }, nn = (e) => async (n) => await Qe.generate(e)(n), be = (e) => (n) => async (t, s = "POST", o, i = {}) => {
584
+ const o = await e.crypto.subtle.digest(t, Pe(s));
585
+ return fe(new Uint8Array(o));
586
+ }, nn = { thumbprint: en }, tn = (e) => async (n) => await Ze.generate(e)(n), Ne = (e) => (n) => async (t, s = "POST", o, i = {}) => {
562
587
  const r = {
563
588
  // https://www.rfc-editor.org/rfc/rfc9449.html#name-concept
564
- jti: btoa(tn()),
589
+ jti: btoa(sn()),
565
590
  htm: s,
566
591
  htu: o,
567
592
  iat: Math.round(Date.now() / 1e3),
568
593
  ...i
569
- }, a = await en.thumbprint(e)(
594
+ }, a = await nn.thumbprint(e)(
570
595
  t,
571
596
  n.digestAlgorithm
572
597
  );
573
- return await Ye.sign(e)(
598
+ return await Xe.sign(e)(
574
599
  t,
575
600
  { kid: a },
576
601
  r,
577
602
  n
578
603
  );
579
- }, tn = () => {
604
+ }, sn = () => {
580
605
  const e = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx", n = "0123456789abcdef";
581
606
  let t = 0, s = "";
582
607
  for (let o = 0; o < 36; o++)
583
608
  e[o] !== "-" && e[o] !== "4" && (t = Math.random() * 16 | 0), e[o] === "x" ? s += n[t] : e[o] === "y" ? (t &= 3, t |= 8, s += n[t]) : s += e[o];
584
609
  return s;
585
- }, Pe = () => {
610
+ }, Ce = () => {
586
611
  const e = typeof window < "u" && !!window.crypto, n = e && !!window.crypto.subtle;
587
612
  return { hasCrypto: e, hasSubtleCrypto: n };
588
- }, ee = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", sn = (e) => {
613
+ }, ie = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", on = (e) => {
589
614
  const n = [];
590
615
  for (let t = 0; t < e.byteLength; t += 1) {
591
- const s = e[t] % ee.length;
592
- n.push(ee[s]);
616
+ const s = e[t] % ie.length;
617
+ n.push(ie[s]);
593
618
  }
594
619
  return n.join("");
595
- }, ne = (e) => {
596
- const n = new Uint8Array(e), { hasCrypto: t } = Pe();
620
+ }, re = (e) => {
621
+ const n = new Uint8Array(e), { hasCrypto: t } = Ce();
597
622
  if (t)
598
623
  window.crypto.getRandomValues(n);
599
624
  else
600
625
  for (let s = 0; s < e; s += 1)
601
- n[s] = Math.random() * ee.length | 0;
602
- return sn(n);
626
+ n[s] = Math.random() * ie.length | 0;
627
+ return on(n);
603
628
  };
604
- function on(e) {
629
+ function rn(e) {
605
630
  const n = new ArrayBuffer(e.length), t = new Uint8Array(n);
606
631
  for (let s = 0; s < e.length; s++)
607
632
  t[s] = e.charCodeAt(s);
608
633
  return t;
609
634
  }
610
- function Ie(e) {
635
+ function xe(e) {
611
636
  return new Promise((n, t) => {
612
- crypto.subtle.digest("SHA-256", on(e)).then(
613
- (s) => n(ce(new Uint8Array(s))),
637
+ crypto.subtle.digest("SHA-256", rn(e)).then(
638
+ (s) => n(fe(new Uint8Array(s))),
614
639
  (s) => t(s)
615
640
  );
616
641
  });
617
642
  }
618
- const rn = (e) => {
643
+ const an = (e) => {
619
644
  if (e.length < 43 || e.length > 128)
620
645
  return Promise.reject(new Error("Invalid code length."));
621
- const { hasSubtleCrypto: n } = Pe();
622
- return n ? Ie(e) : Promise.reject(new Error("window.crypto.subtle is unavailable."));
623
- }, an = 3600, cn = (e) => async (n, t = an, s = window.sessionStorage, o = 1e4) => {
624
- const i = `${n}/.well-known/openid-configuration`, r = `oidc.server:${n}`, a = Je(r, s, t);
646
+ const { hasSubtleCrypto: n } = Ce();
647
+ return n ? xe(e) : Promise.reject(new Error("window.crypto.subtle is unavailable."));
648
+ }, cn = 3600, ln = (e) => async (n, t = cn, s = window.sessionStorage, o = 1e4) => {
649
+ const i = `${n}/.well-known/openid-configuration`, r = `oidc.server:${n}`, a = He(r, s, t);
625
650
  if (a)
626
- return new oe(a);
627
- const c = await H(e)(i, {}, o);
651
+ return new le(a);
652
+ const c = await j(e)(i, {}, o);
628
653
  if (c.status !== 200)
629
654
  return null;
630
655
  const f = await c.json();
631
- return He(r, f, s), new oe(f);
632
- }, H = (e) => async (n, t = {}, s = 1e4, o = 0) => {
656
+ return Ge(r, f, s), new le(f);
657
+ }, j = (e) => async (n, t = {}, s = 1e4, o = 0) => {
633
658
  let i;
634
659
  try {
635
660
  const r = new AbortController();
@@ -637,30 +662,30 @@ const rn = (e) => {
637
662
  } catch (r) {
638
663
  if (r.name === "AbortError" || r.message === "Network request failed") {
639
664
  if (o <= 1)
640
- return await H(e)(n, t, s, o + 1);
665
+ return await j(e)(n, t, s, o + 1);
641
666
  throw r;
642
667
  } else
643
668
  throw console.error(r.message), r;
644
669
  }
645
670
  return i;
646
- }, te = {
671
+ }, ae = {
647
672
  refresh_token: "refresh_token",
648
673
  access_token: "access_token"
649
- }, ke = (e) => async (n, t, s = te.refresh_token, o, i = {}, r = 1e4) => {
674
+ }, pe = (e) => async (n, t, s = ae.refresh_token, o, i = {}, r = 1e4) => {
650
675
  const a = {
651
676
  token: t,
652
677
  token_type_hint: s,
653
678
  client_id: o
654
679
  };
655
- for (const [l, d] of Object.entries(i))
656
- a[l] === void 0 && (a[l] = d);
680
+ for (const [l, h] of Object.entries(i))
681
+ a[l] === void 0 && (a[l] = h);
657
682
  const c = [];
658
683
  for (const l in a) {
659
- const d = encodeURIComponent(l), _ = encodeURIComponent(a[l]);
660
- c.push(`${d}=${_}`);
684
+ const h = encodeURIComponent(l), _ = encodeURIComponent(a[l]);
685
+ c.push(`${h}=${_}`);
661
686
  }
662
687
  const f = c.join("&");
663
- return (await H(e)(
688
+ return (await j(e)(
664
689
  n,
665
690
  {
666
691
  method: "POST",
@@ -673,15 +698,15 @@ const rn = (e) => {
673
698
  )).status !== 200 ? { success: !1 } : {
674
699
  success: !0
675
700
  };
676
- }, ln = (e) => async (n, t, s, o, i = {}, r, a = 1e4) => {
677
- for (const [_, w] of Object.entries(s))
678
- t[_] === void 0 && (t[_] = w);
701
+ }, un = (e) => async (n, t, s, o, i = {}, r, a = 1e4) => {
702
+ for (const [_, m] of Object.entries(s))
703
+ t[_] === void 0 && (t[_] = m);
679
704
  const c = [];
680
705
  for (const _ in t) {
681
- const w = encodeURIComponent(_), A = encodeURIComponent(t[_]);
682
- c.push(`${w}=${A}`);
706
+ const m = encodeURIComponent(_), p = encodeURIComponent(t[_]);
707
+ c.push(`${m}=${p}`);
683
708
  }
684
- const f = c.join("&"), u = await H(e)(
709
+ const f = c.join("&"), u = await j(e)(
685
710
  n,
686
711
  {
687
712
  method: "POST",
@@ -700,32 +725,32 @@ const rn = (e) => {
700
725
  demonstratingProofOfPossessionNonce: null
701
726
  };
702
727
  const l = await u.json();
703
- let d = null;
704
- return u.headers.has(Y) && (d = u.headers.get(
705
- Y
728
+ let h = null;
729
+ return u.headers.has(ee) && (h = u.headers.get(
730
+ ee
706
731
  )), {
707
732
  success: !0,
708
733
  status: u.status,
709
- data: re(l, o, r),
710
- demonstratingProofOfPossessionNonce: d
734
+ data: _e(l, o, r),
735
+ demonstratingProofOfPossessionNonce: h
711
736
  };
712
- }, un = (e, n) => async (t, s) => {
737
+ }, _n = (e, n) => async (t, s) => {
713
738
  s = s ? { ...s } : {};
714
- const o = ne(128), i = await rn(o);
739
+ const o = re(128), i = await an(o);
715
740
  await e.setCodeVerifierAsync(o), await e.setStateAsync(s.state), s.code_challenge = i, s.code_challenge_method = "S256";
716
741
  let r = "";
717
742
  if (s)
718
743
  for (const [a, c] of Object.entries(s))
719
744
  r === "" ? r += "?" : r += "&", r += `${a}=${encodeURIComponent(c)}`;
720
745
  n.open(`${t}${r}`);
721
- }, Y = "DPoP-Nonce", _n = (e) => async (n, t, s, o, i = 1e4) => {
746
+ }, ee = "DPoP-Nonce", fn = (e) => async (n, t, s, o, i = 1e4) => {
722
747
  t = t ? { ...t } : {}, t.code_verifier = await e.getCodeVerifierAsync();
723
748
  const r = [];
724
749
  for (const l in t) {
725
- const d = encodeURIComponent(l), _ = encodeURIComponent(t[l]);
726
- r.push(`${d}=${_}`);
750
+ const h = encodeURIComponent(l), _ = encodeURIComponent(t[l]);
751
+ r.push(`${h}=${_}`);
727
752
  }
728
- const a = r.join("&"), c = await H(fetch)(
753
+ const a = r.join("&"), c = await j(fetch)(
729
754
  n,
730
755
  {
731
756
  method: "POST",
@@ -740,23 +765,23 @@ const rn = (e) => {
740
765
  if (await Promise.all([e.setCodeVerifierAsync(null), e.setStateAsync(null)]), c.status !== 200)
741
766
  return { success: !1, status: c.status };
742
767
  let f = null;
743
- c.headers.has(Y) && (f = c.headers.get(
744
- Y
768
+ c.headers.has(ee) && (f = c.headers.get(
769
+ ee
745
770
  ));
746
771
  const u = await c.json();
747
772
  return {
748
773
  success: !0,
749
774
  data: {
750
775
  state: t.state,
751
- tokens: re(u, null, o),
776
+ tokens: _e(u, null, o),
752
777
  demonstratingProofOfPossessionNonce: f
753
778
  }
754
779
  };
755
780
  };
756
- async function me(e, n, t, s = null) {
781
+ async function Ae(e, n, t, s = null) {
757
782
  const o = (c) => {
758
783
  e.tokens = c;
759
- }, { tokens: i, status: r } = await G(e)(
784
+ }, { tokens: i, status: r } = await z(e)(
760
785
  o,
761
786
  0,
762
787
  0,
@@ -764,35 +789,39 @@ async function me(e, n, t, s = null) {
764
789
  t,
765
790
  s
766
791
  );
767
- return await C(e.configuration, e.configurationName) || N(e.configurationName, e.configuration.storage).setTokens(e.tokens), e.tokens ? i : (await e.destroyAsync(r), null);
792
+ return await x(e.configuration, e.configurationName) || C(
793
+ e.configurationName,
794
+ e.configuration.storage,
795
+ e.configuration.login_state_storage ?? e.configuration.storage
796
+ ).setTokens(e.tokens), e.tokens ? i : (await e.destroyAsync(r), null);
768
797
  }
769
- async function Ne(e, n = !1, t = null, s = null) {
798
+ async function We(e, n = !1, t = null, s = null) {
770
799
  const o = e.configuration, i = `${o.client_id}_${e.configurationName}_${o.authority}`;
771
800
  let r;
772
- const a = await C(e.configuration, e.configurationName);
801
+ const a = await x(e.configuration, e.configurationName);
773
802
  if (o?.storage === window?.sessionStorage && !a || !navigator.locks)
774
- r = await me(e, n, t, s);
803
+ r = await Ae(e, n, t, s);
775
804
  else {
776
805
  let c = "retry";
777
806
  for (; c === "retry"; )
778
807
  c = await navigator.locks.request(
779
808
  i,
780
809
  { ifAvailable: !0 },
781
- async (f) => f ? await me(e, n, t, s) : (e.publishEvent(L.eventNames.syncTokensAsync_lock_not_available, {
810
+ async (f) => f ? await Ae(e, n, t, s) : (e.publishEvent(W.eventNames.syncTokensAsync_lock_not_available, {
782
811
  lock: "lock not available"
783
812
  }), "retry")
784
813
  );
785
814
  r = c;
786
815
  }
787
- return r ? (e.timeoutId && (e.timeoutId = J(e, e.tokens.expiresAt, t, s)), e.tokens) : null;
816
+ return r ? (e.timeoutId && (e.timeoutId = G(e, e.tokens.expiresAt, t, s)), e.tokens) : null;
788
817
  }
789
- const J = (e, n, t = null, s = null) => {
818
+ const G = (e, n, t = null, s = null) => {
790
819
  const o = e.configuration.refresh_time_before_tokens_expiration_in_second;
791
- return e.timeoutId && D.clearTimeout(e.timeoutId), D.setTimeout(async () => {
792
- const r = { timeLeft: F(o, n) };
793
- e.publishEvent(L.eventNames.token_timer, r), await Ne(e, !1, t, s);
820
+ return e.timeoutId && $.clearTimeout(e.timeoutId), $.setTimeout(async () => {
821
+ const r = { timeLeft: B(o, n) };
822
+ e.publishEvent(W.eventNames.token_timer, r), await We(e, !1, t, s);
794
823
  }, 1e3);
795
- }, E = {
824
+ }, b = {
796
825
  FORCE_REFRESH: "FORCE_REFRESH",
797
826
  SESSION_LOST: "SESSION_LOST",
798
827
  NOT_CONNECTED: "NOT_CONNECTED",
@@ -802,17 +831,17 @@ const J = (e, n, t = null, s = null) => {
802
831
  LOGOUT_FROM_ANOTHER_TAB: "LOGOUT_FROM_ANOTHER_TAB",
803
832
  REQUIRE_SYNC_TOKENS: "REQUIRE_SYNC_TOKENS",
804
833
  TOKENS_INVALID: "TOKENS_INVALID"
805
- }, le = (e) => async (n, t, s, o = !1) => {
834
+ }, de = (e) => async (n, t, s, o = !1) => {
806
835
  const i = { nonce: null };
807
836
  if (!s)
808
- return { tokens: null, status: E.NOT_CONNECTED, nonce: i };
837
+ return { tokens: null, status: b.NOT_CONNECTED, nonce: i };
809
838
  let r = i;
810
839
  const a = await e.initAsync(
811
840
  n.authority,
812
841
  n.authority_configuration
813
- ), c = await C(n, t);
842
+ ), c = await x(n, t);
814
843
  if (c) {
815
- const { status: l, tokens: d } = await c.initAsync(
844
+ const { status: l, tokens: h } = await c.initAsync(
816
845
  a,
817
846
  "syncTokensAsync",
818
847
  n
@@ -820,95 +849,103 @@ const J = (e, n, t = null, s = null) => {
820
849
  if (l === "LOGGED_OUT")
821
850
  return {
822
851
  tokens: null,
823
- status: E.LOGOUT_FROM_ANOTHER_TAB,
852
+ status: b.LOGOUT_FROM_ANOTHER_TAB,
824
853
  nonce: i
825
854
  };
826
855
  if (l === "SESSIONS_LOST")
827
- return { tokens: null, status: E.SESSION_LOST, nonce: i };
828
- if (!l || !d)
856
+ return { tokens: null, status: b.SESSION_LOST, nonce: i };
857
+ if (!l || !h)
829
858
  return {
830
859
  tokens: null,
831
- status: E.REQUIRE_SYNC_TOKENS,
860
+ status: b.REQUIRE_SYNC_TOKENS,
832
861
  nonce: i
833
862
  };
834
- if (d.issuedAt !== s.issuedAt) {
835
- const w = F(
863
+ if (h.issuedAt !== s.issuedAt) {
864
+ const m = B(
836
865
  n.refresh_time_before_tokens_expiration_in_second,
837
- d.expiresAt
838
- ) > 0 ? E.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : E.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID, A = await c.getNonceAsync();
839
- return { tokens: d, status: w, nonce: A };
866
+ h.expiresAt
867
+ ) > 0 ? b.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : b.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID, p = await c.getNonceAsync();
868
+ return { tokens: h, status: m, nonce: p };
840
869
  }
841
870
  r = await c.getNonceAsync();
842
871
  } else {
843
- const l = N(t, n.storage ?? sessionStorage), d = await l.initAsync();
844
- let { tokens: _ } = d;
845
- const { status: w } = d;
846
- if (_ && (_ = ie(_, e.tokens, n.token_renew_mode)), _) {
847
- if (w === "SESSIONS_LOST")
848
- return { tokens: null, status: E.SESSION_LOST, nonce: i };
872
+ const l = C(
873
+ t,
874
+ n.storage ?? sessionStorage,
875
+ n.login_state_storage ?? n.storage ?? sessionStorage
876
+ ), h = await l.initAsync();
877
+ let { tokens: _ } = h;
878
+ const { status: m } = h;
879
+ if (_ && (_ = ue(_, e.tokens, n.token_renew_mode)), _) {
880
+ if (m === "SESSIONS_LOST")
881
+ return { tokens: null, status: b.SESSION_LOST, nonce: i };
849
882
  if (_.issuedAt !== s.issuedAt) {
850
- const g = F(
883
+ const g = B(
851
884
  n.refresh_time_before_tokens_expiration_in_second,
852
885
  _.expiresAt
853
- ) > 0 ? E.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : E.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID, y = await l.getNonceAsync();
886
+ ) > 0 ? b.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : b.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID, y = await l.getNonceAsync();
854
887
  return { tokens: _, status: g, nonce: y };
855
888
  }
856
889
  } else return {
857
890
  tokens: null,
858
- status: E.LOGOUT_FROM_ANOTHER_TAB,
891
+ status: b.LOGOUT_FROM_ANOTHER_TAB,
859
892
  nonce: i
860
893
  };
861
894
  r = await l.getNonceAsync();
862
895
  }
863
- const u = F(
896
+ const u = B(
864
897
  n.refresh_time_before_tokens_expiration_in_second,
865
898
  s.expiresAt
866
899
  ) > 0 ? "TOKENS_VALID" : "TOKENS_INVALID";
867
900
  return o ? { tokens: s, status: "FORCE_REFRESH", nonce: r } : { tokens: s, status: u, nonce: r };
868
- }, G = (e) => async (n, t = 0, s = 0, o = !1, i = null, r = null) => {
901
+ }, z = (e) => async (n, t = 0, s = 0, o = !1, i = null, r = null) => {
869
902
  if (!navigator.onLine && document.hidden)
870
903
  return { tokens: e.tokens, status: "GIVE_UP" };
871
904
  let a = 6;
872
905
  const c = o ? 2 : 5, f = 5;
873
906
  for (; !navigator.onLine && a > 0; )
874
- await ae({ milliseconds: 1e3 }), a--, e.publishEvent(p.refreshTokensAsync, {
907
+ await ne({ milliseconds: 1e3 }), a--, e.publishEvent(k.refreshTokensAsync, {
875
908
  message: `wait because navigator is offline try ${a}`
876
909
  });
877
- const u = document.hidden, l = u ? t : t + 1, d = u ? s + 1 : s;
910
+ const u = document.hidden, l = u ? t : t + 1, h = u ? s + 1 : s;
878
911
  if (t >= c || s >= f)
879
- return n(null), e.publishEvent(p.refreshTokensAsync_error, { message: "refresh token" }), { tokens: null, status: "SESSION_LOST" };
912
+ return n(null), e.publishEvent(k.refreshTokensAsync_error, { message: "refresh token" }), { tokens: null, status: "SESSION_LOST" };
880
913
  i || (i = {});
881
- const _ = e.configuration, w = (g, y = null, S = null) => ue(
914
+ const _ = e.configuration, m = (g, y = null, A = null) => ge(
882
915
  e.configurationName,
883
916
  e.configuration,
884
917
  e.publishEvent.bind(e)
885
- )(g, y, S), A = async () => {
918
+ )(g, y, A), p = async () => {
886
919
  try {
887
920
  let g;
888
- const y = await C(_, e.configurationName);
889
- y ? g = y.getLoginParams() : g = N(e.configurationName, _.storage).getLoginParams();
890
- const S = {};
921
+ const y = await x(_, e.configurationName);
922
+ y ? g = y.getLoginParams() : g = C(
923
+ e.configurationName,
924
+ _.storage,
925
+ _.login_state_storage ?? _.storage
926
+ ).getLoginParams();
927
+ const A = {};
891
928
  if (g && g.extras)
892
- for (const [v, h] of Object.entries(g.extras))
893
- h != null && (S[v] = h);
929
+ for (const [O, T] of Object.entries(g.extras))
930
+ T != null && (A[O] = T);
894
931
  if (i)
895
- for (const [v, h] of Object.entries(i))
896
- h != null && (S[v] = h);
897
- S.prompt = "none", r && (S.scope = r);
898
- const T = await w(S);
899
- return T ? T.error ? (n(null), e.publishEvent(p.refreshTokensAsync_error, {
932
+ for (const [O, T] of Object.entries(i))
933
+ T != null && (A[O] = T);
934
+ A.prompt = "none", r && (A.scope = r);
935
+ const S = await m(A);
936
+ return S ? S.error ? (n(null), e.publishEvent(k.refreshTokensAsync_error, {
900
937
  message: "refresh token silent"
901
- }), { tokens: null, status: "SESSION_LOST" }) : (n(T.tokens), e.publishEvent(L.eventNames.token_renewed, {}), { tokens: T.tokens, status: "LOGGED" }) : (n(null), e.publishEvent(p.refreshTokensAsync_error, {
938
+ }), { tokens: null, status: "SESSION_LOST" }) : (n(S.tokens), e.publishEvent(W.eventNames.token_renewed, {}), { tokens: S.tokens, status: "LOGGED" }) : (n(null), e.publishEvent(k.refreshTokensAsync_error, {
902
939
  message: "refresh token silent not active"
903
940
  }), { tokens: null, status: "SESSION_LOST" });
904
941
  } catch (g) {
905
- return console.error(g), e.publishEvent(p.refreshTokensAsync_silent_error, {
942
+ return console.error(g), e.publishEvent(k.refreshTokensAsync_silent_error, {
906
943
  message: "exceptionSilent",
907
944
  exception: g.message
908
- }), await G(e)(
945
+ }), await z(e)(
909
946
  n,
910
947
  l,
911
- d,
948
+ h,
912
949
  o,
913
950
  i,
914
951
  r
@@ -916,99 +953,103 @@ const J = (e, n, t = null, s = null) => {
916
953
  }
917
954
  };
918
955
  try {
919
- const { status: g, tokens: y, nonce: S } = await le(e)(
956
+ const { status: g, tokens: y, nonce: A } = await de(e)(
920
957
  _,
921
958
  e.configurationName,
922
959
  e.tokens,
923
960
  o
924
961
  );
925
962
  switch (g) {
926
- case E.SESSION_LOST:
927
- return n(null), e.publishEvent(p.refreshTokensAsync_error, {
963
+ case b.SESSION_LOST:
964
+ return n(null), e.publishEvent(k.refreshTokensAsync_error, {
928
965
  message: "refresh token session lost"
929
966
  }), { tokens: null, status: "SESSION_LOST" };
930
- case E.NOT_CONNECTED:
967
+ case b.NOT_CONNECTED:
931
968
  return n(null), { tokens: null, status: null };
932
- case E.TOKENS_VALID:
969
+ case b.TOKENS_VALID:
933
970
  return n(y), { tokens: y, status: "LOGGED_IN" };
934
- case E.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID:
935
- return n(y), e.publishEvent(L.eventNames.token_renewed, {
971
+ case b.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID:
972
+ return n(y), e.publishEvent(W.eventNames.token_renewed, {
936
973
  reason: "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID"
937
974
  }), { tokens: y, status: "LOGGED_IN" };
938
- case E.LOGOUT_FROM_ANOTHER_TAB:
939
- return n(null), e.publishEvent(p.logout_from_another_tab, {
975
+ case b.LOGOUT_FROM_ANOTHER_TAB:
976
+ return n(null), e.publishEvent(k.logout_from_another_tab, {
940
977
  status: "session syncTokensAsync"
941
978
  }), { tokens: null, status: "LOGGED_OUT" };
942
- case E.REQUIRE_SYNC_TOKENS:
943
- return _.token_automatic_renew_mode == B.AutomaticOnlyWhenFetchExecuted && !o ? (e.publishEvent(p.tokensInvalidAndWaitingActionsToRefresh, {}), { tokens: e.tokens, status: "GIVE_UP" }) : (e.publishEvent(p.refreshTokensAsync_begin, { tryNumber: t }), await A());
979
+ case b.REQUIRE_SYNC_TOKENS:
980
+ return _.token_automatic_renew_mode == H.AutomaticOnlyWhenFetchExecuted && !o ? (e.publishEvent(k.tokensInvalidAndWaitingActionsToRefresh, {}), { tokens: e.tokens, status: "GIVE_UP" }) : (e.publishEvent(k.refreshTokensAsync_begin, { tryNumber: t }), await p());
944
981
  default: {
945
- if (_.token_automatic_renew_mode == B.AutomaticOnlyWhenFetchExecuted && E.FORCE_REFRESH !== g)
946
- return e.publishEvent(p.tokensInvalidAndWaitingActionsToRefresh, {}), { tokens: e.tokens, status: "GIVE_UP" };
947
- if (e.publishEvent(p.refreshTokensAsync_begin, {
982
+ if (_.token_automatic_renew_mode == H.AutomaticOnlyWhenFetchExecuted && b.FORCE_REFRESH !== g)
983
+ return e.publishEvent(k.tokensInvalidAndWaitingActionsToRefresh, {}), { tokens: e.tokens, status: "GIVE_UP" };
984
+ if (e.publishEvent(k.refreshTokensAsync_begin, {
948
985
  refreshToken: y.refreshToken,
949
986
  status: g,
950
987
  tryNumber: t,
951
988
  backgroundTry: s
952
989
  }), !y.refreshToken)
953
- return await A();
954
- const T = _.client_id, v = _.redirect_uri, h = _.authority, x = { ..._.token_request_extras ? _.token_request_extras : {} };
955
- for (const [b, m] of Object.entries(i))
956
- b.endsWith(":token_request") && (x[b.replace(":token_request", "")] = m);
990
+ return await p();
991
+ const S = _.client_id, O = _.redirect_uri, T = _.authority, w = { ..._.token_request_extras ? _.token_request_extras : {} };
992
+ for (const [L, v] of Object.entries(i))
993
+ L.endsWith(":token_request") && (w[L.replace(":token_request", "")] = v);
957
994
  return await (async () => {
958
- const b = {
959
- client_id: T,
960
- redirect_uri: v,
995
+ const L = {
996
+ client_id: S,
997
+ redirect_uri: O,
961
998
  grant_type: "refresh_token",
962
999
  refresh_token: y.refreshToken
963
- }, m = await e.initAsync(
964
- h,
1000
+ }, v = await e.initAsync(
1001
+ T,
965
1002
  _.authority_configuration
966
- ), W = document.hidden ? 1e4 : 3e4 * 10, V = m.tokenEndpoint, _e = {};
967
- _.demonstrating_proof_of_possession && (_e.DPoP = await e.generateDemonstrationOfProofOfPossessionAsync(
1003
+ ), d = document.hidden ? 1e4 : 3e4 * 10, D = v.tokenEndpoint, E = {};
1004
+ _.demonstrating_proof_of_possession && (E.DPoP = await e.generateDemonstrationOfProofOfPossessionAsync(
968
1005
  y.accessToken,
969
- V,
1006
+ D,
970
1007
  "POST"
971
1008
  ));
972
- const I = await ln(e.getFetch())(
973
- V,
974
- b,
975
- x,
1009
+ const P = await un(e.getFetch())(
1010
+ D,
1011
+ L,
1012
+ w,
976
1013
  y,
977
- _e,
1014
+ E,
978
1015
  _.token_renew_mode,
979
- W
1016
+ d
980
1017
  );
981
- if (I.success) {
982
- const { isValid: We, reason: Le } = Se(
983
- I.data,
984
- S.nonce,
985
- m
1018
+ if (P.success) {
1019
+ const { isValid: q, reason: M } = Ee(
1020
+ P.data,
1021
+ A.nonce,
1022
+ v
986
1023
  );
987
- if (!We)
988
- return n(null), e.publishEvent(p.refreshTokensAsync_error, {
989
- message: `refresh token return not valid tokens, reason: ${Le}`
1024
+ if (!q)
1025
+ return n(null), e.publishEvent(k.refreshTokensAsync_error, {
1026
+ message: `refresh token return not valid tokens, reason: ${M}`
990
1027
  }), { tokens: null, status: "SESSION_LOST" };
991
- if (n(I.data), I.demonstratingProofOfPossessionNonce) {
992
- const fe = await C(_, e.configurationName);
993
- fe ? await fe.setDemonstratingProofOfPossessionNonce(
994
- I.demonstratingProofOfPossessionNonce
995
- ) : await N(e.configurationName, _.storage).setDemonstratingProofOfPossessionNonce(
996
- I.demonstratingProofOfPossessionNonce
1028
+ if (n(P.data), P.demonstratingProofOfPossessionNonce) {
1029
+ const Y = await x(_, e.configurationName);
1030
+ Y ? await Y.setDemonstratingProofOfPossessionNonce(
1031
+ P.demonstratingProofOfPossessionNonce
1032
+ ) : await C(
1033
+ e.configurationName,
1034
+ _.storage,
1035
+ _.login_state_storage ?? _.storage
1036
+ ).setDemonstratingProofOfPossessionNonce(
1037
+ P.demonstratingProofOfPossessionNonce
997
1038
  );
998
1039
  }
999
- return e.publishEvent(p.refreshTokensAsync_end, {
1000
- success: I.success
1001
- }), e.publishEvent(L.eventNames.token_renewed, { reason: "REFRESH_TOKEN" }), { tokens: I.data, status: "LOGGED_IN" };
1040
+ return e.publishEvent(k.refreshTokensAsync_end, {
1041
+ success: P.success
1042
+ }), e.publishEvent(W.eventNames.token_renewed, { reason: "REFRESH_TOKEN" }), { tokens: P.data, status: "LOGGED_IN" };
1002
1043
  } else
1003
- return e.publishEvent(p.refreshTokensAsync_silent_error, {
1044
+ return e.publishEvent(k.refreshTokensAsync_silent_error, {
1004
1045
  message: "bad request",
1005
- tokenResponse: I
1006
- }), I.status >= 400 && I.status < 500 ? (n(null), e.publishEvent(p.refreshTokensAsync_error, {
1007
- message: `session lost: ${I.status}`
1008
- }), { tokens: null, status: "SESSION_LOST" }) : await G(e)(
1046
+ tokenResponse: P
1047
+ }), P.status >= 400 && P.status < 500 ? (n(null), e.publishEvent(k.refreshTokensAsync_error, {
1048
+ message: `session lost: ${P.status}`
1049
+ }), { tokens: null, status: "SESSION_LOST" }) : await z(e)(
1009
1050
  n,
1010
1051
  l,
1011
- d,
1052
+ h,
1012
1053
  o,
1013
1054
  i,
1014
1055
  r
@@ -1017,75 +1058,75 @@ const J = (e, n, t = null, s = null) => {
1017
1058
  }
1018
1059
  }
1019
1060
  } catch (g) {
1020
- return console.error(g), e.publishEvent(p.refreshTokensAsync_silent_error, {
1061
+ return console.error(g), e.publishEvent(k.refreshTokensAsync_silent_error, {
1021
1062
  message: "exception",
1022
1063
  exception: g.message
1023
- }), new Promise((y, S) => {
1064
+ }), new Promise((y, A) => {
1024
1065
  setTimeout(() => {
1025
- G(e)(
1066
+ z(e)(
1026
1067
  n,
1027
1068
  l,
1028
- d,
1069
+ h,
1029
1070
  o,
1030
1071
  i,
1031
1072
  r
1032
- ).then(y).catch(S);
1073
+ ).then(y).catch(A);
1033
1074
  }, 1e3);
1034
1075
  });
1035
1076
  }
1036
- }, ue = (e, n, t) => (s = null, o = null, i = null) => {
1077
+ }, ge = (e, n, t) => (s = null, o = null, i = null) => {
1037
1078
  if (!n.silent_redirect_uri || !n.silent_login_uri)
1038
1079
  return Promise.resolve(null);
1039
1080
  try {
1040
- t(p.silentLoginAsync_begin, {});
1081
+ t(k.silentLoginAsync_begin, {});
1041
1082
  let r = "";
1042
1083
  if (o && (s == null && (s = {}), s.state = o), i != null && (s == null && (s = {}), s.scope = i), s != null)
1043
- for (const [l, d] of Object.entries(s))
1044
- d != null && (r === "" ? r = `?${encodeURIComponent(l)}=${encodeURIComponent(d)}` : r += `&${encodeURIComponent(l)}=${encodeURIComponent(d)}`);
1084
+ for (const [l, h] of Object.entries(s))
1085
+ h != null && (r === "" ? r = `?${encodeURIComponent(l)}=${encodeURIComponent(h)}` : r += `&${encodeURIComponent(l)}=${encodeURIComponent(h)}`);
1045
1086
  const a = n.silent_login_uri + r, c = a.indexOf("/", a.indexOf("//") + 2), f = a.substring(0, c), u = document.createElement("iframe");
1046
- return u.width = "0px", u.height = "0px", u.id = `${e}_oidc_iframe`, u.setAttribute("src", a), u.style.display = "none", document.body.appendChild(u), new Promise((l, d) => {
1087
+ return u.width = "0px", u.height = "0px", u.id = `${e}_oidc_iframe`, u.setAttribute("src", a), u.style.display = "none", document.body.appendChild(u), new Promise((l, h) => {
1047
1088
  let _ = !1;
1048
- const w = () => {
1049
- window.removeEventListener("message", A), u.remove(), _ = !0;
1050
- }, A = (g) => {
1089
+ const m = () => {
1090
+ window.removeEventListener("message", p), u.remove(), _ = !0;
1091
+ }, p = (g) => {
1051
1092
  if (g.origin === f && g.source === u.contentWindow) {
1052
- const y = `${e}_oidc_tokens:`, S = `${e}_oidc_error:`, T = `${e}_oidc_exception:`, v = g.data;
1053
- if (v && typeof v == "string" && !_) {
1054
- if (v.startsWith(y)) {
1055
- const h = JSON.parse(g.data.replace(y, ""));
1056
- t(p.silentLoginAsync_end, {}), l(h), w();
1057
- } else if (v.startsWith(S)) {
1058
- const h = JSON.parse(g.data.replace(S, ""));
1059
- t(p.silentLoginAsync_error, h), l({ error: "oidc_" + h.error, tokens: null, sessionState: null }), w();
1060
- } else if (v.startsWith(T)) {
1061
- const h = JSON.parse(g.data.replace(T, ""));
1062
- t(p.silentLoginAsync_error, h), d(new Error(h.error)), w();
1093
+ const y = `${e}_oidc_tokens:`, A = `${e}_oidc_error:`, S = `${e}_oidc_exception:`, O = g.data;
1094
+ if (O && typeof O == "string" && !_) {
1095
+ if (O.startsWith(y)) {
1096
+ const T = JSON.parse(g.data.replace(y, ""));
1097
+ t(k.silentLoginAsync_end, {}), l(T), m();
1098
+ } else if (O.startsWith(A)) {
1099
+ const T = JSON.parse(g.data.replace(A, ""));
1100
+ t(k.silentLoginAsync_error, T), l({ error: "oidc_" + T.error, tokens: null, sessionState: null }), m();
1101
+ } else if (O.startsWith(S)) {
1102
+ const T = JSON.parse(g.data.replace(S, ""));
1103
+ t(k.silentLoginAsync_error, T), h(new Error(T.error)), m();
1063
1104
  }
1064
1105
  }
1065
1106
  }
1066
1107
  };
1067
1108
  try {
1068
- window.addEventListener("message", A);
1109
+ window.addEventListener("message", p);
1069
1110
  const g = n.silent_login_timeout;
1070
1111
  setTimeout(() => {
1071
- _ || (w(), t(p.silentLoginAsync_error, { reason: "timeout" }), d(new Error("timeout")));
1112
+ _ || (m(), t(k.silentLoginAsync_error, { reason: "timeout" }), h(new Error("timeout")));
1072
1113
  }, g);
1073
1114
  } catch (g) {
1074
- w(), t(p.silentLoginAsync_error, g), d(g);
1115
+ m(), t(k.silentLoginAsync_error, g), h(g);
1075
1116
  }
1076
1117
  });
1077
1118
  } catch (r) {
1078
- throw t(p.silentLoginAsync_error, r), r;
1119
+ throw t(k.silentLoginAsync_error, r), r;
1079
1120
  }
1080
- }, fn = (e, n, t, s, o) => (i = null, r = void 0) => {
1121
+ }, dn = (e, n, t, s, o) => (i = null, r = void 0) => {
1081
1122
  i = { ...i };
1082
- const a = (f, u, l) => ue(n, t, s.bind(o))(
1123
+ const a = (f, u, l) => ge(n, t, s.bind(o))(
1083
1124
  f,
1084
1125
  u,
1085
1126
  l
1086
1127
  );
1087
1128
  return (async () => {
1088
- o.timeoutId && D.clearTimeout(o.timeoutId);
1129
+ o.timeoutId && $.clearTimeout(o.timeoutId);
1089
1130
  let f;
1090
1131
  i && "state" in i && (f = i.state, delete i.state);
1091
1132
  try {
@@ -1098,13 +1139,13 @@ const J = (e, n, t = null, s = null) => {
1098
1139
  r
1099
1140
  );
1100
1141
  if (l)
1101
- return o.tokens = l.tokens, s(p.token_acquired, {}), o.timeoutId = J(o, o.tokens.expiresAt, i, r), {};
1142
+ return o.tokens = l.tokens, s(k.token_acquired, {}), o.timeoutId = G(o, o.tokens.expiresAt, i, r), {};
1102
1143
  } catch (u) {
1103
1144
  return u;
1104
1145
  }
1105
1146
  })();
1106
- }, dn = (e, n, t) => (s, o, i, r = !1) => {
1107
- const a = (c, f = void 0, u = void 0) => ue(e.configurationName, t, e.publishEvent.bind(e))(
1147
+ }, gn = (e, n, t) => (s, o, i, r = !1) => {
1148
+ const a = (c, f = void 0, u = void 0) => ge(e.configurationName, t, e.publishEvent.bind(e))(
1108
1149
  c,
1109
1150
  f,
1110
1151
  u
@@ -1116,18 +1157,18 @@ const J = (e, n, t = null, s = null) => {
1116
1157
  const l = e.tokens;
1117
1158
  if (l === null)
1118
1159
  return;
1119
- const d = l.idToken, _ = l.idTokenPayload;
1160
+ const h = l.idToken, _ = l.idTokenPayload;
1120
1161
  return a({
1121
1162
  prompt: "none",
1122
- id_token_hint: d,
1163
+ id_token_hint: h,
1123
1164
  scope: t.scope || "openid"
1124
- }).then((w) => {
1125
- if (w.error)
1126
- throw new Error(w.error);
1127
- const A = w.tokens.idTokenPayload;
1128
- if (_.sub === A.sub) {
1129
- const g = w.sessionState;
1130
- e.checkSessionIFrame.start(w.sessionState), _.sid === A.sid ? console.debug(
1165
+ }).then((m) => {
1166
+ if (m.error)
1167
+ throw new Error(m.error);
1168
+ const p = m.tokens.idTokenPayload;
1169
+ if (_.sub === p.sub) {
1170
+ const g = m.sessionState;
1171
+ e.checkSessionIFrame.start(m.sessionState), _.sid === p.sid ? console.debug(
1131
1172
  "SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:",
1132
1173
  g
1133
1174
  ) : console.debug(
@@ -1137,18 +1178,18 @@ const J = (e, n, t = null, s = null) => {
1137
1178
  } else
1138
1179
  console.debug(
1139
1180
  "SessionMonitor._callback: Different subject signed into OP:",
1140
- A.sub
1181
+ p.sub
1141
1182
  );
1142
- }).catch(async (w) => {
1183
+ }).catch(async (m) => {
1143
1184
  console.warn(
1144
1185
  "SessionMonitor._callback: Silent login failed, logging out other tabs:",
1145
- w
1186
+ m
1146
1187
  );
1147
- for (const [, A] of Object.entries(n))
1148
- await A.logoutOtherTabAsync(t.client_id, _.sub);
1188
+ for (const [, p] of Object.entries(n))
1189
+ await p.logoutOtherTabAsync(t.client_id, _.sub);
1149
1190
  });
1150
1191
  };
1151
- e.checkSessionIFrame = new De(
1192
+ e.checkSessionIFrame = new $e(
1152
1193
  u,
1153
1194
  o,
1154
1195
  s
@@ -1160,7 +1201,7 @@ const J = (e, n, t = null, s = null) => {
1160
1201
  } else
1161
1202
  c(null);
1162
1203
  });
1163
- }, hn = (e) => !!(e.os === "iOS" && e.osVersion.startsWith("12") || e.os === "Mac OS X" && e.osVersion.startsWith("10_15_6")), gn = (e) => {
1204
+ }, hn = (e) => !!(e.os === "iOS" && e.osVersion.startsWith("12") || e.os === "Mac OS X" && e.osVersion.startsWith("10_15_6")), yn = (e) => {
1164
1205
  const n = e.appVersion, t = e.userAgent, s = "-";
1165
1206
  let o = s;
1166
1207
  const i = [
@@ -1220,7 +1261,7 @@ const J = (e, n, t = null, s = null) => {
1220
1261
  osVersion: r
1221
1262
  };
1222
1263
  };
1223
- function yn() {
1264
+ function kn() {
1224
1265
  const e = navigator.userAgent;
1225
1266
  let n, t = e.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
1226
1267
  if (/trident/i.test(t[1]))
@@ -1238,23 +1279,23 @@ function yn() {
1238
1279
  version: t[1]
1239
1280
  };
1240
1281
  }
1241
- const kn = () => {
1242
- const { name: e, version: n } = yn();
1282
+ const mn = () => {
1283
+ const { name: e, version: n } = kn();
1243
1284
  if (e === "chrome" && parseInt(n) <= 70 || e === "opera" && (!n || parseInt(n.split(".")[0]) < 80) || e === "ie")
1244
1285
  return !1;
1245
- const t = gn(navigator);
1286
+ const t = yn(navigator);
1246
1287
  return !hn(t);
1247
- }, mn = async (e) => {
1288
+ }, wn = async (e) => {
1248
1289
  let n;
1249
1290
  if (e.tokens != null)
1250
1291
  return !1;
1251
- e.publishEvent(p.tryKeepExistingSessionAsync_begin, {});
1292
+ e.publishEvent(k.tryKeepExistingSessionAsync_begin, {});
1252
1293
  try {
1253
1294
  const t = e.configuration, s = await e.initAsync(
1254
1295
  t.authority,
1255
1296
  t.authority_configuration
1256
1297
  );
1257
- if (n = await C(t, e.configurationName), n) {
1298
+ if (n = await x(t, e.configurationName), n) {
1258
1299
  const { tokens: o } = await n.initAsync(
1259
1300
  s,
1260
1301
  "tryKeepExistingSessionAsync",
@@ -1263,7 +1304,7 @@ const kn = () => {
1263
1304
  if (o) {
1264
1305
  n.startKeepAliveServiceWorker(), e.tokens = o;
1265
1306
  const i = n.getLoginParams(e.configurationName);
1266
- e.timeoutId = J(
1307
+ e.timeoutId = G(
1267
1308
  e,
1268
1309
  e.tokens.expiresAt,
1269
1310
  i.extras,
@@ -1274,24 +1315,28 @@ const kn = () => {
1274
1315
  s.checkSessionIframe,
1275
1316
  t.client_id,
1276
1317
  r
1277
- ), t.preload_user_info && await e.userInfoAsync(), e.publishEvent(p.tryKeepExistingSessionAsync_end, {
1318
+ ), t.preload_user_info && await e.userInfoAsync(), e.publishEvent(k.tryKeepExistingSessionAsync_end, {
1278
1319
  success: !0,
1279
1320
  message: "tokens inside ServiceWorker are valid"
1280
1321
  }), !0;
1281
1322
  }
1282
- e.publishEvent(p.tryKeepExistingSessionAsync_end, {
1323
+ e.publishEvent(k.tryKeepExistingSessionAsync_end, {
1283
1324
  success: !1,
1284
1325
  message: "no exiting session found"
1285
1326
  });
1286
1327
  } else {
1287
- t.service_worker_relative_url && e.publishEvent(p.service_worker_not_supported_by_browser, {
1328
+ t.service_worker_relative_url && e.publishEvent(k.service_worker_not_supported_by_browser, {
1288
1329
  message: "service worker is not supported by this browser"
1289
1330
  });
1290
- const o = N(e.configurationName, t.storage ?? sessionStorage), { tokens: i } = await o.initAsync();
1331
+ const o = C(
1332
+ e.configurationName,
1333
+ t.storage ?? sessionStorage,
1334
+ t.login_state_storage ?? t.storage ?? sessionStorage
1335
+ ), { tokens: i } = await o.initAsync();
1291
1336
  if (i) {
1292
- e.tokens = ie(i, null, t.token_renew_mode);
1337
+ e.tokens = ue(i, null, t.token_renew_mode);
1293
1338
  const r = o.getLoginParams();
1294
- e.timeoutId = J(
1339
+ e.timeoutId = G(
1295
1340
  e,
1296
1341
  e.tokens.expiresAt,
1297
1342
  r.extras,
@@ -1302,23 +1347,23 @@ const kn = () => {
1302
1347
  s.checkSessionIframe,
1303
1348
  t.client_id,
1304
1349
  a
1305
- ), t.preload_user_info && await e.userInfoAsync(), e.publishEvent(p.tryKeepExistingSessionAsync_end, {
1350
+ ), t.preload_user_info && await e.userInfoAsync(), e.publishEvent(k.tryKeepExistingSessionAsync_end, {
1306
1351
  success: !0,
1307
1352
  message: "tokens inside storage are valid"
1308
1353
  }), !0;
1309
1354
  }
1310
1355
  }
1311
- return e.publishEvent(p.tryKeepExistingSessionAsync_end, {
1356
+ return e.publishEvent(k.tryKeepExistingSessionAsync_end, {
1312
1357
  success: !1,
1313
1358
  message: n ? "service worker sessions not retrieved" : "session storage sessions not retrieved"
1314
1359
  }), !1;
1315
1360
  } catch (t) {
1316
1361
  return console.error(t), n && await n.clearAsync(), e.publishEvent(
1317
- p.tryKeepExistingSessionAsync_error,
1362
+ k.tryKeepExistingSessionAsync_error,
1318
1363
  "tokens inside ServiceWorker are invalid"
1319
1364
  ), !1;
1320
1365
  }
1321
- }, Ce = (e) => {
1366
+ }, Le = (e) => {
1322
1367
  const n = e.match(
1323
1368
  // eslint-disable-next-line no-useless-escape
1324
1369
  /^([a-z][\w-]+\:)\/\/(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/
@@ -1341,75 +1386,80 @@ const kn = () => {
1341
1386
  hash: s
1342
1387
  };
1343
1388
  }, Cn = (e) => {
1344
- const n = Ce(e);
1389
+ const n = Le(e);
1345
1390
  let { path: t } = n;
1346
1391
  t.endsWith("/") && (t = t.slice(0, -1));
1347
1392
  let { hash: s } = n;
1348
1393
  return s === "#_=_" && (s = ""), s && (t += s), t;
1349
- }, se = (e) => {
1350
- const n = Ce(e), { search: t } = n;
1351
- return wn(t);
1352
- }, wn = (e) => {
1394
+ }, ce = (e) => {
1395
+ const n = Le(e), { search: t } = n;
1396
+ return pn(t);
1397
+ }, pn = (e) => {
1353
1398
  const n = {};
1354
1399
  let t, s, o;
1355
1400
  const i = e.split("&");
1356
1401
  for (s = 0, o = i.length; s < o; s++)
1357
1402
  t = i[s].split("="), n[decodeURIComponent(t[0])] = decodeURIComponent(t[1]);
1358
1403
  return n;
1359
- }, pn = (e, n, t, s, o) => (i = void 0, r = null, a = !1, c = void 0) => {
1404
+ }, An = (e, n, t, s, o) => (i = void 0, r = null, a = !1, c = void 0) => {
1360
1405
  const f = r;
1361
1406
  return r = { ...r }, (async () => {
1362
1407
  const l = i || o.getPath();
1363
- if ("state" in r || (r.state = ne(16)), t(p.loginAsync_begin, {}), r)
1364
- for (const d of Object.keys(r))
1365
- d.endsWith(":token_request") && delete r[d];
1408
+ if ("state" in r || (r.state = re(16)), t(k.loginAsync_begin, {}), r)
1409
+ for (const h of Object.keys(r))
1410
+ h.endsWith(":token_request") && delete r[h];
1366
1411
  try {
1367
- const d = a ? n.silent_redirect_uri : n.redirect_uri;
1412
+ const h = a ? n.silent_redirect_uri : n.redirect_uri;
1368
1413
  c || (c = n.scope);
1369
1414
  const _ = n.extras ? { ...n.extras, ...r } : r;
1370
- _.nonce || (_.nonce = ne(12));
1371
- const w = { nonce: _.nonce }, A = await C(n, e), g = await s(
1415
+ _.nonce || (_.nonce = re(12));
1416
+ const m = { nonce: _.nonce }, p = await x(n, e), g = await s(
1372
1417
  n.authority,
1373
1418
  n.authority_configuration
1374
1419
  );
1375
1420
  let y;
1376
- if (A)
1377
- A.setLoginParams({ callbackPath: l, extras: f, scope: c }), await A.initAsync(g, "loginAsync", n), await A.setNonceAsync(w), A.startKeepAliveServiceWorker(), y = A;
1421
+ if (p)
1422
+ p.setLoginParams({ callbackPath: l, extras: f, scope: c }), await p.initAsync(g, "loginAsync", n), await p.setNonceAsync(m), p.startKeepAliveServiceWorker(), y = p;
1378
1423
  else {
1379
- const T = N(e, n.storage ?? sessionStorage);
1380
- T.setLoginParams({ callbackPath: l, extras: f, scope: c }), await T.setNonceAsync(w), y = T;
1424
+ const S = C(
1425
+ e,
1426
+ n.storage ?? sessionStorage,
1427
+ n.login_state_storage ?? n.storage ?? sessionStorage
1428
+ );
1429
+ S.setLoginParams({ callbackPath: l, extras: f, scope: c }), await S.setNonceAsync(m), y = S;
1381
1430
  }
1382
- const S = {
1431
+ const A = {
1383
1432
  client_id: n.client_id,
1384
- redirect_uri: d,
1433
+ redirect_uri: h,
1385
1434
  scope: c,
1386
1435
  response_type: "code",
1387
1436
  ..._
1388
1437
  };
1389
- await un(y, o)(
1438
+ await _n(y, o)(
1390
1439
  g.authorizationEndpoint,
1391
- S
1440
+ A
1392
1441
  );
1393
- } catch (d) {
1394
- throw t(p.loginAsync_error, d), d;
1442
+ } catch (h) {
1443
+ throw t(k.loginAsync_error, h), h;
1395
1444
  }
1396
1445
  })();
1397
- }, An = (e) => async (n = !1) => {
1446
+ }, Sn = (e) => async (n = !1) => {
1398
1447
  try {
1399
- e.publishEvent(p.loginCallbackAsync_begin, {});
1448
+ e.publishEvent(k.loginCallbackAsync_begin, {});
1400
1449
  const t = e.configuration, s = t.client_id, o = n ? t.silent_redirect_uri : t.redirect_uri, i = t.authority, r = t.token_request_timeout, a = await e.initAsync(
1401
1450
  i,
1402
1451
  t.authority_configuration
1403
- ), c = e.location.getCurrentHref(), f = se(c), u = f.session_state, l = await C(t, e.configurationName);
1404
- let d, _, w, A;
1452
+ ), c = e.location.getCurrentHref(), f = ce(c), u = f.session_state, l = await x(t, e.configurationName);
1453
+ let h, _, m, p;
1405
1454
  if (l)
1406
- await l.initAsync(a, "loginCallbackAsync", t), await l.setSessionStateAsync(u), _ = await l.getNonceAsync(), w = l.getLoginParams(), A = await l.getStateAsync(), l.startKeepAliveServiceWorker(), d = l;
1455
+ await l.initAsync(a, "loginCallbackAsync", t), await l.setSessionStateAsync(u), _ = await l.getNonceAsync(), m = l.getLoginParams(), p = await l.getStateAsync(), l.startKeepAliveServiceWorker(), h = l;
1407
1456
  else {
1408
- const m = N(
1457
+ const v = C(
1409
1458
  e.configurationName,
1410
- t.storage ?? sessionStorage
1459
+ t.storage ?? sessionStorage,
1460
+ t.login_state_storage ?? t.storage ?? sessionStorage
1411
1461
  );
1412
- await m.setSessionStateAsync(u), _ = await m.getNonceAsync(), w = m.getLoginParams(), A = await m.getStateAsync(), d = m;
1462
+ await v.setSessionStateAsync(u), _ = await v.getNonceAsync(), m = v.getLoginParams(), p = await v.getStateAsync(), h = v;
1413
1463
  }
1414
1464
  if (f.error || f.error_description)
1415
1465
  throw new Error(
@@ -1419,8 +1469,8 @@ const kn = () => {
1419
1469
  throw console.error(), new Error(
1420
1470
  `Issuer not valid (expected: ${a.issuer}, received: ${f.iss})`
1421
1471
  );
1422
- if (f.state && f.state !== A)
1423
- throw new Error(`State not valid (expected: ${A}, received: ${f.state})`);
1472
+ if (f.state && f.state !== p)
1473
+ throw new Error(`State not valid (expected: ${p}, received: ${f.state})`);
1424
1474
  const g = {
1425
1475
  code: f.code,
1426
1476
  grant_type: "authorization_code",
@@ -1428,78 +1478,86 @@ const kn = () => {
1428
1478
  redirect_uri: o
1429
1479
  }, y = {};
1430
1480
  if (t.token_request_extras)
1431
- for (const [m, W] of Object.entries(t.token_request_extras))
1432
- y[m] = W;
1433
- if (w?.extras)
1434
- for (const [m, W] of Object.entries(w.extras))
1435
- m.endsWith(":token_request") && (y[m.replace(":token_request", "")] = W);
1436
- const S = a.tokenEndpoint, T = {};
1481
+ for (const [v, d] of Object.entries(t.token_request_extras))
1482
+ y[v] = d;
1483
+ if (m?.extras)
1484
+ for (const [v, d] of Object.entries(m.extras))
1485
+ v.endsWith(":token_request") && (y[v.replace(":token_request", "")] = d);
1486
+ const A = a.tokenEndpoint, S = {};
1437
1487
  if (t.demonstrating_proof_of_possession)
1438
1488
  if (l)
1439
- T.DPoP = `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${e.configurationName}`;
1489
+ S.DPoP = `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${e.configurationName}`;
1440
1490
  else {
1441
- const m = await nn(window)(
1491
+ const v = await tn(window)(
1442
1492
  t.demonstrating_proof_of_possession_configuration.generateKeyAlgorithm
1443
1493
  );
1444
- await N(e.configurationName, t.storage).setDemonstratingProofOfPossessionJwkAsync(m), T.DPoP = await be(window)(
1494
+ await C(
1495
+ e.configurationName,
1496
+ t.storage,
1497
+ t.login_state_storage ?? t.storage
1498
+ ).setDemonstratingProofOfPossessionJwkAsync(v), S.DPoP = await Ne(window)(
1445
1499
  t.demonstrating_proof_of_possession_configuration
1446
- )(m, "POST", S);
1500
+ )(v, "POST", A);
1447
1501
  }
1448
- const v = await _n(d)(
1449
- S,
1502
+ const O = await fn(h)(
1503
+ A,
1450
1504
  { ...g, ...y },
1451
- T,
1505
+ S,
1452
1506
  e.configuration.token_renew_mode,
1453
1507
  r
1454
1508
  );
1455
- if (!v.success)
1509
+ if (!O.success)
1456
1510
  throw new Error("Token request failed");
1457
- let h;
1458
- const P = v.data.tokens, x = v.data.demonstratingProofOfPossessionNonce;
1459
- if (v.data.state !== y.state)
1511
+ let T;
1512
+ const N = O.data.tokens, w = O.data.demonstratingProofOfPossessionNonce;
1513
+ if (O.data.state !== y.state)
1460
1514
  throw new Error("state is not valid");
1461
- const { isValid: k, reason: b } = Se(
1462
- P,
1515
+ const { isValid: F, reason: L } = Ee(
1516
+ N,
1463
1517
  _.nonce,
1464
1518
  a
1465
1519
  );
1466
- if (!k)
1467
- throw new Error(`Tokens are not OpenID valid, reason: ${b}`);
1520
+ if (!F)
1521
+ throw new Error(`Tokens are not OpenID valid, reason: ${L}`);
1468
1522
  if (l) {
1469
- if (P.refreshToken && !P.refreshToken.includes("SECURED_BY_OIDC_SERVICE_WORKER"))
1523
+ if (N.refreshToken && !N.refreshToken.includes("SECURED_BY_OIDC_SERVICE_WORKER"))
1470
1524
  throw new Error("Refresh token should be hidden by service worker");
1471
- if (x && P?.accessToken.includes("SECURED_BY_OIDC_SERVICE_WORKER"))
1525
+ if (w && N?.accessToken.includes("SECURED_BY_OIDC_SERVICE_WORKER"))
1472
1526
  throw new Error(
1473
1527
  "Demonstration of proof of possession require Access token not hidden by service worker"
1474
1528
  );
1475
1529
  }
1476
1530
  if (l)
1477
- await l.initAsync(a, "syncTokensAsync", t), h = l.getLoginParams(), x && await l.setDemonstratingProofOfPossessionNonce(
1478
- x
1531
+ await l.initAsync(a, "syncTokensAsync", t), T = l.getLoginParams(), w && await l.setDemonstratingProofOfPossessionNonce(
1532
+ w
1479
1533
  );
1480
1534
  else {
1481
- const m = N(e.configurationName, t.storage);
1482
- h = m.getLoginParams(), x && await m.setDemonstratingProofOfPossessionNonce(x);
1535
+ const v = C(
1536
+ e.configurationName,
1537
+ t.storage,
1538
+ t.login_state_storage ?? t.storage
1539
+ );
1540
+ T = v.getLoginParams(), w && await v.setDemonstratingProofOfPossessionNonce(w);
1483
1541
  }
1484
1542
  return await e.startCheckSessionAsync(
1485
1543
  a.checkSessionIframe,
1486
1544
  s,
1487
1545
  u,
1488
1546
  n
1489
- ), e.publishEvent(p.loginCallbackAsync_end, {}), {
1490
- tokens: P,
1547
+ ), e.publishEvent(k.loginCallbackAsync_end, {}), {
1548
+ tokens: N,
1491
1549
  state: "request.state",
1492
- callbackPath: h.callbackPath,
1550
+ callbackPath: T.callbackPath,
1493
1551
  scope: f.scope,
1494
- extras: h.extras
1552
+ extras: T.extras
1495
1553
  };
1496
1554
  } catch (t) {
1497
- throw console.error(t), e.publishEvent(p.loginCallbackAsync_error, t), t;
1555
+ throw console.error(t), e.publishEvent(k.loginCallbackAsync_error, t), t;
1498
1556
  }
1499
- }, we = {
1557
+ }, Se = {
1500
1558
  access_token: "access_token",
1501
1559
  refresh_token: "refresh_token"
1502
- }, Q = (e, n) => {
1560
+ }, se = (e, n) => {
1503
1561
  const t = {};
1504
1562
  if (e) {
1505
1563
  for (const [s, o] of Object.entries(e))
@@ -1510,7 +1568,7 @@ const kn = () => {
1510
1568
  return t;
1511
1569
  }
1512
1570
  return t;
1513
- }, Sn = (e) => {
1571
+ }, Tn = (e) => {
1514
1572
  const n = {};
1515
1573
  if (e) {
1516
1574
  for (const [t, s] of Object.entries(e))
@@ -1518,11 +1576,15 @@ const kn = () => {
1518
1576
  return n;
1519
1577
  }
1520
1578
  return n;
1521
- }, Tn = (e) => async (n) => {
1522
- D.clearTimeout(e.timeoutId), e.timeoutId = null, e.checkSessionIFrame && e.checkSessionIFrame.stop();
1523
- const t = await C(e.configuration, e.configurationName);
1524
- t ? await t.clearAsync(n) : await N(e.configurationName, e.configuration.storage).clearAsync(n), e.tokens = null, e.userInfo = null;
1525
- }, vn = (e, n, t, s, o) => async (i = void 0, r = null) => {
1579
+ }, vn = (e) => async (n) => {
1580
+ $.clearTimeout(e.timeoutId), e.timeoutId = null, e.checkSessionIFrame && e.checkSessionIFrame.stop();
1581
+ const t = await x(e.configuration, e.configurationName);
1582
+ t ? await t.clearAsync(n) : await C(
1583
+ e.configurationName,
1584
+ e.configuration.storage,
1585
+ e.configuration.login_state_storage ?? e.configuration.storage
1586
+ ).clearAsync(n), e.tokens = null, e.userInfo = null;
1587
+ }, En = (e, n, t, s, o) => async (i = void 0, r = null) => {
1526
1588
  const a = e.configuration, c = await e.initAsync(
1527
1589
  a.authority,
1528
1590
  a.authority_configuration
@@ -1531,33 +1593,33 @@ const kn = () => {
1531
1593
  const f = i ?? o.getPath();
1532
1594
  let u = !1;
1533
1595
  i && (u = i.includes("https://") || i.includes("http://"));
1534
- const l = u ? i : o.getOrigin() + f, d = e.tokens ? e.tokens.idToken : "";
1596
+ const l = u ? i : o.getOrigin() + f, h = e.tokens ? e.tokens.idToken : "";
1535
1597
  try {
1536
1598
  const y = c.revocationEndpoint;
1537
1599
  if (y) {
1538
- const S = [], T = e.tokens ? e.tokens.accessToken : null;
1539
- if (T && a.logout_tokens_to_invalidate.includes(we.access_token)) {
1540
- const h = Q(r, ":revoke_access_token"), P = ke(t)(
1600
+ const A = [], S = e.tokens ? e.tokens.accessToken : null;
1601
+ if (S && a.logout_tokens_to_invalidate.includes(Se.access_token)) {
1602
+ const T = se(r, ":revoke_access_token"), N = pe(t)(
1541
1603
  y,
1542
- T,
1543
- te.access_token,
1604
+ S,
1605
+ ae.access_token,
1544
1606
  a.client_id,
1545
- h
1607
+ T
1546
1608
  );
1547
- S.push(P);
1609
+ A.push(N);
1548
1610
  }
1549
- const v = e.tokens ? e.tokens.refreshToken : null;
1550
- if (v && a.logout_tokens_to_invalidate.includes(we.refresh_token)) {
1551
- const h = Q(r, ":revoke_refresh_token"), P = ke(t)(
1611
+ const O = e.tokens ? e.tokens.refreshToken : null;
1612
+ if (O && a.logout_tokens_to_invalidate.includes(Se.refresh_token)) {
1613
+ const T = se(r, ":revoke_refresh_token"), N = pe(t)(
1552
1614
  y,
1553
- v,
1554
- te.refresh_token,
1615
+ O,
1616
+ ae.refresh_token,
1555
1617
  a.client_id,
1556
- h
1618
+ T
1557
1619
  );
1558
- S.push(P);
1620
+ A.push(N);
1559
1621
  }
1560
- S.length > 0 && await Promise.all(S);
1622
+ A.length > 0 && await Promise.all(A);
1561
1623
  }
1562
1624
  } catch (y) {
1563
1625
  s.warn(
@@ -1567,20 +1629,20 @@ const kn = () => {
1567
1629
  const _ = e.tokens?.idTokenPayload?.sub ?? null;
1568
1630
  await e.destroyAsync("LOGGED_OUT");
1569
1631
  for (const [, y] of Object.entries(n))
1570
- y !== e ? await e.logoutSameTabAsync(e.configuration.client_id, _) : e.publishEvent(p.logout_from_same_tab, {});
1571
- const w = Q(r, ":oidc");
1572
- if (w && w.no_reload === "true")
1632
+ y !== e ? await e.logoutSameTabAsync(e.configuration.client_id, _) : e.publishEvent(k.logout_from_same_tab, {});
1633
+ const m = se(r, ":oidc");
1634
+ if (m && m.no_reload === "true")
1573
1635
  return;
1574
- const g = Sn(r);
1636
+ const g = Tn(r);
1575
1637
  if (c.endSessionEndpoint) {
1576
- "id_token_hint" in g || (g.id_token_hint = d), !("post_logout_redirect_uri" in g) && i !== null && (g.post_logout_redirect_uri = l);
1638
+ "id_token_hint" in g || (g.id_token_hint = h), !("post_logout_redirect_uri" in g) && i !== null && (g.post_logout_redirect_uri = l);
1577
1639
  let y = "";
1578
- for (const [S, T] of Object.entries(g))
1579
- T != null && (y === "" ? y += "?" : y += "&", y += `${S}=${encodeURIComponent(T)}`);
1640
+ for (const [A, S] of Object.entries(g))
1641
+ S != null && (y === "" ? y += "?" : y += "&", y += `${A}=${encodeURIComponent(S)}`);
1580
1642
  o.open(`${c.endSessionEndpoint}${y}`);
1581
1643
  } else
1582
1644
  o.reload();
1583
- }, xe = (e, n, t = !1) => async (...s) => {
1645
+ }, De = (e, n, t = !1) => async (...s) => {
1584
1646
  const [o, i, ...r] = s, a = i ? { ...i } : { method: "GET" };
1585
1647
  let c = new Headers();
1586
1648
  a.headers && (c = a.headers instanceof Headers ? a.headers : new Headers(a.headers));
@@ -1591,7 +1653,7 @@ const kn = () => {
1591
1653
  refresh_time_before_tokens_expiration_in_second: n.configuration.refresh_time_before_tokens_expiration_in_second
1592
1654
  },
1593
1655
  syncTokensInfoAsync: async () => {
1594
- const { status: _ } = await le(n)(
1656
+ const { status: _ } = await de(n)(
1595
1657
  n.configuration,
1596
1658
  n.configurationName,
1597
1659
  n.tokens,
@@ -1600,7 +1662,7 @@ const kn = () => {
1600
1662
  return _;
1601
1663
  },
1602
1664
  renewTokensAsync: n.renewTokensAsync.bind(n)
1603
- }, l = (await Ae(f))?.tokens?.accessToken;
1665
+ }, l = (await ve(f))?.tokens?.accessToken;
1604
1666
  if (c.has("Accept") || c.set("Accept", "application/json"), l) {
1605
1667
  if (n.configuration.demonstrating_proof_of_possession && t) {
1606
1668
  const _ = await n.generateDemonstrationOfProofOfPossessionAsync(
@@ -1613,9 +1675,9 @@ const kn = () => {
1613
1675
  c.set("Authorization", `Bearer ${l}`);
1614
1676
  a.credentials || (a.credentials = "same-origin");
1615
1677
  }
1616
- const d = { ...a, headers: c };
1617
- return await e(o, d, ...r);
1618
- }, En = (e) => async (n = !1, t = !1) => {
1678
+ const h = { ...a, headers: c };
1679
+ return await e(o, h, ...r);
1680
+ }, On = (e) => async (n = !1, t = !1) => {
1619
1681
  if (e.userInfo != null && !n)
1620
1682
  return e.userInfo;
1621
1683
  const s = !n && e.configuration.storage?.getItem(`oidc.${e.configurationName}.userInfo`);
@@ -1625,49 +1687,49 @@ const kn = () => {
1625
1687
  o.authority,
1626
1688
  o.authority_configuration
1627
1689
  )).userInfoEndpoint, c = await (async () => {
1628
- const u = await xe(fetch, e, t)(r);
1690
+ const u = await De(fetch, e, t)(r);
1629
1691
  return u.status !== 200 ? null : u.json();
1630
1692
  })();
1631
1693
  return e.userInfo = c, c && e.configuration.storage?.setItem(
1632
1694
  `oidc.${e.configurationName}.userInfo`,
1633
1695
  JSON.stringify(c)
1634
1696
  ), c;
1635
- }, On = () => fetch;
1636
- class oe {
1697
+ }, bn = () => fetch;
1698
+ class le {
1637
1699
  constructor(n) {
1638
1700
  this.authorizationEndpoint = n.authorization_endpoint, this.tokenEndpoint = n.token_endpoint, this.revocationEndpoint = n.revocation_endpoint, this.userInfoEndpoint = n.userinfo_endpoint, this.checkSessionIframe = n.check_session_iframe, this.issuer = n.issuer, this.endSessionEndpoint = n.end_session_endpoint;
1639
1701
  }
1640
1702
  }
1641
- const R = {}, bn = (e, n = new j()) => (t, s = "default") => (R[s] || (R[s] = new L(t, s, e, n)), R[s]), Pn = async (e) => {
1703
+ const R = {}, Pn = (e, n = new Q()) => (t, s = "default") => (R[s] || (R[s] = new W(t, s, e, n)), R[s]), In = async (e) => {
1642
1704
  const { parsedTokens: n, callbackPath: t, extras: s, scope: o } = await e.loginCallbackAsync();
1643
- return e.timeoutId = J(e, n.expiresAt, s, o), { callbackPath: t };
1644
- }, In = (e) => Math.floor(Math.random() * e), M = class M {
1645
- constructor(n, t = "default", s, o = new j()) {
1705
+ return e.timeoutId = G(e, n.expiresAt, s, o), { callbackPath: t };
1706
+ }, Nn = (e) => Math.floor(Math.random() * e), J = class J {
1707
+ constructor(n, t = "default", s, o = new Q()) {
1646
1708
  this.initPromise = null, this.tryKeepExistingSessionPromise = null, this.loginPromise = null, this.loginCallbackPromise = null, this.loginCallbackWithAutoTokensRenewPromise = null, this.userInfoPromise = null, this.renewTokensPromise = null, this.logoutPromise = null;
1647
1709
  let i = n.silent_login_uri;
1648
1710
  n.silent_redirect_uri && !n.silent_login_uri && (i = `${n.silent_redirect_uri.replace("-callback", "").replace("callback", "")}-login`);
1649
1711
  let r = n.refresh_time_before_tokens_expiration_in_second ?? 120;
1650
- r > 60 && (r = r - Math.floor(Math.random() * 40)), this.location = o ?? new j(), this.configuration = {
1712
+ r > 60 && (r = r - Math.floor(Math.random() * 40)), this.location = o ?? new Q(), this.configuration = {
1651
1713
  ...n,
1652
1714
  silent_login_uri: i,
1653
- token_automatic_renew_mode: n.token_automatic_renew_mode ?? B.AutomaticBeforeTokenExpiration,
1715
+ token_automatic_renew_mode: n.token_automatic_renew_mode ?? H.AutomaticBeforeTokenExpiration,
1654
1716
  monitor_session: n.monitor_session ?? !1,
1655
1717
  refresh_time_before_tokens_expiration_in_second: r,
1656
1718
  silent_login_timeout: n.silent_login_timeout ?? 12e3,
1657
- token_renew_mode: n.token_renew_mode ?? Z.access_token_or_id_token_invalid,
1719
+ token_renew_mode: n.token_renew_mode ?? oe.access_token_or_id_token_invalid,
1658
1720
  demonstrating_proof_of_possession: n.demonstrating_proof_of_possession ?? !1,
1659
1721
  authority_timeout_wellknowurl_in_millisecond: n.authority_timeout_wellknowurl_in_millisecond ?? 1e4,
1660
1722
  logout_tokens_to_invalidate: n.logout_tokens_to_invalidate ?? [
1661
1723
  "access_token",
1662
1724
  "refresh_token"
1663
1725
  ],
1664
- service_worker_activate: n.service_worker_activate ?? kn,
1665
- demonstrating_proof_of_possession_configuration: n.demonstrating_proof_of_possession_configuration ?? je,
1726
+ service_worker_activate: n.service_worker_activate ?? mn,
1727
+ demonstrating_proof_of_possession_configuration: n.demonstrating_proof_of_possession_configuration ?? qe,
1666
1728
  preload_user_info: n.preload_user_info ?? !1
1667
- }, this.getFetch = s ?? On, this.configurationName = t, this.tokens = null, this.userInfo = null, this.events = [], this.timeoutId = null, this.loginCallbackWithAutoTokensRenewAsync.bind(this), this.initAsync.bind(this), this.loginCallbackAsync.bind(this), this.subscribeEvents.bind(this), this.removeEventSubscription.bind(this), this.publishEvent.bind(this), this.destroyAsync.bind(this), this.logoutAsync.bind(this), this.renewTokensAsync.bind(this), this.initAsync(this.configuration.authority, this.configuration.authority_configuration);
1729
+ }, this.getFetch = s ?? bn, this.configurationName = t, this.tokens = null, this.userInfo = null, this.events = [], this.timeoutId = null, this.loginCallbackWithAutoTokensRenewAsync.bind(this), this.initAsync.bind(this), this.loginCallbackAsync.bind(this), this.subscribeEvents.bind(this), this.removeEventSubscription.bind(this), this.publishEvent.bind(this), this.destroyAsync.bind(this), this.logoutAsync.bind(this), this.renewTokensAsync.bind(this), this.initAsync(this.configuration.authority, this.configuration.authority_configuration);
1668
1730
  }
1669
1731
  subscribeEvents(n) {
1670
- const t = In(9999999999999).toString();
1732
+ const t = Nn(9999999999999).toString();
1671
1733
  return this.events.push({ id: t, func: n }), t;
1672
1734
  }
1673
1735
  removeEventSubscription(n) {
@@ -1688,7 +1750,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1688
1750
  }
1689
1751
  _silentLoginCallbackFromIFrame() {
1690
1752
  if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
1691
- const n = this.location, t = se(n.getCurrentHref());
1753
+ const n = this.location, t = ce(n.getCurrentHref());
1692
1754
  window.parent.postMessage(
1693
1755
  `${this.configurationName}_oidc_tokens:${JSON.stringify({ tokens: this.tokens, sessionState: t.session_state })}`,
1694
1756
  n.getOrigin()
@@ -1697,7 +1759,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1697
1759
  }
1698
1760
  _silentLoginErrorCallbackFromIFrame(n = null) {
1699
1761
  if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
1700
- const t = this.location, s = se(t.getCurrentHref());
1762
+ const t = this.location, s = ce(t.getCurrentHref());
1701
1763
  s.error ? window.parent.postMessage(
1702
1764
  `${this.configurationName}_oidc_error:${JSON.stringify({ error: s.error })}`,
1703
1765
  t.getOrigin()
@@ -1719,7 +1781,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1719
1781
  return this.initPromise;
1720
1782
  const s = async () => {
1721
1783
  if (t != null)
1722
- return new oe({
1784
+ return new le({
1723
1785
  authorization_endpoint: t.authorization_endpoint,
1724
1786
  end_session_endpoint: t.end_session_endpoint,
1725
1787
  revocation_endpoint: t.revocation_endpoint,
@@ -1728,8 +1790,8 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1728
1790
  check_session_iframe: t.check_session_iframe,
1729
1791
  issuer: t.issuer
1730
1792
  });
1731
- const i = await C(this.configuration, this.configurationName) ? this.configuration.storage || window.sessionStorage : this.configuration.storage;
1732
- return await cn(this.getFetch())(
1793
+ const i = await x(this.configuration, this.configurationName) ? this.configuration.storage || window.sessionStorage : this.configuration.storage;
1794
+ return await ln(this.getFetch())(
1733
1795
  n,
1734
1796
  this.configuration.authority_time_cache_wellknowurl_in_second ?? 3600,
1735
1797
  i,
@@ -1741,12 +1803,12 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1741
1803
  });
1742
1804
  }
1743
1805
  async tryKeepExistingSessionAsync() {
1744
- return this.tryKeepExistingSessionPromise !== null ? this.tryKeepExistingSessionPromise : (this.tryKeepExistingSessionPromise = mn(this), this.tryKeepExistingSessionPromise.finally(() => {
1806
+ return this.tryKeepExistingSessionPromise !== null ? this.tryKeepExistingSessionPromise : (this.tryKeepExistingSessionPromise = wn(this), this.tryKeepExistingSessionPromise.finally(() => {
1745
1807
  this.tryKeepExistingSessionPromise = null;
1746
1808
  }));
1747
1809
  }
1748
1810
  async startCheckSessionAsync(n, t, s, o = !1) {
1749
- await dn(this, R, this.configuration)(
1811
+ await gn(this, R, this.configuration)(
1750
1812
  n,
1751
1813
  t,
1752
1814
  s,
@@ -1754,13 +1816,13 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1754
1816
  );
1755
1817
  }
1756
1818
  async loginAsync(n = void 0, t = null, s = !1, o = void 0, i = !1) {
1757
- return this.logoutPromise && await this.logoutPromise, this.loginPromise !== null ? this.loginPromise : (i ? this.loginPromise = fn(
1819
+ return this.logoutPromise && await this.logoutPromise, this.loginPromise !== null ? this.loginPromise : (i ? this.loginPromise = dn(
1758
1820
  window,
1759
1821
  this.configurationName,
1760
1822
  this.configuration,
1761
1823
  this.publishEvent.bind(this),
1762
1824
  this
1763
- )(t, o) : this.loginPromise = pn(
1825
+ )(t, o) : this.loginPromise = An(
1764
1826
  this.configurationName,
1765
1827
  this.configuration,
1766
1828
  this.publishEvent.bind(this),
@@ -1774,8 +1836,12 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1774
1836
  if (this.loginCallbackPromise !== null)
1775
1837
  return this.loginCallbackPromise;
1776
1838
  const t = async () => {
1777
- const s = await An(this)(n), o = s.tokens;
1778
- return this.tokens = o, await C(this.configuration, this.configurationName) || N(this.configurationName, this.configuration.storage).setTokens(o), this.publishEvent(M.eventNames.token_acquired, o), this.configuration.preload_user_info && await this.userInfoAsync(), {
1839
+ const s = await Sn(this)(n), o = s.tokens;
1840
+ return this.tokens = o, await x(this.configuration, this.configurationName) || C(
1841
+ this.configurationName,
1842
+ this.configuration.storage,
1843
+ this.configuration.login_state_storage ?? this.configuration.storage
1844
+ ).setTokens(o), this.publishEvent(J.eventNames.token_acquired, o), this.configuration.preload_user_info && await this.userInfoAsync(), {
1779
1845
  parsedTokens: o,
1780
1846
  state: s.state,
1781
1847
  callbackPath: s.callbackPath,
@@ -1789,23 +1855,27 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1789
1855
  }
1790
1856
  async generateDemonstrationOfProofOfPossessionAsync(n, t, s, o = {}) {
1791
1857
  const i = this.configuration, r = {
1792
- ath: await Ie(n),
1858
+ ath: await xe(n),
1793
1859
  ...o
1794
1860
  };
1795
- if (await C(i, this.configurationName))
1796
- return `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${this.configurationName}#tabId=${ve(this.configurationName)}`;
1797
- const c = N(this.configurationName, i.storage), f = await c.getDemonstratingProofOfPossessionJwkAsync(), u = c.getDemonstratingProofOfPossessionNonce();
1798
- return u && (r.nonce = u), await be(window)(
1861
+ if (await x(i, this.configurationName))
1862
+ return `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${this.configurationName}#tabId=${be(this.configurationName)}`;
1863
+ const c = C(
1864
+ this.configurationName,
1865
+ i.storage,
1866
+ i.login_state_storage ?? i.storage
1867
+ ), f = await c.getDemonstratingProofOfPossessionJwkAsync(), u = c.getDemonstratingProofOfPossessionNonce();
1868
+ return u && (r.nonce = u), await Ne(window)(
1799
1869
  i.demonstrating_proof_of_possession_configuration
1800
1870
  )(f, s, t, r);
1801
1871
  }
1802
1872
  loginCallbackWithAutoTokensRenewAsync() {
1803
- return this.loginCallbackWithAutoTokensRenewPromise !== null ? this.loginCallbackWithAutoTokensRenewPromise : (this.loginCallbackWithAutoTokensRenewPromise = Pn(this), this.loginCallbackWithAutoTokensRenewPromise.finally(() => {
1873
+ return this.loginCallbackWithAutoTokensRenewPromise !== null ? this.loginCallbackWithAutoTokensRenewPromise : (this.loginCallbackWithAutoTokensRenewPromise = In(this), this.loginCallbackWithAutoTokensRenewPromise.finally(() => {
1804
1874
  this.loginCallbackWithAutoTokensRenewPromise = null;
1805
1875
  }));
1806
1876
  }
1807
1877
  userInfoAsync(n = !1, t = !1) {
1808
- return this.userInfoPromise !== null ? this.userInfoPromise : (this.userInfoPromise = En(this)(n, t), this.userInfoPromise.finally(() => {
1878
+ return this.userInfoPromise !== null ? this.userInfoPromise : (this.userInfoPromise = On(this)(n, t), this.userInfoPromise.finally(() => {
1809
1879
  this.userInfoPromise = null;
1810
1880
  }));
1811
1881
  }
@@ -1813,21 +1883,21 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1813
1883
  if (this.renewTokensPromise !== null)
1814
1884
  return this.renewTokensPromise;
1815
1885
  if (this.timeoutId)
1816
- return D.clearTimeout(this.timeoutId), this.renewTokensPromise = Ne(this, !0, n, t), this.renewTokensPromise.finally(() => {
1886
+ return $.clearTimeout(this.timeoutId), this.renewTokensPromise = We(this, !0, n, t), this.renewTokensPromise.finally(() => {
1817
1887
  this.renewTokensPromise = null;
1818
1888
  });
1819
1889
  }
1820
1890
  async destroyAsync(n) {
1821
- return await Tn(this)(n);
1891
+ return await vn(this)(n);
1822
1892
  }
1823
1893
  async logoutSameTabAsync(n, t) {
1824
- this.configuration.monitor_session && this.configuration.client_id === n && t && this.tokens && this.tokens.idTokenPayload && this.tokens.idTokenPayload.sub === t && (await this.destroyAsync("LOGGED_OUT"), this.publishEvent(p.logout_from_same_tab, { mmessage: "SessionMonitor", sub: t }));
1894
+ this.configuration.monitor_session && this.configuration.client_id === n && t && this.tokens && this.tokens.idTokenPayload && this.tokens.idTokenPayload.sub === t && (await this.destroyAsync("LOGGED_OUT"), this.publishEvent(k.logout_from_same_tab, { mmessage: "SessionMonitor", sub: t }));
1825
1895
  }
1826
1896
  async logoutOtherTabAsync(n, t) {
1827
- this.configuration.monitor_session && this.configuration.client_id === n && t && this.tokens && this.tokens.idTokenPayload && this.tokens.idTokenPayload.sub === t && (await this.destroyAsync("LOGGED_OUT"), this.publishEvent(p.logout_from_another_tab, { message: "SessionMonitor", sub: t }));
1897
+ this.configuration.monitor_session && this.configuration.client_id === n && t && this.tokens && this.tokens.idTokenPayload && this.tokens.idTokenPayload.sub === t && (await this.destroyAsync("LOGGED_OUT"), this.publishEvent(k.logout_from_another_tab, { message: "SessionMonitor", sub: t }));
1828
1898
  }
1829
1899
  async logoutAsync(n = void 0, t = null) {
1830
- return this.logoutPromise ? this.logoutPromise : (this.logoutPromise = vn(
1900
+ return this.logoutPromise ? this.logoutPromise : (this.logoutPromise = En(
1831
1901
  this,
1832
1902
  R,
1833
1903
  this.getFetch(),
@@ -1838,9 +1908,9 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1838
1908
  }));
1839
1909
  }
1840
1910
  };
1841
- M.getOrCreate = (n, t) => (s, o = "default") => bn(n, t)(s, o), M.eventNames = p;
1842
- let L = M;
1843
- const U = class U {
1911
+ J.getOrCreate = (n, t) => (s, o = "default") => Pn(n, t)(s, o), J.eventNames = k;
1912
+ let W = J;
1913
+ const V = class V {
1844
1914
  constructor(n) {
1845
1915
  this._oidc = n;
1846
1916
  }
@@ -1854,7 +1924,7 @@ const U = class U {
1854
1924
  this._oidc.publishEvent(n, t);
1855
1925
  }
1856
1926
  static get(n = "default") {
1857
- return new U(L.get(n));
1927
+ return new V(W.get(n));
1858
1928
  }
1859
1929
  tryKeepExistingSessionAsync() {
1860
1930
  return this._oidc.tryKeepExistingSessionAsync();
@@ -1896,7 +1966,7 @@ const U = class U {
1896
1966
  refresh_time_before_tokens_expiration_in_second: s.configuration.refresh_time_before_tokens_expiration_in_second
1897
1967
  },
1898
1968
  syncTokensInfoAsync: async () => {
1899
- const { status: i } = await le(s)(
1969
+ const { status: i } = await de(s)(
1900
1970
  s.configuration,
1901
1971
  s.configurationName,
1902
1972
  s.tokens,
@@ -1906,10 +1976,10 @@ const U = class U {
1906
1976
  },
1907
1977
  renewTokensAsync: s.renewTokensAsync.bind(s)
1908
1978
  };
1909
- return Ae(o, n, t);
1979
+ return ve(o, n, t);
1910
1980
  }
1911
1981
  fetchWithTokens(n, t = !1) {
1912
- return xe(n, this._oidc, t);
1982
+ return De(n, this._oidc, t);
1913
1983
  }
1914
1984
  async userInfoAsync(n = !1, t = !1) {
1915
1985
  return this._oidc.userInfoAsync(n, t);
@@ -1918,14 +1988,14 @@ const U = class U {
1918
1988
  return this._oidc.userInfo;
1919
1989
  }
1920
1990
  };
1921
- U.getOrCreate = (n, t = new j()) => (s, o = "default") => new U(L.getOrCreate(n, t)(s, o)), U.eventNames = L.eventNames;
1922
- let pe = U;
1991
+ V.getOrCreate = (n, t = new Q()) => (s, o = "default") => new V(W.getOrCreate(n, t)(s, o)), V.eventNames = W.eventNames;
1992
+ let Te = V;
1923
1993
  export {
1924
- pe as OidcClient,
1925
- j as OidcLocation,
1926
- B as TokenAutomaticRenewMode,
1927
- Z as TokenRenewMode,
1928
- On as getFetchDefault,
1929
- se as getParseQueryStringFromLocation,
1994
+ Te as OidcClient,
1995
+ Q as OidcLocation,
1996
+ H as TokenAutomaticRenewMode,
1997
+ oe as TokenRenewMode,
1998
+ bn as getFetchDefault,
1999
+ ce as getParseQueryStringFromLocation,
1930
2000
  Cn as getPath
1931
2001
  };