@keycloak/keycloak-ui-shared 25.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/LICENSE.txt +202 -0
  2. package/dist/alerts/Alerts.d.ts +18 -0
  3. package/dist/buttons/FormSubmitButton.d.ts +11 -0
  4. package/dist/context/ErrorPage.d.ts +5 -0
  5. package/dist/context/HelpContext.d.ts +10 -0
  6. package/dist/context/KeycloakContext.d.ts +13 -0
  7. package/dist/context/environment.d.ts +27 -0
  8. package/dist/continue-cancel/ContinueCancelModal.d.ts +16 -0
  9. package/dist/controls/FormErrorText.d.ts +6 -0
  10. package/dist/controls/FormLabel.d.ts +14 -0
  11. package/dist/controls/HelpItem.d.ts +10 -0
  12. package/dist/controls/NumberControl.d.ts +14 -0
  13. package/dist/controls/PasswordControl.d.ts +10 -0
  14. package/dist/controls/PasswordInput.d.ts +8 -0
  15. package/dist/controls/SwitchControl.d.ts +12 -0
  16. package/dist/controls/TextAreaControl.d.ts +9 -0
  17. package/dist/controls/TextControl.d.ts +11 -0
  18. package/dist/controls/keycloak-text-area/KeycloakTextArea.d.ts +5 -0
  19. package/dist/controls/select-control/SelectControl.d.ts +32 -0
  20. package/dist/controls/select-control/SingleSelectControl.d.ts +4 -0
  21. package/dist/controls/select-control/TypeaheadSelectControl.d.ts +4 -0
  22. package/dist/icons/IconMapper.d.ts +5 -0
  23. package/dist/keycloak-ui-shared.d.ts +1 -0
  24. package/dist/keycloak-ui-shared.js +1687 -0
  25. package/dist/main.css +1 -0
  26. package/dist/main.d.ts +31 -0
  27. package/dist/masthead/DefaultAvatar.d.ts +7 -0
  28. package/dist/masthead/KeycloakDropdown.d.ts +11 -0
  29. package/dist/masthead/Masthead.d.ts +23 -0
  30. package/dist/scroll-form/FormPanel.d.ts +9 -0
  31. package/dist/scroll-form/FormTitle.d.ts +9 -0
  32. package/dist/scroll-form/ScrollForm.d.ts +16 -0
  33. package/dist/scroll-form/ScrollPanel.d.ts +8 -0
  34. package/dist/select/KeycloakSelect.d.ts +31 -0
  35. package/dist/select/SingleSelect.d.ts +5 -0
  36. package/dist/select/TypeaheadSelect.d.ts +3 -0
  37. package/dist/user-profile/LocaleSelector.d.ts +8 -0
  38. package/dist/user-profile/MultiInputComponent.d.ts +16 -0
  39. package/dist/user-profile/OptionsComponent.d.ts +3 -0
  40. package/dist/user-profile/SelectComponent.d.ts +3 -0
  41. package/dist/user-profile/TextAreaComponent.d.ts +3 -0
  42. package/dist/user-profile/TextComponent.d.ts +3 -0
  43. package/dist/user-profile/UserProfileFields.d.ts +40 -0
  44. package/dist/user-profile/UserProfileGroup.d.ts +13 -0
  45. package/dist/user-profile/utils.d.ts +32 -0
  46. package/dist/utils/createNamedContext.d.ts +4 -0
  47. package/dist/utils/isDefined.d.ts +1 -0
  48. package/dist/utils/useRequiredContext.d.ts +10 -0
  49. package/dist/utils/useStorageItem.d.ts +11 -0
  50. package/dist/utils/useStoredState.d.ts +14 -0
  51. package/package.json +68 -0
