fictoan-react 2.0.0-alpha.3 → 2.0.0-beta.1

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 (59) hide show
  1. package/dist/Accordion-Z0yapsUC.js +4199 -0
  2. package/dist/Accordion-Z0yapsUC.js.map +1 -0
  3. package/dist/components/Form/Checkbox/Checkbox.d.ts +3 -3
  4. package/dist/components/Form/Checkbox/Checkbox.d.ts.map +1 -1
  5. package/dist/components/Form/Checkbox/Switch.d.ts.map +1 -1
  6. package/dist/components/Form/FileUpload/FileUpload.d.ts.map +1 -1
  7. package/dist/components/Form/InputField/InputField.d.ts +3 -3
  8. package/dist/components/Form/InputField/InputField.d.ts.map +1 -1
  9. package/dist/components/Form/ListBox/ListBox.d.ts.map +1 -1
  10. package/dist/components/Form/RadioButton/RadioButton.d.ts.map +1 -1
  11. package/dist/components/Form/RadioButton/RadioTabGroup.d.ts +3 -1
  12. package/dist/components/Form/RadioButton/RadioTabGroup.d.ts.map +1 -1
  13. package/dist/components/Form/RadioButton/constants.d.ts +4 -2
  14. package/dist/components/Form/RadioButton/constants.d.ts.map +1 -1
  15. package/dist/components/Form/Range/Range.d.ts +3 -3
  16. package/dist/components/Form/Range/Range.d.ts.map +1 -1
  17. package/dist/components/Form/Select/Select.d.ts.map +1 -1
  18. package/dist/components/Form/TextArea/TextArea.d.ts.map +1 -1
  19. package/dist/components/Meter/Meter.d.ts +5 -4
  20. package/dist/components/Meter/Meter.d.ts.map +1 -1
  21. package/dist/components/Modal/Modal.d.ts.map +1 -1
  22. package/dist/components/Notification/NotificationItem/NotificationItem.d.ts +11 -10
  23. package/dist/components/Notification/NotificationItem/NotificationItem.d.ts.map +1 -1
  24. package/dist/components/Notification/NotificationsProvider/NotificationsProvider.d.ts +33 -0
  25. package/dist/components/Notification/NotificationsProvider/NotificationsProvider.d.ts.map +1 -0
  26. package/dist/components/Notification/NotificationsWrapper/NotificationsWrapper.d.ts +1 -0
  27. package/dist/components/Notification/NotificationsWrapper/NotificationsWrapper.d.ts.map +1 -1
  28. package/dist/components/Notification/index.d.ts +2 -2
  29. package/dist/components/Notification/index.d.ts.map +1 -1
  30. package/dist/components/OptionCard/index.d.ts +1 -2
  31. package/dist/components/OptionCard/index.d.ts.map +1 -1
  32. package/dist/components/Sidebar/SidebarItemsGroup/SidebarItemsGroup.d.ts +10 -0
  33. package/dist/components/Sidebar/SidebarItemsGroup/SidebarItemsGroup.d.ts.map +1 -0
  34. package/dist/components/Sidebar/index.d.ts +1 -0
  35. package/dist/components/Sidebar/index.d.ts.map +1 -1
  36. package/dist/components/Tabs/Tabs.d.ts.map +1 -1
  37. package/dist/components/Toast/ToastItem/ToastItem.d.ts +9 -7
  38. package/dist/components/Toast/ToastItem/ToastItem.d.ts.map +1 -1
  39. package/dist/components/Toast/ToastsProvider/ToastsProvider.d.ts +13 -0
  40. package/dist/components/Toast/ToastsProvider/ToastsProvider.d.ts.map +1 -0
  41. package/dist/components/Toast/ToastsWrapper/ToastsWrapper.d.ts +1 -1
  42. package/dist/components/Toast/ToastsWrapper/ToastsWrapper.d.ts.map +1 -1
  43. package/dist/components/Toast/index.d.ts +1 -2
  44. package/dist/components/Toast/index.d.ts.map +1 -1
  45. package/dist/components/Tooltip/Tooltip.d.ts +2 -1
  46. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  47. package/dist/components/index.d.ts +6 -7
  48. package/dist/components/index.d.ts.map +1 -1
  49. package/dist/components/index.js +52 -52
  50. package/dist/index.css +1 -1
  51. package/dist/index.d.ts +6 -7
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +104 -80
  54. package/dist/index.js.map +1 -1
  55. package/dist/utils/propSeparation.d.ts +23 -1
  56. package/dist/utils/propSeparation.d.ts.map +1 -1
  57. package/package.json +1 -1
  58. package/dist/Accordion-ZNSXFjKa.js +0 -4647
  59. package/dist/Accordion-ZNSXFjKa.js.map +0 -1
