@axa-fr/oidc-client 7.26.6 → 7.26.8

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 w = {
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",
@@ -77,93 +77,93 @@ const p = {
77
77
  syncTokensAsync_error: "syncTokensAsync_error",
78
78
  tokensInvalidAndWaitingActionsToRefresh: "tokensInvalidAndWaitingActionsToRefresh"
79
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 () => {
80
+ const t = (y) => (n[`oidc.${e}`] = JSON.stringify({ tokens: null, status: y }), delete n[`oidc.${e}.userInfo`], Promise.resolve()), s = 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 y = JSON.parse(n[`oidc.${e}`]);
84
+ return Promise.resolve({ tokens: y.tokens, status: y.status });
85
+ }, o = (y) => {
86
+ n[`oidc.${e}`] = JSON.stringify({ tokens: y });
87
+ }, i = async (y) => {
88
+ n[`oidc.session_state.${e}`] = y;
89
+ }, r = async () => n[`oidc.session_state.${e}`], a = (y) => {
90
+ n[`oidc.nonce.${e}`] = y.nonce;
91
+ }, c = (y) => {
92
+ n[`oidc.jwk.${e}`] = JSON.stringify(y);
93
+ }, _ = () => JSON.parse(n[`oidc.jwk.${e}`]), u = async () => ({ nonce: n[`oidc.nonce.${e}`] }), l = async (y) => {
94
+ n[`oidc.dpop_nonce.${e}`] = y;
95
+ }, h = () => n[`oidc.dpop_nonce.${e}`], f = () => n[`oidc.${e}`] ? JSON.stringify({ tokens: JSON.parse(n[`oidc.${e}`]).tokens }) : null, m = {};
96
96
  return {
97
97
  clearAsync: t,
98
98
  initAsync: s,
99
99
  setTokens: o,
100
- getTokens: _,
100
+ getTokens: f,
101
101
  setSessionStateAsync: i,
102
102
  getSessionStateAsync: r,
103
103
  setNonceAsync: a,
104
104
  getNonceAsync: u,
105
- setLoginParams: (h) => {
106
- w[e] = h, n[`oidc.login.${e}`] = JSON.stringify(h);
105
+ setLoginParams: (y) => {
106
+ m[e] = y, n[`oidc.login.${e}`] = JSON.stringify(y);
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 y = n[`oidc.login.${e}`];
110
+ return y ? (m[e] || (m[e] = JSON.parse(y)), m[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
114
  getStateAsync: async () => n[`oidc.state.${e}`],
115
- setStateAsync: async (h) => {
116
- n[`oidc.state.${e}`] = h;
115
+ setStateAsync: async (y) => {
116
+ n[`oidc.state.${e}`] = y;
117
117
  },
118
118
  getCodeVerifierAsync: async () => n[`oidc.code_verifier.${e}`],
119
- setCodeVerifierAsync: async (h) => {
120
- n[`oidc.code_verifier.${e}`] = h;
119
+ setCodeVerifierAsync: async (y) => {
120
+ n[`oidc.code_verifier.${e}`] = y;
121
121
  },
122
122
  setDemonstratingProofOfPossessionNonce: l,
123
- getDemonstratingProofOfPossessionNonce: d,
123
+ getDemonstratingProofOfPossessionNonce: h,
124
124
  setDemonstratingProofOfPossessionJwkAsync: c,
125
- getDemonstratingProofOfPossessionJwkAsync: f
125
+ getDemonstratingProofOfPossessionJwkAsync: _
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);
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;
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
+ let _;
161
+ e.expiresAt ? _ = e.expiresAt : t === oe.access_token_invalid ? _ = c : t === oe.id_token_invalid ? _ = a : _ = a < c ? a : c;
162
162
  const u = {
163
163
  ...e,
164
164
  idTokenPayload: r,
165
165
  accessTokenPayload: s,
166
- expiresAt: f,
166
+ expiresAt: _,
167
167
  idToken: i
168
168
  };
169
169
  if (n != null && "refreshToken" in n && !("refreshToken" in e)) {
@@ -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
+ O.REQUIRE_SYNC_TOKENS,
197
+ O.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID,
198
+ O.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.6";
248
- let ge = null, q;
249
- const ae = ({ milliseconds: e }) => new Promise((n) => D.setTimeout(n, e)), Te = (e = "/") => {
247
+ })(), te = "7.26.8";
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, P = (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(
@@ -280,229 +280,254 @@ const ae = ({ milliseconds: e }) => new Promise((n) => D.setTimeout(n, e)), Te =
280
280
  }
281
281
  const a = new MessageChannel();
282
282
  let c = null;
283
- const f = () => {
283
+ const _ = () => {
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(() => {
291
- f(), i(
290
+ c = $.setTimeout(() => {
291
+ _(), i(
292
292
  new Error(`Service worker did not respond within ${s}ms (type=${t?.type})`)
293
293
  );
294
294
  }, s), a.port1.onmessage = (u) => {
295
- f(), u?.data?.error ? i(u.data.error) : o(u.data);
295
+ _(), u?.data?.error ? i(u.data.error) : o(u.data);
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
- f(), i(u);
303
+ _(), 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
314
  }), C = 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 P(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 P(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 _ = async (d) => P(o)({ type: "clear", data: { status: d }, configurationName: n }), u = async (d, D, v) => {
367
+ const b = await P(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: v.token_renew_mode,
374
+ service_worker_convert_all_requests_to_cors: v.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 = b.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 (ge) {
392
+ console.error(ge);
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(b.tokens, null, v.token_renew_mode),
405
+ status: b.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) => P(o)({
385
410
  type: "setSessionState",
386
- data: { sessionState: k },
411
+ data: { sessionState: d },
387
412
  configurationName: n
388
- }), u = async () => (await O(o)({
413
+ }), f = async () => (await P(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, P(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 v = (await P(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 v || (v = sessionStorage[`oidc.nonce.${n}`], console.warn("nonce not found in service worker, using sessionStorage"), d && (await m(v), v = (await p(!1)).nonce)), { nonce: v };
428
+ }, g = {}, k = (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 P(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
+ }, E = async () => (await P(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, y = async (d) => {
444
+ const D = JSON.stringify(d);
445
+ await P(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
+ }, I = async () => {
451
+ const d = await P(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
+ }, x = async (d = !0) => {
458
+ let v = (await P(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 v || (v = sessionStorage[`oidc.state.${n}`], console.warn("state not found in service worker, using sessionStorage"), d && (await F(v), v = await x(!1))), v;
464
+ }, F = async (d) => (sessionStorage[`oidc.state.${n}`] = d, P(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 v = (await P(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 v || (v = sessionStorage[`oidc.code_verifier.${n}`], console.warn("codeVerifier not found in service worker, using sessionStorage"), d && (await T(v), v = await L(!1))), v;
475
+ }, T = async (d) => (sessionStorage[`oidc.code_verifier.${n}`] = d, P(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: _,
482
+ initAsync: u,
483
+ startKeepAliveServiceWorker: () => l(e.service_worker_keep_alive_path),
484
+ setSessionStateAsync: h,
485
+ getSessionStateAsync: f,
486
+ setNonceAsync: m,
487
+ getNonceAsync: p,
488
+ setLoginParams: k,
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: x,
491
+ setStateAsync: F,
492
+ getCodeVerifierAsync: L,
493
+ setCodeVerifierAsync: T,
494
+ setDemonstratingProofOfPossessionNonce: S,
495
+ getDemonstratingProofOfPossessionNonce: E,
496
+ setDemonstratingProofOfPossessionJwkAsync: y,
497
+ getDemonstratingProofOfPossessionJwkAsync: I
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, _ = ["sign"], u = await e.crypto.subtle.importKey("jwk", n, a, c, _), l = Pe(`${r.protected}.${r.payload}`), h = o.signAlgorithm, f = await e.crypto.subtle.sign(h, u, l);
562
+ return r.signature = fe(new Uint8Array(f)), `${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
- const f = await c.json();
631
- return He(r, f, s), new oe(f);
632
- }, H = (e) => async (n, t = {}, s = 1e4, o = 0) => {
655
+ const _ = await c.json();
656
+ return Ge(r, _, s), new le(_);
657
+ }, j = (e) => async (n, t = {}, s = 1e4, o = 0) => {
633
658
  let i;
634
659
  try {
635
660
  const r = new AbortController();
@@ -637,51 +662,51 @@ 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), f = encodeURIComponent(a[l]);
685
+ c.push(`${h}=${f}`);
661
686
  }
662
- const f = c.join("&");
663
- return (await H(e)(
687
+ const _ = c.join("&");
688
+ return (await j(e)(
664
689
  n,
665
690
  {
666
691
  method: "POST",
667
692
  headers: {
668
693
  "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
669
694
  },
670
- body: f
695
+ body: _
671
696
  },
672
697
  r
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 [f, m] of Object.entries(s))
703
+ t[f] === void 0 && (t[f] = m);
679
704
  const c = [];
680
- for (const _ in t) {
681
- const w = encodeURIComponent(_), A = encodeURIComponent(t[_]);
682
- c.push(`${w}=${A}`);
705
+ for (const f in t) {
706
+ const m = encodeURIComponent(f), p = encodeURIComponent(t[f]);
707
+ c.push(`${m}=${p}`);
683
708
  }
684
- const f = c.join("&"), u = await H(e)(
709
+ const _ = c.join("&"), u = await j(e)(
685
710
  n,
686
711
  {
687
712
  method: "POST",
@@ -689,7 +714,7 @@ const rn = (e) => {
689
714
  "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
690
715
  ...i
691
716
  },
692
- body: f
717
+ body: _
693
718
  },
694
719
  a
695
720
  );
@@ -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), f = encodeURIComponent(t[l]);
751
+ r.push(`${h}=${f}`);
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",
@@ -739,24 +764,24 @@ const rn = (e) => {
739
764
  );
740
765
  if (await Promise.all([e.setCodeVerifierAsync(null), e.setStateAsync(null)]), c.status !== 200)
741
766
  return { success: !1, status: c.status };
742
- let f = null;
743
- c.headers.has(Y) && (f = c.headers.get(
744
- Y
767
+ let _ = null;
768
+ c.headers.has(ee) && (_ = 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),
752
- demonstratingProofOfPossessionNonce: f
776
+ tokens: _e(u, null, o),
777
+ demonstratingProofOfPossessionNonce: _
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,
@@ -766,33 +791,33 @@ async function me(e, n, t, s = null) {
766
791
  );
767
792
  return await C(e.configuration, e.configurationName) || N(e.configurationName, e.configuration.storage).setTokens(e.tokens), e.tokens ? i : (await e.destroyAsync(r), null);
768
793
  }
769
- async function Ne(e, n = !1, t = null, s = null) {
794
+ async function We(e, n = !1, t = null, s = null) {
770
795
  const o = e.configuration, i = `${o.client_id}_${e.configurationName}_${o.authority}`;
771
796
  let r;
772
797
  const a = await C(e.configuration, e.configurationName);
773
798
  if (o?.storage === window?.sessionStorage && !a || !navigator.locks)
774
- r = await me(e, n, t, s);
799
+ r = await Ae(e, n, t, s);
775
800
  else {
776
801
  let c = "retry";
777
802
  for (; c === "retry"; )
778
803
  c = await navigator.locks.request(
779
804
  i,
780
805
  { ifAvailable: !0 },
781
- async (f) => f ? await me(e, n, t, s) : (e.publishEvent(L.eventNames.syncTokensAsync_lock_not_available, {
806
+ async (_) => _ ? await Ae(e, n, t, s) : (e.publishEvent(W.eventNames.syncTokensAsync_lock_not_available, {
782
807
  lock: "lock not available"
783
808
  }), "retry")
784
809
  );
785
810
  r = c;
786
811
  }
787
- return r ? (e.timeoutId && (e.timeoutId = J(e, e.tokens.expiresAt, t, s)), e.tokens) : null;
812
+ return r ? (e.timeoutId && (e.timeoutId = G(e, e.tokens.expiresAt, t, s)), e.tokens) : null;
788
813
  }
789
- const J = (e, n, t = null, s = null) => {
814
+ const G = (e, n, t = null, s = null) => {
790
815
  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);
816
+ return e.timeoutId && $.clearTimeout(e.timeoutId), $.setTimeout(async () => {
817
+ const r = { timeLeft: B(o, n) };
818
+ e.publishEvent(W.eventNames.token_timer, r), await We(e, !1, t, s);
794
819
  }, 1e3);
795
- }, E = {
820
+ }, O = {
796
821
  FORCE_REFRESH: "FORCE_REFRESH",
797
822
  SESSION_LOST: "SESSION_LOST",
798
823
  NOT_CONNECTED: "NOT_CONNECTED",
@@ -802,17 +827,17 @@ const J = (e, n, t = null, s = null) => {
802
827
  LOGOUT_FROM_ANOTHER_TAB: "LOGOUT_FROM_ANOTHER_TAB",
803
828
  REQUIRE_SYNC_TOKENS: "REQUIRE_SYNC_TOKENS",
804
829
  TOKENS_INVALID: "TOKENS_INVALID"
805
- }, le = (e) => async (n, t, s, o = !1) => {
830
+ }, de = (e) => async (n, t, s, o = !1) => {
806
831
  const i = { nonce: null };
807
832
  if (!s)
808
- return { tokens: null, status: E.NOT_CONNECTED, nonce: i };
833
+ return { tokens: null, status: O.NOT_CONNECTED, nonce: i };
809
834
  let r = i;
810
835
  const a = await e.initAsync(
811
836
  n.authority,
812
837
  n.authority_configuration
813
838
  ), c = await C(n, t);
814
839
  if (c) {
815
- const { status: l, tokens: d } = await c.initAsync(
840
+ const { status: l, tokens: h } = await c.initAsync(
816
841
  a,
817
842
  "syncTokensAsync",
818
843
  n
@@ -820,95 +845,95 @@ const J = (e, n, t = null, s = null) => {
820
845
  if (l === "LOGGED_OUT")
821
846
  return {
822
847
  tokens: null,
823
- status: E.LOGOUT_FROM_ANOTHER_TAB,
848
+ status: O.LOGOUT_FROM_ANOTHER_TAB,
824
849
  nonce: i
825
850
  };
826
851
  if (l === "SESSIONS_LOST")
827
- return { tokens: null, status: E.SESSION_LOST, nonce: i };
828
- if (!l || !d)
852
+ return { tokens: null, status: O.SESSION_LOST, nonce: i };
853
+ if (!l || !h)
829
854
  return {
830
855
  tokens: null,
831
- status: E.REQUIRE_SYNC_TOKENS,
856
+ status: O.REQUIRE_SYNC_TOKENS,
832
857
  nonce: i
833
858
  };
834
- if (d.issuedAt !== s.issuedAt) {
835
- const w = F(
859
+ if (h.issuedAt !== s.issuedAt) {
860
+ const m = B(
836
861
  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 };
862
+ h.expiresAt
863
+ ) > 0 ? O.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : O.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID, p = await c.getNonceAsync();
864
+ return { tokens: h, status: m, nonce: p };
840
865
  }
841
866
  r = await c.getNonceAsync();
842
867
  } 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 };
849
- if (_.issuedAt !== s.issuedAt) {
850
- const g = F(
868
+ const l = N(t, n.storage ?? sessionStorage), h = await l.initAsync();
869
+ let { tokens: f } = h;
870
+ const { status: m } = h;
871
+ if (f && (f = ue(f, e.tokens, n.token_renew_mode)), f) {
872
+ if (m === "SESSIONS_LOST")
873
+ return { tokens: null, status: O.SESSION_LOST, nonce: i };
874
+ if (f.issuedAt !== s.issuedAt) {
875
+ const g = B(
851
876
  n.refresh_time_before_tokens_expiration_in_second,
852
- _.expiresAt
853
- ) > 0 ? E.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : E.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID, y = await l.getNonceAsync();
854
- return { tokens: _, status: g, nonce: y };
877
+ f.expiresAt
878
+ ) > 0 ? O.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : O.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID, k = await l.getNonceAsync();
879
+ return { tokens: f, status: g, nonce: k };
855
880
  }
856
881
  } else return {
857
882
  tokens: null,
858
- status: E.LOGOUT_FROM_ANOTHER_TAB,
883
+ status: O.LOGOUT_FROM_ANOTHER_TAB,
859
884
  nonce: i
860
885
  };
861
886
  r = await l.getNonceAsync();
862
887
  }
863
- const u = F(
888
+ const u = B(
864
889
  n.refresh_time_before_tokens_expiration_in_second,
865
890
  s.expiresAt
866
891
  ) > 0 ? "TOKENS_VALID" : "TOKENS_INVALID";
867
892
  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) => {
893
+ }, z = (e) => async (n, t = 0, s = 0, o = !1, i = null, r = null) => {
869
894
  if (!navigator.onLine && document.hidden)
870
895
  return { tokens: e.tokens, status: "GIVE_UP" };
871
896
  let a = 6;
872
- const c = o ? 2 : 5, f = 5;
897
+ const c = o ? 2 : 5, _ = 5;
873
898
  for (; !navigator.onLine && a > 0; )
874
- await ae({ milliseconds: 1e3 }), a--, e.publishEvent(p.refreshTokensAsync, {
899
+ await ne({ milliseconds: 1e3 }), a--, e.publishEvent(w.refreshTokensAsync, {
875
900
  message: `wait because navigator is offline try ${a}`
876
901
  });
877
- const u = document.hidden, l = u ? t : t + 1, d = u ? s + 1 : s;
878
- if (t >= c || s >= f)
879
- return n(null), e.publishEvent(p.refreshTokensAsync_error, { message: "refresh token" }), { tokens: null, status: "SESSION_LOST" };
902
+ const u = document.hidden, l = u ? t : t + 1, h = u ? s + 1 : s;
903
+ if (t >= c || s >= _)
904
+ return n(null), e.publishEvent(w.refreshTokensAsync_error, { message: "refresh token" }), { tokens: null, status: "SESSION_LOST" };
880
905
  i || (i = {});
881
- const _ = e.configuration, w = (g, y = null, S = null) => ue(
906
+ const f = e.configuration, m = (g, k = null, A = null) => he(
882
907
  e.configurationName,
883
908
  e.configuration,
884
909
  e.publishEvent.bind(e)
885
- )(g, y, S), A = async () => {
910
+ )(g, k, A), p = async () => {
886
911
  try {
887
912
  let g;
888
- const y = await C(_, e.configurationName);
889
- y ? g = y.getLoginParams() : g = N(e.configurationName, _.storage).getLoginParams();
890
- const S = {};
913
+ const k = await C(f, e.configurationName);
914
+ k ? g = k.getLoginParams() : g = N(e.configurationName, f.storage).getLoginParams();
915
+ const A = {};
891
916
  if (g && g.extras)
892
- for (const [v, h] of Object.entries(g.extras))
893
- h != null && (S[v] = h);
917
+ for (const [E, y] of Object.entries(g.extras))
918
+ y != null && (A[E] = y);
894
919
  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, {
920
+ for (const [E, y] of Object.entries(i))
921
+ y != null && (A[E] = y);
922
+ A.prompt = "none", r && (A.scope = r);
923
+ const S = await m(A);
924
+ return S ? S.error ? (n(null), e.publishEvent(w.refreshTokensAsync_error, {
900
925
  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, {
926
+ }), { tokens: null, status: "SESSION_LOST" }) : (n(S.tokens), e.publishEvent(W.eventNames.token_renewed, {}), { tokens: S.tokens, status: "LOGGED" }) : (n(null), e.publishEvent(w.refreshTokensAsync_error, {
902
927
  message: "refresh token silent not active"
903
928
  }), { tokens: null, status: "SESSION_LOST" });
904
929
  } catch (g) {
905
- return console.error(g), e.publishEvent(p.refreshTokensAsync_silent_error, {
930
+ return console.error(g), e.publishEvent(w.refreshTokensAsync_silent_error, {
906
931
  message: "exceptionSilent",
907
932
  exception: g.message
908
- }), await G(e)(
933
+ }), await z(e)(
909
934
  n,
910
935
  l,
911
- d,
936
+ h,
912
937
  o,
913
938
  i,
914
939
  r
@@ -916,99 +941,99 @@ const J = (e, n, t = null, s = null) => {
916
941
  }
917
942
  };
918
943
  try {
919
- const { status: g, tokens: y, nonce: S } = await le(e)(
920
- _,
944
+ const { status: g, tokens: k, nonce: A } = await de(e)(
945
+ f,
921
946
  e.configurationName,
922
947
  e.tokens,
923
948
  o
924
949
  );
925
950
  switch (g) {
926
- case E.SESSION_LOST:
927
- return n(null), e.publishEvent(p.refreshTokensAsync_error, {
951
+ case O.SESSION_LOST:
952
+ return n(null), e.publishEvent(w.refreshTokensAsync_error, {
928
953
  message: "refresh token session lost"
929
954
  }), { tokens: null, status: "SESSION_LOST" };
930
- case E.NOT_CONNECTED:
955
+ case O.NOT_CONNECTED:
931
956
  return n(null), { tokens: null, status: null };
932
- case E.TOKENS_VALID:
933
- 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, {
957
+ case O.TOKENS_VALID:
958
+ return n(k), { tokens: k, status: "LOGGED_IN" };
959
+ case O.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID:
960
+ return n(k), e.publishEvent(W.eventNames.token_renewed, {
936
961
  reason: "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID"
937
- }), { tokens: y, status: "LOGGED_IN" };
938
- case E.LOGOUT_FROM_ANOTHER_TAB:
939
- return n(null), e.publishEvent(p.logout_from_another_tab, {
962
+ }), { tokens: k, status: "LOGGED_IN" };
963
+ case O.LOGOUT_FROM_ANOTHER_TAB:
964
+ return n(null), e.publishEvent(w.logout_from_another_tab, {
940
965
  status: "session syncTokensAsync"
941
966
  }), { 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());
967
+ case O.REQUIRE_SYNC_TOKENS:
968
+ return f.token_automatic_renew_mode == H.AutomaticOnlyWhenFetchExecuted && !o ? (e.publishEvent(w.tokensInvalidAndWaitingActionsToRefresh, {}), { tokens: e.tokens, status: "GIVE_UP" }) : (e.publishEvent(w.refreshTokensAsync_begin, { tryNumber: t }), await p());
944
969
  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, {
948
- refreshToken: y.refreshToken,
970
+ if (f.token_automatic_renew_mode == H.AutomaticOnlyWhenFetchExecuted && O.FORCE_REFRESH !== g)
971
+ return e.publishEvent(w.tokensInvalidAndWaitingActionsToRefresh, {}), { tokens: e.tokens, status: "GIVE_UP" };
972
+ if (e.publishEvent(w.refreshTokensAsync_begin, {
973
+ refreshToken: k.refreshToken,
949
974
  status: g,
950
975
  tryNumber: t,
951
976
  backgroundTry: s
952
- }), !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);
977
+ }), !k.refreshToken)
978
+ return await p();
979
+ const S = f.client_id, E = f.redirect_uri, y = f.authority, x = { ...f.token_request_extras ? f.token_request_extras : {} };
980
+ for (const [L, T] of Object.entries(i))
981
+ L.endsWith(":token_request") && (x[L.replace(":token_request", "")] = T);
957
982
  return await (async () => {
958
- const b = {
959
- client_id: T,
960
- redirect_uri: v,
983
+ const L = {
984
+ client_id: S,
985
+ redirect_uri: E,
961
986
  grant_type: "refresh_token",
962
- refresh_token: y.refreshToken
963
- }, m = await e.initAsync(
964
- h,
965
- _.authority_configuration
966
- ), W = document.hidden ? 1e4 : 3e4 * 10, V = m.tokenEndpoint, _e = {};
967
- _.demonstrating_proof_of_possession && (_e.DPoP = await e.generateDemonstrationOfProofOfPossessionAsync(
968
- y.accessToken,
969
- V,
987
+ refresh_token: k.refreshToken
988
+ }, T = await e.initAsync(
989
+ y,
990
+ f.authority_configuration
991
+ ), d = document.hidden ? 1e4 : 3e4 * 10, D = T.tokenEndpoint, v = {};
992
+ f.demonstrating_proof_of_possession && (v.DPoP = await e.generateDemonstrationOfProofOfPossessionAsync(
993
+ k.accessToken,
994
+ D,
970
995
  "POST"
971
996
  ));
972
- const I = await ln(e.getFetch())(
973
- V,
974
- b,
997
+ const b = await un(e.getFetch())(
998
+ D,
999
+ L,
975
1000
  x,
976
- y,
977
- _e,
978
- _.token_renew_mode,
979
- W
1001
+ k,
1002
+ v,
1003
+ f.token_renew_mode,
1004
+ d
980
1005
  );
981
- if (I.success) {
982
- const { isValid: We, reason: Le } = Se(
983
- I.data,
984
- S.nonce,
985
- m
1006
+ if (b.success) {
1007
+ const { isValid: q, reason: M } = Ee(
1008
+ b.data,
1009
+ A.nonce,
1010
+ T
986
1011
  );
987
- if (!We)
988
- return n(null), e.publishEvent(p.refreshTokensAsync_error, {
989
- message: `refresh token return not valid tokens, reason: ${Le}`
1012
+ if (!q)
1013
+ return n(null), e.publishEvent(w.refreshTokensAsync_error, {
1014
+ message: `refresh token return not valid tokens, reason: ${M}`
990
1015
  }), { 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
1016
+ if (n(b.data), b.demonstratingProofOfPossessionNonce) {
1017
+ const Y = await C(f, e.configurationName);
1018
+ Y ? await Y.setDemonstratingProofOfPossessionNonce(
1019
+ b.demonstratingProofOfPossessionNonce
1020
+ ) : await N(e.configurationName, f.storage).setDemonstratingProofOfPossessionNonce(
1021
+ b.demonstratingProofOfPossessionNonce
997
1022
  );
998
1023
  }
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" };
1024
+ return e.publishEvent(w.refreshTokensAsync_end, {
1025
+ success: b.success
1026
+ }), e.publishEvent(W.eventNames.token_renewed, { reason: "REFRESH_TOKEN" }), { tokens: b.data, status: "LOGGED_IN" };
1002
1027
  } else
1003
- return e.publishEvent(p.refreshTokensAsync_silent_error, {
1028
+ return e.publishEvent(w.refreshTokensAsync_silent_error, {
1004
1029
  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)(
1030
+ tokenResponse: b
1031
+ }), b.status >= 400 && b.status < 500 ? (n(null), e.publishEvent(w.refreshTokensAsync_error, {
1032
+ message: `session lost: ${b.status}`
1033
+ }), { tokens: null, status: "SESSION_LOST" }) : await z(e)(
1009
1034
  n,
1010
1035
  l,
1011
- d,
1036
+ h,
1012
1037
  o,
1013
1038
  i,
1014
1039
  r
@@ -1017,117 +1042,117 @@ const J = (e, n, t = null, s = null) => {
1017
1042
  }
1018
1043
  }
1019
1044
  } catch (g) {
1020
- return console.error(g), e.publishEvent(p.refreshTokensAsync_silent_error, {
1045
+ return console.error(g), e.publishEvent(w.refreshTokensAsync_silent_error, {
1021
1046
  message: "exception",
1022
1047
  exception: g.message
1023
- }), new Promise((y, S) => {
1048
+ }), new Promise((k, A) => {
1024
1049
  setTimeout(() => {
1025
- G(e)(
1050
+ z(e)(
1026
1051
  n,
1027
1052
  l,
1028
- d,
1053
+ h,
1029
1054
  o,
1030
1055
  i,
1031
1056
  r
1032
- ).then(y).catch(S);
1057
+ ).then(k).catch(A);
1033
1058
  }, 1e3);
1034
1059
  });
1035
1060
  }
1036
- }, ue = (e, n, t) => (s = null, o = null, i = null) => {
1061
+ }, he = (e, n, t) => (s = null, o = null, i = null) => {
1037
1062
  if (!n.silent_redirect_uri || !n.silent_login_uri)
1038
1063
  return Promise.resolve(null);
1039
1064
  try {
1040
- t(p.silentLoginAsync_begin, {});
1065
+ t(w.silentLoginAsync_begin, {});
1041
1066
  let r = "";
1042
1067
  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)}`);
1045
- 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) => {
1047
- let _ = !1;
1048
- const w = () => {
1049
- window.removeEventListener("message", A), u.remove(), _ = !0;
1050
- }, A = (g) => {
1051
- 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();
1068
+ for (const [l, h] of Object.entries(s))
1069
+ h != null && (r === "" ? r = `?${encodeURIComponent(l)}=${encodeURIComponent(h)}` : r += `&${encodeURIComponent(l)}=${encodeURIComponent(h)}`);
1070
+ const a = n.silent_login_uri + r, c = a.indexOf("/", a.indexOf("//") + 2), _ = a.substring(0, c), u = document.createElement("iframe");
1071
+ 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) => {
1072
+ let f = !1;
1073
+ const m = () => {
1074
+ window.removeEventListener("message", p), u.remove(), f = !0;
1075
+ }, p = (g) => {
1076
+ if (g.origin === _ && g.source === u.contentWindow) {
1077
+ const k = `${e}_oidc_tokens:`, A = `${e}_oidc_error:`, S = `${e}_oidc_exception:`, E = g.data;
1078
+ if (E && typeof E == "string" && !f) {
1079
+ if (E.startsWith(k)) {
1080
+ const y = JSON.parse(g.data.replace(k, ""));
1081
+ t(w.silentLoginAsync_end, {}), l(y), m();
1082
+ } else if (E.startsWith(A)) {
1083
+ const y = JSON.parse(g.data.replace(A, ""));
1084
+ t(w.silentLoginAsync_error, y), l({ error: "oidc_" + y.error, tokens: null, sessionState: null }), m();
1085
+ } else if (E.startsWith(S)) {
1086
+ const y = JSON.parse(g.data.replace(S, ""));
1087
+ t(w.silentLoginAsync_error, y), h(new Error(y.error)), m();
1063
1088
  }
1064
1089
  }
1065
1090
  }
1066
1091
  };
1067
1092
  try {
1068
- window.addEventListener("message", A);
1093
+ window.addEventListener("message", p);
1069
1094
  const g = n.silent_login_timeout;
1070
1095
  setTimeout(() => {
1071
- _ || (w(), t(p.silentLoginAsync_error, { reason: "timeout" }), d(new Error("timeout")));
1096
+ f || (m(), t(w.silentLoginAsync_error, { reason: "timeout" }), h(new Error("timeout")));
1072
1097
  }, g);
1073
1098
  } catch (g) {
1074
- w(), t(p.silentLoginAsync_error, g), d(g);
1099
+ m(), t(w.silentLoginAsync_error, g), h(g);
1075
1100
  }
1076
1101
  });
1077
1102
  } catch (r) {
1078
- throw t(p.silentLoginAsync_error, r), r;
1103
+ throw t(w.silentLoginAsync_error, r), r;
1079
1104
  }
1080
- }, fn = (e, n, t, s, o) => (i = null, r = void 0) => {
1105
+ }, dn = (e, n, t, s, o) => (i = null, r = void 0) => {
1081
1106
  i = { ...i };
1082
- const a = (f, u, l) => ue(n, t, s.bind(o))(
1083
- f,
1107
+ const a = (_, u, l) => he(n, t, s.bind(o))(
1108
+ _,
1084
1109
  u,
1085
1110
  l
1086
1111
  );
1087
1112
  return (async () => {
1088
- o.timeoutId && D.clearTimeout(o.timeoutId);
1089
- let f;
1090
- i && "state" in i && (f = i.state, delete i.state);
1113
+ o.timeoutId && $.clearTimeout(o.timeoutId);
1114
+ let _;
1115
+ i && "state" in i && (_ = i.state, delete i.state);
1091
1116
  try {
1092
1117
  const u = t.extras ? { ...t.extras, ...i } : i, l = await a(
1093
1118
  {
1094
1119
  ...u,
1095
1120
  prompt: "none"
1096
1121
  },
1097
- f,
1122
+ _,
1098
1123
  r
1099
1124
  );
1100
1125
  if (l)
1101
- return o.tokens = l.tokens, s(p.token_acquired, {}), o.timeoutId = J(o, o.tokens.expiresAt, i, r), {};
1126
+ return o.tokens = l.tokens, s(w.token_acquired, {}), o.timeoutId = G(o, o.tokens.expiresAt, i, r), {};
1102
1127
  } catch (u) {
1103
1128
  return u;
1104
1129
  }
1105
1130
  })();
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))(
1131
+ }, hn = (e, n, t) => (s, o, i, r = !1) => {
1132
+ const a = (c, _ = void 0, u = void 0) => he(e.configurationName, t, e.publishEvent.bind(e))(
1108
1133
  c,
1109
- f,
1134
+ _,
1110
1135
  u
1111
1136
  );
1112
- return new Promise((c, f) => {
1137
+ return new Promise((c, _) => {
1113
1138
  if (t.silent_login_uri && t.silent_redirect_uri && t.monitor_session && s && i && !r) {
1114
1139
  const u = () => {
1115
1140
  e.checkSessionIFrame.stop();
1116
1141
  const l = e.tokens;
1117
1142
  if (l === null)
1118
1143
  return;
1119
- const d = l.idToken, _ = l.idTokenPayload;
1144
+ const h = l.idToken, f = l.idTokenPayload;
1120
1145
  return a({
1121
1146
  prompt: "none",
1122
- id_token_hint: d,
1147
+ id_token_hint: h,
1123
1148
  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(
1149
+ }).then((m) => {
1150
+ if (m.error)
1151
+ throw new Error(m.error);
1152
+ const p = m.tokens.idTokenPayload;
1153
+ if (f.sub === p.sub) {
1154
+ const g = m.sessionState;
1155
+ e.checkSessionIFrame.start(m.sessionState), f.sid === p.sid ? console.debug(
1131
1156
  "SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:",
1132
1157
  g
1133
1158
  ) : console.debug(
@@ -1137,30 +1162,30 @@ const J = (e, n, t = null, s = null) => {
1137
1162
  } else
1138
1163
  console.debug(
1139
1164
  "SessionMonitor._callback: Different subject signed into OP:",
1140
- A.sub
1165
+ p.sub
1141
1166
  );
1142
- }).catch(async (w) => {
1167
+ }).catch(async (m) => {
1143
1168
  console.warn(
1144
1169
  "SessionMonitor._callback: Silent login failed, logging out other tabs:",
1145
- w
1170
+ m
1146
1171
  );
1147
- for (const [, A] of Object.entries(n))
1148
- await A.logoutOtherTabAsync(t.client_id, _.sub);
1172
+ for (const [, p] of Object.entries(n))
1173
+ await p.logoutOtherTabAsync(t.client_id, f.sub);
1149
1174
  });
1150
1175
  };
1151
- e.checkSessionIFrame = new De(
1176
+ e.checkSessionIFrame = new $e(
1152
1177
  u,
1153
1178
  o,
1154
1179
  s
1155
1180
  ), e.checkSessionIFrame.load().then(() => {
1156
1181
  e.checkSessionIFrame.start(i), c(e.checkSessionIFrame);
1157
1182
  }).catch((l) => {
1158
- f(l);
1183
+ _(l);
1159
1184
  });
1160
1185
  } else
1161
1186
  c(null);
1162
1187
  });
1163
- }, hn = (e) => !!(e.os === "iOS" && e.osVersion.startsWith("12") || e.os === "Mac OS X" && e.osVersion.startsWith("10_15_6")), gn = (e) => {
1188
+ }, gn = (e) => !!(e.os === "iOS" && e.osVersion.startsWith("12") || e.os === "Mac OS X" && e.osVersion.startsWith("10_15_6")), yn = (e) => {
1164
1189
  const n = e.appVersion, t = e.userAgent, s = "-";
1165
1190
  let o = s;
1166
1191
  const i = [
@@ -1220,7 +1245,7 @@ const J = (e, n, t = null, s = null) => {
1220
1245
  osVersion: r
1221
1246
  };
1222
1247
  };
1223
- function yn() {
1248
+ function kn() {
1224
1249
  const e = navigator.userAgent;
1225
1250
  let n, t = e.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
1226
1251
  if (/trident/i.test(t[1]))
@@ -1238,17 +1263,17 @@ function yn() {
1238
1263
  version: t[1]
1239
1264
  };
1240
1265
  }
1241
- const kn = () => {
1242
- const { name: e, version: n } = yn();
1266
+ const mn = () => {
1267
+ const { name: e, version: n } = kn();
1243
1268
  if (e === "chrome" && parseInt(n) <= 70 || e === "opera" && (!n || parseInt(n.split(".")[0]) < 80) || e === "ie")
1244
1269
  return !1;
1245
- const t = gn(navigator);
1246
- return !hn(t);
1247
- }, mn = async (e) => {
1270
+ const t = yn(navigator);
1271
+ return !gn(t);
1272
+ }, wn = async (e) => {
1248
1273
  let n;
1249
1274
  if (e.tokens != null)
1250
1275
  return !1;
1251
- e.publishEvent(p.tryKeepExistingSessionAsync_begin, {});
1276
+ e.publishEvent(w.tryKeepExistingSessionAsync_begin, {});
1252
1277
  try {
1253
1278
  const t = e.configuration, s = await e.initAsync(
1254
1279
  t.authority,
@@ -1263,7 +1288,7 @@ const kn = () => {
1263
1288
  if (o) {
1264
1289
  n.startKeepAliveServiceWorker(), e.tokens = o;
1265
1290
  const i = n.getLoginParams(e.configurationName);
1266
- e.timeoutId = J(
1291
+ e.timeoutId = G(
1267
1292
  e,
1268
1293
  e.tokens.expiresAt,
1269
1294
  i.extras,
@@ -1274,24 +1299,24 @@ const kn = () => {
1274
1299
  s.checkSessionIframe,
1275
1300
  t.client_id,
1276
1301
  r
1277
- ), t.preload_user_info && await e.userInfoAsync(), e.publishEvent(p.tryKeepExistingSessionAsync_end, {
1302
+ ), t.preload_user_info && await e.userInfoAsync(), e.publishEvent(w.tryKeepExistingSessionAsync_end, {
1278
1303
  success: !0,
1279
1304
  message: "tokens inside ServiceWorker are valid"
1280
1305
  }), !0;
1281
1306
  }
1282
- e.publishEvent(p.tryKeepExistingSessionAsync_end, {
1307
+ e.publishEvent(w.tryKeepExistingSessionAsync_end, {
1283
1308
  success: !1,
1284
1309
  message: "no exiting session found"
1285
1310
  });
1286
1311
  } else {
1287
- t.service_worker_relative_url && e.publishEvent(p.service_worker_not_supported_by_browser, {
1312
+ t.service_worker_relative_url && e.publishEvent(w.service_worker_not_supported_by_browser, {
1288
1313
  message: "service worker is not supported by this browser"
1289
1314
  });
1290
1315
  const o = N(e.configurationName, t.storage ?? sessionStorage), { tokens: i } = await o.initAsync();
1291
1316
  if (i) {
1292
- e.tokens = ie(i, null, t.token_renew_mode);
1317
+ e.tokens = ue(i, null, t.token_renew_mode);
1293
1318
  const r = o.getLoginParams();
1294
- e.timeoutId = J(
1319
+ e.timeoutId = G(
1295
1320
  e,
1296
1321
  e.tokens.expiresAt,
1297
1322
  r.extras,
@@ -1302,23 +1327,23 @@ const kn = () => {
1302
1327
  s.checkSessionIframe,
1303
1328
  t.client_id,
1304
1329
  a
1305
- ), t.preload_user_info && await e.userInfoAsync(), e.publishEvent(p.tryKeepExistingSessionAsync_end, {
1330
+ ), t.preload_user_info && await e.userInfoAsync(), e.publishEvent(w.tryKeepExistingSessionAsync_end, {
1306
1331
  success: !0,
1307
1332
  message: "tokens inside storage are valid"
1308
1333
  }), !0;
1309
1334
  }
1310
1335
  }
1311
- return e.publishEvent(p.tryKeepExistingSessionAsync_end, {
1336
+ return e.publishEvent(w.tryKeepExistingSessionAsync_end, {
1312
1337
  success: !1,
1313
1338
  message: n ? "service worker sessions not retrieved" : "session storage sessions not retrieved"
1314
1339
  }), !1;
1315
1340
  } catch (t) {
1316
1341
  return console.error(t), n && await n.clearAsync(), e.publishEvent(
1317
- p.tryKeepExistingSessionAsync_error,
1342
+ w.tryKeepExistingSessionAsync_error,
1318
1343
  "tokens inside ServiceWorker are invalid"
1319
1344
  ), !1;
1320
1345
  }
1321
- }, Ce = (e) => {
1346
+ }, Le = (e) => {
1322
1347
  const n = e.match(
1323
1348
  // eslint-disable-next-line no-useless-escape
1324
1349
  /^([a-z][\w-]+\:)\/\/(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/
@@ -1341,165 +1366,165 @@ const kn = () => {
1341
1366
  hash: s
1342
1367
  };
1343
1368
  }, Cn = (e) => {
1344
- const n = Ce(e);
1369
+ const n = Le(e);
1345
1370
  let { path: t } = n;
1346
1371
  t.endsWith("/") && (t = t.slice(0, -1));
1347
1372
  let { hash: s } = n;
1348
1373
  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) => {
1374
+ }, ce = (e) => {
1375
+ const n = Le(e), { search: t } = n;
1376
+ return pn(t);
1377
+ }, pn = (e) => {
1353
1378
  const n = {};
1354
1379
  let t, s, o;
1355
1380
  const i = e.split("&");
1356
1381
  for (s = 0, o = i.length; s < o; s++)
1357
1382
  t = i[s].split("="), n[decodeURIComponent(t[0])] = decodeURIComponent(t[1]);
1358
1383
  return n;
1359
- }, pn = (e, n, t, s, o) => (i = void 0, r = null, a = !1, c = void 0) => {
1360
- const f = r;
1384
+ }, An = (e, n, t, s, o) => (i = void 0, r = null, a = !1, c = void 0) => {
1385
+ const _ = r;
1361
1386
  return r = { ...r }, (async () => {
1362
1387
  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];
1388
+ if ("state" in r || (r.state = re(16)), t(w.loginAsync_begin, {}), r)
1389
+ for (const h of Object.keys(r))
1390
+ h.endsWith(":token_request") && delete r[h];
1366
1391
  try {
1367
- const d = a ? n.silent_redirect_uri : n.redirect_uri;
1392
+ const h = a ? n.silent_redirect_uri : n.redirect_uri;
1368
1393
  c || (c = n.scope);
1369
- 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(
1394
+ const f = n.extras ? { ...n.extras, ...r } : r;
1395
+ f.nonce || (f.nonce = re(12));
1396
+ const m = { nonce: f.nonce }, p = await C(n, e), g = await s(
1372
1397
  n.authority,
1373
1398
  n.authority_configuration
1374
1399
  );
1375
- 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;
1400
+ let k;
1401
+ if (p)
1402
+ p.setLoginParams({ callbackPath: l, extras: _, scope: c }), await p.initAsync(g, "loginAsync", n), await p.setNonceAsync(m), p.startKeepAliveServiceWorker(), k = p;
1378
1403
  else {
1379
- const T = N(e, n.storage ?? sessionStorage);
1380
- T.setLoginParams({ callbackPath: l, extras: f, scope: c }), await T.setNonceAsync(w), y = T;
1404
+ const S = N(e, n.storage ?? sessionStorage);
1405
+ S.setLoginParams({ callbackPath: l, extras: _, scope: c }), await S.setNonceAsync(m), k = S;
1381
1406
  }
1382
- const S = {
1407
+ const A = {
1383
1408
  client_id: n.client_id,
1384
- redirect_uri: d,
1409
+ redirect_uri: h,
1385
1410
  scope: c,
1386
1411
  response_type: "code",
1387
- ..._
1412
+ ...f
1388
1413
  };
1389
- await un(y, o)(
1414
+ await _n(k, o)(
1390
1415
  g.authorizationEndpoint,
1391
- S
1416
+ A
1392
1417
  );
1393
- } catch (d) {
1394
- throw t(p.loginAsync_error, d), d;
1418
+ } catch (h) {
1419
+ throw t(w.loginAsync_error, h), h;
1395
1420
  }
1396
1421
  })();
1397
- }, An = (e) => async (n = !1) => {
1422
+ }, Sn = (e) => async (n = !1) => {
1398
1423
  try {
1399
- e.publishEvent(p.loginCallbackAsync_begin, {});
1424
+ e.publishEvent(w.loginCallbackAsync_begin, {});
1400
1425
  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
1426
  i,
1402
1427
  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;
1428
+ ), c = e.location.getCurrentHref(), _ = ce(c), u = _.session_state, l = await C(t, e.configurationName);
1429
+ let h, f, m, p;
1405
1430
  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;
1431
+ await l.initAsync(a, "loginCallbackAsync", t), await l.setSessionStateAsync(u), f = await l.getNonceAsync(), m = l.getLoginParams(), p = await l.getStateAsync(), l.startKeepAliveServiceWorker(), h = l;
1407
1432
  else {
1408
- const m = N(
1433
+ const T = N(
1409
1434
  e.configurationName,
1410
1435
  t.storage ?? sessionStorage
1411
1436
  );
1412
- await m.setSessionStateAsync(u), _ = await m.getNonceAsync(), w = m.getLoginParams(), A = await m.getStateAsync(), d = m;
1437
+ await T.setSessionStateAsync(u), f = await T.getNonceAsync(), m = T.getLoginParams(), p = await T.getStateAsync(), h = T;
1413
1438
  }
1414
- if (f.error || f.error_description)
1439
+ if (_.error || _.error_description)
1415
1440
  throw new Error(
1416
- `Error from OIDC server: ${f.error} - ${f.error_description}`
1441
+ `Error from OIDC server: ${_.error} - ${_.error_description}`
1417
1442
  );
1418
- if (f.iss && f.iss !== a.issuer)
1443
+ if (_.iss && _.iss !== a.issuer)
1419
1444
  throw console.error(), new Error(
1420
- `Issuer not valid (expected: ${a.issuer}, received: ${f.iss})`
1445
+ `Issuer not valid (expected: ${a.issuer}, received: ${_.iss})`
1421
1446
  );
1422
- if (f.state && f.state !== A)
1423
- throw new Error(`State not valid (expected: ${A}, received: ${f.state})`);
1447
+ if (_.state && _.state !== p)
1448
+ throw new Error(`State not valid (expected: ${p}, received: ${_.state})`);
1424
1449
  const g = {
1425
- code: f.code,
1450
+ code: _.code,
1426
1451
  grant_type: "authorization_code",
1427
1452
  client_id: t.client_id,
1428
1453
  redirect_uri: o
1429
- }, y = {};
1454
+ }, k = {};
1430
1455
  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 = {};
1456
+ for (const [T, d] of Object.entries(t.token_request_extras))
1457
+ k[T] = d;
1458
+ if (m?.extras)
1459
+ for (const [T, d] of Object.entries(m.extras))
1460
+ T.endsWith(":token_request") && (k[T.replace(":token_request", "")] = d);
1461
+ const A = a.tokenEndpoint, S = {};
1437
1462
  if (t.demonstrating_proof_of_possession)
1438
1463
  if (l)
1439
- T.DPoP = `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${e.configurationName}`;
1464
+ S.DPoP = `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${e.configurationName}`;
1440
1465
  else {
1441
- const m = await nn(window)(
1466
+ const T = await tn(window)(
1442
1467
  t.demonstrating_proof_of_possession_configuration.generateKeyAlgorithm
1443
1468
  );
1444
- await N(e.configurationName, t.storage).setDemonstratingProofOfPossessionJwkAsync(m), T.DPoP = await be(window)(
1469
+ await N(e.configurationName, t.storage).setDemonstratingProofOfPossessionJwkAsync(T), S.DPoP = await Ne(window)(
1445
1470
  t.demonstrating_proof_of_possession_configuration
1446
- )(m, "POST", S);
1471
+ )(T, "POST", A);
1447
1472
  }
1448
- const v = await _n(d)(
1473
+ const E = await fn(h)(
1474
+ A,
1475
+ { ...g, ...k },
1449
1476
  S,
1450
- { ...g, ...y },
1451
- T,
1452
1477
  e.configuration.token_renew_mode,
1453
1478
  r
1454
1479
  );
1455
- if (!v.success)
1480
+ if (!E.success)
1456
1481
  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)
1482
+ let y;
1483
+ const I = E.data.tokens, x = E.data.demonstratingProofOfPossessionNonce;
1484
+ if (E.data.state !== k.state)
1460
1485
  throw new Error("state is not valid");
1461
- const { isValid: k, reason: b } = Se(
1462
- P,
1463
- _.nonce,
1486
+ const { isValid: F, reason: L } = Ee(
1487
+ I,
1488
+ f.nonce,
1464
1489
  a
1465
1490
  );
1466
- if (!k)
1467
- throw new Error(`Tokens are not OpenID valid, reason: ${b}`);
1491
+ if (!F)
1492
+ throw new Error(`Tokens are not OpenID valid, reason: ${L}`);
1468
1493
  if (l) {
1469
- if (P.refreshToken && !P.refreshToken.includes("SECURED_BY_OIDC_SERVICE_WORKER"))
1494
+ if (I.refreshToken && !I.refreshToken.includes("SECURED_BY_OIDC_SERVICE_WORKER"))
1470
1495
  throw new Error("Refresh token should be hidden by service worker");
1471
- if (x && P?.accessToken.includes("SECURED_BY_OIDC_SERVICE_WORKER"))
1496
+ if (x && I?.accessToken.includes("SECURED_BY_OIDC_SERVICE_WORKER"))
1472
1497
  throw new Error(
1473
1498
  "Demonstration of proof of possession require Access token not hidden by service worker"
1474
1499
  );
1475
1500
  }
1476
1501
  if (l)
1477
- await l.initAsync(a, "syncTokensAsync", t), h = l.getLoginParams(), x && await l.setDemonstratingProofOfPossessionNonce(
1502
+ await l.initAsync(a, "syncTokensAsync", t), y = l.getLoginParams(), x && await l.setDemonstratingProofOfPossessionNonce(
1478
1503
  x
1479
1504
  );
1480
1505
  else {
1481
- const m = N(e.configurationName, t.storage);
1482
- h = m.getLoginParams(), x && await m.setDemonstratingProofOfPossessionNonce(x);
1506
+ const T = N(e.configurationName, t.storage);
1507
+ y = T.getLoginParams(), x && await T.setDemonstratingProofOfPossessionNonce(x);
1483
1508
  }
1484
1509
  return await e.startCheckSessionAsync(
1485
1510
  a.checkSessionIframe,
1486
1511
  s,
1487
1512
  u,
1488
1513
  n
1489
- ), e.publishEvent(p.loginCallbackAsync_end, {}), {
1490
- tokens: P,
1514
+ ), e.publishEvent(w.loginCallbackAsync_end, {}), {
1515
+ tokens: I,
1491
1516
  state: "request.state",
1492
- callbackPath: h.callbackPath,
1493
- scope: f.scope,
1494
- extras: h.extras
1517
+ callbackPath: y.callbackPath,
1518
+ scope: _.scope,
1519
+ extras: y.extras
1495
1520
  };
1496
1521
  } catch (t) {
1497
- throw console.error(t), e.publishEvent(p.loginCallbackAsync_error, t), t;
1522
+ throw console.error(t), e.publishEvent(w.loginCallbackAsync_error, t), t;
1498
1523
  }
1499
- }, we = {
1524
+ }, Se = {
1500
1525
  access_token: "access_token",
1501
1526
  refresh_token: "refresh_token"
1502
- }, Q = (e, n) => {
1527
+ }, se = (e, n) => {
1503
1528
  const t = {};
1504
1529
  if (e) {
1505
1530
  for (const [s, o] of Object.entries(e))
@@ -1510,7 +1535,7 @@ const kn = () => {
1510
1535
  return t;
1511
1536
  }
1512
1537
  return t;
1513
- }, Sn = (e) => {
1538
+ }, Tn = (e) => {
1514
1539
  const n = {};
1515
1540
  if (e) {
1516
1541
  for (const [t, s] of Object.entries(e))
@@ -1518,104 +1543,104 @@ const kn = () => {
1518
1543
  return n;
1519
1544
  }
1520
1545
  return n;
1521
- }, Tn = (e) => async (n) => {
1522
- D.clearTimeout(e.timeoutId), e.timeoutId = null, e.checkSessionIFrame && e.checkSessionIFrame.stop();
1546
+ }, vn = (e) => async (n) => {
1547
+ $.clearTimeout(e.timeoutId), e.timeoutId = null, e.checkSessionIFrame && e.checkSessionIFrame.stop();
1523
1548
  const t = await C(e.configuration, e.configurationName);
1524
1549
  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) => {
1550
+ }, En = (e, n, t, s, o) => async (i = void 0, r = null) => {
1526
1551
  const a = e.configuration, c = await e.initAsync(
1527
1552
  a.authority,
1528
1553
  a.authority_configuration
1529
1554
  );
1530
1555
  i && typeof i != "string" && (i = void 0, s.warn("callbackPathOrUrl path is not a string"));
1531
- const f = i ?? o.getPath();
1556
+ const _ = i ?? o.getPath();
1532
1557
  let u = !1;
1533
1558
  i && (u = i.includes("https://") || i.includes("http://"));
1534
- const l = u ? i : o.getOrigin() + f, d = e.tokens ? e.tokens.idToken : "";
1559
+ const l = u ? i : o.getOrigin() + _, h = e.tokens ? e.tokens.idToken : "";
1535
1560
  try {
1536
- const y = c.revocationEndpoint;
1537
- 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)(
1541
- y,
1542
- T,
1543
- te.access_token,
1561
+ const k = c.revocationEndpoint;
1562
+ if (k) {
1563
+ const A = [], S = e.tokens ? e.tokens.accessToken : null;
1564
+ if (S && a.logout_tokens_to_invalidate.includes(Se.access_token)) {
1565
+ const y = se(r, ":revoke_access_token"), I = pe(t)(
1566
+ k,
1567
+ S,
1568
+ ae.access_token,
1544
1569
  a.client_id,
1545
- h
1570
+ y
1546
1571
  );
1547
- S.push(P);
1572
+ A.push(I);
1548
1573
  }
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)(
1552
- y,
1553
- v,
1554
- te.refresh_token,
1574
+ const E = e.tokens ? e.tokens.refreshToken : null;
1575
+ if (E && a.logout_tokens_to_invalidate.includes(Se.refresh_token)) {
1576
+ const y = se(r, ":revoke_refresh_token"), I = pe(t)(
1577
+ k,
1578
+ E,
1579
+ ae.refresh_token,
1555
1580
  a.client_id,
1556
- h
1581
+ y
1557
1582
  );
1558
- S.push(P);
1583
+ A.push(I);
1559
1584
  }
1560
- S.length > 0 && await Promise.all(S);
1585
+ A.length > 0 && await Promise.all(A);
1561
1586
  }
1562
- } catch (y) {
1587
+ } catch (k) {
1563
1588
  s.warn(
1564
1589
  "logoutAsync: error when revoking tokens, if the error persist, you ay configure property logout_tokens_to_invalidate from configuration to avoid this error"
1565
- ), s.warn(y);
1590
+ ), s.warn(k);
1566
1591
  }
1567
- const _ = e.tokens?.idTokenPayload?.sub ?? null;
1592
+ const f = e.tokens?.idTokenPayload?.sub ?? null;
1568
1593
  await e.destroyAsync("LOGGED_OUT");
1569
- 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")
1594
+ for (const [, k] of Object.entries(n))
1595
+ k !== e ? await e.logoutSameTabAsync(e.configuration.client_id, f) : e.publishEvent(w.logout_from_same_tab, {});
1596
+ const m = se(r, ":oidc");
1597
+ if (m && m.no_reload === "true")
1573
1598
  return;
1574
- const g = Sn(r);
1599
+ const g = Tn(r);
1575
1600
  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);
1577
- let y = "";
1578
- for (const [S, T] of Object.entries(g))
1579
- T != null && (y === "" ? y += "?" : y += "&", y += `${S}=${encodeURIComponent(T)}`);
1580
- o.open(`${c.endSessionEndpoint}${y}`);
1601
+ "id_token_hint" in g || (g.id_token_hint = h), !("post_logout_redirect_uri" in g) && i !== null && (g.post_logout_redirect_uri = l);
1602
+ let k = "";
1603
+ for (const [A, S] of Object.entries(g))
1604
+ S != null && (k === "" ? k += "?" : k += "&", k += `${A}=${encodeURIComponent(S)}`);
1605
+ o.open(`${c.endSessionEndpoint}${k}`);
1581
1606
  } else
1582
1607
  o.reload();
1583
- }, xe = (e, n, t = !1) => async (...s) => {
1608
+ }, De = (e, n, t = !1) => async (...s) => {
1584
1609
  const [o, i, ...r] = s, a = i ? { ...i } : { method: "GET" };
1585
1610
  let c = new Headers();
1586
1611
  a.headers && (c = a.headers instanceof Headers ? a.headers : new Headers(a.headers));
1587
- const f = {
1612
+ const _ = {
1588
1613
  getTokens: () => n.tokens,
1589
1614
  configuration: {
1590
1615
  token_automatic_renew_mode: n.configuration.token_automatic_renew_mode,
1591
1616
  refresh_time_before_tokens_expiration_in_second: n.configuration.refresh_time_before_tokens_expiration_in_second
1592
1617
  },
1593
1618
  syncTokensInfoAsync: async () => {
1594
- const { status: _ } = await le(n)(
1619
+ const { status: f } = await de(n)(
1595
1620
  n.configuration,
1596
1621
  n.configurationName,
1597
1622
  n.tokens,
1598
1623
  !1
1599
1624
  );
1600
- return _;
1625
+ return f;
1601
1626
  },
1602
1627
  renewTokensAsync: n.renewTokensAsync.bind(n)
1603
- }, l = (await Ae(f))?.tokens?.accessToken;
1628
+ }, l = (await ve(_))?.tokens?.accessToken;
1604
1629
  if (c.has("Accept") || c.set("Accept", "application/json"), l) {
1605
1630
  if (n.configuration.demonstrating_proof_of_possession && t) {
1606
- const _ = await n.generateDemonstrationOfProofOfPossessionAsync(
1631
+ const f = await n.generateDemonstrationOfProofOfPossessionAsync(
1607
1632
  l,
1608
1633
  o.toString(),
1609
1634
  a.method
1610
1635
  );
1611
- c.set("Authorization", `DPoP ${l}`), c.set("DPoP", _);
1636
+ c.set("Authorization", `DPoP ${l}`), c.set("DPoP", f);
1612
1637
  } else
1613
1638
  c.set("Authorization", `Bearer ${l}`);
1614
1639
  a.credentials || (a.credentials = "same-origin");
1615
1640
  }
1616
- const d = { ...a, headers: c };
1617
- return await e(o, d, ...r);
1618
- }, En = (e) => async (n = !1, t = !1) => {
1641
+ const h = { ...a, headers: c };
1642
+ return await e(o, h, ...r);
1643
+ }, On = (e) => async (n = !1, t = !1) => {
1619
1644
  if (e.userInfo != null && !n)
1620
1645
  return e.userInfo;
1621
1646
  const s = !n && e.configuration.storage?.getItem(`oidc.${e.configurationName}.userInfo`);
@@ -1625,49 +1650,49 @@ const kn = () => {
1625
1650
  o.authority,
1626
1651
  o.authority_configuration
1627
1652
  )).userInfoEndpoint, c = await (async () => {
1628
- const u = await xe(fetch, e, t)(r);
1653
+ const u = await De(fetch, e, t)(r);
1629
1654
  return u.status !== 200 ? null : u.json();
1630
1655
  })();
1631
1656
  return e.userInfo = c, c && e.configuration.storage?.setItem(
1632
1657
  `oidc.${e.configurationName}.userInfo`,
1633
1658
  JSON.stringify(c)
1634
1659
  ), c;
1635
- }, On = () => fetch;
1636
- class oe {
1660
+ }, bn = () => fetch;
1661
+ class le {
1637
1662
  constructor(n) {
1638
1663
  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
1664
  }
1640
1665
  }
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) => {
1666
+ 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
1667
  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()) {
1668
+ return e.timeoutId = G(e, n.expiresAt, s, o), { callbackPath: t };
1669
+ }, Nn = (e) => Math.floor(Math.random() * e), J = class J {
1670
+ constructor(n, t = "default", s, o = new Q()) {
1646
1671
  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
1672
  let i = n.silent_login_uri;
1648
1673
  n.silent_redirect_uri && !n.silent_login_uri && (i = `${n.silent_redirect_uri.replace("-callback", "").replace("callback", "")}-login`);
1649
1674
  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 = {
1675
+ r > 60 && (r = r - Math.floor(Math.random() * 40)), this.location = o ?? new Q(), this.configuration = {
1651
1676
  ...n,
1652
1677
  silent_login_uri: i,
1653
- token_automatic_renew_mode: n.token_automatic_renew_mode ?? B.AutomaticBeforeTokenExpiration,
1678
+ token_automatic_renew_mode: n.token_automatic_renew_mode ?? H.AutomaticBeforeTokenExpiration,
1654
1679
  monitor_session: n.monitor_session ?? !1,
1655
1680
  refresh_time_before_tokens_expiration_in_second: r,
1656
1681
  silent_login_timeout: n.silent_login_timeout ?? 12e3,
1657
- token_renew_mode: n.token_renew_mode ?? Z.access_token_or_id_token_invalid,
1682
+ token_renew_mode: n.token_renew_mode ?? oe.access_token_or_id_token_invalid,
1658
1683
  demonstrating_proof_of_possession: n.demonstrating_proof_of_possession ?? !1,
1659
1684
  authority_timeout_wellknowurl_in_millisecond: n.authority_timeout_wellknowurl_in_millisecond ?? 1e4,
1660
1685
  logout_tokens_to_invalidate: n.logout_tokens_to_invalidate ?? [
1661
1686
  "access_token",
1662
1687
  "refresh_token"
1663
1688
  ],
1664
- service_worker_activate: n.service_worker_activate ?? kn,
1665
- demonstrating_proof_of_possession_configuration: n.demonstrating_proof_of_possession_configuration ?? je,
1689
+ service_worker_activate: n.service_worker_activate ?? mn,
1690
+ demonstrating_proof_of_possession_configuration: n.demonstrating_proof_of_possession_configuration ?? qe,
1666
1691
  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);
1692
+ }, 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
1693
  }
1669
1694
  subscribeEvents(n) {
1670
- const t = In(9999999999999).toString();
1695
+ const t = Nn(9999999999999).toString();
1671
1696
  return this.events.push({ id: t, func: n }), t;
1672
1697
  }
1673
1698
  removeEventSubscription(n) {
@@ -1688,7 +1713,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1688
1713
  }
1689
1714
  _silentLoginCallbackFromIFrame() {
1690
1715
  if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
1691
- const n = this.location, t = se(n.getCurrentHref());
1716
+ const n = this.location, t = ce(n.getCurrentHref());
1692
1717
  window.parent.postMessage(
1693
1718
  `${this.configurationName}_oidc_tokens:${JSON.stringify({ tokens: this.tokens, sessionState: t.session_state })}`,
1694
1719
  n.getOrigin()
@@ -1697,7 +1722,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1697
1722
  }
1698
1723
  _silentLoginErrorCallbackFromIFrame(n = null) {
1699
1724
  if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
1700
- const t = this.location, s = se(t.getCurrentHref());
1725
+ const t = this.location, s = ce(t.getCurrentHref());
1701
1726
  s.error ? window.parent.postMessage(
1702
1727
  `${this.configurationName}_oidc_error:${JSON.stringify({ error: s.error })}`,
1703
1728
  t.getOrigin()
@@ -1719,7 +1744,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1719
1744
  return this.initPromise;
1720
1745
  const s = async () => {
1721
1746
  if (t != null)
1722
- return new oe({
1747
+ return new le({
1723
1748
  authorization_endpoint: t.authorization_endpoint,
1724
1749
  end_session_endpoint: t.end_session_endpoint,
1725
1750
  revocation_endpoint: t.revocation_endpoint,
@@ -1729,7 +1754,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1729
1754
  issuer: t.issuer
1730
1755
  });
1731
1756
  const i = await C(this.configuration, this.configurationName) ? this.configuration.storage || window.sessionStorage : this.configuration.storage;
1732
- return await cn(this.getFetch())(
1757
+ return await ln(this.getFetch())(
1733
1758
  n,
1734
1759
  this.configuration.authority_time_cache_wellknowurl_in_second ?? 3600,
1735
1760
  i,
@@ -1741,12 +1766,12 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1741
1766
  });
1742
1767
  }
1743
1768
  async tryKeepExistingSessionAsync() {
1744
- return this.tryKeepExistingSessionPromise !== null ? this.tryKeepExistingSessionPromise : (this.tryKeepExistingSessionPromise = mn(this), this.tryKeepExistingSessionPromise.finally(() => {
1769
+ return this.tryKeepExistingSessionPromise !== null ? this.tryKeepExistingSessionPromise : (this.tryKeepExistingSessionPromise = wn(this), this.tryKeepExistingSessionPromise.finally(() => {
1745
1770
  this.tryKeepExistingSessionPromise = null;
1746
1771
  }));
1747
1772
  }
1748
1773
  async startCheckSessionAsync(n, t, s, o = !1) {
1749
- await dn(this, R, this.configuration)(
1774
+ await hn(this, R, this.configuration)(
1750
1775
  n,
1751
1776
  t,
1752
1777
  s,
@@ -1754,13 +1779,13 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1754
1779
  );
1755
1780
  }
1756
1781
  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(
1782
+ return this.logoutPromise && await this.logoutPromise, this.loginPromise !== null ? this.loginPromise : (i ? this.loginPromise = dn(
1758
1783
  window,
1759
1784
  this.configurationName,
1760
1785
  this.configuration,
1761
1786
  this.publishEvent.bind(this),
1762
1787
  this
1763
- )(t, o) : this.loginPromise = pn(
1788
+ )(t, o) : this.loginPromise = An(
1764
1789
  this.configurationName,
1765
1790
  this.configuration,
1766
1791
  this.publishEvent.bind(this),
@@ -1774,8 +1799,8 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1774
1799
  if (this.loginCallbackPromise !== null)
1775
1800
  return this.loginCallbackPromise;
1776
1801
  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(), {
1802
+ const s = await Sn(this)(n), o = s.tokens;
1803
+ return this.tokens = o, await C(this.configuration, this.configurationName) || N(this.configurationName, this.configuration.storage).setTokens(o), this.publishEvent(J.eventNames.token_acquired, o), this.configuration.preload_user_info && await this.userInfoAsync(), {
1779
1804
  parsedTokens: o,
1780
1805
  state: s.state,
1781
1806
  callbackPath: s.callbackPath,
@@ -1789,23 +1814,23 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1789
1814
  }
1790
1815
  async generateDemonstrationOfProofOfPossessionAsync(n, t, s, o = {}) {
1791
1816
  const i = this.configuration, r = {
1792
- ath: await Ie(n),
1817
+ ath: await xe(n),
1793
1818
  ...o
1794
1819
  };
1795
1820
  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)(
1821
+ return `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${this.configurationName}#tabId=${be(this.configurationName)}`;
1822
+ const c = N(this.configurationName, i.storage), _ = await c.getDemonstratingProofOfPossessionJwkAsync(), u = c.getDemonstratingProofOfPossessionNonce();
1823
+ return u && (r.nonce = u), await Ne(window)(
1799
1824
  i.demonstrating_proof_of_possession_configuration
1800
- )(f, s, t, r);
1825
+ )(_, s, t, r);
1801
1826
  }
1802
1827
  loginCallbackWithAutoTokensRenewAsync() {
1803
- return this.loginCallbackWithAutoTokensRenewPromise !== null ? this.loginCallbackWithAutoTokensRenewPromise : (this.loginCallbackWithAutoTokensRenewPromise = Pn(this), this.loginCallbackWithAutoTokensRenewPromise.finally(() => {
1828
+ return this.loginCallbackWithAutoTokensRenewPromise !== null ? this.loginCallbackWithAutoTokensRenewPromise : (this.loginCallbackWithAutoTokensRenewPromise = In(this), this.loginCallbackWithAutoTokensRenewPromise.finally(() => {
1804
1829
  this.loginCallbackWithAutoTokensRenewPromise = null;
1805
1830
  }));
1806
1831
  }
1807
1832
  userInfoAsync(n = !1, t = !1) {
1808
- return this.userInfoPromise !== null ? this.userInfoPromise : (this.userInfoPromise = En(this)(n, t), this.userInfoPromise.finally(() => {
1833
+ return this.userInfoPromise !== null ? this.userInfoPromise : (this.userInfoPromise = On(this)(n, t), this.userInfoPromise.finally(() => {
1809
1834
  this.userInfoPromise = null;
1810
1835
  }));
1811
1836
  }
@@ -1813,21 +1838,21 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1813
1838
  if (this.renewTokensPromise !== null)
1814
1839
  return this.renewTokensPromise;
1815
1840
  if (this.timeoutId)
1816
- return D.clearTimeout(this.timeoutId), this.renewTokensPromise = Ne(this, !0, n, t), this.renewTokensPromise.finally(() => {
1841
+ return $.clearTimeout(this.timeoutId), this.renewTokensPromise = We(this, !0, n, t), this.renewTokensPromise.finally(() => {
1817
1842
  this.renewTokensPromise = null;
1818
1843
  });
1819
1844
  }
1820
1845
  async destroyAsync(n) {
1821
- return await Tn(this)(n);
1846
+ return await vn(this)(n);
1822
1847
  }
1823
1848
  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 }));
1849
+ 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(w.logout_from_same_tab, { mmessage: "SessionMonitor", sub: t }));
1825
1850
  }
1826
1851
  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 }));
1852
+ 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(w.logout_from_another_tab, { message: "SessionMonitor", sub: t }));
1828
1853
  }
1829
1854
  async logoutAsync(n = void 0, t = null) {
1830
- return this.logoutPromise ? this.logoutPromise : (this.logoutPromise = vn(
1855
+ return this.logoutPromise ? this.logoutPromise : (this.logoutPromise = En(
1831
1856
  this,
1832
1857
  R,
1833
1858
  this.getFetch(),
@@ -1838,9 +1863,9 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1838
1863
  }));
1839
1864
  }
1840
1865
  };
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 {
1866
+ J.getOrCreate = (n, t) => (s, o = "default") => Pn(n, t)(s, o), J.eventNames = w;
1867
+ let W = J;
1868
+ const V = class V {
1844
1869
  constructor(n) {
1845
1870
  this._oidc = n;
1846
1871
  }
@@ -1854,7 +1879,7 @@ const U = class U {
1854
1879
  this._oidc.publishEvent(n, t);
1855
1880
  }
1856
1881
  static get(n = "default") {
1857
- return new U(L.get(n));
1882
+ return new V(W.get(n));
1858
1883
  }
1859
1884
  tryKeepExistingSessionAsync() {
1860
1885
  return this._oidc.tryKeepExistingSessionAsync();
@@ -1896,7 +1921,7 @@ const U = class U {
1896
1921
  refresh_time_before_tokens_expiration_in_second: s.configuration.refresh_time_before_tokens_expiration_in_second
1897
1922
  },
1898
1923
  syncTokensInfoAsync: async () => {
1899
- const { status: i } = await le(s)(
1924
+ const { status: i } = await de(s)(
1900
1925
  s.configuration,
1901
1926
  s.configurationName,
1902
1927
  s.tokens,
@@ -1906,10 +1931,10 @@ const U = class U {
1906
1931
  },
1907
1932
  renewTokensAsync: s.renewTokensAsync.bind(s)
1908
1933
  };
1909
- return Ae(o, n, t);
1934
+ return ve(o, n, t);
1910
1935
  }
1911
1936
  fetchWithTokens(n, t = !1) {
1912
- return xe(n, this._oidc, t);
1937
+ return De(n, this._oidc, t);
1913
1938
  }
1914
1939
  async userInfoAsync(n = !1, t = !1) {
1915
1940
  return this._oidc.userInfoAsync(n, t);
@@ -1918,14 +1943,14 @@ const U = class U {
1918
1943
  return this._oidc.userInfo;
1919
1944
  }
1920
1945
  };
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;
1946
+ V.getOrCreate = (n, t = new Q()) => (s, o = "default") => new V(W.getOrCreate(n, t)(s, o)), V.eventNames = W.eventNames;
1947
+ let Te = V;
1923
1948
  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,
1949
+ Te as OidcClient,
1950
+ Q as OidcLocation,
1951
+ H as TokenAutomaticRenewMode,
1952
+ oe as TokenRenewMode,
1953
+ bn as getFetchDefault,
1954
+ ce as getParseQueryStringFromLocation,
1930
1955
  Cn as getPath
1931
1956
  };