@alfadocs/ui-kit 0.19.0 → 0.20.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 (84) hide show
  1. package/dist/_chunks/_commonjsHelpers-DaMA6jEr.js +9 -0
  2. package/dist/_chunks/{ai-prompt-input-B-w5Rx3V.js → ai-prompt-input-B5MdixzR.js} +2 -2
  3. package/dist/_chunks/{alert-DBnawbmf.js → alert-ywPR59NE.js} +14 -1
  4. package/dist/_chunks/{leo-sidebar-DIsiTju3.js → alia-sidebar-Bof6TlFx.js} +211 -211
  5. package/dist/_chunks/{audio-recorder-DNkQLW1G.js → audio-recorder-D4xM3H5i.js} +2 -2
  6. package/dist/_chunks/{chat-message-g3lxpXM_.js → chat-message-ChOnwqf_.js} +5 -5
  7. package/dist/_chunks/editable-currency-cell-renderer-Dn3-ANF5.js +1932 -0
  8. package/dist/_chunks/{email-input-DKN5JERd.js → email-input-DvJ_kPKL.js} +2 -2
  9. package/dist/_chunks/exceljs.min-DUJ-5CGx.js +23045 -0
  10. package/dist/_chunks/file-spreadsheet-zUkY8rJ2.js +25 -0
  11. package/dist/_chunks/{file-upload-nMh-1jDD.js → file-upload-DxAQprcU.js} +103 -122
  12. package/dist/_chunks/{freemium-paywall-DXc7XlGE.js → freemium-paywall-CM6V1zNf.js} +2 -2
  13. package/dist/_chunks/grip-vertical-Dlg0_k5C.js +19 -0
  14. package/dist/_chunks/html2canvas.esm-dgT_1dIT.js +4872 -0
  15. package/dist/_chunks/{index-CFoBa86t.js → index-BcMWc8W2.js} +2 -2
  16. package/dist/_chunks/index.es-B8zMZ1wV.js +6694 -0
  17. package/dist/_chunks/jspdf.es.min-DaapWjR1.js +10007 -0
  18. package/dist/_chunks/jspdf.plugin.autotable-CSiDNyPn.js +1088 -0
  19. package/dist/_chunks/{map-view-DVP-Kp9l.js → map-view-CcwycFQX.js} +2 -2
  20. package/dist/_chunks/{patient-shell-Dr64lBp_.js → patient-shell-DavGODt9.js} +2 -2
  21. package/dist/_chunks/{payment-form-BjkuQeqR.js → payment-form-F7uh0Rqr.js} +2 -2
  22. package/dist/_chunks/{pdf-viewer-BG_nsFT5.js → pdf-viewer-CuYaVR1I.js} +2 -2
  23. package/dist/_chunks/{purify.es-DpIUMBYC.js → purify.es-Cm3utOpm.js} +2 -2
  24. package/dist/_chunks/{rich-text-editor-C7TCIlQO.js → rich-text-editor-J-wAz9eN.js} +22 -22
  25. package/dist/_chunks/{sidebar-BqzlRBvC.js → sidebar-DkyC6GvS.js} +167 -180
  26. package/dist/_chunks/{suggestion-chip-C4Jz0LrM.js → suggestion-chip-C4kxWUIs.js} +2 -2
  27. package/dist/_chunks/{warning-stack-CDH9TudY.js → warning-stack-bDicCvxs.js} +2 -2
  28. package/dist/_chunks/{workflow-map-BeKe23uw.js → workflow-map-BkLglexk.js} +2 -2
  29. package/dist/agent-catalog.json +1 -1
  30. package/dist/components/ai-prompt-input/index.js +1 -1
  31. package/dist/components/alert/index.js +1 -1
  32. package/dist/components/app-frame/app-frame.d.ts +1 -1
  33. package/dist/components/audio-recorder/index.js +1 -1
  34. package/dist/components/chat-container/chat-container.d.ts +1 -1
  35. package/dist/components/chat-message/chat-message.d.ts +1 -1
  36. package/dist/components/chat-message/index.js +1 -1
  37. package/dist/components/data-table/cell-renderers/balance-cell-renderer.d.ts +37 -0
  38. package/dist/components/data-table/cell-renderers/editable-currency-cell-renderer.d.ts +23 -0
  39. package/dist/components/data-table/cell-renderers/editable-text-cell-renderer.d.ts +11 -0
  40. package/dist/components/data-table/cell-renderers/image-cell-renderer.d.ts +19 -0
  41. package/dist/components/data-table/cell-renderers/toggle-cell-renderer.d.ts +15 -3
  42. package/dist/components/data-table/data-table.d.ts +30 -3
  43. package/dist/components/data-table/filters/date-range-filter.d.ts +30 -0
  44. package/dist/components/data-table/filters/select-filter.d.ts +64 -0
  45. package/dist/components/data-table/filters/typeahead-filter.d.ts +49 -0
  46. package/dist/components/data-table/index.d.ts +13 -2
  47. package/dist/components/data-table/index.js +24 -14
  48. package/dist/components/data-table/toolbar.d.ts +80 -1
  49. package/dist/components/email-input/index.js +1 -1
  50. package/dist/components/file-upload/index.js +1 -1
  51. package/dist/components/freemium-paywall/index.js +1 -1
  52. package/dist/components/index.d.ts +1 -1
  53. package/dist/components/map-view/index.js +1 -1
  54. package/dist/components/payment-form/index.js +1 -1
  55. package/dist/components/pdf-viewer/index.js +1 -1
  56. package/dist/components/rich-text-editor/index.js +1 -1
  57. package/dist/components/sidebar/index.js +1 -1
  58. package/dist/components/suggestion-chip/index.js +1 -1
  59. package/dist/components/warning-stack/index.js +1 -1
  60. package/dist/components/workflow/index.js +1 -1
  61. package/dist/i18n/config.js +81 -13
  62. package/dist/i18n/resources.d.ts +77 -9
  63. package/dist/index.js +421 -411
  64. package/dist/locales/de.json +13 -3
  65. package/dist/locales/en.json +32 -3
  66. package/dist/locales/it.json +32 -3
  67. package/dist/patterns/alia-assistant/alia-chat-surface.d.ts +3 -0
  68. package/dist/patterns/alia-assistant/alia-embedded.d.ts +13 -0
  69. package/dist/patterns/{leo-assistant/leo-popout.d.ts → alia-assistant/alia-popout.d.ts} +4 -4
  70. package/dist/patterns/{leo-assistant/leo-sidebar.d.ts → alia-assistant/alia-sidebar.d.ts} +10 -10
  71. package/dist/patterns/{leo-assistant/leo-types.d.ts → alia-assistant/alia-types.d.ts} +23 -23
  72. package/dist/patterns/alia-assistant/index.d.ts +20 -0
  73. package/dist/patterns/alia-assistant/index.js +8 -0
  74. package/dist/patterns/patient-shell/index.js +1 -1
  75. package/dist/patterns/patient-shell/patient-shell.d.ts +1 -1
  76. package/dist/safe-html/index.js +6 -6
  77. package/dist/tokens.css +2 -2
  78. package/package.json +7 -4
  79. package/dist/_chunks/_commonjsHelpers-C6fGbg64.js +0 -7
  80. package/dist/_chunks/balance-cell-renderer-DJB6WDPe.js +0 -1015
  81. package/dist/patterns/leo-assistant/index.d.ts +0 -20
  82. package/dist/patterns/leo-assistant/index.js +0 -8
  83. package/dist/patterns/leo-assistant/leo-chat-surface.d.ts +0 -3
  84. package/dist/patterns/leo-assistant/leo-embedded.d.ts +0 -13