@@ -0,0 +1,1687 @@
1
+ import { jsxs as v, jsx as t, Fragment as Y } from "react/jsx-runtime";
2
+ import { AlertGroup as tt, Alert as nt, AlertVariant as re, AlertActionCloseButton as rt, Page as lt, Modal as Pe, ModalVariant as at, Button as D, TextContent as it, Text as ae, TextVariants as st, Spinner as ot, FormHelperText as ue, HelperText as he, HelperTextItem as me, Popover as ct, Icon as ie, FormGroup as Ve, NumberInput as dt, ValidatedOptions as M, InputGroup as pe, InputGroupItem as se, TextInput as Q, Select as X, MenuToggle as W, MenuToggleStatus as fe, SelectList as Z, SelectOption as ge, TextInputGroup as Me, TextInputGroupMain as Ne, ChipGroup as qe, Chip as Le, TextInputGroupUtilities as Be, Switch as ut, TextArea as _e, Title as ht, Card as mt, CardHeader as pt, CardTitle as ft, CardBody as gt, Grid as yt, GridItem as xe, PageSection as vt, JumpLinks as bt, JumpLinksItem as Ct, ButtonVariant as we, Checkbox as It, Radio as kt, MenuFooter as xt, Dropdown as wt, DropdownList as At, DropdownItem as Ae, Brand as Tt, Avatar as St } from "@patternfly/react-core";
3
+ import { createContext as ye, useContext as ve, useState as T, useCallback as He, useEffect as be, useMemo as P, useRef as ee, forwardRef as Ft, useId as Ot, Fragment as Ue, Children as $e } from "react";
4
+ import { useTranslation as Ce } from "react-i18next";
5
+ import Rt from "keycloak-js";
6
+ import { ExclamationCircleIcon as Dt, HelpIcon as Te, EyeIcon as Et, EyeSlashIcon as Pt, TimesIcon as Ge, CubeIcon as Vt, PaypalIcon as Mt, InstagramIcon as Nt, BitbucketIcon as qt, MicrosoftIcon as Lt, TwitterIcon as Bt, StackOverflowIcon as _t, OpenshiftIcon as Ht, LinkedinIcon as Ut, GoogleIcon as $t, GitlabIcon as Gt, FacebookSquareIcon as Wt, GithubIcon as Kt, MinusCircleIcon as jt, PlusCircleIcon as zt, EllipsisVIcon as Jt } from "@patternfly/react-icons";
7
+ import { useFormContext as te, Controller as U, useController as Ie, FormProvider as Yt, useWatch as Qt } from "react-hook-form";
8
+ import { get as G } from "lodash-es";
9
+ import { PageHeader as Xt, PageHeaderTools as Zt, PageHeaderToolsGroup as en, PageHeaderToolsItem as le } from "@patternfly/react-core/deprecated";
10
+ import j from "@patternfly/react-styles/css/components/Avatar/avatar";
11
+ import { css as tn } from "@patternfly/react-styles";
12
+ import './main.css';const We = ye(void 0), rr = () => ve(We), nn = ({ children: e }) => {
13
+ const [n, r] = T([]), l = (s) => {
14
+ r((c) => c.filter((o) => o.id !== s));
15
+ }, a = (s, c = re.success, o) => {
16
+ r([
17
+ {
18
+ id: Math.random() * 100,
19
+ message: s,
20
+ variant: c,
21
+ description: o
22
+ },
23
+ ...n
24
+ ]);
25
+ }, i = (s) => {
26
+ a(s, re.danger);
27
+ };
28
+ return /* @__PURE__ */ v(We.Provider, { value: { addAlert: a, addError: i }, children: [
29
+ /* @__PURE__ */ t(tt, { isToast: !0, "data-testid": "alerts", children: n.map(({ id: s, variant: c, message: o, description: d }) => /* @__PURE__ */ t(
30
+ nt,
31
+ {
32
+ isLiveRegion: !0,
33
+ variant: re[c],
34
+ variantLabel: "",
35
+ title: o,
36
+ actionClose: /* @__PURE__ */ t(
37
+ rt,
38
+ {
39
+ title: o,
40
+ onClose: () => l(s)
41
+ }
42
+ ),
43
+ timeout: !0,
44
+ onTimeout: () => l(s),
45
+ children: d && /* @__PURE__ */ t("p", { children: d })
46
+ },
47
+ s
48
+ )) }),
49
+ e
50
+ ] });
51
+ }, rn = (e) => {
52
+ const { t: n } = Ce(), r = e.error, l = ln(r);
53
+ function a() {
54
+ location.href = location.origin + location.pathname;
55
+ }
56
+ return /* @__PURE__ */ t(lt, { children: /* @__PURE__ */ t(
57
+ Pe,
58
+ {
59
+ variant: at.small,
60
+ title: n("somethingWentWrong"),
61
+ titleIconVariant: "danger",
62
+ showClose: !1,
63
+ isOpen: !0,
64
+ actions: [
65
+ /* @__PURE__ */ t(D, { variant: "primary", onClick: a, children: n("tryAgain") }, "tryAgain")
66
+ ],
67
+ children: /* @__PURE__ */ v(it, { children: [
68
+ /* @__PURE__ */ t(ae, { children: n("somethingWentWrongDescription") }),
69
+ l && /* @__PURE__ */ t(ae, { component: st.small, children: l })
70
+ ] })
71
+ }
72
+ ) });
73
+ };
74
+ function ln(e) {
75
+ return typeof e == "string" ? e : e instanceof Error ? e.message : null;
76
+ }
77
+ function an(e, n) {
78
+ const r = ye(n);
79
+ return r.displayName = e, r;
80
+ }
81
+ function sn(e) {
82
+ return e != null;
83
+ }
84
+ function on(e) {
85
+ const n = ve(e);
86
+ if (sn(n))
87
+ return n;
88
+ throw new Error(
89
+ `No provider found for ${e.displayName ? `the '${e.displayName}'` : "an unknown"} context, make sure it is included in your component hierarchy.`
90
+ );
91
+ }
92
+ function cn(e, n, r) {
93
+ const [l, a] = T(
94
+ () => e.getItem(n) ?? r
95
+ ), i = He((s) => {
96
+ a(s), e.setItem(n, s);
97
+ }, []);
98
+ return be(() => {
99
+ a(e.getItem(n) ?? r), window.addEventListener("storage", s);
100
+ function s(c) {
101
+ c.storageArea === e && (c.key === null || c.key === n) && a(c.newValue ?? r);
102
+ }
103
+ return () => window.removeEventListener("storage", s);
104
+ }, [e, n]), [l, i];
105
+ }
106
+ function dn(e, n, r) {
107
+ const l = P(
108
+ () => JSON.stringify(r),
109
+ [r]
110
+ ), [a, i] = cn(
111
+ e,
112
+ n,
113
+ l
114
+ ), s = P(() => JSON.parse(a), [a]), c = He(
115
+ (o) => i(JSON.stringify(o)),
116
+ []
117
+ );
118
+ return [s, c];
119
+ }
120
+ const Ke = an(
121
+ "HelpContext",
122
+ void 0
123
+ ), un = () => on(Ke), hn = ({ children: e }) => {
124
+ const [n, r] = dn(localStorage, "helpEnabled", !0);
125
+ function l() {
126
+ r(!n);
127
+ }
128
+ return /* @__PURE__ */ t(Ke.Provider, { value: { enabled: n, toggleHelp: l }, children: e });
129
+ }, mn = () => ye(void 0);
130
+ let oe;
131
+ const lr = () => {
132
+ const e = ve(oe);
133
+ if (!e)
134
+ throw Error(
135
+ "no environment provider in the hierarchy make sure to add the provider"
136
+ );
137
+ return e;
138
+ }, ar = ({
139
+ environment: e,
140
+ children: n
141
+ }) => {
142
+ oe = mn();
143
+ const r = ee(!1), [l, a] = T(!1), [i, s] = T(), c = P(() => {
144
+ const o = new Rt({
145
+ url: e.authServerUrl,
146
+ realm: e.realm,
147
+ clientId: e.clientId
148
+ });
149
+ return o.onAuthLogout = () => o.login(), o;
150
+ }, [e]);
151
+ return be(() => {
152
+ if (r.current)
153
+ return;
154
+ c.init({
155
+ onLoad: "check-sso",
156
+ pkceMethod: "S256",
157
+ responseMode: "query"
158
+ }).then(() => a(!0)).catch((d) => s(d)), r.current = !0;
159
+ }, [c]), i ? /* @__PURE__ */ t(rn, { error: i }) : l ? /* @__PURE__ */ t(oe.Provider, { value: { environment: e, keycloak: c }, children: /* @__PURE__ */ t(nn, { children: /* @__PURE__ */ t(hn, { children: n }) }) }) : /* @__PURE__ */ t(ot, {});
160
+ };
161
+ function ir(e) {
162
+ const n = document.getElementById("environment");
163
+ let r = {};
164
+ try {
165
+ n?.textContent && (r = JSON.parse(n.textContent));
166
+ } catch {
167
+ console.error("Unable to parse environment variables.");
168
+ }
169
+ return { ...e, ...r };
170
+ }
171
+ const sr = ({
172
+ modalTitle: e,
173
+ continueLabel: n,
174
+ cancelLabel: r,
175
+ buttonTitle: l,
176
+ isDisabled: a,
177
+ buttonVariant: i,
178
+ buttonTestRole: s,
179
+ onContinue: c,
180
+ component: o = D,
181
+ children: d,
182
+ ...m
183
+ }) => {
184
+ const [y, h] = T(!1);
185
+ return /* @__PURE__ */ v(Y, { children: [
186
+ /* @__PURE__ */ t(
187
+ o,
188
+ {
189
+ variant: i,
190
+ onClick: () => h(!0),
191
+ isDisabled: a,
192
+ "data-testrole": s,
193
+ children: l
194
+ }
195
+ ),
196
+ /* @__PURE__ */ t(
197
+ Pe,
198
+ {
199
+ variant: "small",
200
+ ...m,
201
+ title: e,
202
+ isOpen: y,
203
+ onClose: () => h(!1),
204
+ actions: [
205
+ /* @__PURE__ */ t(
206
+ D,
207
+ {
208
+ id: "modal-confirm",
209
+ variant: "primary",
210
+ onClick: () => {
211
+ h(!1), c();
212
+ },
213
+ children: n
214
+ },
215
+ "confirm"
216
+ ),
217
+ /* @__PURE__ */ t(
218
+ D,
219
+ {
220
+ id: "modal-cancel",
221
+ variant: "secondary",
222
+ onClick: () => h(!1),
223
+ children: r
224
+ },
225
+ "cancel"
226
+ )
227
+ ],
228
+ children: d
229
+ }
230
+ )
231
+ ] });
232
+ }, je = ({ message: e, ...n }) => /* @__PURE__ */ t(ue, { ...n, children: /* @__PURE__ */ t(he, { children: /* @__PURE__ */ t(me, { icon: /* @__PURE__ */ t(Dt, {}), variant: "error", children: e }) }) }), ze = ({
233
+ helpText: e,
234
+ fieldLabelId: n,
235
+ noVerticalAlign: r = !0,
236
+ unWrap: l = !1
237
+ }) => {
238
+ const { enabled: a } = un();
239
+ return a ? /* @__PURE__ */ t(ct, { bodyContent: e, children: /* @__PURE__ */ v(Y, { children: [
240
+ !l && /* @__PURE__ */ t(
241
+ "button",
242
+ {
243
+ "data-testid": `help-label-${n}`,
244
+ "aria-label": n,
245
+ onClick: (i) => i.preventDefault(),
246
+ className: "pf-v5-c-form__group-label-help",
247
+ children: /* @__PURE__ */ t(ie, { isInline: r, children: /* @__PURE__ */ t(Te, {}) })
248
+ }
249
+ ),
250
+ l && /* @__PURE__ */ t(ie, { isInline: r, children: /* @__PURE__ */ t(Te, {}) })
251
+ ] }) }) : null;
252
+ }, _ = ({
253
+ name: e,
254
+ label: n,
255
+ labelIcon: r,
256
+ error: l,
257
+ children: a,
258
+ ...i
259
+ }) => /* @__PURE__ */ v(
260
+ Ve,
261
+ {
262
+ label: n || e,
263
+ fieldId: e,
264
+ labelIcon: r ? /* @__PURE__ */ t(ze, { helpText: r, fieldLabelId: e }) : void 0,
265
+ ...i,
266
+ children: [
267
+ a,
268
+ l && /* @__PURE__ */ t(je, { "data-testid": `${e}-helper`, message: l.message })
269
+ ]
270
+ }
271
+ ), or = ({
272
+ name: e,
273
+ label: n,
274
+ controller: r,
275
+ labelIcon: l,
276
+ ...a
277
+ }) => {
278
+ const {
279
+ control: i,
280
+ formState: { errors: s }
281
+ } = te();
282
+ return /* @__PURE__ */ t(
283
+ _,
284
+ {
285
+ name: e,
286
+ label: n,
287
+ isRequired: r.rules?.required === !0,
288
+ error: s[e],
289
+ labelIcon: l,
290
+ children: /* @__PURE__ */ t(
291
+ U,
292
+ {
293
+ ...r,
294
+ name: e,
295
+ control: i,
296
+ render: ({ field: c }) => {
297
+ const o = !!r.rules?.required, d = r.rules?.min, m = c.value === 0 ? r.defaultValue : c.value, y = (h) => c.onChange(d ? Math.max(h, Number(d)) : h);
298
+ return /* @__PURE__ */ t(
299
+ dt,
300
+ {
301
+ ...a,
302
+ id: e,
303
+ value: m,
304
+ validated: s[e] ? M.error : M.default,
305
+ required: o,
306
+ min: Number(d),
307
+ max: Number(r.rules?.max),
308
+ onPlus: () => y(m + 1),
309
+ onMinus: () => y(m - 1),
310
+ onChange: (h) => {
311
+ const u = Number(h.currentTarget.value);
312
+ y(isNaN(u) ? r.defaultValue : u);
313
+ }
314
+ }
315
+ );
316
+ }
317
+ }
318
+ )
319
+ }
320
+ );
321
+ }, pn = ({
322
+ hasReveal: e = !0,
323
+ innerRef: n,
324
+ ...r
325
+ }) => {
326
+ const { t: l } = Ce(), [a, i] = T(!0);
327
+ return /* @__PURE__ */ v(pe, { children: [
328
+ /* @__PURE__ */ t(se, { isFill: !0, children: /* @__PURE__ */ t(
329
+ Q,
330
+ {
331
+ ...r,
332
+ type: a ? "password" : "text",
333
+ ref: n
334
+ }
335
+ ) }),
336
+ e && /* @__PURE__ */ t(
337
+ D,
338
+ {
339
+ variant: "control",
340
+ "aria-label": l("showPassword"),
341
+ onClick: () => i(!a),
342
+ children: a ? /* @__PURE__ */ t(Et, {}) : /* @__PURE__ */ t(Pt, {})
343
+ }
344
+ )
345
+ ] });
346
+ }, Je = Ft(
347
+ (e, n) => /* @__PURE__ */ t(pn, { ...e, innerRef: n })
348
+ );
349
+ Je.displayName = "PasswordInput";
350
+ const cr = (e) => {
351
+ const { labelIcon: n, ...r } = e, l = !!e.rules?.required, a = e.defaultValue ?? "", { field: i, fieldState: s } = Ie({
352
+ ...e,
353
+ defaultValue: a
354
+ });
355
+ return /* @__PURE__ */ v(
356
+ _,
357
+ {
358
+ name: e.name,
359
+ label: e.label,
360
+ labelIcon: n,
361
+ isRequired: l,
362
+ error: s.error,
363
+ children: [
364
+ /* @__PURE__ */ t(
365
+ Je,
366
+ {
367
+ isRequired: l,
368
+ id: e.name,
369
+ "data-testid": e.name,
370
+ validated: s.error ? M.error : M.default,
371
+ isDisabled: e.isDisabled,
372
+ ...r,
373
+ ...i
374
+ }
375
+ ),
376
+ e.helperText && /* @__PURE__ */ t(ue, { children: /* @__PURE__ */ t(he, { children: /* @__PURE__ */ t(me, { children: e.helperText }) }) })
377
+ ]
378
+ }
379
+ );
380
+ }, fn = ({
381
+ id: e,
382
+ name: n,
383
+ label: r,
384
+ options: l,
385
+ controller: a,
386
+ labelIcon: i,
387
+ ...s
388
+ }) => {
389
+ const {
390
+ control: c,
391
+ formState: { errors: o }
392
+ } = te(), [d, m] = T(!1);
393
+ return /* @__PURE__ */ t(
394
+ _,
395
+ {
396
+ name: n,
397
+ label: r,
398
+ isRequired: !!a.rules?.required,
399
+ error: G(o, n),
400
+ labelIcon: i,
401
+ children: /* @__PURE__ */ t(
402
+ U,
403
+ {
404
+ ...a,
405
+ name: n,
406
+ control: c,
407
+ render: ({ field: { onChange: y, value: h } }) => /* @__PURE__ */ t(
408
+ X,
409
+ {
410
+ ...s,
411
+ onClick: () => m(!d),
412
+ onOpenChange: () => m(!1),
413
+ selected: $(l) ? l.filter(
414
+ (u) => Array.isArray(h) ? h.includes(u.key) : h === u.key
415
+ ).map((u) => u.value) : h,
416
+ toggle: (u) => /* @__PURE__ */ t(
417
+ W,
418
+ {
419
+ id: e || n.slice(n.lastIndexOf(".") + 1),
420
+ ref: u,
421
+ onClick: () => m(!d),
422
+ isExpanded: d,
423
+ isFullWidth: !0,
424
+ status: G(o, n) ? fe.danger : void 0,
425
+ "aria-label": "toggle",
426
+ children: $(l) ? l.find(
427
+ (x) => x.key === (Array.isArray(h) ? h[0] : h)
428
+ )?.value : h
429
+ }
430
+ ),
431
+ onSelect: (u, x) => {
432
+ const g = x?.toString();
433
+ y(Array.isArray(h) ? [g] : g), m(!1);
434
+ },
435
+ isOpen: d,
436
+ children: /* @__PURE__ */ t(Z, { children: l.map((u) => /* @__PURE__ */ t(ge, { value: L(u), children: ke(u) ? u : u.value }, L(u))) })
437
+ }
438
+ )
439
+ }
440
+ )
441
+ }
442
+ );
443
+ }, z = (e) => ke(e) ? e : e.value, gn = ({
444
+ id: e,
445
+ name: n,
446
+ label: r,
447
+ options: l,
448
+ controller: a,
449
+ labelIcon: i,
450
+ placeholderText: s,
451
+ onFilter: c,
452
+ variant: o,
453
+ ...d
454
+ }) => {
455
+ const {
456
+ control: m,
457
+ formState: { errors: y }
458
+ } = te(), [h, u] = T(!1), [x, g] = T(""), [f, w] = T(0), E = ee(), C = l.filter(
459
+ (p) => z(p).toLowerCase().startsWith(x.toLowerCase())
460
+ ), b = P(
461
+ () => C.map((p, I) => /* @__PURE__ */ t(
462
+ ge,
463
+ {
464
+ value: L(p),
465
+ isFocused: f === I,
466
+ children: z(p)
467
+ },
468
+ L(p)
469
+ )),
470
+ [f, C]
471
+ ), q = (p, I) => {
472
+ const A = C[f];
473
+ switch (u(!0), p.key) {
474
+ case "Enter": {
475
+ p.preventDefault(), o !== H.typeaheadMulti ? g(z(A)) : g(""), I.onChange(
476
+ Array.isArray(I.value) ? [...I.value, L(A)] : L(A)
477
+ ), u(!1), w(0);
478
+ break;
479
+ }
480
+ case "Tab":
481
+ case "Escape": {
482
+ u(!1), I.onChange(void 0);
483
+ break;
484
+ }
485
+ case "Backspace": {
486
+ o === H.typeahead && I.onChange("");
487
+ break;
488
+ }
489
+ case "ArrowUp":
490
+ case "ArrowDown": {
491
+ p.preventDefault();
492
+ let k = 0;
493
+ p.key === "ArrowUp" && (f === 0 ? k = l.length - 1 : k = f - 1), p.key === "ArrowDown" && (f === l.length - 1 ? k = 0 : k = f + 1), w(k);
494
+ break;
495
+ }
496
+ }
497
+ };
498
+ return /* @__PURE__ */ t(
499
+ _,
500
+ {
501
+ name: n,
502
+ label: r,
503
+ isRequired: !!a.rules?.required,
504
+ error: G(y, n),
505
+ labelIcon: i,
506
+ children: /* @__PURE__ */ t(
507
+ U,
508
+ {
509
+ ...a,
510
+ name: n,
511
+ control: m,
512
+ render: ({ field: p }) => /* @__PURE__ */ t(
513
+ X,
514
+ {
515
+ ...d,
516
+ onClick: () => u(!h),
517
+ onOpenChange: () => u(!1),
518
+ selected: $(l) ? l.filter(
519
+ (I) => Array.isArray(p.value) ? p.value.includes(I.key) : p.value === I.key
520
+ ).map((I) => I.value) : p.value,
521
+ toggle: (I) => /* @__PURE__ */ t(
522
+ W,
523
+ {
524
+ ref: I,
525
+ id: e || n.slice(n.lastIndexOf(".") + 1),
526
+ variant: "typeahead",
527
+ onClick: () => u(!h),
528
+ isExpanded: h,
529
+ isFullWidth: !0,
530
+ status: G(y, n) ? fe.danger : void 0,
531
+ children: /* @__PURE__ */ v(Me, { isPlain: !0, children: [
532
+ /* @__PURE__ */ t(
533
+ Ne,
534
+ {
535
+ placeholder: s,
536
+ value: o === H.typeahead && p.value ? $(l) ? l.find(
537
+ (A) => A.key === (Array.isArray(p.value) ? p.value[0] : p.value)
538
+ )?.value : p.value : x,
539
+ onClick: () => u(!h),
540
+ onChange: (A, k) => {
541
+ g(k), c?.(k);
542
+ },
543
+ onKeyDown: (A) => q(A, p),
544
+ autoComplete: "off",
545
+ innerRef: E,
546
+ role: "combobox",
547
+ isExpanded: h,
548
+ "aria-controls": "select-typeahead-listbox",
549
+ children: o === H.typeaheadMulti && Array.isArray(p.value) && /* @__PURE__ */ t(qe, { "aria-label": "Current selections", children: p.value.map(
550
+ (A, k) => /* @__PURE__ */ t(
551
+ Le,
552
+ {
553
+ onClick: (S) => {
554
+ S.stopPropagation(), p.onChange(
555
+ p.value.filter(
556
+ (F) => F !== L(A)
557
+ )
558
+ );
559
+ },
560
+ children: $(l) ? l.find((S) => A === S.key)?.value : z(A)
561
+ },
562
+ k
563
+ )
564
+ ) })
565
+ }
566
+ ),
567
+ /* @__PURE__ */ t(Be, { children: !!x && /* @__PURE__ */ t(
568
+ D,
569
+ {
570
+ variant: "plain",
571
+ onClick: () => {
572
+ p.onChange(void 0), g(""), E?.current?.focus();
573
+ },
574
+ "aria-label": "Clear input value",
575
+ children: /* @__PURE__ */ t(Ge, { "aria-hidden": !0 })
576
+ }
577
+ ) })
578
+ ] })
579
+ }
580
+ ),
581
+ onSelect: (I, A) => {
582
+ I?.stopPropagation();
583
+ const k = A?.toString();
584
+ o === H.typeaheadMulti && Array.isArray(p.value) ? p.value.includes(k) ? p.onChange(
585
+ p.value.filter((S) => S !== k)
586
+ ) : p.onChange([...p.value, k]) : (p.onChange(Array.isArray(p.value) ? [k] : k), u(!1));
587
+ },
588
+ isOpen: h,
589
+ children: /* @__PURE__ */ t(Z, { children: b })
590
+ }
591
+ )
592
+ }
593
+ )
594
+ }
595
+ );
596
+ };
597
+ var H = /* @__PURE__ */ ((e) => (e.single = "single", e.typeahead = "typeahead", e.typeaheadMulti = "typeaheadMulti", e))(H || {});
598
+ const $ = (e) => typeof e[0] != "string", ke = (e) => typeof e == "string", L = (e) => ke(e) ? e : e.key, yn = ({
599
+ variant: e = "single",
600
+ ...n
601
+ }) => e === "single" ? /* @__PURE__ */ t(fn, { ...n }) : /* @__PURE__ */ t(gn, { ...n, variant: e }), dr = ({
602
+ labelOn: e,
603
+ stringify: n,
604
+ defaultValue: r,
605
+ labelIcon: l,
606
+ ...a
607
+ }) => {
608
+ const s = r ?? (n ? "false" : !1), { control: c } = te();
609
+ return /* @__PURE__ */ t(
610
+ _,
611
+ {
612
+ hasNoPaddingTop: !0,
613
+ name: a.name,
614
+ isRequired: a.rules?.required === !0,
615
+ label: a.label,
616
+ labelIcon: l,
617
+ children: /* @__PURE__ */ t(
618
+ U,
619
+ {
620
+ control: c,
621
+ name: a.name,
622
+ defaultValue: s,
623
+ render: ({ field: { onChange: o, value: d } }) => /* @__PURE__ */ t(
624
+ ut,
625
+ {
626
+ ...a,
627
+ id: a.name,
628
+ "data-testid": a.name,
629
+ label: e,
630
+ isChecked: n ? d === "true" : d,
631
+ onChange: (m, y) => {
632
+ const h = n ? y.toString() : y;
633
+ a.onChange?.(m, y), o(h);
634
+ }
635
+ }
636
+ )
637
+ }
638
+ )
639
+ }
640
+ );
641
+ }, ur = (e) => {
642
+ const n = !!e.rules?.required, r = e.defaultValue ?? "", { field: l, fieldState: a } = Ie({
643
+ ...e,
644
+ defaultValue: r
645
+ });
646
+ return /* @__PURE__ */ t(
647
+ _,
648
+ {
649
+ isRequired: n,
650
+ label: e.label,
651
+ labelIcon: e.labelIcon,
652
+ name: e.name,
653
+ error: a.error,
654
+ children: /* @__PURE__ */ t(
655
+ _e,
656
+ {
657
+ isRequired: n,
658
+ id: e.name,
659
+ "data-testid": e.name,
660
+ validated: a.error ? M.error : M.default,
661
+ isDisabled: e.isDisabled,
662
+ ...l
663
+ }
664
+ )
665
+ }
666
+ );
667
+ }, hr = (e) => {
668
+ const { labelIcon: n, ...r } = e, l = !!e.rules?.required, a = e.defaultValue ?? "", { field: i, fieldState: s } = Ie({
669
+ ...e,
670
+ defaultValue: a
671
+ });
672
+ return /* @__PURE__ */ v(
673
+ _,
674
+ {
675
+ name: e.name,
676
+ label: e.label,
677
+ labelIcon: n,
678
+ isRequired: l,
679
+ error: s.error,
680
+ children: [
681
+ /* @__PURE__ */ t(
682
+ Q,
683
+ {
684
+ isRequired: l,
685
+ id: e.name,
686
+ "data-testid": e.name,
687
+ validated: s.error ? M.error : M.default,
688
+ isDisabled: e.isDisabled,
689
+ ...r,
690
+ ...i
691
+ }
692
+ ),
693
+ e.helperText && /* @__PURE__ */ t(ue, { children: /* @__PURE__ */ t(he, { children: /* @__PURE__ */ t(me, { children: e.helperText }) }) })
694
+ ]
695
+ }
696
+ );
697
+ }, vn = _e, mr = ({ icon: e }) => {
698
+ const n = bn(e);
699
+ return /* @__PURE__ */ t(ie, { size: "lg", children: /* @__PURE__ */ t(n, { alt: e }) });
700
+ };
701
+ function bn(e) {
702
+ switch (e) {
703
+ case "github":
704
+ return Kt;
705
+ case "facebook":
706
+ return Wt;
707
+ case "gitlab":
708
+ return Gt;
709
+ case "google":
710
+ return $t;
711
+ case "linkedin":
712
+ case "linkedin-openid-connect":
713
+ return Ut;
714
+ case "openshift-v3":
715
+ case "openshift-v4":
716
+ return Ht;
717
+ case "stackoverflow":
718
+ return _t;
719
+ case "twitter":
720
+ return Bt;
721
+ case "microsoft":
722
+ return Lt;
723
+ case "bitbucket":
724
+ return qt;
725
+ case "instagram":
726
+ return Nt;
727
+ case "paypal":
728
+ return Mt;
729
+ default:
730
+ return Vt;
731
+ }
732
+ }
733
+ const Cn = "_title_180i0_2", In = {
734
+ title: Cn
735
+ }, Ye = ({
736
+ id: e,
737
+ title: n,
738
+ headingLevel: r = "h1",
739
+ size: l = "xl",
740
+ ...a
741
+ }) => /* @__PURE__ */ t(
742
+ ht,
743
+ {
744
+ headingLevel: r,
745
+ size: l,
746
+ className: In.title,
747
+ id: e,
748
+ tabIndex: 0,
749
+ ...a,
750
+ children: n
751
+ }
752
+ ), kn = ({
753
+ title: e,
754
+ children: n,
755
+ scrollId: r,
756
+ className: l
757
+ }) => {
758
+ const a = Ot();
759
+ return /* @__PURE__ */ v(mt, { id: a, className: l, isFlat: !0, children: [
760
+ /* @__PURE__ */ t(pt, { className: "kc-form-panel__header", children: /* @__PURE__ */ t(ft, { tabIndex: 0, children: /* @__PURE__ */ t(Ye, { id: r, title: e }) }) }),
761
+ /* @__PURE__ */ t(gt, { className: "kc-form-panel__body", children: n })
762
+ ] });
763
+ }, xn = (e) => {
764
+ const { title: n, children: r, scrollId: l, ...a } = e;
765
+ return /* @__PURE__ */ t("section", { ...a, style: { marginTop: "var(--pf-v5-global--spacer--lg)" }, children: /* @__PURE__ */ v(Y, { children: [
766
+ /* @__PURE__ */ t(Ye, { id: l, title: n }),
767
+ r
768
+ ] }) });
769
+ }, wn = "_panel_1cdve_1", An = "_sticky_1cdve_5", Se = {
770
+ panel: wn,
771
+ sticky: An
772
+ }, Tn = "kc-main-content-page-container", Fe = (e) => e.replace(/\s+/g, "-"), Sn = ({
773
+ label: e,
774
+ sections: n,
775
+ borders: r = !1,
776
+ ...l
777
+ }) => {
778
+ const a = P(
779
+ () => n.filter(({ isHidden: i }) => !i),
780
+ [n]
781
+ );
782
+ return /* @__PURE__ */ v(yt, { hasGutter: !0, ...l, children: [
783
+ /* @__PURE__ */ t(xe, { md: 8, sm: 12, children: a.map(({ title: i, panel: s }) => {
784
+ const c = Fe(i.toLowerCase());
785
+ return /* @__PURE__ */ t(Ue, { children: r ? /* @__PURE__ */ t(
786
+ kn,
787
+ {
788
+ scrollId: c,
789
+ title: i,
790
+ className: Se.panel,
791
+ children: s
792
+ }
793
+ ) : /* @__PURE__ */ t(xn, { scrollId: c, title: i, children: s }) }, i);
794
+ }) }),
795
+ /* @__PURE__ */ t(xe, { md: 4, sm: 12, order: { default: "-1", md: "1" }, children: /* @__PURE__ */ t(vt, { className: Se.sticky, children: /* @__PURE__ */ t(
796
+ bt,
797
+ {
798
+ isVertical: !0,
799
+ scrollableSelector: `#${Tn}`,
800
+ label: e,
801
+ offset: 100,
802
+ children: a.map(({ title: i }) => {
803
+ const s = Fe(i.toLowerCase());
804
+ return (
805
+ // note that JumpLinks currently does not work with spaces in the href
806
+ /* @__PURE__ */ t(
807
+ Ct,
808
+ {
809
+ href: `#${s}`,
810
+ "data-testid": `jump-link-${s}`,
811
+ children: i
812
+ },
813
+ i
814
+ )
815
+ );
816
+ })
817
+ }
818
+ ) }) })
819
+ ] });
820
+ }, Fn = (e, n, r) => (e.isValid || r) && (e.isDirty || n) && !e.isLoading && !e.isValidating && !e.isSubmitting, pr = ({
821
+ formState: e,
822
+ isDisabled: n = !1,
823
+ allowInvalid: r = !1,
824
+ allowNonDirty: l = !1,
825
+ children: a,
826
+ ...i
827
+ }) => /* @__PURE__ */ t(
828
+ D,
829
+ {
830
+ variant: "primary",
831
+ isDisabled: e && !Fn(e, l, r) || n,
832
+ ...i,
833
+ type: "submit",
834
+ children: a
835
+ }
836
+ ), On = (e) => {
837
+ try {
838
+ return new Intl.DisplayNames([e], { type: "language" }).of(e);
839
+ } catch {
840
+ return e;
841
+ }
842
+ }, Rn = ({
843
+ t: e,
844
+ form: n,
845
+ supportedLocales: r,
846
+ currentLocale: l
847
+ }) => {
848
+ const a = P(
849
+ () => r.map((i) => ({
850
+ key: i,
851
+ value: e(`locale_${i}`, On(i) ?? i)
852
+ })).sort((i, s) => i.value.localeCompare(s.value, l)),
853
+ [r, l, e]
854
+ );
855
+ return a.length ? /* @__PURE__ */ t(Yt, { ...n, children: /* @__PURE__ */ t(
856
+ yn,
857
+ {
858
+ "data-testid": "locale-select",
859
+ name: "attributes.locale",
860
+ label: e("selectALocale"),
861
+ controller: { defaultValue: "" },
862
+ options: a,
863
+ variant: a.length >= 10 ? "typeahead" : "single"
864
+ }
865
+ ) }) : null;
866
+ }, Qe = (e) => e?.includes("${"), Xe = (e) => e.substring(2, e.length - 1), B = (e, n, r) => (Qe(n) ? e(Xe(n)) : n) || r, ce = (e, n) => B(e, n.displayName, n.name), Dn = ["username", "firstName", "lastName", "email"], Ze = (e) => e && Dn.includes(e), N = (e) => `${Ze(e) ? "" : "attributes."}${e?.replaceAll(
867
+ ".",
868
+ "🍺"
869
+ )}`, fr = (e) => e.replaceAll(".", "🍺"), gr = (e) => e.replaceAll("🍺", ".");
870
+ function yr(e, n, r) {
871
+ (e.responseData.errors !== void 0 ? e.responseData.errors : [e.responseData]).forEach((l) => {
872
+ const a = Object.assign(
873
+ {},
874
+ l.params?.map((i) => r(Qe(i.toString()) ? Xe(i) : i))
875
+ );
876
+ n(N(l.field), {
877
+ message: r(l.errorMessage, {
878
+ ...a,
879
+ defaultValue: l.errorMessage || l.field
880
+ }),
881
+ type: "server"
882
+ });
883
+ });
884
+ }
885
+ function ne({
886
+ required: e,
887
+ validators: n
888
+ }) {
889
+ return e || En(n);
890
+ }
891
+ function En(e) {
892
+ return e && "length" in e && "min" in e.length && typeof e.length.min == "number" ? e.length.min > 0 : !1;
893
+ }
894
+ function vr(e) {
895
+ if (typeof e != "object" || e === null || !("responseData" in e))
896
+ return !1;
897
+ const { responseData: n } = e;
898
+ return Oe(n) ? !0 : typeof n != "object" || n === null || !("errors" in n) || !Array.isArray(n.errors) ? !1 : n.errors.every(Oe);
899
+ }
900
+ function Oe(e) {
901
+ return !(typeof e != "object" || e === null || !("field" in e) || typeof e.field != "string" || !("errorMessage" in e) || typeof e.errorMessage != "string");
902
+ }
903
+ const K = ({
904
+ t: e,
905
+ form: n,
906
+ attribute: r,
907
+ renderer: l,
908
+ children: a
909
+ }) => {
910
+ const i = B(
911
+ e,
912
+ r.annotations?.inputHelperTextBefore
913
+ ), {
914
+ formState: { errors: s }
915
+ } = n, c = l?.(r), o = G(s, N(r.name));
916
+ return /* @__PURE__ */ v(
917
+ Ve,
918
+ {
919
+ label: ce(e, r) || "",
920
+ fieldId: r.name,
921
+ isRequired: ne(r),
922
+ labelIcon: i ? /* @__PURE__ */ t(ze, { helpText: i, fieldLabelId: r.name }) : void 0,
923
+ children: [
924
+ c ? /* @__PURE__ */ v(pe, { children: [
925
+ a,
926
+ c
927
+ ] }) : a,
928
+ o && /* @__PURE__ */ t(
929
+ je,
930
+ {
931
+ "data-testid": `${r.name}-helper`,
932
+ message: o.message
933
+ }
934
+ )
935
+ ]
936
+ },
937
+ r.name
938
+ );
939
+ }, Pn = ({
940
+ t: e,
941
+ form: n,
942
+ attribute: r,
943
+ renderer: l,
944
+ ...a
945
+ }) => /* @__PURE__ */ t(K, { t: e, form: n, attribute: r, renderer: l, children: /* @__PURE__ */ t(
946
+ Vn,
947
+ {
948
+ t: e,
949
+ form: n,
950
+ "aria-label": ce(e, r),
951
+ name: N(r.name),
952
+ addButtonLabel: e("addMultivaluedLabel", {
953
+ fieldLabel: ce(e, r)
954
+ }),
955
+ ...a
956
+ }
957
+ ) }), Vn = ({
958
+ t: e,
959
+ name: n,
960
+ inputType: r,
961
+ form: l,
962
+ addButtonLabel: a,
963
+ isDisabled: i = !1,
964
+ defaultValue: s,
965
+ id: c,
966
+ ...o
967
+ }) => {
968
+ const { register: d, setValue: m, control: y } = l, h = Qt({
969
+ name: n,
970
+ control: y,
971
+ defaultValue: s || ""
972
+ }), u = P(() => Array.isArray(h) && h.length !== 0 ? h : s || [""], [h]), x = (C) => {
973
+ w([...u.slice(0, C), ...u.slice(C + 1)]);
974
+ }, g = () => {
975
+ w([...u, ""]);
976
+ }, f = (C, b) => {
977
+ w([...u.slice(0, C), b, ...u.slice(C + 1)]);
978
+ }, w = (C) => {
979
+ const b = C.flatMap((q) => q);
980
+ m(n, b, {
981
+ shouldDirty: !0
982
+ });
983
+ }, E = r.startsWith("html") ? r.substring(6) : "text";
984
+ return be(() => {
985
+ d(n);
986
+ }, [d]), /* @__PURE__ */ t("div", { id: c, children: u.map((C, b) => /* @__PURE__ */ v(Ue, { children: [
987
+ /* @__PURE__ */ v(pe, { children: [
988
+ /* @__PURE__ */ t(se, { isFill: !0, children: /* @__PURE__ */ t(
989
+ Q,
990
+ {
991
+ "data-testid": n + b,
992
+ onChange: (q, p) => f(b, p),
993
+ name: `${n}.${b}.value`,
994
+ value: C,
995
+ isDisabled: i,
996
+ type: E,
997
+ ...o
998
+ }
999
+ ) }),
1000
+ /* @__PURE__ */ t(se, { children: /* @__PURE__ */ t(
1001
+ D,
1002
+ {
1003
+ "data-testid": "remove" + b,
1004
+ variant: we.link,
1005
+ onClick: () => x(b),
1006
+ tabIndex: -1,
1007
+ "aria-label": e("remove"),
1008
+ isDisabled: u.length === 1 || i,
1009
+ children: /* @__PURE__ */ t(jt, {})
1010
+ }
1011
+ ) })
1012
+ ] }),
1013
+ b === u.length - 1 && /* @__PURE__ */ v(
1014
+ D,
1015
+ {
1016
+ variant: we.link,
1017
+ onClick: g,
1018
+ tabIndex: -1,
1019
+ "aria-label": e("add"),
1020
+ "data-testid": "addValue",
1021
+ isDisabled: !C || i,
1022
+ children: [
1023
+ /* @__PURE__ */ t(zt, {}),
1024
+ " ",
1025
+ e(a || "add")
1026
+ ]
1027
+ }
1028
+ )
1029
+ ] }, b)) });
1030
+ }, Re = (e) => {
1031
+ const { form: n, inputType: r, attribute: l } = e, a = ne(l), i = r.startsWith("multiselect"), s = i ? It : kt, c = l.validators?.options?.options || [], o = l.annotations?.inputOptionLabels || {};
1032
+ return /* @__PURE__ */ t(K, { ...e, children: /* @__PURE__ */ t(
1033
+ U,
1034
+ {
1035
+ name: N(l.name),
1036
+ control: n.control,
1037
+ defaultValue: "",
1038
+ render: ({ field: d }) => /* @__PURE__ */ t(Y, { children: c.map((m) => /* @__PURE__ */ t(
1039
+ s,
1040
+ {
1041
+ id: m,
1042
+ "data-testid": m,
1043
+ label: B(e.t, o[m], m),
1044
+ value: m,
1045
+ isChecked: d.value.includes(m),
1046
+ onChange: () => {
1047
+ i ? d.value.includes(m) ? d.onChange(
1048
+ d.value.filter((y) => y !== m)
1049
+ ) : d.onChange([...d.value, m]) : d.onChange([m]);
1050
+ },
1051
+ readOnly: l.readOnly,
1052
+ isRequired: a
1053
+ },
1054
+ m
1055
+ )) })
1056
+ }
1057
+ ) });
1058
+ }, Mn = ({
1059
+ toggleId: e,
1060
+ onToggle: n,
1061
+ onSelect: r,
1062
+ selections: l,
1063
+ isOpen: a,
1064
+ menuAppendTo: i,
1065
+ direction: s,
1066
+ width: c,
1067
+ maxHeight: o,
1068
+ toggleIcon: d,
1069
+ className: m,
1070
+ children: y,
1071
+ ...h
1072
+ }) => {
1073
+ const [u, x] = T(!1), g = ee(), f = () => {
1074
+ x(!u), n(!u);
1075
+ }, w = () => i === "parent" && g.current?.parentElement || "inline", E = $e.toArray(
1076
+ y
1077
+ );
1078
+ return /* @__PURE__ */ t(
1079
+ X,
1080
+ {
1081
+ ref: g,
1082
+ maxMenuHeight: J(o),
1083
+ isScrollable: !0,
1084
+ popperProps: {
1085
+ appendTo: w(),
1086
+ direction: s,
1087
+ width: J(c)
1088
+ },
1089
+ ...h,
1090
+ onClick: f,
1091
+ onOpenChange: () => x(!1),
1092
+ selected: l,
1093
+ onSelect: (C, b) => {
1094
+ r?.(b || ""), f();
1095
+ },
1096
+ toggle: (C) => /* @__PURE__ */ t(
1097
+ W,
1098
+ {
1099
+ id: e,
1100
+ ref: C,
1101
+ className: m,
1102
+ onClick: f,
1103
+ isExpanded: a,
1104
+ "aria-label": h["aria-label"],
1105
+ icon: d,
1106
+ isFullWidth: !0,
1107
+ children: E.find((b) => b.props.value === l)?.props.children || l || h["aria-label"]
1108
+ }
1109
+ ),
1110
+ isOpen: a,
1111
+ children: /* @__PURE__ */ t(Z, { children: y })
1112
+ }
1113
+ );
1114
+ }, Nn = ({
1115
+ toggleId: e,
1116
+ onSelect: n,
1117
+ onToggle: r,
1118
+ onFilter: l,
1119
+ variant: a,
1120
+ validated: i,
1121
+ placeholderText: s,
1122
+ maxHeight: c,
1123
+ width: o,
1124
+ toggleIcon: d,
1125
+ direction: m,
1126
+ selections: y,
1127
+ typeAheadAriaLabel: h,
1128
+ chipGroupComponent: u,
1129
+ chipGroupProps: x,
1130
+ footer: g,
1131
+ children: f,
1132
+ ...w
1133
+ }) => {
1134
+ const [E, C] = T(""), [b, q] = T(0), p = ee(), I = $e.toArray(
1135
+ f
1136
+ ), A = () => {
1137
+ r?.(!w.isOpen);
1138
+ }, k = (S) => {
1139
+ const F = I[b];
1140
+ switch (r?.(!0), S.key) {
1141
+ case "Enter": {
1142
+ S.preventDefault(), a !== V.typeaheadMulti ? C(F.props.value) : C(""), n?.(F.props.value), r?.(!1), q(0);
1143
+ break;
1144
+ }
1145
+ case "Escape": {
1146
+ r?.(!1);
1147
+ break;
1148
+ }
1149
+ case "Backspace": {
1150
+ a === V.typeahead && n?.("");
1151
+ break;
1152
+ }
1153
+ case "ArrowUp":
1154
+ case "ArrowDown": {
1155
+ S.preventDefault();
1156
+ let O = 0;
1157
+ S.key === "ArrowUp" && (b === 0 ? O = I.length - 1 : O = b - 1), S.key === "ArrowDown" && (b === I.length - 1 ? O = 0 : O = b + 1), q(O);
1158
+ break;
1159
+ }
1160
+ }
1161
+ };
1162
+ return /* @__PURE__ */ v(
1163
+ X,
1164
+ {
1165
+ ...w,
1166
+ onClick: A,
1167
+ onOpenChange: () => r?.(!1),
1168
+ onSelect: (S, F) => n?.(F || ""),
1169
+ maxMenuHeight: J(c),
1170
+ popperProps: { direction: m, width: J(o) },
1171
+ toggle: (S) => /* @__PURE__ */ t(
1172
+ W,
1173
+ {
1174
+ ref: S,
1175
+ id: e,
1176
+ variant: "typeahead",
1177
+ onClick: () => r?.(!0),
1178
+ icon: d,
1179
+ isExpanded: w.isOpen,
1180
+ isFullWidth: !0,
1181
+ status: i === "error" ? fe.danger : void 0,
1182
+ children: /* @__PURE__ */ v(Me, { isPlain: !0, children: [
1183
+ /* @__PURE__ */ t(
1184
+ Ne,
1185
+ {
1186
+ placeholder: s,
1187
+ value: a === V.typeahead && y ? y : E,
1188
+ onClick: A,
1189
+ onChange: (F, O) => {
1190
+ C(O), l?.(O);
1191
+ },
1192
+ onKeyDown: (F) => k(F),
1193
+ autoComplete: "off",
1194
+ innerRef: p,
1195
+ role: "combobox",
1196
+ isExpanded: w.isOpen,
1197
+ "aria-controls": "select-typeahead-listbox",
1198
+ "aria-label": h,
1199
+ children: a === V.typeaheadMulti && Array.isArray(y) && (u || /* @__PURE__ */ t(qe, { ...x, children: y.map((F, O) => /* @__PURE__ */ t(
1200
+ Le,
1201
+ {
1202
+ onClick: (et) => {
1203
+ et.stopPropagation(), n?.(F);
1204
+ },
1205
+ children: F
1206
+ },
1207
+ O
1208
+ )) }))
1209
+ }
1210
+ ),
1211
+ /* @__PURE__ */ t(Be, { children: !!E && /* @__PURE__ */ t(
1212
+ D,
1213
+ {
1214
+ variant: "plain",
1215
+ onClick: () => {
1216
+ n?.(""), C(""), l?.(""), p?.current?.focus();
1217
+ },
1218
+ "aria-label": "Clear input value",
1219
+ children: /* @__PURE__ */ t(Ge, { "aria-hidden": !0 })
1220
+ }
1221
+ ) })
1222
+ ] })
1223
+ }
1224
+ ),
1225
+ children: [
1226
+ /* @__PURE__ */ t(Z, { children: f }),
1227
+ g && /* @__PURE__ */ t(xt, { children: g })
1228
+ ]
1229
+ }
1230
+ );
1231
+ };
1232
+ var V = /* @__PURE__ */ ((e) => (e.single = "single", e.typeahead = "typeahead", e.typeaheadMulti = "typeaheadMulti", e))(V || {});
1233
+ const J = (e) => typeof e == "number" ? e + "px" : e, qn = ({
1234
+ variant: e = "single",
1235
+ ...n
1236
+ }) => e === "single" ? /* @__PURE__ */ t(Mn, { ...n }) : /* @__PURE__ */ t(Nn, { ...n, variant: e }), De = (e) => {
1237
+ const { t: n, form: r, inputType: l, attribute: a } = e, [i, s] = T(!1), [c, o] = T(""), d = l === "multiselect", m = (g, f) => {
1238
+ d ? f.value.includes(g) ? f.onChange(f.value.filter((w) => w !== g)) : Array.isArray(f.value) ? f.onChange([...f.value, g]) : f.onChange([g]) : f.onChange(g === f.value ? "" : g);
1239
+ }, y = a.validators?.options?.options || [], h = a.annotations?.inputOptionLabels || {}, u = (g) => B(e.t, h[g], g), x = (g) => y.filter(
1240
+ (f) => u(f).toLowerCase().includes(c.toLowerCase())
1241
+ ).map((f) => /* @__PURE__ */ t(
1242
+ ge,
1243
+ {
1244
+ selected: g === f,
1245
+ value: f,
1246
+ children: u(f)
1247
+ },
1248
+ f
1249
+ ));
1250
+ return /* @__PURE__ */ t(K, { ...e, children: /* @__PURE__ */ t(
1251
+ U,
1252
+ {
1253
+ name: N(a.name),
1254
+ defaultValue: "",
1255
+ control: r.control,
1256
+ render: ({ field: g }) => /* @__PURE__ */ t(
1257
+ qn,
1258
+ {
1259
+ toggleId: a.name,
1260
+ onToggle: (f) => s(f),
1261
+ onClear: () => m("", g),
1262
+ onSelect: (f) => {
1263
+ const w = f.toString();
1264
+ m(w, g), Array.isArray(g.value) || s(!1);
1265
+ },
1266
+ selections: d && Array.isArray(g.value) ? g.value : u(g.value),
1267
+ variant: d ? V.typeaheadMulti : y.length >= 10 ? V.typeahead : V.single,
1268
+ "aria-label": n("selectOne"),
1269
+ isOpen: i,
1270
+ isDisabled: a.readOnly,
1271
+ onFilter: (f) => (o(f), x(g.value)),
1272
+ children: x(g.value)
1273
+ }
1274
+ )
1275
+ }
1276
+ ) });
1277
+ }, Ln = (e) => {
1278
+ const { form: n, attribute: r } = e, l = ne(r);
1279
+ return /* @__PURE__ */ t(K, { ...e, children: /* @__PURE__ */ t(
1280
+ vn,
1281
+ {
1282
+ id: r.name,
1283
+ "data-testid": r.name,
1284
+ ...n.register(N(r.name)),
1285
+ cols: r.annotations?.inputTypeCols,
1286
+ rows: r.annotations?.inputTypeRows,
1287
+ readOnly: r.readOnly,
1288
+ isRequired: l
1289
+ }
1290
+ ) });
1291
+ }, R = (e) => {
1292
+ const { form: n, inputType: r, attribute: l } = e, a = ne(l), i = r.startsWith("html") ? r.substring(6) : "text";
1293
+ return /* @__PURE__ */ t(K, { ...e, children: /* @__PURE__ */ t(
1294
+ Q,
1295
+ {
1296
+ id: l.name,
1297
+ "data-testid": l.name,
1298
+ type: i,
1299
+ placeholder: B(
1300
+ e.t,
1301
+ l.annotations?.inputTypePlaceholder
1302
+ ),
1303
+ readOnly: l.readOnly,
1304
+ isRequired: a,
1305
+ ...n.register(N(l.name))
1306
+ }
1307
+ ) });
1308
+ }, de = {
1309
+ text: R,
1310
+ textarea: Ln,
1311
+ select: De,
1312
+ "select-radiobuttons": Re,
1313
+ multiselect: De,
1314
+ "multiselect-checkboxes": Re,
1315
+ "html5-email": R,
1316
+ "html5-tel": R,
1317
+ "html5-url": R,
1318
+ "html5-number": R,
1319
+ "html5-range": R,
1320
+ "html5-datetime-local": R,
1321
+ "html5-date": R,
1322
+ "html5-month": R,
1323
+ "html5-time": R,
1324
+ "multi-input": Pn
1325
+ }, br = ({
1326
+ t: e,
1327
+ form: n,
1328
+ userProfileMetadata: r,
1329
+ supportedLocales: l,
1330
+ currentLocale: a,
1331
+ hideReadOnly: i = !1,
1332
+ renderer: s
1333
+ }) => {
1334
+ const c = P(() => {
1335
+ if (!r.attributes)
1336
+ return [];
1337
+ const o = i ? r.attributes.filter(({ readOnly: d }) => !d) : r.attributes;
1338
+ return [
1339
+ // Insert an empty group for attributes without a group.
1340
+ { name: void 0 },
1341
+ ...r.groups ?? []
1342
+ ].map((d) => ({
1343
+ group: d,
1344
+ attributes: o.filter(
1345
+ (m) => m.group === d.name
1346
+ )
1347
+ }));
1348
+ }, [
1349
+ i,
1350
+ r.groups,
1351
+ r.attributes
1352
+ ]);
1353
+ return c.length === 0 ? null : /* @__PURE__ */ t(
1354
+ Sn,
1355
+ {
1356
+ label: e("jumpToSection"),
1357
+ sections: c.filter((o) => o.attributes.length > 0).map(({ group: o, attributes: d }) => ({
1358
+ title: B(e, o.displayHeader, o.name) || e("general"),
1359
+ panel: /* @__PURE__ */ v("div", { className: "pf-v5-c-form", children: [
1360
+ o.displayDescription && /* @__PURE__ */ t(ae, { className: "pf-v5-u-pb-lg", children: B(e, o.displayDescription, "") }),
1361
+ d.map((m) => /* @__PURE__ */ t(
1362
+ Bn,
1363
+ {
1364
+ t: e,
1365
+ form: n,
1366
+ supportedLocales: l,
1367
+ currentLocale: a,
1368
+ renderer: s,
1369
+ attribute: m
1370
+ },
1371
+ m.name
1372
+ ))
1373
+ ] })
1374
+ }))
1375
+ }
1376
+ );
1377
+ }, Bn = ({
1378
+ t: e,
1379
+ form: n,
1380
+ renderer: r,
1381
+ supportedLocales: l,
1382
+ currentLocale: a,
1383
+ attribute: i
1384
+ }) => {
1385
+ const s = n.watch(
1386
+ N(i.name)
1387
+ ), c = P(() => Hn(i), [i]), o = i.multivalued || $n(s) && i.annotations?.inputType === void 0 ? de["multi-input"] : de[c];
1388
+ return i.name === "locale" ? /* @__PURE__ */ t(
1389
+ Rn,
1390
+ {
1391
+ form: n,
1392
+ supportedLocales: l,
1393
+ currentLocale: a,
1394
+ t: e,
1395
+ attribute: i
1396
+ }
1397
+ ) : /* @__PURE__ */ t(
1398
+ o,
1399
+ {
1400
+ t: e,
1401
+ form: n,
1402
+ inputType: c,
1403
+ attribute: i,
1404
+ renderer: r
1405
+ }
1406
+ );
1407
+ }, _n = "text";
1408
+ function Hn(e) {
1409
+ if (Ze(e.name))
1410
+ return "text";
1411
+ const n = e.annotations?.inputType;
1412
+ return Un(n) ? n : _n;
1413
+ }
1414
+ const Un = (e) => typeof e == "string" && e in de, $n = (e) => Array.isArray(e) && e.length > 1, Gn = ({
1415
+ className: e = "",
1416
+ border: n,
1417
+ size: r = "md"
1418
+ }) => /* @__PURE__ */ v(
1419
+ "svg",
1420
+ {
1421
+ className: tn(
1422
+ j.avatar,
1423
+ j.modifiers[r],
1424
+ n === "light" && j.modifiers.light,
1425
+ n === "dark" && j.modifiers.dark,
1426
+ e
1427
+ ),
1428
+ enableBackground: "new 0 0 36 36",
1429
+ version: "1.1",
1430
+ viewBox: "0 0 36 36",
1431
+ xmlns: "http://www.w3.org/2000/svg",
1432
+ children: [
1433
+ /* @__PURE__ */ t(
1434
+ "circle",
1435
+ {
1436
+ style: { fillRule: "evenodd", clipRule: "evenodd", fill: "#FFFFFF" },
1437
+ cx: "18",
1438
+ cy: "18.5",
1439
+ r: "18"
1440
+ }
1441
+ ),
1442
+ /* @__PURE__ */ t("defs", { children: /* @__PURE__ */ t(
1443
+ "filter",
1444
+ {
1445
+ id: "b",
1446
+ x: "5.2",
1447
+ y: "7.2",
1448
+ width: "25.6",
1449
+ height: "53.6",
1450
+ filterUnits: "userSpaceOnUse",
1451
+ children: /* @__PURE__ */ t("feColorMatrix", { values: "1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0" })
1452
+ }
1453
+ ) }),
1454
+ /* @__PURE__ */ t(
1455
+ "mask",
1456
+ {
1457
+ id: "a",
1458
+ x: "5.2",
1459
+ y: "7.2",
1460
+ width: "25.6",
1461
+ height: "53.6",
1462
+ maskUnits: "userSpaceOnUse",
1463
+ children: /* @__PURE__ */ t("g", { style: { filter: 'url("#b")' }, children: /* @__PURE__ */ t(
1464
+ "circle",
1465
+ {
1466
+ style: { fillRule: "evenodd", clipRule: "evenodd", fill: "#FFFFFF" },
1467
+ cx: "18",
1468
+ cy: "18.5",
1469
+ r: "18"
1470
+ }
1471
+ ) })
1472
+ }
1473
+ ),
1474
+ /* @__PURE__ */ t("g", { style: { filter: 'url("#a")' }, children: /* @__PURE__ */ v("g", { transform: "translate(5.04 6.88)", children: [
1475
+ /* @__PURE__ */ t(
1476
+ "path",
1477
+ {
1478
+ style: {
1479
+ fillRule: "evenodd",
1480
+ clipRule: "evenodd",
1481
+ fill: "#BBBBBB"
1482
+ },
1483
+ d: "m22.6 18.1c-1.1-1.4-2.3-2.2-3.5-2.6s-1.8-0.6-6.3-0.6-6.1 0.7-6.1 0.7 0 0 0 0c-1.2 0.4-2.4 1.2-3.4 2.6-2.3 2.8-3.2 12.3-3.2 14.8 0 3.2 0.4 12.3 0.6 15.4 0 0-0.4 5.5 4 5.5l-0.3-6.3-0.4-3.5 0.2-0.9c0.9 0.4 3.6 1.2 8.6 1.2 5.3 0 8-0.9 8.8-1.3l0.2 1-0.2 3.6-0.3 6.3c3 0.1 3.7-3 3.8-4.4s0.6-12.6 0.6-16.5c0.1-2.6-0.8-12.1-3.1-15z"
1484
+ }
1485
+ ),
1486
+ /* @__PURE__ */ t(
1487
+ "path",
1488
+ {
1489
+ style: {
1490
+ opacity: 0.1,
1491
+ fillRule: "evenodd",
1492
+ clipRule: "evenodd"
1493
+ },
1494
+ d: "m22.5 26c-0.1-2.1-1.5-2.8-4.8-2.8l2.2 9.6s1.8-1.7 3-1.8c0 0-0.4-4.6-0.4-5z"
1495
+ }
1496
+ ),
1497
+ /* @__PURE__ */ t(
1498
+ "path",
1499
+ {
1500
+ style: {
1501
+ fillRule: "evenodd",
1502
+ clipRule: "evenodd",
1503
+ fill: "#BBBBBB"
1504
+ },
1505
+ d: "m12.7 13.2c-3.5 0-6.4-2.9-6.4-6.4s2.9-6.4 6.4-6.4 6.4 2.9 6.4 6.4-2.8 6.4-6.4 6.4z"
1506
+ }
1507
+ ),
1508
+ /* @__PURE__ */ t(
1509
+ "path",
1510
+ {
1511
+ style: {
1512
+ opacity: 0.08,
1513
+ fillRule: "evenodd",
1514
+ clipRule: "evenodd",
1515
+ fill: "#231F20"
1516
+ },
1517
+ d: "m9.4 6.8c0-3 2.1-5.5 4.9-6.3-0.5-0.1-1-0.2-1.6-0.2-3.5 0-6.4 2.9-6.4 6.4s2.9 6.4 6.4 6.4c0.6 0 1.1-0.1 1.6-0.2-2.8-0.6-4.9-3.1-4.9-6.1z"
1518
+ }
1519
+ ),
1520
+ /* @__PURE__ */ t(
1521
+ "path",
1522
+ {
1523
+ style: {
1524
+ opacity: 0.1,
1525
+ fillRule: "evenodd",
1526
+ clipRule: "evenodd"
1527
+ },
1528
+ d: "m8.3 22.4c-2 0.4-2.9 1.4-3.1 3.5l-0.6 18.6s1.7 0.7 3.6 0.9l0.1-23z"
1529
+ }
1530
+ )
1531
+ ] }) })
1532
+ ]
1533
+ }
1534
+ ), Ee = ({
1535
+ isKebab: e = !1,
1536
+ title: n,
1537
+ dropDownItems: r,
1538
+ ...l
1539
+ }) => {
1540
+ const [a, i] = T(!1);
1541
+ return /* @__PURE__ */ t(
1542
+ wt,
1543
+ {
1544
+ ...l,
1545
+ popperProps: {
1546
+ position: "right"
1547
+ },
1548
+ toggle: (s) => /* @__PURE__ */ t(
1549
+ W,
1550
+ {
1551
+ "data-testid": `${l["data-testid"]}-toggle`,
1552
+ ref: s,
1553
+ onClick: () => i(!a),
1554
+ isExpanded: a,
1555
+ variant: e ? "plain" : "default",
1556
+ children: e ? /* @__PURE__ */ t(Jt, {}) : n
1557
+ }
1558
+ ),
1559
+ isOpen: a,
1560
+ children: /* @__PURE__ */ t(At, { children: r })
1561
+ }
1562
+ );
1563
+ };
1564
+ function Wn(e, n) {
1565
+ if (!e)
1566
+ return n("unknownUser");
1567
+ const r = e.given_name, l = e.family_name, a = e.preferred_username;
1568
+ return r && l ? n("fullName", { givenName: r, familyName: l }) : r || l || a || n("unknownUser");
1569
+ }
1570
+ const Cr = ({
1571
+ keycloak: e,
1572
+ brand: { href: n, ...r },
1573
+ avatar: l,
1574
+ features: {
1575
+ hasLogout: a = !0,
1576
+ hasManageAccount: i = !0,
1577
+ hasUsername: s = !0
1578
+ } = {},
1579
+ kebabDropdownItems: c,
1580
+ dropdownItems: o = [],
1581
+ toolbarItems: d,
1582
+ ...m
1583
+ }) => {
1584
+ const { t: y } = Ce(), h = [];
1585
+ i && h.push(
1586
+ /* @__PURE__ */ t(
1587
+ Ae,
1588
+ {
1589
+ onClick: () => e.accountManagement(),
1590
+ children: y("manageAccount")
1591
+ },
1592
+ "manageAccount"
1593
+ )
1594
+ ), a && h.push(
1595
+ /* @__PURE__ */ t(Ae, { onClick: () => e.logout(), children: y("signOut") }, "signOut")
1596
+ );
1597
+ const u = e.idTokenParsed?.picture;
1598
+ return /* @__PURE__ */ t(
1599
+ Xt,
1600
+ {
1601
+ ...m,
1602
+ logo: /* @__PURE__ */ t(Tt, { ...r }),
1603
+ logoProps: { href: n },
1604
+ headerTools: /* @__PURE__ */ v(Zt, { children: [
1605
+ /* @__PURE__ */ v(en, { children: [
1606
+ /* @__PURE__ */ t(
1607
+ le,
1608
+ {
1609
+ visibility: {
1610
+ md: "hidden"
1611
+ },
1612
+ children: /* @__PURE__ */ t(
1613
+ Ee,
1614
+ {
1615
+ "data-testid": "options-kebab",
1616
+ isKebab: !0,
1617
+ dropDownItems: [
1618
+ ...c || o,
1619
+ h
1620
+ ]
1621
+ }
1622
+ )
1623
+ }
1624
+ ),
1625
+ /* @__PURE__ */ t(le, { children: d }),
1626
+ /* @__PURE__ */ t(
1627
+ le,
1628
+ {
1629
+ visibility: {
1630
+ default: "hidden",
1631
+ md: "visible"
1632
+ },
1633
+ children: /* @__PURE__ */ t(
1634
+ Ee,
1635
+ {
1636
+ "data-testid": "options",
1637
+ dropDownItems: [...o, h],
1638
+ title: s ? Wn(e.idTokenParsed, y) : void 0
1639
+ }
1640
+ )
1641
+ }
1642
+ )
1643
+ ] }),
1644
+ u || l?.src ? /* @__PURE__ */ t(St, { src: u, alt: y("avatar"), ...l }) : /* @__PURE__ */ t(Gn, { ...l })
1645
+ ] })
1646
+ }
1647
+ );
1648
+ };
1649
+ export {
1650
+ nn as AlertProvider,
1651
+ sr as ContinueCancelModal,
1652
+ rn as ErrorPage,
1653
+ je as FormErrorText,
1654
+ kn as FormPanel,
1655
+ pr as FormSubmitButton,
1656
+ hn as Help,
1657
+ ze as HelpItem,
1658
+ mr as IconMapper,
1659
+ Cr as KeycloakMasthead,
1660
+ ar as KeycloakProvider,
1661
+ qn as KeycloakSelect,
1662
+ vn as KeycloakTextArea,
1663
+ or as NumberControl,
1664
+ cr as PasswordControl,
1665
+ Je as PasswordInput,
1666
+ Sn as ScrollForm,
1667
+ yn as SelectControl,
1668
+ H as SelectVariant,
1669
+ dr as SwitchControl,
1670
+ ur as TextAreaControl,
1671
+ hr as TextControl,
1672
+ br as UserProfileFields,
1673
+ fr as beerify,
1674
+ an as createNamedContext,
1675
+ gr as debeerify,
1676
+ ir as getInjectedEnvironment,
1677
+ sn as isDefined,
1678
+ vr as isUserProfileError,
1679
+ B as label,
1680
+ Tn as mainPageContentId,
1681
+ yr as setUserProfileServerError,
1682
+ rr as useAlerts,
1683
+ lr as useEnvironment,
1684
+ un as useHelp,
1685
+ on as useRequiredContext,
1686
+ dn as useStoredState
1687
+ };