@rafal.lemieszewski/tide-ui 0.83.0 → 0.84.3

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 (256) hide show
  1. package/README.md +20 -8
  2. package/dist/cjs/components/core-index.cjs +1 -0
  3. package/dist/cjs/components/fundamental/accordion.cjs +1 -0
  4. package/dist/cjs/components/fundamental/alert-dialog.cjs +1 -0
  5. package/dist/cjs/components/fundamental/alert.cjs +1 -0
  6. package/dist/cjs/components/fundamental/autocomplete-search.cjs +1 -0
  7. package/dist/cjs/components/fundamental/avatar-group.cjs +1 -0
  8. package/dist/cjs/components/fundamental/avatar.cjs +1 -0
  9. package/dist/cjs/components/fundamental/badge.cjs +1 -0
  10. package/dist/cjs/components/fundamental/breadcrumb.cjs +1 -0
  11. package/dist/cjs/components/fundamental/button-group.cjs +1 -0
  12. package/dist/cjs/components/fundamental/button.cjs +1 -0
  13. package/dist/cjs/components/fundamental/calendar.cjs +1 -0
  14. package/dist/cjs/components/fundamental/card.cjs +1 -0
  15. package/dist/cjs/components/fundamental/chart.cjs +1 -0
  16. package/dist/cjs/components/fundamental/checkbox.cjs +1 -0
  17. package/dist/cjs/components/fundamental/collapsible.cjs +1 -0
  18. package/dist/cjs/components/fundamental/combobox.cjs +1 -0
  19. package/dist/cjs/components/fundamental/command.cjs +1 -0
  20. package/dist/cjs/components/fundamental/country-dropdown.cjs +1 -0
  21. package/dist/cjs/components/fundamental/custom-icons.cjs +1 -0
  22. package/dist/cjs/components/fundamental/date-picker.cjs +1 -0
  23. package/dist/cjs/components/fundamental/dialog.cjs +1 -0
  24. package/dist/cjs/components/fundamental/drawer.cjs +1 -0
  25. package/dist/cjs/components/fundamental/dropdown-menu.cjs +1 -0
  26. package/dist/cjs/components/fundamental/editable.cjs +1 -0
  27. package/dist/cjs/components/fundamental/empty.cjs +1 -0
  28. package/dist/cjs/components/fundamental/file-upload.cjs +1 -0
  29. package/dist/cjs/components/fundamental/flag.cjs +1 -0
  30. package/dist/cjs/components/fundamental/form-field.cjs +1 -0
  31. package/dist/cjs/components/fundamental/hover-card.cjs +1 -0
  32. package/dist/cjs/components/fundamental/icon.cjs +1 -0
  33. package/dist/cjs/components/fundamental/input-group.cjs +1 -0
  34. package/dist/cjs/components/fundamental/input.cjs +1 -0
  35. package/dist/cjs/components/fundamental/kbd.cjs +1 -0
  36. package/dist/cjs/components/fundamental/label.cjs +1 -0
  37. package/dist/cjs/components/fundamental/month-picker.cjs +1 -0
  38. package/dist/cjs/components/fundamental/pagination.cjs +1 -0
  39. package/dist/cjs/components/fundamental/popover.cjs +1 -0
  40. package/dist/cjs/components/fundamental/progress.cjs +1 -0
  41. package/dist/cjs/components/fundamental/radio-group.cjs +1 -0
  42. package/dist/cjs/components/fundamental/resizable.cjs +1 -0
  43. package/dist/cjs/components/fundamental/scroll-area.cjs +1 -0
  44. package/dist/cjs/components/fundamental/select.cjs +1 -0
  45. package/dist/cjs/components/fundamental/separator.cjs +1 -0
  46. package/dist/cjs/components/fundamental/sheet.cjs +1 -0
  47. package/dist/cjs/components/fundamental/sidebar.cjs +1 -0
  48. package/dist/cjs/components/fundamental/skeleton.cjs +1 -0
  49. package/dist/cjs/components/fundamental/slider.cjs +1 -0
  50. package/dist/cjs/components/fundamental/spinner.cjs +1 -0
  51. package/dist/cjs/components/fundamental/switch.cjs +1 -0
  52. package/dist/cjs/components/fundamental/table.cjs +1 -0
  53. package/dist/cjs/components/fundamental/tabs.cjs +1 -0
  54. package/dist/cjs/components/fundamental/tag.cjs +27 -0
  55. package/dist/cjs/components/fundamental/text-link.cjs +1 -0
  56. package/dist/cjs/components/fundamental/textarea.cjs +1 -0
  57. package/dist/cjs/components/fundamental/toast.cjs +1 -0
  58. package/dist/cjs/components/fundamental/toggle-group.cjs +1 -0
  59. package/dist/cjs/components/fundamental/toggle.cjs +1 -0
  60. package/dist/cjs/components/fundamental/tooltip.cjs +1 -0
  61. package/dist/cjs/components/fundamental/tree.cjs +1 -0
  62. package/dist/cjs/components/product/activity-log.cjs +1 -0
  63. package/dist/cjs/components/product/app-frame.cjs +1 -0
  64. package/dist/cjs/components/product/attributes-list.cjs +1 -0
  65. package/dist/cjs/components/product/bookmarks.cjs +1 -0
  66. package/dist/cjs/components/product/data-table-settings-menu.cjs +1 -0
  67. package/dist/cjs/components/product/data-table.cjs +1 -0
  68. package/dist/cjs/components/product/filters.cjs +1 -0
  69. package/dist/cjs/components/product/fixture-status.cjs +1 -0
  70. package/dist/cjs/components/product/linked-chart.cjs +1 -0
  71. package/dist/cjs/components/product/view-mode-menu.cjs +1 -0
  72. package/dist/cjs/lib/date-utils.cjs +1 -0
  73. package/dist/cjs/lib/hooks.cjs +1 -0
  74. package/dist/cjs/lib/index.cjs +1 -0
  75. package/dist/cjs/lib/utils.cjs +1 -0
  76. package/dist/es/components/core-index.js +37 -0
  77. package/dist/es/components/fundamental/accordion.js +60 -0
  78. package/dist/es/components/fundamental/alert-dialog.js +116 -0
  79. package/dist/es/components/fundamental/alert.js +65 -0
  80. package/dist/es/components/fundamental/autocomplete-search.js +139 -0
  81. package/dist/es/components/fundamental/avatar-group.js +51 -0
  82. package/dist/es/components/fundamental/avatar.js +165 -0
  83. package/dist/es/components/fundamental/badge.js +157 -0
  84. package/dist/es/components/fundamental/breadcrumb.js +142 -0
  85. package/dist/es/components/fundamental/button-group.js +86 -0
  86. package/dist/es/components/fundamental/button.js +186 -0
  87. package/dist/es/components/fundamental/calendar.js +130 -0
  88. package/dist/es/components/fundamental/card.js +68 -0
  89. package/dist/es/components/fundamental/chart.js +1006 -0
  90. package/dist/es/components/fundamental/checkbox.js +51 -0
  91. package/dist/es/components/fundamental/collapsible.js +55 -0
  92. package/dist/es/components/fundamental/combobox.js +229 -0
  93. package/dist/es/components/fundamental/command.js +155 -0
  94. package/dist/es/components/fundamental/country-dropdown.js +215 -0
  95. package/dist/es/components/fundamental/custom-icons.js +876 -0
  96. package/dist/es/components/fundamental/date-picker.js +119 -0
  97. package/dist/es/components/fundamental/dialog.js +106 -0
  98. package/dist/es/components/fundamental/drawer.js +93 -0
  99. package/dist/es/components/fundamental/dropdown-menu.js +600 -0
  100. package/dist/es/components/fundamental/editable.js +123 -0
  101. package/dist/es/components/fundamental/empty.js +152 -0
  102. package/dist/es/components/fundamental/file-upload.js +289 -0
  103. package/dist/es/components/fundamental/flag.js +60 -0
  104. package/dist/es/components/fundamental/form-field.js +352 -0
  105. package/dist/es/components/fundamental/hover-card.js +23 -0
  106. package/dist/es/components/fundamental/icon.js +200 -0
  107. package/dist/es/components/fundamental/input-group.js +135 -0
  108. package/dist/es/components/fundamental/input.js +78 -0
  109. package/dist/es/components/fundamental/kbd.js +57 -0
  110. package/dist/es/components/fundamental/label.js +54 -0
  111. package/dist/es/components/fundamental/month-picker.js +161 -0
  112. package/dist/es/components/fundamental/pagination.js +109 -0
  113. package/dist/es/components/fundamental/popover.js +24 -0
  114. package/dist/es/components/fundamental/progress.js +66 -0
  115. package/dist/es/components/fundamental/radio-group.js +64 -0
  116. package/dist/es/components/fundamental/resizable.js +43 -0
  117. package/dist/es/components/fundamental/scroll-area.js +38 -0
  118. package/dist/es/components/fundamental/select.js +136 -0
  119. package/dist/es/components/fundamental/separator.js +47 -0
  120. package/dist/es/components/fundamental/sheet.js +134 -0
  121. package/dist/es/components/fundamental/sidebar.js +709 -0
  122. package/dist/es/components/fundamental/skeleton.js +158 -0
  123. package/dist/es/components/fundamental/slider.js +35 -0
  124. package/dist/es/components/fundamental/spinner.js +225 -0
  125. package/dist/es/components/fundamental/switch.js +27 -0
  126. package/dist/es/components/fundamental/table.js +263 -0
  127. package/dist/es/components/fundamental/tabs.js +170 -0
  128. package/dist/es/components/fundamental/tag.js +295 -0
  129. package/dist/es/components/fundamental/text-link.js +105 -0
  130. package/dist/es/components/fundamental/textarea.js +47 -0
  131. package/dist/es/components/fundamental/toast.js +108 -0
  132. package/dist/es/components/fundamental/toggle-group.js +37 -0
  133. package/dist/es/components/fundamental/toggle.js +51 -0
  134. package/dist/es/components/fundamental/tooltip.js +26 -0
  135. package/dist/es/components/fundamental/tree.js +161 -0
  136. package/dist/es/components/product/activity-log.js +231 -0
  137. package/dist/es/components/product/app-frame.js +985 -0
  138. package/dist/es/components/product/attributes-list.js +351 -0
  139. package/dist/es/components/product/bookmarks.js +833 -0
  140. package/dist/es/components/product/data-table-settings-menu.js +169 -0
  141. package/dist/es/components/product/data-table.js +2473 -0
  142. package/dist/es/components/product/filters.js +1041 -0
  143. package/dist/es/components/product/fixture-status.js +178 -0
  144. package/dist/es/components/product/linked-chart.js +179 -0
  145. package/dist/es/components/product/view-mode-menu.js +353 -0
  146. package/dist/es/lib/date-utils.js +151 -0
  147. package/dist/es/lib/hooks.js +29 -0
  148. package/dist/es/lib/index.js +348 -0
  149. package/dist/es/lib/utils.js +8 -0
  150. package/dist/es/style.css +1 -0
  151. package/dist/types/bookmarks.d.ts +2 -0
  152. package/dist/types/calendar.d.ts +2 -0
  153. package/dist/types/chart.d.ts +2 -0
  154. package/dist/types/components/core-index.d.cts +135 -0
  155. package/dist/types/components/core-index.d.ts +135 -0
  156. package/dist/{components → types/components}/fundamental/avatar.d.ts +3 -3
  157. package/dist/{components → types/components}/fundamental/badge.d.ts +2 -2
  158. package/dist/{components → types/components}/fundamental/button-group.d.ts +2 -2
  159. package/dist/{components → types/components}/fundamental/button.d.ts +1 -1
  160. package/dist/types/components/fundamental/calendar.d.ts +7 -0
  161. package/dist/types/components/fundamental/chart.d.ts +95 -0
  162. package/dist/{components → types/components}/fundamental/command.d.ts +2 -2
  163. package/dist/types/components/fundamental/country-dropdown.d.ts +34 -0
  164. package/dist/types/components/fundamental/date-picker.d.ts +30 -0
  165. package/dist/{components → types/components}/fundamental/file-upload.d.ts +1 -1
  166. package/dist/{components → types/components}/fundamental/form-field.d.ts +2 -2
  167. package/dist/{components → types/components}/fundamental/form.d.ts +2 -2
  168. package/dist/{components → types/components}/fundamental/icon.d.ts +1 -1
  169. package/dist/{components → types/components}/fundamental/input-group.d.ts +1 -1
  170. package/dist/types/components/fundamental/resizable.d.cts +23 -0
  171. package/dist/{components → types/components}/fundamental/resizable.d.ts +1 -1
  172. package/dist/{components → types/components}/fundamental/sidebar.d.ts +3 -3
  173. package/dist/{components → types/components}/fundamental/spinner.d.ts +1 -1
  174. package/dist/{components → types/components}/fundamental/table.d.ts +3 -3
  175. package/dist/{components → types/components}/fundamental/text-link.d.ts +1 -1
  176. package/dist/{components → types/components}/index.d.ts +118 -118
  177. package/dist/{components → types/components}/product/activity-log.d.ts +1 -1
  178. package/dist/{components → types/components}/product/attributes-list.d.ts +1 -1
  179. package/dist/types/components/product/bookmarks.d.cts +90 -0
  180. package/dist/{components → types/components}/product/bookmarks.d.ts +1 -1
  181. package/dist/types/components/product/data-table.d.ts +802 -0
  182. package/dist/types/components/product/filters.d.ts +124 -0
  183. package/dist/{components → types/components}/product/fixture-status.d.ts +1 -1
  184. package/dist/types/components/product/linked-chart.d.cts +22 -0
  185. package/dist/{components → types/components}/product/linked-chart.d.ts +1 -1
  186. package/dist/types/country-dropdown.d.ts +2 -0
  187. package/dist/types/data-table.d.ts +2 -0
  188. package/dist/types/date-picker.d.ts +2 -0
  189. package/dist/types/filters.d.ts +2 -0
  190. package/dist/types/index.d.ts +2 -0
  191. package/dist/types/lib/index.d.cts +104 -0
  192. package/dist/types/lib/index.d.ts +104 -0
  193. package/dist/types/linked-chart.d.ts +2 -0
  194. package/dist/types/resizable.d.ts +2 -0
  195. package/package.json +191 -31
  196. package/dist/index.cjs.js +0 -144
  197. package/dist/index.cjs.js.map +0 -1
  198. package/dist/index.d.ts +0 -2
  199. package/dist/index.es.js +0 -87768
  200. package/dist/index.es.js.map +0 -1
  201. package/dist/lib/index.d.ts +0 -3
  202. package/dist/style.css +0 -1
  203. /package/dist/{components → types/components}/fundamental/accordion.d.ts +0 -0
  204. /package/dist/{components → types/components}/fundamental/alert-dialog.d.ts +0 -0
  205. /package/dist/{components → types/components}/fundamental/alert.d.ts +0 -0
  206. /package/dist/{components → types/components}/fundamental/autocomplete-search.d.ts +0 -0
  207. /package/dist/{components → types/components}/fundamental/avatar-group.d.ts +0 -0
  208. /package/dist/{components → types/components}/fundamental/breadcrumb.d.ts +0 -0
  209. /package/dist/{components → types/components}/fundamental/button.test.d.ts +0 -0
  210. /package/dist/{components/fundamental/calendar.d.ts → types/components/fundamental/calendar.d.cts} +0 -0
  211. /package/dist/{components → types/components}/fundamental/card.d.ts +0 -0
  212. /package/dist/{components/fundamental/chart.d.ts → types/components/fundamental/chart.d.cts} +0 -0
  213. /package/dist/{components → types/components}/fundamental/checkbox.d.ts +0 -0
  214. /package/dist/{components → types/components}/fundamental/collapsible.d.ts +0 -0
  215. /package/dist/{components → types/components}/fundamental/combobox.d.ts +0 -0
  216. /package/dist/{components/fundamental/country-dropdown.d.ts → types/components/fundamental/country-dropdown.d.cts} +0 -0
  217. /package/dist/{components → types/components}/fundamental/custom-icons.d.ts +0 -0
  218. /package/dist/{components/fundamental/date-picker.d.ts → types/components/fundamental/date-picker.d.cts} +0 -0
  219. /package/dist/{components → types/components}/fundamental/dialog.d.ts +0 -0
  220. /package/dist/{components → types/components}/fundamental/drawer.d.ts +0 -0
  221. /package/dist/{components → types/components}/fundamental/dropdown-menu.d.ts +0 -0
  222. /package/dist/{components → types/components}/fundamental/editable.d.ts +0 -0
  223. /package/dist/{components → types/components}/fundamental/empty.d.ts +0 -0
  224. /package/dist/{components → types/components}/fundamental/flag.d.ts +0 -0
  225. /package/dist/{components → types/components}/fundamental/hover-card.d.ts +0 -0
  226. /package/dist/{components → types/components}/fundamental/input.d.ts +0 -0
  227. /package/dist/{components → types/components}/fundamental/kbd.d.ts +0 -0
  228. /package/dist/{components → types/components}/fundamental/label.d.ts +0 -0
  229. /package/dist/{components → types/components}/fundamental/month-picker.d.ts +0 -0
  230. /package/dist/{components → types/components}/fundamental/pagination.d.ts +0 -0
  231. /package/dist/{components → types/components}/fundamental/popover.d.ts +0 -0
  232. /package/dist/{components → types/components}/fundamental/progress.d.ts +0 -0
  233. /package/dist/{components → types/components}/fundamental/radio-group.d.ts +0 -0
  234. /package/dist/{components → types/components}/fundamental/scroll-area.d.ts +0 -0
  235. /package/dist/{components → types/components}/fundamental/select.d.ts +0 -0
  236. /package/dist/{components → types/components}/fundamental/separator.d.ts +0 -0
  237. /package/dist/{components → types/components}/fundamental/sheet.d.ts +0 -0
  238. /package/dist/{components → types/components}/fundamental/skeleton.d.ts +0 -0
  239. /package/dist/{components → types/components}/fundamental/slider.d.ts +0 -0
  240. /package/dist/{components → types/components}/fundamental/switch.d.ts +0 -0
  241. /package/dist/{components → types/components}/fundamental/tabs.d.ts +0 -0
  242. /package/dist/{components → types/components}/fundamental/tag.d.ts +0 -0
  243. /package/dist/{components → types/components}/fundamental/textarea.d.ts +0 -0
  244. /package/dist/{components → types/components}/fundamental/toast.d.ts +0 -0
  245. /package/dist/{components → types/components}/fundamental/toggle-group.d.ts +0 -0
  246. /package/dist/{components → types/components}/fundamental/toggle.d.ts +0 -0
  247. /package/dist/{components → types/components}/fundamental/tooltip.d.ts +0 -0
  248. /package/dist/{components → types/components}/fundamental/tree.d.ts +0 -0
  249. /package/dist/{components → types/components}/product/app-frame.d.ts +0 -0
  250. /package/dist/{components → types/components}/product/data-table-settings-menu.d.ts +0 -0
  251. /package/dist/{components/product/data-table.d.ts → types/components/product/data-table.d.cts} +0 -0
  252. /package/dist/{components/product/filters.d.ts → types/components/product/filters.d.cts} +0 -0
  253. /package/dist/{components → types/components}/product/view-mode-menu.d.ts +0 -0
  254. /package/dist/{lib → types/lib}/date-utils.d.ts +0 -0
  255. /package/dist/{lib → types/lib}/hooks.d.ts +0 -0
  256. /package/dist/{lib → types/lib}/utils.d.ts +0 -0