@@ -0,0 +1,1932 @@
1
+ import { jsx as r, jsxs as D } from "react/jsx-runtime";
2
+ import { useMemo as O, forwardRef as M, useState as k, useCallback as P, useEffect as $, useRef as W, createContext as ve, useContext as ye, isValidElement as Te, cloneElement as xe, useImperativeHandle as ct, useLayoutEffect as ut } from "react";
3
+ import { S as ft } from "./skeleton-CZbwyJAA.js";
4
+ import { E as pt } from "./empty-state-3CLJIXSj.js";
5
+ import { c as mt } from "./index-D2ZczOXr.js";
6
+ import { useTranslation as F } from "react-i18next";
7
+ import { AgGridReact as gt, useGridFilter as de } from "ag-grid-react";
8
+ import { ModuleRegistry as bt, AllCommunityModule as ht } from "ag-grid-community";
9
+ import { B as H } from "./button-DD_0Xdmr.js";
10
+ import { I as B } from "./icon-button-C4CGcYuz.js";
11
+ import { P as Q } from "./popover--derJ_wq.js";
12
+ import { C as Ce } from "./checkbox-mwbrPZDY.js";
13
+ import { T as vt } from "./text-input-CakysYnD.js";
14
+ import { T as Y } from "./tag-CQmHRM4Y.js";
15
+ import { D as J } from "./dropdown-menu-DZxwF23X.js";
16
+ import { X as yt } from "./x-CCcI3eJp.js";
17
+ import { c as ce } from "./createLucideIcon-CrFbzy84.js";
18
+ import { S as Tt } from "./search-BonnQsHv.js";
19
+ import { G as xt } from "./grip-vertical-Dlg0_k5C.js";
20
+ import { P as Ct } from "./printer-CeVEWfQq.js";
21
+ import { F as we } from "./file-text-DSNuv2B8.js";
22
+ import { F as wt } from "./file-spreadsheet-zUkY8rJ2.js";
23
+ import { u as Nt } from "./registry-C9nwlNyL.js";
24
+ import { D as St } from "./date-range-picker-9gANFNG9.js";
25
+ import { A as Ft } from "./autocomplete-BxfabhZ8.js";
26
+ import { B as Rt } from "./badge-cLYVGlMh.js";
27
+ import { A as Ne } from "./avatar-I10iCDs8.js";
28
+ import { T as kt } from "./tooltip-DHik5yRI.js";
29
+ import { T as pe } from "./timestamp-BV2lC-wV.js";
30
+ import { S as Dt } from "./square-check-big-Jr-0202D.js";
31
+ import { S as It } from "./square-CZoGU14v.js";
32
+ import { c as Se, a as Fe, b as Re, d as ke } from "./input-surface-xyERuLU_.js";
33
+ /**
34
+ * @license lucide-react v1.8.0 - ISC
35
+ *
36
+ * This source code is licensed under the ISC license.
37
+ * See the LICENSE file in the root directory of this source tree.
38
+ */
39
+ const Et = [
40
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
41
+ ["path", { d: "M12 3v18", key: "108xh3" }]
42
+ ], At = ce("columns-2", Et);
43
+ /**
44
+ * @license lucide-react v1.8.0 - ISC
45
+ *
46
+ * This source code is licensed under the ISC license.
47
+ * See the LICENSE file in the root directory of this source tree.
48
+ */
49
+ const zt = [
50
+ ["path", { d: "M12 15V3", key: "m9g1x1" }],
51
+ ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
52
+ ["path", { d: "m7 10 5 5 5-5", key: "brsn70" }]
53
+ ], ee = ce("download", zt);
54
+ /**
55
+ * @license lucide-react v1.8.0 - ISC
56
+ *
57
+ * This source code is licensed under the ISC license.
58
+ * See the LICENSE file in the root directory of this source tree.
59
+ */
60
+ const Pt = [
61
+ ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
62
+ ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
63
+ ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
64
+ ["path", { d: "M8 16H3v5", key: "1cv678" }]
65
+ ], _t = ce("refresh-cw", Pt);
66
+ function Ot(t) {
67
+ if (!Te(t)) return t;
68
+ const e = t, a = e.props.className ?? "", n = /\bsize-|\bw-|\bh-/.test(a) ? a : `${a} ds:size-4`.trim();
69
+ return xe(e, { className: n, size: e.props.size ?? 16 });
70
+ }
71
+ const De = ve(null);
72
+ function j(t) {
73
+ const e = ye(De);
74
+ if (!e)
75
+ throw new Error(
76
+ `${t} must be rendered inside <DataTable.Toolbar> as a descendant of <DataTable>.`
77
+ );
78
+ return e;
79
+ }
80
+ function Mt({
81
+ getApi: t,
82
+ selectionCount: e,
83
+ onPrint: a,
84
+ children: n
85
+ }) {
86
+ const s = O(
87
+ () => ({ getApi: t, selectionCount: e, onPrint: a }),
88
+ [t, e, a]
89
+ );
90
+ return /* @__PURE__ */ r(De.Provider, { value: s, children: n });
91
+ }
92
+ const jt = [
93
+ "data-table-toolbar",
94
+ // Mobile (<sm) keeps `flex-wrap` so a wide QuickSearch can flow above the
95
+ // Actions cluster on narrow screens. From `sm` (≥640px) we switch to
96
+ // `flex-nowrap` + `min-w-0` so the row stays single-line at every common
97
+ // desktop width (1024 / 1280 / 1440) — the QuickSearch slot shrinks via
98
+ // its own `min-w-0` instead of pushing the trailing Actions to a new row.
99
+ "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]",
100
+ "ds:sm:flex-nowrap ds:min-w-0",
101
+ // Brand-polish: give the toolbar its own card surface so it doesn't
102
+ // sit flush above the grid as a bare row. The `--card` token resolves to
103
+ // `--background` on the default light theme (white), which makes a
104
+ // shadow-only chrome invisible on the page — pair the card fill with the
105
+ // standard `--card-border` outline (same recipe as `<Card>`) so the
106
+ // toolbar reads as a discrete surface in both light and dark themes.
107
+ "ds:bg-[var(--card)] ds:rounded-[var(--radius-md)]",
108
+ "ds:border ds:border-[color:var(--card-border)]",
109
+ "ds:shadow-[var(--shadow-sm)]",
110
+ "ds:py-[var(--spacing-sm)] ds:px-[var(--spacing-md)]"
111
+ ].join(" "), Ie = M(
112
+ ({ className: t, children: e, ...a }, n) => /* @__PURE__ */ r(
113
+ "div",
114
+ {
115
+ ref: n,
116
+ role: "toolbar",
117
+ className: [jt, t ?? ""].join(" ").trim(),
118
+ ...a,
119
+ children: e
120
+ }
121
+ )
122
+ );
123
+ Ie.displayName = "DataTable.Toolbar";
124
+ const Ee = M(
125
+ ({ className: t, children: e, ...a }, n) => /* @__PURE__ */ r(
126
+ "div",
127
+ {
128
+ ref: n,
129
+ className: [
130
+ "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]",
131
+ // `grow` lets FilterBar absorb the free space; `min-w-0` lets the
132
+ // QuickSearch slot inside shrink below its intrinsic width when the
133
+ // toolbar runs `flex-nowrap` at `sm` and above, so the trailing
134
+ // Actions cluster stays pinned on a single row.
135
+ "ds:grow ds:min-w-0",
136
+ t ?? ""
137
+ ].join(" ").trim(),
138
+ ...a,
139
+ children: e
140
+ }
141
+ )
142
+ );
143
+ Ee.displayName = "DataTable.Toolbar.FilterBar";
144
+ const Ae = M(
145
+ ({ className: t, children: e, ...a }, n) => /* @__PURE__ */ r(
146
+ "div",
147
+ {
148
+ ref: n,
149
+ className: [
150
+ "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]",
151
+ "ds:ms-auto",
152
+ t ?? ""
153
+ ].join(" ").trim(),
154
+ ...a,
155
+ children: e
156
+ }
157
+ )
158
+ );
159
+ Ae.displayName = "DataTable.Toolbar.Actions";
160
+ const ze = M(
161
+ ({ label: t, onExport: e, intent: a = "outline", ...n }, s) => {
162
+ const { t: i } = F(), { getApi: o } = j("DataTable.Toolbar.ExportCsv"), c = P(() => {
163
+ const u = o();
164
+ u && (e ? e(u) : u.exportDataAsCsv());
165
+ }, [o, e]);
166
+ return /* @__PURE__ */ r(
167
+ B,
168
+ {
169
+ ref: s,
170
+ type: "button",
171
+ intent: a,
172
+ icon: /* @__PURE__ */ r(ee, { "aria-hidden": !0 }),
173
+ tooltip: t ?? i("dataTable.exportCsv"),
174
+ onClick: c,
175
+ ...n
176
+ }
177
+ );
178
+ }
179
+ );
180
+ ze.displayName = "DataTable.Toolbar.ExportCsv";
181
+ function U(t, e = [30, 30, 30]) {
182
+ if (typeof document > "u") return e;
183
+ const a = document.createElement("span");
184
+ a.style.color = `hsl(var(${t}))`, a.style.position = "absolute", a.style.visibility = "hidden", document.body.appendChild(a);
185
+ const n = getComputedStyle(a).color;
186
+ document.body.removeChild(a);
187
+ const s = n.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);
188
+ return s ? [Number(s[1]), Number(s[2]), Number(s[3])] : e;
189
+ }
190
+ async function Pe(t, e) {
191
+ if (!t) return;
192
+ const [{ jsPDF: a }, { default: n }] = await Promise.all([
193
+ import("./jspdf.es.min-DaapWjR1.js").then((x) => x.j),
194
+ import("./jspdf.plugin.autotable-CSiDNyPn.js")
195
+ ]), i = (t.getColumns() ?? []).filter((x) => x.isVisible()), o = [
196
+ i.map((x) => t.getDisplayNameForColumn(x, null) ?? "")
197
+ ], c = [];
198
+ t.forEachNodeAfterFilterAndSort((x) => {
199
+ if (!x.data) return;
200
+ const h = i.map((v) => {
201
+ const w = t.getCellValue({
202
+ rowNode: x,
203
+ colKey: v,
204
+ useFormatter: !0
205
+ });
206
+ return w == null ? "" : String(w);
207
+ });
208
+ c.push(h);
209
+ });
210
+ const u = U("--muted", [240, 240, 240]), d = U("--foreground", [30, 30, 30]), l = U("--card-foreground", [30, 30, 30]), m = U("--card", [250, 250, 250]), S = new a({ orientation: "landscape" });
211
+ n(S, {
212
+ head: o,
213
+ body: c,
214
+ headStyles: { fillColor: u, textColor: d },
215
+ bodyStyles: { textColor: l },
216
+ alternateRowStyles: { fillColor: m },
217
+ styles: {
218
+ font: "helvetica",
219
+ fontSize: 10,
220
+ cellPadding: 4
221
+ }
222
+ }), S.save(e.fileName);
223
+ }
224
+ const _e = M(
225
+ ({ label: t, onClick: e, fileName: a, intent: n = "outline", ...s }, i) => {
226
+ const { t: o } = F(), { getApi: c } = j("DataTable.Toolbar.ExportPdf"), u = P(() => {
227
+ const d = c();
228
+ if (e) {
229
+ e(d);
230
+ return;
231
+ }
232
+ Pe(d, {
233
+ fileName: a ?? "data-table-export.pdf"
234
+ });
235
+ }, [c, e, a]);
236
+ return /* @__PURE__ */ r(
237
+ B,
238
+ {
239
+ ref: i,
240
+ type: "button",
241
+ intent: n,
242
+ icon: /* @__PURE__ */ r(we, { "aria-hidden": !0 }),
243
+ tooltip: t ?? o("dataTable.exportPdf"),
244
+ onClick: u,
245
+ ...s
246
+ }
247
+ );
248
+ }
249
+ );
250
+ _e.displayName = "DataTable.Toolbar.ExportPdf";
251
+ const Oe = M(
252
+ ({ label: t, intent: e = "outline", ...a }, n) => {
253
+ const { t: s } = F(), { onPrint: i } = j("DataTable.Toolbar.Print");
254
+ return /* @__PURE__ */ r(
255
+ B,
256
+ {
257
+ ref: n,
258
+ type: "button",
259
+ intent: e,
260
+ icon: /* @__PURE__ */ r(Ct, { "aria-hidden": !0 }),
261
+ tooltip: t ?? s("dataTable.print"),
262
+ onClick: i,
263
+ ...a
264
+ }
265
+ );
266
+ }
267
+ );
268
+ Oe.displayName = "DataTable.Toolbar.Print";
269
+ const Me = ({ placeholder: t, debounceMs: e = 150 }) => {
270
+ const { t: a } = F(), { getApi: n } = j("DataTable.Toolbar.QuickSearch"), [s, i] = k(""), o = W(void 0);
271
+ return $(() => (o.current && window.clearTimeout(o.current), o.current = window.setTimeout(() => {
272
+ const c = n();
273
+ c && c.setGridOption("quickFilterText", s);
274
+ }, e), () => {
275
+ o.current && window.clearTimeout(o.current);
276
+ }), [s, e, n]), // Slot wrapper caps the search at a sensible legible width on desktop —
277
+ // without this, TextInput's `w-full` lets the QuickSearch absorb the
278
+ // entire FilterBar row and push trailing Actions onto a second line at
279
+ // 1024 / 1280 / 1440. `min-w-0` lets the slot shrink below `24rem` when
280
+ // the toolbar is squeezed on narrow viewports. There is no
281
+ // `--toolbar-search-max` token in the kit yet — see this component's
282
+ // summary for a follow-up note recommending we add one.
283
+ /* @__PURE__ */ r("div", { className: "ds:w-full ds:max-w-[24rem] ds:min-w-0", children: /* @__PURE__ */ r(
284
+ vt,
285
+ {
286
+ type: "search",
287
+ size: "sm",
288
+ value: s,
289
+ onChange: (c) => i(c.target.value),
290
+ placeholder: t ?? a("dataTable.quickSearch.placeholder", "Search…"),
291
+ startAdornment: /* @__PURE__ */ r(Tt, { "aria-hidden": !0, className: "ds:size-4" }),
292
+ clearable: !0,
293
+ onClear: () => i(""),
294
+ "aria-label": a("dataTable.quickSearch.label", "Quick search")
295
+ }
296
+ ) });
297
+ };
298
+ Me.displayName = "DataTable.Toolbar.QuickSearch";
299
+ const je = M(
300
+ ({ onRefresh: t, label: e, intent: a = "outline", ...n }, s) => {
301
+ const { t: i } = F();
302
+ return /* @__PURE__ */ r(
303
+ B,
304
+ {
305
+ ref: s,
306
+ type: "button",
307
+ intent: a,
308
+ icon: /* @__PURE__ */ r(_t, { "aria-hidden": !0 }),
309
+ tooltip: e ?? i("dataTable.refresh", "Refresh"),
310
+ onClick: t,
311
+ ...n
312
+ }
313
+ );
314
+ }
315
+ );
316
+ je.displayName = "DataTable.Toolbar.Refresh";
317
+ function $t(t) {
318
+ if (!t || typeof t != "object") return "";
319
+ const e = t;
320
+ if (typeof e.filter == "string" || typeof e.filter == "number") {
321
+ const a = typeof e.type == "string" ? e.type : "", n = typeof e.filterTo == "string" || typeof e.filterTo == "number" ? String(e.filterTo) : "";
322
+ return a === "inRange" && n ? `${e.filter} – ${n}` : a ? `${a} ${e.filter}` : String(e.filter);
323
+ }
324
+ return typeof e.dateFrom == "string" ? typeof e.dateTo == "string" && e.dateTo ? `${e.dateFrom} – ${e.dateTo}` : String(e.dateFrom) : Array.isArray(e.values) ? e.values.map(String).join(", ") : "";
325
+ }
326
+ const $e = () => {
327
+ const { t } = F(), { getApi: e } = j("DataTable.Toolbar.FilterChips"), [a, n] = k([]), [s, i] = k(""), o = P(() => {
328
+ const l = e();
329
+ if (!l) {
330
+ n([]), i("");
331
+ return;
332
+ }
333
+ const m = l.getFilterModel() ?? {}, S = l.getColumns() ?? [], x = [];
334
+ for (const v of Object.keys(m)) {
335
+ const w = S.find((p) => p.getColId() === v), f = l.getDisplayNameForColumn(w, null) ?? v;
336
+ x.push({
337
+ colId: v,
338
+ headerName: f,
339
+ text: $t(m[v])
340
+ });
341
+ }
342
+ n(x);
343
+ const h = l.getGridOption("quickFilterText");
344
+ i(typeof h == "string" ? h : "");
345
+ }, [e]);
346
+ if ($(() => {
347
+ const l = e();
348
+ if (!l) return;
349
+ const m = (S) => o();
350
+ return l.addEventListener("filterChanged", m), o(), () => {
351
+ l.removeEventListener("filterChanged", m);
352
+ };
353
+ }, [e, o]), a.length + (s ? 1 : 0) === 0) return null;
354
+ function u(l) {
355
+ const m = e();
356
+ m && m.destroyFilter(l);
357
+ }
358
+ function d() {
359
+ const l = e();
360
+ l && (l.setFilterModel(null), l.setGridOption("quickFilterText", ""), i(""));
361
+ }
362
+ return /* @__PURE__ */ D(
363
+ "div",
364
+ {
365
+ role: "group",
366
+ "aria-label": t("dataTable.filterChips.label", "Active filters"),
367
+ className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
368
+ children: [
369
+ s && /* @__PURE__ */ r(
370
+ Y,
371
+ {
372
+ label: `${t("dataTable.quickSearch.label", "Quick search")}: ${s}`,
373
+ size: "sm",
374
+ fill: "outline",
375
+ onRemove: () => {
376
+ const l = e();
377
+ l == null || l.setGridOption("quickFilterText", ""), i("");
378
+ }
379
+ }
380
+ ),
381
+ a.map((l) => /* @__PURE__ */ r(
382
+ Y,
383
+ {
384
+ label: l.text ? `${l.headerName}: ${l.text}` : l.headerName,
385
+ size: "sm",
386
+ fill: "outline",
387
+ onRemove: () => u(l.colId)
388
+ },
389
+ l.colId
390
+ )),
391
+ /* @__PURE__ */ r(
392
+ H,
393
+ {
394
+ type: "button",
395
+ intent: "ghost",
396
+ size: "sm",
397
+ onClick: d,
398
+ startIcon: /* @__PURE__ */ r(yt, { "aria-hidden": !0, className: "ds:size-4" }),
399
+ children: t("dataTable.filterChips.clearAll", "Clear all")
400
+ }
401
+ )
402
+ ]
403
+ }
404
+ );
405
+ };
406
+ $e.displayName = "DataTable.Toolbar.FilterChips";
407
+ const Le = ({
408
+ field: t,
409
+ options: e,
410
+ label: a
411
+ }) => {
412
+ const { t: n } = F(), { getApi: s } = j("DataTable.Toolbar.FacetFilter"), [i, o] = k(null);
413
+ function c(u) {
414
+ o(u);
415
+ const d = s();
416
+ if (d) {
417
+ if (u === null) {
418
+ d.destroyFilter(t);
419
+ return;
420
+ }
421
+ d.setColumnFilterModel(t, {
422
+ type: "equals",
423
+ filter: u
424
+ }), d.onFilterChanged();
425
+ }
426
+ }
427
+ return /* @__PURE__ */ r(
428
+ "div",
429
+ {
430
+ role: "group",
431
+ "aria-label": a ?? n("dataTable.facetFilter.label", "Filter"),
432
+ className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]",
433
+ children: e.map((u) => {
434
+ const d = i === u.value;
435
+ return /* @__PURE__ */ r(
436
+ H,
437
+ {
438
+ type: "button",
439
+ size: "sm",
440
+ intent: d ? "primary" : "secondary",
441
+ "aria-pressed": d,
442
+ onClick: () => c(u.value),
443
+ children: u.label
444
+ },
445
+ String(u.value)
446
+ );
447
+ })
448
+ }
449
+ );
450
+ };
451
+ Le.displayName = "DataTable.Toolbar.FacetFilter";
452
+ const Lt = ["csv", "xlsx", "pdf"];
453
+ async function Gt(t, e) {
454
+ if (!t) return;
455
+ const a = await import("./exceljs.min-DUJ-5CGx.js").then((v) => v.e), n = new a.Workbook(), s = n.addWorksheet("Sheet1"), o = (t.getColumns() ?? []).filter((v) => v.isVisible());
456
+ s.addRow(
457
+ o.map(
458
+ (v) => t.getDisplayNameForColumn(v, null) ?? v.getColId()
459
+ )
460
+ ), t.forEachNodeAfterFilterAndSort((v) => {
461
+ v.data && s.addRow(
462
+ o.map((w) => {
463
+ const f = t.getCellValue({
464
+ rowNode: v,
465
+ colKey: w,
466
+ useFormatter: !0
467
+ });
468
+ return f ?? "";
469
+ })
470
+ );
471
+ });
472
+ const c = U("--muted", [240, 240, 240]), u = U("--foreground", [30, 30, 30]), d = s.getRow(1), l = ([v, w, f]) => `${v.toString(16).padStart(2, "0")}${w.toString(16).padStart(2, "0")}${f.toString(16).padStart(2, "0")}`.toUpperCase();
473
+ d.eachCell((v) => {
474
+ v.font = { bold: !0, color: { argb: `FF${l(u)}` } }, v.fill = {
475
+ type: "pattern",
476
+ pattern: "solid",
477
+ fgColor: { argb: `FF${l(c)}` }
478
+ };
479
+ });
480
+ const m = await n.xlsx.writeBuffer(), S = new Blob([m], {
481
+ type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
482
+ }), x = URL.createObjectURL(S), h = document.createElement("a");
483
+ h.href = x, h.download = e.fileName, document.body.appendChild(h), h.click(), document.body.removeChild(h), URL.revokeObjectURL(x);
484
+ }
485
+ const Ge = ve(null);
486
+ function Bt() {
487
+ const t = ye(Ge);
488
+ if (!t)
489
+ throw new Error(
490
+ "DataTable.Toolbar.ExportMenu.Item must be rendered inside DataTable.Toolbar.ExportMenu."
491
+ );
492
+ return t;
493
+ }
494
+ const Be = ({ children: t, label: e }) => {
495
+ const { t: a } = F(), { getApi: n } = j("DataTable.Toolbar.ExportMenu"), s = O(() => ({ getApi: n }), [n]), i = t ?? Lt.map((o) => /* @__PURE__ */ r(ue, { format: o }, o));
496
+ return /* @__PURE__ */ r(Ge.Provider, { value: s, children: /* @__PURE__ */ D(J.Root, { children: [
497
+ /* @__PURE__ */ r(J.Trigger, { asChild: !0, children: /* @__PURE__ */ r(
498
+ B,
499
+ {
500
+ type: "button",
501
+ intent: "outline",
502
+ icon: /* @__PURE__ */ r(ee, { "aria-hidden": !0 }),
503
+ tooltip: e ?? a("dataTable.export.menu", "Export"),
504
+ "aria-label": e ?? a("dataTable.export.menu", "Export"),
505
+ "aria-haspopup": "menu"
506
+ }
507
+ ) }),
508
+ /* @__PURE__ */ r(J.Content, { align: "end", sideOffset: 4, children: i })
509
+ ] }) });
510
+ };
511
+ Be.displayName = "DataTable.Toolbar.ExportMenu";
512
+ function Vt(t, e) {
513
+ return e === "csv" ? t("dataTable.export.csv", "Export CSV") : e === "xlsx" ? t("dataTable.export.xlsx", "Export Excel") : e === "pdf" ? t("dataTable.export.pdf", "Export PDF") : t("dataTable.export.custom", "Export");
514
+ }
515
+ function qt(t) {
516
+ return t === "csv" ? /* @__PURE__ */ r(ee, { "aria-hidden": !0, className: "ds:size-4" }) : t === "xlsx" ? /* @__PURE__ */ r(wt, { "aria-hidden": !0, className: "ds:size-4" }) : t === "pdf" ? /* @__PURE__ */ r(we, { "aria-hidden": !0, className: "ds:size-4" }) : /* @__PURE__ */ r(ee, { "aria-hidden": !0, className: "ds:size-4" });
517
+ }
518
+ const ue = ({
519
+ format: t,
520
+ label: e,
521
+ onClick: a,
522
+ fileName: n
523
+ }) => {
524
+ const { t: s } = F(), { getApi: i } = Bt(), o = P(() => {
525
+ const c = i();
526
+ if (t === "csv") {
527
+ c == null || c.exportDataAsCsv();
528
+ return;
529
+ }
530
+ if (t === "pdf") {
531
+ Pe(c, {
532
+ fileName: n ?? "data-table-export.pdf"
533
+ });
534
+ return;
535
+ }
536
+ if (t === "xlsx") {
537
+ Gt(c, {
538
+ fileName: n ?? "data-table-export.xlsx"
539
+ });
540
+ return;
541
+ }
542
+ a == null || a(c);
543
+ }, [t, n, a, i]);
544
+ return /* @__PURE__ */ r(J.Item, { onSelect: o, children: /* @__PURE__ */ D("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
545
+ qt(t),
546
+ /* @__PURE__ */ r("span", { children: e ?? Vt(s, t) })
547
+ ] }) });
548
+ };
549
+ ue.displayName = "DataTable.Toolbar.ExportMenu.Item";
550
+ function Ut(t) {
551
+ return t ? (t.getColumns() ?? []).map((a) => a.getColDef().hide === void 0 && a.getColId().startsWith("ag-Grid-") ? null : {
552
+ colId: a.getColId(),
553
+ displayName: t.getDisplayNameForColumn(a, null) || a.getColId(),
554
+ visible: a.isVisible()
555
+ }).filter((a) => a !== null) : [];
556
+ }
557
+ const Ve = ({ label: t }) => {
558
+ const { t: e } = F(), { getApi: a } = j("DataTable.Toolbar.ColumnToggle"), [n, s] = k(!1), [i, o] = k([]), [c, u] = k(null), [d, l] = k(null);
559
+ $(() => {
560
+ n && o(Ut(a()));
561
+ }, [n, a]);
562
+ const m = P(
563
+ (h, v) => {
564
+ const w = a();
565
+ w && (w.setColumnsVisible([h], v), o(
566
+ (f) => f.map(
567
+ (p) => p.colId === h ? { ...p, visible: v } : p
568
+ )
569
+ ));
570
+ },
571
+ [a]
572
+ ), S = P(
573
+ (h, v) => {
574
+ if (h === v) return;
575
+ const w = a();
576
+ if (!w) return;
577
+ o((p) => {
578
+ const b = p.findIndex((E) => E.colId === h), T = p.findIndex((E) => E.colId === v);
579
+ if (b < 0 || T < 0) return p;
580
+ const N = [...p], [z] = N.splice(b, 1);
581
+ return N.splice(T, 0, z), N;
582
+ });
583
+ const f = i.findIndex((p) => p.colId === v);
584
+ f >= 0 && w.moveColumns([h], f);
585
+ },
586
+ [a, i]
587
+ ), x = t ?? e("dataTable.columnToggle");
588
+ return /* @__PURE__ */ D(Q.Root, { open: n, onOpenChange: s, children: [
589
+ /* @__PURE__ */ r(Q.Trigger, { asChild: !0, children: /* @__PURE__ */ r(
590
+ B,
591
+ {
592
+ type: "button",
593
+ intent: "outline",
594
+ icon: /* @__PURE__ */ r(At, { "aria-hidden": !0 }),
595
+ "aria-label": x,
596
+ "aria-haspopup": "dialog"
597
+ }
598
+ ) }),
599
+ /* @__PURE__ */ D(Q.Content, { size: "sm", align: "end", children: [
600
+ /* @__PURE__ */ r(Q.Heading, { children: x }),
601
+ /* @__PURE__ */ r(
602
+ "ul",
603
+ {
604
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
605
+ "aria-label": x,
606
+ children: i.map((h) => {
607
+ const v = c === h.colId, w = d === h.colId && c !== h.colId;
608
+ return /* @__PURE__ */ D(
609
+ "li",
610
+ {
611
+ draggable: !0,
612
+ onDragStart: (f) => {
613
+ u(h.colId), f.dataTransfer.effectAllowed = "move", f.dataTransfer.setData("text/plain", h.colId);
614
+ },
615
+ onDragOver: (f) => {
616
+ f.preventDefault(), f.dataTransfer.dropEffect = "move", l(h.colId);
617
+ },
618
+ onDragLeave: () => {
619
+ l((f) => f === h.colId ? null : f);
620
+ },
621
+ onDrop: (f) => {
622
+ f.preventDefault();
623
+ const p = f.dataTransfer.getData("text/plain");
624
+ p && S(p, h.colId), u(null), l(null);
625
+ },
626
+ onDragEnd: () => {
627
+ u(null), l(null);
628
+ },
629
+ className: [
630
+ "ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:rounded-[var(--radius-sm)] ds:px-[var(--spacing-xs)] ds:py-[var(--spacing-2xs,var(--spacing-xs))] ds:transition-colors",
631
+ v ? "ds:opacity-50" : "",
632
+ w ? "ds:bg-[color:color-mix(in_srgb,var(--primary)_8%,transparent)]" : ""
633
+ ].filter(Boolean).join(" "),
634
+ children: [
635
+ /* @__PURE__ */ r(
636
+ "span",
637
+ {
638
+ "aria-hidden": "true",
639
+ className: "ds:cursor-grab ds:text-[color:var(--muted-foreground)] ds:active:cursor-grabbing",
640
+ children: /* @__PURE__ */ r(xt, { className: "ds:size-4" })
641
+ }
642
+ ),
643
+ /* @__PURE__ */ r(
644
+ Ce,
645
+ {
646
+ label: h.displayName,
647
+ checked: h.visible,
648
+ onCheckedChange: (f) => m(h.colId, f === !0)
649
+ }
650
+ )
651
+ ]
652
+ },
653
+ h.colId
654
+ );
655
+ })
656
+ }
657
+ )
658
+ ] })
659
+ ] });
660
+ };
661
+ Ve.displayName = "DataTable.Toolbar.ColumnToggle";
662
+ const qe = M(
663
+ ({ label: t, icon: e, onClick: a, variant: n = "default", size: s = "sm", ...i }, o) => {
664
+ const { t: c } = F(), { getApi: u, selectionCount: d } = j(
665
+ "DataTable.Toolbar.BulkAction"
666
+ );
667
+ return d === 0 ? null : /* @__PURE__ */ D(
668
+ H,
669
+ {
670
+ ref: o,
671
+ type: "button",
672
+ intent: n === "destructive" ? "destructive" : "secondary",
673
+ size: s,
674
+ startIcon: Ot(e),
675
+ onClick: () => a(u()),
676
+ "aria-label": `${t} (${c("dataTable.bulkAction", { count: d })})`,
677
+ ...i,
678
+ children: [
679
+ /* @__PURE__ */ r("span", { children: t }),
680
+ /* @__PURE__ */ r(
681
+ "span",
682
+ {
683
+ "aria-hidden": "true",
684
+ className: "ds:ms-[var(--spacing-xs)] ds:opacity-80",
685
+ children: c("dataTable.bulkAction", { count: d })
686
+ }
687
+ )
688
+ ]
689
+ }
690
+ );
691
+ }
692
+ );
693
+ qe.displayName = "DataTable.Toolbar.BulkAction";
694
+ const Ht = Object.assign(Be, {
695
+ Item: ue
696
+ }), Z = Object.assign(Ie, {
697
+ FilterBar: Ee,
698
+ Actions: Ae,
699
+ /** @deprecated Use `Toolbar.ExportMenu` with a `csv` item. */
700
+ ExportCsv: ze,
701
+ /** @deprecated Use `Toolbar.ExportMenu` with a `pdf` item. */
702
+ ExportPdf: _e,
703
+ Print: Oe,
704
+ ColumnToggle: Ve,
705
+ BulkAction: qe,
706
+ QuickSearch: Me,
707
+ Refresh: je,
708
+ FilterChips: $e,
709
+ FacetFilter: Le,
710
+ ExportMenu: Ht
711
+ }), Kt = {
712
+ id: "data-table",
713
+ capabilities: [
714
+ "select_single",
715
+ "select_multiple",
716
+ "range_pick",
717
+ "filter",
718
+ "sort",
719
+ "paginate"
720
+ ],
721
+ state: {
722
+ selection: {
723
+ type: "string[]",
724
+ descriptionKey: "ui.agent.dataTable.state.selection",
725
+ description: "Row ids of currently-selected rows.",
726
+ read: (t) => t.getSelection()
727
+ },
728
+ filter: {
729
+ type: "object",
730
+ descriptionKey: "ui.agent.dataTable.state.filter",
731
+ description: "Current ag-grid filter model, keyed by column id.",
732
+ read: (t) => t.getFilter()
733
+ },
734
+ sort: {
735
+ type: "Array<{ colId, sort }>",
736
+ descriptionKey: "ui.agent.dataTable.state.sort",
737
+ description: "Active sort, in priority order.",
738
+ read: (t) => t.getSort()
739
+ },
740
+ currentPage: {
741
+ type: "number",
742
+ descriptionKey: "ui.agent.dataTable.state.currentPage",
743
+ description: "Zero-indexed page number.",
744
+ read: (t) => t.getCurrentPage()
745
+ }
746
+ },
747
+ actions: {
748
+ select_rows: {
749
+ safety: "read",
750
+ argsType: "{ ids: string[] }",
751
+ descriptionKey: "ui.agent.dataTable.actions.selectRows",
752
+ description: "Replace the current selection with the given row ids.",
753
+ invoke: (t, e) => {
754
+ t.setSelection(e.ids);
755
+ }
756
+ },
757
+ select_range: {
758
+ safety: "read",
759
+ argsType: "{ fromId: string, toId: string }",
760
+ descriptionKey: "ui.agent.dataTable.actions.selectRange",
761
+ description: "Select every row between fromId and toId, inclusive, in current sort order.",
762
+ invoke: (t, e) => {
763
+ t.selectRange(e.fromId, e.toId);
764
+ }
765
+ },
766
+ clear_selection: {
767
+ safety: "read",
768
+ descriptionKey: "ui.agent.dataTable.actions.clearSelection",
769
+ description: "Deselect all rows.",
770
+ invoke: (t) => {
771
+ t.clearSelection();
772
+ }
773
+ },
774
+ apply_filter: {
775
+ safety: "read",
776
+ argsType: "{ model: Record<string, unknown> }",
777
+ descriptionKey: "ui.agent.dataTable.actions.applyFilter",
778
+ description: "Replace the filter model with the given object.",
779
+ invoke: (t, e) => {
780
+ t.setFilter(e.model);
781
+ }
782
+ },
783
+ sort_by: {
784
+ safety: "read",
785
+ argsType: "{ model: DataTableSortEntry[] }",
786
+ descriptionKey: "ui.agent.dataTable.actions.sortBy",
787
+ description: "Replace the active sort with the given list (priority order).",
788
+ invoke: (t, e) => {
789
+ t.setSort(e.model);
790
+ }
791
+ },
792
+ go_to_page: {
793
+ safety: "read",
794
+ argsType: "{ page: number }",
795
+ descriptionKey: "ui.agent.dataTable.actions.goToPage",
796
+ description: "Navigate to the given zero-indexed page.",
797
+ invoke: (t, e) => {
798
+ t.goToPage(e.page);
799
+ }
800
+ }
801
+ },
802
+ domHooks: {
803
+ root: {
804
+ attr: "data-component",
805
+ value: "data-table",
806
+ description: "Marks the DataTable wrapper."
807
+ },
808
+ instanceId: {
809
+ attr: "data-component-id",
810
+ sourceProp: "gridId",
811
+ description: "Sourced from the gridId prop. Required to address a specific table from the agent."
812
+ },
813
+ item: {
814
+ attr: "row-id",
815
+ description: "Native ag-grid row-id attribute on each rendered row. Selection is performed via the curated handle, not by DOM mutation."
816
+ }
817
+ }
818
+ };
819
+ bt.registerModules([ht]);
820
+ const Wt = mt("ag-theme-alfadocs ds:w-full", {
821
+ variants: {
822
+ density: {
823
+ default: "",
824
+ compact: "data-table-compact",
825
+ expanded: "data-table-expanded"
826
+ },
827
+ bordered: {
828
+ true: "",
829
+ false: "ds:[--ag-borders:none]"
830
+ }
831
+ },
832
+ defaultVariants: {
833
+ density: "default",
834
+ bordered: !0
835
+ }
836
+ });
837
+ function Qt() {
838
+ const { t } = F();
839
+ return O(
840
+ () => ({
841
+ // Filter strings
842
+ contains: t("dataTable.agGrid.contains"),
843
+ notContains: t("dataTable.agGrid.notContains"),
844
+ equals: t("dataTable.agGrid.equals"),
845
+ notEqual: t("dataTable.agGrid.notEqual"),
846
+ startsWith: t("dataTable.agGrid.startsWith"),
847
+ endsWith: t("dataTable.agGrid.endsWith"),
848
+ lessThan: t("dataTable.agGrid.lessThan"),
849
+ greaterThan: t("dataTable.agGrid.greaterThan"),
850
+ inRange: t("dataTable.agGrid.inRange"),
851
+ blank: t("dataTable.agGrid.blank"),
852
+ notBlank: t("dataTable.agGrid.notBlank"),
853
+ filterOoo: t("dataTable.agGrid.filterOoo"),
854
+ applyFilter: t("dataTable.agGrid.applyFilter"),
855
+ resetFilter: t("dataTable.agGrid.resetFilter"),
856
+ noRowsToShow: t("dataTable.agGrid.noRowsToShow"),
857
+ selectAll: t("dataTable.agGrid.selectAll"),
858
+ // Pagination
859
+ page: t("dataTable.page"),
860
+ of: t("dataTable.of"),
861
+ to: t("dataTable.to"),
862
+ nextPage: t("dataTable.nextPage"),
863
+ previousPage: t("dataTable.previousPage"),
864
+ firstPage: t("dataTable.firstPage"),
865
+ lastPage: t("dataTable.lastPage"),
866
+ pageSize: t("dataTable.pageSize")
867
+ }),
868
+ [t]
869
+ );
870
+ }
871
+ function Xt() {
872
+ return /* @__PURE__ */ r(
873
+ "div",
874
+ {
875
+ role: "status",
876
+ "aria-live": "polite",
877
+ className: "ds:flex ds:w-full ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]",
878
+ children: Array.from({ length: 5 }).map((t, e) => /* @__PURE__ */ r(
879
+ ft,
880
+ {
881
+ variant: "rectangular",
882
+ className: "ds:h-[var(--min-target-size)] ds:w-full"
883
+ },
884
+ e
885
+ ))
886
+ }
887
+ );
888
+ }
889
+ function Jt() {
890
+ const { t } = F();
891
+ return /* @__PURE__ */ r(
892
+ pt,
893
+ {
894
+ variant: "no-results",
895
+ size: "sm",
896
+ title: t("dataTable.noRows"),
897
+ description: t("dataTable.noRowsDescription")
898
+ }
899
+ );
900
+ }
901
+ function Zt(t) {
902
+ try {
903
+ const e = localStorage.getItem(`data-table-col-state:${t}`);
904
+ return e ? JSON.parse(e) : null;
905
+ } catch {
906
+ return null;
907
+ }
908
+ }
909
+ function Yt(t, e) {
910
+ try {
911
+ localStorage.setItem(
912
+ `data-table-col-state:${t}`,
913
+ JSON.stringify(e.getColumnState())
914
+ );
915
+ } catch {
916
+ }
917
+ }
918
+ function ea(t, e) {
919
+ const {
920
+ columnDefs: a,
921
+ rowData: n,
922
+ rowSelection: s,
923
+ pagination: i = !1,
924
+ paginationPageSize: o = 25,
925
+ paginationPageSizeSelector: c = [10, 25, 50, 100],
926
+ gridId: u,
927
+ onSelectionChanged: d,
928
+ onSortChanged: l,
929
+ onFilterChanged: m,
930
+ noRowsOverlay: S,
931
+ loadingOverlay: x,
932
+ gridOptions: h,
933
+ density: v,
934
+ bordered: w,
935
+ heightClass: f = "ds:h-[500px]",
936
+ className: p,
937
+ getRowClass: b,
938
+ pinnedBottomRowData: T,
939
+ printMode: N = !1,
940
+ children: z
941
+ } = t, { t: E, i18n: K } = F(), R = W(null), [L, He] = k(0), [te, ae] = k(""), Ke = Qt(), ne = O(
942
+ () => ({
943
+ getSelection: () => {
944
+ var C;
945
+ const g = (C = R.current) == null ? void 0 : C.api;
946
+ if (!g) return [];
947
+ const y = [];
948
+ for (const A of g.getSelectedNodes())
949
+ A.id != null && y.push(A.id);
950
+ return y;
951
+ },
952
+ setSelection: (g) => {
953
+ var A;
954
+ const y = (A = R.current) == null ? void 0 : A.api;
955
+ if (!y) return;
956
+ const C = new Set(g);
957
+ y.forEachNode((I) => {
958
+ I.id != null && I.setSelected(C.has(I.id));
959
+ });
960
+ },
961
+ selectRange: (g, y) => {
962
+ var fe;
963
+ const C = (fe = R.current) == null ? void 0 : fe.api;
964
+ if (!C) return;
965
+ const A = [];
966
+ C.forEachNodeAfterFilterAndSort((V) => {
967
+ V.id != null && A.push(V.id);
968
+ });
969
+ const I = A.indexOf(g), _ = A.indexOf(y);
970
+ if (I < 0 || _ < 0) return;
971
+ const [G, se] = I <= _ ? [I, _] : [_, I], oe = new Set(A.slice(G, se + 1));
972
+ C.forEachNode((V) => {
973
+ V.id != null && V.setSelected(oe.has(V.id));
974
+ });
975
+ },
976
+ clearSelection: () => {
977
+ var g, y;
978
+ (y = (g = R.current) == null ? void 0 : g.api) == null || y.deselectAll();
979
+ },
980
+ getFilter: () => {
981
+ var g, y;
982
+ return ((y = (g = R.current) == null ? void 0 : g.api) == null ? void 0 : y.getFilterModel()) ?? {};
983
+ },
984
+ setFilter: (g) => {
985
+ var y, C;
986
+ (C = (y = R.current) == null ? void 0 : y.api) == null || C.setFilterModel(g);
987
+ },
988
+ getSort: () => {
989
+ var y;
990
+ const g = (y = R.current) == null ? void 0 : y.api;
991
+ return g ? g.getColumnState().filter((C) => C.sort === "asc" || C.sort === "desc").map((C) => ({ colId: C.colId, sort: C.sort })) : [];
992
+ },
993
+ setSort: (g) => {
994
+ var A;
995
+ const y = (A = R.current) == null ? void 0 : A.api;
996
+ if (!y) return;
997
+ const C = y.getColumnState().map((I) => {
998
+ const _ = g.find((G) => G.colId === I.colId);
999
+ return { ...I, sort: _ ? _.sort : null };
1000
+ });
1001
+ y.applyColumnState({ state: C, defaultState: { sort: null } });
1002
+ },
1003
+ getCurrentPage: () => {
1004
+ var g, y;
1005
+ return ((y = (g = R.current) == null ? void 0 : g.api) == null ? void 0 : y.paginationGetCurrentPage()) ?? 0;
1006
+ },
1007
+ goToPage: (g) => {
1008
+ var y, C;
1009
+ (C = (y = R.current) == null ? void 0 : y.api) == null || C.paginationGoToPage(g);
1010
+ },
1011
+ getRawApi: () => {
1012
+ var g;
1013
+ return (g = R.current) == null ? void 0 : g.api;
1014
+ }
1015
+ }),
1016
+ []
1017
+ );
1018
+ ct(e, () => ne, [ne]), Nt(Kt, ne, u);
1019
+ const We = K.dir() === "rtl", Qe = n === void 0, Xe = O(
1020
+ () => window.matchMedia("(prefers-reduced-motion: reduce)").matches,
1021
+ []
1022
+ ), Je = O(
1023
+ () => document.documentElement.classList.contains("theme-accessible"),
1024
+ []
1025
+ ) && v === "compact" ? "default" : v, Ze = O(() => {
1026
+ if (s)
1027
+ return s === "single" ? { mode: "singleRow" } : {
1028
+ mode: "multiRow",
1029
+ headerCheckbox: !0,
1030
+ checkboxes: !0
1031
+ };
1032
+ }, [s]), Ye = P(() => {
1033
+ var y;
1034
+ if (!u || !((y = R.current) != null && y.api)) return;
1035
+ const g = Zt(u);
1036
+ g && R.current.api.applyColumnState({
1037
+ state: g,
1038
+ applyOrder: !0
1039
+ });
1040
+ }, [u]), re = P(() => {
1041
+ var g;
1042
+ u && ((g = R.current) != null && g.api) && Yt(u, R.current.api);
1043
+ }, [u]), et = P(() => {
1044
+ var C;
1045
+ const g = (C = R.current) == null ? void 0 : C.api;
1046
+ if (!g) return;
1047
+ const y = g.getSelectedRows();
1048
+ He(y.length), d == null || d(y);
1049
+ }, [d]), tt = P(
1050
+ (g) => {
1051
+ var C;
1052
+ const y = (C = R.current) == null ? void 0 : C.api;
1053
+ if (y) {
1054
+ const I = y.getColumnState().find((_) => _.sort);
1055
+ if (I) {
1056
+ const _ = I.colId, G = y.getColumnDef(_), se = (G == null ? void 0 : G.headerName) ?? _, oe = I.sort === "asc" ? "dataTable.sortAscending" : "dataTable.sortDescending";
1057
+ ae(
1058
+ E("dataTable.sortAnnounce", {
1059
+ column: se,
1060
+ direction: E(oe)
1061
+ })
1062
+ );
1063
+ } else
1064
+ ae("");
1065
+ }
1066
+ l == null || l(g);
1067
+ },
1068
+ [l, E]
1069
+ ), at = P(
1070
+ (g) => {
1071
+ m == null || m(g);
1072
+ },
1073
+ [m]
1074
+ );
1075
+ $(() => {
1076
+ if (!te) return;
1077
+ const g = setTimeout(() => ae(""), 3e3);
1078
+ return () => clearTimeout(g);
1079
+ }, [te]);
1080
+ const nt = S ?? Jt, rt = x ?? Xt, st = P(
1081
+ () => {
1082
+ var g;
1083
+ return (g = R.current) == null ? void 0 : g.api;
1084
+ },
1085
+ []
1086
+ ), ot = P(() => {
1087
+ typeof window < "u" && window.print();
1088
+ }, []), lt = Wt({
1089
+ density: Je,
1090
+ bordered: w,
1091
+ className: p
1092
+ }), it = z ?? /* @__PURE__ */ r(Z, { children: /* @__PURE__ */ r(Z.Actions, { children: /* @__PURE__ */ r(Z.ExportMenu, {}) }) }), dt = N ? !1 : i;
1093
+ return /* @__PURE__ */ D(
1094
+ "div",
1095
+ {
1096
+ className: "ds:flex ds:w-full ds:flex-col ds:gap-[var(--spacing-sm)]",
1097
+ "aria-busy": Qe ? "true" : void 0,
1098
+ "data-component": "data-table",
1099
+ "data-component-id": u,
1100
+ "data-print-mode": N ? "true" : void 0,
1101
+ children: [
1102
+ !N && /* @__PURE__ */ r(
1103
+ Mt,
1104
+ {
1105
+ getApi: st,
1106
+ selectionCount: L,
1107
+ onPrint: ot,
1108
+ children: it
1109
+ }
1110
+ ),
1111
+ /* @__PURE__ */ r(
1112
+ "div",
1113
+ {
1114
+ className: [lt, N ? "" : f].join(" ").trim(),
1115
+ children: /* @__PURE__ */ r(
1116
+ gt,
1117
+ {
1118
+ ref: R,
1119
+ theme: "legacy",
1120
+ columnDefs: a,
1121
+ rowData: n,
1122
+ defaultColDef: {
1123
+ sortable: !0,
1124
+ filter: !0,
1125
+ resizable: !0,
1126
+ floatingFilter: !0,
1127
+ // §13d — faint sort icon advertises which columns are
1128
+ // sortable. v33+ moved this from grid-level to defaultColDef.
1129
+ unSortIcon: !0,
1130
+ ...h == null ? void 0 : h.defaultColDef
1131
+ },
1132
+ rowSelection: Ze,
1133
+ pagination: dt,
1134
+ paginationPageSize: o,
1135
+ paginationPageSizeSelector: c,
1136
+ paginationNumberFormatter: (g) => new Intl.NumberFormat(K.language).format(g.value),
1137
+ animateRows: !Xe,
1138
+ enableRtl: We,
1139
+ ensureDomOrder: !0,
1140
+ enableCellSpan: !0,
1141
+ enableCellTextSelection: !0,
1142
+ copyHeadersToClipboard: !0,
1143
+ accentedSort: !0,
1144
+ multiSortKey: "ctrl",
1145
+ suppressDragLeaveHidesColumns: !0,
1146
+ suppressRowClickSelection: s ? !0 : void 0,
1147
+ tooltipShowDelay: 500,
1148
+ tooltipHideDelay: 5e3,
1149
+ tooltipInteraction: !0,
1150
+ stopEditingWhenCellsLoseFocus: !0,
1151
+ maintainColumnOrder: !0,
1152
+ undoRedoCellEditing: !0,
1153
+ undoRedoCellEditingLimit: 20,
1154
+ suppressCellFocus: !1,
1155
+ rowBuffer: 10,
1156
+ localeText: Ke,
1157
+ noRowsOverlayComponent: nt,
1158
+ loadingOverlayComponent: rt,
1159
+ getRowClass: b,
1160
+ pinnedBottomRowData: T,
1161
+ domLayout: N ? "autoHeight" : void 0,
1162
+ onGridReady: Ye,
1163
+ onColumnMoved: re,
1164
+ onColumnResized: re,
1165
+ onColumnPinned: re,
1166
+ onSortChanged: tt,
1167
+ onFilterChanged: at,
1168
+ onSelectionChanged: et,
1169
+ ...h
1170
+ }
1171
+ )
1172
+ }
1173
+ ),
1174
+ !N && /* @__PURE__ */ r("div", { className: "ds:flex ds:items-center ds:justify-between type-body-sm ds:text-[color:var(--muted-foreground)]", children: L > 0 ? /* @__PURE__ */ r("span", { children: E("dataTable.selected", { count: L }) }) : /* @__PURE__ */ r("span", {}) }),
1175
+ /* @__PURE__ */ r("span", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: te })
1176
+ ]
1177
+ }
1178
+ );
1179
+ }
1180
+ const Ue = M(ea);
1181
+ Ue.displayName = "DataTable";
1182
+ const Qa = Object.assign(Ue, {
1183
+ Toolbar: Z
1184
+ });
1185
+ function Xa(t, e, a) {
1186
+ return O(() => {
1187
+ const n = {};
1188
+ for (const s of e) {
1189
+ let i = 0;
1190
+ for (const o of t ?? []) {
1191
+ const c = o[s], u = typeof c == "number" ? c : Number(c);
1192
+ Number.isFinite(u) && (i += u);
1193
+ }
1194
+ n[s] = i;
1195
+ }
1196
+ return a != null && a.labelField && a.labelValue !== void 0 && (n[a.labelField] = a.labelValue), n;
1197
+ }, [t, e, a == null ? void 0 : a.labelField, a == null ? void 0 : a.labelValue]);
1198
+ }
1199
+ function me(t) {
1200
+ return t ? t.toISOString().slice(0, 10) : null;
1201
+ }
1202
+ function le(t) {
1203
+ if (!t) return;
1204
+ const e = new Date(t);
1205
+ return Number.isNaN(e.getTime()) ? void 0 : e;
1206
+ }
1207
+ function Ja(t) {
1208
+ const { model: e, onModelChange: a, getValue: n, doesRowPassOtherFilter: s } = t, i = {
1209
+ from: le(e == null ? void 0 : e.dateFrom),
1210
+ to: le(e == null ? void 0 : e.dateTo)
1211
+ }, [o, c] = k(i);
1212
+ de({
1213
+ doesFilterPass: (d) => {
1214
+ const l = n(d.node);
1215
+ if (!l) return !1;
1216
+ const m = l instanceof Date ? l : le(String(l));
1217
+ return !(!m || o.from && m < o.from || o.to && m > o.to);
1218
+ }
1219
+ });
1220
+ function u(d) {
1221
+ if (c(d), !d.from && !d.to) {
1222
+ a(null);
1223
+ return;
1224
+ }
1225
+ a({
1226
+ type: "inRange",
1227
+ dateFrom: me(d.from),
1228
+ dateTo: me(d.to)
1229
+ });
1230
+ }
1231
+ return /* @__PURE__ */ r("div", { className: "ds:p-[var(--spacing-sm)] ds:min-w-[280px]", children: /* @__PURE__ */ r(St, { value: o, onChange: u, size: "sm" }) });
1232
+ }
1233
+ function Za(t) {
1234
+ const { model: e, showParentFilter: a } = t, { t: n, i18n: s } = F("ui");
1235
+ function i(u) {
1236
+ if (!u) return "…";
1237
+ const d = new Date(u);
1238
+ return Number.isNaN(d.getTime()) ? "…" : new Intl.DateTimeFormat(s.language || "en", {
1239
+ month: "short",
1240
+ day: "numeric"
1241
+ }).format(d);
1242
+ }
1243
+ const o = (e == null ? void 0 : e.dateFrom) || (e == null ? void 0 : e.dateTo), c = o ? `${i(e.dateFrom)} – ${i(e.dateTo)}` : n("dataTable.selectFilter.all");
1244
+ return /* @__PURE__ */ r(
1245
+ "button",
1246
+ {
1247
+ type: "button",
1248
+ onClick: a,
1249
+ "data-component": "date-range-floating-filter",
1250
+ className: "ds:flex ds:w-full ds:items-center ds:justify-between ds:gap-[var(--spacing-xs)] ds:rounded-[var(--radius-sm)] ds:border ds:border-[var(--border)] ds:bg-[var(--background)] ds:px-[var(--spacing-sm)] ds:text-[length:var(--font-size-sm)] ds:text-[var(--foreground)] ds:[block-size:calc(var(--min-target-size)_-_var(--spacing-sm))] ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-[color:var(--ring)]",
1251
+ children: /* @__PURE__ */ r("span", { className: o ? "" : "ds:text-[var(--muted-foreground)]", children: c })
1252
+ }
1253
+ );
1254
+ }
1255
+ function q(t) {
1256
+ return typeof t == "number" ? `n:${t}` : `s:${t}`;
1257
+ }
1258
+ function Ya(t) {
1259
+ const { model: e, onModelChange: a, getValue: n, api: s, column: i, options: o, placeholder: c } = t, { t: u } = F("ui"), d = O(() => {
1260
+ if (o && o.length > 0) return o;
1261
+ if (!s || !i) return [];
1262
+ const f = /* @__PURE__ */ new Map();
1263
+ return s.forEachNode((p) => {
1264
+ const b = n(p);
1265
+ if (b == null) return;
1266
+ const T = typeof b == "string" || typeof b == "number" ? b : String(b), N = q(T);
1267
+ f.has(N) || f.set(N, { value: T, label: String(T) });
1268
+ }), Array.from(f.values()).sort(
1269
+ (p, b) => String(p.label).localeCompare(String(b.label))
1270
+ );
1271
+ }, [o, s, i, n]), l = O(() => {
1272
+ const f = /* @__PURE__ */ new Set(), p = (e == null ? void 0 : e.values) ?? [];
1273
+ for (const b of p) f.add(q(b));
1274
+ return f;
1275
+ }, [e]), [m, S] = k(l);
1276
+ $(() => {
1277
+ S(l);
1278
+ }, [l]), de({
1279
+ doesFilterPass: (f) => {
1280
+ const p = e == null ? void 0 : e.values;
1281
+ if (!p || p.length === 0) return !0;
1282
+ const b = n(f.node);
1283
+ if (b == null) return !1;
1284
+ const T = typeof b == "string" || typeof b == "number" ? b : String(b), N = q(T);
1285
+ return p.some((z) => q(z) === N);
1286
+ }
1287
+ });
1288
+ function x(f) {
1289
+ S((p) => {
1290
+ const b = new Set(p);
1291
+ return b.has(f) ? b.delete(f) : b.add(f), b;
1292
+ });
1293
+ }
1294
+ function h() {
1295
+ if (m.size === 0) {
1296
+ a(null);
1297
+ return;
1298
+ }
1299
+ const f = [];
1300
+ for (const p of d)
1301
+ m.has(q(p.value)) && f.push(p.value);
1302
+ a({ type: "set", values: f });
1303
+ }
1304
+ function v() {
1305
+ S(/* @__PURE__ */ new Set()), a(null);
1306
+ }
1307
+ const w = c ?? u("dataTable.selectFilter.all");
1308
+ return /* @__PURE__ */ D(
1309
+ "div",
1310
+ {
1311
+ "data-component": "select-filter",
1312
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-sm)] ds:min-w-[200px] ds:max-w-[260px]",
1313
+ children: [
1314
+ /* @__PURE__ */ r(
1315
+ "div",
1316
+ {
1317
+ role: "group",
1318
+ "aria-label": w,
1319
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:max-h-[240px] ds:overflow-y-auto",
1320
+ children: d.length === 0 ? /* @__PURE__ */ r("p", { className: "ds:text-[length:var(--font-size-sm)] ds:text-[var(--muted-foreground)] ds:py-[var(--spacing-xs)]", children: u("dataTable.agGrid.noRowsToShow") }) : d.map((f) => {
1321
+ const p = q(f.value);
1322
+ return /* @__PURE__ */ r(
1323
+ Ce,
1324
+ {
1325
+ size: "sm",
1326
+ label: f.label,
1327
+ checked: m.has(p),
1328
+ onCheckedChange: () => x(p)
1329
+ },
1330
+ p
1331
+ );
1332
+ })
1333
+ }
1334
+ ),
1335
+ /* @__PURE__ */ D("div", { className: "ds:flex ds:items-center ds:justify-end ds:gap-[var(--spacing-xs)] ds:pt-[var(--spacing-xs)] ds:border-t ds:border-[var(--border)]", children: [
1336
+ /* @__PURE__ */ r(H, { intent: "ghost", size: "sm", onClick: v, type: "button", children: u("dataTable.selectFilter.clear") }),
1337
+ /* @__PURE__ */ r(H, { intent: "primary", size: "sm", onClick: h, type: "button", children: u("dataTable.selectFilter.apply") })
1338
+ ] })
1339
+ ]
1340
+ }
1341
+ );
1342
+ }
1343
+ function en(t) {
1344
+ var o;
1345
+ const { model: e, showParentFilter: a } = t, { t: n } = F("ui"), s = ((o = e == null ? void 0 : e.values) == null ? void 0 : o.length) ?? 0, i = s === 0 ? n("dataTable.selectFilter.all") : n("dataTable.selectFilter.selectedCount", { count: s });
1346
+ return /* @__PURE__ */ r(
1347
+ "button",
1348
+ {
1349
+ type: "button",
1350
+ onClick: a,
1351
+ "data-component": "select-floating-filter",
1352
+ className: "ds:flex ds:w-full ds:items-center ds:justify-between ds:gap-[var(--spacing-xs)] ds:rounded-[var(--radius-sm)] ds:border ds:border-[var(--border)] ds:bg-[var(--background)] ds:px-[var(--spacing-sm)] ds:text-[length:var(--font-size-sm)] ds:text-[var(--foreground)] ds:[block-size:calc(var(--min-target-size)_-_var(--spacing-sm))] ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-[color:var(--ring)]",
1353
+ children: /* @__PURE__ */ r("span", { className: s === 0 ? "ds:text-[var(--muted-foreground)]" : "", children: i })
1354
+ }
1355
+ );
1356
+ }
1357
+ function X(t) {
1358
+ return t.trim().toLocaleLowerCase();
1359
+ }
1360
+ function tn(t) {
1361
+ const {
1362
+ model: e,
1363
+ onModelChange: a,
1364
+ getValue: n,
1365
+ api: s,
1366
+ column: i,
1367
+ options: o,
1368
+ loadOptions: c,
1369
+ placeholder: u
1370
+ } = t, { t: d } = F("ui"), l = O(() => {
1371
+ if (o && o.length > 0) return o;
1372
+ if (!s || !i) return [];
1373
+ const p = /* @__PURE__ */ new Map();
1374
+ return s.forEachNode((b) => {
1375
+ const T = n(b);
1376
+ if (T == null) return;
1377
+ const N = typeof T == "string" ? T : String(T);
1378
+ p.has(N) || p.set(N, { value: N, label: N });
1379
+ }), Array.from(p.values()).sort(
1380
+ (b, T) => b.label.localeCompare(T.label)
1381
+ );
1382
+ }, [o, s, i, n]), m = O(() => async (p, b) => {
1383
+ if (c)
1384
+ return (await c(p, b)).map((E) => ({ value: E.value, label: E.label }));
1385
+ const T = X(p);
1386
+ return (T ? l.filter((z) => X(z.label).includes(T)) : l).slice(0, 50).map((z) => ({ value: z.value, label: z.label }));
1387
+ }, [c, l]), [S, x] = k((e == null ? void 0 : e.value) ?? "");
1388
+ $(() => {
1389
+ x((e == null ? void 0 : e.value) ?? "");
1390
+ }, [e == null ? void 0 : e.value]), de({
1391
+ doesFilterPass: (p) => {
1392
+ const b = e == null ? void 0 : e.value;
1393
+ if (!b) return !0;
1394
+ const T = n(p.node);
1395
+ if (T == null) return !1;
1396
+ const N = typeof T == "string" ? T : String(T);
1397
+ return X(N) === X(b);
1398
+ }
1399
+ });
1400
+ function h(p) {
1401
+ x(p.label), a({ type: "equals", value: p.value });
1402
+ }
1403
+ function v(p) {
1404
+ x(p), p === "" && e && a(null);
1405
+ }
1406
+ function w() {
1407
+ x(""), a(null);
1408
+ }
1409
+ const f = u ?? d("dataTable.typeaheadFilter.placeholder");
1410
+ return /* @__PURE__ */ D(
1411
+ "div",
1412
+ {
1413
+ "data-component": "typeahead-filter",
1414
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-sm)] ds:min-w-[240px]",
1415
+ children: [
1416
+ /* @__PURE__ */ r(
1417
+ Ft,
1418
+ {
1419
+ size: "sm",
1420
+ value: S,
1421
+ onChange: v,
1422
+ onSelect: h,
1423
+ loadOptions: m,
1424
+ placeholder: f,
1425
+ "aria-label": f
1426
+ }
1427
+ ),
1428
+ /* @__PURE__ */ r("div", { className: "ds:flex ds:items-center ds:justify-end ds:pt-[var(--spacing-xs)] ds:border-t ds:border-[var(--border)]", children: /* @__PURE__ */ r(H, { intent: "ghost", size: "sm", onClick: w, type: "button", children: d("dataTable.typeaheadFilter.clear") }) })
1429
+ ]
1430
+ }
1431
+ );
1432
+ }
1433
+ function an(t) {
1434
+ const { model: e, showParentFilter: a } = t, { t: n } = F("ui"), s = e == null ? void 0 : e.value, i = s || n("dataTable.selectFilter.all");
1435
+ return /* @__PURE__ */ r(
1436
+ "button",
1437
+ {
1438
+ type: "button",
1439
+ onClick: a,
1440
+ "data-component": "typeahead-floating-filter",
1441
+ className: "ds:flex ds:w-full ds:items-center ds:justify-between ds:gap-[var(--spacing-xs)] ds:rounded-[var(--radius-sm)] ds:border ds:border-[var(--border)] ds:bg-[var(--background)] ds:px-[var(--spacing-sm)] ds:text-[length:var(--font-size-sm)] ds:text-[var(--foreground)] ds:[block-size:calc(var(--min-target-size)_-_var(--spacing-sm))] ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-[color:var(--ring)]",
1442
+ children: /* @__PURE__ */ r("span", { className: s ? "" : "ds:text-[var(--muted-foreground)]", children: i })
1443
+ }
1444
+ );
1445
+ }
1446
+ function nn(t) {
1447
+ const { value: e, variantMap: a } = t, n = (a == null ? void 0 : a[e]) ?? "neutral";
1448
+ return /* @__PURE__ */ r(Rt, { variant: n, withDot: !0, size: "sm", children: String(e ?? "") });
1449
+ }
1450
+ function rn(t) {
1451
+ const { value: e } = t;
1452
+ return e ? /* @__PURE__ */ D("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
1453
+ /* @__PURE__ */ r(Ne, { name: e.name, src: e.src, size: "sm" }),
1454
+ /* @__PURE__ */ r("span", { children: e.name })
1455
+ ] }) : null;
1456
+ }
1457
+ const ta = {
1458
+ sm: "ds:size-8",
1459
+ md: "ds:size-10",
1460
+ lg: "ds:size-12"
1461
+ }, aa = {
1462
+ square: "ds:rounded-none",
1463
+ rounded: "ds:rounded-[var(--radius-md)]",
1464
+ circle: "ds:rounded-[var(--radius-full)]"
1465
+ };
1466
+ function ie(t, e) {
1467
+ if (!t || typeof t != "object") return;
1468
+ const a = t[e];
1469
+ return typeof a == "string" ? a : void 0;
1470
+ }
1471
+ const na = /^(?:https?:|data:image\/)/i;
1472
+ function ra(t) {
1473
+ if (!t) return;
1474
+ const e = t.trim();
1475
+ if (e.length !== 0)
1476
+ return na.test(e) ? e : void 0;
1477
+ }
1478
+ function sn(t) {
1479
+ const {
1480
+ data: e,
1481
+ srcField: a,
1482
+ altField: n,
1483
+ fallbackField: s,
1484
+ size: i = "md",
1485
+ shape: o = "rounded"
1486
+ } = t;
1487
+ if (!e) return null;
1488
+ const c = ie(e, a), u = ra(c), d = n ? ie(e, n) ?? "" : "", l = s ? ie(e, s) : void 0;
1489
+ return u ? /* @__PURE__ */ r(
1490
+ "img",
1491
+ {
1492
+ src: u,
1493
+ alt: d,
1494
+ loading: "lazy",
1495
+ decoding: "async",
1496
+ className: ["ds:object-cover", ta[i], aa[o]].join(
1497
+ " "
1498
+ )
1499
+ }
1500
+ ) : l ? /* @__PURE__ */ r(Ne, { name: l, size: i }) : null;
1501
+ }
1502
+ function on(t) {
1503
+ const { value: e, maxVisible: a = 3 } = t, { t: n } = F();
1504
+ if (!Array.isArray(e) || e.length === 0) return null;
1505
+ const s = e.slice(0, a), i = e.length - a;
1506
+ return /* @__PURE__ */ D("span", { className: "ds:inline-flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", children: [
1507
+ s.map((o) => /* @__PURE__ */ r(Y, { label: o, size: "sm" }, o)),
1508
+ i > 0 && /* @__PURE__ */ r(kt, { label: e.slice(a).join(", "), children: /* @__PURE__ */ r(
1509
+ Y,
1510
+ {
1511
+ label: n("inputs.multiSelect.overflow", { count: i }),
1512
+ size: "sm",
1513
+ variant: "neutral",
1514
+ fill: "outline"
1515
+ }
1516
+ ) })
1517
+ ] });
1518
+ }
1519
+ const sa = {
1520
+ date: { year: "numeric", month: "short", day: "numeric" },
1521
+ time: { hour: "2-digit", minute: "2-digit" },
1522
+ datetime: {
1523
+ year: "numeric",
1524
+ month: "short",
1525
+ day: "numeric",
1526
+ hour: "2-digit",
1527
+ minute: "2-digit"
1528
+ }
1529
+ };
1530
+ function ln(t) {
1531
+ const { value: e, format: a = "date", options: n } = t;
1532
+ return e == null || e === "" ? null : a === "relative" && !n ? /* @__PURE__ */ r(pe, { value: e, shape: "bare" }) : /* @__PURE__ */ r(
1533
+ pe,
1534
+ {
1535
+ value: e,
1536
+ format: "absolute",
1537
+ shape: "bare",
1538
+ absoluteFormat: n ?? sa[a === "relative" ? "date" : a]
1539
+ }
1540
+ );
1541
+ }
1542
+ function oa(t) {
1543
+ if (t == null || t === "") return null;
1544
+ const e = typeof t == "number" ? t : Number(t);
1545
+ return Number.isFinite(e) ? e : null;
1546
+ }
1547
+ function dn(t) {
1548
+ const {
1549
+ value: e,
1550
+ currency: a = "EUR",
1551
+ colorNegative: n,
1552
+ strikethrough: s,
1553
+ options: i
1554
+ } = t, { i18n: o } = F(), c = oa(e);
1555
+ if (c === null) return null;
1556
+ const u = o.language || "en", d = new Intl.NumberFormat(u, {
1557
+ style: "currency",
1558
+ currency: a,
1559
+ ...i
1560
+ }).format(c), l = ["ds:tabular-nums"];
1561
+ return n && c < 0 && l.push("ds:text-[color:var(--destructive)]"), s && l.push("line-through"), /* @__PURE__ */ r("span", { className: l.join(" "), children: d });
1562
+ }
1563
+ function la(t) {
1564
+ if (!Te(t)) return t;
1565
+ const e = t, a = e.props.className ?? "", n = /\bsize-|\bw-|\bh-/.test(a) ? a : `${a} size-4`.trim();
1566
+ return xe(e, { className: n, size: e.props.size ?? 16 });
1567
+ }
1568
+ function ge(t, e) {
1569
+ return typeof t == "function" ? t(e) : !!t;
1570
+ }
1571
+ function cn(t) {
1572
+ const { data: e, actions: a } = t;
1573
+ return e ? /* @__PURE__ */ r("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: a.map((n, s) => {
1574
+ if (ge(n.hidden, e)) return null;
1575
+ const i = ge(n.disabled, e), o = i && n.disabledReason ? n.disabledReason : n.label, c = n.variant === "destructive";
1576
+ return /* @__PURE__ */ r(
1577
+ B,
1578
+ {
1579
+ size: "sm",
1580
+ intent: "ghost",
1581
+ icon: la(n.icon),
1582
+ tooltip: o,
1583
+ "aria-label": n.label,
1584
+ disabled: i,
1585
+ onClick: (u) => {
1586
+ u.stopPropagation(), n.onClick(e);
1587
+ },
1588
+ className: c ? "ds:text-[color:var(--destructive)] ds:hover:text-[color:var(--destructive-hover)]" : void 0
1589
+ },
1590
+ s
1591
+ );
1592
+ }) }) : null;
1593
+ }
1594
+ function be(t, e) {
1595
+ return typeof t == "function" ? t(e) : t;
1596
+ }
1597
+ function ia(t) {
1598
+ return /^(https?:\/\/|\/|#|mailto:|tel:)/i.test(t) ? t : "#";
1599
+ }
1600
+ function un(t) {
1601
+ const { value: e, data: a, href: n, onClick: s, secondary: i } = t;
1602
+ if (!a) return null;
1603
+ const o = be(n, a), c = be(i, a), u = e == null || e === "" ? "" : String(e), d = [
1604
+ "ds:text-[color:var(--primary)]",
1605
+ "ds:hover:underline",
1606
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
1607
+ "ds:focus-visible:outline-solid",
1608
+ "ds:focus-visible:outline-[color:var(--ring)]",
1609
+ "ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
1610
+ "ds:rounded-[var(--radius-sm)]"
1611
+ ].join(" "), l = (m) => {
1612
+ s && (o || m.preventDefault(), m.stopPropagation(), s(a));
1613
+ };
1614
+ return /* @__PURE__ */ D("span", { className: "ds:flex ds:flex-col ds:leading-tight", children: [
1615
+ o ? /* @__PURE__ */ r(
1616
+ "a",
1617
+ {
1618
+ href: ia(o),
1619
+ onClick: l,
1620
+ className: d,
1621
+ children: u
1622
+ }
1623
+ ) : /* @__PURE__ */ r(
1624
+ "button",
1625
+ {
1626
+ type: "button",
1627
+ onClick: l,
1628
+ className: [
1629
+ "ds:appearance-none ds:bg-transparent ds:p-0 ds:text-start",
1630
+ d
1631
+ ].join(" "),
1632
+ children: u
1633
+ }
1634
+ ),
1635
+ c ? /* @__PURE__ */ r("span", { className: "type-meta ds:text-[color:var(--muted-foreground)]", children: c }) : null
1636
+ ] });
1637
+ }
1638
+ function fn(t) {
1639
+ const {
1640
+ value: e,
1641
+ data: a,
1642
+ onToggle: n,
1643
+ onError: s,
1644
+ trueIcon: i,
1645
+ falseIcon: o,
1646
+ trueClass: c = "ds:text-[color:var(--success)]",
1647
+ falseClass: u = "ds:text-[color:var(--muted-foreground)]",
1648
+ label: d
1649
+ } = t, { t: l } = F(), [m, S] = k(!1);
1650
+ if (!a) return null;
1651
+ const x = !!e, h = x ? i ?? /* @__PURE__ */ r(Dt, { "aria-hidden": !0, className: "ds:size-4" }) : o ?? /* @__PURE__ */ r(It, { "aria-hidden": !0, className: "ds:size-4" }), v = x ? c : u, w = d ?? l(x ? "inputs.switch.on" : "inputs.switch.off");
1652
+ async function f(p) {
1653
+ if (p.stopPropagation(), m || !a) return;
1654
+ const T = n(a, !x);
1655
+ if (T && typeof T.then == "function") {
1656
+ S(!0);
1657
+ try {
1658
+ await T;
1659
+ } catch (N) {
1660
+ s == null || s(a, N);
1661
+ } finally {
1662
+ S(!1);
1663
+ }
1664
+ }
1665
+ }
1666
+ return /* @__PURE__ */ r(
1667
+ "button",
1668
+ {
1669
+ type: "button",
1670
+ role: "switch",
1671
+ "aria-checked": x,
1672
+ "aria-busy": m,
1673
+ "aria-label": w,
1674
+ disabled: m,
1675
+ onClick: f,
1676
+ className: [
1677
+ "ds:inline-flex ds:items-center ds:justify-center",
1678
+ "ds:min-h-[var(--min-target-size)] ds:min-w-[var(--min-target-size)]",
1679
+ "ds:appearance-none ds:bg-transparent ds:p-[var(--spacing-xs)]",
1680
+ "ds:rounded-[var(--radius-sm)]",
1681
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
1682
+ "ds:focus-visible:outline-solid",
1683
+ "ds:focus-visible:outline-[color:var(--ring)]",
1684
+ "ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
1685
+ "ds:disabled:opacity-50",
1686
+ v
1687
+ ].join(" "),
1688
+ children: h
1689
+ }
1690
+ );
1691
+ }
1692
+ const da = {
1693
+ sm: "ds:size-[var(--icon-size-sm)]",
1694
+ md: "ds:size-[var(--icon-size-md)]",
1695
+ lg: "ds:size-[var(--icon-size-lg)]"
1696
+ };
1697
+ function he(t, e) {
1698
+ if (!t || typeof t != "object") return;
1699
+ const a = t[e];
1700
+ return typeof a == "string" ? a : void 0;
1701
+ }
1702
+ const ca = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i, ua = /^rgba?\(\s*[\d.\s,%/]+\)$/i, fa = /^hsla?\(\s*[\d.\s,%/]+\)$/i, pa = /^var\(--[a-z0-9-]+(?:,\s*[^)]+)?\)$/i;
1703
+ function ma(t) {
1704
+ if (!t) return;
1705
+ const e = t.trim();
1706
+ if (ca.test(e) || ua.test(e) || fa.test(e) || pa.test(e))
1707
+ return e;
1708
+ }
1709
+ function pn(t) {
1710
+ const { data: e, colorField: a, size: n = "md", labelField: s } = t, i = W(null), o = e ? he(e, a) : void 0, c = ma(o), u = e && s ? he(e, s) : void 0;
1711
+ return ut(() => {
1712
+ const d = i.current;
1713
+ d && (c ? d.style.setProperty("--data-table-dot-color", c) : d.style.removeProperty("--data-table-dot-color"));
1714
+ }, [c]), c ? /* @__PURE__ */ D("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
1715
+ /* @__PURE__ */ r(
1716
+ "span",
1717
+ {
1718
+ ref: i,
1719
+ "aria-hidden": "true",
1720
+ className: [
1721
+ "ds:inline-block ds:shrink-0 ds:rounded-[var(--radius-full)]",
1722
+ "ds:bg-[var(--data-table-dot-color)]",
1723
+ "ds:border ds:border-[color:var(--border)]",
1724
+ da[n]
1725
+ ].join(" ")
1726
+ }
1727
+ ),
1728
+ u ? /* @__PURE__ */ r("span", { children: u }) : null
1729
+ ] }) : null;
1730
+ }
1731
+ function ga(t, e) {
1732
+ if (!t || typeof t != "object") return null;
1733
+ const a = t[e], n = typeof a == "number" ? a : Number(a);
1734
+ return Number.isFinite(n) ? n : null;
1735
+ }
1736
+ function mn(t) {
1737
+ const { data: e, lines: a, currency: n = "EUR", highlightNegative: s } = t, { i18n: i } = F();
1738
+ if (!e) return null;
1739
+ const o = i.language || "en", c = (d) => {
1740
+ const l = ga(e, d.valueField);
1741
+ if (l === null) return null;
1742
+ let m;
1743
+ switch (d.format ?? "number") {
1744
+ case "currency":
1745
+ m = new Intl.NumberFormat(o, {
1746
+ style: "currency",
1747
+ currency: n
1748
+ }).format(l);
1749
+ break;
1750
+ case "percent":
1751
+ m = new Intl.NumberFormat(o, {
1752
+ style: "percent",
1753
+ maximumFractionDigits: 1
1754
+ }).format(l / 100);
1755
+ break;
1756
+ default:
1757
+ m = new Intl.NumberFormat(o).format(l);
1758
+ }
1759
+ return {
1760
+ label: d.label,
1761
+ formatted: m,
1762
+ negative: !!s && l < 0
1763
+ };
1764
+ }, u = a.map(c).filter(
1765
+ (d) => d !== null
1766
+ );
1767
+ return u.length === 0 ? null : /* @__PURE__ */ r(
1768
+ "div",
1769
+ {
1770
+ className: [
1771
+ "ds:flex",
1772
+ "ds:flex-wrap",
1773
+ "ds:items-center",
1774
+ "ds:gap-x-[var(--spacing-sm)]",
1775
+ "ds:gap-y-0",
1776
+ "type-meta",
1777
+ "ds:leading-tight"
1778
+ ].join(" "),
1779
+ children: u.map((d, l) => /* @__PURE__ */ D(
1780
+ "span",
1781
+ {
1782
+ className: "ds:inline-flex ds:items-baseline ds:gap-x-[var(--spacing-xs)]",
1783
+ children: [
1784
+ l > 0 ? /* @__PURE__ */ r(
1785
+ "span",
1786
+ {
1787
+ "aria-hidden": "true",
1788
+ className: "ds:me-[var(--spacing-xs)] ds:text-[color:var(--muted-foreground)]",
1789
+ children: "·"
1790
+ }
1791
+ ) : null,
1792
+ /* @__PURE__ */ r("span", { className: "ds:text-[color:var(--muted-foreground)]", children: d.label }),
1793
+ /* @__PURE__ */ r(
1794
+ "span",
1795
+ {
1796
+ className: [
1797
+ "ds:tabular-nums",
1798
+ "ds:font-medium",
1799
+ d.negative ? "ds:text-[color:var(--destructive)]" : ""
1800
+ ].filter(Boolean).join(" "),
1801
+ children: d.formatted
1802
+ }
1803
+ )
1804
+ ]
1805
+ },
1806
+ `${d.label}-${l}`
1807
+ ))
1808
+ }
1809
+ );
1810
+ }
1811
+ function gn(t) {
1812
+ var d, l;
1813
+ const { initialValue: e, onValueChange: a, stopEditing: n, column: s } = t, [i, o] = k(e ?? ""), c = W(null);
1814
+ $(() => {
1815
+ const m = c.current;
1816
+ m && (m.focus(), m.select());
1817
+ }, []);
1818
+ const u = ((l = (d = s == null ? void 0 : s.getColDef) == null ? void 0 : d.call(s)) == null ? void 0 : l.headerName) ?? void 0;
1819
+ return /* @__PURE__ */ r(
1820
+ "input",
1821
+ {
1822
+ ref: c,
1823
+ type: "text",
1824
+ value: i,
1825
+ "aria-label": u,
1826
+ onChange: (m) => {
1827
+ const S = m.target.value;
1828
+ o(S), a(S);
1829
+ },
1830
+ onKeyDown: (m) => {
1831
+ m.key === "Enter" && (m.preventDefault(), n());
1832
+ },
1833
+ className: [
1834
+ "ds:block ds:w-full ds:appearance-none",
1835
+ // Input surface chrome: rounded border + bg + focus halo.
1836
+ Se,
1837
+ // Use the `md` height (`--min-target-size`) so the input
1838
+ // auto-lifts to 48px under `.theme-accessible` to satisfy
1839
+ // WCAG 2.5.5 target size.
1840
+ Fe.md,
1841
+ Re.sm,
1842
+ ke.sm
1843
+ ].join(" ")
1844
+ }
1845
+ );
1846
+ }
1847
+ function bn(t) {
1848
+ var v, w;
1849
+ const {
1850
+ initialValue: e,
1851
+ onValueChange: a,
1852
+ stopEditing: n,
1853
+ column: s,
1854
+ decimals: i = 2,
1855
+ min: o,
1856
+ max: c
1857
+ } = t, { i18n: u } = F(), d = W(null), l = ((w = (v = s == null ? void 0 : s.getColDef) == null ? void 0 : v.call(s)) == null ? void 0 : w.headerName) ?? void 0, [m, S] = k(() => e == null || Number.isNaN(e) ? "" : String(e));
1858
+ $(() => {
1859
+ const f = d.current;
1860
+ f && (f.focus(), f.select());
1861
+ }, []);
1862
+ function x(f) {
1863
+ var K, R;
1864
+ if (f.trim().length === 0) return null;
1865
+ const p = u.language || "en", b = new Intl.NumberFormat(p).formatToParts(12345.6), T = ((K = b.find((L) => L.type === "group")) == null ? void 0 : K.value) ?? "", N = ((R = b.find((L) => L.type === "decimal")) == null ? void 0 : R.value) ?? ".", z = f.replace(new RegExp(`\\${T}`, "g"), "").replace(N, ".").replace(/[^\d.-]/g, ""), E = Number(z);
1866
+ return Number.isFinite(E) ? E : null;
1867
+ }
1868
+ function h(f) {
1869
+ const p = x(f);
1870
+ if (p == null) {
1871
+ a(null);
1872
+ return;
1873
+ }
1874
+ let b = p;
1875
+ typeof o == "number" && (b = Math.max(o, b)), typeof c == "number" && (b = Math.min(c, b));
1876
+ const T = 10 ** i;
1877
+ a(Math.round(b * T) / T);
1878
+ }
1879
+ return /* @__PURE__ */ r(
1880
+ "input",
1881
+ {
1882
+ ref: d,
1883
+ type: "text",
1884
+ inputMode: "decimal",
1885
+ value: m,
1886
+ "aria-label": l,
1887
+ onChange: (f) => {
1888
+ const p = f.target.value;
1889
+ S(p), h(p);
1890
+ },
1891
+ onKeyDown: (f) => {
1892
+ f.key === "Enter" && (f.preventDefault(), n());
1893
+ },
1894
+ className: [
1895
+ "ds:block ds:w-full ds:appearance-none ds:text-end ds:tabular-nums",
1896
+ Se,
1897
+ // Use `md` height — see editable-text-cell-renderer for rationale.
1898
+ Fe.md,
1899
+ Re.sm,
1900
+ ke.sm
1901
+ ].join(" ")
1902
+ }
1903
+ );
1904
+ }
1905
+ export {
1906
+ cn as A,
1907
+ mn as B,
1908
+ pn as C,
1909
+ Qa as D,
1910
+ bn as E,
1911
+ sn as I,
1912
+ un as L,
1913
+ Ya as S,
1914
+ on as T,
1915
+ rn as U,
1916
+ dn as a,
1917
+ ln as b,
1918
+ Ja as c,
1919
+ Za as d,
1920
+ gn as e,
1921
+ en as f,
1922
+ nn as g,
1923
+ fn as h,
1924
+ Z as i,
1925
+ Mt as j,
1926
+ tn as k,
1927
+ an as l,
1928
+ Kt as m,
1929
+ Pe as n,
1930
+ Xa as u
1931
+ };
1932
+ //# sourceMappingURL=editable-currency-cell-renderer-Dn3-ANF5.js.map