@apicurio/common-ui-components 2.0.4 → 2.0.6

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/main.js CHANGED
@@ -1,23 +1,23 @@
1
- import j, { createContext as gt, useContext as ut, useState as I, useEffect as Te, memo as Ie, forwardRef as ee, useCallback as Ne, useMemo as qe } from "react";
2
- import { jsx as a, jsxs as f, Fragment as ae } from "react/jsx-runtime";
3
- import { EmptyState as te, EmptyStateVariant as _t, EmptyStateHeader as se, EmptyStateBody as ue, Spinner as X, Alert as pt, Dropdown as ft, MenuToggle as ce, DropdownList as mt, Divider as Je, DropdownItem as wt, Select as Ee, SelectOption as Ce, TextInput as _e, Button as pe, TextArea as vt, Modal as Re, Form as St, FormGroup as je, EmptyStateIcon as Be, AboutModal as bt, TextContent as yt, Text as He, TextVariants as Le, TextList as Me, TextListItem as y, Progress as kt, Pagination as Tt, PaginationVariant as It, Skeleton as Et, SearchInput as Ct, SelectList as Rt, ToolbarItem as xt, InputGroup as Ut, ToolbarToggleGroup as At, ToolbarGroup as Pt, ToolbarFilter as Ot } from "@patternfly/react-core";
4
- import { EllipsisVIcon as Nt, ChevronDownIcon as qt, ChevronRightIcon as jt, ErrorCircleOIcon as Ht, FilterIcon as Ve } from "@patternfly/react-icons";
5
- import { DateTime as de } from "luxon";
6
- import { Tr as ie, Td as xe, Th as Lt, Table as Mt, Thead as Ft, Tbody as Dt, ActionsColumn as $t } from "@patternfly/react-table";
1
+ import $, { createContext as gt, useContext as ut, useState as k, useEffect as Ce, memo as Pe, forwardRef as re, useCallback as Ne, useMemo as qe } from "react";
2
+ import { jsx as a, jsxs as v, Fragment as Re } from "react/jsx-runtime";
3
+ import { Tooltip as _t, EmptyState as ne, EmptyStateVariant as pt, EmptyStateHeader as oe, EmptyStateBody as me, Spinner as ee, Alert as ft, Dropdown as mt, MenuToggle as Je, DropdownList as wt, Divider as Ke, DropdownItem as vt, Select as St, SelectOption as yt, TextInput as ae, Button as ce, TextArea as bt, AboutModal as kt, TextContent as Tt, Text as De, TextVariants as Le, TextList as je, TextListItem as b, Modal as Ue, Form as Be, FormGroup as He, Progress as It, EmptyStateIcon as ze, ChipGroup as Et, Chip as Ct, InputGroup as Pt, ButtonVariant as Rt, Pagination as Ut, PaginationVariant as xt, Skeleton as At } from "@patternfly/react-core";
4
+ import { EllipsisVIcon as Ot, ChevronDownIcon as Nt, ChevronRightIcon as qt, ErrorCircleOIcon as Dt, SearchIcon as Lt } from "@patternfly/react-icons";
5
+ import { DateTime as se } from "luxon";
6
+ import { Tr as le, Td as xe, Th as jt, Table as Ht, Thead as $t, Tbody as Mt, ActionsColumn as Ft } from "@patternfly/react-table";
7
7
  import Wt from "use-resize-observer";