@@ -0,0 +1,2473 @@
1
+ import { jsx as t, Fragment as ee, jsxs as b } from "react/jsx-runtime";
2
+ import * as l from "react";
3
+ import { useReactTable as os, getFacetedMinMaxValues as as, getFacetedUniqueValues as ls, getFacetedRowModel as is, getGroupedRowModel as cs, getExpandedRowModel as ds, getSortedRowModel as us, getPaginationRowModel as fs, getFilteredRowModel as gs, getCoreRowModel as ms, flexRender as be } from "@tanstack/react-table";
4
+ import { useReactTable as To } from "@tanstack/react-table";
5
+ import { useSensors as hs, useSensor as wr, MouseSensor as ps, TouchSensor as vs, DndContext as bs, closestCenter as xs } from "@dnd-kit/core";
6
+ import { SortableContext as ys, horizontalListSortingStrategy as Cs, arrayMove as ws, useSortable as Ss } from "@dnd-kit/sortable";
7
+ import { CSS as Ns } from "@dnd-kit/utilities";
8
+ import { cn as V } from "../../lib/utils.js";
9
+ import { Button as Me } from "../fundamental/button.js";
10
+ import { Input as ft } from "../fundamental/input.js";
11
+ import { AutocompleteSearch as Rs } from "../fundamental/autocomplete-search.js";
12
+ import { Table as Is, TableHeader as Es, TableRow as G, TableHead as ut, TableBody as Ds, TableCell as le } from "../fundamental/table.js";
13
+ import { Select as ks, SelectTrigger as zs, SelectValue as Bs, SelectContent as Ts, SelectItem as Sr } from "../fundamental/select.js";
14
+ import { Checkbox as gt } from "../fundamental/checkbox.js";
15
+ import { Icon as W } from "../fundamental/icon.js";
16
+ import { Badge as xe } from "../fundamental/badge.js";
17
+ import { Popover as Pr, PopoverTrigger as Vr, PopoverContent as Fr } from "../fundamental/popover.js";
18
+ import { Command as $r, CommandInput as jr, CommandList as Ar, CommandEmpty as Lr, CommandGroup as Or, CommandItem as Hr } from "../fundamental/command.js";
19
+ import { Pagination as Ms } from "../fundamental/pagination.js";
20
+ import { Skeleton as Nr } from "../fundamental/skeleton.js";
21
+ import { Spinner as qe } from "../fundamental/spinner.js";
22
+ import { DataTableSettingsMenu as Ps } from "./data-table-settings-menu.js";
23
+ import { TooltipProvider as Vs, Tooltip as Fs, TooltipTrigger as $s, TooltipContent as js } from "../fundamental/tooltip.js";
24
+ function As(c, s) {
25
+ const [i, a] = l.useState(c);
26
+ return l.useEffect(() => {
27
+ const f = setTimeout(() => {
28
+ a(c);
29
+ }, s);
30
+ return () => {
31
+ clearTimeout(f);
32
+ };
33
+ }, [c, s]), i;
34
+ }
35
+ const Te = /* @__PURE__ */ l.memo(function({ children: s, align: i = "left" }) {
36
+ const a = l.useRef(null), [f, x] = l.useState(!1), [y, h] = l.useState("");
37
+ return l.useEffect(() => {
38
+ const p = a.current;
39
+ if (!p) return;
40
+ let v;
41
+ const R = () => {
42
+ clearTimeout(v), v = setTimeout(() => {
43
+ if (a.current) {
44
+ const T = a.current.scrollWidth > a.current.clientWidth, C = a.current.firstElementChild, A = C ? C.scrollWidth > C.clientWidth : !1;
45
+ x(T || A);
46
+ }
47
+ }, 150);
48
+ };
49
+ if (a.current) {
50
+ const T = a.current.scrollWidth > a.current.clientWidth, C = a.current.firstElementChild, A = C ? C.scrollWidth > C.clientWidth : !1;
51
+ x(T || A);
52
+ }
53
+ const D = new ResizeObserver(R);
54
+ return D.observe(p), () => {
55
+ clearTimeout(v), D.disconnect();
56
+ };
57
+ }, [s]), l.useEffect(() => {
58
+ a.current && h(a.current.textContent || "");
59
+ }, [s]), f ? /* @__PURE__ */ b(Fs, { children: [
60
+ /* @__PURE__ */ t($s, { asChild: !0, children: /* @__PURE__ */ t(
61
+ "div",
62
+ {
63
+ ref: a,
64
+ className: V("min-w-0 overflow-hidden truncate [&>*]:truncate", i === "right" && "text-right"),
65
+ children: s
66
+ }
67
+ ) }),
68
+ /* @__PURE__ */ t(js, { side: "top", className: "max-w-xs", children: y })
69
+ ] }) : /* @__PURE__ */ t(
70
+ "div",
71
+ {
72
+ ref: a,
73
+ className: V("min-w-0 overflow-hidden truncate [&>*]:truncate", i === "right" && "text-right"),
74
+ children: s
75
+ }
76
+ );
77
+ }), Rr = (c, s, i, a) => {
78
+ const f = c.getValue(s), x = f != null ? String(f) : "", y = i.toLowerCase();
79
+ return x.toLowerCase().includes(y) ? !0 : x.toLowerCase().split(" ").some((p) => p.startsWith(y));
80
+ }, Ls = (c, s, i) => {
81
+ if (!i || i.length === 0) return !0;
82
+ const a = c.getValue(s);
83
+ return i.includes(a);
84
+ }, Eo = (c, s, i, a) => {
85
+ if (!i || i.trim() === "") return !0;
86
+ const f = String(i).toLowerCase(), x = (h) => {
87
+ const p = h.getAllCells().map((v) => v.column.id);
88
+ for (const v of p) {
89
+ const R = h.getValue(v);
90
+ if (R != null && String(R).toLowerCase().includes(f))
91
+ return !0;
92
+ }
93
+ return !1;
94
+ };
95
+ c.getParentRow?.()?.getParentRow?.() || c.getParentRow?.();
96
+ const y = x(c);
97
+ return a && y && a({ itemRank: 1 }), y;
98
+ };
99
+ function Os(c, s) {
100
+ for (const i of c) {
101
+ const a = typeof s == "function" ? s(i.original) : i.original?.[s];
102
+ if (a != null) {
103
+ if (typeof a == "number") return "number";
104
+ if (a instanceof Date) return "date";
105
+ if (typeof a == "string") {
106
+ const f = Date.parse(a);
107
+ return isNaN(f) ? "string" : "date";
108
+ }
109
+ return "unknown";
110
+ }
111
+ }
112
+ return "unknown";
113
+ }
114
+ function Ir(c) {
115
+ if (c.length === 0) return "";
116
+ const s = Math.min(...c), i = Math.max(...c);
117
+ return s === i ? String(s) : `${s} – ${i}`;
118
+ }
119
+ function Hs(c) {
120
+ return c.length === 0 ? "" : `Avg: ${(c.reduce((a, f) => a + f, 0) / c.length).toFixed(2)}`;
121
+ }
122
+ function Ws(c) {
123
+ return c.length === 0 ? "" : `Total: ${c.reduce((i, a) => i + a, 0)}`;
124
+ }
125
+ function Er(c) {
126
+ return `${c} ${c === 1 ? "item" : "items"}`;
127
+ }
128
+ function Dr(c, s) {
129
+ if (c.length === 0) return "";
130
+ const a = new Set(c).size, f = a === 1 || s.endsWith("s") ? s : s.endsWith("y") ? s.slice(0, -1) + "ies" : s + "s";
131
+ return `${a} ${f.toLowerCase()}`;
132
+ }
133
+ function Gs(c) {
134
+ if (c.length === 0) return "";
135
+ const s = /* @__PURE__ */ new Map();
136
+ c.forEach((f) => s.set(f, (s.get(f) || 0) + 1));
137
+ let i = 0, a = "";
138
+ return s.forEach((f, x) => {
139
+ f > i && (i = f, a = x);
140
+ }), `${a} (${i})`;
141
+ }
142
+ function kr(c) {
143
+ if (c.length === 0) return "";
144
+ const i = c.map((y) => y instanceof Date ? y : new Date(y)).filter((y) => !isNaN(y.getTime()));
145
+ if (i.length === 0) return "";
146
+ const a = new Date(Math.min(...i.map((y) => y.getTime()))), f = new Date(Math.max(...i.map((y) => y.getTime()))), x = (y) => y.toISOString().split("T")[0];
147
+ return a.getTime() === f.getTime() ? x(a) : `${x(a)} – ${x(f)}`;
148
+ }
149
+ function zr(c, s, i) {
150
+ const a = c.columnDef;
151
+ if (c.id === i || a?.meta?.renderInGroupedRows || a?.meta?.aggregation === !1) return null;
152
+ if (typeof a?.meta?.aggregation == "function") {
153
+ const R = "accessorKey" in a ? a.accessorKey : void 0;
154
+ return a.meta.aggregation(s, R);
155
+ }
156
+ const f = "accessorKey" in a ? a.accessorKey : void 0, x = "accessorFn" in a ? a.accessorFn : void 0, y = f || x;
157
+ if (!y) return null;
158
+ const h = s.map((R) => typeof y == "function" ? y(R.original, R.index) : R.original?.[y]).filter((R) => R != null);
159
+ if (h.length === 0) return null;
160
+ const p = a?.meta?.aggregation;
161
+ if (p && typeof p == "string")
162
+ switch (p) {
163
+ case "range":
164
+ return Ir(h);
165
+ case "average":
166
+ return Hs(h);
167
+ case "sum":
168
+ return Ws(h);
169
+ case "count":
170
+ return Er(h.length);
171
+ case "uniqueCount":
172
+ return Dr(
173
+ h.map(String),
174
+ a?.meta?.label || String(c.id)
175
+ );
176
+ case "mostCommon":
177
+ return Gs(h.map(String));
178
+ case "dateRange":
179
+ return kr(h);
180
+ default:
181
+ return null;
182
+ }
183
+ switch (Os(s, y)) {
184
+ case "number":
185
+ return Ir(h);
186
+ case "string":
187
+ return Dr(
188
+ h.map(String),
189
+ a?.meta?.label || String(c.id)
190
+ );
191
+ case "date":
192
+ return kr(h);
193
+ default:
194
+ return Er(h.length);
195
+ }
196
+ }
197
+ function Br({ columns: c, rows: s, showRowBorder: i = !0, showCellBorder: a = !0, skipHeader: f = !1, enableResponsiveWrapper: x = !0 }) {
198
+ const y = x ? "h-4 w-full max-w-full" : "h-4 w-[120px]", h = x ? "h-4 w-full max-w-full" : "h-4 w-[100px]";
199
+ return /* @__PURE__ */ b(ee, { children: [
200
+ !f && /* @__PURE__ */ t(G, { showBorder: i, children: Array.from({ length: c }).map((p, v) => /* @__PURE__ */ t(ut, { showBorder: a, className: "overflow-hidden", children: /* @__PURE__ */ t(Nr, { className: y }) }, v)) }),
201
+ Array.from({ length: s }).map((p, v) => /* @__PURE__ */ t(G, { showBorder: i, children: Array.from({ length: c }).map((R, D) => /* @__PURE__ */ t(
202
+ le,
203
+ {
204
+ showBorder: a,
205
+ showRowBorder: i,
206
+ className: "text-body-sm overflow-hidden",
207
+ children: /* @__PURE__ */ t(Nr, { className: h })
208
+ },
209
+ D
210
+ )) }, v))
211
+ ] });
212
+ }
213
+ const _s = /* @__PURE__ */ l.memo(function({
214
+ title: s = "No data",
215
+ description: i = "No items to display",
216
+ action: a,
217
+ customContent: f
218
+ }) {
219
+ return f ? /* @__PURE__ */ t(ee, { children: f }) : /* @__PURE__ */ b("div", { className: "flex flex-col items-center justify-center py-[var(--space-2xl)] text-center", children: [
220
+ /* @__PURE__ */ t("p", { className: "text-body-medium-md text-[var(--color-text-primary)]", children: s }),
221
+ i && /* @__PURE__ */ t("p", { className: "text-body-sm text-[var(--color-text-secondary)] mt-[var(--space-xs)]", children: i }),
222
+ a && /* @__PURE__ */ t(
223
+ Me,
224
+ {
225
+ variant: "primary",
226
+ size: "s",
227
+ className: "mt-[var(--space-m)]",
228
+ onClick: a.onClick,
229
+ children: a.label
230
+ }
231
+ )
232
+ ] });
233
+ }), qs = /* @__PURE__ */ l.memo(function({
234
+ title: s = "No results found",
235
+ description: i = "Try adjusting your search or filters",
236
+ action: a,
237
+ customContent: f
238
+ }) {
239
+ return f ? /* @__PURE__ */ t(ee, { children: f }) : /* @__PURE__ */ b("div", { className: "flex flex-col items-center justify-center py-[var(--space-2xl)] text-center", children: [
240
+ /* @__PURE__ */ t("p", { className: "text-body-medium-md text-[var(--color-text-primary)]", children: s }),
241
+ i && /* @__PURE__ */ t("p", { className: "text-body-sm text-[var(--color-text-secondary)] mt-[var(--space-xs)]", children: i }),
242
+ a && /* @__PURE__ */ t(
243
+ Me,
244
+ {
245
+ variant: "default",
246
+ size: "s",
247
+ className: "mt-[var(--space-m)]",
248
+ onClick: a.onClick,
249
+ children: a.label
250
+ }
251
+ )
252
+ ] });
253
+ }), Us = /* @__PURE__ */ l.memo(function({
254
+ error: s,
255
+ onRetry: i,
256
+ customContent: a
257
+ }) {
258
+ return a ? /* @__PURE__ */ t(ee, { children: a }) : /* @__PURE__ */ b("div", { className: "flex flex-col items-center justify-center py-[var(--space-2xl)] text-center", children: [
259
+ /* @__PURE__ */ t("p", { className: "text-body-medium-md text-[var(--color-text-primary)]", children: "Something went wrong" }),
260
+ /* @__PURE__ */ t("p", { className: "text-body-sm text-[var(--color-text-secondary)] mt-[var(--space-xs)]", children: s?.message || "An error occurred while loading data" }),
261
+ i && /* @__PURE__ */ t(
262
+ Me,
263
+ {
264
+ variant: "default",
265
+ size: "s",
266
+ className: "mt-[var(--space-m)]",
267
+ onClick: i,
268
+ children: "Try again"
269
+ }
270
+ )
271
+ ] });
272
+ }), Js = /* @__PURE__ */ l.memo(function() {
273
+ return /* @__PURE__ */ t("div", { className: "absolute top-0 left-0 right-0 h-[2px] overflow-hidden", children: /* @__PURE__ */ t("div", { className: "h-full w-full bg-[var(--color-background-brand)] animate-pulse" }) });
274
+ }), Ks = /* @__PURE__ */ l.memo(function({
275
+ table: s,
276
+ searchKey: i,
277
+ searchPlaceholder: a = "Search...",
278
+ enableGlobalSearch: f = !1,
279
+ globalSearchPlaceholder: x = "Search all columns...",
280
+ globalFilter: y = "",
281
+ onGlobalFilterChange: h,
282
+ enableGlobalFaceting: p = !1,
283
+ enableGrouping: v = !1,
284
+ showSettingsMenu: R = !1,
285
+ enableAutocomplete: D = !1,
286
+ autocompleteSuggestions: T = [],
287
+ autocompleteMinCharacters: C = 2
288
+ }) {
289
+ const A = s.getState().columnFilters.length > 0 || f && y.length > 0;
290
+ return /* @__PURE__ */ b("div", { className: "flex items-center justify-between", children: [
291
+ /* @__PURE__ */ b("div", { className: "flex flex-1 items-center space-x-2", children: [
292
+ f && h && /* @__PURE__ */ t(ee, { children: D && T.length > 0 ? /* @__PURE__ */ t(
293
+ Rs,
294
+ {
295
+ value: y,
296
+ onValueChange: h,
297
+ suggestions: T,
298
+ placeholder: x,
299
+ minCharacters: C,
300
+ className: "h-8 w-[150px] lg:w-[250px]",
301
+ onSelect: h
302
+ }
303
+ ) : /* @__PURE__ */ t(
304
+ ft,
305
+ {
306
+ placeholder: x,
307
+ value: y,
308
+ onChange: (P) => h(P.target.value),
309
+ className: "h-8 w-[150px] lg:w-[250px]"
310
+ }
311
+ ) }),
312
+ i && !f && /* @__PURE__ */ t(
313
+ ft,
314
+ {
315
+ placeholder: a,
316
+ value: s.getColumn(i)?.getFilterValue() ?? "",
317
+ onChange: (P) => s.getColumn(i)?.setFilterValue(P.target.value),
318
+ className: "h-8 w-[150px] lg:w-[250px]"
319
+ }
320
+ ),
321
+ s.getAllColumns().filter((P) => P.getCanFilter() && P.columnDef.meta?.filterVariant).map((P) => /* @__PURE__ */ t(Qs, { column: P }, P.id)),
322
+ p && /* @__PURE__ */ t(Xs, { table: s }),
323
+ A && /* @__PURE__ */ b(
324
+ Me,
325
+ {
326
+ variant: "ghost",
327
+ onClick: () => {
328
+ s.resetColumnFilters(), f && h && h("");
329
+ },
330
+ className: "h-8 px-2 lg:px-3",
331
+ children: [
332
+ "Reset",
333
+ /* @__PURE__ */ t(W, { name: "x", className: "ml-2 h-4 w-4" })
334
+ ]
335
+ }
336
+ )
337
+ ] }),
338
+ R && /* @__PURE__ */ t("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ t(Wr, { table: s, enableGrouping: v }) })
339
+ ] });
340
+ }), Xs = /* @__PURE__ */ l.memo(function({ table: s }) {
341
+ const [i, a] = l.useState([]), f = s.getAllColumns().filter(
342
+ (h) => h.columnDef.meta?.filterOptions && h.getCanFilter()
343
+ ), x = l.useMemo(() => {
344
+ const h = /* @__PURE__ */ new Map();
345
+ return f.forEach((p) => {
346
+ const v = p.getFacetedUniqueValues(), R = p.columnDef.meta?.filterOptions || [], D = p.columnDef.meta?.label || p.columnDef.header;
347
+ v.forEach((T, C) => {
348
+ const A = R.find((P) => P.value === C);
349
+ if (A && T > 0) {
350
+ const P = `${D}:${C}`;
351
+ h.set(P, {
352
+ count: T,
353
+ column: D,
354
+ label: A.label
355
+ });
356
+ }
357
+ });
358
+ }), Array.from(h.entries()).map(([p, v]) => ({
359
+ key: p,
360
+ value: p.split(":")[1],
361
+ ...v
362
+ })).sort((p, v) => v.count - p.count);
363
+ }, [f]), y = (h) => {
364
+ const p = i.includes(h) ? i.filter((v) => v !== h) : [...i, h];
365
+ a(p), f.forEach((v) => {
366
+ const R = v.columnDef.meta?.filterOptions || [], D = p.filter(
367
+ (T) => R.some((C) => C.value === T)
368
+ );
369
+ D.length > 0 ? v.columnDef.meta?.filterVariant === "multiselect" ? v.setFilterValue(D) : v.columnDef.meta?.filterVariant === "select" && v.setFilterValue(D[0]) : v.setFilterValue(void 0);
370
+ });
371
+ };
372
+ return x.length === 0 ? null : /* @__PURE__ */ b(Pr, { children: [
373
+ /* @__PURE__ */ t(Vr, { asChild: !0, children: /* @__PURE__ */ b(Me, { variant: "ghost", size: "s", className: "h-8 border-dashed", children: [
374
+ /* @__PURE__ */ t(W, { name: "filter", className: "mr-2 h-4 w-4" }),
375
+ "Global Faceting",
376
+ i.length > 0 && /* @__PURE__ */ b(ee, { children: [
377
+ /* @__PURE__ */ t("div", { className: "mx-2 h-4 w-px bg-[var(--color-border-primary)]" }),
378
+ /* @__PURE__ */ b(xe, { className: "rounded-s px-1 font-normal", children: [
379
+ i.length,
380
+ " selected"
381
+ ] })
382
+ ] })
383
+ ] }) }),
384
+ /* @__PURE__ */ t(Fr, { className: "w-[300px] p-0", align: "start", children: /* @__PURE__ */ b($r, { children: [
385
+ /* @__PURE__ */ t(jr, { placeholder: "Search values across all columns..." }),
386
+ /* @__PURE__ */ b(Ar, { children: [
387
+ /* @__PURE__ */ t(Lr, { children: "No results found" }),
388
+ /* @__PURE__ */ t(Or, { children: x.map((h) => {
389
+ const p = i.includes(h.value);
390
+ return /* @__PURE__ */ t(
391
+ Hr,
392
+ {
393
+ onSelect: () => y(h.value),
394
+ children: /* @__PURE__ */ b("div", { className: "flex items-center justify-between flex-1", children: [
395
+ /* @__PURE__ */ b("div", { className: "flex items-center gap-2", children: [
396
+ /* @__PURE__ */ t(gt, { checked: p }),
397
+ /* @__PURE__ */ b("div", { className: "flex flex-col", children: [
398
+ /* @__PURE__ */ t("span", { className: "text-body-sm", children: h.label }),
399
+ /* @__PURE__ */ b("span", { className: "text-caption-sm text-[var(--color-text-secondary)]", children: [
400
+ "in ",
401
+ h.column
402
+ ] })
403
+ ] })
404
+ ] }),
405
+ /* @__PURE__ */ t(xe, { className: "ml-auto text-caption-sm px-1 py-0", children: h.count })
406
+ ] })
407
+ },
408
+ h.key
409
+ );
410
+ }) })
411
+ ] })
412
+ ] }) })
413
+ ] });
414
+ }), Qs = /* @__PURE__ */ l.memo(function({ column: s }) {
415
+ const { filterVariant: i, filterOptions: a, label: f, placeholder: x } = s.columnDef.meta || {}, y = s.getFilterValue(), h = s.getFacetedUniqueValues();
416
+ if (i === "select" && a)
417
+ return /* @__PURE__ */ b(
418
+ ks,
419
+ {
420
+ value: y || "all",
421
+ onValueChange: (p) => s.setFilterValue(p === "all" ? "" : p),
422
+ children: [
423
+ /* @__PURE__ */ t(zs, { className: "h-8 w-[150px]", children: /* @__PURE__ */ t(Bs, { placeholder: x || `Filter ${f}` }) }),
424
+ /* @__PURE__ */ b(Ts, { children: [
425
+ /* @__PURE__ */ b(Sr, { value: "all", children: [
426
+ "All ",
427
+ f
428
+ ] }),
429
+ a.map((p) => {
430
+ const v = h.get(p.value) || 0;
431
+ return /* @__PURE__ */ t(Sr, { value: p.value, children: /* @__PURE__ */ b("div", { className: "flex items-center justify-between w-full gap-2", children: [
432
+ /* @__PURE__ */ b("div", { className: "flex items-center gap-2", children: [
433
+ p.icon && /* @__PURE__ */ t(p.icon, { className: "h-4 w-4" }),
434
+ p.label
435
+ ] }),
436
+ v > 0 && /* @__PURE__ */ t(xe, { className: "ml-auto text-caption-sm px-1 py-0", children: v })
437
+ ] }) }, p.value);
438
+ })
439
+ ] })
440
+ ]
441
+ }
442
+ );
443
+ if (i === "multiselect" && a) {
444
+ const p = y || [];
445
+ return /* @__PURE__ */ b(Pr, { children: [
446
+ /* @__PURE__ */ t(Vr, { asChild: !0, children: /* @__PURE__ */ b(Me, { variant: "ghost", size: "s", className: "h-8 border-dashed", children: [
447
+ /* @__PURE__ */ t(W, { name: "plus-circle", className: "mr-2 h-4 w-4" }),
448
+ f,
449
+ p.length > 0 && /* @__PURE__ */ b(ee, { children: [
450
+ /* @__PURE__ */ t("div", { className: "mx-2 h-4 w-px bg-[var(--color-border-primary)]" }),
451
+ /* @__PURE__ */ t(xe, { className: "rounded-s px-1 font-normal lg:hidden", children: p.length }),
452
+ /* @__PURE__ */ t("div", { className: "hidden space-x-1 lg:flex", children: p.length > 2 ? /* @__PURE__ */ b(xe, { className: "rounded-s px-1 font-normal", children: [
453
+ p.length,
454
+ " selected"
455
+ ] }) : a.filter((v) => p.includes(v.value)).map((v) => /* @__PURE__ */ t(xe, { className: "rounded-s px-1 font-normal", children: v.label }, v.value)) })
456
+ ] })
457
+ ] }) }),
458
+ /* @__PURE__ */ t(Fr, { className: "w-[200px] p-0", align: "start", children: /* @__PURE__ */ b($r, { children: [
459
+ /* @__PURE__ */ t(jr, { placeholder: x || `Search ${f}...` }),
460
+ /* @__PURE__ */ b(Ar, { children: [
461
+ /* @__PURE__ */ t(Lr, { children: "No results found" }),
462
+ /* @__PURE__ */ t(Or, { children: a.map((v) => {
463
+ const R = p.includes(v.value), D = h.get(v.value) || 0;
464
+ return /* @__PURE__ */ t(
465
+ Hr,
466
+ {
467
+ onSelect: () => {
468
+ const T = R ? p.filter((C) => C !== v.value) : [...p, v.value];
469
+ s.setFilterValue(T.length ? T : void 0);
470
+ },
471
+ children: /* @__PURE__ */ b("div", { className: "flex items-center justify-between flex-1", children: [
472
+ /* @__PURE__ */ b("div", { className: "flex items-center gap-2", children: [
473
+ /* @__PURE__ */ t(gt, { checked: R }),
474
+ v.icon && /* @__PURE__ */ t(v.icon, { className: "h-4 w-4" }),
475
+ /* @__PURE__ */ t("span", { children: v.label })
476
+ ] }),
477
+ D > 0 && /* @__PURE__ */ t(xe, { className: "ml-auto text-caption-sm px-1 py-0", children: D })
478
+ ] })
479
+ },
480
+ v.value
481
+ );
482
+ }) })
483
+ ] })
484
+ ] }) })
485
+ ] });
486
+ }
487
+ return i === "number" ? /* @__PURE__ */ t(
488
+ ft,
489
+ {
490
+ placeholder: x || `Filter ${f}...`,
491
+ value: y || "",
492
+ onChange: (p) => s.setFilterValue(p.target.value),
493
+ className: "h-8 w-[150px]",
494
+ type: "number"
495
+ }
496
+ ) : /* @__PURE__ */ t(
497
+ ft,
498
+ {
499
+ placeholder: x || `Filter ${f}...`,
500
+ value: y || "",
501
+ onChange: (p) => s.setFilterValue(p.target.value),
502
+ className: "h-8 w-[150px]"
503
+ }
504
+ );
505
+ }), Ys = /* @__PURE__ */ l.memo(function({ header: s, enableColumnOrdering: i, children: a }) {
506
+ const {
507
+ attributes: f,
508
+ listeners: x,
509
+ setNodeRef: y,
510
+ transform: h,
511
+ transition: p,
512
+ isDragging: v
513
+ } = Ss({
514
+ id: s.id,
515
+ disabled: !i
516
+ }), R = {
517
+ transform: Ns.Translate.toString(h),
518
+ // Only translate, no scale
519
+ transition: p,
520
+ opacity: v ? 0.5 : 1
521
+ };
522
+ return i ? /* @__PURE__ */ b(
523
+ "div",
524
+ {
525
+ ref: y,
526
+ style: R,
527
+ className: V(
528
+ "relative flex items-center",
529
+ v && "z-50"
530
+ ),
531
+ children: [
532
+ /* @__PURE__ */ t("div", { className: "flex-1", children: a }),
533
+ i && /* @__PURE__ */ t(
534
+ "div",
535
+ {
536
+ className: "ml-2 p-1 !cursor-grab active:!cursor-grabbing hover:bg-[var(--color-background-neutral-subtlest-hovered)] rounded-s transition-colors",
537
+ ...f,
538
+ ...x,
539
+ children: /* @__PURE__ */ t(
540
+ W,
541
+ {
542
+ name: "grip-vertical",
543
+ className: "h-3 w-3 text-[var(--color-text-tertiary)]"
544
+ }
545
+ )
546
+ }
547
+ )
548
+ ]
549
+ }
550
+ ) : /* @__PURE__ */ t(ee, { children: a });
551
+ }), Wr = /* @__PURE__ */ l.memo(function({ table: s, enableGrouping: i = !1 }) {
552
+ const a = s.getAllColumns().filter((N) => N.getCanSort()).map((N) => ({
553
+ id: N.id,
554
+ label: N.columnDef.meta?.label || N.columnDef.header || N.id
555
+ })), f = s.getAllColumns().filter((N) => N.getCanGroup?.() || N.columnDef.enableGrouping).map((N) => ({
556
+ id: N.id,
557
+ label: N.columnDef.meta?.label || N.columnDef.header || N.id
558
+ })), x = s.getAllColumns().filter((N) => typeof N.accessorFn < "u" && N.getCanHide()).map((N) => ({
559
+ id: N.id,
560
+ label: N.columnDef.meta?.label || N.columnDef.header || N.id
561
+ })), y = x.filter((N) => s.getColumn(N.id)?.getIsVisible()).map((N) => N.id), h = s.getState().sorting[0], p = h?.id, v = h?.desc ? "desc" : "asc", D = s.getState().grouping[0] || "";
562
+ return /* @__PURE__ */ t(
563
+ Ps,
564
+ {
565
+ sortableColumns: a,
566
+ selectedSortColumn: p,
567
+ sortDirection: v,
568
+ onSortChange: (N) => {
569
+ s.setSorting([{ id: N, desc: v === "desc" }]);
570
+ },
571
+ onSortDirectionChange: (N) => {
572
+ h && s.setSorting([{ id: h.id, desc: N === "desc" }]);
573
+ },
574
+ groupableColumns: i ? f : [],
575
+ selectedGroupColumn: D,
576
+ onGroupChange: (N) => {
577
+ !N || N === "none" ? s.setGrouping([]) : s.setGrouping([N]);
578
+ },
579
+ columns: x,
580
+ visibleColumns: y,
581
+ onColumnVisibilityChange: (N, Ue) => {
582
+ s.getColumn(N)?.toggleVisibility(Ue);
583
+ }
584
+ }
585
+ );
586
+ }), Do = /* @__PURE__ */ l.memo(function({
587
+ column: s,
588
+ title: i,
589
+ className: a
590
+ }) {
591
+ const f = s.columnDef.meta?.align || "left", x = s.columnDef.meta?.truncate !== !1, y = s.getIsSorted();
592
+ return s.getCanSort() ? /* @__PURE__ */ b(
593
+ "div",
594
+ {
595
+ className: V(
596
+ "flex items-center gap-1",
597
+ f === "right" && "justify-end",
598
+ y && "!text-[var(--color-text-brand-bold)]",
599
+ a
600
+ ),
601
+ children: [
602
+ y && /* @__PURE__ */ t(
603
+ W,
604
+ {
605
+ name: y === "desc" ? "arrow-down-wide-narrow" : "arrow-down-narrow-wide",
606
+ className: "h-4 w-4 !text-[var(--color-icon-brand-bold)]"
607
+ }
608
+ ),
609
+ x ? /* @__PURE__ */ t(Te, { align: f, children: /* @__PURE__ */ t("span", { children: i }) }) : /* @__PURE__ */ t("span", { children: i })
610
+ ]
611
+ }
612
+ ) : x ? /* @__PURE__ */ t(Te, { align: f, children: /* @__PURE__ */ t("div", { className: V(f === "right" ? "text-right" : "text-left", a), children: i }) }) : /* @__PURE__ */ t("div", { className: V(f === "right" ? "text-right" : "text-left", a), children: i });
613
+ }), Zs = /* @__PURE__ */ l.memo(function({
614
+ table: s,
615
+ enableGrouping: i = !1,
616
+ hideChildrenForSingleItemGroups: a = {},
617
+ footerLabel: f,
618
+ onNextPageHover: x,
619
+ onPreviousPageHover: y,
620
+ paginationVariant: h = "full",
621
+ pageSizeOptions: p = [10, 25, 50, 100]
622
+ }) {
623
+ const v = s.getState().pagination.pageIndex + 1, R = s.getState().pagination.pageSize, D = i && !s.options.manualPagination ? s.getPrePaginationRowModel().rows.filter((P) => P.depth === 0).length : s.getRowCount(), T = s.getFilteredSelectedRowModel().rows.length, C = (P) => {
624
+ s.setPageIndex(P - 1);
625
+ }, A = (P) => {
626
+ s.setPageSize(P);
627
+ };
628
+ return /* @__PURE__ */ b("div", { className: "flex items-center justify-between", children: [
629
+ /* @__PURE__ */ t("div", { className: "flex-1 text-body-sm text-[var(--color-text-secondary)]", children: f ? /* @__PURE__ */ b("div", { className: "flex items-center gap-[var(--space-m)]", children: [
630
+ f,
631
+ T > 0 && /* @__PURE__ */ b("span", { children: [
632
+ "· ",
633
+ T,
634
+ " of ",
635
+ D,
636
+ " row(s) selected"
637
+ ] })
638
+ ] }) : T > 0 && /* @__PURE__ */ b("span", { children: [
639
+ T,
640
+ " of ",
641
+ D,
642
+ " row(s) selected."
643
+ ] }) }),
644
+ /* @__PURE__ */ t(
645
+ Ms,
646
+ {
647
+ variant: h,
648
+ currentPage: v,
649
+ totalItems: D,
650
+ pageSize: R,
651
+ onPageChange: C,
652
+ onPageSizeChange: A,
653
+ pageSizeOptions: p,
654
+ onNextPageHover: x,
655
+ onPreviousPageHover: y
656
+ }
657
+ )
658
+ ] });
659
+ }), eo = /* @__PURE__ */ l.memo(function({
660
+ onLoadMore: s,
661
+ isLoading: i
662
+ }) {
663
+ const a = l.useRef(null);
664
+ return l.useEffect(() => {
665
+ const f = a.current;
666
+ if (!f || i) return;
667
+ const x = new IntersectionObserver(
668
+ (y) => {
669
+ y[0].isIntersecting && s();
670
+ },
671
+ { threshold: 0.1 }
672
+ );
673
+ return x.observe(f), () => x.disconnect();
674
+ }, [s, i]), /* @__PURE__ */ t(
675
+ "div",
676
+ {
677
+ ref: a,
678
+ className: "flex justify-center py-[var(--space-m)] border-t border-[var(--color-border-primary-subtle)]",
679
+ children: i && /* @__PURE__ */ t(qe, { size: "s" })
680
+ }
681
+ );
682
+ });
683
+ function to(c) {
684
+ let s = 0;
685
+ const i = (a, f) => {
686
+ a.forEach((x) => {
687
+ x.depth > s && (s = x.depth), x.subRows && x.subRows.length > 0 && i(x.subRows);
688
+ });
689
+ };
690
+ return i(c), s;
691
+ }
692
+ function Tr(c, s) {
693
+ const { enableGrouping: i, enableExpanding: a, nestedRowStyling: f, expandingRowColors: x, maxDepth: y } = s, h = c.depth, p = c.getIsGrouped?.(), v = c.getIsExpanded(), R = c.subRows && c.subRows.length > 0, D = R ? v ? "expanded" : "collapsed" : "leaf", T = () => {
694
+ let C = c;
695
+ for (; C; ) {
696
+ if (C.getIsExpanded()) return !0;
697
+ C = C.getParentRow?.();
698
+ }
699
+ return !1;
700
+ };
701
+ if (f?.colors && f.colors[h] !== void 0) {
702
+ const C = f.colors[h];
703
+ if (typeof C == "string")
704
+ return C;
705
+ if (typeof C == "object") {
706
+ if (D === "expanded" && C.expanded)
707
+ return C.expanded;
708
+ if (D === "collapsed" && C.collapsed)
709
+ return C.collapsed;
710
+ if (D === "leaf" && C.leaf)
711
+ return C.leaf;
712
+ if (C.default)
713
+ return C.default;
714
+ }
715
+ }
716
+ if (a && !p && x) {
717
+ const C = y - h;
718
+ if (C === 0 && x.children)
719
+ return x.children;
720
+ if (C > 0) {
721
+ if (v && x.expandedParent)
722
+ return x.expandedParent;
723
+ if (!v && x.collapsedParent)
724
+ return x.collapsedParent;
725
+ }
726
+ }
727
+ return p ? v ? "var(--blue-50)" : "var(--color-background-neutral-subtlest)" : i && h === 1 ? "var(--blue-25)" : a && !p ? h === 0 && (!R || !T()) ? "" : (y - h) % 2 === 0 ? "var(--blue-25)" : "var(--blue-50)" : "";
728
+ }
729
+ function ro(c, s) {
730
+ if (s) {
731
+ if (s.heights && s.heights[c] !== void 0)
732
+ return s.heights[c];
733
+ if (s.defaultHeight)
734
+ return s.defaultHeight;
735
+ }
736
+ }
737
+ function Mr(c, s, i, a, f, x) {
738
+ const y = c.groupingColumnId, h = f[y] ?? !1, p = x[y] ?? !1, R = h && p && c.subRows.length <= 1 ? null : c.subRows.length > 1 ? /* @__PURE__ */ t(
739
+ "button",
740
+ {
741
+ tabIndex: -1,
742
+ onClick: c.getToggleExpandedHandler(),
743
+ className: "flex h-[var(--size-s)] w-[var(--size-s)] cursor-pointer items-center justify-center rounded-s text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",
744
+ children: /* @__PURE__ */ t(
745
+ W,
746
+ {
747
+ name: a ? "chevron-down" : "chevron-right",
748
+ className: "h-3 w-3"
749
+ }
750
+ )
751
+ }
752
+ ) : (
753
+ // Spacer to maintain alignment when there's only 1 item
754
+ /* @__PURE__ */ t("div", { className: "h-[var(--size-s)] w-[var(--size-s)]" })
755
+ ), D = c.subRows.length > 1 ? /* @__PURE__ */ t(xe, { appearance: "subtle", size: "s", truncate: !1, children: c.subRows.length }) : null;
756
+ if (i) {
757
+ const T = s.getAllColumns().find((C) => C.id === i);
758
+ if (T) {
759
+ const C = T.columnDef;
760
+ if (C.aggregatedCell) {
761
+ const A = c.getAllCells().find((P) => P.column.id === i);
762
+ return /* @__PURE__ */ b("div", { className: "flex items-center gap-[var(--space-s)] font-medium text-[var(--color-text-primary)]", children: [
763
+ R,
764
+ /* @__PURE__ */ b("div", { className: "flex items-center gap-[var(--space-s)]", children: [
765
+ A ? be(C.aggregatedCell, A.getContext()) : null,
766
+ D
767
+ ] })
768
+ ] });
769
+ } else {
770
+ const A = c.subRows[0]?.original?.[i];
771
+ return /* @__PURE__ */ b("div", { className: "flex items-center gap-[var(--space-s)] font-medium text-[var(--color-text-primary)]", children: [
772
+ R,
773
+ /* @__PURE__ */ b("div", { className: "flex items-center gap-[var(--space-s)]", children: [
774
+ /* @__PURE__ */ t("span", { className: "font-medium", children: String(A) }),
775
+ D
776
+ ] })
777
+ ] });
778
+ }
779
+ }
780
+ }
781
+ return /* @__PURE__ */ b("div", { className: "flex items-center gap-[var(--space-s)] font-medium text-[var(--color-text-primary)]", children: [
782
+ R,
783
+ /* @__PURE__ */ b("div", { className: "flex items-center gap-[var(--space-s)]", children: [
784
+ /* @__PURE__ */ t("span", { className: "font-medium", children: String(c.getGroupingValue(c.groupingColumnId)) }),
785
+ D
786
+ ] })
787
+ ] });
788
+ }
789
+ function ko({
790
+ columns: c,
791
+ data: s,
792
+ searchKey: i,
793
+ searchPlaceholder: a,
794
+ title: f,
795
+ caption: x,
796
+ className: y,
797
+ stickyHeader: h = !1,
798
+ stickyFirstColumn: p = !1,
799
+ stickyLeftColumns: v = 0,
800
+ stickyRightColumns: R = 0,
801
+ enableResponsiveWrapper: D = !0,
802
+ showScrollIndicators: T = !1,
803
+ minTableWidth: C = "900px",
804
+ isLoading: A = !1,
805
+ loadingBehavior: P = "replace",
806
+ loadingRowCount: N = 10,
807
+ borderStyle: Ue = "both",
808
+ defaultVerticalAlign: Ie = "middle",
809
+ enableGlobalSearch: ie = !1,
810
+ globalSearchPlaceholder: Gr = "Search all columns...",
811
+ enableAutocomplete: mt = !1,
812
+ globalSearchColumns: Je,
813
+ autocompleteMinCharacters: _r = 2,
814
+ enableGlobalFaceting: qr = !1,
815
+ enableColumnResizing: te = !1,
816
+ columnResizeMode: Ur = "onChange",
817
+ enableColumnResizePersistence: Ke = !1,
818
+ enablePaginationPersistence: ht = !1,
819
+ storageKey: Y = "data-table-columns",
820
+ enableExpanding: _ = !1,
821
+ getSubRows: Jr,
822
+ expandingRowColors: O,
823
+ nestedRowStyling: pt,
824
+ enableGrouping: z = !1,
825
+ groupedColumnMode: Kr = !1,
826
+ enableManualGrouping: Xr = !1,
827
+ groupDisplayColumn: Xe,
828
+ hideChildrenForSingleItemGroups: ye = {},
829
+ hideExpanderForSingleItemGroups: Vt = {},
830
+ enableRowPinning: Ee = !1,
831
+ keepPinnedRows: Ft = !0,
832
+ enableVirtualization: Qr = !1,
833
+ // virtualContainerHeight = 600,
834
+ // virtualRowHeight = 40,
835
+ // virtualOverscan = 10,
836
+ nestedHeaders: Qe = [],
837
+ enableNestedHeaders: Yr = !1,
838
+ enableColumnOrdering: Ye = !1,
839
+ enableRowSelection: fe = !1,
840
+ showHeader: Pe = !0,
841
+ showPagination: vt = !0,
842
+ paginationVariant: Zr = "full",
843
+ pageSizeOptions: en = [10, 25, 50, 100],
844
+ footerLabel: tn,
845
+ onTableReady: bt,
846
+ initialState: Ve,
847
+ // Controlled state props
848
+ sorting: $t,
849
+ onSortingChange: rn,
850
+ columnVisibility: jt,
851
+ onColumnVisibilityChange: nn,
852
+ grouping: At,
853
+ onGroupingChange: sn,
854
+ columnOrder: Lt,
855
+ onColumnOrderChange: on,
856
+ columnSizing: xt,
857
+ onColumnSizingChange: an,
858
+ pagination: Ot,
859
+ onPaginationChange: ln,
860
+ expanded: Ce,
861
+ onExpandedChange: yt,
862
+ renderSectionHeaderRow: Ht,
863
+ renderSubComponent: J,
864
+ getRowCanExpand: cn,
865
+ autoExpandChildren: Wt = !1,
866
+ // Row click props
867
+ onRowClick: K,
868
+ isRowClickable: we,
869
+ clickableRowClassName: Gt,
870
+ groupPreservingSearch: Ze = !1,
871
+ // Active row props
872
+ activeRowId: Fe,
873
+ activeRowClassName: _t,
874
+ getRowId: Ct,
875
+ onActiveRowChange: qt,
876
+ // Callback props
877
+ onRowSelectionChange: wt,
878
+ onNextPageHover: dn,
879
+ onPreviousPageHover: un,
880
+ onRowUpdate: no,
881
+ // Infinite scroll props
882
+ onLoadMore: Ut,
883
+ hasMoreData: fn,
884
+ isLoadingMore: gn,
885
+ // Error handling props
886
+ error: Jt,
887
+ onRetry: mn,
888
+ errorComponent: hn,
889
+ // Empty state props
890
+ emptyState: pn,
891
+ emptyStateTitle: vn = "No data",
892
+ emptyStateDescription: bn = "No items to display",
893
+ emptyStateAction: xn,
894
+ // No results state props
895
+ noResultsState: yn,
896
+ noResultsTitle: Cn = "No results found",
897
+ noResultsDescription: wn = "Try adjusting your search or filters",
898
+ noResultsAction: Sn,
899
+ // Refetching props
900
+ isRefetching: Nn = !1,
901
+ // Server-side mode props
902
+ manualSorting: Kt = !1,
903
+ manualFiltering: Xt = !1,
904
+ manualPagination: et = !1,
905
+ rowCount: Rn,
906
+ // Server-side expansion props
907
+ manualExpanding: Qt = !1,
908
+ onLoadChildren: tt,
909
+ expandingRowsLoading: rt,
910
+ subComponentLoading: nt,
911
+ onSubComponentLoad: De,
912
+ // Server-side error handling props
913
+ expandingRowsError: so,
914
+ subComponentError: Yt,
915
+ onExpandError: $e
916
+ }) {
917
+ const st = D || !!(v && v > 0) || !!(R && R > 0), [In, En] = l.useState([]), [Dn, kn] = l.useState({}), [zn, Bn] = l.useState(Ve?.grouping || []), [Tn, Mn] = l.useState(() => {
918
+ const e = c.map((r) => r.id || r.accessorKey || `column-${Math.random()}`);
919
+ return fe ? ["select", ...e] : e;
920
+ }), [Pn, Vn] = l.useState(xt || Ve?.columnSizing || {}), [Fn, $n] = l.useState(() => {
921
+ if (ht && Y) {
922
+ const e = localStorage.getItem(`${Y}-pagination`);
923
+ if (e)
924
+ try {
925
+ const r = JSON.parse(e);
926
+ if (typeof r.pageIndex == "number" && typeof r.pageSize == "number")
927
+ return r;
928
+ } catch (r) {
929
+ console.warn("Failed to parse saved pagination:", r);
930
+ }
931
+ }
932
+ return Ve?.pagination || { pageIndex: 0, pageSize: 10 };
933
+ }), [Zt, jn] = l.useState([]), [ke, An] = l.useState({}), [St, er] = l.useState(""), [Ln, tr] = l.useState(Ve?.expanded || {}), [On, Hn] = l.useState(Ve?.rowPinning || { top: [], bottom: [] }), [Wn, ot] = l.useState(""), [X, Nt] = l.useState([-1, 0]), Rt = l.useRef(null), je = l.useRef(/* @__PURE__ */ new Map()), Ae = l.useRef(/* @__PURE__ */ new Map());
934
+ l.useEffect(() => () => {
935
+ je.current.forEach((e) => e.abort()), Ae.current.forEach((e) => e.abort());
936
+ }, []), l.useEffect(() => {
937
+ wt && wt(ke);
938
+ }, [ke, wt]), l.useEffect(() => {
939
+ qt?.(Fe);
940
+ }, [Fe, qt]);
941
+ const rr = $t !== void 0, nr = jt !== void 0, sr = At !== void 0, or = Lt !== void 0, ar = xt !== void 0, lr = Ot !== void 0, It = Ce !== void 0, ge = rr ? $t : In, Gn = nr ? jt : Dn, me = sr ? At : zn, Le = or ? Lt : Tn, at = ar ? xt : Pn, re = lr ? Ot : Fn, Q = It ? Ce : Ln, _n = rr ? rn : En, qn = nr ? nn : kn, Un = sr ? sn : Bn, ir = or ? on : Mn, cr = ar ? an : Vn, Jn = lr ? ln : $n, Et = l.useCallback(
942
+ (e) => {
943
+ const r = typeof e == "object" && e !== null && !(e instanceof Function) && Object.keys(e).length === 0;
944
+ if (It && yt) {
945
+ if (r && (Ce === !0 || typeof Ce == "object" && Ce !== null && Object.keys(Ce).length > 0))
946
+ return;
947
+ yt(e);
948
+ } else
949
+ tr(r ? (n) => n === !0 || typeof n == "object" && n !== null && Object.keys(n).length > 0 ? n : e : e);
950
+ },
951
+ [It, yt, Ce]
952
+ ), Kn = l.useMemo(() => N !== void 0 && N !== 10 ? N : re.pageSize, [N, re.pageSize]), L = As(St, 300), Xn = l.useMemo(() => {
953
+ if (!mt || !ie)
954
+ return [];
955
+ const e = /* @__PURE__ */ new Set();
956
+ return s.forEach((r) => {
957
+ Je && Je.length > 0 ? Je.forEach((n) => {
958
+ const u = r[n];
959
+ u != null && String(u).trim() !== "" && e.add(String(u));
960
+ }) : Object.values(r).forEach((n) => {
961
+ n != null && String(n).trim() !== "" && e.add(String(n));
962
+ });
963
+ }), Array.from(e).sort();
964
+ }, [s, Je, mt, ie]), dr = l.useCallback((e, r, n) => {
965
+ if (!e || !r || r.length === 0)
966
+ return () => !0;
967
+ const u = e.toLowerCase(), g = /* @__PURE__ */ new Set();
968
+ return n.forEach((m) => {
969
+ let S = !1;
970
+ for (const B in m) {
971
+ const F = m[B];
972
+ if (F != null && String(F).toLowerCase().includes(u)) {
973
+ S = !0;
974
+ break;
975
+ }
976
+ }
977
+ S && r.forEach((B) => {
978
+ const F = m[B];
979
+ F != null && g.add(String(F));
980
+ });
981
+ }), (m) => {
982
+ for (const S of r) {
983
+ const B = m.getValue(S);
984
+ if (B != null && g.has(String(B)))
985
+ return !0;
986
+ }
987
+ return !1;
988
+ };
989
+ }, []);
990
+ l.useEffect(() => {
991
+ if (Ke && Y) {
992
+ const e = localStorage.getItem(`${Y}-sizing`);
993
+ if (e)
994
+ try {
995
+ cr(JSON.parse(e));
996
+ } catch (r) {
997
+ console.warn("Failed to parse saved column sizing:", r);
998
+ }
999
+ }
1000
+ }, [Ke, Y]), l.useEffect(() => {
1001
+ Ke && Y && Object.keys(at).length > 0 && localStorage.setItem(`${Y}-sizing`, JSON.stringify(at));
1002
+ }, [at, Ke, Y]), l.useEffect(() => {
1003
+ ht && Y && localStorage.setItem(`${Y}-pagination`, JSON.stringify(re));
1004
+ }, [re, ht, Y]);
1005
+ const E = l.useMemo(() => {
1006
+ switch (Ue) {
1007
+ case "horizontal":
1008
+ return { showRowBorder: !0, showCellBorder: !1 };
1009
+ case "vertical":
1010
+ return { showRowBorder: !1, showCellBorder: !0 };
1011
+ case "both":
1012
+ return { showRowBorder: !0, showCellBorder: !0 };
1013
+ case "none":
1014
+ return { showRowBorder: !1, showCellBorder: !1 };
1015
+ default:
1016
+ return { showRowBorder: !0, showCellBorder: !0 };
1017
+ }
1018
+ }, [Ue]), Dt = l.useCallback((e, r) => {
1019
+ if (!K) return;
1020
+ const n = r.target;
1021
+ if (!(n.tagName === "BUTTON" || n.tagName === "A" || n.tagName === "INPUT" || n.closest("button") || n.closest("a") || n.closest("input")) && !(we && !we(e))) {
1022
+ if (!we && e.getIsGrouped()) {
1023
+ const g = e.groupingColumnId;
1024
+ if (!((ye[g] ?? !1) && e.subRows && e.subRows.length === 1)) return;
1025
+ }
1026
+ K(e, r);
1027
+ }
1028
+ }, [K, we, ye]), Se = l.useCallback((e) => {
1029
+ if (!K) return !1;
1030
+ if (we) return we(e);
1031
+ if (!e.getIsGrouped()) return !0;
1032
+ const n = e.groupingColumnId;
1033
+ return (ye[n] ?? !1) && e.subRows && e.subRows.length === 1;
1034
+ }, [K, we, ye]), ur = (e) => e ? "![box-shadow:inset_3px_0_0_0_var(--color-border-brand-bold),inset_0_-1px_0_0_var(--color-border-primary-medium)]" : "![box-shadow:inset_3px_0_0_0_var(--color-border-brand-bold)]", ze = l.useCallback((e) => {
1035
+ if (!Fe) return !1;
1036
+ const r = Ct ? e.id : e.original?.id !== void 0 ? e.original.id : e.id;
1037
+ return String(r) === String(Fe);
1038
+ }, [Fe, Ct]), Oe = l.useMemo(() => p ? 1 : v || 0, [p, v]), Ne = l.useMemo(() => R || 0, [R]), fr = l.useMemo(() => {
1039
+ const e = /* @__PURE__ */ new Set();
1040
+ return c.forEach((r) => {
1041
+ if (r.cell) {
1042
+ const n = r.id || r.accessorKey;
1043
+ n && e.add(String(n));
1044
+ }
1045
+ }), e;
1046
+ }, [c]), kt = l.useMemo(() => {
1047
+ const e = c.map((r) => {
1048
+ let n = {
1049
+ ...r,
1050
+ // Set default minimum column width when resizing is enabled
1051
+ ...te && !r.minSize ? { minSize: 80 } : {}
1052
+ };
1053
+ return r.enableGrouping || r.meta?.enableGrouping ? {
1054
+ ...n,
1055
+ enableGrouping: !0,
1056
+ getGroupingValue: (u) => {
1057
+ const g = r.accessorKey || r.accessorFn;
1058
+ return typeof g == "string" && u.original ? u.original[g] : typeof g == "function" && u.original ? g(u.original) : u.getValue?.(r.id) || u[g] || "";
1059
+ }
1060
+ } : n;
1061
+ });
1062
+ return fe ? [{
1063
+ id: "select",
1064
+ size: 48,
1065
+ minSize: 48,
1066
+ maxSize: 48,
1067
+ enableResizing: !1,
1068
+ header: ({ table: n }) => /* @__PURE__ */ t(
1069
+ gt,
1070
+ {
1071
+ tabIndex: -1,
1072
+ checked: n.getIsAllPageRowsSelected() || n.getIsSomePageRowsSelected() && "indeterminate",
1073
+ onCheckedChange: (u) => n.toggleAllPageRowsSelected(!!u),
1074
+ "aria-label": "Select all"
1075
+ }
1076
+ ),
1077
+ cell: ({ row: n }) => /* @__PURE__ */ t(
1078
+ gt,
1079
+ {
1080
+ tabIndex: -1,
1081
+ checked: n.getIsSelected(),
1082
+ onCheckedChange: (u) => n.toggleSelected(!!u),
1083
+ "aria-label": "Select row"
1084
+ }
1085
+ ),
1086
+ enableSorting: !1,
1087
+ enableHiding: !1,
1088
+ enableGrouping: !1,
1089
+ meta: {
1090
+ label: "Select"
1091
+ }
1092
+ }, ...e] : e;
1093
+ }, [c, fe]), zt = l.useMemo(() => s, [s]), Qn = l.useMemo(() => !Ze || !L ? Rr : dr(L, me, zt), [Ze, L, me, zt, dr]), w = os({
1094
+ data: zt,
1095
+ columns: kt,
1096
+ getRowId: Ct,
1097
+ filterFns: {
1098
+ fuzzy: Rr,
1099
+ multiSelect: Ls
1100
+ },
1101
+ state: {
1102
+ sorting: ge,
1103
+ columnFilters: Zt,
1104
+ columnVisibility: Gn,
1105
+ rowSelection: ke,
1106
+ globalFilter: L,
1107
+ columnSizing: at,
1108
+ expanded: Q,
1109
+ grouping: me,
1110
+ rowPinning: On,
1111
+ columnOrder: Le,
1112
+ pagination: re
1113
+ },
1114
+ // Server-side mode configuration
1115
+ manualSorting: Kt,
1116
+ manualFiltering: Xt,
1117
+ manualPagination: et,
1118
+ rowCount: Rn,
1119
+ // Required for server-side pagination
1120
+ enableRowSelection: fe,
1121
+ enableColumnPinning: !1,
1122
+ // Disable TanStack Table pinning - using CSS approach
1123
+ enableGlobalFilter: ie,
1124
+ // Enable global filtering
1125
+ globalFilterFn: Qn,
1126
+ // Use group-preserving filter when enabled
1127
+ enableColumnResizing: te,
1128
+ columnResizeMode: Ur,
1129
+ enableExpanding: _,
1130
+ getSubRows: Jr,
1131
+ getRowCanExpand: cn,
1132
+ paginateExpandedRows: !1,
1133
+ // Only paginate top-level rows, not expanded children
1134
+ autoResetPageIndex: !1,
1135
+ // Prevent pagination from resetting on data/filter/grouping changes
1136
+ enableGrouping: z,
1137
+ groupedColumnMode: Kr,
1138
+ manualGrouping: Xr,
1139
+ enableRowPinning: Ee,
1140
+ keepPinnedRows: Ft,
1141
+ onRowSelectionChange: An,
1142
+ onSortingChange: _n,
1143
+ onColumnFiltersChange: jn,
1144
+ onColumnVisibilityChange: qn,
1145
+ onGlobalFilterChange: er,
1146
+ onColumnSizingChange: cr,
1147
+ onExpandedChange: Et,
1148
+ onGroupingChange: Un,
1149
+ onRowPinningChange: Hn,
1150
+ onColumnOrderChange: ir,
1151
+ onPaginationChange: Jn,
1152
+ getCoreRowModel: ms(),
1153
+ // Conditionally include row models based on manual mode
1154
+ getFilteredRowModel: Xt ? void 0 : gs(),
1155
+ getPaginationRowModel: et || Qr ? void 0 : fs(),
1156
+ getSortedRowModel: Kt ? void 0 : us(),
1157
+ getExpandedRowModel: _ ? ds() : void 0,
1158
+ getGroupedRowModel: z ? cs() : void 0,
1159
+ getFacetedRowModel: is(),
1160
+ getFacetedUniqueValues: ls(),
1161
+ getFacetedMinMaxValues: as()
1162
+ }), lt = l.useMemo(
1163
+ () => to(w.getRowModel().rows),
1164
+ [w.getRowModel().rows]
1165
+ ), it = l.useMemo(() => {
1166
+ if (!z) return null;
1167
+ const e = /* @__PURE__ */ new Map();
1168
+ return w.getGroupedRowModel?.()?.rows?.forEach((n) => {
1169
+ n.subRows && n.subRows.length > 0 && e.set(n.id, n.subRows);
1170
+ }), e;
1171
+ }, [z, w]), { flatVisibleRows: ct, rowIdToFlatIndex: gr } = l.useMemo(() => {
1172
+ const e = [], r = /* @__PURE__ */ new Map(), n = (g) => {
1173
+ const m = e.length;
1174
+ e.push(g), r.set(g.id, m), g.getIsExpanded() && (g.subRows && g.subRows.length > 0 ? g.subRows : it?.get(g.id) || []).forEach(n);
1175
+ };
1176
+ return w.getRowModel().rows.filter((g) => J || g.depth === 0).forEach(n), { flatVisibleRows: e, rowIdToFlatIndex: r };
1177
+ }, [w, Q, it, J]), mr = l.useRef(void 0);
1178
+ l.useEffect(() => {
1179
+ if (!z) return;
1180
+ const r = w.getPrePaginationRowModel().rows.filter((g) => g.depth === 0).length, n = re.pageSize, u = Math.max(1, Math.ceil(r / n));
1181
+ mr.current !== u && (mr.current = u, w.setPageCount(u));
1182
+ }, [
1183
+ z,
1184
+ // NOTE: Deliberately NOT including 'table' to avoid re-running on every render
1185
+ // We access table methods inside but only re-run when these stable values change:
1186
+ re.pageSize,
1187
+ me.join(","),
1188
+ // Join for efficient deep comparison
1189
+ w.getPrePaginationRowModel().rows.length
1190
+ // Row count changes
1191
+ ]);
1192
+ const hr = l.useRef({});
1193
+ l.useEffect(() => {
1194
+ if (!Wt) return;
1195
+ const e = w.getState().expanded, r = hr.current, n = { ...e };
1196
+ let u = !1;
1197
+ w.getRowModel().rows.forEach((g) => {
1198
+ const m = g.id, S = e[m] === !0, B = r[m] === !0;
1199
+ S && !B && g.subRows && g.subRows.length > 0 && g.subRows.forEach((F) => {
1200
+ e[F.id] !== !0 && (n[F.id] = !0, u = !0);
1201
+ });
1202
+ }), hr.current = e, u && Et(n);
1203
+ }, [
1204
+ Q,
1205
+ Wt
1206
+ // NOTE: Deliberately NOT including 'table' to avoid re-running on every render
1207
+ ]);
1208
+ const pr = l.useRef({});
1209
+ l.useEffect(() => {
1210
+ if (!tt && !De) return;
1211
+ const e = w.getState().expanded, r = pr.current;
1212
+ Object.keys(r).forEach((n) => {
1213
+ const u = r[n], g = e[n];
1214
+ if (u && !g) {
1215
+ const m = je.current.get(n);
1216
+ m && (m.abort(), je.current.delete(n));
1217
+ const S = Ae.current.get(n);
1218
+ S && (S.abort(), Ae.current.delete(n));
1219
+ }
1220
+ }), Object.keys(e).forEach((n) => {
1221
+ const u = e[n], g = r[n];
1222
+ if (u && !g) {
1223
+ const m = w.getRow(n);
1224
+ if (!m) return;
1225
+ if (tt && Qt) {
1226
+ const S = m.getIsGrouped() || m.subRows && m.subRows.length === 0 && m.getCanExpand(), B = rt?.[n] === !0, F = m.subRows && m.subRows.length > 0;
1227
+ if (S && !B && !F) {
1228
+ const o = new AbortController();
1229
+ je.current.set(n, o), Promise.resolve(tt(m)).catch((M) => {
1230
+ M?.name !== "AbortError" && $e && $e(m, M, "children");
1231
+ }).finally(() => {
1232
+ je.current.delete(n);
1233
+ });
1234
+ }
1235
+ }
1236
+ if (De && J && !m.getIsGrouped() && m.depth === 0 && !(nt?.[n] === !0)) {
1237
+ const B = new AbortController();
1238
+ Ae.current.set(n, B), Promise.resolve(De(m)).catch((F) => {
1239
+ F?.name !== "AbortError" && $e && $e(m, F, "subComponent");
1240
+ }).finally(() => {
1241
+ Ae.current.delete(n);
1242
+ });
1243
+ }
1244
+ }
1245
+ }), pr.current = e;
1246
+ }, [
1247
+ Q,
1248
+ tt,
1249
+ De,
1250
+ Qt,
1251
+ J,
1252
+ rt,
1253
+ nt,
1254
+ $e
1255
+ // NOTE: Deliberately NOT including 'table' to avoid re-running on every render
1256
+ ]), l.useEffect(() => {
1257
+ if (!Ze || !L || !z)
1258
+ return;
1259
+ const e = {};
1260
+ w.getFilteredRowModel().rows.forEach((n) => {
1261
+ n.getIsGrouped() && n.subRows && n.subRows.length > 0 && (e[n.id] = !0);
1262
+ }), Et((n) => {
1263
+ const u = Object.keys(n).sort().join(","), g = Object.keys(e).sort().join(",");
1264
+ return u === g ? n : e;
1265
+ });
1266
+ }, [L, Ze, z]);
1267
+ const vr = l.useRef(me), br = l.useRef(ge);
1268
+ l.useEffect(() => {
1269
+ if (!et) return;
1270
+ const e = JSON.stringify(me) !== JSON.stringify(vr.current), r = JSON.stringify(ge) !== JSON.stringify(br.current);
1271
+ (e || r) && w.setPageIndex(0), vr.current = me, br.current = ge;
1272
+ }, [me, ge, et, w]), l.useEffect(() => {
1273
+ bt && bt(w);
1274
+ }, [w, bt]), l.useEffect(() => {
1275
+ if (ge.length > 0) {
1276
+ const e = ge[0], r = c.find(
1277
+ (g) => g.id === e.id || g.accessorKey === e.id
1278
+ ), n = r?.meta?.label || r?.header || e.id, u = e.desc ? "descending" : "ascending";
1279
+ ot(`Table sorted by ${n}, ${u}`);
1280
+ }
1281
+ }, [ge, c]), l.useEffect(() => {
1282
+ if (L) {
1283
+ const e = w.getFilteredRowModel().rows.length;
1284
+ ot(`${e} result${e !== 1 ? "s" : ""} found for "${L}"`);
1285
+ }
1286
+ }, [L, w]), l.useEffect(() => {
1287
+ const e = Object.keys(ke).filter((r) => ke[r]).length;
1288
+ e > 0 && ot(`${e} row${e !== 1 ? "s" : ""} selected`);
1289
+ }, [ke]), l.useEffect(() => {
1290
+ const [e, r] = X, n = ct.length, u = w.getVisibleLeafColumns();
1291
+ let g = e, m = r;
1292
+ e >= 0 && e >= n && (g = Math.max(n - 1, -1)), r >= u.length && (m = Math.max(u.length - 1, 0)), (g !== e || m !== r) && Nt([g, m]);
1293
+ }, [s.length, w, X, ct.length]), l.useEffect(() => {
1294
+ const e = w.getPageCount();
1295
+ e > 1 && ot(`Page ${re.pageIndex + 1} of ${e}`);
1296
+ }, [re.pageIndex, w]);
1297
+ const He = l.useCallback((e, r) => {
1298
+ if (!r || !e) return e;
1299
+ const n = e.toLowerCase(), u = r.toLowerCase(), g = [];
1300
+ let m = 0, S = n.indexOf(u);
1301
+ for (; S !== -1; )
1302
+ S > m && g.push(e.substring(m, S)), g.push(
1303
+ /* @__PURE__ */ t(
1304
+ "span",
1305
+ {
1306
+ style: {
1307
+ backgroundColor: "#fef3c7",
1308
+ // Light yellow
1309
+ fontWeight: 600,
1310
+ padding: "2px 0"
1311
+ },
1312
+ children: e.substring(S, S + r.length)
1313
+ },
1314
+ `highlight-${m}-${S}`
1315
+ )
1316
+ ), m = S + r.length, S = n.indexOf(u, m);
1317
+ return m < e.length && g.push(e.substring(m)), /* @__PURE__ */ t(ee, { children: g });
1318
+ }, []), he = l.useCallback((e) => {
1319
+ if (e == null) return "";
1320
+ if (typeof e == "string" || typeof e == "number") return String(e);
1321
+ if (Array.isArray(e)) return e.map(he).join("");
1322
+ if (l.isValidElement(e)) {
1323
+ const r = e;
1324
+ if (typeof r.type == "function")
1325
+ try {
1326
+ if (r.type.prototype?.isReactComponent)
1327
+ return he(r.props.children);
1328
+ const u = r.type(r.props);
1329
+ return he(u);
1330
+ } catch {
1331
+ return he(r.props.children);
1332
+ }
1333
+ return he(r.props.children);
1334
+ }
1335
+ return "";
1336
+ }, []), dt = l.useCallback((e, r) => r ? he(e).toLowerCase().includes(r.toLowerCase()) : !1, [he]), ce = l.useCallback((e, r) => {
1337
+ if (!r || e == null) return e;
1338
+ if (typeof e == "string")
1339
+ return He(e, r);
1340
+ if (typeof e == "number")
1341
+ return He(String(e), r);
1342
+ if (Array.isArray(e))
1343
+ return e.map((n, u) => /* @__PURE__ */ t(l.Fragment, { children: ce(n, r) }, u));
1344
+ if (l.isValidElement(e)) {
1345
+ const n = e;
1346
+ if (typeof n.type == "function")
1347
+ try {
1348
+ if (n.type.prototype?.isReactComponent) {
1349
+ const B = n.props.children;
1350
+ return l.cloneElement(n, {}, ce(B, r));
1351
+ }
1352
+ const S = n.type(n.props);
1353
+ return ce(S, r);
1354
+ } catch {
1355
+ const { children: S, ...B } = n.props;
1356
+ return S == null ? n : l.cloneElement(
1357
+ n,
1358
+ B,
1359
+ ce(S, r)
1360
+ );
1361
+ }
1362
+ if (n.props.children === void 0 || n.props.children === null)
1363
+ return n;
1364
+ const { children: u, ...g } = n.props;
1365
+ return l.cloneElement(
1366
+ n,
1367
+ g,
1368
+ ce(u, r)
1369
+ );
1370
+ }
1371
+ return e;
1372
+ }, [He]), Be = l.useCallback((e) => {
1373
+ if (!ie || !L)
1374
+ return be(e.column.columnDef.cell, e.getContext());
1375
+ if (fr.has(e.column.id)) {
1376
+ const u = be(e.column.columnDef.cell, e.getContext());
1377
+ return u == null || !dt(u, L) ? u : ce(u, L);
1378
+ }
1379
+ const n = e.getValue();
1380
+ if (typeof n == "string" || typeof n == "number") {
1381
+ const u = String(n);
1382
+ return He(u, L);
1383
+ }
1384
+ return be(e.column.columnDef.cell, e.getContext());
1385
+ }, [ie, L, He, fr, dt, ce]), xr = l.useCallback((e) => {
1386
+ if (!ie || !L)
1387
+ return be(e.column.columnDef.aggregatedCell, e.getContext());
1388
+ const r = be(e.column.columnDef.aggregatedCell, e.getContext());
1389
+ return r == null || !dt(r, L) ? r : ce(r, L);
1390
+ }, [ie, L, dt, ce, he]), Yn = l.useRef(null), Zn = hs(
1391
+ wr(ps, {
1392
+ activationConstraint: {
1393
+ distance: 8
1394
+ }
1395
+ }),
1396
+ wr(vs, {
1397
+ activationConstraint: {
1398
+ delay: 200,
1399
+ tolerance: 8
1400
+ }
1401
+ })
1402
+ ), [, yr] = l.useState(null), es = (e) => {
1403
+ Ye && yr(e.active.id);
1404
+ }, ts = (e) => {
1405
+ if (!Ye) return;
1406
+ const { active: r, over: n } = e;
1407
+ if (yr(null), r.id !== n?.id && n?.id) {
1408
+ const u = Le.findIndex((m) => m === r.id), g = Le.findIndex((m) => m === n?.id);
1409
+ if (u !== -1 && g !== -1) {
1410
+ const m = ws(Le, u, g);
1411
+ console.log("Column reorder:", {
1412
+ activeId: r.id,
1413
+ overId: n.id,
1414
+ oldIndex: u,
1415
+ newIndex: g,
1416
+ oldOrder: Le,
1417
+ newOrder: m
1418
+ }), ir(m);
1419
+ }
1420
+ }
1421
+ }, rs = l.useCallback((e) => {
1422
+ const [r, n] = X, u = w.getVisibleLeafColumns(), g = ct, m = u.length, S = g.length, B = -1, F = S - 1;
1423
+ let o = r, M = n, $ = !1;
1424
+ switch (e.key) {
1425
+ case "ArrowRight":
1426
+ n < m - 1 && (M = n + 1, $ = !0);
1427
+ break;
1428
+ case "ArrowLeft":
1429
+ n > 0 && (M = n - 1, $ = !0);
1430
+ break;
1431
+ case "ArrowDown":
1432
+ r < F && (o = r + 1, $ = !0);
1433
+ break;
1434
+ case "ArrowUp":
1435
+ r > B && (o = r - 1, $ = !0);
1436
+ break;
1437
+ case "Home":
1438
+ (e.ctrlKey || e.metaKey) && (o = B), M = 0, $ = !0;
1439
+ break;
1440
+ case "End":
1441
+ (e.ctrlKey || e.metaKey) && (o = F), M = m - 1, $ = !0;
1442
+ break;
1443
+ case "PageDown":
1444
+ o = Math.min(r + 10, F), $ = !0;
1445
+ break;
1446
+ case "PageUp":
1447
+ o = Math.max(r - 10, B), $ = !0;
1448
+ break;
1449
+ case "Enter":
1450
+ case " ":
1451
+ if (r === -1) {
1452
+ const d = u[n];
1453
+ d?.id === "select" && fe && e.key === " " ? (w.toggleAllPageRowsSelected(), $ = !0) : d?.getCanSort() && (d.toggleSorting(), $ = !0);
1454
+ } else {
1455
+ const d = g[r];
1456
+ d && ((_ || z) && d.getCanExpand() ? (d.toggleExpanded(), $ = !0) : fe && e.key === " " && (d.toggleSelected(), $ = !0), !$ && e.key === "Enter" && K && Se(d) && (Dt(d, e), $ = !0));
1457
+ }
1458
+ break;
1459
+ case "Escape":
1460
+ document.activeElement instanceof HTMLElement && document.activeElement.blur(), $ = !0;
1461
+ break;
1462
+ }
1463
+ if ($ && (e.preventDefault(), e.stopPropagation(), o !== r || M !== n)) {
1464
+ Nt([o, M]);
1465
+ const d = o === -1 ? `[data-header-col="${M}"]` : `[data-row="${o}"][data-col="${M}"]`, k = Rt.current?.querySelector(d);
1466
+ k && k.focus();
1467
+ }
1468
+ }, [X, w, ct, _, z, fe]), ns = l.useCallback((e) => {
1469
+ Rt.current?.contains(e.relatedTarget) || Nt([-1, 0]);
1470
+ }, []), We = l.useMemo(() => {
1471
+ const e = w.getVisibleFlatColumns(), r = /* @__PURE__ */ new Map();
1472
+ let n = 0;
1473
+ e.forEach((g, m) => {
1474
+ const S = m < Oe, B = m >= e.length - Ne, F = S && m === Oe - 1, o = B && m === e.length - Ne;
1475
+ r.set(g.id, {
1476
+ isLeftSticky: S,
1477
+ isRightSticky: B,
1478
+ leftPosition: n,
1479
+ rightPosition: 0,
1480
+ // Will be calculated below
1481
+ isRightmostLeftSticky: F,
1482
+ isLeftmostRightSticky: o,
1483
+ columnIndex: m
1484
+ }), n += g.getSize();
1485
+ });
1486
+ let u = 0;
1487
+ for (let g = e.length - 1; g >= 0; g--) {
1488
+ const m = e[g], S = r.get(m.id);
1489
+ S && (S.rightPosition = u), u += m.getSize();
1490
+ }
1491
+ return { data: r, allColumns: e };
1492
+ }, [w.getVisibleFlatColumns(), Oe, Ne]), Ge = (e, r = !1, n = !0) => {
1493
+ if (!e || typeof e.getSize != "function")
1494
+ return {};
1495
+ const u = We.data.get(e.id);
1496
+ if (!u || !u.isLeftSticky && !u.isRightSticky)
1497
+ return {};
1498
+ const { isLeftSticky: g, isRightSticky: m, leftPosition: S, rightPosition: B, isRightmostLeftSticky: F, isLeftmostRightSticky: o } = u;
1499
+ if (g) {
1500
+ const M = {
1501
+ position: "sticky",
1502
+ left: `${S}px`,
1503
+ ...r && { backgroundColor: "var(--grey-25)" },
1504
+ width: `${e.getSize()}px`,
1505
+ minWidth: `${e.getSize()}px`,
1506
+ maxWidth: `${e.getSize()}px`
1507
+ };
1508
+ return F && r ? {
1509
+ ...M,
1510
+ backgroundImage: "linear-gradient(to right, var(--grey-25) calc(100% - 3px), var(--color-border-primary-medium) calc(100% - 3px), var(--color-border-primary-medium) 100%)",
1511
+ backgroundColor: "transparent"
1512
+ } : M;
1513
+ }
1514
+ if (m) {
1515
+ const M = {
1516
+ position: "sticky",
1517
+ right: `${B}px`,
1518
+ ...r && { backgroundColor: "var(--grey-25)" },
1519
+ width: `${e.getSize()}px`,
1520
+ minWidth: `${e.getSize()}px`,
1521
+ maxWidth: `${e.getSize()}px`
1522
+ };
1523
+ return o && r ? {
1524
+ ...M,
1525
+ backgroundImage: "linear-gradient(to right, var(--color-border-primary-medium) 0, var(--color-border-primary-medium) 3px, var(--grey-25) 3px)",
1526
+ backgroundColor: "transparent"
1527
+ } : M;
1528
+ }
1529
+ return {};
1530
+ }, ss = (e) => {
1531
+ if (!e || typeof e.getSize != "function")
1532
+ return "";
1533
+ const r = We.data.get(e.id);
1534
+ return r ? r.isRightmostLeftSticky ? "border-r-[3px] border-[var(--color-border-primary-medium)]" : r.isLeftmostRightSticky ? "border-l-[3px] border-[var(--color-border-primary-medium)]" : "" : "";
1535
+ }, Bt = (e) => {
1536
+ if (!e || typeof e.getSize != "function")
1537
+ return !1;
1538
+ const r = We.data.get(e.id);
1539
+ return r ? r.isRightmostLeftSticky || r.isLeftmostRightSticky : !1;
1540
+ }, Tt = (e) => {
1541
+ if (!e || typeof e.getSize != "function" || Ne === 0)
1542
+ return !1;
1543
+ const r = We.data.get(e.id);
1544
+ return r ? r.columnIndex === We.allColumns.length - Ne - 1 : !1;
1545
+ }, Cr = (e, r = !1) => !te || !e.getCanResize() || !!E.showCellBorder ? "" : V(
1546
+ // Right side indicator - hidden for last column
1547
+ !r && [
1548
+ "after:content-[''] after:absolute after:right-px after:top-1/2 after:-translate-y-1/2",
1549
+ "after:w-[2px] after:h-[24px] after:rounded-[2px]",
1550
+ "after:bg-[var(--color-border-primary-medium)]",
1551
+ "after:opacity-0 hover:after:opacity-100",
1552
+ "after:transition-opacity after:pointer-events-none after:z-10"
1553
+ ],
1554
+ // Left side indicator - positioned to align with resize handle (outside column)
1555
+ "before:content-[''] before:absolute before:left-[-3px] before:top-1/2 before:-translate-y-1/2",
1556
+ "before:w-[2px] before:h-[24px] before:rounded-[2px]",
1557
+ "before:bg-[var(--color-border-primary-medium)]",
1558
+ "before:opacity-0 hover:before:opacity-100",
1559
+ "before:transition-opacity before:pointer-events-none before:z-10"
1560
+ );
1561
+ return /* @__PURE__ */ t(Vs, { children: /* @__PURE__ */ t(
1562
+ bs,
1563
+ {
1564
+ sensors: Zn,
1565
+ collisionDetection: xs,
1566
+ onDragStart: es,
1567
+ onDragEnd: ts,
1568
+ children: /* @__PURE__ */ b("div", { className: V(
1569
+ "border border-[var(--color-border-primary-medium)] bg-[var(--color-surface-primary)] overflow-hidden rounded-l",
1570
+ // Remove bottom border when no pagination to avoid double border with last row
1571
+ !vt && "border-b-0",
1572
+ y
1573
+ ), children: [
1574
+ Pe && (f || ie) && /* @__PURE__ */ b("div", { className: "border-b border-[var(--color-border-primary-medium)] bg-[var(--color-surface-primary)] px-[var(--space-l)] py-[var(--space-m)]", children: [
1575
+ f && /* @__PURE__ */ b("div", { className: "flex justify-between items-center", children: [
1576
+ /* @__PURE__ */ t("h3", { className: "text-heading-sm font-semibold text-[var(--color-text-primary)]", children: f }),
1577
+ /* @__PURE__ */ t(Wr, { table: w, enableGrouping: z })
1578
+ ] }),
1579
+ /* @__PURE__ */ t(
1580
+ Ks,
1581
+ {
1582
+ table: w,
1583
+ searchKey: i,
1584
+ searchPlaceholder: a,
1585
+ showSettingsMenu: !1,
1586
+ enableGlobalSearch: ie,
1587
+ globalSearchPlaceholder: Gr,
1588
+ globalFilter: St,
1589
+ onGlobalFilterChange: er,
1590
+ enableGlobalFaceting: qr,
1591
+ enableGrouping: z,
1592
+ enableAutocomplete: mt,
1593
+ autocompleteSuggestions: Xn,
1594
+ autocompleteMinCharacters: _r
1595
+ }
1596
+ )
1597
+ ] }),
1598
+ /* @__PURE__ */ b(
1599
+ "div",
1600
+ {
1601
+ ref: Rt,
1602
+ onKeyDown: rs,
1603
+ onFocus: ns,
1604
+ className: V(
1605
+ "relative",
1606
+ st && [
1607
+ "overflow-x-auto",
1608
+ "scrollbar-thin scrollbar-track-transparent scrollbar-thumb-[var(--color-border-primary-subtle)]",
1609
+ "hover:scrollbar-thumb-[var(--color-border-primary)]",
1610
+ // Touch-friendly scrollbar
1611
+ "max-sm:scrollbar-none"
1612
+ ]
1613
+ ),
1614
+ children: [
1615
+ T && /* @__PURE__ */ b(ee, { children: [
1616
+ /* @__PURE__ */ t("div", { className: "absolute top-0 left-0 bottom-0 w-8 bg-gradient-to-r from-[var(--color-surface-primary)] to-transparent z-10 pointer-events-none opacity-0 transition-opacity" }),
1617
+ /* @__PURE__ */ t("div", { className: "absolute top-0 right-0 bottom-0 w-8 bg-gradient-to-l from-[var(--color-surface-primary)] to-transparent z-10 pointer-events-none opacity-0 transition-opacity" })
1618
+ ] }),
1619
+ /* @__PURE__ */ t(
1620
+ "div",
1621
+ {
1622
+ role: "status",
1623
+ "aria-live": "polite",
1624
+ "aria-atomic": "true",
1625
+ className: "sr-only",
1626
+ children: Wn
1627
+ }
1628
+ ),
1629
+ /* @__PURE__ */ b(
1630
+ Is,
1631
+ {
1632
+ ref: Yn,
1633
+ role: "grid",
1634
+ "aria-label": x || f,
1635
+ "aria-rowcount": s.length,
1636
+ "aria-colcount": w.getVisibleLeafColumns().length,
1637
+ className: V(
1638
+ "border-separate border-spacing-0",
1639
+ // Required for sticky columns to work properly
1640
+ te && "table-fixed"
1641
+ // Fixed layout for column resizing
1642
+ ),
1643
+ style: {
1644
+ ...st && { minWidth: C }
1645
+ },
1646
+ children: [
1647
+ /* @__PURE__ */ t("colgroup", { children: w.getVisibleLeafColumns().map((e) => /* @__PURE__ */ t(
1648
+ "col",
1649
+ {
1650
+ style: {
1651
+ width: e.id === "select" ? "48px" : void 0
1652
+ }
1653
+ },
1654
+ e.id
1655
+ )) }),
1656
+ /* @__PURE__ */ t(Es, { className: V(
1657
+ h && [
1658
+ "sticky top-0 z-20",
1659
+ "after:absolute after:bottom-0 after:left-0 after:right-0 after:h-px after:bg-[var(--color-border-primary-medium)]"
1660
+ ],
1661
+ // Remove bottom border from last header row when pagination is enabled to avoid double border
1662
+ vt && "[&_tr:last-child]:border-b-0"
1663
+ ), children: A ? /* @__PURE__ */ t(
1664
+ Br,
1665
+ {
1666
+ columns: w.getVisibleLeafColumns().length,
1667
+ rows: 0,
1668
+ showRowBorder: E.showRowBorder,
1669
+ showCellBorder: E.showCellBorder,
1670
+ enableResponsiveWrapper: st
1671
+ }
1672
+ ) : Yr && Qe && Qe.length > 0 ? (
1673
+ // Nested headers rendering
1674
+ /* @__PURE__ */ b(ee, { children: [
1675
+ /* @__PURE__ */ t(G, { showBorder: E.showRowBorder, children: Qe.map((e, r) => {
1676
+ const n = e.columns.length, u = Ge(e, !0, E.showRowBorder);
1677
+ return /* @__PURE__ */ t(
1678
+ ut,
1679
+ {
1680
+ colSpan: n,
1681
+ showBorder: E.showCellBorder,
1682
+ className: V(
1683
+ "text-center bg-[var(--color-background-neutral-subtlest)] font-medium border-b border-[var(--color-border-primary-medium)]",
1684
+ h && "z-20",
1685
+ !Pe && r === 0 && "rounded-tl-l",
1686
+ !Pe && r === Qe.length - 1 && "rounded-tr-l",
1687
+ e.className
1688
+ ),
1689
+ style: {
1690
+ ...u,
1691
+ ...e.style
1692
+ },
1693
+ children: typeof e.header == "string" ? /* @__PURE__ */ t("span", { className: "text-body-strong-sm text-[var(--color-text-primary)]", children: e.header }) : e.header
1694
+ },
1695
+ e.id
1696
+ );
1697
+ }) }),
1698
+ /* @__PURE__ */ t(G, { showBorder: E.showRowBorder, children: w.getHeaderGroups()[0]?.headers.map((e, r) => {
1699
+ const n = Ge(e.column, !0, E.showRowBorder), u = e.column.columnDef.meta?.align || "left", g = r === w.getHeaderGroups()[0].headers.length - 1, m = Bt(e.column);
1700
+ return /* @__PURE__ */ t(
1701
+ ut,
1702
+ {
1703
+ scope: "col",
1704
+ "aria-sort": e.column.getCanSort() ? e.column.getIsSorted() ? e.column.getIsSorted() === "desc" ? "descending" : "ascending" : "none" : void 0,
1705
+ "aria-colindex": r + 1,
1706
+ "data-header-col": r,
1707
+ tabIndex: X[0] === -1 && X[1] === r ? 0 : -1,
1708
+ showBorder: g || m || Tt(e.column) ? !1 : E.showCellBorder,
1709
+ className: V(
1710
+ h && "z-20",
1711
+ (Oe > 0 || Ne > 0) && "z-30",
1712
+ te && "relative overflow-visible group",
1713
+ Cr(e.column, g),
1714
+ // Focus ring for keyboard navigation
1715
+ "focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--color-border-brand-bold)]"
1716
+ ),
1717
+ style: {
1718
+ ...n,
1719
+ // For table-fixed layout, all columns need explicit width
1720
+ ...te && !n.width ? { width: e.column.getSize() } : {}
1721
+ },
1722
+ children: /* @__PURE__ */ b("div", { className: V(
1723
+ u === "right" ? "text-right" : "text-left"
1724
+ ), children: [
1725
+ e.isPlaceholder ? null : be(
1726
+ e.column.columnDef.header,
1727
+ e.getContext()
1728
+ ),
1729
+ te && e.column.getCanResize() && /* @__PURE__ */ t(
1730
+ "div",
1731
+ {
1732
+ onMouseDown: e.getResizeHandler(),
1733
+ onTouchStart: e.getResizeHandler(),
1734
+ className: "absolute right-0 top-0 h-full w-2 cursor-col-resize select-none touch-none -mr-1",
1735
+ children: /* @__PURE__ */ t(
1736
+ "div",
1737
+ {
1738
+ className: V(
1739
+ "absolute right-1 top-0 h-full w-1",
1740
+ "hover:bg-[var(--color-border-primary-medium)] active:bg-[var(--color-border-primary-medium)]",
1741
+ e.column.getIsResizing() && "bg-[var(--color-border-primary-medium)]"
1742
+ )
1743
+ }
1744
+ )
1745
+ }
1746
+ )
1747
+ ] })
1748
+ },
1749
+ e.id
1750
+ );
1751
+ }) })
1752
+ ] })
1753
+ ) : (
1754
+ // Standard single-level headers
1755
+ w.getHeaderGroups().map((e) => /* @__PURE__ */ t(
1756
+ ys,
1757
+ {
1758
+ items: e.headers.map((r) => r.id),
1759
+ strategy: Cs,
1760
+ children: /* @__PURE__ */ t(G, { showBorder: E.showRowBorder, children: e.headers.map((r, n) => {
1761
+ const u = Ge(r.column, !0, E.showRowBorder), g = r.column.columnDef.meta?.align || "left", m = n === e.headers.length - 1, S = Bt(r.column);
1762
+ return /* @__PURE__ */ t(
1763
+ ut,
1764
+ {
1765
+ scope: "col",
1766
+ "aria-sort": r.column.getCanSort() ? r.column.getIsSorted() ? r.column.getIsSorted() === "desc" ? "descending" : "ascending" : "none" : void 0,
1767
+ "aria-colindex": n + 1,
1768
+ "data-header-col": n,
1769
+ tabIndex: X[0] === -1 && X[1] === n ? 0 : -1,
1770
+ showBorder: m || S || Tt(r.column) ? !1 : E.showCellBorder,
1771
+ className: V(
1772
+ h && "z-20",
1773
+ (Oe > 0 || Ne > 0) && "z-30",
1774
+ te && "relative overflow-visible group",
1775
+ Ye && "group",
1776
+ !Pe && n === 0 && "rounded-tl-l",
1777
+ !Pe && n === e.headers.length - 1 && "rounded-tr-l",
1778
+ Cr(r.column, m),
1779
+ // Focus ring for keyboard navigation
1780
+ "focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--color-border-brand-bold)]"
1781
+ ),
1782
+ style: {
1783
+ ...u,
1784
+ // For table-fixed layout, all columns need explicit width
1785
+ ...te && !u.width ? { width: r.column.getSize() } : {}
1786
+ },
1787
+ children: /* @__PURE__ */ t(Ys, { header: r, enableColumnOrdering: Ye, children: /* @__PURE__ */ b("div", { className: V(
1788
+ g === "right" ? "text-right" : "text-left"
1789
+ ), children: [
1790
+ r.isPlaceholder ? null : be(
1791
+ r.column.columnDef.header,
1792
+ r.getContext()
1793
+ ),
1794
+ te && r.column.getCanResize() && /* @__PURE__ */ t(
1795
+ "div",
1796
+ {
1797
+ onMouseDown: r.getResizeHandler(),
1798
+ onTouchStart: r.getResizeHandler(),
1799
+ className: "absolute right-0 top-0 h-full w-2 cursor-col-resize select-none touch-none -mr-1",
1800
+ children: /* @__PURE__ */ t(
1801
+ "div",
1802
+ {
1803
+ className: V(
1804
+ "absolute right-1 top-0 h-full w-1",
1805
+ "hover:bg-[var(--color-border-primary-medium)] active:bg-[var(--color-border-primary-medium)]",
1806
+ r.column.getIsResizing() && "bg-[var(--color-border-primary-medium)]"
1807
+ )
1808
+ }
1809
+ )
1810
+ }
1811
+ )
1812
+ ] }) })
1813
+ },
1814
+ r.id
1815
+ );
1816
+ }) })
1817
+ },
1818
+ e.id
1819
+ ))
1820
+ ) }),
1821
+ /* @__PURE__ */ b(Ds, { children: [
1822
+ Nn && !A && s.length > 0 && /* @__PURE__ */ t("tr", { className: "absolute top-0 left-0 right-0 z-50 h-0", children: /* @__PURE__ */ t("td", { colSpan: w.getVisibleLeafColumns().length, className: "p-0", children: /* @__PURE__ */ t(Js, {}) }) }),
1823
+ Jt ? /* @__PURE__ */ t(G, { showBorder: !1, className: "h-[300px]", children: /* @__PURE__ */ t(
1824
+ le,
1825
+ {
1826
+ colSpan: w.getVisibleLeafColumns().length,
1827
+ className: "text-center",
1828
+ showBorder: !1,
1829
+ showRowBorder: !1,
1830
+ verticalAlign: "middle",
1831
+ children: hn || /* @__PURE__ */ t(
1832
+ Us,
1833
+ {
1834
+ error: Jt,
1835
+ onRetry: mn
1836
+ }
1837
+ )
1838
+ }
1839
+ ) }) : A && (P === "replace" || s.length === 0) ? /* @__PURE__ */ t(
1840
+ Br,
1841
+ {
1842
+ columns: w.getVisibleLeafColumns().length,
1843
+ rows: Kn,
1844
+ showRowBorder: E.showRowBorder,
1845
+ showCellBorder: E.showCellBorder,
1846
+ skipHeader: !0,
1847
+ enableResponsiveWrapper: st
1848
+ }
1849
+ ) : (
1850
+ // DISABLED: Virtualization temporarily disabled to fix React hooks error
1851
+ // false && enableVirtualization && virtualizer && table.getRowModel().rows?.length ? (
1852
+ // // Virtualized rows - DISABLED
1853
+ // ) :
1854
+ w.getRowModel().rows?.length ? (
1855
+ // Manual cross-page pinning: organize rows with pinned rows at top/bottom of every page
1856
+ (() => {
1857
+ if (!Ee || !Ft) {
1858
+ const o = /* @__PURE__ */ new Set(), M = w.getRowModel().rows.filter((d) => J || d.depth === 0), $ = (d, k, H) => {
1859
+ if (o.has(d.id)) return null;
1860
+ o.add(d.id);
1861
+ const q = gr.get(d.id) ?? -1;
1862
+ return /* @__PURE__ */ b(l.Fragment, { children: [
1863
+ /* @__PURE__ */ t(
1864
+ G,
1865
+ {
1866
+ "data-state": d.getIsSelected() && "selected",
1867
+ showBorder: E.showRowBorder,
1868
+ "aria-rowindex": q + 2,
1869
+ "aria-selected": fe ? d.getIsSelected() : void 0,
1870
+ "aria-expanded": d.getCanExpand() ? d.getIsExpanded() : void 0,
1871
+ className: V(
1872
+ "group",
1873
+ // Selected row styling
1874
+ d.getIsSelected() && "bg-[var(--blue-25)]",
1875
+ // Pinned row styling using existing CSS variables
1876
+ d.getIsPinned() === "top" && "!bg-[var(--color-background-neutral-selected)] !border-b-2 !border-[var(--color-border-primary-medium)]",
1877
+ d.getIsPinned() === "bottom" && "!bg-[var(--color-background-neutral-selected)] !border-t-2 !border-[var(--color-border-primary-medium)]",
1878
+ // Nested row background colors (grouped and expanding)
1879
+ (() => {
1880
+ const j = d.getIsGrouped?.() ? "font-medium" : "", ne = Tr(d, {
1881
+ enableGrouping: z,
1882
+ enableExpanding: _,
1883
+ nestedRowStyling: pt,
1884
+ expandingRowColors: O,
1885
+ maxDepth: lt
1886
+ });
1887
+ return V(ne ? `bg-[${ne}]` : "", j);
1888
+ })(),
1889
+ // Row click styling with smart hover
1890
+ K && Se(d) && (Gt || "cursor-pointer hover:[background-image:linear-gradient(rgba(0,0,0,0.02),rgba(0,0,0,0.02))]")
1891
+ ),
1892
+ style: {
1893
+ height: ro(d.depth, pt)
1894
+ },
1895
+ onClick: K && Se(d) ? (I) => Dt(d, I) : void 0,
1896
+ role: "row",
1897
+ "aria-label": K && Se(d) ? `View details for row ${d.id}` : void 0,
1898
+ "aria-current": ze(d) ? "true" : void 0,
1899
+ children: d.getVisibleCells().map((I, j) => {
1900
+ const ne = Ge(I.column, !1, E.showRowBorder), U = j === 0, _e = _ && d.getCanExpand() || z && d.getIsGrouped(), de = d.getIsExpanded(), ue = d.depth, Mt = z && d.getIsGrouped();
1901
+ let Re = Ht?.(d);
1902
+ if (Re == null)
1903
+ for (const oe of d.getVisibleCells()) {
1904
+ const ae = oe.column.columnDef.sectionHeaderCell;
1905
+ if (ae) {
1906
+ const Pt = ae(oe.getContext());
1907
+ if (Pt != null) {
1908
+ Re = Pt;
1909
+ break;
1910
+ }
1911
+ }
1912
+ }
1913
+ const se = Re != null;
1914
+ if (se && !U)
1915
+ return null;
1916
+ const Z = z && d.depth > 0 && j === 0 && !H;
1917
+ return /* @__PURE__ */ t(
1918
+ le,
1919
+ {
1920
+ role: "gridcell",
1921
+ "aria-colindex": j + 1,
1922
+ "data-row": q,
1923
+ "data-col": j,
1924
+ tabIndex: X[0] === q && X[1] === j ? 0 : -1,
1925
+ showBorder: Bt(I.column) || Tt(I.column) ? !1 : E.showCellBorder,
1926
+ showRowBorder: E.showRowBorder,
1927
+ verticalAlign: I.column.columnDef.meta?.verticalAlign || Ie,
1928
+ colSpan: se ? d.getVisibleCells().length : void 0,
1929
+ "data-section-header": se ? !0 : void 0,
1930
+ className: V(
1931
+ // Active row indicator on first cell
1932
+ U && ze(d) && (_t || ur(Z ? !1 : E.showRowBorder)),
1933
+ // Add sticky border classes for body cells (skip for section headers)
1934
+ !se && ss(I.column),
1935
+ // Sticky columns need higher z-index and explicit backgrounds
1936
+ Object.keys(ne).length > 0 && [
1937
+ "z-10",
1938
+ // Match row backgrounds for sticky cells to prevent transparency
1939
+ (() => {
1940
+ const oe = Tr(d, {
1941
+ enableGrouping: z,
1942
+ enableExpanding: _,
1943
+ nestedRowStyling: pt,
1944
+ expandingRowColors: O,
1945
+ maxDepth: lt
1946
+ });
1947
+ return oe ? `bg-[${oe}]` : "bg-[var(--color-surface-primary)]";
1948
+ })()
1949
+ ],
1950
+ // Section header background
1951
+ se && "bg-[var(--blue-50)]",
1952
+ // Remove bottom border from first column child rows (except last), but not when row is active
1953
+ Z && !ze(d) && "![box-shadow:none]",
1954
+ // Focus ring for keyboard navigation
1955
+ "focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--color-border-brand-bold)]"
1956
+ ),
1957
+ style: {
1958
+ ...ne,
1959
+ // Add left padding for nested rows
1960
+ paddingLeft: U && ue > 0 && !se ? `calc(var(--space-m) + ${ue * 20}px)` : void 0
1961
+ },
1962
+ children: se ? (
1963
+ // Section header row - render custom content
1964
+ Re
1965
+ ) : Mt ? (
1966
+ // Grouped row rendering - only show content in first cell
1967
+ U ? Mr(d, w, Xe, de, ye, Vt) : I.column.columnDef.meta?.renderInGroupedRows ? (
1968
+ // Render custom cell content for columns with renderInGroupedRows flag
1969
+ Be(I)
1970
+ ) : I.column.columnDef.aggregatedCell ? (
1971
+ // Render custom aggregatedCell if defined
1972
+ xr(I)
1973
+ ) : (
1974
+ // Calculate and show aggregation for other columns in grouped row
1975
+ (() => {
1976
+ const oe = zr(
1977
+ I.column,
1978
+ d.subRows,
1979
+ d.groupingColumnId
1980
+ );
1981
+ if (!oe) return /* @__PURE__ */ t("div", {});
1982
+ const ae = I.column.columnDef.meta?.align || "left";
1983
+ return /* @__PURE__ */ t(Te, { align: ae, children: /* @__PURE__ */ t("span", { className: V(
1984
+ "text-[var(--color-text-secondary)] text-body-sm",
1985
+ ae === "right" ? "tabular-nums" : ""
1986
+ ), children: oe }) });
1987
+ })()
1988
+ )
1989
+ ) : (
1990
+ // Regular row rendering
1991
+ /* @__PURE__ */ b("div", { className: "flex items-center gap-[var(--space-s)]", children: [
1992
+ U && _e && /* @__PURE__ */ t(
1993
+ "button",
1994
+ {
1995
+ tabIndex: -1,
1996
+ onClick: d.getToggleExpandedHandler(),
1997
+ className: "flex h-[var(--size-s)] w-[var(--size-s)] cursor-pointer items-center justify-center rounded-s text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",
1998
+ children: /* @__PURE__ */ t(
1999
+ W,
2000
+ {
2001
+ name: de ? "chevron-down" : "chevron-right",
2002
+ className: "h-3 w-3"
2003
+ }
2004
+ )
2005
+ }
2006
+ ),
2007
+ U && Ee && !Mt && /* @__PURE__ */ b("div", { className: "flex items-center gap-1", children: [
2008
+ d.getIsPinned() !== "top" && /* @__PURE__ */ t(
2009
+ "button",
2010
+ {
2011
+ tabIndex: -1,
2012
+ onClick: () => d.pin("top"),
2013
+ className: "opacity-0 group-hover:opacity-100 flex h-[var(--size-s)] w-[var(--size-s)] items-center justify-center rounded-s text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",
2014
+ title: "Pin to top",
2015
+ children: /* @__PURE__ */ t(W, { name: "arrow-up-to-line", className: "h-3 w-3" })
2016
+ }
2017
+ ),
2018
+ d.getIsPinned() !== "bottom" && /* @__PURE__ */ t(
2019
+ "button",
2020
+ {
2021
+ tabIndex: -1,
2022
+ onClick: () => d.pin("bottom"),
2023
+ className: "opacity-0 group-hover:opacity-100 flex h-[var(--size-s)] w-[var(--size-s)] items-center justify-center rounded-s text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",
2024
+ title: "Pin to bottom",
2025
+ children: /* @__PURE__ */ t(W, { name: "arrow-down-to-line", className: "h-3 w-3" })
2026
+ }
2027
+ ),
2028
+ d.getIsPinned() && /* @__PURE__ */ t(
2029
+ "button",
2030
+ {
2031
+ tabIndex: -1,
2032
+ onClick: () => d.pin(!1),
2033
+ className: "opacity-0 group-hover:opacity-100 flex h-[var(--size-s)] w-[var(--size-s)] items-center justify-center rounded-s text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",
2034
+ title: "Unpin row",
2035
+ children: /* @__PURE__ */ t(W, { name: "x", className: "h-3 w-3" })
2036
+ }
2037
+ )
2038
+ ] }),
2039
+ U && !_e && !Ee && (_ || z) && /* @__PURE__ */ t("div", { className: "h-[var(--size-s)] w-[var(--size-s)]" }),
2040
+ /* @__PURE__ */ t("div", { className: "flex-1 min-w-0", children: z && d.depth > 0 && (I.column.id === d.getParentRow()?.groupingColumnId || I.column.id === Xe) ? (
2041
+ // Hide grouped column and groupDisplayColumn in detail rows
2042
+ /* @__PURE__ */ t("div", {})
2043
+ ) : I.column.columnDef.meta?.truncate !== !1 ? (
2044
+ // Wrap in TruncatedCell for overflow handling with tooltip
2045
+ /* @__PURE__ */ t(Te, { align: I.column.columnDef.meta?.align, children: Be(I) })
2046
+ ) : (
2047
+ // No truncation for this column
2048
+ Be(I)
2049
+ ) })
2050
+ ] })
2051
+ )
2052
+ },
2053
+ I.id
2054
+ );
2055
+ })
2056
+ }
2057
+ ),
2058
+ rt?.[d.id] && d.getIsExpanded() && /* @__PURE__ */ t(G, { showBorder: E.showRowBorder, children: /* @__PURE__ */ t(
2059
+ le,
2060
+ {
2061
+ colSpan: d.getVisibleCells().length,
2062
+ showBorder: E.showCellBorder,
2063
+ showRowBorder: E.showRowBorder,
2064
+ verticalAlign: Ie,
2065
+ className: "py-[var(--space-m)]",
2066
+ children: /* @__PURE__ */ b("div", { className: "flex items-center justify-center gap-[var(--space-s)]", children: [
2067
+ /* @__PURE__ */ t(qe, { size: "s" }),
2068
+ /* @__PURE__ */ t("span", { className: "text-body-sm text-[var(--color-text-secondary)]", children: "Loading..." })
2069
+ ] })
2070
+ }
2071
+ ) }),
2072
+ J && d.getIsExpanded() && d.depth === 0 && /* @__PURE__ */ t(G, { showBorder: E.showRowBorder, children: /* @__PURE__ */ t(
2073
+ le,
2074
+ {
2075
+ colSpan: d.getVisibleCells().length,
2076
+ showBorder: E.showCellBorder,
2077
+ showRowBorder: E.showRowBorder,
2078
+ verticalAlign: Ie,
2079
+ className: "p-0",
2080
+ "data-section-header": !0,
2081
+ children: Yt?.[d.id] ? /* @__PURE__ */ b("div", { className: "flex flex-col items-center justify-center py-[var(--space-l)] gap-[var(--space-s)]", children: [
2082
+ /* @__PURE__ */ b("div", { className: "flex items-center gap-[var(--space-s)] text-[var(--color-text-danger)]", children: [
2083
+ /* @__PURE__ */ t(W, { name: "alert-circle", className: "h-4 w-4" }),
2084
+ /* @__PURE__ */ t("span", { className: "text-body-sm", children: Yt[d.id]?.message || "Failed to load details" })
2085
+ ] }),
2086
+ De && /* @__PURE__ */ t(
2087
+ "button",
2088
+ {
2089
+ onClick: () => De(d),
2090
+ className: "text-body-sm text-[var(--color-text-brand)] hover:underline cursor-pointer",
2091
+ children: "Try again"
2092
+ }
2093
+ )
2094
+ ] }) : nt?.[d.id] ? /* @__PURE__ */ b("div", { className: "flex items-center justify-center py-[var(--space-l)]", children: [
2095
+ /* @__PURE__ */ t(qe, { size: "s" }),
2096
+ /* @__PURE__ */ t("span", { className: "ml-[var(--space-s)] text-body-sm text-[var(--color-text-secondary)]", children: "Loading details..." })
2097
+ ] }) : J(d)
2098
+ }
2099
+ ) }),
2100
+ (() => {
2101
+ if (J) return null;
2102
+ const I = d.subRows && d.subRows.length > 0 ? d.subRows : it?.get(d.id) || [];
2103
+ if (I.length === 0) return null;
2104
+ let j = d.getIsExpanded();
2105
+ return !j && Q === !0 && d.getCanExpand() && (j = !0), !j && typeof Q == "object" && Q !== null && Q[d.id] && (j = !0), j ? I.map(
2106
+ (ne, U) => $(ne, U, U === I.length - 1)
2107
+ ) : null;
2108
+ })()
2109
+ ] }, d.id);
2110
+ };
2111
+ return M.map(
2112
+ (d, k) => $(d, k, k === M.length - 1)
2113
+ );
2114
+ }
2115
+ const e = w.getCoreRowModel().rows, r = w.getRowModel().rows, n = e.filter((o) => o.getIsPinned() === "top"), u = e.filter((o) => o.getIsPinned() === "bottom"), g = r.filter((o) => !o.getIsPinned()), m = [
2116
+ ...n,
2117
+ ...g,
2118
+ ...u
2119
+ ], S = /* @__PURE__ */ new Set(), B = m.filter((o) => J || o.depth === 0), F = (o, M, $) => {
2120
+ if (S.has(o.id)) return null;
2121
+ S.add(o.id);
2122
+ const d = gr.get(o.id) ?? -1;
2123
+ return /* @__PURE__ */ b(l.Fragment, { children: [
2124
+ /* @__PURE__ */ t(
2125
+ G,
2126
+ {
2127
+ "data-state": o.getIsSelected() && "selected",
2128
+ showBorder: E.showRowBorder,
2129
+ "aria-rowindex": d + 2,
2130
+ className: V(
2131
+ "group",
2132
+ // Selected row styling
2133
+ o.getIsSelected() && "bg-[var(--blue-25)]",
2134
+ // Pinned row styling using existing CSS variables
2135
+ o.getIsPinned() === "top" && "!bg-[var(--color-background-neutral-selected)] !border-b-2 !border-[var(--color-border-primary-medium)]",
2136
+ o.getIsPinned() === "bottom" && "!bg-[var(--color-background-neutral-selected)] !border-t-2 !border-[var(--color-border-primary-medium)]",
2137
+ // Grouped row styling - blue-50 when expanded, neutral otherwise
2138
+ o.getIsGrouped?.() && o.getIsExpanded() && "bg-[var(--blue-50)] font-medium",
2139
+ o.getIsGrouped?.() && !o.getIsExpanded() && "bg-[var(--color-background-neutral-subtlest)] font-medium",
2140
+ // Second level (children of grouped rows) - blue-25
2141
+ z && o.depth === 1 && "bg-[var(--blue-25)]",
2142
+ // Bottom-up alternating colors for expanding rows (only when expanded)
2143
+ _ && !o.getIsGrouped?.() && (() => {
2144
+ const k = o.subRows && o.subRows.length > 0, H = () => {
2145
+ let j = o;
2146
+ for (; j; ) {
2147
+ if (j.getIsExpanded()) return !0;
2148
+ j = j.getParentRow?.();
2149
+ }
2150
+ return !1;
2151
+ };
2152
+ if (o.depth === 0 && (!k || !H()))
2153
+ return "";
2154
+ const q = lt - o.depth, I = q % 2 === 0 ? "bg-[var(--blue-25)]" : "bg-[var(--blue-50)]";
2155
+ if (O) {
2156
+ if (q === 0 && O.children)
2157
+ return `bg-[${O.children}]`;
2158
+ if (q > 0 && o.getIsExpanded() && O.expandedParent)
2159
+ return `bg-[${O.expandedParent}]`;
2160
+ if (q > 0 && !o.getIsExpanded() && O.collapsedParent)
2161
+ return `bg-[${O.collapsedParent}]`;
2162
+ }
2163
+ return I;
2164
+ })(),
2165
+ // Row click styling with smart hover
2166
+ K && Se(o) && (Gt || "cursor-pointer hover:[background-image:linear-gradient(rgba(0,0,0,0.02),rgba(0,0,0,0.02))]")
2167
+ ),
2168
+ onClick: K && Se(o) ? (k) => Dt(o, k) : void 0,
2169
+ role: "row",
2170
+ "aria-label": K && Se(o) ? `View details for row ${o.id}` : void 0,
2171
+ "aria-current": ze(o) ? "true" : void 0,
2172
+ children: o.getVisibleCells().map((k, H) => {
2173
+ const q = Ge(k.column, !1, E.showRowBorder), I = H === 0, j = _ && o.getCanExpand() || z && o.getIsGrouped(), ne = o.getIsExpanded(), U = o.depth, _e = z && o.getIsGrouped();
2174
+ let de = Ht?.(o);
2175
+ if (de == null)
2176
+ for (const pe of o.getVisibleCells()) {
2177
+ const ve = pe.column.columnDef.sectionHeaderCell;
2178
+ if (ve) {
2179
+ const Z = ve(pe.getContext());
2180
+ if (Z != null) {
2181
+ de = Z;
2182
+ break;
2183
+ }
2184
+ }
2185
+ }
2186
+ const ue = de != null;
2187
+ if (ue && !I)
2188
+ return null;
2189
+ const se = z && o.depth > 0 && H === 0 && !$;
2190
+ return /* @__PURE__ */ t(
2191
+ le,
2192
+ {
2193
+ role: "gridcell",
2194
+ "aria-colindex": H + 1,
2195
+ "data-row": d,
2196
+ "data-col": H,
2197
+ tabIndex: X[0] === d && X[1] === H ? 0 : -1,
2198
+ showBorder: E.showCellBorder,
2199
+ showRowBorder: E.showRowBorder,
2200
+ verticalAlign: k.column.columnDef.meta?.verticalAlign || Ie,
2201
+ colSpan: ue ? o.getVisibleCells().length : void 0,
2202
+ className: V(
2203
+ // Active row indicator on first cell
2204
+ I && ze(o) && (_t || ur(se ? !1 : E.showRowBorder)),
2205
+ // Focus ring for keyboard navigation
2206
+ "focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--color-border-brand-bold)]",
2207
+ // Sticky columns need higher z-index and explicit backgrounds
2208
+ Object.keys(q).length > 0 && [
2209
+ "z-10",
2210
+ // Match row backgrounds for sticky cells to prevent transparency
2211
+ // Grouped expanded rows
2212
+ o.getIsGrouped?.() && o.getIsExpanded() && "bg-[var(--blue-50)]",
2213
+ // Grouped collapsed rows
2214
+ o.getIsGrouped?.() && !o.getIsExpanded() && "bg-[var(--color-background-neutral-subtlest)]",
2215
+ // Second level rows (children of grouped rows)
2216
+ z && o.depth === 1 && "bg-[var(--blue-25)]",
2217
+ // Bottom-up alternating colors for expanding rows (only when expanded)
2218
+ _ && !o.getIsGrouped?.() && (() => {
2219
+ const pe = o.subRows && o.subRows.length > 0, ve = () => {
2220
+ let ae = o;
2221
+ for (; ae; ) {
2222
+ if (ae.getIsExpanded()) return !0;
2223
+ ae = ae.getParentRow?.();
2224
+ }
2225
+ return !1;
2226
+ };
2227
+ if (o.depth === 0 && (!pe || !ve()))
2228
+ return "";
2229
+ const Z = lt - o.depth, oe = Z % 2 === 0 ? "bg-[var(--blue-25)]" : "bg-[var(--blue-50)]";
2230
+ if (O) {
2231
+ if (Z === 0 && O.children)
2232
+ return `bg-[${O.children}]`;
2233
+ if (Z > 0 && o.getIsExpanded() && O.expandedParent)
2234
+ return `bg-[${O.expandedParent}]`;
2235
+ if (Z > 0 && !o.getIsExpanded() && O.collapsedParent)
2236
+ return `bg-[${O.collapsedParent}]`;
2237
+ }
2238
+ return oe;
2239
+ })(),
2240
+ // Default rows (not grouped, not expanding)
2241
+ !o.getIsGrouped?.() && !(z && o.depth === 1) && !_ && "bg-[var(--color-surface-primary)]"
2242
+ ],
2243
+ // Section header background
2244
+ ue && "bg-[var(--blue-50)]",
2245
+ // Remove bottom border from first column child rows (except last), but not when row is active
2246
+ se && !ze(o) && "![box-shadow:none]"
2247
+ ),
2248
+ style: {
2249
+ ...q,
2250
+ width: k.column.getSize(),
2251
+ // Section header: fixed height with no padding
2252
+ ...ue ? { height: "32px", padding: "0" } : {},
2253
+ // Add left padding for nested rows
2254
+ paddingLeft: I && U > 0 && !ue ? `calc(var(--space-m) + ${U * 20}px)` : void 0
2255
+ },
2256
+ children: ue ? (
2257
+ // Section header row - render custom content
2258
+ de
2259
+ ) : _e ? (
2260
+ // Grouped row rendering - only show content in first cell
2261
+ I ? Mr(o, w, Xe, ne, ye, Vt) : k.column.columnDef.meta?.renderInGroupedRows ? (
2262
+ // Render custom cell content for columns with renderInGroupedRows flag
2263
+ Be(k)
2264
+ ) : k.column.columnDef.aggregatedCell ? (
2265
+ // Render custom aggregatedCell if defined
2266
+ xr(k)
2267
+ ) : (
2268
+ // Calculate and show aggregation for other columns in grouped row
2269
+ (() => {
2270
+ const pe = zr(
2271
+ k.column,
2272
+ o.subRows,
2273
+ o.groupingColumnId
2274
+ );
2275
+ if (!pe) return /* @__PURE__ */ t("div", {});
2276
+ const ve = k.column.columnDef.meta?.align || "left";
2277
+ return /* @__PURE__ */ t(Te, { align: ve, children: /* @__PURE__ */ t("span", { className: V(
2278
+ "text-[var(--color-text-secondary)] text-body-sm",
2279
+ ve === "right" ? "tabular-nums" : ""
2280
+ ), children: pe }) });
2281
+ })()
2282
+ )
2283
+ ) : (
2284
+ // Regular row rendering
2285
+ /* @__PURE__ */ b("div", { className: "flex items-center gap-[var(--space-s)]", children: [
2286
+ I && j && /* @__PURE__ */ t(
2287
+ "button",
2288
+ {
2289
+ onClick: o.getToggleExpandedHandler(),
2290
+ className: "flex h-[var(--size-s)] w-[var(--size-s)] cursor-pointer items-center justify-center rounded-s text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",
2291
+ children: /* @__PURE__ */ t(
2292
+ W,
2293
+ {
2294
+ name: ne ? "chevron-down" : "chevron-right",
2295
+ className: "h-3 w-3"
2296
+ }
2297
+ )
2298
+ }
2299
+ ),
2300
+ I && Ee && !_e && /* @__PURE__ */ b("div", { className: "flex items-center gap-1", children: [
2301
+ o.getIsPinned() !== "top" && /* @__PURE__ */ t(
2302
+ "button",
2303
+ {
2304
+ onClick: () => o.pin("top"),
2305
+ className: "opacity-0 group-hover:opacity-100 flex h-[var(--size-s)] w-[var(--size-s)] items-center justify-center rounded-s text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",
2306
+ title: "Pin to top",
2307
+ children: /* @__PURE__ */ t(W, { name: "arrow-up-to-line", className: "h-3 w-3" })
2308
+ }
2309
+ ),
2310
+ o.getIsPinned() !== "bottom" && /* @__PURE__ */ t(
2311
+ "button",
2312
+ {
2313
+ onClick: () => o.pin("bottom"),
2314
+ className: "opacity-0 group-hover:opacity-100 flex h-[var(--size-s)] w-[var(--size-s)] items-center justify-center rounded-s text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",
2315
+ title: "Pin to bottom",
2316
+ children: /* @__PURE__ */ t(W, { name: "arrow-down-to-line", className: "h-3 w-3" })
2317
+ }
2318
+ ),
2319
+ o.getIsPinned() && /* @__PURE__ */ t(
2320
+ "button",
2321
+ {
2322
+ onClick: () => o.pin(!1),
2323
+ className: "opacity-0 group-hover:opacity-100 flex h-[var(--size-s)] w-[var(--size-s)] items-center justify-center rounded-s text-[var(--color-text-secondary)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:text-[var(--color-text-primary)]",
2324
+ title: "Unpin row",
2325
+ children: /* @__PURE__ */ t(W, { name: "x", className: "h-3 w-3" })
2326
+ }
2327
+ )
2328
+ ] }),
2329
+ I && !j && !Ee && (_ || z) && /* @__PURE__ */ t("div", { className: "h-[var(--size-s)] w-[var(--size-s)]" }),
2330
+ /* @__PURE__ */ t("div", { className: "flex-1 min-w-0", children: z && o.depth > 0 && (k.column.id === o.getParentRow()?.groupingColumnId || k.column.id === Xe) ? (
2331
+ // Hide grouped column and groupDisplayColumn in detail rows
2332
+ /* @__PURE__ */ t("div", {})
2333
+ ) : k.column.columnDef.meta?.truncate !== !1 ? (
2334
+ // Wrap in TruncatedCell for overflow handling with tooltip
2335
+ /* @__PURE__ */ t(Te, { align: k.column.columnDef.meta?.align, children: Be(k) })
2336
+ ) : (
2337
+ // No truncation for this column
2338
+ Be(k)
2339
+ ) })
2340
+ ] })
2341
+ )
2342
+ },
2343
+ k.id
2344
+ );
2345
+ })
2346
+ }
2347
+ ),
2348
+ rt?.[o.id] && o.getIsExpanded() && /* @__PURE__ */ t(G, { showBorder: E.showRowBorder, children: /* @__PURE__ */ t(
2349
+ le,
2350
+ {
2351
+ colSpan: o.getVisibleCells().length,
2352
+ showBorder: E.showCellBorder,
2353
+ showRowBorder: E.showRowBorder,
2354
+ verticalAlign: Ie,
2355
+ className: "py-[var(--space-m)]",
2356
+ children: /* @__PURE__ */ b("div", { className: "flex items-center justify-center gap-[var(--space-s)]", children: [
2357
+ /* @__PURE__ */ t(qe, { size: "s" }),
2358
+ /* @__PURE__ */ t("span", { className: "text-body-sm text-[var(--color-text-secondary)]", children: "Loading..." })
2359
+ ] })
2360
+ }
2361
+ ) }),
2362
+ J && o.getIsExpanded() && o.depth === 0 && /* @__PURE__ */ t(G, { showBorder: E.showRowBorder, children: /* @__PURE__ */ t(
2363
+ le,
2364
+ {
2365
+ colSpan: o.getVisibleCells().length,
2366
+ showBorder: E.showCellBorder,
2367
+ showRowBorder: E.showRowBorder,
2368
+ verticalAlign: Ie,
2369
+ className: "p-0",
2370
+ "data-section-header": !0,
2371
+ children: nt?.[o.id] ? /* @__PURE__ */ b("div", { className: "flex items-center justify-center py-[var(--space-l)]", children: [
2372
+ /* @__PURE__ */ t(qe, { size: "s" }),
2373
+ /* @__PURE__ */ t("span", { className: "ml-[var(--space-s)] text-body-sm text-[var(--color-text-secondary)]", children: "Loading details..." })
2374
+ ] }) : J(o)
2375
+ }
2376
+ ) }),
2377
+ (() => {
2378
+ if (J) return null;
2379
+ const k = o.subRows && o.subRows.length > 0 ? o.subRows : it?.get(o.id) || [];
2380
+ if (k.length === 0) return null;
2381
+ let H = o.getIsExpanded();
2382
+ return !H && Q === !0 && o.getCanExpand() && (H = !0), !H && typeof Q == "object" && Q !== null && Q[o.id] && (H = !0), H ? k.map(
2383
+ (q, I) => F(q, I, I === k.length - 1)
2384
+ ) : null;
2385
+ })()
2386
+ ] }, o.id);
2387
+ };
2388
+ return B.map(
2389
+ (o, M) => F(o, M, M === B.length - 1)
2390
+ );
2391
+ })()
2392
+ ) : (
2393
+ // Empty or no results state
2394
+ Zt.length > 0 || St !== "" ? /* @__PURE__ */ t(G, { showBorder: !1, className: "h-[300px]", children: /* @__PURE__ */ t(
2395
+ le,
2396
+ {
2397
+ colSpan: kt.length,
2398
+ className: "text-center",
2399
+ showBorder: !1,
2400
+ showRowBorder: !1,
2401
+ verticalAlign: "middle",
2402
+ children: yn || /* @__PURE__ */ t(
2403
+ qs,
2404
+ {
2405
+ title: Cn,
2406
+ description: wn,
2407
+ action: Sn
2408
+ }
2409
+ )
2410
+ }
2411
+ ) }) : /* @__PURE__ */ t(G, { showBorder: !1, className: "h-[300px]", children: /* @__PURE__ */ t(
2412
+ le,
2413
+ {
2414
+ colSpan: kt.length,
2415
+ className: "text-center",
2416
+ showBorder: !1,
2417
+ showRowBorder: !1,
2418
+ verticalAlign: "middle",
2419
+ children: pn || /* @__PURE__ */ t(
2420
+ _s,
2421
+ {
2422
+ title: vn,
2423
+ description: bn,
2424
+ action: xn
2425
+ }
2426
+ )
2427
+ }
2428
+ ) })
2429
+ )
2430
+ )
2431
+ ] })
2432
+ ]
2433
+ }
2434
+ )
2435
+ ]
2436
+ }
2437
+ ),
2438
+ vt && /* @__PURE__ */ t("div", { className: "bg-[var(--color-surface-primary)] px-[var(--space-l)] py-[var(--space-m)]", children: /* @__PURE__ */ t(
2439
+ Zs,
2440
+ {
2441
+ table: w,
2442
+ enableGrouping: z,
2443
+ hideChildrenForSingleItemGroups: ye,
2444
+ footerLabel: tn,
2445
+ onNextPageHover: dn,
2446
+ onPreviousPageHover: un,
2447
+ paginationVariant: Zr,
2448
+ pageSizeOptions: en
2449
+ }
2450
+ ) }),
2451
+ Ut && fn && /* @__PURE__ */ t(
2452
+ eo,
2453
+ {
2454
+ onLoadMore: () => Ut(re.pageIndex),
2455
+ isLoading: gn
2456
+ }
2457
+ )
2458
+ ] })
2459
+ }
2460
+ ) });
2461
+ }
2462
+ export {
2463
+ ko as DataTable,
2464
+ Do as DataTableColumnHeader,
2465
+ Qs as DataTableFilter,
2466
+ Zs as DataTablePagination,
2467
+ Br as DataTableSkeleton,
2468
+ Ks as DataTableToolbar,
2469
+ Rr as fuzzyFilter,
2470
+ Eo as groupPreservingGlobalFilter,
2471
+ Ls as multiSelectFilter,
2472
+ To as useReactTable
2473
+ };