@@ -0,0 +1,4199 @@
1
+ "use client";
2
+ "use client;";
3
+ import { jsx as o, jsxs as P, Fragment as Ne } from "react/jsx-runtime";
4
+ import w, { useCallback as _, useEffect as q, useRef as J, useState as X, useMemo as he, createElement as xt, createRef as Rt, useImperativeHandle as Je, createContext as Le, useContext as ye } from "react";
5
+ import { createRoot as Mt } from "react-dom/client";
6
+ const Et = (e) => e.filter((t) => !!t).join(" "), I = w.forwardRef(
7
+ ({
8
+ as: e = "div",
9
+ role: t,
10
+ ariaLabel: a,
11
+ tabIndex: r,
12
+ onKeyDown: l,
13
+ ...n
14
+ }, s) => {
15
+ const {
16
+ classNames: i = [],
17
+ bgColor: c,
18
+ bgColour: d,
19
+ bgOpacity: u,
20
+ borderColor: f,
21
+ borderColour: p,
22
+ borderOpacity: g,
23
+ className: b,
24
+ columns: x,
25
+ fillColor: y,
26
+ fillColour: E,
27
+ gap: v,
28
+ hideOnDesktop: T,
29
+ hideOnMobile: H,
30
+ hideOnTabletLandscape: k,
31
+ hideOnTabletPortrait: N,
32
+ horizontalMargin: $,
33
+ horizontalPadding: L,
34
+ horizontallyCenterThis: M,
35
+ horizontallyCentreThis: z,
36
+ isFullHeight: A,
37
+ isFullWidth: S,
38
+ layoutAsFlexbox: D,
39
+ layoutAsGrid: G,
40
+ stackVertically: V,
41
+ stackHorizontally: O,
42
+ marginLeft: h,
43
+ marginBottom: m,
44
+ margin: R,
45
+ marginRight: F,
46
+ marginTop: W,
47
+ opacity: C,
48
+ paddingBottom: te,
49
+ paddingLeft: se,
50
+ padding: Q,
51
+ paddingRight: B,
52
+ paddingTop: j,
53
+ pushItemsToEnds: ee,
54
+ shadow: le,
55
+ shape: xe,
56
+ showOnlyOnDesktop: Re,
57
+ showOnlyOnMobile: Me,
58
+ showOnlyOnTabletLandscape: Ee,
59
+ showOnlyOnTabletPortrait: Be,
60
+ size: Pe,
61
+ strokeColor: U,
62
+ strokeColour: pe,
63
+ textColor: ve,
64
+ textColour: ce,
65
+ verticalMargin: be,
66
+ verticalPadding: Fe,
67
+ verticallyCenterItems: gt,
68
+ verticallyCentreItems: Nt,
69
+ weight: Ge,
70
+ style: kt,
71
+ ...$t
72
+ } = n, { className: Aa, classNames: La, ...Sa } = n, Ke = {
73
+ ...kt,
74
+ ...u && { "--bg-opacity": Number(u) / 100 },
75
+ ...g && { "--border-opacity": Number(g) / 100 }
76
+ };
77
+ return /* @__PURE__ */ o(
78
+ e,
79
+ {
80
+ ref: s,
81
+ role: t,
82
+ "aria-label": a,
83
+ tabIndex: r,
84
+ onKeyDown: l,
85
+ ...$t,
86
+ style: Object.keys(Ke).length > 0 ? Ke : void 0,
87
+ className: Et(
88
+ [
89
+ b,
90
+ c && `bg-${c}`,
91
+ d && `bg-${d}`,
92
+ f && `border-${f}`,
93
+ p && `border-${p}`,
94
+ y && `fill-${y}`,
95
+ E && `fill-${E}`,
96
+ T && "hide-on-desktop",
97
+ H && "hide-on-mobile",
98
+ k && "hide-on-tablet-landscape",
99
+ N && "hide-on-tablet-portrait",
100
+ $ && `margin-right-${$} margin-left-${$}`,
101
+ L && `padding-right-${L} padding-left-${L}`,
102
+ M && "horizontally-centre-this",
103
+ z && "horizontally-centre-this",
104
+ A && "full-height",
105
+ S && "full-width",
106
+ D && "layout-flexbox",
107
+ G && "layout-grid",
108
+ V && "stack-vertically",
109
+ O && "stack-horizontally",
110
+ v && `gap-${v}`,
111
+ h && `margin-left-${h}`,
112
+ m && `margin-bottom-${m}`,
113
+ R && `margin-all-${R}`,
114
+ F && `margin-right-${F}`,
115
+ W && `margin-top-${W}`,
116
+ C && `opacity-${C}`,
117
+ te && `padding-bottom-${te}`,
118
+ se && `padding-left-${se}`,
119
+ Q && `padding-all-${Q}`,
120
+ B && `padding-right-${B}`,
121
+ j && `padding-top-${j}`,
122
+ ee && "push-to-ends",
123
+ le && `shadow-${le}`,
124
+ xe && `shape-${xe}`,
125
+ Re && "show-only-on-desktop",
126
+ Me && "show-only-on-mobile",
127
+ Ee && "show-only-on-tablet-landscape",
128
+ Be && "show-only-on-tablet-portrait",
129
+ Pe && `size-${Pe}`,
130
+ U && `stroke-${U}`,
131
+ pe && `stroke-${pe}`,
132
+ ve && `text-${ve}`,
133
+ ce && `text-${ce}`,
134
+ be && `margin-top-${be} margin-bottom-${be}`,
135
+ Fe && `padding-top-${Fe} padding-bottom-${Fe}`,
136
+ gt && "vertically-centre-items",
137
+ Nt && "vertically-centre-items",
138
+ Ge && `weight-${Ge}`
139
+ ].concat(i)
140
+ )
141
+ }
142
+ );
143
+ }
144
+ );
145
+ I.displayName = "Element";
146
+ const oe = (e, t) => w.forwardRef(
147
+ (a, r) => {
148
+ const l = { ...t, ...a };
149
+ if (e === "a" && "external" in l) {
150
+ const { external: n } = l;
151
+ n && (l.target = "_blank", l.rel = "noopener noreferrer");
152
+ }
153
+ return /* @__PURE__ */ o(I, { as: e, ref: r, ...l });
154
+ }
155
+ ), Va = oe("article"), Wa = oe("aside"), za = oe("body"), K = oe("div"), Ha = oe("footer"), _a = oe("header"), Ga = oe("main"), Pt = oe("nav"), Ka = oe("section"), ja = oe("span"), Xa = oe("a", {
156
+ rel: "noopener noreferrer"
157
+ // Default props for Hyperlink
158
+ }), Tt = {
159
+ cross: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M18 6L6 18M6 6l12 12" }) }),
160
+ tick: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M5 12l5 5L20 7" }) }),
161
+ plus: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M12 5v14M5 12h14" }) }),
162
+ minus: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M5 12h14" }) })
163
+ }, Se = w.forwardRef(
164
+ ({
165
+ children: e,
166
+ size: t = "medium",
167
+ shape: a,
168
+ actionIcon: r,
169
+ onActionClick: l,
170
+ actionAriaLabel: n,
171
+ ...s
172
+ }, i) => {
173
+ let c = [];
174
+ t && c.push(`size-${t}`), a && c.push(`shape-${a}`);
175
+ const d = (f) => {
176
+ f.stopPropagation(), l == null || l(f);
177
+ }, u = !!r;
178
+ return /* @__PURE__ */ P(
179
+ I,
180
+ {
181
+ "data-badge": !0,
182
+ "data-has-action": u || void 0,
183
+ ref: i,
184
+ classNames: c,
185
+ role: "status",
186
+ "aria-label": typeof e == "string" ? e : void 0,
187
+ ...s,
188
+ children: [
189
+ e,
190
+ u && /* @__PURE__ */ o(
191
+ "button",
192
+ {
193
+ type: "button",
194
+ className: "badge-action-button",
195
+ onClick: d,
196
+ "aria-label": n,
197
+ children: Tt[r]
198
+ }
199
+ )
200
+ ]
201
+ }
202
+ );
203
+ }
204
+ );
205
+ Se.displayName = "Badge";
206
+ const We = (e, t) => {
207
+ const a = _(t, [t]);
208
+ q(() => {
209
+ const r = (l) => {
210
+ !e.current || typeof a != "function" || e.current.contains(l.target) || a(l);
211
+ };
212
+ return document.addEventListener("mousedown", r), document.addEventListener("touchstart", r), () => {
213
+ document.removeEventListener("mousedown", r), document.removeEventListener("touchstart", r);
214
+ };
215
+ }, [e, a]);
216
+ }, Dt = w.forwardRef(
217
+ ({
218
+ id: e,
219
+ children: t,
220
+ isOpen: a = !1,
221
+ onClose: r,
222
+ position: l = "right",
223
+ size: n = "medium",
224
+ padding: s = "micro",
225
+ bgColor: i,
226
+ bgColour: c,
227
+ isDismissible: d = !0,
228
+ showOverlay: u = !0,
229
+ blurOverlay: f = !1,
230
+ closeOnClickOutside: p = !0,
231
+ zIndex: g,
232
+ label: b,
233
+ description: x,
234
+ classNames: y = [],
235
+ ...E
236
+ }, v) => {
237
+ const T = `${e}`, H = x ? `${T}-description` : void 0, k = J(null), N = v || k, $ = [
238
+ "drawer",
239
+ l,
240
+ n,
241
+ ...a ? ["open"] : [],
242
+ ...u ? ["with-overlay"] : [],
243
+ ...f ? ["blur-overlay"] : [],
244
+ ...y
245
+ ];
246
+ return q(() => {
247
+ const M = N.current, z = document.querySelector(`[data-drawer-overlay-for="${T}"]`);
248
+ return a ? (M == null || M.classList.add("open"), M == null || M.classList.remove("closing"), M == null || M.focus(), z && z.classList.add("visible"), document.body.style.overflow = "hidden") : M != null && M.classList.contains("open") && (M.classList.add("closing"), M.classList.remove("open"), z && z.classList.remove("visible"), document.body.style.overflow = ""), () => {
249
+ document.body.style.overflow = "";
250
+ };
251
+ }, [a, T, N]), q(() => {
252
+ const M = (z) => {
253
+ z.key === "Escape" && d && a && r && r();
254
+ };
255
+ return document.addEventListener("keydown", M), () => document.removeEventListener("keydown", M);
256
+ }, [d, a, r]), We(N, () => {
257
+ p && d && a && r && r();
258
+ }), /* @__PURE__ */ P(Ne, { children: [
259
+ u && /* @__PURE__ */ o(
260
+ K,
261
+ {
262
+ className: `drawer-overlay ${f ? "blur" : ""} ${a ? "visible" : ""}`,
263
+ "data-drawer-overlay-for": e,
264
+ "aria-hidden": "true",
265
+ onClick: p && d && r ? r : void 0,
266
+ style: { zIndex: g ?? 9999 }
267
+ }
268
+ ),
269
+ /* @__PURE__ */ P(
270
+ I,
271
+ {
272
+ as: "div",
273
+ id: T,
274
+ "data-drawer": !0,
275
+ ref: N,
276
+ classNames: $,
277
+ onAnimationEnd: (M) => {
278
+ (M.animationName.includes("slide-out") || M.animationName.includes("fade-out")) && M.currentTarget.classList.remove("closing");
279
+ },
280
+ role: "dialog",
281
+ "aria-modal": "true",
282
+ "aria-label": b || "Drawer",
283
+ "aria-describedby": H,
284
+ tabIndex: -1,
285
+ style: { zIndex: g ?? 1e4 },
286
+ ...E,
287
+ children: [
288
+ d && r && /* @__PURE__ */ o(
289
+ "button",
290
+ {
291
+ className: "drawer-dismiss-button",
292
+ onClick: r,
293
+ "aria-label": "Close drawer",
294
+ tabIndex: 0,
295
+ children: "×"
296
+ }
297
+ ),
298
+ /* @__PURE__ */ P(
299
+ K,
300
+ {
301
+ className: "drawer-content",
302
+ padding: s,
303
+ bgColor: i,
304
+ bgColour: c,
305
+ children: [
306
+ x && /* @__PURE__ */ o("div", { id: H, className: "sr-only", children: x }),
307
+ /* @__PURE__ */ o("div", { role: "document", children: t })
308
+ ]
309
+ }
310
+ )
311
+ ]
312
+ }
313
+ )
314
+ ] });
315
+ }
316
+ );
317
+ Dt.displayName = "Drawer";
318
+ const ze = w.forwardRef(
319
+ ({ size: e = "medium", shape: t, kind: a, isLoading: r, label: l, ...n }, s) => {
320
+ let i = [];
321
+ return a && i.push(a), e && i.push(`size-${e}`), t && i.push(`shape-${t}`), r && i.push("is-loading"), /* @__PURE__ */ o(
322
+ I,
323
+ {
324
+ as: "button",
325
+ "data-button": !0,
326
+ ref: s,
327
+ classNames: i,
328
+ "aria-label": l,
329
+ "aria-disabled": n.disabled || r,
330
+ "aria-busy": r,
331
+ ...n
332
+ }
333
+ );
334
+ }
335
+ );
336
+ ze.displayName = "Button";
337
+ const It = w.forwardRef(
338
+ ({ isJoint: e = !0, spacing: t, equaliseWidth: a, children: r, ...l }, n) => {
339
+ let s = [];
340
+ return e && s.push("is-joint"), t && !e && s.push(`spacing-${t}`), a && s.push("equal-width"), /* @__PURE__ */ o(
341
+ I,
342
+ {
343
+ as: "div",
344
+ "data-button-group": !0,
345
+ ref: n,
346
+ role: "group",
347
+ classNames: s,
348
+ ...l,
349
+ children: r
350
+ }
351
+ );
352
+ }
353
+ );
354
+ It.displayName = "ButtonGroup";
355
+ const je = w.forwardRef(
356
+ ({ children: e, current: t, ...a }, r) => /* @__PURE__ */ o(
357
+ I,
358
+ {
359
+ as: "li",
360
+ "data-breadcrumb-item": !0,
361
+ ref: r,
362
+ ...a,
363
+ "aria-current": t ? "page" : void 0,
364
+ className: t ? "current" : void 0,
365
+ role: "listitem",
366
+ children: /* @__PURE__ */ o("span", { className: "breadcrumb-content", children: e })
367
+ }
368
+ )
369
+ ), At = ({ separator: e }) => /* @__PURE__ */ o(
370
+ Y,
371
+ {
372
+ className: "breadcrumb-separator",
373
+ "aria-hidden": "true",
374
+ role: "presentation",
375
+ margin: "none",
376
+ children: e
377
+ }
378
+ ), Lt = w.forwardRef(
379
+ ({ children: e, separator: t = "/", spacing: a = "micro", ...r }, l) => {
380
+ let n = [];
381
+ a && n.push(`spacing-${a}`);
382
+ const s = w.Children.toArray(e).filter(Boolean), i = s.reduce((c, d, u) => {
383
+ if (!w.isValidElement(d)) return c;
384
+ const f = u === s.length - 1;
385
+ let p;
386
+ return d.type === je ? p = w.cloneElement(d, {
387
+ ...d.props,
388
+ current: f
389
+ }) : p = /* @__PURE__ */ o(je, { current: f, children: d }, `item-${u}`), c.push(p), f || c.push(
390
+ /* @__PURE__ */ o(At, { separator: t }, `sep-${u}`)
391
+ ), c;
392
+ }, []);
393
+ return /* @__PURE__ */ o("nav", { "aria-label": "Breadcrumb", ref: l, ...r, children: /* @__PURE__ */ o(
394
+ I,
395
+ {
396
+ as: "ul",
397
+ "data-breadcrumbs-wrapper": !0,
398
+ role: "list",
399
+ classNames: n,
400
+ children: i
401
+ }
402
+ ) });
403
+ }
404
+ );
405
+ Lt.displayName = "Breadcrumbs";
406
+ const Ze = w.forwardRef(
407
+ ({ kind: e, children: t, title: a, ...r }, l) => /* @__PURE__ */ o(
408
+ I,
409
+ {
410
+ as: "div",
411
+ "data-callout": !0,
412
+ ref: l,
413
+ className: e,
414
+ role: {
415
+ info: "status",
416
+ success: "status",
417
+ warning: "alert",
418
+ error: "alert"
419
+ }[e],
420
+ "aria-live": e === "error" || e === "warning" ? "assertive" : "polite",
421
+ "aria-label": a,
422
+ ...r,
423
+ children: t
424
+ }
425
+ )
426
+ );
427
+ Ze.displayName = "Callout";
428
+ const Qe = w.forwardRef(({ shape: e, heading: t, children: a, ...r }, l) => {
429
+ let n = [];
430
+ return e && n.push(`shape-${e}`), /* @__PURE__ */ o(
431
+ I,
432
+ {
433
+ as: "div",
434
+ "data-card": !0,
435
+ ref: l,
436
+ classNames: n,
437
+ role: "region",
438
+ "aria-label": t,
439
+ tabIndex: 0,
440
+ ...r,
441
+ children: a
442
+ }
443
+ );
444
+ });
445
+ Qe.displayName = "Card";
446
+ const St = w.forwardRef(({
447
+ children: e,
448
+ source: t,
449
+ language: a = "json",
450
+ showCopyButton: r,
451
+ showLineNumbers: l,
452
+ description: n,
453
+ withSyntaxHighlighting: s = !1,
454
+ makeEditable: i = !1,
455
+ onChange: c,
456
+ shadow: d,
457
+ ...u
458
+ }, f) => {
459
+ const [p, g] = X(!1), [b, x] = X(null), [y, E] = X(s), [v, T] = X(null), H = J(null);
460
+ let k = typeof e == "string" ? e : w.Children.toArray(e).join("");
461
+ e || (k = typeof t == "object" ? JSON.stringify(t, null, 2) : t ?? ""), q(() => {
462
+ if (!s) return;
463
+ (async () => {
464
+ var G;
465
+ E(!0);
466
+ try {
467
+ const O = (await import("prismjs")).default;
468
+ if (typeof window < "u" && !window.Prism && (window.Prism = O), a !== "plain" && !O.languages[a])
469
+ try {
470
+ await import(`prismjs/components/prism-${a}`);
471
+ } catch {
472
+ console.warn(`Language "${a}" not available, falling back to plain text`);
473
+ }
474
+ x(O);
475
+ } catch (V) {
476
+ (V == null ? void 0 : V.code) === "ERR_MODULE_NOT_FOUND" || (G = V == null ? void 0 : V.message) != null && G.includes("Cannot find module") ? console.warn(
477
+ "PrismJS is not installed. To enable syntax highlighting, run: npm install prismjs"
478
+ ) : console.warn(`Failed to load syntax highlighting for ${a}:`, V);
479
+ } finally {
480
+ E(!1);
481
+ }
482
+ })();
483
+ }, [s, a]);
484
+ const N = _(() => {
485
+ var m;
486
+ const D = window.getSelection();
487
+ if (!D || D.rangeCount === 0) return null;
488
+ const G = D.getRangeAt(0), V = G.startContainer;
489
+ let h = G.startOffset;
490
+ if (V && V !== v && v) {
491
+ const R = document.createTreeWalker(
492
+ v,
493
+ NodeFilter.SHOW_TEXT,
494
+ null
495
+ );
496
+ let F;
497
+ for (; (F = R.nextNode()) && F !== V; )
498
+ h += ((m = F.textContent) == null ? void 0 : m.length) || 0;
499
+ }
500
+ return h;
501
+ }, [v]), $ = _((D) => {
502
+ var G;
503
+ if (!(!v || !s || !b))
504
+ try {
505
+ const V = i ? N() : null, O = b.highlight(
506
+ D,
507
+ b.languages[a] || b.languages.plain,
508
+ a
509
+ );
510
+ if (v.innerHTML = O, i && V !== null) {
511
+ const h = window.getSelection(), m = document.createRange(), R = document.createTreeWalker(
512
+ v,
513
+ NodeFilter.SHOW_TEXT,
514
+ null
515
+ );
516
+ let F = 0, W;
517
+ for (; W = R.nextNode(); ) {
518
+ const C = ((G = W.textContent) == null ? void 0 : G.length) || 0;
519
+ if (F + C >= V) {
520
+ m.setStart(W, V - F), m.setEnd(W, V - F), h == null || h.removeAllRanges(), h == null || h.addRange(m);
521
+ break;
522
+ }
523
+ F += C;
524
+ }
525
+ }
526
+ } catch (V) {
527
+ console.warn("Error highlighting code:", V), v && (v.textContent = D);
528
+ }
529
+ }, [a, s, i, b, N, v]), L = _((D) => {
530
+ if (!v) return;
531
+ const G = v.textContent || "";
532
+ c == null || c(G), requestAnimationFrame(() => {
533
+ $(G);
534
+ });
535
+ }, [$, c, v]);
536
+ q(() => {
537
+ const D = v;
538
+ if (!(!D || !i))
539
+ return D.addEventListener("input", L), () => {
540
+ D.removeEventListener("input", L);
541
+ };
542
+ }, [i, L, v]), q(() => {
543
+ !v || !b || $(k);
544
+ }, [$, k, b, v]);
545
+ const M = async () => {
546
+ try {
547
+ const D = v ? v.textContent || "" : k;
548
+ await navigator.clipboard.writeText(D), g(!0), setTimeout(() => g(!1), 3e3);
549
+ } catch (D) {
550
+ console.error("Could not copy text: ", D);
551
+ }
552
+ }, z = async (D) => {
553
+ (D.key === "Enter" || D.key === " ") && D.target === H.current && (D.preventDefault(), await M());
554
+ };
555
+ let A = [];
556
+ l && A.push("show-line-numbers");
557
+ const S = k.split(/\r\n|\r|\n/gm);
558
+ return /* @__PURE__ */ P(
559
+ I,
560
+ {
561
+ "data-code-block": !0,
562
+ as: "div",
563
+ classNames: A,
564
+ role: "region",
565
+ "aria-label": n || `Code block in ${a}`,
566
+ ...u,
567
+ children: [
568
+ r ? p ? /* @__PURE__ */ o(
569
+ Se,
570
+ {
571
+ className: "code-block-copied-badge",
572
+ size: "tiny",
573
+ shape: "rounded",
574
+ "aria-live": "polite",
575
+ children: "Copied!"
576
+ }
577
+ ) : /* @__PURE__ */ o(
578
+ ze,
579
+ {
580
+ type: "button",
581
+ className: "code-block-copy-button",
582
+ size: "tiny",
583
+ shape: "rounded",
584
+ onClick: M,
585
+ onKeyDown: z,
586
+ "aria-label": "Copy code to clipboard",
587
+ children: "Copy"
588
+ }
589
+ ) : null,
590
+ /* @__PURE__ */ P(
591
+ "pre",
592
+ {
593
+ ref: H,
594
+ className: `language-${a}${d ? ` shadow-${d}` : ""}`,
595
+ tabIndex: 0,
596
+ "aria-label": `Code in ${a}`,
597
+ children: [
598
+ l && Array.from(Array(S.length).keys()).map((D) => /* @__PURE__ */ o(
599
+ "span",
600
+ {
601
+ className: "line-numbers",
602
+ "aria-hidden": "true",
603
+ children: D + 1
604
+ },
605
+ D
606
+ )),
607
+ /* @__PURE__ */ o(
608
+ "code",
609
+ {
610
+ ref: T,
611
+ contentEditable: i,
612
+ suppressContentEditableWarning: !0,
613
+ spellCheck: "false",
614
+ className: `language-${a} ${y ? "is-loading" : ""}`,
615
+ children: k
616
+ }
617
+ )
618
+ ]
619
+ }
620
+ )
621
+ ]
622
+ }
623
+ );
624
+ });
625
+ St.displayName = "CodeBlock";
626
+ const et = w.forwardRef(
627
+ ({ kind: e, height: t, label: a, ...r }, l) => {
628
+ let n = [];
629
+ return e && n.push(e), /* @__PURE__ */ o(
630
+ I,
631
+ {
632
+ as: "hr",
633
+ "data-hrule": !0,
634
+ ref: l,
635
+ classNames: n,
636
+ role: "separator",
637
+ "aria-orientation": "horizontal",
638
+ "aria-label": a,
639
+ ...r,
640
+ style: { height: t }
641
+ }
642
+ );
643
+ }
644
+ );
645
+ et.displayName = "Divider";
646
+ const ke = w.forwardRef(
647
+ ({
648
+ label: e,
649
+ hideLabel: t,
650
+ htmlFor: a,
651
+ ...r
652
+ }, l) => {
653
+ let n = [];
654
+ return t && n.push("visually-hidden"), /* @__PURE__ */ o(
655
+ I,
656
+ {
657
+ as: "label",
658
+ ref: l,
659
+ htmlFor: a,
660
+ classNames: n,
661
+ ...r,
662
+ children: e
663
+ }
664
+ );
665
+ }
666
+ );
667
+ ke.displayName = "InputLabel";
668
+ const Y = w.forwardRef(
669
+ ({ weight: e, size: t, fontStyle: a = "sans-serif", align: r, isSubtext: l, ...n }, s) => {
670
+ let i = [];
671
+ return e && i.push(`weight-${e}`), t && i.push(`text-${t}`), a && i.push(`font-${a}`), l && i.push("sub-text"), r && i.push(`text-${r}`), /* @__PURE__ */ o(I, { as: "p", ref: s, classNames: i, ...n });
672
+ }
673
+ );
674
+ Y.displayName = "Text";
675
+ const Ot = ({ state: e }) => e === "valid" ? /* @__PURE__ */ o(
676
+ "svg",
677
+ {
678
+ "data-validation-icon": "valid",
679
+ xmlns: "http://www.w3.org/2000/svg",
680
+ viewBox: "0 0 24 24",
681
+ width: "20",
682
+ height: "20",
683
+ children: /* @__PURE__ */ o(
684
+ "polyline",
685
+ {
686
+ points: "3.5 12.5 8.5 17.5 20.5 5.5",
687
+ fill: "none",
688
+ stroke: "#0ec05c",
689
+ strokeMiterlimit: "10",
690
+ strokeWidth: "2"
691
+ }
692
+ )
693
+ }
694
+ ) : /* @__PURE__ */ P(
695
+ "svg",
696
+ {
697
+ "data-validation-icon": "invalid",
698
+ xmlns: "http://www.w3.org/2000/svg",
699
+ viewBox: "0 0 24 24",
700
+ width: "20",
701
+ height: "20",
702
+ children: [
703
+ /* @__PURE__ */ o(
704
+ "line",
705
+ {
706
+ x1: "6.5",
707
+ y1: "17.5",
708
+ x2: "18.5",
709
+ y2: "5.5",
710
+ fill: "none",
711
+ stroke: "#ef4343",
712
+ strokeMiterlimit: "10",
713
+ strokeWidth: "2"
714
+ }
715
+ ),
716
+ /* @__PURE__ */ o(
717
+ "line",
718
+ {
719
+ x1: "6.5",
720
+ y1: "5.5",
721
+ x2: "18.5",
722
+ y2: "17.5",
723
+ fill: "none",
724
+ stroke: "#ef4343",
725
+ strokeMiterlimit: "10",
726
+ strokeWidth: "2"
727
+ }
728
+ )
729
+ ]
730
+ }
731
+ ), Z = w.forwardRef(
732
+ ({
733
+ label: e,
734
+ customLabel: t,
735
+ htmlFor: a,
736
+ helpText: r,
737
+ errorText: l,
738
+ validationState: n,
739
+ required: s,
740
+ size: i,
741
+ children: c,
742
+ ...d
743
+ }, u) => {
744
+ const f = e || t, p = r || l;
745
+ return /* @__PURE__ */ P(
746
+ I,
747
+ {
748
+ as: "div",
749
+ "data-form-item": !0,
750
+ ref: u,
751
+ role: "group",
752
+ required: s,
753
+ className: i ? `size-${i}` : void 0,
754
+ ...d,
755
+ children: [
756
+ f && /* @__PURE__ */ P(K, { "data-label-wrapper": !0, "data-has-validation": n ? "true" : void 0, children: [
757
+ t || e && /* @__PURE__ */ o(ke, { label: e, htmlFor: a }),
758
+ n && /* @__PURE__ */ o(Ot, { state: n })
759
+ ] }),
760
+ /* @__PURE__ */ o(K, { "data-input-wrapper": !0, children: c }),
761
+ p && /* @__PURE__ */ P(K, { className: "info-section vertically-center-items", children: [
762
+ r && /* @__PURE__ */ o(Y, { className: "help-text", children: r }),
763
+ l && /* @__PURE__ */ o(Y, { className: "error-text", children: l })
764
+ ] })
765
+ ]
766
+ }
767
+ );
768
+ }
769
+ );
770
+ Z.displayName = "FormItem";
771
+ const Bt = [
772
+ // Colours
773
+ "bgColor",
774
+ "bgColour",
775
+ "bgOpacity",
776
+ "textColor",
777
+ "textColour",
778
+ "borderColor",
779
+ "borderColour",
780
+ "borderOpacity",
781
+ "fillColor",
782
+ "fillColour",
783
+ "strokeColor",
784
+ "strokeColour",
785
+ // Visual
786
+ "shadow",
787
+ "shape",
788
+ "opacity",
789
+ // Layout
790
+ "layoutAsFlexbox",
791
+ "stackVertically",
792
+ "stackHorizontally",
793
+ "layoutAsGrid",
794
+ "columns",
795
+ "gap",
796
+ // Margin
797
+ "margin",
798
+ "horizontalMargin",
799
+ "verticalMargin",
800
+ "marginTop",
801
+ "marginRight",
802
+ "marginBottom",
803
+ "marginLeft",
804
+ // Padding
805
+ "padding",
806
+ "horizontalPadding",
807
+ "verticalPadding",
808
+ "paddingTop",
809
+ "paddingRight",
810
+ "paddingBottom",
811
+ "paddingLeft",
812
+ // Alignment
813
+ "horizontallyCentreThis",
814
+ "horizontallyCenterThis",
815
+ "verticallyCentreItems",
816
+ "verticallyCenterItems",
817
+ "pushItemsToEnds",
818
+ // Sizing
819
+ "isFullWidth",
820
+ "isFullHeight",
821
+ // Responsive visibility
822
+ "hideOnMobile",
823
+ "showOnlyOnMobile",
824
+ "hideOnTabletPortrait",
825
+ "showOnlyOnTabletPortrait",
826
+ "hideOnTabletLandscape",
827
+ "showOnlyOnTabletLandscape",
828
+ "hideOnDesktop",
829
+ "showOnlyOnDesktop",
830
+ // Typography
831
+ "weight",
832
+ // Custom classes
833
+ "classNames"
834
+ ], ie = (e) => {
835
+ const t = {}, a = {};
836
+ for (const r of Object.keys(e))
837
+ Bt.includes(r) ? t[r] = e[r] : a[r] = e[r];
838
+ return {
839
+ wrapperProps: t,
840
+ inputProps: a
841
+ };
842
+ }, He = w.forwardRef(
843
+ ({
844
+ id: e,
845
+ name: t,
846
+ label: a,
847
+ hideLabel: r,
848
+ helpText: l,
849
+ errorText: n,
850
+ onChange: s,
851
+ checked: i,
852
+ defaultChecked: c,
853
+ disabled: d,
854
+ required: u,
855
+ size: f = "medium",
856
+ ...p
857
+ }, g) => {
858
+ const b = he(() => t || e, [t, e]), x = (v) => {
859
+ s == null || s(v.target.checked);
860
+ }, { wrapperProps: y, inputProps: E } = ie(p);
861
+ return /* @__PURE__ */ P(
862
+ Z,
863
+ {
864
+ label: a,
865
+ htmlFor: e,
866
+ helpText: l,
867
+ errorText: n,
868
+ required: u,
869
+ size: f,
870
+ ...y,
871
+ children: [
872
+ /* @__PURE__ */ o(
873
+ I,
874
+ {
875
+ as: "input",
876
+ type: "checkbox",
877
+ ref: g,
878
+ id: e,
879
+ name: b,
880
+ checked: i,
881
+ defaultChecked: c,
882
+ disabled: d,
883
+ required: u,
884
+ onChange: x,
885
+ ...E
886
+ }
887
+ ),
888
+ /* @__PURE__ */ o(
889
+ I,
890
+ {
891
+ as: "div",
892
+ "data-checkbox": !0,
893
+ className: `size-${f}`
894
+ }
895
+ )
896
+ ]
897
+ }
898
+ );
899
+ }
900
+ );
901
+ He.displayName = "Checkbox";
902
+ const _e = w.forwardRef(
903
+ ({
904
+ id: e,
905
+ name: t,
906
+ label: a,
907
+ hideLabel: r,
908
+ helpText: l,
909
+ errorText: n,
910
+ onChange: s,
911
+ checked: i,
912
+ defaultChecked: c,
913
+ disabled: d,
914
+ required: u,
915
+ size: f = "medium",
916
+ ...p
917
+ }, g) => {
918
+ const b = he(() => t || e, [t, e]), x = (v) => {
919
+ s == null || s(v.target.checked);
920
+ }, { wrapperProps: y, inputProps: E } = ie(p);
921
+ return /* @__PURE__ */ P(
922
+ Z,
923
+ {
924
+ label: a,
925
+ htmlFor: e,
926
+ helpText: l,
927
+ errorText: n,
928
+ required: u,
929
+ size: f,
930
+ ...y,
931
+ children: [
932
+ /* @__PURE__ */ o(
933
+ I,
934
+ {
935
+ as: "input",
936
+ type: "checkbox",
937
+ ref: g,
938
+ id: e,
939
+ name: b,
940
+ checked: i,
941
+ defaultChecked: c,
942
+ disabled: d,
943
+ required: u,
944
+ onChange: x,
945
+ ...E
946
+ }
947
+ ),
948
+ /* @__PURE__ */ o(
949
+ I,
950
+ {
951
+ as: "div",
952
+ "data-switch": !0,
953
+ className: `size-${f}`
954
+ }
955
+ )
956
+ ]
957
+ }
958
+ );
959
+ }
960
+ );
961
+ _e.displayName = "Switch";
962
+ const Ft = w.forwardRef(
963
+ ({
964
+ id: e,
965
+ name: t,
966
+ label: a,
967
+ helpText: r,
968
+ errorText: l,
969
+ options: n,
970
+ value: s,
971
+ defaultValue: i,
972
+ onChange: c,
973
+ align: d,
974
+ equaliseWidth: u,
975
+ equalizeWidth: f,
976
+ required: p,
977
+ disabled: g,
978
+ size: b,
979
+ ...x
980
+ }, y) => {
981
+ const E = he(() => t || e, [t, e]), [v, T] = w.useState(
982
+ s || i || []
983
+ );
984
+ w.useEffect(() => {
985
+ s !== void 0 && T(s);
986
+ }, [s]);
987
+ const H = (N, $) => {
988
+ let L;
989
+ $ ? L = [...v, N] : L = v.filter((M) => M !== N), s === void 0 && T(L), c == null || c(L);
990
+ };
991
+ let k = [];
992
+ return d && k.push(`align-${d}`), (u || f) && k.push("equalise-width"), /* @__PURE__ */ o(
993
+ Z,
994
+ {
995
+ label: a,
996
+ htmlFor: e,
997
+ helpText: r,
998
+ errorText: l,
999
+ required: p,
1000
+ children: /* @__PURE__ */ o(
1001
+ I,
1002
+ {
1003
+ as: "div",
1004
+ "data-checkbox-group": !0,
1005
+ ref: y,
1006
+ classNames: k,
1007
+ role: "group",
1008
+ "aria-label": a,
1009
+ ...x,
1010
+ children: n.map((N, $) => {
1011
+ const { id: L, value: M, label: z, ...A } = N, S = L || `${e}-option-${$}`, D = v.includes(M);
1012
+ return /* @__PURE__ */ o(
1013
+ He,
1014
+ {
1015
+ id: S,
1016
+ name: E,
1017
+ label: z,
1018
+ checked: D,
1019
+ disabled: g || N.disabled,
1020
+ size: b,
1021
+ onChange: (G) => H(M, G),
1022
+ ...A
1023
+ },
1024
+ S
1025
+ );
1026
+ })
1027
+ }
1028
+ )
1029
+ }
1030
+ );
1031
+ }
1032
+ );
1033
+ Ft.displayName = "CheckboxGroup";
1034
+ const Vt = w.forwardRef(
1035
+ ({
1036
+ id: e,
1037
+ name: t,
1038
+ label: a,
1039
+ helpText: r,
1040
+ errorText: l,
1041
+ options: n,
1042
+ value: s,
1043
+ defaultValue: i,
1044
+ onChange: c,
1045
+ align: d,
1046
+ equaliseWidth: u,
1047
+ equalizeWidth: f,
1048
+ required: p,
1049
+ disabled: g,
1050
+ size: b,
1051
+ ...x
1052
+ }, y) => {
1053
+ const E = he(() => t || e, [t, e]), [v, T] = w.useState(
1054
+ s || i || []
1055
+ );
1056
+ w.useEffect(() => {
1057
+ s !== void 0 && T(s);
1058
+ }, [s]);
1059
+ const H = (N, $) => {
1060
+ let L;
1061
+ $ ? L = [...v, N] : L = v.filter((M) => M !== N), s === void 0 && T(L), c == null || c(L);
1062
+ };
1063
+ let k = [];
1064
+ return d && k.push(`align-${d}`), (u || f) && k.push("equalise-width"), /* @__PURE__ */ o(
1065
+ Z,
1066
+ {
1067
+ label: a,
1068
+ htmlFor: e,
1069
+ helpText: r,
1070
+ errorText: l,
1071
+ required: p,
1072
+ children: /* @__PURE__ */ o(
1073
+ I,
1074
+ {
1075
+ as: "div",
1076
+ "data-switch-group": !0,
1077
+ ref: y,
1078
+ classNames: k,
1079
+ role: "group",
1080
+ "aria-label": a,
1081
+ ...x,
1082
+ children: n.map((N, $) => {
1083
+ const { id: L, value: M, label: z, ...A } = N, S = L || `${e}-option-${$}`, D = v.includes(M);
1084
+ return /* @__PURE__ */ o(
1085
+ _e,
1086
+ {
1087
+ id: S,
1088
+ name: E,
1089
+ label: z,
1090
+ checked: D,
1091
+ disabled: g || N.disabled,
1092
+ size: b,
1093
+ onChange: (G) => H(M, G),
1094
+ ...A
1095
+ },
1096
+ S
1097
+ );
1098
+ })
1099
+ }
1100
+ )
1101
+ }
1102
+ );
1103
+ }
1104
+ );
1105
+ Vt.displayName = "SwitchGroup";
1106
+ const tt = w.forwardRef(
1107
+ ({
1108
+ "aria-label": e,
1109
+ "aria-invalid": t,
1110
+ label: a,
1111
+ helpText: r,
1112
+ errorText: l,
1113
+ required: n,
1114
+ accept: s,
1115
+ allowMultipleFiles: i = !1,
1116
+ capture: c,
1117
+ height: d = "120px",
1118
+ onChange: u,
1119
+ className: f = "",
1120
+ instructionMainText: p = "Drag and drop or click to upload",
1121
+ instructionSubText: g = "You can add multiple files",
1122
+ invalid: b,
1123
+ id: x,
1124
+ name: y,
1125
+ badgeBgColour: E,
1126
+ badgeTextColour: v,
1127
+ ...T
1128
+ }, H) => {
1129
+ const [k, N] = X([]), [$, L] = X(!1), M = J(null), z = (h) => {
1130
+ h.preventDefault(), h.stopPropagation(), L(!0);
1131
+ }, A = (h) => {
1132
+ h.preventDefault(), h.stopPropagation(), L(!1);
1133
+ }, S = (h) => {
1134
+ h.preventDefault(), h.stopPropagation(), L(!1);
1135
+ const m = Array.from(h.dataTransfer.files);
1136
+ D(m);
1137
+ }, D = (h) => {
1138
+ if (i)
1139
+ N((m) => [...m, ...h]), u == null || u([...k, ...h]);
1140
+ else {
1141
+ const m = h[0];
1142
+ N([m]), u == null || u([m]);
1143
+ }
1144
+ }, G = (h) => {
1145
+ if (h.target.files) {
1146
+ const m = Array.from(h.target.files);
1147
+ D(m);
1148
+ }
1149
+ }, V = (h) => {
1150
+ const m = k.filter((R, F) => F !== h);
1151
+ N(m), u == null || u(m);
1152
+ }, O = () => {
1153
+ var h;
1154
+ (h = M.current) == null || h.click();
1155
+ };
1156
+ return /* @__PURE__ */ o(
1157
+ Z,
1158
+ {
1159
+ label: a,
1160
+ htmlFor: x,
1161
+ helpText: r,
1162
+ errorText: l,
1163
+ required: n,
1164
+ children: /* @__PURE__ */ P(
1165
+ K,
1166
+ {
1167
+ "data-file-upload-area": !0,
1168
+ ref: H,
1169
+ className: [
1170
+ "file-upload-wrapper",
1171
+ $ ? "dragging" : "",
1172
+ f
1173
+ ].filter(Boolean).join(" "),
1174
+ "aria-label": e || a,
1175
+ "aria-invalid": t || b || void 0,
1176
+ "aria-required": n,
1177
+ children: [
1178
+ /* @__PURE__ */ P(
1179
+ K,
1180
+ {
1181
+ className: "file-upload-area",
1182
+ onDragOver: z,
1183
+ onDragLeave: A,
1184
+ onDrop: S,
1185
+ onClick: O,
1186
+ style: { height: d },
1187
+ children: [
1188
+ /* @__PURE__ */ o(
1189
+ "input",
1190
+ {
1191
+ ref: M,
1192
+ type: "file",
1193
+ id: x,
1194
+ name: y,
1195
+ onChange: G,
1196
+ multiple: i,
1197
+ accept: s,
1198
+ capture: c,
1199
+ className: "file-input"
1200
+ }
1201
+ ),
1202
+ p && /* @__PURE__ */ P(K, { className: "file-upload-content", children: [
1203
+ /* @__PURE__ */ o(Y, { children: p }),
1204
+ g && /* @__PURE__ */ o(Y, { isSubtext: !0, children: g })
1205
+ ] })
1206
+ ]
1207
+ }
1208
+ ),
1209
+ k.length > 0 && /* @__PURE__ */ o(K, { className: "uploaded-files", children: k.map((h, m) => /* @__PURE__ */ o(
1210
+ Se,
1211
+ {
1212
+ size: "small",
1213
+ shape: "rounded",
1214
+ actionIcon: "cross",
1215
+ onActionClick: () => V(m),
1216
+ actionAriaLabel: `Remove ${h.name}`,
1217
+ bgColour: E,
1218
+ textColour: v,
1219
+ children: h.name
1220
+ },
1221
+ `${h.name}-${m}`
1222
+ )) })
1223
+ ]
1224
+ }
1225
+ )
1226
+ }
1227
+ );
1228
+ }
1229
+ );
1230
+ tt.displayName = "FileUpload";
1231
+ const $e = w.forwardRef(
1232
+ ({
1233
+ // FormItem props
1234
+ label: e,
1235
+ hideLabel: t,
1236
+ helpText: a,
1237
+ errorText: r,
1238
+ size: l,
1239
+ required: n,
1240
+ // Side elements
1241
+ innerIconLeft: s,
1242
+ innerIconRight: i,
1243
+ innerTextLeft: c,
1244
+ innerTextRight: d,
1245
+ // Validation
1246
+ validateThis: u,
1247
+ valid: f,
1248
+ invalid: p,
1249
+ validationState: g,
1250
+ // Handlers
1251
+ onChange: b,
1252
+ onBlur: x,
1253
+ onFocus: y,
1254
+ // Aria
1255
+ "aria-label": E,
1256
+ "aria-invalid": v,
1257
+ // Input props
1258
+ id: T,
1259
+ name: H,
1260
+ value: k,
1261
+ defaultValue: N,
1262
+ type: $ = "text",
1263
+ placeholder: L,
1264
+ autoComplete: M,
1265
+ maxLength: z,
1266
+ minLength: A,
1267
+ pattern: S,
1268
+ readOnly: D,
1269
+ disabled: G,
1270
+ className: V,
1271
+ ...O
1272
+ }, h) => {
1273
+ const m = J(null), R = J(null), F = J(null), [W, C] = X(!1), [te, se] = X(null), Q = g ?? (u ? te : null), B = w.useCallback(
1274
+ (U) => {
1275
+ F.current = U, typeof h == "function" ? h(U) : h && (h.current = U);
1276
+ },
1277
+ [h]
1278
+ ), j = () => {
1279
+ const U = F.current;
1280
+ if (!U || U.value === "") {
1281
+ se(null);
1282
+ return;
1283
+ }
1284
+ se(U.validity.valid ? "valid" : "invalid");
1285
+ }, ee = (U) => {
1286
+ b == null || b(U.target.value), W && u && j();
1287
+ }, le = (U) => {
1288
+ C(!0), u && j(), x == null || x(U);
1289
+ }, xe = (U) => {
1290
+ y == null || y(U);
1291
+ };
1292
+ q(() => {
1293
+ const U = (pe, ve) => {
1294
+ if (!pe) return;
1295
+ const ce = pe.closest("[data-form-item]");
1296
+ ce == null || ce.style.setProperty(
1297
+ `--side-element-${ve}-width`,
1298
+ `${pe.getBoundingClientRect().width}px`
1299
+ );
1300
+ };
1301
+ (c || s) && U(m.current, "left"), (d || i) && U(R.current, "right");
1302
+ }, [c, d, s, i]);
1303
+ const Re = (U, pe, ve) => {
1304
+ if (!U) return null;
1305
+ const ce = typeof U == "string", be = !ce && w.isValidElement(U) && (U.props.onClick || U.props.onKeyDown || U.type === "button" || U.type === "a");
1306
+ return /* @__PURE__ */ o(
1307
+ K,
1308
+ {
1309
+ ref: ve,
1310
+ "data-input-side-element": !0,
1311
+ className: `${pe} ${ce ? "is-text" : "is-icon"} ${be ? "is-interactive" : ""}`,
1312
+ "aria-hidden": "true",
1313
+ children: U
1314
+ }
1315
+ );
1316
+ }, Me = !!(s || c), Ee = !!(i || d), { wrapperProps: Be, inputProps: Pe } = ie(O);
1317
+ return /* @__PURE__ */ P(
1318
+ Z,
1319
+ {
1320
+ label: e,
1321
+ htmlFor: T,
1322
+ helpText: a,
1323
+ errorText: r,
1324
+ validationState: Q,
1325
+ required: n,
1326
+ size: l,
1327
+ ...Be,
1328
+ children: [
1329
+ /* @__PURE__ */ o(
1330
+ I,
1331
+ {
1332
+ as: "input",
1333
+ ref: B,
1334
+ "data-input-field": !0,
1335
+ id: T,
1336
+ name: H,
1337
+ type: $,
1338
+ value: k,
1339
+ defaultValue: N,
1340
+ placeholder: L || " ",
1341
+ autoComplete: M,
1342
+ maxLength: z,
1343
+ minLength: A,
1344
+ pattern: S,
1345
+ readOnly: D,
1346
+ disabled: G,
1347
+ required: n,
1348
+ className: [
1349
+ V,
1350
+ Me && "with-left-element",
1351
+ Ee && "with-right-element"
1352
+ ].filter(Boolean).join(" "),
1353
+ "aria-label": E || e,
1354
+ "aria-invalid": v || p,
1355
+ "aria-required": n,
1356
+ onChange: ee,
1357
+ onBlur: le,
1358
+ onFocus: xe,
1359
+ ...Pe
1360
+ }
1361
+ ),
1362
+ (Me || Ee) && /* @__PURE__ */ P(K, { "data-input-helper": !0, "aria-hidden": "true", children: [
1363
+ Re(s || c, "left", m),
1364
+ Re(i || d, "right", R)
1365
+ ] })
1366
+ ]
1367
+ }
1368
+ );
1369
+ }
1370
+ );
1371
+ $e.displayName = "InputField";
1372
+ const at = w.forwardRef(
1373
+ ({
1374
+ desktopSpan: e,
1375
+ mobileSpan: t,
1376
+ tabletLandscapeSpan: a,
1377
+ tabletPortraitSpan: r,
1378
+ isHorizontal: l,
1379
+ role: n,
1380
+ ...s
1381
+ }, i) => {
1382
+ let c = [];
1383
+ return e || a || r || t ? (e && c.push(`${e}`), a && c.push(`${a}-on-tablet-landscape`), r && c.push(`${r}-on-tablet-portrait`), t && c.push(`${t}-on-mobile`)) : c.push("whole"), l && c.push("horizontal"), /* @__PURE__ */ o(
1384
+ I,
1385
+ {
1386
+ as: "div",
1387
+ "data-portion": !0,
1388
+ ref: i,
1389
+ classNames: c,
1390
+ role: n,
1391
+ ...s
1392
+ }
1393
+ );
1394
+ }
1395
+ );
1396
+ at.displayName = "Portion";
1397
+ const rt = w.forwardRef(
1398
+ ({
1399
+ id: e,
1400
+ name: t,
1401
+ value: a,
1402
+ label: r,
1403
+ helpText: l,
1404
+ errorText: n,
1405
+ onChange: s,
1406
+ checked: i,
1407
+ disabled: c,
1408
+ required: d,
1409
+ ...u
1410
+ }, f) => {
1411
+ const p = he(() => t || e, [t, e]), g = (y) => {
1412
+ y.target.checked && s && s(a);
1413
+ }, { wrapperProps: b, inputProps: x } = ie(u);
1414
+ return /* @__PURE__ */ o(
1415
+ I,
1416
+ {
1417
+ as: "div",
1418
+ "data-radio-button": !0,
1419
+ ref: f,
1420
+ role: "radio",
1421
+ "aria-checked": i,
1422
+ "aria-disabled": c,
1423
+ ...b,
1424
+ children: /* @__PURE__ */ o(
1425
+ Z,
1426
+ {
1427
+ label: r,
1428
+ htmlFor: e,
1429
+ helpText: l,
1430
+ errorText: n,
1431
+ required: d,
1432
+ children: /* @__PURE__ */ o(
1433
+ I,
1434
+ {
1435
+ as: "input",
1436
+ type: "radio",
1437
+ id: e,
1438
+ name: p,
1439
+ value: a,
1440
+ checked: i,
1441
+ disabled: c,
1442
+ required: d,
1443
+ onChange: g,
1444
+ ...x
1445
+ }
1446
+ )
1447
+ }
1448
+ )
1449
+ }
1450
+ );
1451
+ }
1452
+ );
1453
+ rt.displayName = "RadioButton";
1454
+ const st = w.forwardRef(
1455
+ ({
1456
+ id: e,
1457
+ name: t,
1458
+ label: a,
1459
+ helpText: r,
1460
+ errorText: l,
1461
+ options: n,
1462
+ value: s,
1463
+ defaultValue: i,
1464
+ onChange: c,
1465
+ align: d,
1466
+ equaliseWidth: u,
1467
+ equalizeWidth: f,
1468
+ required: p,
1469
+ disabled: g,
1470
+ ...b
1471
+ }, x) => {
1472
+ const y = he(() => t || e, [t, e]), E = (T) => {
1473
+ c == null || c(T.target.value);
1474
+ };
1475
+ let v = [];
1476
+ return d && v.push(`align-${d}`), (u || f) && v.push("equalise-width"), /* @__PURE__ */ o(
1477
+ Z,
1478
+ {
1479
+ label: a,
1480
+ htmlFor: e,
1481
+ helpText: r,
1482
+ errorText: l,
1483
+ required: p,
1484
+ children: /* @__PURE__ */ o(
1485
+ I,
1486
+ {
1487
+ as: "div",
1488
+ "data-radio-group": !0,
1489
+ ref: x,
1490
+ classNames: v,
1491
+ role: "radiogroup",
1492
+ "aria-label": a,
1493
+ ...b,
1494
+ children: n.map((T, H) => {
1495
+ const { id: k, value: N, label: $, ...L } = T, M = k || `${e}-option-${H}`, z = s ? s === N : i === N;
1496
+ return /* @__PURE__ */ P(
1497
+ K,
1498
+ {
1499
+ "data-radio-button": !0,
1500
+ role: "radio",
1501
+ "aria-checked": z,
1502
+ children: [
1503
+ /* @__PURE__ */ o(
1504
+ "input",
1505
+ {
1506
+ type: "radio",
1507
+ id: M,
1508
+ name: y,
1509
+ value: N,
1510
+ checked: z,
1511
+ disabled: g,
1512
+ onChange: E,
1513
+ ...L
1514
+ }
1515
+ ),
1516
+ /* @__PURE__ */ o("label", { htmlFor: M, children: $ })
1517
+ ]
1518
+ },
1519
+ M
1520
+ );
1521
+ })
1522
+ }
1523
+ )
1524
+ }
1525
+ );
1526
+ }
1527
+ );
1528
+ st.displayName = "RadioGroup";
1529
+ const nt = w.forwardRef(
1530
+ ({
1531
+ layout: e = "grid",
1532
+ gutters: t = "medium",
1533
+ retainLayoutOnTabletLandscape: a,
1534
+ retainLayoutOnTabletPortrait: r,
1535
+ retainLayoutOnMobile: l,
1536
+ retainLayoutAlways: n,
1537
+ allowUltraWide: s,
1538
+ groupLabel: i,
1539
+ ...c
1540
+ }, d) => {
1541
+ let u = [];
1542
+ return e && u.push(`layout-${e}`), t && u.push(t === "none" ? "no-gutters" : `${t}-gutters`), a && u.push("retain-layout-on-tablet-landscape"), r && u.push("retain-layout-on-tablet-portrait"), l && u.push("retain-layout-on-mobile"), n && u.push(
1543
+ "retain-layout-on-tablet-landscape retain-layout-on-tablet-portrait retain-layout-on-mobile"
1544
+ ), s && u.push("allow-ultra-wide"), /* @__PURE__ */ o(
1545
+ I,
1546
+ {
1547
+ as: "div",
1548
+ "data-row": !0,
1549
+ ref: d,
1550
+ classNames: [u.join(" ")],
1551
+ marginBottom: "tiny",
1552
+ role: "grid",
1553
+ "aria-label": i,
1554
+ ...c
1555
+ }
1556
+ );
1557
+ }
1558
+ );
1559
+ nt.displayName = "Row";
1560
+ const ot = w.forwardRef(
1561
+ ({
1562
+ // FormItem props
1563
+ label: e,
1564
+ helpText: t,
1565
+ errorText: a,
1566
+ required: r,
1567
+ // Select props
1568
+ id: l,
1569
+ name: n,
1570
+ options: s,
1571
+ onChange: i,
1572
+ disabled: c,
1573
+ className: d,
1574
+ ...u
1575
+ }, f) => {
1576
+ const p = he(() => n || l, [n, l]), g = (v) => /* @__PURE__ */ o(
1577
+ I,
1578
+ {
1579
+ as: "option",
1580
+ value: v.value,
1581
+ disabled: v.disabled,
1582
+ children: v.label
1583
+ },
1584
+ v.value
1585
+ ), b = (v) => /* @__PURE__ */ o(
1586
+ I,
1587
+ {
1588
+ as: "optgroup",
1589
+ label: v.label,
1590
+ children: v.options.map(g)
1591
+ },
1592
+ v.label
1593
+ ), x = (v) => {
1594
+ i == null || i(v.target.value);
1595
+ }, { wrapperProps: y, inputProps: E } = ie(u);
1596
+ return /* @__PURE__ */ o(
1597
+ Z,
1598
+ {
1599
+ label: e,
1600
+ htmlFor: l,
1601
+ helpText: t,
1602
+ errorText: a,
1603
+ required: r,
1604
+ ...y,
1605
+ children: /* @__PURE__ */ o(K, { "data-select": !0, className: d, disabled: c, children: /* @__PURE__ */ o(
1606
+ I,
1607
+ {
1608
+ as: "select",
1609
+ ref: f,
1610
+ id: l,
1611
+ name: p,
1612
+ disabled: c,
1613
+ required: r,
1614
+ onChange: x,
1615
+ ...E,
1616
+ children: s.map(
1617
+ (v) => "options" in v ? b(v) : g(v)
1618
+ )
1619
+ }
1620
+ ) })
1621
+ }
1622
+ );
1623
+ }
1624
+ );
1625
+ ot.displayName = "Select";
1626
+ const Xe = (e, t) => e > t ? "exceeded" : e >= t * 0.9 ? "warning" : "normal", Te = (e, t, a) => Math.abs(e) === 1 ? t : a, it = w.forwardRef(
1627
+ ({
1628
+ // FormItem props
1629
+ label: e,
1630
+ hideLabel: t,
1631
+ helpText: a,
1632
+ errorText: r,
1633
+ size: l,
1634
+ required: n,
1635
+ // TextArea-specific
1636
+ onChange: s,
1637
+ value: i = "",
1638
+ characterLimit: c,
1639
+ wordLimit: d,
1640
+ // Input props
1641
+ id: u,
1642
+ name: f,
1643
+ rows: p,
1644
+ cols: g,
1645
+ minLength: b,
1646
+ maxLength: x,
1647
+ placeholder: y,
1648
+ readOnly: E,
1649
+ disabled: v,
1650
+ autoComplete: T,
1651
+ // Validation (unused but destructured to not pass to DOM)
1652
+ validateThis: H,
1653
+ valid: k,
1654
+ invalid: N,
1655
+ ...$
1656
+ }, L) => {
1657
+ const M = J(null), z = (V) => {
1658
+ s == null || s(V.target.value);
1659
+ }, A = () => {
1660
+ const V = [];
1661
+ if (c) {
1662
+ const O = i.length, h = Xe(O, c), m = Math.max(0, O - c), R = c - O;
1663
+ V.push(
1664
+ /* @__PURE__ */ o("span", { className: `limit-${h}`, children: m > 0 ? `${m} ${Te(m, "char", "chars")} over limit` : `${R} ${Te(R, "char", "chars")} left` }, "char-limit")
1665
+ );
1666
+ }
1667
+ if (d) {
1668
+ const O = i.trim().split(/\s+/).filter(Boolean).length, h = Xe(O, d), m = Math.max(0, O - d), R = d - O;
1669
+ V.push(
1670
+ /* @__PURE__ */ o("span", { className: `limit-${h}`, children: m > 0 ? `${m} ${Te(m, "word", "words")} over limit` : `${R} ${Te(R, "word", "words")} left` }, "word-limit")
1671
+ );
1672
+ }
1673
+ if (!(!V.length && !a))
1674
+ return /* @__PURE__ */ P(Ne, { children: [
1675
+ a,
1676
+ a && V.length > 0 && /* @__PURE__ */ o("span", { className: "separator", children: " • " }),
1677
+ V.map((O, h) => /* @__PURE__ */ P(w.Fragment, { children: [
1678
+ h > 0 && /* @__PURE__ */ o("span", { className: "separator", children: " • " }),
1679
+ O
1680
+ ] }, h))
1681
+ ] });
1682
+ }, S = (V) => {
1683
+ M.current = V, typeof L == "function" ? L(V) : L && (L.current = V);
1684
+ }, { wrapperProps: D, inputProps: G } = ie($);
1685
+ return /* @__PURE__ */ o(
1686
+ Z,
1687
+ {
1688
+ label: e,
1689
+ htmlFor: u,
1690
+ helpText: A(),
1691
+ errorText: r,
1692
+ required: n,
1693
+ size: l,
1694
+ ...D,
1695
+ children: /* @__PURE__ */ o(
1696
+ I,
1697
+ {
1698
+ as: "textarea",
1699
+ ref: S,
1700
+ "data-textarea": !0,
1701
+ id: u,
1702
+ name: f,
1703
+ value: i,
1704
+ rows: p,
1705
+ cols: g,
1706
+ minLength: b,
1707
+ maxLength: x,
1708
+ placeholder: y,
1709
+ readOnly: E,
1710
+ disabled: v,
1711
+ required: n,
1712
+ autoComplete: T,
1713
+ onChange: z,
1714
+ ...G
1715
+ }
1716
+ )
1717
+ }
1718
+ );
1719
+ }
1720
+ );
1721
+ it.displayName = "TextArea";
1722
+ const Wt = {
1723
+ Checkbox: He,
1724
+ Switch: _e,
1725
+ InputField: $e,
1726
+ FileUpload: tt,
1727
+ InputLabel: ke,
1728
+ RadioButton: rt,
1729
+ RadioGroup: st,
1730
+ Select: ot,
1731
+ TextArea: it,
1732
+ Empty: "div"
1733
+ }, zt = (e, t) => {
1734
+ const { as: a, name: r, ...l } = e, n = (i) => {
1735
+ t(r, i);
1736
+ }, s = Wt[a] || $e;
1737
+ return /* @__PURE__ */ o(
1738
+ I,
1739
+ {
1740
+ as: s,
1741
+ ...l,
1742
+ name: r,
1743
+ isFullWidth: !0,
1744
+ onChange: n
1745
+ }
1746
+ );
1747
+ }, Ht = (e, t, a) => {
1748
+ const r = e.map((l, n) => {
1749
+ const {
1750
+ desktopSpan: s,
1751
+ tabletLandscapeSpan: i,
1752
+ tabletPortraitSpan: c,
1753
+ mobileSpan: d,
1754
+ isHorizontal: u,
1755
+ ...f
1756
+ } = l;
1757
+ return /* @__PURE__ */ xt(at, { ...{
1758
+ desktopSpan: s,
1759
+ tabletLandscapeSpan: i,
1760
+ tabletPortraitSpan: c,
1761
+ mobileSpan: d,
1762
+ isHorizontal: u
1763
+ }, key: `${l.name}-${n}` }, zt(f, t));
1764
+ });
1765
+ return /* @__PURE__ */ o(nt, { gutters: a, children: r });
1766
+ }, _t = w.forwardRef(
1767
+ ({ spacing: e = "small", fields: t, onFieldsChange: a, children: r, errorText: l, ...n }, s) => {
1768
+ let i = [];
1769
+ e && i.push(`spacing-${e}`);
1770
+ const c = (u, f) => {
1771
+ a && a({
1772
+ [u]: f
1773
+ });
1774
+ }, d = t != null && t.length ? Ht(t, c, e) : r;
1775
+ return /* @__PURE__ */ P(
1776
+ I,
1777
+ {
1778
+ as: "form",
1779
+ "data-form": !0,
1780
+ ref: s,
1781
+ classNames: i,
1782
+ ...n,
1783
+ children: [
1784
+ d,
1785
+ l && /* @__PURE__ */ o(Ze, { kind: "error", children: l })
1786
+ ]
1787
+ }
1788
+ );
1789
+ }
1790
+ );
1791
+ _t.displayName = "Form";
1792
+ const Gt = w.forwardRef(
1793
+ ({
1794
+ isJoint: e,
1795
+ equalWidthForChildren: t,
1796
+ retainLayout: a,
1797
+ children: r,
1798
+ legend: l,
1799
+ id: n,
1800
+ ...s
1801
+ }, i) => {
1802
+ const c = n || `form-group-${Math.random().toString(36).substring(2, 9)}`;
1803
+ let d = [];
1804
+ return e && d.push("is-joint"), t && d.push("equal-width-for-children"), a && d.push("retain-layout"), /* @__PURE__ */ o(
1805
+ I,
1806
+ {
1807
+ as: "div",
1808
+ "data-form-item-group": !0,
1809
+ ref: i,
1810
+ id: c,
1811
+ role: "group",
1812
+ "aria-label": l,
1813
+ classNames: d,
1814
+ ...s,
1815
+ children: r
1816
+ }
1817
+ );
1818
+ }
1819
+ );
1820
+ Gt.displayName = "FormItemGroup";
1821
+ const Kt = (e, t) => {
1822
+ const a = [], r = e.length, l = t.length;
1823
+ if (r === 0) return l;
1824
+ if (l === 0) return r;
1825
+ for (let n = 0; n <= l; n++)
1826
+ a[n] = [n];
1827
+ for (let n = 0; n <= r; n++)
1828
+ a[0][n] = n;
1829
+ for (let n = 1; n <= l; n++)
1830
+ for (let s = 1; s <= r; s++)
1831
+ t[n - 1] === e[s - 1] ? a[n][s] = a[n - 1][s - 1] : a[n][s] = Math.min(
1832
+ a[n - 1][s] + 1,
1833
+ // Deletion
1834
+ a[n][s - 1] + 1,
1835
+ // Insertion
1836
+ a[n - 1][s - 1] + 1
1837
+ // Substitution
1838
+ );
1839
+ return a[l][r];
1840
+ }, jt = (e, t) => {
1841
+ let a = 0, r = 0;
1842
+ for (; a < e.length && r < t.length; )
1843
+ e[a] === t[r] && a++, r++;
1844
+ return a === e.length;
1845
+ }, Xt = (e) => e.split(/[\s\-_]+/).map((t) => t.slice(0, 2)).join("").toLowerCase(), Ct = (e, t) => {
1846
+ if (!t) return e;
1847
+ const a = t.toLowerCase().trim(), r = Math.floor(a.length / 2);
1848
+ return e.map((n) => {
1849
+ const s = n.label.toLowerCase(), i = Kt(a, s), c = s.split(/[\s\-_]+/), d = a.split(/[\s\-_]+/), u = s.includes(a) || d.every(
1850
+ (g) => c.some((b) => b.startsWith(g))
1851
+ ), f = Xt(s), p = jt(a, f);
1852
+ return {
1853
+ option: n,
1854
+ distance: i,
1855
+ isPartialMatch: u,
1856
+ isAcronymMatch: p
1857
+ };
1858
+ }).filter(
1859
+ ({ distance: n, isPartialMatch: s, isAcronymMatch: i }) => s || i || n <= r
1860
+ ).sort((n, s) => n.isPartialMatch && !s.isPartialMatch ? -1 : !n.isPartialMatch && s.isPartialMatch ? 1 : n.isAcronymMatch && !s.isAcronymMatch ? -1 : !n.isAcronymMatch && s.isAcronymMatch ? 1 : n.distance - s.distance).map(({ option: n }) => n);
1861
+ }, Ut = w.forwardRef(
1862
+ ({
1863
+ options: e = [],
1864
+ label: t,
1865
+ helpText: a,
1866
+ errorText: r,
1867
+ placeholder: l = "Select an option",
1868
+ id: n,
1869
+ defaultValue: s,
1870
+ onChange: i,
1871
+ disabled: c,
1872
+ selectionLimit: d,
1873
+ allowMultiSelect: u = !1,
1874
+ allowCustomEntries: f = !1,
1875
+ isLoading: p,
1876
+ value: g,
1877
+ isFullWidth: b,
1878
+ className: x,
1879
+ required: y,
1880
+ ...E
1881
+ }, v) => {
1882
+ const [T, H] = X(!1), [k, N] = X(""), [$, L] = X(-1), [M, z] = X(null), [A, S] = X([]);
1883
+ q(() => {
1884
+ s && i && i(s);
1885
+ }, []);
1886
+ const D = w.useMemo(() => [...e], [e]), G = J(), V = J(null), O = n || `listbox-${Math.random().toString(36).substring(2, 9)}`, h = Ct(D, k), m = (B) => {
1887
+ if (B.disabled) return;
1888
+ let j;
1889
+ if (u) {
1890
+ if (A.some((le) => le.value === B.value))
1891
+ j = A.filter((le) => le.value !== B.value);
1892
+ else {
1893
+ if (d && A.length >= d)
1894
+ return;
1895
+ j = [...A, B];
1896
+ }
1897
+ S(j), i == null || i(j.map((le) => le.value));
1898
+ } else
1899
+ j = [B], z(B), S(j), i == null || i(B.value), H(!1);
1900
+ N(""), L(-1);
1901
+ }, R = (B) => {
1902
+ N(B);
1903
+ }, F = () => {
1904
+ if (!k.trim() || !f) return;
1905
+ const B = k.trim(), j = {
1906
+ value: B,
1907
+ label: B
1908
+ };
1909
+ D.some((ee) => ee.value === B) || m(j);
1910
+ }, W = (B) => {
1911
+ if (u) {
1912
+ const j = A.filter((ee) => ee.value !== B);
1913
+ S(j), i == null || i(j.map((ee) => ee.value));
1914
+ } else
1915
+ z(null), S([]), i == null || i("");
1916
+ }, C = () => {
1917
+ z(null), S([]), i == null || i(u ? [] : "");
1918
+ }, te = (B) => {
1919
+ switch (B.key) {
1920
+ case "ArrowDown":
1921
+ B.preventDefault(), T ? L(
1922
+ (j) => j < h.length - 1 ? j + 1 : j
1923
+ ) : (H(!0), L(0));
1924
+ break;
1925
+ case "ArrowUp":
1926
+ B.preventDefault(), L((j) => j > 0 ? j - 1 : j);
1927
+ break;
1928
+ case "Enter":
1929
+ if (B.preventDefault(), f && k.trim()) {
1930
+ const j = h.find(
1931
+ (ee) => ee.label.toLowerCase() === k.trim().toLowerCase()
1932
+ );
1933
+ j ? m(j) : F();
1934
+ } else $ >= 0 && h[$] && m(h[$]);
1935
+ break;
1936
+ case "Escape":
1937
+ B.preventDefault(), H(!1), L(-1);
1938
+ break;
1939
+ case " ":
1940
+ T || (B.preventDefault(), H(!0), L(0));
1941
+ break;
1942
+ case "Home":
1943
+ T && (B.preventDefault(), L(0));
1944
+ break;
1945
+ case "End":
1946
+ T && (B.preventDefault(), L(h.length - 1));
1947
+ break;
1948
+ }
1949
+ };
1950
+ We(G, () => {
1951
+ H(!1), L(-1);
1952
+ }), q(() => {
1953
+ T && V.current && V.current.focus();
1954
+ }, [T]), q(() => {
1955
+ if ($ >= 0) {
1956
+ const B = document.querySelector(`[data-index="${$}"]`);
1957
+ B == null || B.scrollIntoView({ block: "nearest" });
1958
+ }
1959
+ }, [$]);
1960
+ const { wrapperProps: se, inputProps: Q } = ie(E);
1961
+ return /* @__PURE__ */ o(
1962
+ Z,
1963
+ {
1964
+ label: t,
1965
+ htmlFor: n,
1966
+ helpText: a,
1967
+ errorText: r,
1968
+ required: y,
1969
+ isFullWidth: b,
1970
+ ...se,
1971
+ children: /* @__PURE__ */ P(
1972
+ I,
1973
+ {
1974
+ as: "div",
1975
+ "data-list-box": !0,
1976
+ classNames: ["list-box-wrapper", c ? "disabled" : "", x || ""],
1977
+ ref: G,
1978
+ isFullWidth: b,
1979
+ ...Q,
1980
+ children: [
1981
+ /* @__PURE__ */ P(
1982
+ K,
1983
+ {
1984
+ className: "list-box-input-wrapper",
1985
+ onClick: () => !c && H(!T),
1986
+ role: "combobox",
1987
+ "aria-haspopup": "listbox",
1988
+ "aria-expanded": T,
1989
+ "aria-controls": `${O}-listbox`,
1990
+ "aria-owns": `${O}-listbox`,
1991
+ tabIndex: c ? -1 : 0,
1992
+ children: [
1993
+ u ? /* @__PURE__ */ P(Ne, { children: [
1994
+ A.length > 0 ? /* @__PURE__ */ P(K, { className: "options-wrapper", children: [
1995
+ /* @__PURE__ */ o(K, { className: "options-list", children: A.map((B) => /* @__PURE__ */ o(
1996
+ Se,
1997
+ {
1998
+ actionIcon: "cross",
1999
+ onActionClick: () => W(B.value),
2000
+ actionAriaLabel: `Remove ${B.label}`,
2001
+ size: "small",
2002
+ shape: "rounded",
2003
+ children: /* @__PURE__ */ o(Y, { children: B.label })
2004
+ },
2005
+ B.value
2006
+ )) }),
2007
+ d && A.length >= d && /* @__PURE__ */ P(Y, { className: "options-limit-warning", textColour: "red", size: "tiny", children: [
2008
+ "You can choose only ",
2009
+ d,
2010
+ " option",
2011
+ d === 1 ? "" : "s"
2012
+ ] })
2013
+ ] }) : /* @__PURE__ */ o("span", { className: "placeholder", children: l }),
2014
+ A.length > 0 && /* @__PURE__ */ o(
2015
+ K,
2016
+ {
2017
+ className: "icon-wrapper clear-all",
2018
+ title: "Clear all options",
2019
+ onClick: () => C(),
2020
+ children: /* @__PURE__ */ P("svg", { viewBox: "0 0 24 24", children: [
2021
+ /* @__PURE__ */ o("line", { x1: "5", y1: "5", x2: "19", y2: "19" }),
2022
+ /* @__PURE__ */ o("line", { x1: "5", y1: "19", x2: "19", y2: "5" })
2023
+ ] })
2024
+ }
2025
+ )
2026
+ ] }) : A[0] ? /* @__PURE__ */ o(Y, { className: "selected-option", children: A[0].label }) : /* @__PURE__ */ o("span", { className: "placeholder", children: l }),
2027
+ /* @__PURE__ */ o(K, { className: "icon-wrapper chevrons", children: /* @__PURE__ */ P("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: [
2028
+ /* @__PURE__ */ o("polyline", { points: "6 9 12 4 18 9" }),
2029
+ /* @__PURE__ */ o("polyline", { points: "6 15 12 20 18 15" })
2030
+ ] }) })
2031
+ ]
2032
+ }
2033
+ ),
2034
+ T && !c && /* @__PURE__ */ P(K, { className: "list-box-dropdown", children: [
2035
+ /* @__PURE__ */ P(K, { className: "list-box-search-wrapper", children: [
2036
+ /* @__PURE__ */ o(
2037
+ $e,
2038
+ {
2039
+ type: "text",
2040
+ ref: V,
2041
+ className: "list-box-search",
2042
+ placeholder: f ? "Type to search or add new" : "Search",
2043
+ value: k,
2044
+ onChange: R,
2045
+ onKeyDown: te,
2046
+ "aria-controls": `${O}-listbox`,
2047
+ "aria-label": "Search options",
2048
+ isFullWidth: !0
2049
+ }
2050
+ ),
2051
+ f && k.trim() && !A.some((B) => B.label.toLowerCase() === k.trim().toLowerCase()) && /* @__PURE__ */ o(
2052
+ "kbd",
2053
+ {
2054
+ className: "list-box-enter-key",
2055
+ "aria-label": "Press Enter to add custom option",
2056
+ children: "↵"
2057
+ }
2058
+ )
2059
+ ] }),
2060
+ /* @__PURE__ */ o(
2061
+ I,
2062
+ {
2063
+ as: "ul",
2064
+ id: `${O}-listbox`,
2065
+ className: "list-box-options",
2066
+ role: "listbox",
2067
+ "aria-multiselectable": u,
2068
+ "aria-busy": p,
2069
+ tabIndex: -1,
2070
+ children: h.length > 0 ? h.map((B, j) => /* @__PURE__ */ o(
2071
+ "li",
2072
+ {
2073
+ id: `${O}-option-${B.value}`,
2074
+ className: `list-box-option ${B.disabled ? "disabled" : ""} ${$ === j ? "active" : ""}`,
2075
+ role: "option",
2076
+ "aria-selected": A.some((ee) => ee.value === B.value),
2077
+ "aria-disabled": B.disabled,
2078
+ onClick: () => m(B),
2079
+ "data-index": j,
2080
+ tabIndex: -1,
2081
+ children: B.customLabel || B.label
2082
+ },
2083
+ B.value
2084
+ )) : /* @__PURE__ */ o(
2085
+ "li",
2086
+ {
2087
+ className: "list-box-option disabled",
2088
+ role: "alert",
2089
+ "aria-live": "polite",
2090
+ children: f ? "Type and press Enter to add new option" : "No matches found"
2091
+ }
2092
+ )
2093
+ }
2094
+ )
2095
+ ] })
2096
+ ]
2097
+ }
2098
+ )
2099
+ }
2100
+ );
2101
+ }
2102
+ );
2103
+ Ut.displayName = "ListBox";
2104
+ function Ce(e, t) {
2105
+ return (t === "alphanumeric" ? /^[a-zA-Z0-9]+$/i : /^[0-9]+$/).test(e);
2106
+ }
2107
+ const qt = w.forwardRef(
2108
+ ({
2109
+ numberOfFields: e,
2110
+ onChange: t,
2111
+ type: a = "number",
2112
+ mask: r = !1,
2113
+ isOTP: l = !1,
2114
+ autoFocus: n = !1,
2115
+ pasteFromClipboard: s = "enabled",
2116
+ focusFirstInputOnReset: i = !0,
2117
+ isFullWidth: c,
2118
+ ariaLabel: d,
2119
+ ...u
2120
+ }, f) => {
2121
+ const p = J(null), [g, b] = X([]), [x, y] = X([]), [E, v] = X(!0), [T, H] = X(-1), k = u.id || `pin-input-${Math.random().toString(36).substring(2, 9)}`, N = d || "Enter verification code", $ = _(
2122
+ (O) => {
2123
+ var m;
2124
+ const h = g[O];
2125
+ (m = h == null ? void 0 : h.current) == null || m.focus();
2126
+ },
2127
+ [g]
2128
+ ), L = _(
2129
+ (O) => {
2130
+ if (!E) return;
2131
+ const h = O + 1 < e ? O + 1 : null;
2132
+ h && $(h);
2133
+ },
2134
+ [$, e, E]
2135
+ ), M = _(() => {
2136
+ y(Array(e).fill("")), t == null || t(""), i && ($(0), H(0));
2137
+ }, [e, t, $, i]), z = _(
2138
+ (O, h) => {
2139
+ const m = [...x];
2140
+ m[h] = O, y(m), t == null || t(m.join("")), O !== "" && m.length === e && m.every((F) => F != null && F !== "") && h === e - 1 || (v(!0), L(h));
2141
+ },
2142
+ [L, e, t, x]
2143
+ ), A = _((O, h) => {
2144
+ var F;
2145
+ const m = typeof O == "string" ? O : O.target.value, R = x[h];
2146
+ if (m === "") {
2147
+ z("", h);
2148
+ return;
2149
+ }
2150
+ if (m.length > 1 && h < e - 1) {
2151
+ if (Ce(m, a)) {
2152
+ let W = [];
2153
+ const C = m.split("");
2154
+ R === "" ? W = C.filter((Q, B) => h + B < e) : ((F = g[h].current) == null ? void 0 : F.selectionEnd) === m.length ? W = C.filter((B, j) => j > 0 && h + j - 1 < e) : W = C.filter((B, j) => j < m.length - 1 && h + j < e);
2155
+ const te = x.map(
2156
+ (Q, B) => B >= h && B < h + W.length ? W[B - h] : Q
2157
+ );
2158
+ y(te), t == null || t(te.join(""));
2159
+ const se = Math.min(h + W.length, e - 1);
2160
+ $(se);
2161
+ }
2162
+ } else {
2163
+ let W = m;
2164
+ (R == null ? void 0 : R.length) > 0 && (W = m.charAt(m.length - 1)), Ce(W, a) && z(W, h);
2165
+ }
2166
+ }, [e, t, z, a, x, $, g]), S = _((O, h) => {
2167
+ var m;
2168
+ if (O.key === "Backspace")
2169
+ if (O.target.value === "") {
2170
+ if (h > 0) {
2171
+ const R = h - 1;
2172
+ z("", R), $(R), v(!0);
2173
+ }
2174
+ } else
2175
+ v(!1);
2176
+ else O.key === "Escape" ? ((m = g[h].current) == null || m.blur(), V()) : O.key === "ArrowRight" ? h < e - 1 && $(h + 1) : O.key === "ArrowLeft" && h > 0 && $(h - 1);
2177
+ }, [$, z, g, e]), D = _((O, h) => {
2178
+ H(h);
2179
+ }, []), G = _((O) => {
2180
+ const h = O.target;
2181
+ setTimeout(() => {
2182
+ h.setSelectionRange(h.value.length, h.value.length);
2183
+ }, 0);
2184
+ }, []), V = _(() => {
2185
+ H(-1);
2186
+ }, []);
2187
+ return q(() => {
2188
+ b((O) => Array(e).fill(0).map((m, R) => {
2189
+ var W;
2190
+ const F = O[R] || Rt();
2191
+ return n && R === 0 && ((W = F.current) == null || W.focus()), F;
2192
+ }));
2193
+ }, [e, n]), Je(
2194
+ f,
2195
+ () => ({
2196
+ ...p.current,
2197
+ reset: M
2198
+ }),
2199
+ [M]
2200
+ ), /* @__PURE__ */ o(
2201
+ K,
2202
+ {
2203
+ "data-pin-input-field": !0,
2204
+ ref: p,
2205
+ classNames: c ? ["full-width"] : [],
2206
+ role: "group",
2207
+ "aria-label": N,
2208
+ "aria-required": u.required,
2209
+ ...u,
2210
+ children: Array.from({ length: e }, (O, h) => /* @__PURE__ */ o(
2211
+ $e,
2212
+ {
2213
+ id: `${k}-${h}`,
2214
+ ref: g[h],
2215
+ type: r ? "password" : a === "number" ? "tel" : "text",
2216
+ inputMode: a === "number" ? "numeric" : "text",
2217
+ onChange: (m) => A(m, h),
2218
+ onKeyDown: (m) => S(m, h),
2219
+ onFocus: (m) => D(m, h),
2220
+ onSelect: G,
2221
+ onBlur: V,
2222
+ placeholder: T !== h ? "⦁" : void 0,
2223
+ autoComplete: l ? "one-time-code" : "off",
2224
+ value: x[h] || "",
2225
+ autoFocus: n && h === 0,
2226
+ onCopy: (m) => s === "disabled" && m.preventDefault(),
2227
+ onPaste: (m) => s === "disabled" && m.preventDefault(),
2228
+ "aria-label": `Digit ${h + 1} of ${e}`,
2229
+ "aria-required": u.required
2230
+ },
2231
+ h
2232
+ ))
2233
+ }
2234
+ );
2235
+ }
2236
+ );
2237
+ qt.displayName = "PinInputField";
2238
+ const Yt = w.forwardRef(
2239
+ ({
2240
+ id: e,
2241
+ name: t,
2242
+ label: a,
2243
+ helpText: r,
2244
+ errorText: l,
2245
+ options: n,
2246
+ defaultValue: s,
2247
+ value: i,
2248
+ required: c,
2249
+ onChange: d,
2250
+ size: u = "medium",
2251
+ bgColour: f,
2252
+ disabled: p,
2253
+ ...g
2254
+ }, b) => {
2255
+ const x = he(() => t || e, [t, e]), y = J(null), [E, v] = X({
2256
+ width: 0,
2257
+ transform: "translateX(0)"
2258
+ }), [T, H] = X(!1), [k, N] = X(0), [$, L] = X(0), M = J([]), z = _(() => {
2259
+ if (!y.current) return;
2260
+ const m = y.current, R = m.closest("[data-input-wrapper]");
2261
+ if (m && R) {
2262
+ const F = m.scrollWidth, W = R.clientWidth, C = F > W;
2263
+ H(C), L(C ? F - W : 0);
2264
+ }
2265
+ }, []);
2266
+ q(() => {
2267
+ const m = y.current;
2268
+ if (!m) return;
2269
+ z();
2270
+ const R = new ResizeObserver(() => {
2271
+ z();
2272
+ });
2273
+ return R.observe(m), m.closest("[data-input-wrapper]") && R.observe(m.closest("[data-input-wrapper]")), () => R.disconnect();
2274
+ }, [z]), q(() => {
2275
+ const m = n.findIndex((R) => R.value === i);
2276
+ if (m >= 0) {
2277
+ const R = () => {
2278
+ const F = M.current[m];
2279
+ if (F) {
2280
+ const W = F.offsetWidth;
2281
+ let C = "translateX(0)";
2282
+ m > 0 && (C = `translateX(${M.current.slice(0, m).reduce((se, Q) => se + ((Q == null ? void 0 : Q.offsetWidth) || 0), 0)}px)`), v({ width: W, transform: C });
2283
+ }
2284
+ };
2285
+ if (document.fonts && document.fonts.ready)
2286
+ document.fonts.ready.then(() => {
2287
+ requestAnimationFrame(() => {
2288
+ requestAnimationFrame(R);
2289
+ });
2290
+ });
2291
+ else {
2292
+ const F = setTimeout(R, 100);
2293
+ return () => clearTimeout(F);
2294
+ }
2295
+ }
2296
+ }, [i, n]);
2297
+ const A = (m) => {
2298
+ d == null || d(m.target.value);
2299
+ }, { wrapperProps: S, inputProps: D } = ie(g), G = _((m) => {
2300
+ const R = y.current;
2301
+ if (!R) return;
2302
+ const W = R.clientWidth * 0.8;
2303
+ let C = m === "right" ? Math.min(k + W, $) : Math.max(k - W, 0);
2304
+ N(C), requestAnimationFrame(() => {
2305
+ R.style.transform = `translateX(-${C}px)`;
2306
+ });
2307
+ }, [k, $]), V = k > 0, O = k < $, h = [];
2308
+ return u && h.push(`size-${u}`), /* @__PURE__ */ o(
2309
+ Z,
2310
+ {
2311
+ label: a,
2312
+ htmlFor: e,
2313
+ helpText: r,
2314
+ errorText: l,
2315
+ required: c,
2316
+ ...S,
2317
+ children: /* @__PURE__ */ P(
2318
+ I,
2319
+ {
2320
+ as: "div",
2321
+ "data-radio-tab-group": !0,
2322
+ ref: b,
2323
+ classNames: h,
2324
+ name: x,
2325
+ ...D,
2326
+ children: [
2327
+ T && V && /* @__PURE__ */ o(
2328
+ K,
2329
+ {
2330
+ className: "scroll-button left",
2331
+ onClick: () => G("left"),
2332
+ children: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ o("polyline", { points: "15 18 9 12 15 6" }) })
2333
+ }
2334
+ ),
2335
+ /* @__PURE__ */ P(K, { className: "rtg-options-container", children: [
2336
+ /* @__PURE__ */ P(
2337
+ K,
2338
+ {
2339
+ className: "rtg-options-wrapper",
2340
+ ref: y,
2341
+ children: [
2342
+ /* @__PURE__ */ o(
2343
+ K,
2344
+ {
2345
+ className: "indicator",
2346
+ style: {
2347
+ width: `${E.width}px`,
2348
+ transform: E.transform
2349
+ }
2350
+ }
2351
+ ),
2352
+ n.map((m, R) => {
2353
+ const { id: F, ...W } = m, C = F || `${e}-option-${R}`;
2354
+ return /* @__PURE__ */ P(w.Fragment, { children: [
2355
+ /* @__PURE__ */ o(
2356
+ "input",
2357
+ {
2358
+ type: "radio",
2359
+ ...W,
2360
+ id: C,
2361
+ name: x,
2362
+ checked: i === m.value,
2363
+ disabled: p || m.disabled,
2364
+ onChange: A
2365
+ }
2366
+ ),
2367
+ /* @__PURE__ */ o(
2368
+ "label",
2369
+ {
2370
+ ref: (te) => M.current[R] = te,
2371
+ htmlFor: C,
2372
+ children: m.label
2373
+ }
2374
+ )
2375
+ ] }, C);
2376
+ })
2377
+ ]
2378
+ }
2379
+ ),
2380
+ T && O && /* @__PURE__ */ o(
2381
+ K,
2382
+ {
2383
+ className: "scroll-button right",
2384
+ onClick: () => G("right"),
2385
+ children: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ o("polyline", { points: "9 6 15 12 9 18" }) })
2386
+ }
2387
+ )
2388
+ ] })
2389
+ ]
2390
+ }
2391
+ )
2392
+ }
2393
+ );
2394
+ }
2395
+ );
2396
+ Yt.displayName = "RadioTabGroup";
2397
+ function Jt(e) {
2398
+ return Array.isArray(e.value);
2399
+ }
2400
+ const Zt = w.forwardRef(
2401
+ (e, t) => Jt(e) ? /* @__PURE__ */ o(ct, { ...e, forwardedRef: t }) : /* @__PURE__ */ o(lt, { ...e, forwardedRef: t })
2402
+ );
2403
+ Zt.displayName = "Range";
2404
+ const lt = ({
2405
+ label: e,
2406
+ helpText: t,
2407
+ errorText: a,
2408
+ value: r = 0,
2409
+ suffix: l,
2410
+ onChange: n,
2411
+ min: s = 0,
2412
+ max: i = 100,
2413
+ step: c = 1,
2414
+ id: d,
2415
+ disabled: u,
2416
+ ...f
2417
+ }) => {
2418
+ const { wrapperProps: p } = ie(f), g = J(null), b = J(null), [x, y] = X(!1), [E, v] = X(!1), T = Math.max(s, Math.min(i, r)), H = _((A) => i <= s ? 0 : (Math.max(s, Math.min(i, A)) - s) / (i - s) * 100, [s, i]), k = _((A) => {
2419
+ if (!b.current) return s;
2420
+ const S = b.current.getBoundingClientRect(), D = Math.max(0, Math.min(1, (A - S.left) / S.width)), G = s + D * (i - s), V = Math.round(G / c) * c;
2421
+ return Math.max(s, Math.min(i, V));
2422
+ }, [s, i, c]), N = _((A) => {
2423
+ const S = k(A);
2424
+ n == null || n(S);
2425
+ }, [k, n]), $ = _((A) => {
2426
+ u || (A.preventDefault(), y(!0), v(!0), N(A.clientX));
2427
+ }, [u, N]);
2428
+ q(() => {
2429
+ if (!x) return;
2430
+ const A = (D) => {
2431
+ N(D.clientX);
2432
+ }, S = () => {
2433
+ y(!1);
2434
+ };
2435
+ return document.addEventListener("mousemove", A), document.addEventListener("mouseup", S), () => {
2436
+ document.removeEventListener("mousemove", A), document.removeEventListener("mouseup", S);
2437
+ };
2438
+ }, [x, N]);
2439
+ const L = _((A) => {
2440
+ u || (y(!0), v(!0), N(A.touches[0].clientX));
2441
+ }, [u, N]);
2442
+ q(() => {
2443
+ if (!x) return;
2444
+ const A = (D) => {
2445
+ D.preventDefault(), N(D.touches[0].clientX);
2446
+ }, S = () => {
2447
+ y(!1);
2448
+ };
2449
+ return document.addEventListener("touchmove", A, { passive: !1 }), document.addEventListener("touchend", S), () => {
2450
+ document.removeEventListener("touchmove", A), document.removeEventListener("touchend", S);
2451
+ };
2452
+ }, [x, N]);
2453
+ const M = _((A) => {
2454
+ if (u) return;
2455
+ let S = T;
2456
+ switch (A.key) {
2457
+ case "ArrowRight":
2458
+ case "ArrowUp":
2459
+ A.preventDefault(), S = Math.min(T + c, i);
2460
+ break;
2461
+ case "ArrowLeft":
2462
+ case "ArrowDown":
2463
+ A.preventDefault(), S = Math.max(T - c, s);
2464
+ break;
2465
+ case "Home":
2466
+ A.preventDefault(), S = s;
2467
+ break;
2468
+ case "End":
2469
+ A.preventDefault(), S = i;
2470
+ break;
2471
+ case "PageUp":
2472
+ A.preventDefault(), S = Math.min(T + c * 10, i);
2473
+ break;
2474
+ case "PageDown":
2475
+ A.preventDefault(), S = Math.max(T - c * 10, s);
2476
+ break;
2477
+ default:
2478
+ return;
2479
+ }
2480
+ n == null || n(S);
2481
+ }, [u, T, s, i, c, n]), z = H(T);
2482
+ return /* @__PURE__ */ o(
2483
+ Z,
2484
+ {
2485
+ customLabel: e && /* @__PURE__ */ P(K, { "data-range-meta": !0, children: [
2486
+ /* @__PURE__ */ o(
2487
+ ke,
2488
+ {
2489
+ className: "range-label",
2490
+ label: e,
2491
+ htmlFor: d
2492
+ }
2493
+ ),
2494
+ /* @__PURE__ */ P(Y, { className: "range-value", children: [
2495
+ T,
2496
+ l && l
2497
+ ] })
2498
+ ] }),
2499
+ helpText: t,
2500
+ errorText: a,
2501
+ ...p,
2502
+ children: /* @__PURE__ */ P(
2503
+ K,
2504
+ {
2505
+ ref: b,
2506
+ "data-range-single": !0,
2507
+ className: u ? "disabled" : "",
2508
+ role: "group",
2509
+ "aria-labelledby": e ? `${d}-label` : void 0,
2510
+ children: [
2511
+ /* @__PURE__ */ o(K, { className: "range-track", "aria-hidden": "true" }),
2512
+ /* @__PURE__ */ o(
2513
+ K,
2514
+ {
2515
+ className: "range-track-fill",
2516
+ style: {
2517
+ left: "0%",
2518
+ right: `${100 - z}%`
2519
+ },
2520
+ "aria-hidden": "true"
2521
+ }
2522
+ ),
2523
+ /* @__PURE__ */ o(
2524
+ "button",
2525
+ {
2526
+ ref: g,
2527
+ id: d,
2528
+ type: "button",
2529
+ className: "range-thumb",
2530
+ style: { left: `${z}%` },
2531
+ disabled: u,
2532
+ onMouseDown: $,
2533
+ onTouchStart: L,
2534
+ onKeyDown: M,
2535
+ onFocus: () => v(!0),
2536
+ onBlur: () => v(!1),
2537
+ "data-active": E || x,
2538
+ role: "slider",
2539
+ "aria-valuemin": s,
2540
+ "aria-valuemax": i,
2541
+ "aria-valuenow": T,
2542
+ "aria-valuetext": `${T}${l ? ` ${l}` : ""}`,
2543
+ "aria-orientation": "horizontal"
2544
+ }
2545
+ )
2546
+ ]
2547
+ }
2548
+ )
2549
+ }
2550
+ );
2551
+ };
2552
+ lt.displayName = "SingleThumbRange";
2553
+ const ct = ({
2554
+ label: e,
2555
+ helpText: t,
2556
+ errorText: a,
2557
+ value: r = [0, 100],
2558
+ suffix: l,
2559
+ onChange: n,
2560
+ min: s = 0,
2561
+ max: i = 100,
2562
+ step: c = 1,
2563
+ minLabel: d = "Minimum value",
2564
+ maxLabel: u = "Maximum value",
2565
+ id: f,
2566
+ disabled: p,
2567
+ ...g
2568
+ }) => {
2569
+ const { wrapperProps: b } = ie(g), [x, y] = r, E = Math.max(s, Math.min(i, x)), v = Math.max(s, Math.min(i, y)), T = J(null), H = J(null), k = J(null), [N, $] = X(null), [L, M] = X(null), z = _((m) => i <= s ? 0 : (Math.max(s, Math.min(i, m)) - s) / (i - s) * 100, [s, i]), A = _((m) => {
2570
+ if (!k.current) return s;
2571
+ const R = k.current.getBoundingClientRect(), F = Math.max(0, Math.min(1, (m - R.left) / R.width)), W = s + F * (i - s), C = Math.round(W / c) * c;
2572
+ return Math.max(s, Math.min(i, C));
2573
+ }, [s, i, c]), S = _((m, R) => {
2574
+ const F = A(m);
2575
+ if (R === "min") {
2576
+ const W = Math.min(F, v - c);
2577
+ n == null || n([W, v]);
2578
+ } else {
2579
+ const W = Math.max(F, E + c);
2580
+ n == null || n([E, W]);
2581
+ }
2582
+ }, [A, E, v, c, n]), D = _((m) => (R) => {
2583
+ p || (R.preventDefault(), $(m), M(m), S(R.clientX, m));
2584
+ }, [p, S]);
2585
+ q(() => {
2586
+ if (!N) return;
2587
+ const m = (F) => {
2588
+ S(F.clientX, N);
2589
+ }, R = () => {
2590
+ $(null);
2591
+ };
2592
+ return document.addEventListener("mousemove", m), document.addEventListener("mouseup", R), () => {
2593
+ document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", R);
2594
+ };
2595
+ }, [N, S]);
2596
+ const G = _((m) => (R) => {
2597
+ p || ($(m), M(m), S(R.touches[0].clientX, m));
2598
+ }, [p, S]);
2599
+ q(() => {
2600
+ if (!N) return;
2601
+ const m = (F) => {
2602
+ F.preventDefault(), S(F.touches[0].clientX, N);
2603
+ }, R = () => {
2604
+ $(null);
2605
+ };
2606
+ return document.addEventListener("touchmove", m, { passive: !1 }), document.addEventListener("touchend", R), () => {
2607
+ document.removeEventListener("touchmove", m), document.removeEventListener("touchend", R);
2608
+ };
2609
+ }, [N, S]);
2610
+ const V = _((m) => (R) => {
2611
+ if (p) return;
2612
+ const F = m === "min" ? E : v;
2613
+ let W = F;
2614
+ switch (R.key) {
2615
+ case "ArrowRight":
2616
+ case "ArrowUp":
2617
+ R.preventDefault(), W = Math.min(F + c, i);
2618
+ break;
2619
+ case "ArrowLeft":
2620
+ case "ArrowDown":
2621
+ R.preventDefault(), W = Math.max(F - c, s);
2622
+ break;
2623
+ case "Home":
2624
+ R.preventDefault(), W = m === "min" ? s : E + c;
2625
+ break;
2626
+ case "End":
2627
+ R.preventDefault(), W = m === "max" ? i : v - c;
2628
+ break;
2629
+ case "PageUp":
2630
+ R.preventDefault(), W = Math.min(F + c * 10, i);
2631
+ break;
2632
+ case "PageDown":
2633
+ R.preventDefault(), W = Math.max(F - c * 10, s);
2634
+ break;
2635
+ default:
2636
+ return;
2637
+ }
2638
+ if (m === "min") {
2639
+ const C = Math.min(W, v - c);
2640
+ n == null || n([C, v]);
2641
+ } else {
2642
+ const C = Math.max(W, E + c);
2643
+ n == null || n([E, C]);
2644
+ }
2645
+ }, [p, E, v, s, i, c, n]), O = z(E), h = z(v);
2646
+ return /* @__PURE__ */ o(
2647
+ Z,
2648
+ {
2649
+ customLabel: e && /* @__PURE__ */ P(K, { "data-range-meta": !0, children: [
2650
+ /* @__PURE__ */ o(
2651
+ ke,
2652
+ {
2653
+ className: "range-label",
2654
+ label: e,
2655
+ htmlFor: f
2656
+ }
2657
+ ),
2658
+ /* @__PURE__ */ P(Y, { className: "range-value", children: [
2659
+ E,
2660
+ "–",
2661
+ v,
2662
+ l && l
2663
+ ] })
2664
+ ] }),
2665
+ helpText: t,
2666
+ errorText: a,
2667
+ ...b,
2668
+ children: /* @__PURE__ */ P(
2669
+ K,
2670
+ {
2671
+ ref: k,
2672
+ "data-range-dual": !0,
2673
+ className: p ? "disabled" : "",
2674
+ role: "group",
2675
+ "aria-labelledby": e ? `${f}-label` : void 0,
2676
+ children: [
2677
+ /* @__PURE__ */ o(K, { className: "range-track", "aria-hidden": "true" }),
2678
+ /* @__PURE__ */ o(
2679
+ K,
2680
+ {
2681
+ className: "range-track-fill",
2682
+ style: {
2683
+ left: `${O}%`,
2684
+ right: `${100 - h}%`
2685
+ },
2686
+ "aria-hidden": "true"
2687
+ }
2688
+ ),
2689
+ /* @__PURE__ */ o(
2690
+ "button",
2691
+ {
2692
+ ref: T,
2693
+ id: `${f}-min`,
2694
+ type: "button",
2695
+ className: "range-thumb range-thumb-min",
2696
+ style: { left: `${O}%` },
2697
+ disabled: p,
2698
+ onMouseDown: D("min"),
2699
+ onTouchStart: G("min"),
2700
+ onKeyDown: V("min"),
2701
+ onFocus: () => M("min"),
2702
+ onBlur: () => M(null),
2703
+ "data-active": L === "min" || N === "min",
2704
+ role: "slider",
2705
+ "aria-label": d,
2706
+ "aria-valuemin": s,
2707
+ "aria-valuemax": v - c,
2708
+ "aria-valuenow": E,
2709
+ "aria-valuetext": `${E}${l ? ` ${l}` : ""}`,
2710
+ "aria-orientation": "horizontal"
2711
+ }
2712
+ ),
2713
+ /* @__PURE__ */ o(
2714
+ "button",
2715
+ {
2716
+ ref: H,
2717
+ id: `${f}-max`,
2718
+ type: "button",
2719
+ className: "range-thumb range-thumb-max",
2720
+ style: { left: `${h}%` },
2721
+ disabled: p,
2722
+ onMouseDown: D("max"),
2723
+ onTouchStart: G("max"),
2724
+ onKeyDown: V("max"),
2725
+ onFocus: () => M("max"),
2726
+ onBlur: () => M(null),
2727
+ "data-active": L === "max" || N === "max",
2728
+ role: "slider",
2729
+ "aria-label": u,
2730
+ "aria-valuemin": E + c,
2731
+ "aria-valuemax": i,
2732
+ "aria-valuenow": v,
2733
+ "aria-valuetext": `${v}${l ? ` ${l}` : ""}`,
2734
+ "aria-orientation": "horizontal"
2735
+ }
2736
+ )
2737
+ ]
2738
+ }
2739
+ )
2740
+ }
2741
+ );
2742
+ };
2743
+ ct.displayName = "DualThumbRange";
2744
+ const Qt = w.forwardRef(
2745
+ ({
2746
+ label: e,
2747
+ value: t,
2748
+ height: a,
2749
+ suffix: r,
2750
+ showOptimumMarker: l,
2751
+ ariaLabel: n,
2752
+ description: s,
2753
+ min: i,
2754
+ max: c,
2755
+ low: d,
2756
+ high: u,
2757
+ optimum: f,
2758
+ ...p
2759
+ }, g) => {
2760
+ const b = f ? (f - i) / (c - i) * 100 : 0, x = () => {
2761
+ const v = (t - i) / (c - i) * 100;
2762
+ let T;
2763
+ return t <= d ? T = "Low" : t >= u ? T = "High" : T = "Normal", `Current value is ${t}${r || ""} (${v.toFixed(1)}%). Status: ${T}`;
2764
+ }, { wrapperProps: y, inputProps: E } = ie(p);
2765
+ return /* @__PURE__ */ P(
2766
+ I,
2767
+ {
2768
+ as: "div",
2769
+ role: "region",
2770
+ "aria-label": n || "Meter indicator",
2771
+ ...y,
2772
+ children: [
2773
+ e && /* @__PURE__ */ P(
2774
+ I,
2775
+ {
2776
+ as: "div",
2777
+ "data-meter-meta": !0,
2778
+ id: `meter-label-${e.toLowerCase().replace(/\s+/g, "-")}`,
2779
+ children: [
2780
+ /* @__PURE__ */ o(Y, { children: e }),
2781
+ /* @__PURE__ */ P(Y, { children: [
2782
+ t,
2783
+ r && r
2784
+ ] })
2785
+ ]
2786
+ }
2787
+ ),
2788
+ /* @__PURE__ */ P(
2789
+ "div",
2790
+ {
2791
+ className: "meter-wrapper",
2792
+ role: "presentation",
2793
+ children: [
2794
+ /* @__PURE__ */ o(
2795
+ I,
2796
+ {
2797
+ as: "meter",
2798
+ "data-meter": !0,
2799
+ ref: g,
2800
+ value: t,
2801
+ min: i,
2802
+ max: c,
2803
+ low: d,
2804
+ high: u,
2805
+ optimum: f,
2806
+ ...E,
2807
+ style: { height: a },
2808
+ "aria-label": e || n || "Progress meter",
2809
+ "aria-valuemin": i,
2810
+ "aria-valuemax": c,
2811
+ "aria-valuenow": t,
2812
+ "aria-valuetext": x(),
2813
+ "aria-describedby": s ? `meter-description-${e == null ? void 0 : e.toLowerCase().replace(/\s+/g, "-")}` : void 0
2814
+ }
2815
+ ),
2816
+ l && f && /* @__PURE__ */ o(
2817
+ "div",
2818
+ {
2819
+ className: "optimum-marker",
2820
+ style: { left: `calc(${b}% - var(--meter-border-width))` },
2821
+ title: `Optimum: ${f}`,
2822
+ role: "presentation",
2823
+ "aria-hidden": "true"
2824
+ }
2825
+ )
2826
+ ]
2827
+ }
2828
+ ),
2829
+ s && /* @__PURE__ */ o(
2830
+ "div",
2831
+ {
2832
+ id: `meter-description-${e == null ? void 0 : e.toLowerCase().replace(/\s+/g, "-")}`,
2833
+ className: "sr-only",
2834
+ children: s
2835
+ }
2836
+ )
2837
+ ]
2838
+ }
2839
+ );
2840
+ }
2841
+ );
2842
+ Qt.displayName = "Meter";
2843
+ const ea = w.forwardRef(
2844
+ ({
2845
+ id: e,
2846
+ children: t,
2847
+ classNames: a = [],
2848
+ isOpen: r = !1,
2849
+ onClose: l,
2850
+ isDismissible: n = !0,
2851
+ showBackdrop: s,
2852
+ blurBackdrop: i,
2853
+ label: c,
2854
+ description: d,
2855
+ ...u
2856
+ }, f) => {
2857
+ const p = `${e}`, g = d ? `${p}-description` : void 0;
2858
+ return s && a.push("show-backdrop"), i && a.push("blur-backdrop"), q(() => {
2859
+ const b = document.querySelector(`#${p}[data-modal]`);
2860
+ if (!(!b || !(b instanceof HTMLElement)))
2861
+ if (r) {
2862
+ b.showPopover();
2863
+ const x = b.querySelectorAll(
2864
+ 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
2865
+ );
2866
+ x.length && x[0].focus();
2867
+ } else
2868
+ b.matches(":popover-open") && b.hidePopover();
2869
+ }, [r, p]), q(() => {
2870
+ const b = document.querySelector(`#${p}[data-modal]`);
2871
+ if (!b || !(b instanceof HTMLElement)) return;
2872
+ const x = (y) => {
2873
+ y.newState === "closed" && r && l && l();
2874
+ };
2875
+ return b.addEventListener("toggle", x), () => b.removeEventListener("toggle", x);
2876
+ }, [p, r, l]), /* @__PURE__ */ P(
2877
+ I,
2878
+ {
2879
+ as: "dialog",
2880
+ id: p,
2881
+ "data-modal": !0,
2882
+ popover: n ? "auto" : "manual",
2883
+ ref: f,
2884
+ classNames: a,
2885
+ role: "dialog",
2886
+ "aria-modal": "true",
2887
+ "aria-label": c || "Modal dialog",
2888
+ "aria-describedby": g,
2889
+ ...u,
2890
+ children: [
2891
+ n && l && /* @__PURE__ */ o(
2892
+ Y,
2893
+ {
2894
+ className: "dismiss-button",
2895
+ onClick: l,
2896
+ "aria-label": "Close modal",
2897
+ tabIndex: 0,
2898
+ children: "×"
2899
+ }
2900
+ ),
2901
+ d && /* @__PURE__ */ o("div", { id: g, className: "sr-only", children: d }),
2902
+ /* @__PURE__ */ o("div", { role: "document", children: t })
2903
+ ]
2904
+ }
2905
+ );
2906
+ }
2907
+ );
2908
+ ea.displayName = "Modal";
2909
+ const dt = w.forwardRef(
2910
+ ({
2911
+ position: e = "right",
2912
+ anchor: t = "top",
2913
+ order: a = "new-on-top",
2914
+ kind: r = "list",
2915
+ children: l,
2916
+ label: n,
2917
+ ...s
2918
+ }, i) => {
2919
+ let c = [];
2920
+ return e && c.push(e), t && c.push(t), a && c.push(a), r && c.push(r), w.Children.count(l) === 0 ? null : /* @__PURE__ */ o(
2921
+ I,
2922
+ {
2923
+ as: "section",
2924
+ "data-notifications-wrapper": !0,
2925
+ ref: i,
2926
+ classNames: c,
2927
+ "aria-label": n || "Notifications",
2928
+ "aria-relevant": "additions removals",
2929
+ role: "log",
2930
+ ...s,
2931
+ children: l
2932
+ }
2933
+ );
2934
+ }
2935
+ );
2936
+ dt.displayName = "NotificationsWrapper";
2937
+ const ta = {
2938
+ generic: "status",
2939
+ info: "status",
2940
+ warning: "alert",
2941
+ error: "alert",
2942
+ success: "status"
2943
+ }, ut = ({
2944
+ id: e,
2945
+ kind: t = "generic",
2946
+ duration: a = 4,
2947
+ isDismissible: r = !0,
2948
+ onClose: l,
2949
+ children: n
2950
+ }) => {
2951
+ const [s, i] = X(!1);
2952
+ q(() => {
2953
+ if (a === 0) return;
2954
+ const p = setTimeout(() => {
2955
+ i(!0);
2956
+ }, a * 1e3);
2957
+ return () => clearTimeout(p);
2958
+ }, [a]), q(() => {
2959
+ if (!s) return;
2960
+ const p = setTimeout(() => {
2961
+ l();
2962
+ }, 500);
2963
+ return () => clearTimeout(p);
2964
+ }, [s, l]);
2965
+ const c = (p) => {
2966
+ p.preventDefault(), i(!0);
2967
+ }, d = (p) => {
2968
+ (p.key === "Enter" || p.key === " ") && (p.preventDefault(), i(!0));
2969
+ }, u = () => {
2970
+ s && l();
2971
+ }, f = [t];
2972
+ return r && f.push("dismissible"), s && f.push("dismissed"), /* @__PURE__ */ P(
2973
+ I,
2974
+ {
2975
+ as: "div",
2976
+ "data-notification-item": !0,
2977
+ id: e,
2978
+ classNames: f,
2979
+ onTransitionEnd: u,
2980
+ role: ta[t],
2981
+ "aria-live": t === "error" || t === "warning" ? "assertive" : "polite",
2982
+ "aria-atomic": "true",
2983
+ children: [
2984
+ /* @__PURE__ */ o("div", { className: "notification-content", children: n }),
2985
+ r && /* @__PURE__ */ o(
2986
+ K,
2987
+ {
2988
+ className: "dismiss-button",
2989
+ onClick: c,
2990
+ onKeyDown: d,
2991
+ "aria-label": "Dismiss notification",
2992
+ tabIndex: 0,
2993
+ children: /* @__PURE__ */ o("span", { className: "sr-only", children: "Close notification" })
2994
+ }
2995
+ )
2996
+ ]
2997
+ }
2998
+ );
2999
+ };
3000
+ ut.displayName = "NotificationItem";
3001
+ const ft = Le(null), aa = ({
3002
+ children: e,
3003
+ position: t = "right",
3004
+ anchor: a = "top",
3005
+ order: r = "new-on-top",
3006
+ kind: l = "list"
3007
+ }) => {
3008
+ const [n, s] = X([]), i = _((f) => {
3009
+ s((p) => p.filter((g) => g.id !== f));
3010
+ }, []), c = _((f, p = "generic", g = 4, b = !0) => {
3011
+ const x = `notification-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
3012
+ return s((y) => [...y, {
3013
+ id: x,
3014
+ content: f,
3015
+ kind: p,
3016
+ duration: g,
3017
+ isDismissible: b
3018
+ }]), x;
3019
+ }, []), d = _((f) => {
3020
+ if (typeof f == "string") {
3021
+ c(f);
3022
+ return;
3023
+ }
3024
+ if (f !== null && typeof f == "object" && "content" in f) {
3025
+ const p = f;
3026
+ c(
3027
+ p.content,
3028
+ p.kind ?? "generic",
3029
+ p.duration ?? 4,
3030
+ p.isDismissible ?? !0
3031
+ );
3032
+ return;
3033
+ }
3034
+ c(f);
3035
+ }, [c]), u = _(() => {
3036
+ const f = d;
3037
+ return f.success = (p) => {
3038
+ c(p, "success");
3039
+ }, f.error = (p) => {
3040
+ c(p, "error");
3041
+ }, f.warning = (p) => {
3042
+ c(p, "warning");
3043
+ }, f.info = (p) => {
3044
+ c(p, "info");
3045
+ }, f;
3046
+ }, [d, c])();
3047
+ return /* @__PURE__ */ P(ft.Provider, { value: { notify: u }, children: [
3048
+ e,
3049
+ /* @__PURE__ */ o(
3050
+ dt,
3051
+ {
3052
+ position: t,
3053
+ anchor: a,
3054
+ order: r,
3055
+ kind: l,
3056
+ children: n.map(({ id: f, content: p, kind: g, duration: b, isDismissible: x }) => /* @__PURE__ */ o(
3057
+ ut,
3058
+ {
3059
+ id: f,
3060
+ kind: g,
3061
+ duration: b,
3062
+ isDismissible: x,
3063
+ onClose: () => i(f),
3064
+ children: typeof p == "function" ? p({ close: () => i(f) }) : p
3065
+ },
3066
+ f
3067
+ ))
3068
+ }
3069
+ )
3070
+ ] });
3071
+ };
3072
+ aa.displayName = "NotificationsProvider";
3073
+ const Ca = () => {
3074
+ const e = ye(ft);
3075
+ if (!e)
3076
+ throw new Error("useNotifications must be used within a NotificationsProvider");
3077
+ return e.notify;
3078
+ }, pt = w.forwardRef(
3079
+ ({
3080
+ size: e = "medium",
3081
+ loadingText: t = "Loading...",
3082
+ ...a
3083
+ }, r) => {
3084
+ let l = [];
3085
+ return e && l.push(`size-${e}`), /* @__PURE__ */ o(
3086
+ I,
3087
+ {
3088
+ as: "div",
3089
+ "data-spinner": !0,
3090
+ ref: r,
3091
+ classNames: l,
3092
+ role: "status",
3093
+ "aria-busy": "true",
3094
+ "aria-live": "polite",
3095
+ "aria-label": t,
3096
+ ...a
3097
+ }
3098
+ );
3099
+ }
3100
+ );
3101
+ pt.displayName = "Spinner";
3102
+ const Ue = (e, t) => {
3103
+ const a = t - e + 1;
3104
+ return Array.from({ length: a }, (r, l) => e + l);
3105
+ }, ra = ({
3106
+ totalItems: e,
3107
+ currentPage: t,
3108
+ itemsToShowEachSide: a
3109
+ }) => {
3110
+ const r = e;
3111
+ return {
3112
+ items: (() => {
3113
+ const n = a * 2 + 1;
3114
+ let s = [];
3115
+ if (r <= n)
3116
+ s = Ue(1, r);
3117
+ else {
3118
+ const i = Math.min(t - 1, a), c = Math.min(r - t, a);
3119
+ s.push(1), t - a > 2 && s.push("...");
3120
+ const d = Math.max(2, t - i), u = Math.min(r - 1, t + c);
3121
+ s.push(...Ue(d, u)), r - t > a + 1 && s.push("..."), u < r && s.push(r);
3122
+ }
3123
+ return s;
3124
+ })(),
3125
+ totalPages: r,
3126
+ rangeStart: t,
3127
+ rangeEnd: t,
3128
+ hasPrevPage: t > 1,
3129
+ hasNextPage: t < r
3130
+ };
3131
+ }, sa = ({
3132
+ type: e,
3133
+ page: t,
3134
+ selected: a,
3135
+ disabled: r,
3136
+ onClick: l,
3137
+ key: n,
3138
+ ...s
3139
+ }) => {
3140
+ if (e === "ellipsis")
3141
+ return /* @__PURE__ */ o(Y, { className: "pagination-ellipsis", children: "..." });
3142
+ const i = {
3143
+ type: "button",
3144
+ className: `pagination-item ${a ? "selected" : ""} ${r ? "disabled" : ""}`,
3145
+ onClick: l,
3146
+ disabled: r,
3147
+ ...s
3148
+ };
3149
+ let c;
3150
+ switch (e) {
3151
+ case "first":
3152
+ c = c = /* @__PURE__ */ P("svg", { viewBox: "0 0 24 24", children: [
3153
+ /* @__PURE__ */ o("line", { x1: "5", y1: "18", x2: "5", y2: "6" }),
3154
+ /* @__PURE__ */ o("polyline", { points: "14 18 9 12 14 6" }),
3155
+ /* @__PURE__ */ o("line", { x1: "10", y1: "12", x2: "19", y2: "12" })
3156
+ ] });
3157
+ break;
3158
+ case "previous":
3159
+ c = /* @__PURE__ */ P("svg", { viewBox: "0 0 24 24", children: [
3160
+ /* @__PURE__ */ o("polyline", { points: "12 18 7 12 12 6" }),
3161
+ /* @__PURE__ */ o("line", { x1: "8", y1: "12", x2: "17", y2: "12" })
3162
+ ] });
3163
+ break;
3164
+ case "next":
3165
+ c = c = /* @__PURE__ */ P("svg", { viewBox: "0 0 24 24", children: [
3166
+ /* @__PURE__ */ o("polyline", { points: "12 6 17 12 12 18" }),
3167
+ /* @__PURE__ */ o("line", { x1: "16", y1: "12", x2: "7", y2: "12" })
3168
+ ] });
3169
+ break;
3170
+ case "last":
3171
+ c = c = /* @__PURE__ */ P("svg", { viewBox: "0 0 24 24", children: [
3172
+ /* @__PURE__ */ o("polyline", { points: "10 6 15 12 10 18" }),
3173
+ /* @__PURE__ */ o("line", { x1: "19", y1: "6", x2: "19", y2: "18" }),
3174
+ /* @__PURE__ */ o("line", { x1: "14", y1: "12", x2: "5", y2: "12" })
3175
+ ] });
3176
+ break;
3177
+ default:
3178
+ c = t;
3179
+ }
3180
+ return /* @__PURE__ */ o(
3181
+ ze,
3182
+ {
3183
+ kind: "custom",
3184
+ ...i,
3185
+ children: c
3186
+ }
3187
+ );
3188
+ }, na = w.forwardRef(
3189
+ ({
3190
+ totalItems: e,
3191
+ currentPage: t,
3192
+ onPageChange: a,
3193
+ itemsToShowEachSide: r = 1,
3194
+ kind: l = "plain",
3195
+ showGoToFirstItemButton: n = !0,
3196
+ showGoToLastItemButton: s = !0,
3197
+ showPreviousButton: i = !0,
3198
+ showNextButton: c = !0,
3199
+ showGoToInput: d = !1,
3200
+ disabled: u = !1,
3201
+ hideDisabledButtons: f = !1,
3202
+ renderItem: p = sa,
3203
+ isLoading: g = !1,
3204
+ loadingText: b,
3205
+ emptyText: x,
3206
+ itemDisplayText: y = "Page",
3207
+ ...E
3208
+ }, v) => {
3209
+ const {
3210
+ items: T,
3211
+ totalPages: H,
3212
+ rangeStart: k,
3213
+ hasPrevPage: N,
3214
+ hasNextPage: $
3215
+ } = ra({
3216
+ totalItems: e,
3217
+ currentPage: t,
3218
+ itemsToShowEachSide: r
3219
+ }), [L, M] = w.useState(""), z = (D) => {
3220
+ M(D.target.value);
3221
+ }, A = (D) => {
3222
+ if (D.key === "Enter") {
3223
+ const G = parseInt(L);
3224
+ !isNaN(G) && G >= 1 && G <= H && (a(G), M(""));
3225
+ }
3226
+ };
3227
+ if (e === 0)
3228
+ return /* @__PURE__ */ o(Y, { className: "pagination-empty", children: x || "No items to display" });
3229
+ let S = ["pagination"];
3230
+ return l && S.push(l), u && S.push("disabled"), g && S.push("loading"), /* @__PURE__ */ P(
3231
+ I,
3232
+ {
3233
+ as: "nav",
3234
+ "data-pagination": !0,
3235
+ ref: v,
3236
+ classNames: S,
3237
+ role: "navigation",
3238
+ "aria-label": "pagination",
3239
+ ...E,
3240
+ children: [
3241
+ /* @__PURE__ */ P(K, { className: "pagination-controls", children: [
3242
+ n && (!f || N) && p({
3243
+ type: "first",
3244
+ disabled: !N || u,
3245
+ selected: !1,
3246
+ onClick: () => a(1)
3247
+ }),
3248
+ i && (!f || N) && p({
3249
+ type: "previous",
3250
+ disabled: !N || u,
3251
+ selected: !1,
3252
+ onClick: () => a(t - 1)
3253
+ }),
3254
+ T.map((D, G) => {
3255
+ const V = D === "..." ? {
3256
+ key: `ellipsis-${G}`,
3257
+ type: "ellipsis",
3258
+ selected: !1,
3259
+ disabled: !0
3260
+ } : {
3261
+ key: D.toString(),
3262
+ type: "page",
3263
+ page: D,
3264
+ selected: D === t,
3265
+ disabled: u,
3266
+ "aria-current": D === t ? "page" : void 0,
3267
+ onClick: () => a(D)
3268
+ };
3269
+ return p(V);
3270
+ }),
3271
+ c && (!f || $) && p({
3272
+ type: "next",
3273
+ disabled: !$ || u,
3274
+ selected: !1,
3275
+ onClick: () => a(t + 1)
3276
+ }),
3277
+ s && (!f || $) && p({
3278
+ type: "last",
3279
+ disabled: !$ || u,
3280
+ selected: !1,
3281
+ onClick: () => a(H)
3282
+ }),
3283
+ g && /* @__PURE__ */ P(K, { className: "pagination-loading", children: [
3284
+ /* @__PURE__ */ o(pt, {}),
3285
+ b && /* @__PURE__ */ o(Y, { size: "small", children: b })
3286
+ ] })
3287
+ ] }),
3288
+ /* @__PURE__ */ P(K, { className: "pagination-info", children: [
3289
+ /* @__PURE__ */ P(Y, { size: "tiny", children: [
3290
+ y,
3291
+ " ",
3292
+ k,
3293
+ " of ",
3294
+ e
3295
+ ] }),
3296
+ d && /* @__PURE__ */ o(K, { className: "pagination-go-to", children: /* @__PURE__ */ o(
3297
+ "input",
3298
+ {
3299
+ type: "number",
3300
+ min: 1,
3301
+ max: H,
3302
+ value: L,
3303
+ onChange: z,
3304
+ onKeyDown: A,
3305
+ placeholder: `Go to ${y}`,
3306
+ "aria-label": `Go to ${y}`,
3307
+ disabled: u
3308
+ }
3309
+ ) })
3310
+ ] })
3311
+ ]
3312
+ }
3313
+ );
3314
+ }
3315
+ );
3316
+ na.displayName = "Pagination";
3317
+ const oa = w.forwardRef(
3318
+ ({
3319
+ label: e,
3320
+ value: t,
3321
+ height: a,
3322
+ max: r = 100,
3323
+ shape: l,
3324
+ bgColor: n,
3325
+ bgColour: s,
3326
+ fillColor: i,
3327
+ fillColour: c,
3328
+ ...d
3329
+ }, u) => {
3330
+ const f = Math.max(0, Math.min(r, Number(t) || 0)), p = `${f}${d.suffix || ""}`, g = s || n, b = c || i, x = {
3331
+ height: a,
3332
+ ...g && { "--progress-bar-bg": `var(--${g})` },
3333
+ ...b && { "--progress-bar-fill": `var(--${b})` }
3334
+ };
3335
+ return /* @__PURE__ */ P(Ne, { children: [
3336
+ e && /* @__PURE__ */ P(
3337
+ I,
3338
+ {
3339
+ as: "div",
3340
+ "data-progress-bar-meta": !0,
3341
+ "aria-hidden": "true",
3342
+ children: [
3343
+ /* @__PURE__ */ o(Y, { children: e }),
3344
+ /* @__PURE__ */ o(Y, { children: p })
3345
+ ]
3346
+ }
3347
+ ),
3348
+ /* @__PURE__ */ o(
3349
+ I,
3350
+ {
3351
+ as: "progress",
3352
+ "data-progress-bar": !0,
3353
+ ref: u,
3354
+ value: f,
3355
+ max: r,
3356
+ "aria-label": e,
3357
+ "aria-valuemin": 0,
3358
+ "aria-valuemax": r,
3359
+ "aria-valuenow": f,
3360
+ "aria-valuetext": `${e ? `${e}: ` : ""}${p}`,
3361
+ shape: l,
3362
+ ...d,
3363
+ style: x
3364
+ }
3365
+ )
3366
+ ] });
3367
+ }
3368
+ );
3369
+ oa.displayName = "ProgressBar";
3370
+ const Oe = Le({
3371
+ isSelected: () => !1,
3372
+ toggleSelection: () => {
3373
+ },
3374
+ showTickIcon: !1,
3375
+ tickPosition: "top-right",
3376
+ selectAllOptions: () => {
3377
+ },
3378
+ clearAllOptions: () => {
3379
+ },
3380
+ setSelectedOptions: () => {
3381
+ },
3382
+ setSelectedIds: () => {
3383
+ },
3384
+ registerOption: () => {
3385
+ },
3386
+ unregisterOption: () => {
3387
+ }
3388
+ }), ia = w.forwardRef(
3389
+ ({
3390
+ children: e,
3391
+ allowMultipleSelections: t = !1,
3392
+ showTickIcon: a,
3393
+ onSelectionChange: r,
3394
+ tickPosition: l = "top-right",
3395
+ selectionLimit: n,
3396
+ defaultSelectedIds: s,
3397
+ ...i
3398
+ }, c) => {
3399
+ const [d, u] = X(
3400
+ s ? new Set(s) : /* @__PURE__ */ new Set()
3401
+ ), f = J(/* @__PURE__ */ new Map());
3402
+ q(() => {
3403
+ s && s.size > 0 && (u(new Set(s)), r == null || r(new Set(s)));
3404
+ }, [s, r]);
3405
+ const p = _((k, N) => {
3406
+ f.current.set(k, N);
3407
+ }, []), g = _((k) => {
3408
+ f.current.delete(k);
3409
+ }, []), b = _((k) => {
3410
+ u((N) => {
3411
+ const $ = new Set(N);
3412
+ if (t)
3413
+ if ($.has(k))
3414
+ $.delete(k);
3415
+ else {
3416
+ if (n && $.size >= n)
3417
+ return N;
3418
+ $.add(k);
3419
+ }
3420
+ else
3421
+ $.has(k) && N.size === 1 ? $.clear() : ($.clear(), $.add(k));
3422
+ return r == null || r($), $;
3423
+ });
3424
+ }, [t, r, n]), x = _(() => {
3425
+ t && u((k) => {
3426
+ const N = new Set(k), $ = Array.from(f.current.entries()).filter(([M, z]) => !z).map(([M]) => M);
3427
+ return (n ? $.slice(0, n) : $).forEach((M) => N.add(M)), r == null || r(N), N;
3428
+ });
3429
+ }, [t, n, r]), y = _(() => {
3430
+ u(/* @__PURE__ */ new Set()), r == null || r(/* @__PURE__ */ new Set());
3431
+ }, [r]), E = _((k) => {
3432
+ k && (console.log("Setting selected options:", k), u(() => {
3433
+ const N = new Set(k);
3434
+ return r == null || r(N), N;
3435
+ }));
3436
+ }, [r]), v = _((k) => {
3437
+ k && (console.log("Setting selected ids:", Array.from(k)), u(() => {
3438
+ const N = new Set(k);
3439
+ return r == null || r(N), N;
3440
+ }));
3441
+ }, [r]), T = _((k) => d.has(k), [d]);
3442
+ w.useImperativeHandle(c, () => ({
3443
+ selectAllOptions: x,
3444
+ clearAllOptions: y,
3445
+ setSelectedOptions: E,
3446
+ setSelectedIds: v
3447
+ }), [x, y, E, v]);
3448
+ const H = {
3449
+ isSelected: T,
3450
+ toggleSelection: b,
3451
+ showTickIcon: a,
3452
+ tickPosition: l,
3453
+ selectAllOptions: x,
3454
+ clearAllOptions: y,
3455
+ setSelectedOptions: E,
3456
+ setSelectedIds: v,
3457
+ registerOption: p,
3458
+ unregisterOption: g
3459
+ };
3460
+ return /* @__PURE__ */ o(Oe.Provider, { value: H, children: /* @__PURE__ */ o(K, { "data-option-cards-group": !0, className: `tick-${l}`, children: e }) });
3461
+ }
3462
+ );
3463
+ ia.displayName = "OptionCardsGroup";
3464
+ const Ua = (e) => {
3465
+ const t = ye(Oe);
3466
+ return {
3467
+ isSelected: t.isSelected(e),
3468
+ toggleSelection: () => t.toggleSelection(e),
3469
+ showTickIcon: t.showTickIcon
3470
+ };
3471
+ }, qa = () => {
3472
+ const {
3473
+ selectAllOptions: e,
3474
+ clearAllOptions: t,
3475
+ setSelectedOptions: a,
3476
+ setSelectedIds: r
3477
+ } = ye(Oe);
3478
+ return {
3479
+ selectAllOptions: e,
3480
+ clearAllOptions: t,
3481
+ setSelectedOptions: a,
3482
+ setSelectedIds: r
3483
+ };
3484
+ }, Ya = ({ id: e, children: t, disabled: a = !1, ...r }) => {
3485
+ const { isSelected: l, toggleSelection: n, showTickIcon: s, registerOption: i, unregisterOption: c } = ye(Oe), [d, u] = X(!1), [f, p] = X(!0);
3486
+ w.useEffect(() => (i(e, a), () => c(e)), [e, a, i, c]);
3487
+ let g = [];
3488
+ l(e) && g.push("selected"), a && g.push("disabled"), d && g.push("show-deselect");
3489
+ const b = () => {
3490
+ l(e) && !f && u(!0);
3491
+ }, x = () => {
3492
+ u(!1), p(!1);
3493
+ }, y = (v) => {
3494
+ var T;
3495
+ a || (p(!0), u(!1), n(e), (T = r.onClick) == null || T.call(r, v));
3496
+ }, E = (v) => {
3497
+ (v.key === "Enter" || v.key === " ") && !a && (v.preventDefault(), p(!0), u(!1), n(e));
3498
+ };
3499
+ return /* @__PURE__ */ P(
3500
+ I,
3501
+ {
3502
+ as: Qe,
3503
+ "data-option-card": !0,
3504
+ role: "button",
3505
+ tabIndex: a ? -1 : 0,
3506
+ "aria-disabled": a,
3507
+ "aria-selected": l(e),
3508
+ classNames: g,
3509
+ onClick: y,
3510
+ onKeyDown: E,
3511
+ onMouseEnter: b,
3512
+ onMouseLeave: x,
3513
+ ...r,
3514
+ children: [
3515
+ s && /* @__PURE__ */ P(Ne, { children: [
3516
+ /* @__PURE__ */ P("svg", { viewBox: "0 0 24 24", className: "tick-icon", children: [
3517
+ /* @__PURE__ */ o("circle", { cx: "12", cy: "12", r: "11" }),
3518
+ /* @__PURE__ */ o("path", { d: "M8 13 L11 15 L16 9" })
3519
+ ] }),
3520
+ /* @__PURE__ */ P("svg", { viewBox: "0 0 24 24", className: "deselect-icon", children: [
3521
+ /* @__PURE__ */ o("circle", { cx: "12", cy: "12", r: "11" }),
3522
+ /* @__PURE__ */ o("path", { d: "M8 8 L16 16 M16 8 L8 16" })
3523
+ ] })
3524
+ ] }),
3525
+ t
3526
+ ]
3527
+ }
3528
+ );
3529
+ }, la = w.forwardRef(
3530
+ ({
3531
+ collapsed: e,
3532
+ closeOnClickOutside: t,
3533
+ showMobileSidebar: a,
3534
+ ...r
3535
+ }, l) => {
3536
+ const n = J(null);
3537
+ Je(l, () => n.current), We(n, () => {
3538
+ typeof t == "function" && t();
3539
+ });
3540
+ let s = [];
3541
+ return e && s.push("collapsed"), a && s.push("show-sidebar"), /* @__PURE__ */ o(
3542
+ I,
3543
+ {
3544
+ as: "aside",
3545
+ "data-sidebar-wrapper": !0,
3546
+ ref: n,
3547
+ classNames: s,
3548
+ ...r
3549
+ }
3550
+ );
3551
+ }
3552
+ );
3553
+ la.displayName = "SidebarWrapper";
3554
+ const ca = w.forwardRef(
3555
+ ({ label: e, ...t }, a) => /* @__PURE__ */ o(
3556
+ I,
3557
+ {
3558
+ as: "main",
3559
+ "data-content-wrapper": !0,
3560
+ ref: a,
3561
+ role: "main",
3562
+ "aria-label": e || "Main content",
3563
+ ...t
3564
+ }
3565
+ )
3566
+ );
3567
+ ca.displayName = "ContentWrapper";
3568
+ const da = w.forwardRef(
3569
+ ({ isSticky: e, ...t }, a) => {
3570
+ let r = [];
3571
+ return e && r.push("is-sticky"), /* @__PURE__ */ o(
3572
+ I,
3573
+ {
3574
+ as: "header",
3575
+ "data-sidebar-header": !0,
3576
+ ref: a,
3577
+ classNames: r,
3578
+ ...t
3579
+ }
3580
+ );
3581
+ }
3582
+ );
3583
+ da.displayName = "SidebarHeader";
3584
+ const ua = w.forwardRef(
3585
+ ({ hasAlert: e, hasEmptyIcon: t, hasNoIcon: a, children: r, ...l }, n) => {
3586
+ let s = [];
3587
+ return e && s.push("has-alert"), t ? s.push("has-empty-icon") : a && s.push("has-no-icon"), /* @__PURE__ */ P(
3588
+ I,
3589
+ {
3590
+ as: "div",
3591
+ "data-sidebar-item": !0,
3592
+ ref: n,
3593
+ classNames: s,
3594
+ ...l,
3595
+ children: [
3596
+ t && /* @__PURE__ */ o(K, { className: "empty-icon-wrapper" }),
3597
+ r
3598
+ ]
3599
+ }
3600
+ );
3601
+ }
3602
+ );
3603
+ ua.displayName = "SidebarItem";
3604
+ const fa = w.forwardRef(
3605
+ ({ isSticky: e, ...t }, a) => {
3606
+ let r = [];
3607
+ return e && r.push("is-sticky"), /* @__PURE__ */ o(
3608
+ I,
3609
+ {
3610
+ as: "footer",
3611
+ "data-sidebar-footer": !0,
3612
+ ref: a,
3613
+ classNames: r,
3614
+ ...t
3615
+ }
3616
+ );
3617
+ }
3618
+ );
3619
+ fa.displayName = "SidebarFooter";
3620
+ const mt = Le({
3621
+ effect: "wave",
3622
+ animate: !0
3623
+ }), pa = w.forwardRef(({
3624
+ variant: e = "line",
3625
+ width: t,
3626
+ height: a,
3627
+ shape: r,
3628
+ effect: l,
3629
+ loadingLabel: n,
3630
+ ...s
3631
+ }, i) => {
3632
+ const c = ye(mt), d = l || c.effect, u = n || c.loadingLabel || "Loading...";
3633
+ let f = [];
3634
+ e && f.push(`variant-${e}`), r && f.push(`shape-${r}`), d && f.push(`effect-${d}`);
3635
+ const p = t || "100%", g = e === "circle" ? (typeof t == "number" ? `${t}px` : t) || a || "100%" : a, b = {
3636
+ width: p,
3637
+ height: g,
3638
+ aspectRatio: e === "circle" ? "1 / 1" : "auto",
3639
+ ...s.style
3640
+ };
3641
+ return /* @__PURE__ */ o(
3642
+ I,
3643
+ {
3644
+ as: "div",
3645
+ "data-skeleton": !0,
3646
+ ref: i,
3647
+ classNames: f,
3648
+ style: b,
3649
+ role: "progressbar",
3650
+ "aria-busy": "true",
3651
+ "aria-valuemin": 0,
3652
+ "aria-valuemax": 100,
3653
+ "aria-valuetext": u,
3654
+ "aria-label": u,
3655
+ ...s
3656
+ }
3657
+ );
3658
+ });
3659
+ pa.displayName = "Skeleton";
3660
+ const ma = w.forwardRef(({
3661
+ effect: e = "wave",
3662
+ spacing: t = "small",
3663
+ animate: a = !0,
3664
+ repeat: r = 1,
3665
+ direction: l = "vertical",
3666
+ children: n,
3667
+ classNames: s = [],
3668
+ loadingLabel: i = "Loading content...",
3669
+ ...c
3670
+ }, d) => {
3671
+ const u = [
3672
+ `direction-${l}`,
3673
+ e && `effect-${e}`,
3674
+ ...s
3675
+ ];
3676
+ return t && u.push(`spacing-${t}`), /* @__PURE__ */ o(mt.Provider, { value: { effect: e, animate: a, loadingLabel: i }, children: /* @__PURE__ */ o(
3677
+ I,
3678
+ {
3679
+ as: "div",
3680
+ ref: d,
3681
+ "data-skeleton-group": !0,
3682
+ classNames: u,
3683
+ role: "alert",
3684
+ "aria-busy": "true",
3685
+ "aria-label": i,
3686
+ ...c,
3687
+ children: Array(r).fill(n).map((f, p) => w.cloneElement(f, {
3688
+ key: p
3689
+ }))
3690
+ }
3691
+ ) });
3692
+ });
3693
+ ma.displayName = "SkeletonGroup";
3694
+ const ha = w.forwardRef(
3695
+ ({
3696
+ bordersFor: e,
3697
+ isStriped: t,
3698
+ highlightRowOnHover: a,
3699
+ isFullWidth: r,
3700
+ alignText: l,
3701
+ caption: n,
3702
+ summary: s,
3703
+ hasColSpan: i,
3704
+ children: c,
3705
+ ...d
3706
+ }, u) => {
3707
+ let f = [];
3708
+ e && f.push(`bordered-${e}`), t && f.push("striped"), a && f.push("hoverable"), r && f.push("full-width"), l && f.push(`align-text-${l}`);
3709
+ const p = w.Children.count(c);
3710
+ return /* @__PURE__ */ P(
3711
+ I,
3712
+ {
3713
+ as: "table",
3714
+ classNames: f,
3715
+ ref: u,
3716
+ role: "table",
3717
+ "aria-rowcount": p || void 0,
3718
+ "aria-colcount": i ? void 0 : (() => {
3719
+ if (!c || !w.isValidElement(c)) return;
3720
+ const b = w.Children.toArray(c)[0];
3721
+ if (w.isValidElement(b) && b.props.children)
3722
+ return w.Children.count(b.props.children);
3723
+ })(),
3724
+ summary: s,
3725
+ ...d,
3726
+ children: [
3727
+ n && /* @__PURE__ */ o("caption", { children: n }),
3728
+ c
3729
+ ]
3730
+ }
3731
+ );
3732
+ }
3733
+ );
3734
+ ha.displayName = "Table";
3735
+ const va = w.forwardRef(
3736
+ ({ tabs: e, additionalNavContentWrapper: t, defaultActiveTab: a, align: r = "left", isFullWidth: l, ...n }, s) => {
3737
+ const i = e.findIndex((y) => y.key === a), c = i > -1 ? i : 0, [d, u] = w.useState(
3738
+ e.length > 0 ? e[c] : void 0
3739
+ ), [f, p] = w.useState(!1), g = J([]), b = _((y) => {
3740
+ (d == null ? void 0 : d.key) !== y.key && (p(!0), setTimeout(() => {
3741
+ u(y), p(!1);
3742
+ }, 150));
3743
+ }, [d == null ? void 0 : d.key]);
3744
+ q(() => {
3745
+ e.length > 0 ? e.find((E) => E.key === (d == null ? void 0 : d.key)) || u(e[c]) : u(void 0);
3746
+ }, [e, c, d == null ? void 0 : d.key]);
3747
+ const x = _((y, E) => {
3748
+ var H;
3749
+ let v = E;
3750
+ if (y.key === "ArrowRight")
3751
+ v = (E + 1) % e.length;
3752
+ else if (y.key === "ArrowLeft")
3753
+ v = (E - 1 + e.length) % e.length;
3754
+ else if (y.key === "Home")
3755
+ v = 0;
3756
+ else if (y.key === "End")
3757
+ v = e.length - 1;
3758
+ else
3759
+ return;
3760
+ y.preventDefault();
3761
+ const T = e[v];
3762
+ T && (b(T), (H = g.current[v]) == null || H.focus());
3763
+ }, [e, b]);
3764
+ return d ? /* @__PURE__ */ P(
3765
+ I,
3766
+ {
3767
+ as: "div",
3768
+ "data-tabs": !0,
3769
+ ref: s,
3770
+ "data-align": r,
3771
+ "data-full-width": l,
3772
+ ...n,
3773
+ children: [
3774
+ /* @__PURE__ */ o(Pt, { "data-tabs-nav": !0, role: "tablist", "aria-label": "Tab Navigation", children: /* @__PURE__ */ P("ul", { className: "tab-labels-list", children: [
3775
+ e.map((y, E) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o(
3776
+ I,
3777
+ {
3778
+ as: "button",
3779
+ ref: (v) => g.current[E] = v,
3780
+ id: `tab-${y.key}`,
3781
+ role: "tab",
3782
+ "aria-selected": d.key === y.key,
3783
+ "aria-controls": `tab-panel-${y.key}`,
3784
+ tabIndex: d.key === y.key ? 0 : -1,
3785
+ "data-tab-label": !0,
3786
+ "data-active": d.key === y.key,
3787
+ "data-alert": y.hasAlert,
3788
+ onClick: () => b(y),
3789
+ onKeyDown: (v) => x(v, E),
3790
+ className: `tab-button ${d.key === y.key ? "is-active" : ""}`,
3791
+ marginBottom: "nano",
3792
+ children: /* @__PURE__ */ o(
3793
+ Y,
3794
+ {
3795
+ className: `tab-label ${d.key === y.key ? "is-active" : ""} ${y.hasAlert ? "has-alert" : ""}`,
3796
+ children: y.label
3797
+ }
3798
+ )
3799
+ }
3800
+ ) }, y.key)),
3801
+ t
3802
+ ] }) }),
3803
+ /* @__PURE__ */ o(et, { kind: "tertiary", marginTop: "none", marginBottom: "micro" }),
3804
+ e.map((y) => /* @__PURE__ */ o(
3805
+ K,
3806
+ {
3807
+ id: `tab-panel-${y.key}`,
3808
+ role: "tabpanel",
3809
+ "aria-labelledby": `tab-${y.key}`,
3810
+ tabIndex: d.key === y.key ? 0 : -1,
3811
+ "data-tab-content": !0,
3812
+ "data-active": d.key === y.key,
3813
+ "data-exiting": d.key === y.key && f,
3814
+ hidden: d.key !== y.key,
3815
+ children: y.content
3816
+ },
3817
+ y.key
3818
+ ))
3819
+ ]
3820
+ }
3821
+ ) : null;
3822
+ }
3823
+ );
3824
+ va.displayName = "Tabs";
3825
+ const De = () => {
3826
+ if (typeof window < "u") {
3827
+ const e = window.location.hostname, t = window.location.port;
3828
+ let a = e.replace(/\./g, "-");
3829
+ return t && (a += `-${t}`), `${a}-theme`;
3830
+ }
3831
+ return "fictoan-theme";
3832
+ }, ya = ["", (e) => {
3833
+ }], ht = w.createContext(void 0), Ja = () => {
3834
+ const e = w.useContext(ht);
3835
+ return e === void 0 ? ya : e;
3836
+ }, qe = (e, t) => {
3837
+ let a;
3838
+ try {
3839
+ a = localStorage.getItem(e) || void 0;
3840
+ } catch {
3841
+ }
3842
+ return a || t;
3843
+ }, wa = w.forwardRef(
3844
+ ({ currentTheme: e, themeList: t, children: a, ...r }, l) => {
3845
+ const [n, s] = X(!1), [i, c] = X(() => qe(De()) || e), d = _(
3846
+ (u) => {
3847
+ const f = typeof u == "function" ? u(i) : u;
3848
+ if (!t.includes(f)) {
3849
+ const p = t[0];
3850
+ c(p), document.documentElement.className = "", document.documentElement.classList.add(p);
3851
+ try {
3852
+ localStorage.setItem(De(), p);
3853
+ } catch {
3854
+ }
3855
+ return;
3856
+ }
3857
+ c(f), document.documentElement.className = "", document.documentElement.classList.add(f), n || s(!0);
3858
+ try {
3859
+ localStorage.setItem(De(), f);
3860
+ } catch {
3861
+ }
3862
+ },
3863
+ [i, t]
3864
+ );
3865
+ return q(() => {
3866
+ const u = qe(De());
3867
+ d(u || e);
3868
+ }, [e, d]), /* @__PURE__ */ o(ht.Provider, { value: [i, d], children: /* @__PURE__ */ o(I, { as: "div", "data-theme-provider": !0, ref: l, ...r, children: n && a }) });
3869
+ }
3870
+ );
3871
+ wa.displayName = "ThemeProvider";
3872
+ const vt = w.forwardRef(
3873
+ ({
3874
+ anchor: e = "top",
3875
+ children: t,
3876
+ ...a
3877
+ }, r) => w.Children.count(t) === 0 ? null : /* @__PURE__ */ o(
3878
+ I,
3879
+ {
3880
+ as: "section",
3881
+ "data-toasts-wrapper": !0,
3882
+ ref: r,
3883
+ classNames: [e],
3884
+ "aria-label": "Toasts",
3885
+ "aria-relevant": "additions removals",
3886
+ role: "log",
3887
+ ...a,
3888
+ children: t
3889
+ }
3890
+ )
3891
+ );
3892
+ vt.displayName = "ToastsWrapper";
3893
+ const yt = ({
3894
+ id: e,
3895
+ duration: t = 4,
3896
+ onClose: a,
3897
+ children: r
3898
+ }) => {
3899
+ const [l, n] = X(!1);
3900
+ return q(() => {
3901
+ if (t === 0) return;
3902
+ const i = setTimeout(() => {
3903
+ n(!0);
3904
+ }, t * 1e3);
3905
+ return () => clearTimeout(i);
3906
+ }, [t]), q(() => {
3907
+ if (!l) return;
3908
+ const i = setTimeout(() => {
3909
+ a();
3910
+ }, 500);
3911
+ return () => clearTimeout(i);
3912
+ }, [l, a]), /* @__PURE__ */ o(
3913
+ I,
3914
+ {
3915
+ as: "div",
3916
+ "data-toast-item": !0,
3917
+ id: e,
3918
+ classNames: l ? ["dismissed"] : [],
3919
+ onTransitionEnd: () => {
3920
+ l && a();
3921
+ },
3922
+ role: "status",
3923
+ "aria-live": "polite",
3924
+ "aria-atomic": "true",
3925
+ shadow: "soft",
3926
+ children: r
3927
+ }
3928
+ );
3929
+ };
3930
+ yt.displayName = "ToastItem";
3931
+ const wt = Le(null), ba = ({
3932
+ children: e,
3933
+ anchor: t = "top"
3934
+ }) => {
3935
+ const [a, r] = X([]), l = _((s) => {
3936
+ r((i) => i.filter((c) => c.id !== s));
3937
+ }, []), n = _((s, i = 4) => {
3938
+ const c = `toast-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
3939
+ r((d) => [...d, {
3940
+ id: c,
3941
+ message: s,
3942
+ duration: i
3943
+ }]);
3944
+ }, []);
3945
+ return /* @__PURE__ */ P(wt.Provider, { value: { toast: n }, children: [
3946
+ e,
3947
+ /* @__PURE__ */ o(vt, { anchor: t, children: a.map(({ id: s, message: i, duration: c }) => /* @__PURE__ */ o(
3948
+ yt,
3949
+ {
3950
+ id: s,
3951
+ duration: c,
3952
+ onClose: () => l(s),
3953
+ children: i
3954
+ },
3955
+ s
3956
+ )) })
3957
+ ] });
3958
+ };
3959
+ ba.displayName = "ToastsProvider";
3960
+ const Za = () => {
3961
+ const e = ye(wt);
3962
+ if (!e)
3963
+ throw new Error("useToasts must be used within a ToastsProvider");
3964
+ return e.toast;
3965
+ }, de = 8, ae = 16;
3966
+ let re = null, ue = null, Ve = !1, ne = null, me = null;
3967
+ const fe = /* @__PURE__ */ new Map(), ga = (e, t, a) => {
3968
+ const r = e.getBoundingClientRect(), l = t.getBoundingClientRect(), n = window.innerHeight, s = window.innerWidth;
3969
+ let i, c;
3970
+ switch (a) {
3971
+ case "top":
3972
+ i = l.top - r.height - de, c = l.left + (l.width - r.width) / 2, i < ae && (i = l.bottom + de);
3973
+ break;
3974
+ case "bottom":
3975
+ i = l.bottom + de, c = l.left + (l.width - r.width) / 2, i + r.height > n - ae && (i = l.top - r.height - de);
3976
+ break;
3977
+ case "left":
3978
+ i = l.top + (l.height - r.height) / 2, c = l.left - r.width - de, c < ae && (c = l.right + de);
3979
+ break;
3980
+ case "right":
3981
+ i = l.top + (l.height - r.height) / 2, c = l.right + de, c + r.width > s - ae && (c = l.left - r.width - de);
3982
+ break;
3983
+ default:
3984
+ i = l.top - r.height - de, c = l.left + (l.width - r.width) / 2;
3985
+ }
3986
+ return c < ae ? c = ae : c + r.width > s - ae && (c = s - r.width - ae), i < ae ? i = ae : i + r.height > n - ae && (i = n - r.height - ae), { top: i, left: c };
3987
+ }, Ie = ({ content: e, isVisible: t, position: a, zIndex: r }) => /* @__PURE__ */ o(
3988
+ "div",
3989
+ {
3990
+ "data-tooltip": !0,
3991
+ className: t ? "visible" : "",
3992
+ role: "tooltip",
3993
+ style: {
3994
+ position: "fixed",
3995
+ zIndex: r,
3996
+ top: `${a.top}px`,
3997
+ left: `${a.left}px`
3998
+ },
3999
+ children: e
4000
+ }
4001
+ ), ge = (e, t) => {
4002
+ if (!(!ue || !re)) {
4003
+ if (!e || !t) {
4004
+ ue.render(
4005
+ /* @__PURE__ */ o(Ie, { content: null, isVisible: !1, position: { top: -9999, left: -9999 }, zIndex: 1e5 })
4006
+ );
4007
+ return;
4008
+ }
4009
+ ue.render(
4010
+ /* @__PURE__ */ o(Ie, { content: e.content, isVisible: !1, position: { top: -9999, left: -9999 }, zIndex: e.zIndex })
4011
+ ), requestAnimationFrame(() => {
4012
+ if (!re || !t) return;
4013
+ const a = re.firstElementChild;
4014
+ if (!a) return;
4015
+ const { top: r, left: l } = ga(a, t, e.position);
4016
+ ue == null || ue.render(
4017
+ /* @__PURE__ */ o(Ie, { content: e.content, isVisible: !0, position: { top: r, left: l }, zIndex: e.zIndex })
4018
+ );
4019
+ });
4020
+ }
4021
+ }, Ye = () => {
4022
+ if (!ne || !me) return;
4023
+ const e = fe.get(ne);
4024
+ e && ge(e, me);
4025
+ }, bt = (e, t) => {
4026
+ const a = fe.get(e);
4027
+ a && (ne = e, me = t, ge(a, t));
4028
+ }, Ae = (e) => {
4029
+ e && ne !== e || (ne = null, me = null, ge(null, null));
4030
+ }, Na = (e) => {
4031
+ const t = e.target.closest("[id]");
4032
+ if (!(t != null && t.id)) return;
4033
+ const a = fe.get(t.id);
4034
+ (a == null ? void 0 : a.showOn) === "hover" && bt(t.id, t);
4035
+ }, ka = (e) => {
4036
+ const t = e.target.closest("[id]");
4037
+ if (!(t != null && t.id)) return;
4038
+ const a = fe.get(t.id);
4039
+ (a == null ? void 0 : a.showOn) === "hover" && Ae(t.id);
4040
+ }, $a = (e) => {
4041
+ if (re != null && re.contains(e.target))
4042
+ return;
4043
+ const t = e.target.closest("[id]");
4044
+ if (t != null && t.id) {
4045
+ const a = fe.get(t.id);
4046
+ if ((a == null ? void 0 : a.showOn) === "click") {
4047
+ ne === t.id ? Ae() : bt(t.id, t);
4048
+ return;
4049
+ }
4050
+ }
4051
+ if (ne) {
4052
+ const a = fe.get(ne);
4053
+ (a == null ? void 0 : a.showOn) === "click" && Ae();
4054
+ }
4055
+ }, xa = () => {
4056
+ if (typeof document > "u") return;
4057
+ const e = document.getElementById("fictoan-tooltip-singleton");
4058
+ if (e && Ve) {
4059
+ re = e;
4060
+ return;
4061
+ }
4062
+ Ve = !1, re = null, ue = null, re = document.createElement("div"), re.id = "fictoan-tooltip-singleton", document.body.appendChild(re), ue = Mt(re), ue.render(
4063
+ /* @__PURE__ */ o(Ie, { content: null, isVisible: !1, position: { top: -9999, left: -9999 }, zIndex: 1e5 })
4064
+ ), document.addEventListener("mouseover", Na), document.addEventListener("mouseout", ka), document.addEventListener("click", $a), window.addEventListener("scroll", Ye, !0), window.addEventListener("resize", Ye), Ve = !0;
4065
+ }, Qa = ({
4066
+ children: e,
4067
+ isTooltipFor: t,
4068
+ showOn: a = "hover",
4069
+ position: r = "top",
4070
+ zIndex: l = 1e5
4071
+ }) => {
4072
+ const n = J({ content: e, position: r, showOn: a, zIndex: l });
4073
+ return n.current = { content: e, position: r, showOn: a, zIndex: l }, q(() => (xa(), fe.set(t, n.current), ne === t && me && ge(n.current, me), () => {
4074
+ fe.delete(t), ne === t && Ae();
4075
+ }), [t]), q(() => {
4076
+ fe.set(t, n.current), ne === t && me && ge(n.current, me);
4077
+ }, [e, r, a, l, t]), null;
4078
+ }, we = w.forwardRef(
4079
+ ({ fontStyle: e = "sans-serif", weight: t, align: a, ...r }, l) => {
4080
+ let n = [];
4081
+ return t && n.push(`weight-${t}`), e && n.push(`font-${e}`), a && n.push(`text-${a}`), /* @__PURE__ */ o(I, { ref: l, classNames: n, ...r });
4082
+ }
4083
+ ), Ra = w.forwardRef((e, t) => /* @__PURE__ */ o(we, { as: "h1", ref: t, ...e }));
4084
+ Ra.displayName = "Heading1";
4085
+ const Ma = w.forwardRef((e, t) => /* @__PURE__ */ o(we, { as: "h2", ref: t, ...e }));
4086
+ Ma.displayName = "Heading2";
4087
+ const Ea = w.forwardRef((e, t) => /* @__PURE__ */ o(we, { as: "h3", ref: t, ...e }));
4088
+ Ea.displayName = "Heading3";
4089
+ const Pa = w.forwardRef((e, t) => /* @__PURE__ */ o(we, { as: "h4", ref: t, ...e }));
4090
+ Pa.displayName = "Heading4";
4091
+ const Ta = w.forwardRef((e, t) => /* @__PURE__ */ o(we, { as: "h5", ref: t, ...e }));
4092
+ Ta.displayName = "Heading5";
4093
+ const Da = w.forwardRef((e, t) => /* @__PURE__ */ o(we, { as: "h6", ref: t, ...e }));
4094
+ Da.displayName = "Heading6";
4095
+ const Ia = w.forwardRef(
4096
+ ({ summary: e, children: t, isOpen: a = !1, ...r }, l) => /* @__PURE__ */ P(
4097
+ I,
4098
+ {
4099
+ as: "details",
4100
+ "data-expandable-content": !0,
4101
+ ref: l,
4102
+ ...r,
4103
+ open: a,
4104
+ role: "region",
4105
+ "aria-labelledby": "accordion-summary",
4106
+ children: [
4107
+ /* @__PURE__ */ o(
4108
+ "summary",
4109
+ {
4110
+ role: "button",
4111
+ tabIndex: 0,
4112
+ "aria-controls": "accordion-content",
4113
+ "aria-expanded": a,
4114
+ children: typeof e == "string" ? /* @__PURE__ */ o(Y, { margin: "none", children: e }) : e
4115
+ }
4116
+ ),
4117
+ t
4118
+ ]
4119
+ }
4120
+ )
4121
+ );
4122
+ Ia.displayName = "Accordion";
4123
+ export {
4124
+ ca as $,
4125
+ Ia as A,
4126
+ Se as B,
4127
+ Ze as C,
4128
+ Dt as D,
4129
+ I as E,
4130
+ Ha as F,
4131
+ ea as G,
4132
+ _a as H,
4133
+ $e as I,
4134
+ aa as J,
4135
+ Ca as K,
4136
+ Ut as L,
4137
+ Ga as M,
4138
+ Pt as N,
4139
+ na as O,
4140
+ qt as P,
4141
+ at as Q,
4142
+ rt as R,
4143
+ Ka as S,
4144
+ it as T,
4145
+ oa as U,
4146
+ nt as V,
4147
+ Ya as W,
4148
+ Ua as X,
4149
+ qa as Y,
4150
+ ia as Z,
4151
+ la as _,
4152
+ ze as a,
4153
+ da as a0,
4154
+ ua as a1,
4155
+ fa as a2,
4156
+ pa as a3,
4157
+ ma as a4,
4158
+ pt as a5,
4159
+ ha as a6,
4160
+ va as a7,
4161
+ wa as a8,
4162
+ Ja as a9,
4163
+ ba as aa,
4164
+ Za as ab,
4165
+ Qa as ac,
4166
+ Ra as ad,
4167
+ Ma as ae,
4168
+ Ea as af,
4169
+ Pa as ag,
4170
+ Ta as ah,
4171
+ Da as ai,
4172
+ Y as aj,
4173
+ It as b,
4174
+ Lt as c,
4175
+ Qe as d,
4176
+ St as e,
4177
+ et as f,
4178
+ K as g,
4179
+ Va as h,
4180
+ Wa as i,
4181
+ za as j,
4182
+ ja as k,
4183
+ Xa as l,
4184
+ He as m,
4185
+ Ft as n,
4186
+ tt as o,
4187
+ _t as p,
4188
+ Z as q,
4189
+ Gt as r,
4190
+ ke as s,
4191
+ st as t,
4192
+ Yt as u,
4193
+ Zt as v,
4194
+ ot as w,
4195
+ _e as x,
4196
+ Vt as y,
4197
+ Qt as z
4198
+ };
4199
+ //# sourceMappingURL=Accordion-Z0yapsUC.js.map