8
- const Kt = gt({
8
+ const Jt = gt({
9
9
  type: "none"
10
10
  });
11
- class V extends Error {
11
+ class Y extends Error {
12
12
  }
13
- V.prototype.name = "InvalidTokenError";
14
- function zt(e) {
13
+ Y.prototype.name = "InvalidTokenError";
14
+ function Kt(e) {
15
15
  return decodeURIComponent(atob(e).replace(/(.)/g, (t, s) => {
16
16
  let i = s.charCodeAt(0).toString(16).toUpperCase();
17
17
  return i.length < 2 && (i = "0" + i), "%" + i;
18
18
  }));
19
19
  }
20
- function Jt(e) {
20
+ function Bt(e) {
21
21
  let t = e.replace(/-/g, "+").replace(/_/g, "/");
22
22
  switch (t.length % 4) {
23
23
  case 0:
@@ -32,28 +32,28 @@ function Jt(e) {
32
32
  throw new Error("base64 string is not of the correct length");
33
33
  }
34
34
  try {
35
- return zt(t);
35
+ return Kt(t);
36
36
  } catch {
37
37
  return atob(t);
38
38
  }
39
39
  }
40
- function Bt(e, t) {
40
+ function zt(e, t) {
41
41
  if (typeof e != "string")
42
- throw new V("Invalid token specified: must be a string");
42
+ throw new Y("Invalid token specified: must be a string");
43
43
  t || (t = {});
44
44
  const s = t.header === !0 ? 0 : 1, i = e.split(".")[s];
45
45
  if (typeof i != "string")
46
- throw new V(`Invalid token specified: missing part #${s + 1}`);
46
+ throw new Y(`Invalid token specified: missing part #${s + 1}`);
47
47
  let r;
48
48
  try {
49
- r = Jt(i);
49
+ r = Bt(i);
50
50
  } catch (n) {
51
- throw new V(`Invalid token specified: invalid base64 for part #${s + 1} (${n.message})`);
51
+ throw new Y(`Invalid token specified: invalid base64 for part #${s + 1} (${n.message})`);
52
52
  }
53
53
  try {
54
54
  return JSON.parse(r);
55
55
  } catch (n) {
56
- throw new V(`Invalid token specified: invalid json for part #${s + 1} (${n.message})`);
56
+ throw new Y(`Invalid token specified: invalid json for part #${s + 1} (${n.message})`);
57
57
  }
58
58
  }
59
59
  var Vt = {
@@ -65,39 +65,39 @@ var Vt = {
65
65
  },
66
66
  error: () => {
67
67
  }
68
- }, N, q, re = /* @__PURE__ */ ((e) => (e[e.NONE = 0] = "NONE", e[e.ERROR = 1] = "ERROR", e[e.WARN = 2] = "WARN", e[e.INFO = 3] = "INFO", e[e.DEBUG = 4] = "DEBUG", e))(re || {});
68
+ }, j, H, de = /* @__PURE__ */ ((e) => (e[e.NONE = 0] = "NONE", e[e.ERROR = 1] = "ERROR", e[e.WARN = 2] = "WARN", e[e.INFO = 3] = "INFO", e[e.DEBUG = 4] = "DEBUG", e))(de || {});
69
69
  ((e) => {
70
70
  function t() {
71
- N = 3, q = Vt;
71
+ j = 3, H = Vt;
72
72
  }
73
73
  e.reset = t;
74
74
  function s(r) {
75
75
  if (!(0 <= r && r <= 4))
76
76
  throw new Error("Invalid log level");
77
- N = r;
77
+ j = r;
78
78
  }
79
79
  e.setLevel = s;
80
80
  function i(r) {
81
- q = r;
81
+ H = r;
82
82
  }
83
83
  e.setLogger = i;
84
- })(re || (re = {}));
85
- var u = class O {
84
+ })(de || (de = {}));
85
+ var u = class D {
86
86
  constructor(t) {
87
87
  this._name = t;
88
88
  }
89
89
  /* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */
90
90
  debug(...t) {
91
- N >= 4 && q.debug(O._format(this._name, this._method), ...t);
91
+ j >= 4 && H.debug(D._format(this._name, this._method), ...t);
92
92
  }
93
93
  info(...t) {
94
- N >= 3 && q.info(O._format(this._name, this._method), ...t);
94
+ j >= 3 && H.info(D._format(this._name, this._method), ...t);
95
95
  }
96
96
  warn(...t) {
97
- N >= 2 && q.warn(O._format(this._name, this._method), ...t);
97
+ j >= 2 && H.warn(D._format(this._name, this._method), ...t);
98
98
  }
99
99
  error(...t) {
100
- N >= 1 && q.error(O._format(this._name, this._method), ...t);
100
+ j >= 1 && H.error(D._format(this._name, this._method), ...t);
101
101
  }
102
102
  /* eslint-enable @typescript-eslint/no-unsafe-enum-comparison */
103
103
  throw(t) {
@@ -108,7 +108,7 @@ var u = class O {
108
108
  return s._method = t, s.debug("begin"), s;
109
109
  }
110
110
  static createStatic(t, s) {
111
- const i = new O(`${t}.${s}`);
111
+ const i = new D(`${t}.${s}`);
112
112
  return i.debug("begin"), i;
113
113
  }
114
114
  static _format(t, s) {
@@ -118,21 +118,41 @@ var u = class O {
118
118
  /* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */
119
119
  // helpers for static class methods
120
120
  static debug(t, ...s) {
121
- N >= 4 && q.debug(O._format(t), ...s);
121
+ j >= 4 && H.debug(D._format(t), ...s);
122
122
  }
123
123
  static info(t, ...s) {
124
- N >= 3 && q.info(O._format(t), ...s);
124
+ j >= 3 && H.info(D._format(t), ...s);
125
125
  }
126
126
  static warn(t, ...s) {
127
- N >= 2 && q.warn(O._format(t), ...s);
127
+ j >= 2 && H.warn(D._format(t), ...s);
128
128
  }
129
129
  static error(t, ...s) {
130
- N >= 1 && q.error(O._format(t), ...s);
130
+ j >= 1 && H.error(D._format(t), ...s);
131
131
  }
132
132
  /* eslint-enable @typescript-eslint/no-unsafe-enum-comparison */
133
133
  };
134
- re.reset();
135
- var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")), z = class G {
134
+ de.reset();
135
+ var he = class {
136
+ // IMPORTANT: doesn't validate the token
137
+ static decode(e) {
138
+ try {
139
+ return zt(e);
140
+ } catch (t) {
141
+ throw u.error("JwtUtils.decode", t), t;
142
+ }
143
+ }
144
+ static async generateSignedJwt(e, t, s) {
145
+ const i = C.encodeBase64Url(new TextEncoder().encode(JSON.stringify(e))), r = C.encodeBase64Url(new TextEncoder().encode(JSON.stringify(t))), n = `${i}.${r}`, o = await window.crypto.subtle.sign(
146
+ {
147
+ name: "ECDSA",
148
+ hash: { name: "SHA-256" }
149
+ },
150
+ s,
151
+ new TextEncoder().encode(n)
152
+ ), c = C.encodeBase64Url(new Uint8Array(o));
153
+ return `${n}.${c}`;
154
+ }
155
+ }, Gt = "10000000-1000-4000-8000-100000000000", we = (e) => btoa([...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")), Ve = class L {
136
156
  static _randomWord() {
137
157
  const t = new Uint32Array(1);
138
158
  return crypto.getRandomValues(t), t[0];
@@ -143,14 +163,14 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
143
163
  static generateUUIDv4() {
144
164
  return Gt.replace(
145
165
  /[018]/g,
146
- (s) => (+s ^ G._randomWord() & 15 >> +s / 4).toString(16)
166
+ (s) => (+s ^ L._randomWord() & 15 >> +s / 4).toString(16)
147
167
  ).replace(/-/g, "");
148
168
  }
149
169
  /**
150
170
  * PKCE: Generate a code verifier
151
171
  */
152
172
  static generateCodeVerifier() {
153
- return G.generateUUIDv4() + G.generateUUIDv4() + G.generateUUIDv4();
173
+ return L.generateUUIDv4() + L.generateUUIDv4() + L.generateUUIDv4();
154
174
  }
155
175
  /**
156
176
  * PKCE: Generate a code challenge
@@ -160,7 +180,7 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
160
180
  throw new Error("Crypto.subtle is available only in secure contexts (HTTPS).");
161
181
  try {
162
182
  const i = new TextEncoder().encode(t), r = await crypto.subtle.digest("SHA-256", i);
163
- return Fe(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
183
+ return we(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
164
184
  } catch (s) {
165
185
  throw u.error("CryptoUtils.generateCodeChallenge", s), s;
166
186
  }
@@ -170,11 +190,112 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
170
190
  */
171
191
  static generateBasicAuth(t, s) {
172
192
  const r = new TextEncoder().encode([t, s].join(":"));
173
- return Fe(r);
193
+ return we(r);
194
+ }
195
+ /**
196
+ * Generates a hash of a string using a given algorithm
197
+ * @param alg
198
+ * @param message
199
+ */
200
+ static async hash(t, s) {
201
+ const i = new TextEncoder().encode(s), r = await crypto.subtle.digest(t, i);
202
+ return new Uint8Array(r);
203
+ }
204
+ /**
205
+ * Generates a rfc7638 compliant jwk thumbprint
206
+ * @param jwk
207
+ */
208
+ static async customCalculateJwkThumbprint(t) {
209
+ let s;
210
+ switch (t.kty) {
211
+ case "RSA":
212
+ s = {
213
+ e: t.e,
214
+ kty: t.kty,
215
+ n: t.n
216
+ };
217
+ break;
218
+ case "EC":
219
+ s = {
220
+ crv: t.crv,
221
+ kty: t.kty,
222
+ x: t.x,
223
+ y: t.y
224
+ };
225
+ break;
226
+ case "OKP":
227
+ s = {
228
+ crv: t.crv,
229
+ kty: t.kty,
230
+ x: t.x
231
+ };
232
+ break;
233
+ case "oct":
234
+ s = {
235
+ crv: t.k,
236
+ kty: t.kty
237
+ };
238
+ break;
239
+ default:
240
+ throw new Error("Unknown jwk type");
241
+ }
242
+ const i = await L.hash("SHA-256", JSON.stringify(s));
243
+ return L.encodeBase64Url(i);
244
+ }
245
+ static async generateDPoPProof({
246
+ url: t,
247
+ accessToken: s,
248
+ httpMethod: i,
249
+ keyPair: r,
250
+ nonce: n
251
+ }) {
252
+ let o, c;
253
+ const l = {
254
+ jti: window.crypto.randomUUID(),
255
+ htm: i ?? "GET",
256
+ htu: t,
257
+ iat: Math.floor(Date.now() / 1e3)
258
+ };
259
+ s && (o = await L.hash("SHA-256", s), c = L.encodeBase64Url(o), l.ath = c), n && (l.nonce = n);
260
+ try {
261
+ const d = await crypto.subtle.exportKey("jwk", r.publicKey), h = {
262
+ alg: "ES256",
263
+ typ: "dpop+jwt",
264
+ jwk: {
265
+ crv: d.crv,
266
+ kty: d.kty,
267
+ x: d.x,
268
+ y: d.y
269
+ }
270
+ };
271
+ return await he.generateSignedJwt(h, l, r.privateKey);
272
+ } catch (d) {
273
+ throw d instanceof TypeError ? new Error(`Error exporting dpop public key: ${d.message}`) : d;
274
+ }
275
+ }
276
+ static async generateDPoPJkt(t) {
277
+ try {
278
+ const s = await crypto.subtle.exportKey("jwk", t.publicKey);
279
+ return await L.customCalculateJwkThumbprint(s);
280
+ } catch (s) {
281
+ throw s instanceof TypeError ? new Error(`Could not retrieve dpop keys from storage: ${s.message}`) : s;
282
+ }
283
+ }
284
+ static async generateDPoPKeys() {
285
+ return await window.crypto.subtle.generateKey(
286
+ {
287
+ name: "ECDSA",
288
+ namedCurve: "P-256"
289
+ },
290
+ !1,
291
+ ["sign", "verify"]
292
+ );
174
293
  }
175
- }, F = class {
294
+ };
295
+ Ve.encodeBase64Url = (e) => we(e).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
296
+ var C = Ve, W = class {
176
297
  constructor(e) {
177
- this._name = e, this._logger = new u(`Event('${this._name}')`), this._callbacks = [];
298
+ this._name = e, this._callbacks = [], this._logger = new u(`Event('${this._name}')`);
178
299
  }
179
300
  addHandler(e) {
180
301
  return this._callbacks.push(e), () => this.removeHandler(e);
@@ -188,16 +309,7 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
188
309
  for (const t of this._callbacks)
189
310
  await t(...e);
190
311
  }
191
- }, fe = class {
192
- // IMPORTANT: doesn't validate the token
193
- static decode(e) {
194
- try {
195
- return Bt(e);
196
- } catch (t) {
197
- throw u.error("JwtUtils.decode", t), t;
198
- }
199
- }
200
- }, De = class {
312
+ }, $e = class {
201
313
  /**
202
314
  * Populates a map of window features with a placement centered in front of
203
315
  * the current window. If no explicit width is given, a default value is
@@ -210,11 +322,11 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
210
322
  static serialize(e) {
211
323
  return Object.entries(e).filter(([, t]) => t != null).map(([t, s]) => `${t}=${typeof s != "boolean" ? s : s ? "yes" : "no"}`).join(",");
212
324
  }
213
- }, M = class Z extends F {
325
+ }, F = class ie extends W {
214
326
  constructor() {
215
327
  super(...arguments), this._logger = new u(`Timer('${this._name}')`), this._timerHandle = null, this._expiration = 0, this._callback = () => {
216
- const t = this._expiration - Z.getEpochTime();
217
- this._logger.debug("timer completes in", t), this._expiration <= Z.getEpochTime() && (this.cancel(), super.raise());
328
+ const t = this._expiration - ie.getEpochTime();
329
+ this._logger.debug("timer completes in", t), this._expiration <= ie.getEpochTime() && (this.cancel(), super.raise());
218
330
  };
219
331
  }
220
332
  // get the time
@@ -224,7 +336,7 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
224
336
  init(t) {
225
337
  const s = this._logger.create("init");
226
338
  t = Math.max(Math.floor(t), 1);
227
- const i = Z.getEpochTime() + t;
339
+ const i = ie.getEpochTime() + t;
228
340
  if (this.expiration === i && this._timerHandle) {
229
341
  s.debug("skipping since already initialized for expiration at", this.expiration);
230
342
  return;
@@ -239,27 +351,26 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
239
351
  cancel() {
240
352
  this._logger.create("cancel"), this._timerHandle && (clearInterval(this._timerHandle), this._timerHandle = null);
241
353
  }
242
- }, me = class {
354
+ }, ve = class {
243
355
  static readParams(e, t = "query") {
244
- if (!e)
245
- throw new TypeError("Invalid URL");
356
+ if (!e) throw new TypeError("Invalid URL");
246
357
  const i = new URL(e, "http://127.0.0.1")[t === "fragment" ? "hash" : "search"];
247
358
  return new URLSearchParams(i.slice(1));
248
359
  }
249
- }, we = ";", W = class extends Error {
360
+ }, Se = ";", B = class extends Error {
250
361
  constructor(e, t) {
251
362
  var s, i, r;
252
363
  if (super(e.error_description || e.error || ""), this.form = t, this.name = "ErrorResponse", !e.error)
253
364
  throw u.error("ErrorResponse", "No error passed"), new Error("No error passed");
254
365
  this.error = e.error, this.error_description = (s = e.error_description) != null ? s : null, this.error_uri = (i = e.error_uri) != null ? i : null, this.state = e.userState, this.session_state = (r = e.session_state) != null ? r : null, this.url_state = e.url_state;
255
366
  }
256
- }, Ue = class extends Error {
367
+ }, Ae = class extends Error {
257
368
  constructor(e) {
258
369
  super(e), this.name = "ErrorTimeout";
259
370
  }
260
371
  }, Qt = class {
261
372
  constructor(e) {
262
- this._logger = new u("AccessTokenEvents"), this._expiringTimer = new M("Access token expiring"), this._expiredTimer = new M("Access token expired"), this._expiringNotificationTimeInSeconds = e.expiringNotificationTimeInSeconds;
373
+ this._logger = new u("AccessTokenEvents"), this._expiringTimer = new F("Access token expiring"), this._expiredTimer = new F("Access token expired"), this._expiringNotificationTimeInSeconds = e.expiringNotificationTimeInSeconds;
263
374
  }
264
375
  load(e) {
265
376
  const t = this._logger.create("load");
@@ -304,8 +415,8 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
304
415
  }
305
416
  }, Xt = class {
306
417
  constructor(e, t, s, i, r) {
307
- this._callback = e, this._client_id = t, this._intervalInSeconds = i, this._stopOnError = r, this._logger = new u("CheckSessionIFrame"), this._timer = null, this._session_state = null, this._message = (c) => {
308
- c.origin === this._frame_origin && c.source === this._frame.contentWindow && (c.data === "error" ? (this._logger.error("error message from check session op iframe"), this._stopOnError && this.stop()) : c.data === "changed" ? (this._logger.debug("changed message from check session op iframe"), this.stop(), this._callback()) : this._logger.debug(c.data + " message from check session op iframe"));
418
+ this._callback = e, this._client_id = t, this._intervalInSeconds = i, this._stopOnError = r, this._logger = new u("CheckSessionIFrame"), this._timer = null, this._session_state = null, this._message = (o) => {
419
+ o.origin === this._frame_origin && o.source === this._frame.contentWindow && (o.data === "error" ? (this._logger.error("error message from check session op iframe"), this._stopOnError && this.stop()) : o.data === "changed" ? (this._logger.debug("changed message from check session op iframe"), this.stop(), this._callback()) : this._logger.debug(o.data + " message from check session op iframe"));
309
420
  };
310
421
  const n = new URL(s);
311
422
  this._frame_origin = n.origin, this._frame = window.document.createElement("iframe"), this._frame.style.visibility = "hidden", this._frame.style.position = "fixed", this._frame.style.left = "-1000px", this._frame.style.top = "0", this._frame.width = "0", this._frame.height = "0", this._frame.src = n.href;
@@ -351,7 +462,11 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
351
462
  key(e) {
352
463
  return Object.getOwnPropertyNames(this._data)[e];
353
464
  }
354
- }, Ae = class {
465
+ }, ye = class extends Error {
466
+ constructor(e, t) {
467
+ super(t), this.name = "ErrorDPoPNonce", this.nonce = e;
468
+ }
469
+ }, Oe = class {
355
470
  constructor(e = [], t = null, s = {}) {
356
471
  this._jwtHandler = t, this._extraHeaders = s, this._logger = new u("JsonService"), this._contentTypes = [], this._contentTypes.push(...e, "application/json"), t && this._contentTypes.push("application/jwt");
357
472
  }
@@ -365,72 +480,80 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
365
480
  ...t,
366
481
  signal: r.signal
367
482
  });
368
- } catch (c) {
369
- throw c instanceof DOMException && c.name === "AbortError" ? new Ue("Network timed out") : c;
483
+ } catch (o) {
484
+ throw o instanceof DOMException && o.name === "AbortError" ? new Ae("Network timed out") : o;
370
485
  } finally {
371
486
  clearTimeout(n);
372
487
  }
373
488
  }
374
489
  async getJson(e, {
375
490
  token: t,
376
- credentials: s
491
+ credentials: s,
492
+ timeoutInSeconds: i
377
493
  } = {}) {
378
- const i = this._logger.create("getJson"), r = {
494
+ const r = this._logger.create("getJson"), n = {
379
495
  Accept: this._contentTypes.join(", ")
380
496
  };
381
- t && (i.debug("token passed, setting Authorization header"), r.Authorization = "Bearer " + t), this.appendExtraHeaders(r);
382
- let n;
497
+ t && (r.debug("token passed, setting Authorization header"), n.Authorization = "Bearer " + t), this.appendExtraHeaders(n);
498
+ let o;
383
499
  try {
384
- i.debug("url:", e), n = await this.fetchWithTimeout(e, { method: "GET", headers: r, credentials: s });
385
- } catch (l) {
386
- throw i.error("Network Error"), l;
500
+ r.debug("url:", e), o = await this.fetchWithTimeout(e, { method: "GET", headers: n, timeoutInSeconds: i, credentials: s });
501
+ } catch (d) {
502
+ throw r.error("Network Error"), d;
387
503
  }
388
- i.debug("HTTP response received, status", n.status);
389
- const c = n.headers.get("Content-Type");
390
- if (c && !this._contentTypes.find((l) => c.startsWith(l)) && i.throw(new Error(`Invalid response Content-Type: ${c ?? "undefined"}, from URL: ${e}`)), n.ok && this._jwtHandler && (c != null && c.startsWith("application/jwt")))
391
- return await this._jwtHandler(await n.text());
392
- let o;
504
+ r.debug("HTTP response received, status", o.status);
505
+ const c = o.headers.get("Content-Type");
506
+ if (c && !this._contentTypes.find((d) => c.startsWith(d)) && r.throw(new Error(`Invalid response Content-Type: ${c ?? "undefined"}, from URL: ${e}`)), o.ok && this._jwtHandler && (c != null && c.startsWith("application/jwt")))
507
+ return await this._jwtHandler(await o.text());
508
+ let l;
393
509
  try {
394
- o = await n.json();
395
- } catch (l) {
396
- throw i.error("Error parsing JSON response", l), n.ok ? l : new Error(`${n.statusText} (${n.status})`);
510
+ l = await o.json();
511
+ } catch (d) {
512
+ throw r.error("Error parsing JSON response", d), o.ok ? d : new Error(`${o.statusText} (${o.status})`);
397
513
  }
398
- if (!n.ok)
399
- throw i.error("Error from server:", o), o.error ? new W(o) : new Error(`${n.statusText} (${n.status}): ${JSON.stringify(o)}`);
400
- return o;
514
+ if (!o.ok)
515
+ throw r.error("Error from server:", l), l.error ? new B(l) : new Error(`${o.statusText} (${o.status}): ${JSON.stringify(l)}`);
516
+ return l;
401
517
  }
402
518
  async postForm(e, {
403
519
  body: t,
404
520
  basicAuth: s,
405
521
  timeoutInSeconds: i,
406
- initCredentials: r
522
+ initCredentials: r,
523
+ extraHeaders: n
407
524
  }) {
408
- const n = this._logger.create("postForm"), c = {
525
+ const o = this._logger.create("postForm"), c = {
409
526
  Accept: this._contentTypes.join(", "),
410
- "Content-Type": "application/x-www-form-urlencoded"
527
+ "Content-Type": "application/x-www-form-urlencoded",
528
+ ...n
411
529
  };
412
530
  s !== void 0 && (c.Authorization = "Basic " + s), this.appendExtraHeaders(c);
413
- let o;
531
+ let l;
414
532
  try {
415
- n.debug("url:", e), o = await this.fetchWithTimeout(e, { method: "POST", headers: c, body: t, timeoutInSeconds: i, credentials: r });
416
- } catch (g) {
417
- throw n.error("Network error"), g;
533
+ o.debug("url:", e), l = await this.fetchWithTimeout(e, { method: "POST", headers: c, body: t, timeoutInSeconds: i, credentials: r });
534
+ } catch (_) {
535
+ throw o.error("Network error"), _;
418
536
  }
419
- n.debug("HTTP response received, status", o.status);
420
- const l = o.headers.get("Content-Type");
421
- if (l && !this._contentTypes.find((g) => l.startsWith(g)))
422
- throw new Error(`Invalid response Content-Type: ${l ?? "undefined"}, from URL: ${e}`);
423
- const d = await o.text();
424
- let h = {};
425
- if (d)
537
+ o.debug("HTTP response received, status", l.status);
538
+ const d = l.headers.get("Content-Type");
539
+ if (d && !this._contentTypes.find((_) => d.startsWith(_)))
540
+ throw new Error(`Invalid response Content-Type: ${d ?? "undefined"}, from URL: ${e}`);
541
+ const h = await l.text();
542
+ let g = {};
543
+ if (h)
426
544
  try {
427
- h = JSON.parse(d);
428
- } catch (g) {
429
- throw n.error("Error parsing JSON response", g), o.ok ? g : new Error(`${o.statusText} (${o.status})`);
545
+ g = JSON.parse(h);
546
+ } catch (_) {
547
+ throw o.error("Error parsing JSON response", _), l.ok ? _ : new Error(`${l.statusText} (${l.status})`);
430
548
  }
431
- if (!o.ok)
432
- throw n.error("Error from server:", h), h.error ? new W(h, t) : new Error(`${o.statusText} (${o.status}): ${JSON.stringify(h)}`);
433
- return h;
549
+ if (!l.ok) {
550
+ if (o.error("Error from server:", g), l.headers.has("dpop-nonce")) {
551
+ const _ = l.headers.get("dpop-nonce");
552
+ throw new ye(_, `${JSON.stringify(g)}`);
553
+ }
554
+ throw g.error ? new B(g, t) : new Error(`${l.statusText} (${l.status}): ${JSON.stringify(g)}`);
555
+ }
556
+ return g;
434
557
  }
435
558
  appendExtraHeaders(e) {
436
559
  const t = this._logger.create("appendExtraHeaders"), s = Object.keys(this._extraHeaders), i = [
@@ -449,7 +572,7 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
449
572
  }
450
573
  }, Yt = class {
451
574
  constructor(e) {
452
- this._settings = e, this._logger = new u("MetadataService"), this._signingKeys = null, this._metadata = null, this._metadataUrl = this._settings.metadataUrl, this._jsonService = new Ae(
575
+ this._settings = e, this._logger = new u("MetadataService"), this._signingKeys = null, this._metadata = null, this._metadataUrl = this._settings.metadataUrl, this._jsonService = new Oe(
453
576
  ["application/jwk-set+json"],
454
577
  null,
455
578
  this._settings.extraHeaders
@@ -465,7 +588,7 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
465
588
  if (!this._metadataUrl)
466
589
  throw e.throw(new Error("No authority or metadataUrl configured on settings")), null;
467
590
  e.debug("getting metadata from", this._metadataUrl);
468
- const t = await this._jsonService.getJson(this._metadataUrl, { credentials: this._fetchRequestCredentials });
591
+ const t = await this._jsonService.getJson(this._metadataUrl, { credentials: this._fetchRequestCredentials, timeoutInSeconds: this._settings.requestTimeoutInSeconds });
469
592
  return e.debug("merging remote JSON with seed metadata"), this._metadata = Object.assign({}, this._settings.metadataSeed, t), this._metadata;
470
593
  }
471
594
  getIssuer() {
@@ -509,7 +632,7 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
509
632
  return e.debug("returning signingKeys from cache"), this._signingKeys;
510
633
  const t = await this.getKeysEndpoint(!1);
511
634
  e.debug("got jwks_uri", t);
512
- const s = await this._jsonService.getJson(t);
635
+ const s = await this._jsonService.getJson(t, { timeoutInSeconds: this._settings.requestTimeoutInSeconds });
513
636
  if (e.debug("got key set", s), !Array.isArray(s.keys))
514
637
  throw e.throw(new Error("Missing keys on keyset")), null;
515
638
  return this._signingKeys = s.keys, this._signingKeys;
@@ -541,7 +664,7 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
541
664
  }
542
665
  return t;
543
666
  }
544
- }, Zt = "code", es = "openid", ts = "client_secret_post", ss = 60 * 15, ve = class {
667
+ }, Zt = "code", es = "openid", ts = "client_secret_post", ss = 60 * 15, be = class {
545
668
  constructor({
546
669
  // metadata related
547
670
  authority: e,
@@ -551,55 +674,60 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
551
674
  metadataSeed: r,
552
675
  // client related
553
676
  client_id: n,
554
- client_secret: c,
555
- response_type: o = Zt,
677
+ client_secret: o,
678
+ response_type: c = Zt,
556
679
  scope: l = es,
557
680
  redirect_uri: d,
558
681
  post_logout_redirect_uri: h,
559
682
  client_authentication: g = ts,
560
683
  // optional protocol
561
- prompt: v,
562
- display: b,
563
- max_age: R,
564
- ui_locales: k,
565
- acr_values: x,
566
- resource: E,
567
- response_mode: H,
684
+ prompt: _,
685
+ display: S,
686
+ max_age: x,
687
+ ui_locales: T,
688
+ acr_values: A,
689
+ resource: I,
690
+ response_mode: N,
568
691
  // behavior flags
569
- filterProtocolClaims: T = !0,
570
- loadUserInfo: w = !1,
571
- staleStateAgeInSeconds: U = ss,
572
- mergeClaimsStrategy: C = { array: "replace" },
573
- disablePKCE: S = !1,
692
+ filterProtocolClaims: P = !0,
693
+ loadUserInfo: M = !1,
694
+ requestTimeoutInSeconds: R,
695
+ staleStateAgeInSeconds: m = ss,
696
+ mergeClaimsStrategy: E = { array: "replace" },
697
+ disablePKCE: U = !1,
574
698
  // other behavior
575
- stateStore: L,
576
- revokeTokenAdditionalContentTypes: B,
577
- fetchRequestCredentials: Y,
578
- refreshTokenAllowedScope: p,
699
+ stateStore: y,
700
+ revokeTokenAdditionalContentTypes: z,
701
+ fetchRequestCredentials: f,
702
+ refreshTokenAllowedScope: w,
579
703
  // extra
580
- extraQueryParams: m = {},
581
- extraTokenParams: P = {},
582
- extraHeaders: D = {}
704
+ extraQueryParams: q = {},
705
+ extraTokenParams: J = {},
706
+ extraHeaders: K = {},
707
+ dpop: Q,
708
+ omitScopeWhenRequesting: _e = !1
583
709
  }) {
584
- if (this.authority = e, t ? this.metadataUrl = t : (this.metadataUrl = e, e && (this.metadataUrl.endsWith("/") || (this.metadataUrl += "/"), this.metadataUrl += ".well-known/openid-configuration")), this.metadata = s, this.metadataSeed = r, this.signingKeys = i, this.client_id = n, this.client_secret = c, this.response_type = o, this.scope = l, this.redirect_uri = d, this.post_logout_redirect_uri = h, this.client_authentication = g, this.prompt = v, this.display = b, this.max_age = R, this.ui_locales = k, this.acr_values = x, this.resource = E, this.response_mode = H, this.filterProtocolClaims = T ?? !0, this.loadUserInfo = !!w, this.staleStateAgeInSeconds = U, this.mergeClaimsStrategy = C, this.disablePKCE = !!S, this.revokeTokenAdditionalContentTypes = B, this.fetchRequestCredentials = Y || "same-origin", L)
585
- this.stateStore = L;
710
+ var X;
711
+ if (this.authority = e, t ? this.metadataUrl = t : (this.metadataUrl = e, e && (this.metadataUrl.endsWith("/") || (this.metadataUrl += "/"), this.metadataUrl += ".well-known/openid-configuration")), this.metadata = s, this.metadataSeed = r, this.signingKeys = i, this.client_id = n, this.client_secret = o, this.response_type = c, this.scope = l, this.redirect_uri = d, this.post_logout_redirect_uri = h, this.client_authentication = g, this.prompt = _, this.display = S, this.max_age = x, this.ui_locales = T, this.acr_values = A, this.resource = I, this.response_mode = N, this.filterProtocolClaims = P ?? !0, this.loadUserInfo = !!M, this.staleStateAgeInSeconds = m, this.mergeClaimsStrategy = E, this.omitScopeWhenRequesting = _e, this.disablePKCE = !!U, this.revokeTokenAdditionalContentTypes = z, this.fetchRequestCredentials = f || "same-origin", this.requestTimeoutInSeconds = R, y)
712
+ this.stateStore = y;
586
713
  else {
587
- const $ = typeof window < "u" ? window.localStorage : new Ge();
588
- this.stateStore = new Qe({ store: $ });
714
+ const te = typeof window < "u" ? window.localStorage : new Ge();
715
+ this.stateStore = new Qe({ store: te });
589
716
  }
590
- this.refreshTokenAllowedScope = p, this.extraQueryParams = m, this.extraTokenParams = P, this.extraHeaders = D;
717
+ if (this.refreshTokenAllowedScope = w, this.extraQueryParams = q, this.extraTokenParams = J, this.extraHeaders = K, this.dpop = Q, this.dpop && !((X = this.dpop) != null && X.store))
718
+ throw new Error("A DPoPStore is required when dpop is enabled");
591
719
  }
592
720
  }, is = class {
593
721
  constructor(e, t) {
594
722
  this._settings = e, this._metadataService = t, this._logger = new u("UserInfoService"), this._getClaimsFromJwt = async (s) => {
595
723
  const i = this._logger.create("_getClaimsFromJwt");
596
724
  try {
597
- const r = fe.decode(s);
725
+ const r = he.decode(s);
598
726
  return i.debug("JWT decoding successful"), r;
599
727
  } catch (r) {
600
728
  throw i.error("Error parsing JWT response"), r;
601
729
  }
602
- }, this._jsonService = new Ae(
730
+ }, this._jsonService = new Oe(
603
731
  void 0,
604
732
  this._getClaimsFromJwt,
605
733
  this._settings.extraHeaders
@@ -612,13 +740,14 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
612
740
  t.debug("got userinfo url", s);
613
741
  const i = await this._jsonService.getJson(s, {
614
742
  token: e,
615
- credentials: this._settings.fetchRequestCredentials
743
+ credentials: this._settings.fetchRequestCredentials,
744
+ timeoutInSeconds: this._settings.requestTimeoutInSeconds
616
745
  });
617
746
  return t.debug("got claims", i), i;
618
747
  }
619
748
  }, Xe = class {
620
749
  constructor(e, t) {
621
- this._settings = e, this._metadataService = t, this._logger = new u("TokenClient"), this._jsonService = new Ae(
750
+ this._settings = e, this._metadataService = t, this._logger = new u("TokenClient"), this._jsonService = new Oe(
622
751
  this._settings.revokeTokenAdditionalContentTypes,
623
752
  null,
624
753
  this._settings.extraHeaders
@@ -634,28 +763,35 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
634
763
  redirect_uri: t = this._settings.redirect_uri,
635
764
  client_id: s = this._settings.client_id,
636
765
  client_secret: i = this._settings.client_secret,
637
- ...r
766
+ extraHeaders: r,
767
+ ...n
638
768
  }) {
639
- const n = this._logger.create("exchangeCode");
640
- s || n.throw(new Error("A client_id is required")), t || n.throw(new Error("A redirect_uri is required")), r.code || n.throw(new Error("A code is required"));
769
+ const o = this._logger.create("exchangeCode");
770
+ s || o.throw(new Error("A client_id is required")), t || o.throw(new Error("A redirect_uri is required")), n.code || o.throw(new Error("A code is required"));
641
771
  const c = new URLSearchParams({ grant_type: e, redirect_uri: t });
642
- for (const [h, g] of Object.entries(r))
643
- g != null && c.set(h, g);
644
- let o;
772
+ for (const [g, _] of Object.entries(n))
773
+ _ != null && c.set(g, _);
774
+ let l;
645
775
  switch (this._settings.client_authentication) {
646
776
  case "client_secret_basic":
647
777
  if (!i)
648
- throw n.throw(new Error("A client_secret is required")), null;
649
- o = z.generateBasicAuth(s, i);
778
+ throw o.throw(new Error("A client_secret is required")), null;
779
+ l = C.generateBasicAuth(s, i);
650
780
  break;
651
781
  case "client_secret_post":
652
782
  c.append("client_id", s), i && c.append("client_secret", i);
653
783
  break;
654
784
  }
655
- const l = await this._metadataService.getTokenEndpoint(!1);
656
- n.debug("got token endpoint");
657
- const d = await this._jsonService.postForm(l, { body: c, basicAuth: o, initCredentials: this._settings.fetchRequestCredentials });
658
- return n.debug("got response"), d;
785
+ const d = await this._metadataService.getTokenEndpoint(!1);
786
+ o.debug("got token endpoint");
787
+ const h = await this._jsonService.postForm(d, {
788
+ body: c,
789
+ basicAuth: l,
790
+ timeoutInSeconds: this._settings.requestTimeoutInSeconds,
791
+ initCredentials: this._settings.fetchRequestCredentials,
792
+ extraHeaders: r
793
+ });
794
+ return o.debug("got response"), h;
659
795
  }
660
796
  /**
661
797
  * Exchange credentials.
@@ -671,23 +807,24 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
671
807
  }) {
672
808
  const n = this._logger.create("exchangeCredentials");
673
809
  t || n.throw(new Error("A client_id is required"));
674
- const c = new URLSearchParams({ grant_type: e, scope: i });
810
+ const o = new URLSearchParams({ grant_type: e });
811
+ this._settings.omitScopeWhenRequesting || o.set("scope", i);
675
812
  for (const [h, g] of Object.entries(r))
676
- g != null && c.set(h, g);
677
- let o;
813
+ g != null && o.set(h, g);
814
+ let c;
678
815
  switch (this._settings.client_authentication) {
679
816
  case "client_secret_basic":
680
817
  if (!s)
681
818
  throw n.throw(new Error("A client_secret is required")), null;
682
- o = z.generateBasicAuth(t, s);
819
+ c = C.generateBasicAuth(t, s);
683
820
  break;
684
821
  case "client_secret_post":
685
- c.append("client_id", t), s && c.append("client_secret", s);
822
+ o.append("client_id", t), s && o.append("client_secret", s);
686
823
  break;
687
824
  }
688
825
  const l = await this._metadataService.getTokenEndpoint(!1);
689
826
  n.debug("got token endpoint");
690
- const d = await this._jsonService.postForm(l, { body: c, basicAuth: o, initCredentials: this._settings.fetchRequestCredentials });
827
+ const d = await this._jsonService.postForm(l, { body: o, basicAuth: c, timeoutInSeconds: this._settings.requestTimeoutInSeconds, initCredentials: this._settings.fetchRequestCredentials });
691
828
  return n.debug("got response"), d;
692
829
  }
693
830
  /**
@@ -700,28 +837,29 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
700
837
  client_id: t = this._settings.client_id,
701
838
  client_secret: s = this._settings.client_secret,
702
839
  timeoutInSeconds: i,
703
- ...r
840
+ extraHeaders: r,
841
+ ...n
704
842
  }) {
705
- const n = this._logger.create("exchangeRefreshToken");
706
- t || n.throw(new Error("A client_id is required")), r.refresh_token || n.throw(new Error("A refresh_token is required"));
843
+ const o = this._logger.create("exchangeRefreshToken");
844
+ t || o.throw(new Error("A client_id is required")), n.refresh_token || o.throw(new Error("A refresh_token is required"));
707
845
  const c = new URLSearchParams({ grant_type: e });
708
- for (const [h, g] of Object.entries(r))
709
- Array.isArray(g) ? g.forEach((v) => c.append(h, v)) : g != null && c.set(h, g);
710
- let o;
846
+ for (const [g, _] of Object.entries(n))
847
+ Array.isArray(_) ? _.forEach((S) => c.append(g, S)) : _ != null && c.set(g, _);
848
+ let l;
711
849
  switch (this._settings.client_authentication) {
712
850
  case "client_secret_basic":
713
851
  if (!s)
714
- throw n.throw(new Error("A client_secret is required")), null;
715
- o = z.generateBasicAuth(t, s);
852
+ throw o.throw(new Error("A client_secret is required")), null;
853
+ l = C.generateBasicAuth(t, s);
716
854
  break;
717
855
  case "client_secret_post":
718
856
  c.append("client_id", t), s && c.append("client_secret", s);
719
857
  break;
720
858
  }
721
- const l = await this._metadataService.getTokenEndpoint(!1);
722
- n.debug("got token endpoint");
723
- const d = await this._jsonService.postForm(l, { body: c, basicAuth: o, timeoutInSeconds: i, initCredentials: this._settings.fetchRequestCredentials });
724
- return n.debug("got response"), d;
859
+ const d = await this._metadataService.getTokenEndpoint(!1);
860
+ o.debug("got token endpoint");
861
+ const h = await this._jsonService.postForm(d, { body: c, basicAuth: l, timeoutInSeconds: i, initCredentials: this._settings.fetchRequestCredentials, extraHeaders: r });
862
+ return o.debug("got response"), h;
725
863
  }
726
864
  /**
727
865
  * Revoke an access or refresh token.
@@ -735,17 +873,17 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
735
873
  const i = await this._metadataService.getRevocationEndpoint(!1);
736
874
  s.debug(`got revocation endpoint, revoking ${(t = e.token_type_hint) != null ? t : "default token type"}`);
737
875
  const r = new URLSearchParams();
738
- for (const [n, c] of Object.entries(e))
739
- c != null && r.set(n, c);
740
- r.set("client_id", this._settings.client_id), this._settings.client_secret && r.set("client_secret", this._settings.client_secret), await this._jsonService.postForm(i, { body: r }), s.debug("got response");
876
+ for (const [n, o] of Object.entries(e))
877
+ o != null && r.set(n, o);
878
+ r.set("client_id", this._settings.client_id), this._settings.client_secret && r.set("client_secret", this._settings.client_secret), await this._jsonService.postForm(i, { body: r, timeoutInSeconds: this._settings.requestTimeoutInSeconds }), s.debug("got response");
741
879
  }
742
880
  }, rs = class {
743
881
  constructor(e, t, s) {
744
882
  this._settings = e, this._metadataService = t, this._claimsService = s, this._logger = new u("ResponseValidator"), this._userInfoService = new is(this._settings, this._metadataService), this._tokenClient = new Xe(this._settings, this._metadataService);
745
883
  }
746
- async validateSigninResponse(e, t) {
747
- const s = this._logger.create("validateSigninResponse");
748
- this._processSigninState(e, t), s.debug("state processed"), await this._processCode(e, t), s.debug("code processed"), e.isOpenId && this._validateIdTokenAttributes(e), s.debug("tokens validated"), await this._processClaims(e, t == null ? void 0 : t.skipUserInfo, e.isOpenId), s.debug("claims processed");
884
+ async validateSigninResponse(e, t, s) {
885
+ const i = this._logger.create("validateSigninResponse");
886
+ this._processSigninState(e, t), i.debug("state processed"), await this._processCode(e, t, s), i.debug("code processed"), e.isOpenId && this._validateIdTokenAttributes(e), i.debug("tokens validated"), await this._processClaims(e, t == null ? void 0 : t.skipUserInfo, e.isOpenId), i.debug("claims processed");
749
887
  }
750
888
  async validateCredentialsResponse(e, t) {
751
889
  const s = this._logger.create("validateCredentialsResponse");
@@ -761,13 +899,13 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
761
899
  validateSignoutResponse(e, t) {
762
900
  const s = this._logger.create("validateSignoutResponse");
763
901
  if (t.id !== e.state && s.throw(new Error("State does not match")), s.debug("state validated"), e.userState = t.data, e.error)
764
- throw s.warn("Response was error", e.error), new W(e);
902
+ throw s.warn("Response was error", e.error), new B(e);
765
903
  }
766
904
  _processSigninState(e, t) {
767
905
  var s;
768
906
  const i = this._logger.create("_processSigninState");
769
907
  if (t.id !== e.state && i.throw(new Error("State does not match")), t.client_id || i.throw(new Error("No client_id on state")), t.authority || i.throw(new Error("No authority on state")), this._settings.authority !== t.authority && i.throw(new Error("authority mismatch on settings vs. signin state")), this._settings.client_id && this._settings.client_id !== t.client_id && i.throw(new Error("client_id mismatch on settings vs. signin state")), i.debug("state validated"), e.userState = t.data, e.url_state = t.url_state, (s = e.scope) != null || (e.scope = t.scope), e.error)
770
- throw i.warn("Response was error", e.error), new W(e);
908
+ throw i.warn("Response was error", e.error), new B(e);
771
909
  t.code_verifier && !e.code && i.throw(new Error("Expected code in response"));
772
910
  }
773
911
  async _processClaims(e, t = !1, s = !0) {
@@ -780,36 +918,37 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
780
918
  const r = await this._userInfoService.getClaims(e.access_token);
781
919
  i.debug("user info claims received from user info endpoint"), s && r.sub !== e.profile.sub && i.throw(new Error("subject from UserInfo response does not match subject in ID Token")), e.profile = this._claimsService.mergeClaims(e.profile, this._claimsService.filterProtocolClaims(r)), i.debug("user info claims received, updated profile:", e.profile);
782
920
  }
783
- async _processCode(e, t) {
784
- const s = this._logger.create("_processCode");
921
+ async _processCode(e, t, s) {
922
+ const i = this._logger.create("_processCode");
785
923
  if (e.code) {
786
- s.debug("Validating code");
787
- const i = await this._tokenClient.exchangeCode({
924
+ i.debug("Validating code");
925
+ const r = await this._tokenClient.exchangeCode({
788
926
  client_id: t.client_id,
789
927
  client_secret: t.client_secret,
790
928
  code: e.code,
791
929
  redirect_uri: t.redirect_uri,
792
930
  code_verifier: t.code_verifier,
931
+ extraHeaders: s,
793
932
  ...t.extraTokenParams
794
933
  });
795
- Object.assign(e, i);
934
+ Object.assign(e, r);
796
935
  } else
797
- s.debug("No code to process");
936
+ i.debug("No code to process");
798
937
  }
799
938
  _validateIdTokenAttributes(e, t) {
800
939
  var s;
801
940
  const i = this._logger.create("_validateIdTokenAttributes");
802
941
  i.debug("decoding ID Token JWT");
803
- const r = fe.decode((s = e.id_token) != null ? s : "");
942
+ const r = he.decode((s = e.id_token) != null ? s : "");
804
943
  if (r.sub || i.throw(new Error("ID Token is missing a subject claim")), t) {
805
- const n = fe.decode(t);
944
+ const n = he.decode(t);
806
945
  r.sub !== n.sub && i.throw(new Error("sub in id_token does not match current sub")), r.auth_time && r.auth_time !== n.auth_time && i.throw(new Error("auth_time in id_token does not match original auth_time")), r.azp && r.azp !== n.azp && i.throw(new Error("azp in id_token does not match original azp")), !r.azp && n.azp && i.throw(new Error("azp not in id_token, but present in original id_token"));
807
946
  }
808
947
  e.profile = r;
809
948
  }
810
- }, ne = class Se {
949
+ }, ge = class ke {
811
950
  constructor(t) {
812
- this.id = t.id || z.generateUUIDv4(), this.data = t.data, t.created && t.created > 0 ? this.created = t.created : this.created = M.getEpochTime(), this.request_type = t.request_type, this.url_state = t.url_state;
951
+ this.id = t.id || C.generateUUIDv4(), this.data = t.data, t.created && t.created > 0 ? this.created = t.created : this.created = F.getEpochTime(), this.request_type = t.request_type, this.url_state = t.url_state;
813
952
  }
814
953
  toStorageString() {
815
954
  return new u("State").create("toStorageString"), JSON.stringify({
@@ -821,33 +960,33 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
821
960
  });
822
961
  }
823
962
  static fromStorageString(t) {
824
- return u.createStatic("State", "fromStorageString"), Promise.resolve(new Se(JSON.parse(t)));
963
+ return u.createStatic("State", "fromStorageString"), Promise.resolve(new ke(JSON.parse(t)));
825
964
  }
826
965
  static async clearStaleState(t, s) {
827
- const i = u.createStatic("State", "clearStaleState"), r = M.getEpochTime() - s, n = await t.getAllKeys();
966
+ const i = u.createStatic("State", "clearStaleState"), r = F.getEpochTime() - s, n = await t.getAllKeys();
828
967
  i.debug("got keys", n);
829
- for (let c = 0; c < n.length; c++) {
830
- const o = n[c], l = await t.get(o);
968
+ for (let o = 0; o < n.length; o++) {
969
+ const c = n[o], l = await t.get(c);
831
970
  let d = !1;
832
971
  if (l)
833
972
  try {
834
- const h = await Se.fromStorageString(l);
835
- i.debug("got item from key:", o, h.created), h.created <= r && (d = !0);
973
+ const h = await ke.fromStorageString(l);
974
+ i.debug("got item from key:", c, h.created), h.created <= r && (d = !0);
836
975
  } catch (h) {
837
- i.error("Error parsing state for key:", o, h), d = !0;
976
+ i.error("Error parsing state for key:", c, h), d = !0;
838
977
  }
839
978
  else
840
- i.debug("no item in storage for key:", o), d = !0;
841
- d && (i.debug("removed item for key:", o), t.remove(o));
979
+ i.debug("no item in storage for key:", c), d = !0;
980
+ d && (i.debug("removed item for key:", c), t.remove(c));
842
981
  }
843
982
  }
844
- }, Ye = class be extends ne {
983
+ }, Ye = class Te extends ge {
845
984
  constructor(t) {
846
985
  super(t), this.code_verifier = t.code_verifier, this.code_challenge = t.code_challenge, this.authority = t.authority, this.client_id = t.client_id, this.redirect_uri = t.redirect_uri, this.scope = t.scope, this.client_secret = t.client_secret, this.extraTokenParams = t.extraTokenParams, this.response_mode = t.response_mode, this.skipUserInfo = t.skipUserInfo;
847
986
  }
848
987
  static async create(t) {
849
- const s = t.code_verifier === !0 ? z.generateCodeVerifier() : t.code_verifier || void 0, i = s ? await z.generateCodeChallenge(s) : void 0;
850
- return new be({
988
+ const s = t.code_verifier === !0 ? C.generateCodeVerifier() : t.code_verifier || void 0, i = s ? await C.generateCodeChallenge(s) : void 0;
989
+ return new Te({
851
990
  ...t,
852
991
  code_verifier: s,
853
992
  code_challenge: i
@@ -874,7 +1013,7 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
874
1013
  static fromStorageString(t) {
875
1014
  u.createStatic("SigninState", "fromStorageString");
876
1015
  const s = JSON.parse(t);
877
- return be.create(s);
1016
+ return Te.create(s);
878
1017
  }
879
1018
  }, Ze = class et {
880
1019
  constructor(t) {
@@ -887,20 +1026,22 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
887
1026
  client_id: i,
888
1027
  redirect_uri: r,
889
1028
  response_type: n,
890
- scope: c,
1029
+ scope: o,
891
1030
  // optional
892
- state_data: o,
1031
+ state_data: c,
893
1032
  response_mode: l,
894
1033
  request_type: d,
895
1034
  client_secret: h,
896
1035
  nonce: g,
897
- url_state: v,
898
- resource: b,
899
- skipUserInfo: R,
900
- extraQueryParams: k,
901
- extraTokenParams: x,
902
- disablePKCE: E,
903
- ...H
1036
+ url_state: _,
1037
+ resource: S,
1038
+ skipUserInfo: x,
1039
+ extraQueryParams: T,
1040
+ extraTokenParams: A,
1041
+ disablePKCE: I,
1042
+ dpopJkt: N,
1043
+ omitScopeWhenRequesting: P,
1044
+ ...M
904
1045
  }) {
905
1046
  if (!t)
906
1047
  throw this._logger.error("create: No url passed"), new Error("url");
@@ -910,50 +1051,50 @@ var Gt = "10000000-1000-4000-8000-100000000000", Fe = (e) => btoa([...new Uint8A
910
1051
  throw this._logger.error("create: No redirect_uri passed"), new Error("redirect_uri");
911
1052
  if (!n)
912
1053
  throw this._logger.error("create: No response_type passed"), new Error("response_type");
913
- if (!c)
1054
+ if (!o)
914
1055
  throw this._logger.error("create: No scope passed"), new Error("scope");
915
1056
  if (!s)
916
1057
  throw this._logger.error("create: No authority passed"), new Error("authority");
917
- const T = await Ye.create({
918
- data: o,
1058
+ const R = await Ye.create({
1059
+ data: c,
919
1060
  request_type: d,
920
- url_state: v,
921
- code_verifier: !E,
1061
+ url_state: _,
1062
+ code_verifier: !I,
922
1063
  client_id: i,
923
1064
  authority: s,
924
1065
  redirect_uri: r,
925
1066
  response_mode: l,
926
1067
  client_secret: h,
927
- scope: c,
928
- extraTokenParams: x,
929
- skipUserInfo: R
930
- }), w = new URL(t);
931
- w.searchParams.append("client_id", i), w.searchParams.append("redirect_uri", r), w.searchParams.append("response_type", n), w.searchParams.append("scope", c), g && w.searchParams.append("nonce", g);
932
- let U = T.id;
933
- v && (U = `${U}${we}${v}`), w.searchParams.append("state", U), T.code_challenge && (w.searchParams.append("code_challenge", T.code_challenge), w.searchParams.append("code_challenge_method", "S256")), b && (Array.isArray(b) ? b : [b]).forEach((S) => w.searchParams.append("resource", S));
934
- for (const [C, S] of Object.entries({ response_mode: l, ...H, ...k }))
935
- S != null && w.searchParams.append(C, S.toString());
1068
+ scope: o,
1069
+ extraTokenParams: A,
1070
+ skipUserInfo: x
1071
+ }), m = new URL(t);
1072
+ m.searchParams.append("client_id", i), m.searchParams.append("redirect_uri", r), m.searchParams.append("response_type", n), P || m.searchParams.append("scope", o), g && m.searchParams.append("nonce", g), N && m.searchParams.append("dpop_jkt", N);
1073
+ let E = R.id;
1074
+ _ && (E = `${E}${Se}${_}`), m.searchParams.append("state", E), R.code_challenge && (m.searchParams.append("code_challenge", R.code_challenge), m.searchParams.append("code_challenge_method", "S256")), S && (Array.isArray(S) ? S : [S]).forEach((y) => m.searchParams.append("resource", y));
1075
+ for (const [U, y] of Object.entries({ response_mode: l, ...M, ...T }))
1076
+ y != null && m.searchParams.append(U, y.toString());
936
1077
  return new et({
937
- url: w.href,
938
- state: T
1078
+ url: m.href,
1079
+ state: R
939
1080
  });
940
1081
  }
941
1082
  };
942
1083
  Ze._logger = new u("SigninRequest");
943
- var ns = Ze, os = "openid", he = class {
1084
+ var ns = Ze, os = "openid", pe = class {
944
1085
  constructor(e) {
945
1086
  if (this.access_token = "", this.token_type = "", this.profile = {}, this.state = e.get("state"), this.session_state = e.get("session_state"), this.state) {
946
- const t = decodeURIComponent(this.state).split(we);
947
- this.state = t[0], t.length > 1 && (this.url_state = t.slice(1).join(we));
1087
+ const t = decodeURIComponent(this.state).split(Se);
1088
+ this.state = t[0], t.length > 1 && (this.url_state = t.slice(1).join(Se));
948
1089
  }
949
1090
  this.error = e.get("error"), this.error_description = e.get("error_description"), this.error_uri = e.get("error_uri"), this.code = e.get("code");
950
1091
  }
951
1092
  get expires_in() {
952
1093
  if (this.expires_at !== void 0)
953
- return this.expires_at - M.getEpochTime();
1094
+ return this.expires_at - F.getEpochTime();
954
1095
  }
955
1096
  set expires_in(e) {
956
- typeof e == "string" && (e = Number(e)), e !== void 0 && e >= 0 && (this.expires_at = Math.floor(e) + M.getEpochTime());
1097
+ typeof e == "string" && (e = Number(e)), e !== void 0 && e >= 0 && (this.expires_at = Math.floor(e) + F.getEpochTime());
957
1098
  }
958
1099
  get isOpenId() {
959
1100
  var e;
@@ -967,15 +1108,15 @@ var ns = Ze, os = "openid", he = class {
967
1108
  post_logout_redirect_uri: i,
968
1109
  extraQueryParams: r,
969
1110
  request_type: n,
970
- client_id: c
1111
+ client_id: o
971
1112
  }) {
972
1113
  if (this._logger = new u("SignoutRequest"), !e)
973
1114
  throw this._logger.error("ctor: No url passed"), new Error("url");
974
- const o = new URL(e);
975
- s && o.searchParams.append("id_token_hint", s), c && o.searchParams.append("client_id", c), i && (o.searchParams.append("post_logout_redirect_uri", i), t && (this.state = new ne({ data: t, request_type: n }), o.searchParams.append("state", this.state.id)));
1115
+ const c = new URL(e);
1116
+ s && c.searchParams.append("id_token_hint", s), o && c.searchParams.append("client_id", o), i && (c.searchParams.append("post_logout_redirect_uri", i), t && (this.state = new ge({ data: t, request_type: n }), c.searchParams.append("state", this.state.id)));
976
1117
  for (const [l, d] of Object.entries({ ...r }))
977
- d != null && o.searchParams.append(l, d.toString());
978
- this.url = o.href;
1118
+ d != null && c.searchParams.append(l, d.toString());
1119
+ this.url = c.href;
979
1120
  }
980
1121
  }, cs = class {
981
1122
  constructor(e) {
@@ -1014,17 +1155,20 @@ var ns = Ze, os = "openid", he = class {
1014
1155
  s[i] = r;
1015
1156
  else {
1016
1157
  const n = Array.isArray(s[i]) ? s[i] : [s[i]];
1017
- for (const c of Array.isArray(r) ? r : [r])
1018
- n.includes(c) || n.push(c);
1158
+ for (const o of Array.isArray(r) ? r : [r])
1159
+ n.includes(o) || n.push(o);
1019
1160
  s[i] = n;
1020
1161
  }
1021
- else
1022
- typeof s[i] == "object" && typeof r == "object" ? s[i] = this.mergeClaims(s[i], r) : s[i] = r;
1162
+ else typeof s[i] == "object" && typeof r == "object" ? s[i] = this.mergeClaims(s[i], r) : s[i] = r;
1023
1163
  return s;
1024
1164
  }
1165
+ }, tt = class {
1166
+ constructor(e, t) {
1167
+ this.keys = e, this.nonce = t;
1168
+ }
1025
1169
  }, gs = class {
1026
1170
  constructor(e, t) {
1027
- this._logger = new u("OidcClient"), this.settings = e instanceof ve ? e : new ve(e), this.metadataService = t ?? new Yt(this.settings), this._claimsService = new hs(this.settings), this._validator = new rs(this.settings, this.metadataService, this._claimsService), this._tokenClient = new Xe(this.settings, this.metadataService);
1171
+ this._logger = new u("OidcClient"), this.settings = e instanceof be ? e : new be(e), this.metadataService = t ?? new Yt(this.settings), this._claimsService = new hs(this.settings), this._validator = new rs(this.settings, this.metadataService, this._claimsService), this._tokenClient = new Xe(this.settings, this.metadataService);
1028
1172
  }
1029
1173
  async createSigninRequest({
1030
1174
  state: e,
@@ -1033,29 +1177,31 @@ var ns = Ze, os = "openid", he = class {
1033
1177
  request_type: i,
1034
1178
  id_token_hint: r,
1035
1179
  login_hint: n,
1036
- skipUserInfo: c,
1037
- nonce: o,
1180
+ skipUserInfo: o,
1181
+ nonce: c,
1038
1182
  url_state: l,
1039
1183
  response_type: d = this.settings.response_type,
1040
1184
  scope: h = this.settings.scope,
1041
1185
  redirect_uri: g = this.settings.redirect_uri,
1042
- prompt: v = this.settings.prompt,
1043
- display: b = this.settings.display,
1044
- max_age: R = this.settings.max_age,
1045
- ui_locales: k = this.settings.ui_locales,
1046
- acr_values: x = this.settings.acr_values,
1047
- resource: E = this.settings.resource,
1048
- response_mode: H = this.settings.response_mode,
1049
- extraQueryParams: T = this.settings.extraQueryParams,
1050
- extraTokenParams: w = this.settings.extraTokenParams
1186
+ prompt: _ = this.settings.prompt,
1187
+ display: S = this.settings.display,
1188
+ max_age: x = this.settings.max_age,
1189
+ ui_locales: T = this.settings.ui_locales,
1190
+ acr_values: A = this.settings.acr_values,
1191
+ resource: I = this.settings.resource,
1192
+ response_mode: N = this.settings.response_mode,
1193
+ extraQueryParams: P = this.settings.extraQueryParams,
1194
+ extraTokenParams: M = this.settings.extraTokenParams,
1195
+ dpopJkt: R,
1196
+ omitScopeWhenRequesting: m = this.settings.omitScopeWhenRequesting
1051
1197
  }) {
1052
- const U = this._logger.create("createSigninRequest");
1198
+ const E = this._logger.create("createSigninRequest");
1053
1199
  if (d !== "code")
1054
1200
  throw new Error("Only the Authorization Code flow (with PKCE) is supported");
1055
- const C = await this.metadataService.getAuthorizationEndpoint();
1056
- U.debug("Received authorization endpoint", C);
1057
- const S = await ns.create({
1058
- url: C,
1201
+ const U = await this.metadataService.getAuthorizationEndpoint();
1202
+ E.debug("Received authorization endpoint", U);
1203
+ const y = await ns.create({
1204
+ url: U,
1059
1205
  authority: this.settings.authority,
1060
1206
  client_id: this.settings.client_id,
1061
1207
  redirect_uri: g,
@@ -1063,31 +1209,33 @@ var ns = Ze, os = "openid", he = class {
1063
1209
  scope: h,
1064
1210
  state_data: e,
1065
1211
  url_state: l,
1066
- prompt: v,
1067
- display: b,
1068
- max_age: R,
1069
- ui_locales: k,
1212
+ prompt: _,
1213
+ display: S,
1214
+ max_age: x,
1215
+ ui_locales: T,
1070
1216
  id_token_hint: r,
1071
1217
  login_hint: n,
1072
- acr_values: x,
1073
- resource: E,
1218
+ acr_values: A,
1219
+ dpopJkt: R,
1220
+ resource: I,
1074
1221
  request: t,
1075
1222
  request_uri: s,
1076
- extraQueryParams: T,
1077
- extraTokenParams: w,
1223
+ extraQueryParams: P,
1224
+ extraTokenParams: M,
1078
1225
  request_type: i,
1079
- response_mode: H,
1226
+ response_mode: N,
1080
1227
  client_secret: this.settings.client_secret,
1081
- skipUserInfo: c,
1082
- nonce: o,
1083
- disablePKCE: this.settings.disablePKCE
1228
+ skipUserInfo: o,
1229
+ nonce: c,
1230
+ disablePKCE: this.settings.disablePKCE,
1231
+ omitScopeWhenRequesting: m
1084
1232
  });
1085
1233
  await this.clearStaleState();
1086
- const L = S.state;
1087
- return await this.settings.stateStore.set(L.id, L.toStorageString()), S;
1234
+ const z = y.state;
1235
+ return await this.settings.stateStore.set(z.id, z.toStorageString()), y;
1088
1236
  }
1089
1237
  async readSigninResponseState(e, t = !1) {
1090
- const s = this._logger.create("readSigninResponseState"), i = new he(me.readParams(e, this.settings.response_mode));
1238
+ const s = this._logger.create("readSigninResponseState"), i = new pe(ve.readParams(e, this.settings.response_mode));
1091
1239
  if (!i.state)
1092
1240
  throw s.throw(new Error("No state in response")), null;
1093
1241
  const r = await this.settings.stateStore[t ? "remove" : "get"](i.state);
@@ -1095,9 +1243,31 @@ var ns = Ze, os = "openid", he = class {
1095
1243
  throw s.throw(new Error("No matching state found in storage")), null;
1096
1244
  return { state: await Ye.fromStorageString(r), response: i };
1097
1245
  }
1098
- async processSigninResponse(e) {
1099
- const t = this._logger.create("processSigninResponse"), { state: s, response: i } = await this.readSigninResponseState(e, !0);
1100
- return t.debug("received state from storage; validating response"), await this._validator.validateSigninResponse(i, s), i;
1246
+ async processSigninResponse(e, t) {
1247
+ const s = this._logger.create("processSigninResponse"), { state: i, response: r } = await this.readSigninResponseState(e, !0);
1248
+ if (s.debug("received state from storage; validating response"), this.settings.dpop && this.settings.dpop.store) {
1249
+ const n = await this.getDpopProof(this.settings.dpop.store);
1250
+ t = { ...t, DPoP: n };
1251
+ }
1252
+ try {
1253
+ await this._validator.validateSigninResponse(r, i, t);
1254
+ } catch (n) {
1255
+ if (n instanceof ye && this.settings.dpop) {
1256
+ const o = await this.getDpopProof(this.settings.dpop.store, n.nonce);
1257
+ t.DPoP = o, await this._validator.validateSigninResponse(r, i, t);
1258
+ } else
1259
+ throw n;
1260
+ }
1261
+ return r;
1262
+ }
1263
+ async getDpopProof(e, t) {
1264
+ let s, i;
1265
+ return (await e.getAllKeys()).includes(this.settings.client_id) ? (i = await e.get(this.settings.client_id), i.nonce !== t && t && (i.nonce = t, await e.set(this.settings.client_id, i))) : (s = await C.generateDPoPKeys(), i = new tt(s, t), await e.set(this.settings.client_id, i)), await C.generateDPoPProof({
1266
+ url: await this.metadataService.getTokenEndpoint(!1),
1267
+ httpMethod: "POST",
1268
+ keyPair: i.keys,
1269
+ nonce: i.nonce
1270
+ });
1101
1271
  }
1102
1272
  async processResourceOwnerPasswordCredentials({
1103
1273
  username: e,
@@ -1105,7 +1275,7 @@ var ns = Ze, os = "openid", he = class {
1105
1275
  skipUserInfo: s = !1,
1106
1276
  extraTokenParams: i = {}
1107
1277
  }) {
1108
- const r = await this._tokenClient.exchangeCredentials({ username: e, password: t, ...i }), n = new he(new URLSearchParams());
1278
+ const r = await this._tokenClient.exchangeCredentials({ username: e, password: t, ...i }), n = new pe(new URLSearchParams());
1109
1279
  return Object.assign(n, r), await this._validator.validateCredentialsResponse(n, s), n;
1110
1280
  }
1111
1281
  async useRefreshToken({
@@ -1113,32 +1283,56 @@ var ns = Ze, os = "openid", he = class {
1113
1283
  redirect_uri: t,
1114
1284
  resource: s,
1115
1285
  timeoutInSeconds: i,
1116
- extraTokenParams: r
1286
+ extraHeaders: r,
1287
+ extraTokenParams: n
1117
1288
  }) {
1118
- var n;
1289
+ var o;
1119
1290
  const c = this._logger.create("useRefreshToken");
1120
- let o;
1291
+ let l;
1121
1292
  if (this.settings.refreshTokenAllowedScope === void 0)
1122
- o = e.scope;
1293
+ l = e.scope;
1123
1294
  else {
1124
- const h = this.settings.refreshTokenAllowedScope.split(" ");
1125
- o = (((n = e.scope) == null ? void 0 : n.split(" ")) || []).filter((v) => h.includes(v)).join(" ");
1295
+ const g = this.settings.refreshTokenAllowedScope.split(" ");
1296
+ l = (((o = e.scope) == null ? void 0 : o.split(" ")) || []).filter((S) => g.includes(S)).join(" ");
1126
1297
  }
1127
- const l = await this._tokenClient.exchangeRefreshToken({
1128
- refresh_token: e.refresh_token,
1129
- // provide the (possible filtered) scope list
1130
- scope: o,
1131
- redirect_uri: t,
1132
- resource: s,
1133
- timeoutInSeconds: i,
1134
- ...r
1135
- }), d = new he(new URLSearchParams());
1136
- return Object.assign(d, l), c.debug("validating response", d), await this._validator.validateRefreshResponse(d, {
1298
+ if (this.settings.dpop && this.settings.dpop.store) {
1299
+ const g = await this.getDpopProof(this.settings.dpop.store);
1300
+ r = { ...r, DPoP: g };
1301
+ }
1302
+ let d;
1303
+ try {
1304
+ d = await this._tokenClient.exchangeRefreshToken({
1305
+ refresh_token: e.refresh_token,
1306
+ // provide the (possible filtered) scope list
1307
+ scope: l,
1308
+ redirect_uri: t,
1309
+ resource: s,
1310
+ timeoutInSeconds: i,
1311
+ extraHeaders: r,
1312
+ ...n
1313
+ });
1314
+ } catch (g) {
1315
+ if (g instanceof ye && this.settings.dpop)
1316
+ r.DPoP = await this.getDpopProof(this.settings.dpop.store, g.nonce), d = await this._tokenClient.exchangeRefreshToken({
1317
+ refresh_token: e.refresh_token,
1318
+ // provide the (possible filtered) scope list
1319
+ scope: l,
1320
+ redirect_uri: t,
1321
+ resource: s,
1322
+ timeoutInSeconds: i,
1323
+ extraHeaders: r,
1324
+ ...n
1325
+ });
1326
+ else
1327
+ throw g;
1328
+ }
1329
+ const h = new pe(new URLSearchParams());
1330
+ return Object.assign(h, d), c.debug("validating response", h), await this._validator.validateRefreshResponse(h, {
1137
1331
  ...e,
1138
1332
  // override the scope in the state handed over to the validator
1139
1333
  // so it can set the granted scope to the requested scope in case none is included in the response
1140
- scope: o
1141
- }), d;
1334
+ scope: l
1335
+ }), h;
1142
1336
  }
1143
1337
  async createSignoutRequest({
1144
1338
  state: e,
@@ -1148,12 +1342,12 @@ var ns = Ze, os = "openid", he = class {
1148
1342
  post_logout_redirect_uri: r = this.settings.post_logout_redirect_uri,
1149
1343
  extraQueryParams: n = this.settings.extraQueryParams
1150
1344
  } = {}) {
1151
- const c = this._logger.create("createSignoutRequest"), o = await this.metadataService.getEndSessionEndpoint();
1152
- if (!o)
1153
- throw c.throw(new Error("No end session endpoint")), null;
1154
- c.debug("Received end session endpoint", o), !s && r && !t && (s = this.settings.client_id);
1345
+ const o = this._logger.create("createSignoutRequest"), c = await this.metadataService.getEndSessionEndpoint();
1346
+ if (!c)
1347
+ throw o.throw(new Error("No end session endpoint")), null;
1348
+ o.debug("Received end session endpoint", c), !s && r && !t && (s = this.settings.client_id);
1155
1349
  const l = new as({
1156
- url: o,
1350
+ url: c,
1157
1351
  id_token_hint: t,
1158
1352
  client_id: s,
1159
1353
  post_logout_redirect_uri: r,
@@ -1163,26 +1357,26 @@ var ns = Ze, os = "openid", he = class {
1163
1357
  });
1164
1358
  await this.clearStaleState();
1165
1359
  const d = l.state;
1166
- return d && (c.debug("Signout request has state to persist"), await this.settings.stateStore.set(d.id, d.toStorageString())), l;
1360
+ return d && (o.debug("Signout request has state to persist"), await this.settings.stateStore.set(d.id, d.toStorageString())), l;
1167
1361
  }
1168
1362
  async readSignoutResponseState(e, t = !1) {
1169
- const s = this._logger.create("readSignoutResponseState"), i = new cs(me.readParams(e, this.settings.response_mode));
1363
+ const s = this._logger.create("readSignoutResponseState"), i = new cs(ve.readParams(e, this.settings.response_mode));
1170
1364
  if (!i.state) {
1171
1365
  if (s.debug("No state in response"), i.error)
1172
- throw s.warn("Response was error:", i.error), new W(i);
1366
+ throw s.warn("Response was error:", i.error), new B(i);
1173
1367
  return { state: void 0, response: i };
1174
1368
  }
1175
1369
  const r = await this.settings.stateStore[t ? "remove" : "get"](i.state);
1176
1370
  if (!r)
1177
1371
  throw s.throw(new Error("No matching state found in storage")), null;
1178
- return { state: await ne.fromStorageString(r), response: i };
1372
+ return { state: await ge.fromStorageString(r), response: i };
1179
1373
  }
1180
1374
  async processSignoutResponse(e) {
1181
1375
  const t = this._logger.create("processSignoutResponse"), { state: s, response: i } = await this.readSignoutResponseState(e, !0);
1182
1376
  return s ? (t.debug("Received state from storage; validating response"), this._validator.validateSignoutResponse(i, s)) : t.debug("No state from storage; skipping response validation"), i;
1183
1377
  }
1184
1378
  clearStaleState() {
1185
- return this._logger.create("clearStaleState"), ne.clearStaleState(this.settings.stateStore, this.settings.staleStateAgeInSeconds);
1379
+ return this._logger.create("clearStaleState"), ge.clearStaleState(this.settings.stateStore, this.settings.staleStateAgeInSeconds);
1186
1380
  }
1187
1381
  async revokeToken(e, t) {
1188
1382
  return this._logger.create("revokeToken"), await this._tokenClient.revoke({
@@ -1205,7 +1399,7 @@ var ns = Ze, os = "openid", he = class {
1205
1399
  const r = await this._userManager.metadataService.getCheckSessionIframe();
1206
1400
  if (r) {
1207
1401
  i.debug("initializing check session iframe");
1208
- const n = this._userManager.settings.client_id, c = this._userManager.settings.checkSessionIntervalInSeconds, o = this._userManager.settings.stopCheckSessionOnError, l = new Xt(this._callback, n, r, c, o);
1402
+ const n = this._userManager.settings.client_id, o = this._userManager.settings.checkSessionIntervalInSeconds, c = this._userManager.settings.stopCheckSessionOnError, l = new Xt(this._callback, n, r, o, c);
1209
1403
  await l.load(), this._checkSessionIFrame = l, l.start(s);
1210
1404
  } else
1211
1405
  i.warn("no check session iframe found in the metadata");
@@ -1264,7 +1458,7 @@ var ns = Ze, os = "openid", he = class {
1264
1458
  }
1265
1459
  }
1266
1460
  }
1267
- }, ge = class tt {
1461
+ }, fe = class st {
1268
1462
  constructor(t) {
1269
1463
  var s;
1270
1464
  this.id_token = t.id_token, this.session_state = (s = t.session_state) != null ? s : null, this.access_token = t.access_token, this.refresh_token = t.refresh_token, this.token_type = t.token_type, this.scope = t.scope, this.profile = t.profile, this.expires_at = t.expires_at, this.state = t.userState, this.url_state = t.url_state;
@@ -1272,10 +1466,10 @@ var ns = Ze, os = "openid", he = class {
1272
1466
  /** Computed number of seconds the access token has remaining. */
1273
1467
  get expires_in() {
1274
1468
  if (this.expires_at !== void 0)
1275
- return this.expires_at - M.getEpochTime();
1469
+ return this.expires_at - F.getEpochTime();
1276
1470
  }
1277
1471
  set expires_in(t) {
1278
- t !== void 0 && (this.expires_at = Math.floor(t) + M.getEpochTime());
1472
+ t !== void 0 && (this.expires_at = Math.floor(t) + F.getEpochTime());
1279
1473
  }
1280
1474
  /** Computed value indicating if the access token is expired. */
1281
1475
  get expired() {
@@ -1301,11 +1495,11 @@ var ns = Ze, os = "openid", he = class {
1301
1495
  });
1302
1496
  }
1303
1497
  static fromStorageString(t) {
1304
- return u.createStatic("User", "fromStorageString"), new tt(JSON.parse(t));
1498
+ return u.createStatic("User", "fromStorageString"), new st(JSON.parse(t));
1305
1499
  }
1306
- }, $e = "oidc-client", st = class {
1500
+ }, Me = "oidc-client", it = class {
1307
1501
  constructor() {
1308
- this._abort = new F("Window navigation aborted"), this._disposeHandlers = /* @__PURE__ */ new Set(), this._window = null;
1502
+ this._abort = new W("Window navigation aborted"), this._disposeHandlers = /* @__PURE__ */ new Set(), this._window = null;
1309
1503
  }
1310
1504
  async navigate(e) {
1311
1505
  const t = this._logger.create("navigate");
@@ -1313,13 +1507,13 @@ var ns = Ze, os = "openid", he = class {
1313
1507
  throw new Error("Attempted to navigate on a disposed window");
1314
1508
  t.debug("setting URL in window"), this._window.location.replace(e.url);
1315
1509
  const { url: s, keepOpen: i } = await new Promise((r, n) => {
1316
- const c = (o) => {
1510
+ const o = (c) => {
1317
1511
  var l;
1318
- const d = o.data, h = (l = e.scriptOrigin) != null ? l : window.location.origin;
1319
- if (!(o.origin !== h || (d == null ? void 0 : d.source) !== $e)) {
1512
+ const d = c.data, h = (l = e.scriptOrigin) != null ? l : window.location.origin;
1513
+ if (!(c.origin !== h || (d == null ? void 0 : d.source) !== Me)) {
1320
1514
  try {
1321
- const g = me.readParams(d.url, e.response_mode).get("state");
1322
- if (g || t.warn("no state found in response url"), o.source !== this._window && g !== e.state)
1515
+ const g = ve.readParams(d.url, e.response_mode).get("state");
1516
+ if (g || t.warn("no state found in response url"), c.source !== this._window && g !== e.state)
1323
1517
  return;
1324
1518
  } catch {
1325
1519
  this._dispose(), n(new Error("Invalid response from window"));
@@ -1327,8 +1521,8 @@ var ns = Ze, os = "openid", he = class {
1327
1521
  r(d);
1328
1522
  }
1329
1523
  };
1330
- window.addEventListener("message", c, !1), this._disposeHandlers.add(() => window.removeEventListener("message", c, !1)), this._disposeHandlers.add(this._abort.addHandler((o) => {
1331
- this._dispose(), n(o);
1524
+ window.addEventListener("message", o, !1), this._disposeHandlers.add(() => window.removeEventListener("message", o, !1)), this._disposeHandlers.add(this._abort.addHandler((c) => {
1525
+ this._dispose(), n(c);
1332
1526
  }));
1333
1527
  });
1334
1528
  return t.debug("got response from window"), this._dispose(), i || this.close(), { url: s };
@@ -1341,55 +1535,56 @@ var ns = Ze, os = "openid", he = class {
1341
1535
  }
1342
1536
  static _notifyParent(e, t, s = !1, i = window.location.origin) {
1343
1537
  e.postMessage({
1344
- source: $e,
1538
+ source: Me,
1345
1539
  url: t,
1346
1540
  keepOpen: s
1347
1541
  }, i);
1348
1542
  }
1349
- }, it = {
1543
+ }, rt = {
1350
1544
  location: !1,
1351
1545
  toolbar: !1,
1352
1546
  height: 640,
1353
1547
  closePopupWindowAfterInSeconds: -1
1354
- }, rt = "_blank", _s = 60, ps = 2, nt = 10, fs = class extends ve {
1548
+ }, nt = "_blank", _s = 60, ps = 2, ot = 10, fs = class extends be {
1355
1549
  constructor(e) {
1356
1550
  const {
1357
1551
  popup_redirect_uri: t = e.redirect_uri,
1358
1552
  popup_post_logout_redirect_uri: s = e.post_logout_redirect_uri,
1359
- popupWindowFeatures: i = it,
1360
- popupWindowTarget: r = rt,
1553
+ popupWindowFeatures: i = rt,
1554
+ popupWindowTarget: r = nt,
1361
1555
  redirectMethod: n = "assign",
1362
- redirectTarget: c = "self",
1363
- iframeNotifyParentOrigin: o = e.iframeNotifyParentOrigin,
1556
+ redirectTarget: o = "self",
1557
+ iframeNotifyParentOrigin: c = e.iframeNotifyParentOrigin,
1364
1558
  iframeScriptOrigin: l = e.iframeScriptOrigin,
1365
- silent_redirect_uri: d = e.redirect_uri,
1366
- silentRequestTimeoutInSeconds: h = nt,
1367
- automaticSilentRenew: g = !0,
1368
- validateSubOnSilentRenew: v = !0,
1369
- includeIdTokenInSilentRenew: b = !1,
1370
- monitorSession: R = !1,
1371
- monitorAnonymousSession: k = !1,
1372
- checkSessionIntervalInSeconds: x = ps,
1373
- query_status_response_type: E = "code",
1374
- stopCheckSessionOnError: H = !0,
1375
- revokeTokenTypes: T = ["access_token", "refresh_token"],
1376
- revokeTokensOnSignout: w = !1,
1377
- includeIdTokenInSilentSignout: U = !1,
1378
- accessTokenExpiringNotificationTimeInSeconds: C = _s,
1379
- userStore: S
1559
+ requestTimeoutInSeconds: d,
1560
+ silent_redirect_uri: h = e.redirect_uri,
1561
+ silentRequestTimeoutInSeconds: g,
1562
+ automaticSilentRenew: _ = !0,
1563
+ validateSubOnSilentRenew: S = !0,
1564
+ includeIdTokenInSilentRenew: x = !1,
1565
+ monitorSession: T = !1,
1566
+ monitorAnonymousSession: A = !1,
1567
+ checkSessionIntervalInSeconds: I = ps,
1568
+ query_status_response_type: N = "code",
1569
+ stopCheckSessionOnError: P = !0,
1570
+ revokeTokenTypes: M = ["access_token", "refresh_token"],
1571
+ revokeTokensOnSignout: R = !1,
1572
+ includeIdTokenInSilentSignout: m = !1,
1573
+ accessTokenExpiringNotificationTimeInSeconds: E = _s,
1574
+ userStore: U
1380
1575
  } = e;
1381
- if (super(e), this.popup_redirect_uri = t, this.popup_post_logout_redirect_uri = s, this.popupWindowFeatures = i, this.popupWindowTarget = r, this.redirectMethod = n, this.redirectTarget = c, this.iframeNotifyParentOrigin = o, this.iframeScriptOrigin = l, this.silent_redirect_uri = d, this.silentRequestTimeoutInSeconds = h, this.automaticSilentRenew = g, this.validateSubOnSilentRenew = v, this.includeIdTokenInSilentRenew = b, this.monitorSession = R, this.monitorAnonymousSession = k, this.checkSessionIntervalInSeconds = x, this.stopCheckSessionOnError = H, this.query_status_response_type = E, this.revokeTokenTypes = T, this.revokeTokensOnSignout = w, this.includeIdTokenInSilentSignout = U, this.accessTokenExpiringNotificationTimeInSeconds = C, S)
1382
- this.userStore = S;
1576
+ if (super(e), this.popup_redirect_uri = t, this.popup_post_logout_redirect_uri = s, this.popupWindowFeatures = i, this.popupWindowTarget = r, this.redirectMethod = n, this.redirectTarget = o, this.iframeNotifyParentOrigin = c, this.iframeScriptOrigin = l, this.silent_redirect_uri = h, this.silentRequestTimeoutInSeconds = g || d || ot, this.automaticSilentRenew = _, this.validateSubOnSilentRenew = S, this.includeIdTokenInSilentRenew = x, this.monitorSession = T, this.monitorAnonymousSession = A, this.checkSessionIntervalInSeconds = I, this.stopCheckSessionOnError = P, this.query_status_response_type = N, this.revokeTokenTypes = M, this.revokeTokensOnSignout = R, this.includeIdTokenInSilentSignout = m, this.accessTokenExpiringNotificationTimeInSeconds = E, U)
1577
+ this.userStore = U;
1383
1578
  else {
1384
- const L = typeof window < "u" ? window.sessionStorage : new Ge();
1385
- this.userStore = new Qe({ store: L });
1579
+ const y = typeof window < "u" ? window.sessionStorage : new Ge();
1580
+ this.userStore = new Qe({ store: y });
1386
1581
  }
1387
1582
  }
1388
- }, We = class ot extends st {
1583
+ }, Fe = class at extends it {
1389
1584
  constructor({
1390
- silentRequestTimeoutInSeconds: t = nt
1585
+ silentRequestTimeoutInSeconds: t = ot
1391
1586
  }) {
1392
- super(), this._logger = new u("IFrameWindow"), this._timeoutInSeconds = t, this._frame = ot.createHiddenIframe(), this._window = this._frame.contentWindow;
1587
+ super(), this._logger = new u("IFrameWindow"), this._timeoutInSeconds = t, this._frame = at.createHiddenIframe(), this._window = this._frame.contentWindow;
1393
1588
  }
1394
1589
  static createHiddenIframe() {
1395
1590
  const t = window.document.createElement("iframe");
@@ -1397,7 +1592,7 @@ var ns = Ze, os = "openid", he = class {
1397
1592
  }
1398
1593
  async navigate(t) {
1399
1594
  this._logger.debug("navigate: Using timeout of:", this._timeoutInSeconds);
1400
- const s = setTimeout(() => void this._abort.raise(new Ue("IFrame timed out without a response")), this._timeoutInSeconds * 1e3);
1595
+ const s = setTimeout(() => void this._abort.raise(new Ae("IFrame timed out without a response")), this._timeoutInSeconds * 1e3);
1401
1596
  return this._disposeHandlers.add(() => clearTimeout(s)), await super.navigate(t);
1402
1597
  }
1403
1598
  close() {
@@ -1418,19 +1613,23 @@ var ns = Ze, os = "openid", he = class {
1418
1613
  async prepare({
1419
1614
  silentRequestTimeoutInSeconds: e = this._settings.silentRequestTimeoutInSeconds
1420
1615
  }) {
1421
- return new We({ silentRequestTimeoutInSeconds: e });
1616
+ return new Fe({ silentRequestTimeoutInSeconds: e });
1422
1617
  }
1423
1618
  async callback(e) {
1424
- this._logger.create("callback"), We.notifyParent(e, this._settings.iframeNotifyParentOrigin);
1619
+ this._logger.create("callback"), Fe.notifyParent(e, this._settings.iframeNotifyParentOrigin);
1425
1620
  }
1426
- }, ws = 500, vs = 1e3, Ke = class extends st {
1621
+ }, ws = 500, vs = 1e3, We = class extends it {
1427
1622
  constructor({
1428
- popupWindowTarget: e = rt,
1429
- popupWindowFeatures: t = {}
1623
+ popupWindowTarget: e = nt,
1624
+ popupWindowFeatures: t = {},
1625
+ popupSignal: s
1430
1626
  }) {
1431
1627
  super(), this._logger = new u("PopupWindow");
1432
- const s = De.center({ ...it, ...t });
1433
- this._window = window.open(void 0, e, De.serialize(s)), t.closePopupWindowAfterInSeconds && t.closePopupWindowAfterInSeconds > 0 && setTimeout(() => {
1628
+ const i = $e.center({ ...rt, ...t });
1629
+ this._window = window.open(void 0, e, $e.serialize(i)), s && s.addEventListener("abort", () => {
1630
+ var r;
1631
+ this._abort.raise(new Error((r = s.reason) != null ? r : "Popup aborted"));
1632
+ }), t.closePopupWindowAfterInSeconds && t.closePopupWindowAfterInSeconds > 0 && setTimeout(() => {
1434
1633
  if (!this._window || typeof this._window.closed != "boolean" || this._window.closed) {
1435
1634
  this._abort.raise(new Error("Popup blocked by user"));
1436
1635
  return;
@@ -1460,14 +1659,15 @@ var ns = Ze, os = "openid", he = class {
1460
1659
  }
1461
1660
  async prepare({
1462
1661
  popupWindowFeatures: e = this._settings.popupWindowFeatures,
1463
- popupWindowTarget: t = this._settings.popupWindowTarget
1662
+ popupWindowTarget: t = this._settings.popupWindowTarget,
1663
+ popupSignal: s
1464
1664
  }) {
1465
- return new Ke({ popupWindowFeatures: e, popupWindowTarget: t });
1665
+ return new We({ popupWindowFeatures: e, popupWindowTarget: t, popupSignal: s });
1466
1666
  }
1467
1667
  async callback(e, { keepOpen: t = !1 }) {
1468
- this._logger.create("callback"), Ke.notifyOpener(e, t);
1668
+ this._logger.create("callback"), We.notifyOpener(e, t);
1469
1669
  }
1470
- }, bs = class {
1670
+ }, ys = class {
1471
1671
  constructor(e) {
1472
1672
  this._settings = e, this._logger = new u("RedirectNavigator");
1473
1673
  }
@@ -1482,12 +1682,12 @@ var ns = Ze, os = "openid", he = class {
1482
1682
  const r = i.location[e].bind(i.location);
1483
1683
  let n;
1484
1684
  return {
1485
- navigate: async (c) => {
1685
+ navigate: async (o) => {
1486
1686
  this._logger.create("navigate");
1487
- const o = new Promise((l, d) => {
1687
+ const c = new Promise((l, d) => {
1488
1688
  n = d;
1489
1689
  });
1490
- return r(c.url), await o;
1690
+ return r(o.url), await c;
1491
1691
  },
1492
1692
  close: () => {
1493
1693
  this._logger.create("close"), n == null || n(new Error("Redirect aborted")), i.stop();
@@ -1496,9 +1696,9 @@ var ns = Ze, os = "openid", he = class {
1496
1696
  }
1497
1697
  async callback() {
1498
1698
  }
1499
- }, ys = class extends Qt {
1699
+ }, bs = class extends Qt {
1500
1700
  constructor(e) {
1501
- super({ expiringNotificationTimeInSeconds: e.accessTokenExpiringNotificationTimeInSeconds }), this._logger = new u("UserManagerEvents"), this._userLoaded = new F("User loaded"), this._userUnloaded = new F("User unloaded"), this._silentRenewError = new F("Silent renew error"), this._userSignedIn = new F("User signed in"), this._userSignedOut = new F("User signed out"), this._userSessionChanged = new F("User session changed");
1701
+ super({ expiringNotificationTimeInSeconds: e.accessTokenExpiringNotificationTimeInSeconds }), this._logger = new u("UserManagerEvents"), this._userLoaded = new W("User loaded"), this._userUnloaded = new W("User unloaded"), this._silentRenewError = new W("Silent renew error"), this._userSignedIn = new W("User signed in"), this._userSignedOut = new W("User signed out"), this._userSessionChanged = new W("User session changed");
1502
1702
  }
1503
1703
  async load(e, t = !0) {
1504
1704
  super.load(e), t && await this._userLoaded.raise(e);
@@ -1607,12 +1807,12 @@ var ns = Ze, os = "openid", he = class {
1607
1807
  }
1608
1808
  }, ks = class {
1609
1809
  constructor(e) {
1610
- this._userManager = e, this._logger = new u("SilentRenewService"), this._isStarted = !1, this._retryTimer = new M("Retry Silent Renew"), this._tokenExpiring = async () => {
1810
+ this._userManager = e, this._logger = new u("SilentRenewService"), this._isStarted = !1, this._retryTimer = new F("Retry Silent Renew"), this._tokenExpiring = async () => {
1611
1811
  const t = this._logger.create("_tokenExpiring");
1612
1812
  try {
1613
1813
  await this._userManager.signinSilent(), t.debug("silent token renewal successful");
1614
1814
  } catch (s) {
1615
- if (s instanceof Ue) {
1815
+ if (s instanceof Ae) {
1616
1816
  t.warn("ErrorTimeout from signinSilent:", s, "retry in 5s"), this._retryTimer.init(5);
1617
1817
  return;
1618
1818
  }
@@ -1640,7 +1840,7 @@ var ns = Ze, os = "openid", he = class {
1640
1840
  }
1641
1841
  }, Is = class {
1642
1842
  constructor(e, t, s, i) {
1643
- this._logger = new u("UserManager"), this.settings = new fs(e), this._client = new gs(e), this._redirectNavigator = t ?? new bs(this.settings), this._popupNavigator = s ?? new Ss(this.settings), this._iframeNavigator = i ?? new ms(this.settings), this._events = new ys(this.settings), this._silentRenewService = new ks(this), this.settings.automaticSilentRenew && this.startSilentRenew(), this._sessionMonitor = null, this.settings.monitorSession && (this._sessionMonitor = new us(this));
1843
+ this._logger = new u("UserManager"), this.settings = new fs(e), this._client = new gs(e), this._redirectNavigator = t ?? new ys(this.settings), this._popupNavigator = s ?? new Ss(this.settings), this._iframeNavigator = i ?? new ms(this.settings), this._events = new bs(this.settings), this._silentRenewService = new ks(this), this.settings.automaticSilentRenew && this.startSilentRenew(), this._sessionMonitor = null, this.settings.monitorSession && (this._sessionMonitor = new us(this));
1644
1844
  }
1645
1845
  /**
1646
1846
  * Get object used to register for events raised by the `UserManager`.
@@ -1680,19 +1880,24 @@ var ns = Ze, os = "openid", he = class {
1680
1880
  * @throws `Error` In cases of wrong authentication.
1681
1881
  */
1682
1882
  async signinRedirect(e = {}) {
1883
+ var t;
1683
1884
  this._logger.create("signinRedirect");
1684
1885
  const {
1685
- redirectMethod: t,
1686
- ...s
1687
- } = e, i = await this._redirectNavigator.prepare({ redirectMethod: t });
1886
+ redirectMethod: s,
1887
+ ...i
1888
+ } = e;
1889
+ let r;
1890
+ (t = this.settings.dpop) != null && t.bind_authorization_code && (r = await this.generateDPoPJkt(this.settings.dpop));
1891
+ const n = await this._redirectNavigator.prepare({ redirectMethod: s });
1688
1892
  await this._signinStart({
1689
1893
  request_type: "si:r",
1690
- ...s
1691
- }, i);
1894
+ dpopJkt: r,
1895
+ ...i
1896
+ }, n);
1692
1897
  }
1693
1898
  /**
1694
1899
  * Process the response (callback) from the authorization endpoint.
1695
- * It is recommend to use {@link UserManager.signinCallback} instead.
1900
+ * It is recommended to use {@link UserManager.signinCallback} instead.
1696
1901
  *
1697
1902
  * @returns A promise containing the authenticated `User`.
1698
1903
  *
@@ -1713,7 +1918,12 @@ var ns = Ze, os = "openid", he = class {
1713
1918
  password: t,
1714
1919
  skipUserInfo: s = !1
1715
1920
  }) {
1716
- const i = this._logger.create("signinResourceOwnerCredential"), r = await this._client.processResourceOwnerPasswordCredentials({ username: e, password: t, skipUserInfo: s, extraTokenParams: this.settings.extraTokenParams });
1921
+ const i = this._logger.create("signinResourceOwnerCredential"), r = await this._client.processResourceOwnerPasswordCredentials({
1922
+ username: e,
1923
+ password: t,
1924
+ skipUserInfo: s,
1925
+ extraTokenParams: this.settings.extraTokenParams
1926
+ });
1717
1927
  i.debug("got signin response");
1718
1928
  const n = await this._buildUser(r);
1719
1929
  return n.profile && n.profile.sub ? i.info("success, signed in subject", n.profile.sub) : i.info("no subject"), n;
@@ -1725,23 +1935,29 @@ var ns = Ze, os = "openid", he = class {
1725
1935
  * @throws `Error` In cases of wrong authentication.
1726
1936
  */
1727
1937
  async signinPopup(e = {}) {
1728
- const t = this._logger.create("signinPopup"), {
1729
- popupWindowFeatures: s,
1730
- popupWindowTarget: i,
1731
- ...r
1732
- } = e, n = this.settings.popup_redirect_uri;
1733
- n || t.throw(new Error("No popup_redirect_uri configured"));
1734
- const c = await this._popupNavigator.prepare({ popupWindowFeatures: s, popupWindowTarget: i }), o = await this._signin({
1938
+ var t;
1939
+ const s = this._logger.create("signinPopup");
1940
+ let i;
1941
+ (t = this.settings.dpop) != null && t.bind_authorization_code && (i = await this.generateDPoPJkt(this.settings.dpop));
1942
+ const {
1943
+ popupWindowFeatures: r,
1944
+ popupWindowTarget: n,
1945
+ popupSignal: o,
1946
+ ...c
1947
+ } = e, l = this.settings.popup_redirect_uri;
1948
+ l || s.throw(new Error("No popup_redirect_uri configured"));
1949
+ const d = await this._popupNavigator.prepare({ popupWindowFeatures: r, popupWindowTarget: n, popupSignal: o }), h = await this._signin({
1735
1950
  request_type: "si:p",
1736
- redirect_uri: n,
1951
+ redirect_uri: l,
1737
1952
  display: "popup",
1738
- ...r
1739
- }, c);
1740
- return o && (o.profile && o.profile.sub ? t.info("success, signed in subject", o.profile.sub) : t.info("no subject")), o;
1953
+ dpopJkt: i,
1954
+ ...c
1955
+ }, d);
1956
+ return h && (h.profile && h.profile.sub ? s.info("success, signed in subject", h.profile.sub) : s.info("no subject")), h;
1741
1957
  }
1742
1958
  /**
1743
1959
  * Notify the opening window of response (callback) from the authorization endpoint.
1744
- * It is recommend to use {@link UserManager.signinCallback} instead.
1960
+ * It is recommended to use {@link UserManager.signinCallback} instead.
1745
1961
  *
1746
1962
  * @returns A promise
1747
1963
  *
@@ -1757,47 +1973,50 @@ var ns = Ze, os = "openid", he = class {
1757
1973
  * @returns A promise that contains the authenticated `User`.
1758
1974
  */
1759
1975
  async signinSilent(e = {}) {
1760
- var t;
1761
- const s = this._logger.create("signinSilent"), {
1762
- silentRequestTimeoutInSeconds: i,
1763
- ...r
1976
+ var t, s;
1977
+ const i = this._logger.create("signinSilent"), {
1978
+ silentRequestTimeoutInSeconds: r,
1979
+ ...n
1764
1980
  } = e;
1765
- let n = await this._loadUser();
1766
- if (n != null && n.refresh_token) {
1767
- s.debug("using refresh token");
1768
- const d = new Ts(n);
1981
+ let o = await this._loadUser();
1982
+ if (o != null && o.refresh_token) {
1983
+ i.debug("using refresh token");
1984
+ const g = new Ts(o);
1769
1985
  return await this._useRefreshToken({
1770
- state: d,
1771
- redirect_uri: r.redirect_uri,
1772
- resource: r.resource,
1773
- extraTokenParams: r.extraTokenParams,
1774
- timeoutInSeconds: i
1986
+ state: g,
1987
+ redirect_uri: n.redirect_uri,
1988
+ resource: n.resource,
1989
+ extraTokenParams: n.extraTokenParams,
1990
+ timeoutInSeconds: r
1775
1991
  });
1776
1992
  }
1777
- const c = this.settings.silent_redirect_uri;
1778
- c || s.throw(new Error("No silent_redirect_uri configured"));
1779
- let o;
1780
- n && this.settings.validateSubOnSilentRenew && (s.debug("subject prior to silent renew:", n.profile.sub), o = n.profile.sub);
1781
- const l = await this._iframeNavigator.prepare({ silentRequestTimeoutInSeconds: i });
1782
- return n = await this._signin({
1993
+ let c;
1994
+ (t = this.settings.dpop) != null && t.bind_authorization_code && (c = await this.generateDPoPJkt(this.settings.dpop));
1995
+ const l = this.settings.silent_redirect_uri;
1996
+ l || i.throw(new Error("No silent_redirect_uri configured"));
1997
+ let d;
1998
+ o && this.settings.validateSubOnSilentRenew && (i.debug("subject prior to silent renew:", o.profile.sub), d = o.profile.sub);
1999
+ const h = await this._iframeNavigator.prepare({ silentRequestTimeoutInSeconds: r });
2000
+ return o = await this._signin({
1783
2001
  request_type: "si:s",
1784
- redirect_uri: c,
2002
+ redirect_uri: l,
1785
2003
  prompt: "none",
1786
- id_token_hint: this.settings.includeIdTokenInSilentRenew ? n == null ? void 0 : n.id_token : void 0,
1787
- ...r
1788
- }, l, o), n && ((t = n.profile) != null && t.sub ? s.info("success, signed in subject", n.profile.sub) : s.info("no subject")), n;
2004
+ id_token_hint: this.settings.includeIdTokenInSilentRenew ? o == null ? void 0 : o.id_token : void 0,
2005
+ dpopJkt: c,
2006
+ ...n
2007
+ }, h, d), o && ((s = o.profile) != null && s.sub ? i.info("success, signed in subject", o.profile.sub) : i.info("no subject")), o;
1789
2008
  }
1790
2009
  async _useRefreshToken(e) {
1791
2010
  const t = await this._client.useRefreshToken({
1792
- ...e,
1793
- timeoutInSeconds: this.settings.silentRequestTimeoutInSeconds
1794
- }), s = new ge({ ...e.state, ...t });
2011
+ timeoutInSeconds: this.settings.silentRequestTimeoutInSeconds,
2012
+ ...e
2013
+ }), s = new fe({ ...e.state, ...t });
1795
2014
  return await this.storeUser(s), await this._events.load(s), s;
1796
2015
  }
1797
2016
  /**
1798
2017
  *
1799
2018
  * Notify the parent window of response (callback) from the authorization endpoint.
1800
- * It is recommend to use {@link UserManager.signinCallback} instead.
2019
+ * It is recommended to use {@link UserManager.signinCallback} instead.
1801
2020
  *
1802
2021
  * @returns A promise
1803
2022
  *
@@ -1814,7 +2033,7 @@ var ns = Ze, os = "openid", he = class {
1814
2033
  * - {@link UserManager.signinPopupCallback}
1815
2034
  * - {@link UserManager.signinSilentCallback}
1816
2035
  *
1817
- * @throws `Error` If request_type is unknown or signout can not processed.
2036
+ * @throws `Error` If request_type is unknown or signin cannot be processed.
1818
2037
  */
1819
2038
  async signinCallback(e = window.location.href) {
1820
2039
  const { state: t } = await this._client.readSigninResponseState(e);
@@ -1822,9 +2041,11 @@ var ns = Ze, os = "openid", he = class {
1822
2041
  case "si:r":
1823
2042
  return await this.signinRedirectCallback(e);
1824
2043
  case "si:p":
1825
- return await this.signinPopupCallback(e);
2044
+ await this.signinPopupCallback(e);
2045
+ break;
1826
2046
  case "si:s":
1827
- return await this.signinSilentCallback(e);
2047
+ await this.signinSilentCallback(e);
2048
+ break;
1828
2049
  default:
1829
2050
  throw new Error("invalid response_type in state");
1830
2051
  }
@@ -1836,15 +2057,14 @@ var ns = Ze, os = "openid", he = class {
1836
2057
  * - {@link UserManager.signoutPopupCallback}
1837
2058
  * - {@link UserManager.signoutSilentCallback}
1838
2059
  *
1839
- * @throws `Error` If request_type is unknown or signout can not processed.
2060
+ * @throws `Error` If request_type is unknown or signout cannot be processed.
1840
2061
  */
1841
2062
  async signoutCallback(e = window.location.href, t = !1) {
1842
2063
  const { state: s } = await this._client.readSignoutResponseState(e);
1843
2064
  if (s)
1844
2065
  switch (s.request_type) {
1845
2066
  case "so:r":
1846
- await this.signoutRedirectCallback(e);
1847
- break;
2067
+ return await this.signoutRedirectCallback(e);
1848
2068
  case "so:p":
1849
2069
  await this.signoutPopupCallback(e, t);
1850
2070
  break;
@@ -1866,7 +2086,7 @@ var ns = Ze, os = "openid", he = class {
1866
2086
  ...i
1867
2087
  } = e, r = this.settings.silent_redirect_uri;
1868
2088
  r || t.throw(new Error("No silent_redirect_uri configured"));
1869
- const n = await this._loadUser(), c = await this._iframeNavigator.prepare({ silentRequestTimeoutInSeconds: s }), o = await this._signinStart({
2089
+ const n = await this._loadUser(), o = await this._iframeNavigator.prepare({ silentRequestTimeoutInSeconds: s }), c = await this._signinStart({
1870
2090
  request_type: "si:s",
1871
2091
  // this acts like a signin silent
1872
2092
  redirect_uri: r,
@@ -1876,15 +2096,15 @@ var ns = Ze, os = "openid", he = class {
1876
2096
  scope: "openid",
1877
2097
  skipUserInfo: !0,
1878
2098
  ...i
1879
- }, c);
2099
+ }, o);
1880
2100
  try {
1881
- const l = await this._client.processSigninResponse(o.url);
1882
- return t.debug("got signin response"), l.session_state && l.profile.sub ? (t.info("success for subject", l.profile.sub), {
1883
- session_state: l.session_state,
1884
- sub: l.profile.sub
2101
+ const l = {}, d = await this._client.processSigninResponse(c.url, l);
2102
+ return t.debug("got signin response"), d.session_state && d.profile.sub ? (t.info("success for subject", d.profile.sub), {
2103
+ session_state: d.session_state,
2104
+ sub: d.profile.sub
1885
2105
  }) : (t.info("success, user not authenticated"), null);
1886
2106
  } catch (l) {
1887
- if (this.settings.monitorAnonymousSession && l instanceof W)
2107
+ if (this.settings.monitorAnonymousSession && l instanceof B)
1888
2108
  switch (l.error) {
1889
2109
  case "login_required":
1890
2110
  case "consent_required":
@@ -1917,14 +2137,14 @@ var ns = Ze, os = "openid", he = class {
1917
2137
  }
1918
2138
  }
1919
2139
  async _signinEnd(e, t) {
1920
- const s = this._logger.create("_signinEnd"), i = await this._client.processSigninResponse(e);
1921
- return s.debug("got signin response"), await this._buildUser(i, t);
2140
+ const s = this._logger.create("_signinEnd"), i = {}, r = await this._client.processSigninResponse(e, i);
2141
+ return s.debug("got signin response"), await this._buildUser(r, t);
1922
2142
  }
1923
2143
  async _buildUser(e, t) {
1924
- const s = this._logger.create("_buildUser"), i = new ge(e);
2144
+ const s = this._logger.create("_buildUser"), i = new fe(e);
1925
2145
  if (t) {
1926
2146
  if (t !== i.profile.sub)
1927
- throw s.debug("current user does not match user returned from signin. sub from signin:", i.profile.sub), new W({ ...e, error: "login_required" });
2147
+ throw s.debug("current user does not match user returned from signin. sub from signin:", i.profile.sub), new B({ ...e, error: "login_required" });
1928
2148
  s.debug("current user matches user returned from signin");
1929
2149
  }
1930
2150
  return await this.storeUser(i), s.debug("user stored"), await this._events.load(i), i;
@@ -1947,7 +2167,7 @@ var ns = Ze, os = "openid", he = class {
1947
2167
  }
1948
2168
  /**
1949
2169
  * Process response (callback) from the end session endpoint.
1950
- * It is recommend to use {@link UserManager.signoutCallback} instead.
2170
+ * It is recommended to use {@link UserManager.signoutCallback} instead.
1951
2171
  *
1952
2172
  * @returns A promise containing signout response
1953
2173
  *
@@ -1958,7 +2178,7 @@ var ns = Ze, os = "openid", he = class {
1958
2178
  return t.info("success"), s;
1959
2179
  }
1960
2180
  /**
1961
- * Trigger a redirect of a popup window window to the end session endpoint.
2181
+ * Trigger a redirect of a popup window to the end session endpoint.
1962
2182
  *
1963
2183
  * @returns A promise
1964
2184
  */
@@ -1966,23 +2186,24 @@ var ns = Ze, os = "openid", he = class {
1966
2186
  const t = this._logger.create("signoutPopup"), {
1967
2187
  popupWindowFeatures: s,
1968
2188
  popupWindowTarget: i,
1969
- ...r
1970
- } = e, n = this.settings.popup_post_logout_redirect_uri, c = await this._popupNavigator.prepare({ popupWindowFeatures: s, popupWindowTarget: i });
2189
+ popupSignal: r,
2190
+ ...n
2191
+ } = e, o = this.settings.popup_post_logout_redirect_uri, c = await this._popupNavigator.prepare({ popupWindowFeatures: s, popupWindowTarget: i, popupSignal: r });
1971
2192
  await this._signout({
1972
2193
  request_type: "so:p",
1973
- post_logout_redirect_uri: n,
2194
+ post_logout_redirect_uri: o,
1974
2195
  // we're putting a dummy entry in here because we
1975
2196
  // need a unique id from the state for notification
1976
2197
  // to the parent window, which is necessary if we
1977
2198
  // plan to return back to the client after signout
1978
2199
  // and so we can close the popup after signout
1979
- state: n == null ? void 0 : {},
1980
- ...r
2200
+ state: o == null ? void 0 : {},
2201
+ ...n
1981
2202
  }, c), t.info("success");
1982
2203
  }
1983
2204
  /**
1984
2205
  * Process response (callback) from the end session endpoint from a popup window.
1985
- * It is recommend to use {@link UserManager.signoutCallback} instead.
2206
+ * It is recommended to use {@link UserManager.signoutCallback} instead.
1986
2207
  *
1987
2208
  * @returns A promise
1988
2209
  *
@@ -2004,10 +2225,10 @@ var ns = Ze, os = "openid", he = class {
2004
2225
  i.debug("loaded current user from storage"), this.settings.revokeTokensOnSignout && await this._revokeInternal(r);
2005
2226
  const n = e.id_token_hint || r && r.id_token;
2006
2227
  n && (i.debug("setting id_token_hint in signout request"), e.id_token_hint = n), await this.removeUser(), i.debug("user removed, creating signout request");
2007
- const c = await this._client.createSignoutRequest(e);
2228
+ const o = await this._client.createSignoutRequest(e);
2008
2229
  return i.debug("got signout request"), await t.navigate({
2009
- url: c.url,
2010
- state: (s = c.state) == null ? void 0 : s.id,
2230
+ url: o.url,
2231
+ state: (s = o.state) == null ? void 0 : s.id,
2011
2232
  scriptOrigin: this.settings.iframeScriptOrigin
2012
2233
  });
2013
2234
  } catch (r) {
@@ -2028,17 +2249,17 @@ var ns = Ze, os = "openid", he = class {
2028
2249
  const s = this._logger.create("signoutSilent"), {
2029
2250
  silentRequestTimeoutInSeconds: i,
2030
2251
  ...r
2031
- } = e, n = this.settings.includeIdTokenInSilentSignout ? (t = await this._loadUser()) == null ? void 0 : t.id_token : void 0, c = this.settings.popup_post_logout_redirect_uri, o = await this._iframeNavigator.prepare({ silentRequestTimeoutInSeconds: i });
2252
+ } = e, n = this.settings.includeIdTokenInSilentSignout ? (t = await this._loadUser()) == null ? void 0 : t.id_token : void 0, o = this.settings.popup_post_logout_redirect_uri, c = await this._iframeNavigator.prepare({ silentRequestTimeoutInSeconds: i });
2032
2253
  await this._signout({
2033
2254
  request_type: "so:s",
2034
- post_logout_redirect_uri: c,
2255
+ post_logout_redirect_uri: o,
2035
2256
  id_token_hint: n,
2036
2257
  ...r
2037
- }, o), s.info("success");
2258
+ }, c), s.info("success");
2038
2259
  }
2039
2260
  /**
2040
2261
  * Notify the parent window of response (callback) from the end session endpoint.
2041
- * It is recommend to use {@link UserManager.signoutCallback} instead.
2262
+ * It is recommended to use {@link UserManager.signoutCallback} instead.
2042
2263
  *
2043
2264
  * @returns A promise
2044
2265
  *
@@ -2054,8 +2275,7 @@ var ns = Ze, os = "openid", he = class {
2054
2275
  }
2055
2276
  async _revokeInternal(e, t = this.settings.revokeTokenTypes) {
2056
2277
  const s = this._logger.create("_revokeInternal");
2057
- if (!e)
2058
- return;
2278
+ if (!e) return;
2059
2279
  const i = t.filter((r) => typeof e[r] == "string");
2060
2280
  if (!i.length) {
2061
2281
  s.debug("no need to revoke due to no token(s)");
@@ -2086,7 +2306,7 @@ var ns = Ze, os = "openid", he = class {
2086
2306
  }
2087
2307
  async _loadUser() {
2088
2308
  const e = this._logger.create("_loadUser"), t = await this.settings.userStore.get(this._userStoreKey);
2089
- return t ? (e.debug("user storageString loaded"), ge.fromStorageString(t)) : (e.debug("no user storageString"), null);
2309
+ return t ? (e.debug("user storageString loaded"), fe.fromStorageString(t)) : (e.debug("no user storageString"), null);
2090
2310
  }
2091
2311
  async storeUser(e) {
2092
2312
  const t = this._logger.create("storeUser");
@@ -2095,7 +2315,7 @@ var ns = Ze, os = "openid", he = class {
2095
2315
  const s = e.toStorageString();
2096
2316
  await this.settings.userStore.set(this._userStoreKey, s);
2097
2317
  } else
2098
- this._logger.debug("removing user"), await this.settings.userStore.remove(this._userStoreKey);
2318
+ this._logger.debug("removing user"), await this.settings.userStore.remove(this._userStoreKey), this.settings.dpop && await this.settings.dpop.store.remove(this.settings.client_id);
2099
2319
  }
2100
2320
  /**
2101
2321
  * Removes stale state entries in storage for incomplete authorize requests.
@@ -2103,21 +2323,52 @@ var ns = Ze, os = "openid", he = class {
2103
2323
  async clearStaleState() {
2104
2324
  await this._client.clearStaleState();
2105
2325
  }
2326
+ /**
2327
+ * Dynamically generates a DPoP proof for a given user, URL and optional Http method.
2328
+ * This method is useful when you need to make a request to a resource server
2329
+ * with fetch or similar, and you need to include a DPoP proof in a DPoP header.
2330
+ * @param url - The URL to generate the DPoP proof for
2331
+ * @param user - The user to generate the DPoP proof for
2332
+ * @param httpMethod - Optional, defaults to "GET"
2333
+ * @param nonce - Optional nonce provided by the resource server
2334
+ *
2335
+ * @returns A promise containing the DPoP proof or undefined if DPoP is not enabled/no user is found.
2336
+ */
2337
+ async dpopProof(e, t, s, i) {
2338
+ var r, n;
2339
+ const o = await ((n = (r = this.settings.dpop) == null ? void 0 : r.store) == null ? void 0 : n.get(this.settings.client_id));
2340
+ if (o)
2341
+ return await C.generateDPoPProof({
2342
+ url: e,
2343
+ accessToken: t == null ? void 0 : t.access_token,
2344
+ httpMethod: s,
2345
+ keyPair: o.keys,
2346
+ nonce: i
2347
+ });
2348
+ }
2349
+ async generateDPoPJkt(e) {
2350
+ let t = await e.store.get(this.settings.client_id);
2351
+ if (!t) {
2352
+ const s = await C.generateDPoPKeys();
2353
+ t = new tt(s), await e.store.set(this.settings.client_id, t);
2354
+ }
2355
+ return await C.generateDPoPJkt(t.keys);
2356
+ }
2106
2357
  };
2107
2358
  const Es = ["url", "clientId", "redirectUri", "scope", "logoutUrl"], Cs = "openid profile email";
2108
- function Rs(e, t) {
2359
+ function Ps(e, t) {
2109
2360
  const s = {};
2110
2361
  return e.forEach((i) => {
2111
2362
  t[i] !== void 0 && (s[i] = t[i]);
2112
2363
  }), s;
2113
2364
  }
2114
- let _, K;
2115
- const xs = (e) => (K = Rs(Es, e), new Is({
2116
- authority: K.url,
2117
- client_id: K.clientId,
2118
- redirect_uri: K.redirectUri,
2365
+ let p, V;
2366
+ const Rs = (e) => (V = Ps(Es, e), new Is({
2367
+ authority: V.url,
2368
+ client_id: V.clientId,
2369
+ redirect_uri: V.redirectUri,
2119
2370
  response_type: "code",
2120
- scope: K.scope || Cs,
2371
+ scope: V.scope || Cs,
2121
2372
  filterProtocolClaims: !0,
2122
2373
  includeIdTokenInSilentRenew: !0,
2123
2374
  includeIdTokenInSilentSignout: !0,
@@ -2125,60 +2376,60 @@ const xs = (e) => (K = Rs(Es, e), new Is({
2125
2376
  })), Us = async () => {
2126
2377
  try {
2127
2378
  console.debug("[Auth] Logging in using OIDC");
2128
- const e = new URL(window.location.href), t = await (_ == null ? void 0 : _.getUser());
2129
- e.searchParams.get("state") || t ? await (_ == null ? void 0 : _.signinRedirectCallback()) : await (_ == null ? void 0 : _.signinRedirect().then(() => {
2130
- _ == null || _.startSilentRenew(), _ == null || _.signinRedirectCallback();
2379
+ const e = new URL(window.location.href), t = await (p == null ? void 0 : p.getUser());
2380
+ e.searchParams.get("state") || t ? await (p == null ? void 0 : p.signinRedirectCallback()) : await (p == null ? void 0 : p.signinRedirect().then(() => {
2381
+ p == null || p.startSilentRenew(), p == null || p.signinRedirectCallback();
2131
2382
  }).catch((s) => {
2132
2383
  console.log(s);
2133
2384
  }));
2134
2385
  } catch (e) {
2135
2386
  console.error("[Auth] Error logging in using OIDC: ", e);
2136
2387
  }
2137
- }, As = async () => _ == null ? void 0 : _.removeUser().then(() => _ == null ? void 0 : _.signoutRedirect({
2138
- post_logout_redirect_uri: K.logoutUrl || window.location.href
2139
- })), Ps = async () => await (_ == null ? void 0 : _.getUser()) != null, Os = async () => {
2140
- const e = await (_ == null ? void 0 : _.getUser());
2388
+ }, xs = async () => p == null ? void 0 : p.removeUser().then(() => p == null ? void 0 : p.signoutRedirect({
2389
+ post_logout_redirect_uri: V.logoutUrl || window.location.href
2390
+ })), As = async () => await (p == null ? void 0 : p.getUser()) != null, Os = async () => {
2391
+ const e = await (p == null ? void 0 : p.getUser());
2141
2392
  return Promise.resolve(e == null ? void 0 : e.id_token);
2142
2393
  }, Ns = async () => {
2143
- const e = await (_ == null ? void 0 : _.getUser());
2394
+ const e = await (p == null ? void 0 : p.getUser());
2144
2395
  return Promise.resolve(e == null ? void 0 : e.profile.preferred_username);
2145
2396
  };
2146
- let J, Q;
2397
+ let G, Z;
2147
2398
  const qs = async (e, t) => {
2148
2399
  try {
2149
- console.debug("[Auth] Setting Username and Password for BasicAuth"), J = e, Q = t;
2400
+ console.debug("[Auth] Setting Username and Password for BasicAuth"), G = e, Z = t;
2150
2401
  } catch (s) {
2151
2402
  console.error("[Auth] Error logging in using BasicAuth: ", s);
2152
2403
  }
2153
- }, js = async () => {
2154
- console.debug("[Auth] Logout for BasicAuth"), J = void 0, Q = void 0, window.location.reload();
2155
- }, Hs = async () => J !== void 0 && Q !== void 0, Ls = async () => Promise.resolve(J), Ms = () => {
2156
- if (J !== void 0 && Q != null)
2404
+ }, Ds = async () => {
2405
+ console.debug("[Auth] Logout for BasicAuth"), G = void 0, Z = void 0, window.location.reload();
2406
+ }, Ls = async () => G !== void 0 && Z !== void 0, js = async () => Promise.resolve(G), Hs = () => {
2407
+ if (G !== void 0 && Z != null)
2157
2408
  return {
2158
- username: J,
2159
- password: Q
2409
+ username: G,
2410
+ password: Z
2160
2411
  };
2161
- }, at = () => {
2162
- const e = ut(Kt);
2163
- return e.type === "oidc" ? (_ === void 0 && (console.debug("[Auth] Creating OIDC UserManager with options: ", e.options), _ = xs(e.options)), {
2412
+ }, ct = () => {
2413
+ const e = ut(Jt);
2414
+ return e.type === "oidc" ? (p === void 0 && (console.debug("[Auth] Creating OIDC UserManager with options: ", e.options), p = Rs(e.options)), {
2164
2415
  isOidcAuthEnabled: () => !0,
2165
2416
  isBasicAuthEnabled: () => !1,
2166
- isAuthenticated: Ps,
2417
+ isAuthenticated: As,
2167
2418
  getToken: Os,
2168
2419
  getUsernameAndPassword: () => {
2169
2420
  },
2170
2421
  getUsername: Ns,
2171
2422
  login: Us,
2172
- logout: As
2423
+ logout: xs
2173
2424
  }) : e.type === "basic" ? {
2174
2425
  isOidcAuthEnabled: () => !1,
2175
2426
  isBasicAuthEnabled: () => !0,
2176
- isAuthenticated: Hs,
2427
+ isAuthenticated: Ls,
2177
2428
  getToken: () => Promise.resolve(void 0),
2178
- getUsernameAndPassword: Ms,
2179
- getUsername: Ls,
2429
+ getUsernameAndPassword: Hs,
2430
+ getUsername: js,
2180
2431
  login: qs,
2181
- logout: js
2432
+ logout: Ds
2182
2433
  } : {
2183
2434
  isOidcAuthEnabled: () => !1,
2184
2435
  isBasicAuthEnabled: () => !1,
@@ -2190,40 +2441,44 @@ const qs = async (e, t) => {
2190
2441
  login: () => Promise.resolve(),
2191
2442
  logout: () => Promise.resolve()
2192
2443
  };
2193
- }, ye = (e) => {
2194
- const [t, s] = I(null), i = e.format || "locale";
2195
- return Te(() => {
2196
- let r;
2197
- if (e.date && typeof e.date == "string" ? r = de.fromISO(e.date) : e.date && typeof e.date == "object" && (r = de.fromJSDate(e.date)), r) {
2198
- const n = {
2444
+ }, Ie = (e) => {
2445
+ const [t, s] = k(""), [i, r] = k(""), [n, o] = k(), c = e.format || "locale";
2446
+ return Ce(() => {
2447
+ let l;
2448
+ if (e.date && typeof e.date == "string" ? l = se.fromISO(e.date) : e.date && typeof e.date == "object" && (l = se.fromJSDate(e.date)), l) {
2449
+ const d = {
2199
2450
  locale: e.locale
2200
2451
  };
2201
- s(i === "fromNow" ? r.toRelative() : i === "locale" ? r.toLocaleString(de.DATETIME_FULL, n) : r.toFormat(i, n));
2202
- } else
2203
- s(null);
2204
- }, [e.date]), /* @__PURE__ */ a("span", { children: t || "" });
2205
- }, Ys = (e) => /* @__PURE__ */ a(ye, { date: e.date, format: "fromNow" }), A = ({ condition: e, children: t }) => (typeof e == "boolean" ? e : e()) ? /* @__PURE__ */ a(j.Fragment, { children: t }) : /* @__PURE__ */ a(j.Fragment, {}), Zs = ({ collection: e, emptyState: t, emptyStateTitle: s, emptyStateMessage: i, children: r }) => {
2206
- const n = () => !e || e.length === 0, c = t || /* @__PURE__ */ f(te, { variant: _t.xs, children: [
2207
- /* @__PURE__ */ a(se, { titleText: s || "None found", headingLevel: "h4" }),
2208
- /* @__PURE__ */ a(ue, { children: i || "No items found." })
2452
+ c === "fromNow" ? (s(l.toRelative() || ""), o(setInterval(() => {
2453
+ s(l.toRelative() || "");
2454
+ }, 5e3))) : s(c === "locale" ? l.toLocaleString(se.DATETIME_FULL, d) : l.toFormat(c, d)), r(l.toLocaleString(se.DATETIME_FULL, d));
2455
+ }
2456
+ return () => {
2457
+ n !== void 0 && clearInterval(n);
2458
+ };
2459
+ }, [e.date]), c === "fromNow" ? /* @__PURE__ */ a(_t, { content: /* @__PURE__ */ a("span", { children: i }), children: /* @__PURE__ */ a("span", { children: t }) }) : /* @__PURE__ */ a("span", { children: t });
2460
+ }, Xs = (e) => /* @__PURE__ */ a(Ie, { date: e.date, format: "fromNow" }), O = ({ condition: e, children: t }) => (typeof e == "boolean" ? e : e()) ? /* @__PURE__ */ a($.Fragment, { children: t }) : /* @__PURE__ */ a($.Fragment, {}), Ys = ({ collection: e, emptyState: t, emptyStateTitle: s, emptyStateMessage: i, children: r }) => {
2461
+ const n = () => !e || e.length === 0, o = t || /* @__PURE__ */ v(ne, { variant: pt.xs, children: [
2462
+ /* @__PURE__ */ a(oe, { titleText: s || "None found", headingLevel: "h4" }),
2463
+ /* @__PURE__ */ a(me, { children: i || "No items found." })
2209
2464
  ] });
2210
- return n() ? /* @__PURE__ */ a(j.Fragment, { children: c }) : /* @__PURE__ */ a(j.Fragment, { children: r });
2211
- }, oe = ({ isLoading: e, loadingComponent: t, children: s }) => {
2212
- const i = () => typeof e == "boolean" ? e : e(), r = t || /* @__PURE__ */ a(X, {});
2213
- return i() ? /* @__PURE__ */ a(j.Fragment, { children: r }) : /* @__PURE__ */ a(j.Fragment, { children: s });
2214
- }, ei = ({ toolbar: e, alwaysShowToolbar: t, emptyState: s, filteredEmptyState: i, isLoading: r, isError: n, loadingComponent: c, errorComponent: o, isEmpty: l, isFiltered: d, children: h }) => {
2465
+ return n() ? /* @__PURE__ */ a($.Fragment, { children: o }) : /* @__PURE__ */ a($.Fragment, { children: r });
2466
+ }, ue = ({ isLoading: e, loadingComponent: t, children: s }) => {
2467
+ const i = () => typeof e == "boolean" ? e : e(), r = t || /* @__PURE__ */ a(ee, {});
2468
+ return i() ? /* @__PURE__ */ a($.Fragment, { children: r }) : /* @__PURE__ */ a($.Fragment, { children: s });
2469
+ }, Zs = ({ toolbar: e, alwaysShowToolbar: t, emptyState: s, filteredEmptyState: i, isLoading: r, isError: n, loadingComponent: o, errorComponent: c, isEmpty: l, isFiltered: d, children: h }) => {
2215
2470
  const g = t || !l || d || n;
2216
- return o || (o = /* @__PURE__ */ a("div", { style: { padding: "15px", backgroundColor: "white" }, children: /* @__PURE__ */ a(pt, { isInline: !0, variant: "danger", title: "Error: Something went wrong!", children: /* @__PURE__ */ a("p", { children: "Something went wrong with the action you attempted, but we're not sure what it was. Try reloading the page and hopef for a better result, or contact your admin to report the error." }) }) })), /* @__PURE__ */ f(j.Fragment, { children: [
2217
- /* @__PURE__ */ a(A, { condition: g, children: e }),
2218
- /* @__PURE__ */ f(oe, { isLoading: r, loadingComponent: c, children: [
2219
- /* @__PURE__ */ a(A, { condition: !l && !n, children: h }),
2220
- /* @__PURE__ */ a(A, { condition: l && d && !n, children: i }),
2221
- /* @__PURE__ */ a(A, { condition: l && !d && !n, children: s }),
2222
- /* @__PURE__ */ a(A, { condition: n, children: o })
2471
+ return c || (c = /* @__PURE__ */ a("div", { style: { padding: "15px", backgroundColor: "white" }, children: /* @__PURE__ */ a(ft, { isInline: !0, variant: "danger", title: "Error: Something went wrong!", children: /* @__PURE__ */ a("p", { children: "Something went wrong with the action you attempted, but we're not sure what it was. Try reloading the page and hopef for a better result, or contact your admin to report the error." }) }) })), /* @__PURE__ */ v($.Fragment, { children: [
2472
+ /* @__PURE__ */ a(O, { condition: g, children: e }),
2473
+ /* @__PURE__ */ v(ue, { isLoading: r, loadingComponent: o, children: [
2474
+ /* @__PURE__ */ a(O, { condition: !l && !n, children: h }),
2475
+ /* @__PURE__ */ a(O, { condition: l && d && !n, children: i }),
2476
+ /* @__PURE__ */ a(O, { condition: l && !d && !n, children: s }),
2477
+ /* @__PURE__ */ a(O, { condition: n, children: c })
2223
2478
  ] })
2224
2479
  ] });
2225
- }, ti = (e) => {
2226
- const [t, s] = I(!1), i = (l, d) => {
2480
+ }, ei = (e) => {
2481
+ const [t, s] = k(!1), i = (l, d) => {
2227
2482
  s(!1);
2228
2483
  const h = d;
2229
2484
  h !== void 0 && h >= 0 ? e.onSelect(e.items[h]) : e.onSelect(void 0);
@@ -2232,32 +2487,32 @@ const qs = async (e, t) => {
2232
2487
  }, n = (l) => {
2233
2488
  let d;
2234
2489
  return e.itemToTestId !== void 0 && (d = e.itemToTestId(l)), d;
2235
- }, c = e.popperProps || {
2490
+ }, o = e.popperProps || {
2236
2491
  appendTo: e.menuAppendTo
2237
2492
  };
2238
- let o = /* @__PURE__ */ a(Nt, { title: e.label });
2239
- return e.isKebab || (o = /* @__PURE__ */ a(j.Fragment, { children: e.label })), /* @__PURE__ */ a(
2240
- ft,
2493
+ let c = /* @__PURE__ */ a(Ot, { title: e.label });
2494
+ return e.isKebab || (c = /* @__PURE__ */ a($.Fragment, { children: e.label })), /* @__PURE__ */ a(
2495
+ mt,
2241
2496
  {
2242
2497
  isOpen: t,
2243
2498
  onSelect: i,
2244
2499
  onOpenChange: (l) => s(l),
2245
2500
  toggle: (l) => /* @__PURE__ */ a(
2246
- ce,
2501
+ Je,
2247
2502
  {
2248
2503
  "data-testid": e.testId,
2249
2504
  ref: l,
2250
2505
  onClick: r,
2251
2506
  isExpanded: t,
2252
2507
  variant: e.isKebab ? "plain" : "default",
2253
- children: o
2508
+ children: c
2254
2509
  }
2255
2510
  ),
2256
2511
  ouiaId: "ObjectDropdown",
2257
- popperProps: c,
2512
+ popperProps: o,
2258
2513
  shouldFocusToggleOnSelect: !0,
2259
- children: /* @__PURE__ */ a(mt, { children: e.items.map((l, d) => e.itemIsVisible !== void 0 && !e.itemIsVisible(l) ? /* @__PURE__ */ a(ae, {}) : e.itemIsDivider && e.itemIsDivider(l) ? /* @__PURE__ */ a(Je, { component: "li" }, `divider-${d}`) : /* @__PURE__ */ a(
2260
- wt,
2514
+ children: /* @__PURE__ */ a(wt, { children: e.items.map((l, d) => e.itemIsVisible !== void 0 && !e.itemIsVisible(l) ? /* @__PURE__ */ a(Re, {}) : e.itemIsDivider && e.itemIsDivider(l) ? /* @__PURE__ */ a(Ke, { component: "li" }, `divider-${d}`) : /* @__PURE__ */ a(
2515
+ vt,
2261
2516
  {
2262
2517
  value: d,
2263
2518
  isDisabled: e.itemIsDisabled === void 0 ? !1 : e.itemIsDisabled(l),
@@ -2268,17 +2523,17 @@ const qs = async (e, t) => {
2268
2523
  )) })
2269
2524
  }
2270
2525
  );
2271
- }, si = (e) => {
2526
+ }, $s = (e) => {
2272
2527
  var l;
2273
- const [t, s] = I(!1), i = (d, h) => {
2528
+ const [t, s] = k(!1), i = (d, h) => {
2274
2529
  s(!1), e.onSelect(e.items[h]);
2275
2530
  }, r = () => {
2276
2531
  s(!t);
2277
2532
  }, n = (d) => {
2278
2533
  let h;
2279
2534
  return e.itemToTestId !== void 0 && (h = e.itemToTestId(d)), h;
2280
- }, c = (d) => /* @__PURE__ */ a(
2281
- ce,
2535
+ }, o = (d) => /* @__PURE__ */ a(
2536
+ Je,
2282
2537
  {
2283
2538
  ref: d,
2284
2539
  className: e.toggleClassname || "menu-toggle",
@@ -2287,20 +2542,20 @@ const qs = async (e, t) => {
2287
2542
  isExpanded: t,
2288
2543
  children: e.value ? e.itemToString(e.value) : e.noSelectionLabel
2289
2544
  }
2290
- ), o = {
2545
+ ), c = {
2291
2546
  appendTo: e.appendTo === "document" ? () => document.body : "inline"
2292
2547
  };
2293
2548
  return /* @__PURE__ */ a(
2294
- Ee,
2549
+ St,
2295
2550
  {
2296
- toggle: c,
2551
+ toggle: o,
2297
2552
  id: e.toggleId,
2298
2553
  onSelect: i,
2299
2554
  onOpenChange: s,
2300
2555
  isOpen: t,
2301
- popperProps: o,
2302
- children: (l = e.items) == null ? void 0 : l.map((d, h) => e.itemIsDivider && e.itemIsDivider(d) ? /* @__PURE__ */ a(Je, {}, h) : /* @__PURE__ */ a(
2303
- Ce,
2556
+ popperProps: c,
2557
+ children: (l = e.items) == null ? void 0 : l.map((d, h) => e.itemIsDivider && e.itemIsDivider(d) ? /* @__PURE__ */ a(Ke, {}, h) : /* @__PURE__ */ a(
2558
+ yt,
2304
2559
  {
2305
2560
  isSelected: d === e.value,
2306
2561
  component: (g) => /* @__PURE__ */ a("button", { ...g, "data-testid": n(d) }),
@@ -2311,36 +2566,36 @@ const qs = async (e, t) => {
2311
2566
  ))
2312
2567
  }
2313
2568
  );
2314
- }, ii = ({ expanded: e, onClick: t }) => e ? /* @__PURE__ */ a(qt, { onClick: t, style: { cursor: "pointer" } }) : /* @__PURE__ */ a(jt, { onClick: t, style: { cursor: "pointer" } }), ct = {
2569
+ }, ti = ({ expanded: e, onClick: t }) => e ? /* @__PURE__ */ a(Nt, { onClick: t, style: { cursor: "pointer" } }) : /* @__PURE__ */ a(qt, { onClick: t, style: { cursor: "pointer" } }), lt = {
2315
2570
  padding: "5px",
2316
2571
  minHeight: "128px",
2317
2572
  borderRight: 0,
2318
2573
  borderLeft: 0,
2319
2574
  borderBottom: "1px solid #666",
2320
2575
  backgroundColor: "rgb(240, 240, 240)"
2321
- }, Fs = {
2322
- ...ct,
2576
+ }, Ms = {
2577
+ ...lt,
2323
2578
  color: "red",
2324
2579
  overflow: "auto"
2325
- }, ri = (e) => {
2326
- const [t, s] = I(""), [i, r] = I(""), [n, c] = I(!1), [o, l] = I(), d = (k, x) => {
2327
- s(x);
2328
- }, h = () => t != null && t.trim().length > 0, g = () => o != null && o.trim().length > 0, v = () => {
2329
- c(!0), e.onUrlFetch(t).then((k) => {
2330
- l(void 0), r(k), c(!1), e.onChange(k, t);
2331
- }).catch((k) => {
2332
- l(k.message), c(!1);
2580
+ }, si = (e) => {
2581
+ const [t, s] = k(""), [i, r] = k(""), [n, o] = k(!1), [c, l] = k(), d = (T, A) => {
2582
+ s(A);
2583
+ }, h = () => t != null && t.trim().length > 0, g = () => c != null && c.trim().length > 0, _ = () => {
2584
+ o(!0), e.onUrlFetch(t).then((T) => {
2585
+ l(void 0), r(T), o(!1), e.onChange(T, t);
2586
+ }).catch((T) => {
2587
+ l(T.message), o(!1);
2333
2588
  });
2334
- }, b = () => {
2589
+ }, S = () => {
2335
2590
  s(""), r(""), e.onChange(void 0, void 0);
2336
- }, R = /* @__PURE__ */ f("div", { className: "url-upload-loading", style: ct, children: [
2337
- /* @__PURE__ */ a(X, { size: "md", className: "spinner", style: { marginRight: "5px" } }),
2591
+ }, x = /* @__PURE__ */ v("div", { className: "url-upload-loading", style: lt, children: [
2592
+ /* @__PURE__ */ a(ee, { size: "md", className: "spinner", style: { marginRight: "5px" } }),
2338
2593
  /* @__PURE__ */ a("span", { className: "spinner-message", children: "Loading URL content" })
2339
2594
  ] });
2340
- return /* @__PURE__ */ f("div", { className: "url-upload", "data-testid": e.testId, children: [
2341
- /* @__PURE__ */ f("div", { className: "url-upload-flex", style: { display: "flex" }, children: [
2595
+ return /* @__PURE__ */ v("div", { className: "url-upload", "data-testid": e.testId, children: [
2596
+ /* @__PURE__ */ v("div", { className: "url-upload-flex", style: { display: "flex" }, children: [
2342
2597
  /* @__PURE__ */ a("div", { className: "url-upload-url", style: { flexGrow: 1 }, children: /* @__PURE__ */ a(
2343
- _e,
2598
+ ae,
2344
2599
  {
2345
2600
  "data-testid": `${e.testId}-input`,
2346
2601
  value: t,
@@ -2351,16 +2606,16 @@ const qs = async (e, t) => {
2351
2606
  "aria-label": "url input"
2352
2607
  }
2353
2608
  ) }),
2354
- /* @__PURE__ */ a("div", { className: "url-fetch-button", children: /* @__PURE__ */ a(pe, { "data-testid": `${e.testId}-fetch`, variant: "control", isDisabled: !h(), onClick: v, children: "Fetch" }) }),
2355
- /* @__PURE__ */ a("div", { className: "url-clear-button", children: /* @__PURE__ */ a(pe, { "data-testid": `${e.testId}-clear`, variant: "control", isDisabled: !h(), onClick: b, children: "Clear" }) })
2609
+ /* @__PURE__ */ a("div", { className: "url-fetch-button", children: /* @__PURE__ */ a(ce, { "data-testid": `${e.testId}-fetch`, variant: "control", isDisabled: !h(), onClick: _, children: "Fetch" }) }),
2610
+ /* @__PURE__ */ a("div", { className: "url-clear-button", children: /* @__PURE__ */ a(ce, { "data-testid": `${e.testId}-clear`, variant: "control", isDisabled: !h(), onClick: S, children: "Clear" }) })
2356
2611
  ] }),
2357
- /* @__PURE__ */ a("div", { className: "url-upload-preview", children: /* @__PURE__ */ f(oe, { isLoading: n, loadingComponent: R, children: [
2358
- /* @__PURE__ */ a(A, { condition: g, children: /* @__PURE__ */ f("div", { className: "url-upload-error", style: Fs, children: [
2612
+ /* @__PURE__ */ a("div", { className: "url-upload-preview", children: /* @__PURE__ */ v(ue, { isLoading: n, loadingComponent: x, children: [
2613
+ /* @__PURE__ */ a(O, { condition: g, children: /* @__PURE__ */ v("div", { className: "url-upload-error", style: Ms, children: [
2359
2614
  /* @__PURE__ */ a("div", { children: "Error getting content from URL." }),
2360
- /* @__PURE__ */ a("div", { children: o })
2615
+ /* @__PURE__ */ a("div", { children: c })
2361
2616
  ] }) }),
2362
- /* @__PURE__ */ a(A, { condition: !g(), children: /* @__PURE__ */ a(
2363
- vt,
2617
+ /* @__PURE__ */ a(O, { condition: !g(), children: /* @__PURE__ */ a(
2618
+ bt,
2364
2619
  {
2365
2620
  "data-testid": `${e.testId}-preview`,
2366
2621
  "aria-label": "url-content",
@@ -2371,25 +2626,65 @@ const qs = async (e, t) => {
2371
2626
  ) })
2372
2627
  ] }) })
2373
2628
  ] });
2374
- }, Ds = (e) => {
2375
- const [t, s] = I({
2629
+ }, ii = (e) => {
2630
+ const [t, s] = k(), [i, r] = k();
2631
+ return Ce(() => {
2632
+ e.isOpen && (typeof e.frontendInfo == "function" ? e.frontendInfo().then(s) : s(e.frontendInfo), typeof e.backendInfo == "function" ? e.backendInfo().then(r) : r(e.backendInfo));
2633
+ }, [e.isOpen]), /* @__PURE__ */ a(
2634
+ kt,
2635
+ {
2636
+ className: "app-about-modal",
2637
+ isOpen: e.isOpen,
2638
+ onClose: e.onClose,
2639
+ trademark: "© 2024 Red Hat",
2640
+ brandImageSrc: e.brandImageSrc,
2641
+ brandImageAlt: e.brandImageAlt,
2642
+ "aria-label": e.brandImageAlt,
2643
+ children: /* @__PURE__ */ v(Tt, { className: "app-about-modal-content", style: { marginTop: "-25px" }, children: [
2644
+ /* @__PURE__ */ a(De, { component: Le.h2, children: "Web console info" }),
2645
+ /* @__PURE__ */ a(ue, { isLoading: t === void 0, children: /* @__PURE__ */ v(je, { component: "dl", children: [
2646
+ /* @__PURE__ */ a(b, { component: "dt", children: "Project" }),
2647
+ /* @__PURE__ */ a(b, { component: "dd", children: /* @__PURE__ */ a("a", { href: t == null ? void 0 : t.url, target: "_blank", children: t == null ? void 0 : t.name }) }),
2648
+ /* @__PURE__ */ a(b, { component: "dt", children: "Version" }),
2649
+ /* @__PURE__ */ a(b, { component: "dd", children: t == null ? void 0 : t.version }),
2650
+ /* @__PURE__ */ a(b, { component: "dt", children: "Built on" }),
2651
+ /* @__PURE__ */ a(b, { component: "dd", children: /* @__PURE__ */ a(Ie, { date: t == null ? void 0 : t.builtOn, format: "locale" }) }),
2652
+ /* @__PURE__ */ a(b, { component: "dt", children: "Digest" }),
2653
+ /* @__PURE__ */ a(b, { component: "dd", children: t == null ? void 0 : t.digest })
2654
+ ] }) }),
2655
+ /* @__PURE__ */ a(De, { style: { marginTop: "40px" }, component: Le.h2, children: e.backendLabel }),
2656
+ /* @__PURE__ */ a(ue, { isLoading: i === void 0, children: /* @__PURE__ */ v(je, { component: "dl", children: [
2657
+ /* @__PURE__ */ a(b, { component: "dt", children: "Name" }),
2658
+ /* @__PURE__ */ a(b, { component: "dd", children: (i == null ? void 0 : i.name) || "" }),
2659
+ /* @__PURE__ */ a(b, { component: "dt", children: "Description" }),
2660
+ /* @__PURE__ */ a(b, { component: "dd", children: (i == null ? void 0 : i.description) || "" }),
2661
+ /* @__PURE__ */ a(b, { component: "dt", children: "Version" }),
2662
+ /* @__PURE__ */ a(b, { component: "dd", children: (i == null ? void 0 : i.version) || "" }),
2663
+ /* @__PURE__ */ a(b, { component: "dt", children: "Built on" }),
2664
+ /* @__PURE__ */ a(b, { component: "dd", children: /* @__PURE__ */ a(Ie, { date: i == null ? void 0 : i.builtOn, format: "locale" }) })
2665
+ ] }) })
2666
+ ] })
2667
+ }
2668
+ );
2669
+ }, Fs = (e) => {
2670
+ const [t, s] = k({
2376
2671
  username: "",
2377
2672
  password: ""
2378
2673
  }), i = () => {
2379
2674
  e.onLogin(t);
2380
- }, r = (c, o) => {
2675
+ }, r = (o, c) => {
2381
2676
  s({
2382
2677
  ...t,
2383
- username: o
2678
+ username: c
2384
2679
  });
2385
- }, n = (c, o) => {
2680
+ }, n = (o, c) => {
2386
2681
  s({
2387
2682
  ...t,
2388
- password: o
2683
+ password: c
2389
2684
  });
2390
2685
  };
2391
2686
  return /* @__PURE__ */ a(
2392
- Re,
2687
+ Ue,
2393
2688
  {
2394
2689
  title: "Login",
2395
2690
  variant: "small",
@@ -2400,16 +2695,16 @@ const qs = async (e, t) => {
2400
2695
  "aria-label": "please-wait-modal",
2401
2696
  style: { marginTop: "-15px" },
2402
2697
  actions: [
2403
- /* @__PURE__ */ a(pe, { variant: "primary", "data-testid": "modal-btn-login", onClick: i, isDisabled: (t == null ? void 0 : t.username) === "" || (t == null ? void 0 : t.password) === "", children: "Login" }, "login")
2698
+ /* @__PURE__ */ a(ce, { variant: "primary", "data-testid": "modal-btn-login", onClick: i, isDisabled: (t == null ? void 0 : t.username) === "" || (t == null ? void 0 : t.password) === "", children: "Login" }, "login")
2404
2699
  ],
2405
- children: /* @__PURE__ */ f(St, { children: [
2700
+ children: /* @__PURE__ */ v(Be, { children: [
2406
2701
  /* @__PURE__ */ a(
2407
- je,
2702
+ He,
2408
2703
  {
2409
2704
  label: "Username",
2410
2705
  fieldId: "form-username",
2411
2706
  children: /* @__PURE__ */ a(
2412
- _e,
2707
+ ae,
2413
2708
  {
2414
2709
  isRequired: !0,
2415
2710
  type: "text",
@@ -2424,12 +2719,12 @@ const qs = async (e, t) => {
2424
2719
  }
2425
2720
  ),
2426
2721
  /* @__PURE__ */ a(
2427
- je,
2722
+ He,
2428
2723
  {
2429
2724
  label: "Password",
2430
2725
  fieldId: "form-password",
2431
2726
  children: /* @__PURE__ */ a(
2432
- _e,
2727
+ ae,
2433
2728
  {
2434
2729
  isRequired: !0,
2435
2730
  type: "text",
@@ -2446,17 +2741,45 @@ const qs = async (e, t) => {
2446
2741
  ] })
2447
2742
  }
2448
2743
  );
2449
- }, ni = (e) => {
2450
- const [t, s] = I(
2744
+ }, ri = (e) => /* @__PURE__ */ v(
2745
+ Ue,
2746
+ {
2747
+ title: "Please Wait",
2748
+ variant: "small",
2749
+ isOpen: e.isOpen,
2750
+ header: /* @__PURE__ */ a("a", { href: "#" }),
2751
+ showClose: !1,
2752
+ className: "please-wait pf-m-redhat-font",
2753
+ "aria-label": "please-wait-modal",
2754
+ style: { marginTop: "-15px" },
2755
+ children: [
2756
+ /* @__PURE__ */ a(ee, { size: "md", className: "spinner" }),
2757
+ /* @__PURE__ */ a("span", { className: "message", style: { fontSize: "15px", color: "#333", marginLeft: "10px" }, children: e.message })
2758
+ ]
2759
+ }
2760
+ ), ni = (e) => /* @__PURE__ */ a(
2761
+ Ue,
2762
+ {
2763
+ title: e.title,
2764
+ variant: "small",
2765
+ isOpen: e.isOpen,
2766
+ showClose: e.isCloseable,
2767
+ onClose: e.onClose,
2768
+ className: "progress pf-m-redhat-font",
2769
+ "aria-label": "progress-modal",
2770
+ children: /* @__PURE__ */ a(It, { title: e.message, value: e.progress })
2771
+ }
2772
+ ), oi = (e) => {
2773
+ const [t, s] = k(
2451
2774
  0
2452
2775
  /* AUTHENTICATING */
2453
- ), i = at(), r = (n) => {
2776
+ ), i = ct(), r = (n) => {
2454
2777
  console.info("[ApplicationAuth] Using username and password."), i.login(n.username, n.password), s(
2455
2778
  1
2456
2779
  /* AUTHENTICATED */
2457
2780
  );
2458
2781
  };
2459
- return Te(() => {
2782
+ return Ce(() => {
2460
2783
  i.isOidcAuthEnabled() ? i.login("", "").then(() => {
2461
2784
  console.info("[ApplicationAuth] Authentication successful."), s(
2462
2785
  1
@@ -2471,100 +2794,79 @@ const qs = async (e, t) => {
2471
2794
  1
2472
2795
  /* AUTHENTICATED */
2473
2796
  );
2474
- }, []), /* @__PURE__ */ f(ae, { children: [
2475
- /* @__PURE__ */ a(A, { condition: t === 0 && i.isOidcAuthEnabled(), children: /* @__PURE__ */ f(te, { children: [
2476
- /* @__PURE__ */ a(se, { titleText: "Loading", headingLevel: "h4" }),
2477
- /* @__PURE__ */ a(ue, { children: /* @__PURE__ */ a(X, { size: "xl", "aria-label": "Loading spinner" }) })
2797
+ }, []), /* @__PURE__ */ v(Re, { children: [
2798
+ /* @__PURE__ */ a(O, { condition: t === 0 && i.isOidcAuthEnabled(), children: /* @__PURE__ */ v(ne, { children: [
2799
+ /* @__PURE__ */ a(oe, { titleText: "Loading", headingLevel: "h4" }),
2800
+ /* @__PURE__ */ a(me, { children: /* @__PURE__ */ a(ee, { size: "xl", "aria-label": "Loading spinner" }) })
2478
2801
  ] }) }),
2479
- /* @__PURE__ */ a(A, { condition: t === 0 && i.isBasicAuthEnabled(), children: /* @__PURE__ */ a(Ds, { onLogin: r }) }),
2480
- /* @__PURE__ */ a(A, { condition: t === 2, children: /* @__PURE__ */ f(te, { children: [
2481
- /* @__PURE__ */ a(se, { titleText: "Empty state", headingLevel: "h4", icon: /* @__PURE__ */ a(Be, { icon: Ht }) }),
2482
- /* @__PURE__ */ a(ue, { children: "Authentication failed." })
2802
+ /* @__PURE__ */ a(O, { condition: t === 0 && i.isBasicAuthEnabled(), children: /* @__PURE__ */ a(Fs, { onLogin: r }) }),
2803
+ /* @__PURE__ */ a(O, { condition: t === 2, children: /* @__PURE__ */ v(ne, { children: [
2804
+ /* @__PURE__ */ a(oe, { titleText: "Empty state", headingLevel: "h4", icon: /* @__PURE__ */ a(ze, { icon: Dt }) }),
2805
+ /* @__PURE__ */ a(me, { children: "Authentication failed." })
2483
2806
  ] }) }),
2484
- /* @__PURE__ */ a(A, { condition: t === 1, children: e.children })
2807
+ /* @__PURE__ */ a(O, { condition: t === 1, children: e.children })
2485
2808
  ] });
2486
- }, oi = (e) => {
2487
- const t = at();
2809
+ }, ai = (e) => {
2810
+ const t = ct();
2488
2811
  return (() => {
2489
2812
  let i = !0;
2490
2813
  return e.enabled !== void 0 && (i = i && (t.isOidcAuthEnabled() === e.enabled || t.isBasicAuthEnabled() === e.enabled)), i;
2491
- })() ? /* @__PURE__ */ a(j.Fragment, { children: e.children }) : /* @__PURE__ */ a(j.Fragment, {});
2492
- }, ai = (e) => {
2493
- const [t, s] = I(), [i, r] = I();
2494
- return Te(() => {
2495
- e.isOpen && (typeof e.frontendInfo == "function" ? e.frontendInfo().then(s) : s(e.frontendInfo), typeof e.backendInfo == "function" ? e.backendInfo().then(r) : r(e.backendInfo));
2496
- }, [e.isOpen]), /* @__PURE__ */ a(
2497
- bt,
2498
- {
2499
- className: "app-about-modal",
2500
- isOpen: e.isOpen,
2501
- onClose: e.onClose,
2502
- trademark: "© 2024 Red Hat",
2503
- brandImageSrc: e.brandImageSrc,
2504
- brandImageAlt: e.brandImageAlt,
2505
- "aria-label": e.brandImageAlt,
2506
- children: /* @__PURE__ */ f(yt, { className: "app-about-modal-content", style: { marginTop: "-25px" }, children: [
2507
- /* @__PURE__ */ a(He, { component: Le.h2, children: "Web console info" }),
2508
- /* @__PURE__ */ a(oe, { isLoading: t === void 0, children: /* @__PURE__ */ f(Me, { component: "dl", children: [
2509
- /* @__PURE__ */ a(y, { component: "dt", children: "Project" }),
2510
- /* @__PURE__ */ a(y, { component: "dd", children: /* @__PURE__ */ a("a", { href: t == null ? void 0 : t.url, target: "_blank", children: t == null ? void 0 : t.name }) }),
2511
- /* @__PURE__ */ a(y, { component: "dt", children: "Version" }),
2512
- /* @__PURE__ */ a(y, { component: "dd", children: t == null ? void 0 : t.version }),
2513
- /* @__PURE__ */ a(y, { component: "dt", children: "Built on" }),
2514
- /* @__PURE__ */ a(y, { component: "dd", children: /* @__PURE__ */ a(ye, { date: t == null ? void 0 : t.builtOn, format: "locale" }) }),
2515
- /* @__PURE__ */ a(y, { component: "dt", children: "Digest" }),
2516
- /* @__PURE__ */ a(y, { component: "dd", children: t == null ? void 0 : t.digest })
2517
- ] }) }),
2518
- /* @__PURE__ */ a(He, { style: { marginTop: "40px" }, component: Le.h2, children: e.backendLabel }),
2519
- /* @__PURE__ */ a(oe, { isLoading: i === void 0, children: /* @__PURE__ */ f(Me, { component: "dl", children: [
2520
- /* @__PURE__ */ a(y, { component: "dt", children: "Name" }),
2521
- /* @__PURE__ */ a(y, { component: "dd", children: (i == null ? void 0 : i.name) || "" }),
2522
- /* @__PURE__ */ a(y, { component: "dt", children: "Description" }),
2523
- /* @__PURE__ */ a(y, { component: "dd", children: (i == null ? void 0 : i.description) || "" }),
2524
- /* @__PURE__ */ a(y, { component: "dt", children: "Version" }),
2525
- /* @__PURE__ */ a(y, { component: "dd", children: (i == null ? void 0 : i.version) || "" }),
2526
- /* @__PURE__ */ a(y, { component: "dt", children: "Built on" }),
2527
- /* @__PURE__ */ a(y, { component: "dd", children: /* @__PURE__ */ a(ye, { date: i == null ? void 0 : i.builtOn, format: "locale" }) })
2528
- ] }) })
2529
- ] })
2530
- }
2531
- );
2532
- }, ci = (e) => /* @__PURE__ */ f(
2533
- Re,
2534
- {
2535
- title: "Please Wait",
2536
- variant: "small",
2537
- isOpen: e.isOpen,
2538
- header: /* @__PURE__ */ a("a", { href: "#" }),
2539
- showClose: !1,
2540
- className: "please-wait pf-m-redhat-font",
2541
- "aria-label": "please-wait-modal",
2542
- style: { marginTop: "-15px" },
2543
- children: [
2544
- /* @__PURE__ */ a(X, { size: "md", className: "spinner" }),
2545
- /* @__PURE__ */ a("span", { className: "message", style: { fontSize: "15px", color: "#333", marginLeft: "10px" }, children: e.message })
2546
- ]
2547
- }
2548
- ), li = (e) => /* @__PURE__ */ a(
2549
- Re,
2550
- {
2551
- title: e.title,
2552
- variant: "small",
2553
- isOpen: e.isOpen,
2554
- showClose: e.isCloseable,
2555
- onClose: e.onClose,
2556
- className: "progress pf-m-redhat-font",
2557
- "aria-label": "progress-modal",
2558
- children: /* @__PURE__ */ a(kt, { title: e.message, value: e.progress })
2559
- }
2560
- );
2814
+ })() ? /* @__PURE__ */ a($.Fragment, { children: e.children }) : /* @__PURE__ */ a($.Fragment, {});
2815
+ }, ci = (e) => /* @__PURE__ */ a(Et, { categoryName: e.categoryName || "Filters", isClosable: !0, onClick: e.onClearAllCriteria, children: e.criteria.map((t, s) => /* @__PURE__ */ v(Ct, { onClick: () => e.onRemoveCriteria(t), children: [
2816
+ /* @__PURE__ */ a("b", { children: t.filterBy.label }),
2817
+ /* @__PURE__ */ a("span", { children: ": " }),
2818
+ /* @__PURE__ */ a("span", { children: t.filterValue })
2819
+ ] }, s)) }), li = (e) => {
2820
+ const [t, s] = k(e.filterTypes[0]), [i, r] = k(""), n = (o) => {
2821
+ o && o.preventDefault(), e.onAddCriteria({
2822
+ filterBy: t,
2823
+ filterValue: i
2824
+ }), r("");
2825
+ };
2826
+ return /* @__PURE__ */ a(Be, { onSubmit: n, children: /* @__PURE__ */ v(Pt, { children: [
2827
+ /* @__PURE__ */ a(
2828
+ $s,
2829
+ {
2830
+ value: t,
2831
+ items: e.filterTypes,
2832
+ testId: "chip-filter-select",
2833
+ toggleClassname: "chip-filter-toggle",
2834
+ onSelect: s,
2835
+ itemToTestId: (o) => o.testId,
2836
+ itemToString: (o) => o.label
2837
+ }
2838
+ ),
2839
+ /* @__PURE__ */ a(
2840
+ ae,
2841
+ {
2842
+ name: "filterValue",
2843
+ id: "filterValue",
2844
+ type: "search",
2845
+ value: i,
2846
+ onChange: (o, c) => r(c),
2847
+ "data-testid": "chip-filter-value",
2848
+ "aria-label": "search input"
2849
+ }
2850
+ ),
2851
+ /* @__PURE__ */ a(
2852
+ ce,
2853
+ {
2854
+ variant: Rt.control,
2855
+ onClick: n,
2856
+ "data-testid": "chip-filter-search",
2857
+ "aria-label": "search button for search input",
2858
+ children: /* @__PURE__ */ a(Lt, {})
2859
+ }
2860
+ )
2861
+ ] }) });
2862
+ };
2561
2863
  function di() {
2562
- return /* @__PURE__ */ a(te, { children: /* @__PURE__ */ a(
2563
- se,
2864
+ return /* @__PURE__ */ a(ne, { children: /* @__PURE__ */ a(
2865
+ oe,
2564
2866
  {
2565
2867
  titleText: "Loading",
2566
2868
  headingLevel: "h4",
2567
- icon: /* @__PURE__ */ a(Be, { icon: X })
2869
+ icon: /* @__PURE__ */ a(ze, { icon: ee })
2568
2870
  }
2569
2871
  ) });
2570
2872
  }
@@ -2574,32 +2876,32 @@ function hi({
2574
2876
  perPage: s,
2575
2877
  isCompact: i = !1,
2576
2878
  onChange: r,
2577
- variant: n = It.top
2879
+ variant: n = xt.top
2578
2880
  }) {
2579
2881
  return /* @__PURE__ */ a(
2580
- Tt,
2882
+ Ut,
2581
2883
  {
2582
2884
  itemCount: e,
2583
2885
  page: t,
2584
2886
  perPage: s,
2585
- onSetPage: (c, o) => r(o, s),
2586
- onPerPageSelect: (c, o) => r(1, o),
2887
+ onSetPage: (o, c) => r(c, s),
2888
+ onPerPageSelect: (o, c) => r(1, c),
2587
2889
  variant: n,
2588
2890
  isCompact: i
2589
2891
  }
2590
2892
  );
2591
2893
  }
2592
- function $s({ columns: e, rows: t, getTd: s = () => xe }) {
2593
- const i = new Array(e).fill(0).map((n, c) => {
2594
- const o = s(c);
2595
- return /* @__PURE__ */ a(o, { children: /* @__PURE__ */ a(
2596
- Et,
2894
+ function Ws({ columns: e, rows: t, getTd: s = () => xe }) {
2895
+ const i = new Array(e).fill(0).map((n, o) => {
2896
+ const c = s(o);
2897
+ return /* @__PURE__ */ a(c, { children: /* @__PURE__ */ a(
2898
+ At,
2597
2899
  {
2598
- screenreaderText: c === 0 ? "Loading data" : void 0
2900
+ screenreaderText: o === 0 ? "Loading data" : void 0
2599
2901
  }
2600
- ) }, `cell_${c}`);
2601
- }), r = new Array(t).fill(0).map((n, c) => /* @__PURE__ */ a(ie, { children: i }, `row_${c}`));
2602
- return /* @__PURE__ */ a(ae, { children: r });
2902
+ ) }, `cell_${o}`);
2903
+ }), r = new Array(t).fill(0).map((n, o) => /* @__PURE__ */ a(le, { children: i }, `row_${o}`));
2904
+ return /* @__PURE__ */ a(Re, { children: r });
2603
2905
  }
2604
2906
  const gi = ({
2605
2907
  ariaLabel: e,
@@ -2608,188 +2910,188 @@ const gi = ({
2608
2910
  data: i,
2609
2911
  renderHeader: r,
2610
2912
  renderCell: n,
2611
- renderActions: c,
2612
- isColumnSortable: o,
2913
+ renderActions: o,
2914
+ isColumnSortable: c,
2613
2915
  isRowDeleted: l,
2614
2916
  isRowSelected: d,
2615
2917
  expectedLength: h = 3,
2616
2918
  onRowClick: g,
2617
- setActionCellOuiaId: v,
2618
- setRowOuiaId: b,
2619
- tableOuiaId: R,
2620
- children: k,
2621
- variant: x
2919
+ setActionCellOuiaId: _,
2920
+ setRowOuiaId: S,
2921
+ tableOuiaId: x,
2922
+ children: T,
2923
+ variant: A
2622
2924
  }) => {
2623
- const [E, H] = I(1e3);
2624
- let T;
2625
- const w = ({ width: p }) => {
2626
- T && cancelAnimationFrame(T), p && (T = requestAnimationFrame(() => {
2627
- H(p);
2925
+ const [I, N] = k(1e3);
2926
+ let P;
2927
+ const M = ({ width: f }) => {
2928
+ P && cancelAnimationFrame(P), f && (P = requestAnimationFrame(() => {
2929
+ N(f);
2628
2930
  }));
2629
- }, { ref: U } = Wt({ onResize: w }), C = E >= 576, S = Ne(
2630
- (p) => C && p !== 0 && p !== s.length - 1,
2631
- [s, C]
2632
- ), L = qe(() => s.map((p, m) => {
2633
- const P = ee(
2634
- ({ children: D, ...$ }, le) => /* @__PURE__ */ a(
2635
- lt,
2931
+ }, { ref: R } = Wt({ onResize: M }), m = I >= 576, E = Ne(
2932
+ (f) => m && f !== 0 && f !== s.length - 1,
2933
+ [s, m]
2934
+ ), U = qe(() => s.map((f, w) => {
2935
+ const q = re(
2936
+ ({ children: J, ...K }, Q) => /* @__PURE__ */ a(
2937
+ dt,
2636
2938
  {
2637
- position: m,
2638
- tableWidth: E,
2939
+ position: w,
2940
+ tableWidth: I,
2639
2941
  columnWidth: t,
2640
- canHide: S(m),
2641
- sort: o ? o(p) : void 0,
2642
- ...$,
2643
- ref: le,
2644
- children: D
2942
+ canHide: E(w),
2943
+ sort: c ? c(f) : void 0,
2944
+ ...K,
2945
+ ref: Q,
2946
+ children: J
2645
2947
  }
2646
2948
  )
2647
2949
  );
2648
- return P.displayName = "ResponsiveThCurried", r({
2649
- Th: P,
2650
- key: `header_${p}`,
2651
- column: p,
2652
- colIndex: m
2950
+ return q.displayName = "ResponsiveThCurried", r({
2951
+ Th: q,
2952
+ key: `header_${f}`,
2953
+ column: f,
2954
+ colIndex: w
2653
2955
  });
2654
2956
  }), [
2655
- S,
2957
+ E,
2656
2958
  s,
2657
- o,
2959
+ c,
2658
2960
  t,
2659
2961
  r,
2660
- E
2661
- ]), B = Ne(
2662
- (p) => {
2663
- const m = ee(
2664
- ({ children: P, ...D }, $) => /* @__PURE__ */ a(
2665
- ke,
2962
+ I
2963
+ ]), y = Ne(
2964
+ (f) => {
2965
+ const w = re(
2966
+ ({ children: q, ...J }, K) => /* @__PURE__ */ a(
2967
+ Ee,
2666
2968
  {
2667
- position: p,
2668
- tableWidth: E,
2969
+ position: f,
2970
+ tableWidth: I,
2669
2971
  columnWidth: t,
2670
- canHide: S(p),
2671
- ...D,
2672
- ref: $,
2673
- children: P
2972
+ canHide: E(f),
2973
+ ...J,
2974
+ ref: K,
2975
+ children: q
2674
2976
  }
2675
2977
  )
2676
2978
  );
2677
- return m.displayName = "ResponsiveTdCurried", m;
2979
+ return w.displayName = "ResponsiveTdCurried", w;
2678
2980
  },
2679
- [S, t, E]
2680
- ), Y = qe(
2681
- () => s.map((p, m) => B(m)),
2682
- [s, B]
2981
+ [E, t, I]
2982
+ ), z = qe(
2983
+ () => s.map((f, w) => y(w)),
2984
+ [s, y]
2683
2985
  );
2684
- return /* @__PURE__ */ f(
2685
- Mt,
2986
+ return /* @__PURE__ */ v(
2987
+ Ht,
2686
2988
  {
2687
2989
  "aria-label": e,
2688
2990
  gridBreakPoint: "",
2689
- ref: U,
2690
- className: C ? "" : "pf-m-grid",
2691
- ouiaId: R,
2692
- variant: x,
2991
+ ref: R,
2992
+ className: m ? "" : "pf-m-grid",
2993
+ ouiaId: x,
2994
+ variant: A,
2693
2995
  children: [
2694
- /* @__PURE__ */ a(Ft, { children: /* @__PURE__ */ a(ie, { children: L }) }),
2695
- /* @__PURE__ */ f(Dt, { children: [
2996
+ /* @__PURE__ */ a($t, { children: /* @__PURE__ */ a(le, { children: U }) }),
2997
+ /* @__PURE__ */ v(Mt, { children: [
2696
2998
  i === void 0 && /* @__PURE__ */ a(
2697
- $s,
2999
+ Ws,
2698
3000
  {
2699
3001
  columns: s.length,
2700
3002
  rows: h,
2701
- getTd: B
3003
+ getTd: y
2702
3004
  }
2703
3005
  ),
2704
- i == null ? void 0 : i.map((p, m) => {
2705
- const P = l !== void 0 && l({ row: p, rowIndex: m }), D = d !== void 0 && d({ row: p, rowIndex: m }), $ = !P && g ? () => g({ row: p, rowIndex: m }) : void 0, le = s.map((Pe, Oe) => n({
2706
- Td: Y[Oe],
2707
- key: `row_${m}_cell_${Pe}`,
2708
- column: Pe,
2709
- colIndex: Oe,
2710
- rowIndex: m,
2711
- row: p
2712
- })), ht = !P && c && /* @__PURE__ */ a(
2713
- ke,
3006
+ i == null ? void 0 : i.map((f, w) => {
3007
+ const q = l !== void 0 && l({ row: f, rowIndex: w }), J = d !== void 0 && d({ row: f, rowIndex: w }), K = !q && g ? () => g({ row: f, rowIndex: w }) : void 0, Q = s.map((X, te) => n({
3008
+ Td: z[te],
3009
+ key: `row_${w}_cell_${X}`,
3010
+ column: X,
3011
+ colIndex: te,
3012
+ rowIndex: w,
3013
+ row: f
3014
+ })), _e = !q && o && /* @__PURE__ */ a(
3015
+ Ee,
2714
3016
  {
2715
3017
  position: s.length,
2716
- tableWidth: E,
3018
+ tableWidth: I,
2717
3019
  columnWidth: t,
2718
3020
  canHide: !1,
2719
3021
  isActionCell: !0,
2720
- "data-testid": v ? v({ row: p, rowIndex: m }) : `actions-for-row-${m}`,
2721
- children: c({ rowIndex: m, row: p, ActionsColumn: $t })
3022
+ "data-testid": _ ? _({ row: f, rowIndex: w }) : `actions-for-row-${w}`,
3023
+ children: o({ rowIndex: w, row: f, ActionsColumn: Ft })
2722
3024
  }
2723
3025
  );
2724
- return /* @__PURE__ */ f(
2725
- dt,
3026
+ return /* @__PURE__ */ v(
3027
+ ht,
2726
3028
  {
2727
- isDeleted: P,
2728
- isSelected: D,
2729
- onClick: $,
2730
- rowOuiaId: b == null ? void 0 : b({ row: p, rowIndex: m }),
3029
+ isDeleted: q,
3030
+ isSelected: J,
3031
+ onClick: K,
3032
+ rowOuiaId: S == null ? void 0 : S({ row: f, rowIndex: w }),
2731
3033
  children: [
2732
- le,
2733
- ht
3034
+ Q,
3035
+ _e
2734
3036
  ]
2735
3037
  },
2736
- `row_${m}`
3038
+ `row_${w}`
2737
3039
  );
2738
3040
  }),
2739
- (i == null ? void 0 : i.length) === 0 && /* @__PURE__ */ a(ie, { children: /* @__PURE__ */ a(xe, { colSpan: s.length, children: k }) })
3041
+ (i == null ? void 0 : i.length) === 0 && /* @__PURE__ */ a(le, { children: /* @__PURE__ */ a(xe, { colSpan: s.length, children: T }) })
2740
3042
  ] })
2741
3043
  ]
2742
3044
  }
2743
3045
  );
2744
- }, lt = Ie(
2745
- ee((e, t) => {
3046
+ }, dt = Pe(
3047
+ re((e, t) => {
2746
3048
  const {
2747
3049
  tableWidth: s,
2748
3050
  columnWidth: i,
2749
3051
  position: r,
2750
3052
  canHide: n,
2751
- className: c = "",
2752
- children: o,
3053
+ className: o = "",
3054
+ children: c,
2753
3055
  ...l
2754
3056
  } = e, d = n && s < i * (r + 1) ? "pf-m-hidden" : "pf-m-visible";
2755
3057
  return /* @__PURE__ */ a(
2756
- Lt,
3058
+ jt,
2757
3059
  {
2758
3060
  ref: t,
2759
- className: `${d} ${c}`,
3061
+ className: `${d} ${o}`,
2760
3062
  ...l,
2761
- children: o
3063
+ children: c
2762
3064
  }
2763
3065
  );
2764
3066
  })
2765
3067
  );
2766
- lt.displayName = "ResponsiveTh";
2767
- const ke = Ie(
2768
- ee((e, t) => {
3068
+ dt.displayName = "ResponsiveTh";
3069
+ const Ee = Pe(
3070
+ re((e, t) => {
2769
3071
  const {
2770
3072
  tableWidth: s,
2771
3073
  columnWidth: i,
2772
3074
  position: r,
2773
3075
  canHide: n,
2774
- className: c = "",
2775
- children: o,
3076
+ className: o = "",
3077
+ children: c,
2776
3078
  ...l
2777
3079
  } = e, d = n && s < i * (r + 1) ? "pf-m-hidden" : "pf-m-visible";
2778
3080
  return /* @__PURE__ */ a(
2779
3081
  xe,
2780
3082
  {
2781
3083
  ref: t,
2782
- className: `${d} ${c}`,
3084
+ className: `${d} ${o}`,
2783
3085
  ...l,
2784
- children: o
3086
+ children: c
2785
3087
  }
2786
3088
  );
2787
3089
  })
2788
3090
  );
2789
- ke.displayName = "ResponsiveTd";
2790
- const dt = Ie(
3091
+ Ee.displayName = "ResponsiveTd";
3092
+ const ht = Pe(
2791
3093
  ({ isDeleted: e, isSelected: t, onClick: s, children: i, rowOuiaId: r }) => /* @__PURE__ */ a(
2792
- ie,
3094
+ le,
2793
3095
  {
2794
3096
  onRowClick: (n) => {
2795
3097
  (n == null ? void 0 : n.target) instanceof HTMLElement && (["a", "button"].includes(n.target.tagName.toLowerCase()) || s && s());
@@ -2803,189 +3105,33 @@ const dt = Ie(
2803
3105
  }
2804
3106
  )
2805
3107
  );
2806
- dt.displayName = "DeletableRow";
2807
- const Ws = ({ label: e, onSearch: t }) => {
2808
- const s = (i, r, n) => {
2809
- t(r);
2810
- };
2811
- return /* @__PURE__ */ a(
2812
- Ct,
2813
- {
2814
- placeholder: `Filter by ${e}`,
2815
- onSearch: s
2816
- }
2817
- );
2818
- };
2819
- function ze({
2820
- options: e,
2821
- value: t,
2822
- onChange: s,
2823
- ouiaId: i
2824
- }) {
2825
- const [r, n] = I(!1);
2826
- return /* @__PURE__ */ a(
2827
- Ee,
2828
- {
2829
- toggle: (o) => /* @__PURE__ */ a(
2830
- ce,
2831
- {
2832
- ref: o,
2833
- onClick: () => n((l) => !l),
2834
- isExpanded: r,
2835
- variant: "plain",
2836
- children: /* @__PURE__ */ a(Ve, {})
2837
- }
2838
- ),
2839
- "aria-label": "table:select_filter",
2840
- selected: t,
2841
- isOpen: r,
2842
- onSelect: (o, l) => {
2843
- s(l), n(!1);
2844
- },
2845
- ouiaId: i,
2846
- children: /* @__PURE__ */ a(Rt, { children: e.map((o, l) => /* @__PURE__ */ a(Ce, { value: o, children: o }, l)) })
2847
- }
2848
- );
2849
- }
2850
- function Ks({
2851
- label: e,
2852
- chips: t,
2853
- options: s,
2854
- onToggle: i
2855
- }) {
2856
- const [r, n] = I(!1);
2857
- return /* @__PURE__ */ a(
2858
- Ee,
2859
- {
2860
- "aria-label": e,
2861
- onSelect: (c, o) => {
2862
- i(o);
2863
- },
2864
- selected: t,
2865
- isOpen: r,
2866
- toggle: (c) => /* @__PURE__ */ a(
2867
- ce,
2868
- {
2869
- ref: c,
2870
- onClick: () => n((o) => !o),
2871
- isExpanded: r,
2872
- style: {
2873
- width: "200px"
2874
- },
2875
- children: `Filter by ${e}`
2876
- }
2877
- ),
2878
- children: Object.entries(s).map(([c, o]) => /* @__PURE__ */ a(Ce, { value: c, hasCheckbox: !0, children: o }, c))
2879
- }
2880
- );
2881
- }
2882
- function ui({ filters: e, breakpoint: t = "md" }) {
2883
- const s = Object.keys(e), [i, r] = I(s[0]), n = (c, o) => {
2884
- switch (o.type) {
2885
- case "search":
2886
- return /* @__PURE__ */ a(
2887
- Ws,
2888
- {
2889
- onSearch: o.onSearch,
2890
- label: c,
2891
- validate: o.validate,
2892
- errorMessage: o.errorMessage
2893
- }
2894
- );
2895
- case "checkbox":
2896
- return /* @__PURE__ */ a(
2897
- Ks,
2898
- {
2899
- chips: o.chips,
2900
- options: o.options,
2901
- onToggle: o.onToggle,
2902
- label: c
2903
- }
2904
- );
2905
- }
2906
- };
2907
- return /* @__PURE__ */ f(ae, { children: [
2908
- /* @__PURE__ */ a(
2909
- xt,
2910
- {
2911
- variant: "search-filter",
2912
- visibility: { default: "hidden", [t]: "visible" },
2913
- "data-testid": "large-viewport-toolbar",
2914
- children: /* @__PURE__ */ f(Ut, { children: [
2915
- s.length > 1 && /* @__PURE__ */ a(
2916
- ze,
2917
- {
2918
- options: s,
2919
- value: i,
2920
- onChange: r,
2921
- ouiaId: "chip-filter-selector-large-viewport"
2922
- }
2923
- ),
2924
- n(i, e[i])
2925
- ] })
2926
- }
2927
- ),
2928
- /* @__PURE__ */ a(
2929
- At,
2930
- {
2931
- toggleIcon: /* @__PURE__ */ a(Ve, {}),
2932
- breakpoint: t,
2933
- visibility: { default: "visible", [t]: "hidden" },
2934
- children: /* @__PURE__ */ f(Pt, { variant: "filter-group", children: [
2935
- s.length > 1 && /* @__PURE__ */ a(
2936
- ze,
2937
- {
2938
- options: s,
2939
- value: i,
2940
- onChange: r,
2941
- ouiaId: "chip-filter-selector-small-viewport"
2942
- }
2943
- ),
2944
- Object.entries(e).map(([c, o], l) => /* @__PURE__ */ a(
2945
- Ot,
2946
- {
2947
- chips: o.type === "checkbox" ? o.chips.map((d) => ({ key: d, node: o.options[d] })) : o.chips,
2948
- deleteChip: (d, h) => o.onRemoveChip(typeof h == "string" ? h : h.key),
2949
- deleteChipGroup: o.onRemoveGroup,
2950
- categoryName: c,
2951
- showToolbarItem: c === i,
2952
- children: c === i && n(c, o)
2953
- },
2954
- l
2955
- ))
2956
- ] })
2957
- }
2958
- )
2959
- ] });
2960
- }
3108
+ ht.displayName = "DeletableRow";
2961
3109
  export {
2962
- ai as AppAboutModal,
2963
- ni as ApplicationAuth,
2964
- Kt as AuthConfigContext,
2965
- Ds as BasicAuthModal,
2966
- ui as ChipFilter,
2967
- ye as DateTime,
2968
- dt as DeletableRow,
2969
- Ks as FilterCheckbox,
2970
- Ws as FilterSearch,
2971
- ze as FilterSelector,
2972
- Ys as FromNow,
2973
- A as If,
2974
- oi as IfAuth,
2975
- Zs as IfNotEmpty,
2976
- oe as IfNotLoading,
2977
- ei as ListWithToolbar,
3110
+ ii as AppAboutModal,
3111
+ oi as ApplicationAuth,
3112
+ Jt as AuthConfigContext,
3113
+ Fs as BasicAuthModal,
3114
+ li as ChipFilterInput,
3115
+ Ie as DateTime,
3116
+ ht as DeletableRow,
3117
+ ci as FilterChips,
3118
+ Xs as FromNow,
3119
+ O as If,
3120
+ ai as IfAuth,
3121
+ Ys as IfNotEmpty,
3122
+ ue as IfNotLoading,
3123
+ Zs as ListWithToolbar,
2978
3124
  di as Loading,
2979
- ti as ObjectDropdown,
2980
- si as ObjectSelect,
3125
+ ei as ObjectDropdown,
3126
+ $s as ObjectSelect,
2981
3127
  hi as Pagination,
2982
- ci as PleaseWaitModal,
2983
- li as ProgressModal,
3128
+ ri as PleaseWaitModal,
3129
+ ni as ProgressModal,
2984
3130
  gi as ResponsiveTable,
2985
- ke as ResponsiveTd,
2986
- lt as ResponsiveTh,
2987
- $s as TableSkeleton,
2988
- ii as ToggleIcon,
2989
- ri as UrlUpload,
2990
- at as useAuth
3131
+ Ee as ResponsiveTd,
3132
+ dt as ResponsiveTh,
3133
+ Ws as TableSkeleton,
3134
+ ti as ToggleIcon,
3135
+ si as UrlUpload,
3136
+ ct as useAuth
2991
3137
  };