@axa-fr/oidc-client 7.25.13 → 7.25.14

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