@rafal.lemieszewski/tide-ui 0.83.0 → 0.84.2

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