@bigcapitalhq/blueprintjs-react-table 0.1.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +331 -7
  2. package/dist/blueprintjs-react-table.cjs +6 -0
  3. package/dist/blueprintjs-react-table.cjs.map +1 -0
  4. package/dist/blueprintjs-react-table.js +2681 -0
  5. package/dist/blueprintjs-react-table.js.map +1 -0
  6. package/dist/styles.css +1 -0
  7. package/dist/types/components/BP_Table.d.ts +130 -7
  8. package/dist/types/components/body/TableBody.d.ts +21 -3
  9. package/dist/types/components/body/TableBodyCell.d.ts +10 -5
  10. package/dist/types/components/body/TableGhostCells.d.ts +18 -4
  11. package/dist/types/components/body/TableRowExpander.d.ts +8 -0
  12. package/dist/types/components/body/TableRowHeaderCell.d.ts +10 -3
  13. package/dist/types/components/body/TableRowHeaders.d.ts +16 -1
  14. package/dist/types/components/body/TableRowSelectionCell.d.ts +19 -0
  15. package/dist/types/components/common/cell-selection.d.ts +57 -0
  16. package/dist/types/components/common/cellCoordinates.d.ts +25 -4
  17. package/dist/types/components/common/classes.d.ts +11 -0
  18. package/dist/types/components/common/dimensions.d.ts +5 -0
  19. package/dist/types/components/common/menu-context.d.ts +81 -0
  20. package/dist/types/components/common/pinning.d.ts +44 -0
  21. package/dist/types/components/common/region.d.ts +26 -0
  22. package/dist/types/components/common/table-selection-context.d.ts +3 -3
  23. package/dist/types/components/container/TableContainer.d.ts +12 -4
  24. package/dist/types/components/head/TableColumnHeaders.d.ts +4 -1
  25. package/dist/types/components/head/TableHead.d.ts +3 -1
  26. package/dist/types/components/head/TableRowSelectionHeaderCell.d.ts +13 -0
  27. package/dist/types/components/layers/TableRegionLayer.d.ts +10 -2
  28. package/dist/types/components/layers/TableReorderGuides.d.ts +10 -1
  29. package/dist/types/components/layers/TableResizeGuides.d.ts +18 -5
  30. package/dist/types/components/pagination/TablePaginationBar.d.ts +30 -0
  31. package/dist/types/components/pagination/constants.d.ts +4 -0
  32. package/dist/types/components/pagination/pagination-row-count-context.d.ts +2 -0
  33. package/dist/types/components/pagination/withPagination.d.ts +51 -0
  34. package/dist/types/components/quadrant/TableQuadrant.d.ts +42 -10
  35. package/dist/types/components/quadrant/TableQuadrantStack.d.ts +39 -0
  36. package/dist/types/components/quadrant/quadrant-type.d.ts +10 -0
  37. package/dist/types/hooks/use-bp-table-instance.d.ts +33 -0
  38. package/dist/types/hooks/use-cell-selection.d.ts +62 -0
  39. package/dist/types/hooks/use-column-header-height.d.ts +24 -0
  40. package/dist/types/hooks/use-column-reorder.d.ts +7 -3
  41. package/dist/types/hooks/use-freeze-pinning.d.ts +25 -0
  42. package/dist/types/hooks/use-row-resizing.d.ts +5 -1
  43. package/dist/types/hooks/use-row-virtualizer.d.ts +13 -2
  44. package/dist/types/hooks/use-uncontrolled.d.ts +20 -0
  45. package/dist/types/index.d.ts +8 -0
  46. package/dist/types/types.d.ts +33 -2
  47. package/package.json +2 -2
  48. package/dist/types/components/body/TableStaticBody.d.ts +0 -10
  49. package/dist/types/components/body/VirtualBody.d.ts +0 -12
  50. package/dist/types/components/quadrant/TableBottomContainer.d.ts +0 -14
  51. package/dist/types/components/quadrant/TableTopContainer.d.ts +0 -11
  52. package/dist/types/hooks/use-cell-focus-selection.d.ts +0 -34
@@ -0,0 +1,2681 @@
1
+ var Ye = Object.defineProperty;
2
+ var Xe = (t, e, n) => e in t ? Ye(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var Et = (t, e, n) => Xe(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { jsx as a, jsxs as W, Fragment as Nt } from "react/jsx-runtime";
5
+ import { useLayoutEffect as dt, useState as lt, useRef as Z, createContext as Gt, useCallback as P, useMemo as gt, useEffect as Lt, useContext as Wt, Fragment as zt } from "react";
6
+ import { tableFeatures as Pt, sortFns as Ke, rowSortingFeature as Qe, cellSelectionFeature as Ze, rowSelectionFeature as je, rowPinningFeature as qe, rowExpandingFeature as Je, columnPinningFeature as tn, columnVisibilityFeature as en, columnOrderingFeature as nn, columnResizingFeature as on, columnSizingFeature as ln, createSortedRowModel as sn, createExpandedRowModel as rn, useTable as cn, functionalUpdate as de, rowPaginationFeature as fe, createPaginatedRowModel as he } from "@tanstack/react-table";
7
+ import { useVirtualizer as an } from "@tanstack/react-virtual";
8
+ import { Classes as ft, Icon as me, ContextMenu as un, Checkbox as we, PopoverNext as dn, Menu as fn, MenuItem as Dt, HTMLSelect as hn, ButtonGroup as mn, Button as It } from "@blueprintjs/core";
9
+ import { DragHandleVerticalIcon as wn } from "@blueprintjs/icons";
10
+ var Ot = /* @__PURE__ */ ((t) => (t.CELLS = "cells", t.COLUMN_HEADERS = "column-header", t.ROW_HEADERS = "row-header", t))(Ot || {});
11
+ function $t(t, e) {
12
+ return t.indexOf(e) !== -1;
13
+ }
14
+ const Vt = Pt({
15
+ columnSizingFeature: ln,
16
+ columnResizingFeature: on,
17
+ columnOrderingFeature: nn,
18
+ columnVisibilityFeature: en,
19
+ columnPinningFeature: tn,
20
+ rowExpandingFeature: Je,
21
+ rowPinningFeature: qe,
22
+ rowSelectionFeature: je,
23
+ cellSelectionFeature: Ze,
24
+ rowSortingFeature: Qe,
25
+ expandedRowModel: rn(),
26
+ sortedRowModel: sn(),
27
+ sortFns: Ke
28
+ }), En = (t) => cn({
29
+ ...t,
30
+ initialState: t.initialState ?? {},
31
+ features: t.features ?? Vt,
32
+ columnResizeMode: t.columnResizeMode ?? "onEnd"
33
+ });
34
+ function gn({
35
+ table: t,
36
+ numFrozenColumns: e,
37
+ numFrozenRows: n
38
+ }) {
39
+ const l = t.getVisibleLeafColumns(), s = t.getRowModel().rows;
40
+ dt(() => {
41
+ var c;
42
+ if (t.setColumnPinning == null)
43
+ return;
44
+ const o = l.slice(0, Math.max(0, e)).map((i) => i.id), r = ((c = t.state.columnPinning) == null ? void 0 : c.start) ?? [];
45
+ Zt(r, o) || t.setColumnPinning((i) => ({ ...i, start: o }));
46
+ }, [e, t, l]), dt(() => {
47
+ var c;
48
+ if (t.setRowPinning == null)
49
+ return;
50
+ const o = s.slice(0, Math.max(0, n)).map((i) => i.id), r = ((c = t.state.rowPinning) == null ? void 0 : c.top) ?? [];
51
+ Zt(r, o) || t.setRowPinning((i) => ({ ...i, top: o }));
52
+ }, [n, s, t]);
53
+ }
54
+ function Zt(t, e) {
55
+ return t.length === e.length && t.every((n, l) => n === e[l]);
56
+ }
57
+ const Ee = 5;
58
+ function Ln({
59
+ table: t,
60
+ columnHeaderHeight: e,
61
+ frozenRowCount: n,
62
+ frozenRowsHeight: l,
63
+ getRowHeight: s,
64
+ scrollContainerRef: o,
65
+ enableRowVirtualization: r,
66
+ overscanRowCount: c
67
+ }) {
68
+ const i = Math.max(0, t.getRowModel().rows.length - n), u = an({
69
+ count: i,
70
+ getScrollElement: () => o.current,
71
+ estimateSize: (f) => s(n + f),
72
+ overscan: c,
73
+ /**
74
+ * The scrollable body sits below the column-header area and the frozen
75
+ * rows inside the shared scroll container; this offset aligns virtual item
76
+ * offsets with the absolute positioning used by body cells.
77
+ */
78
+ scrollMargin: e + l,
79
+ enabled: r
80
+ });
81
+ return dt(() => {
82
+ u.measure();
83
+ }, [n, s, u]), r ? u : void 0;
84
+ }
85
+ function jt({
86
+ value: t,
87
+ initialValue: e,
88
+ finalValue: n,
89
+ onChange: l
90
+ }) {
91
+ const [s, o] = lt(
92
+ e !== void 0 ? e : n
93
+ ), r = Z(s);
94
+ return [t !== void 0 ? t : s, (i) => {
95
+ const u = t !== void 0 ? t : r.current, f = typeof i == "function" ? i(u) : i;
96
+ t === void 0 && (r.current = f, o(() => f)), l == null || l(f);
97
+ }, t !== void 0];
98
+ }
99
+ const Tn = 20, Cn = 30, ge = 30, vn = 30, qt = 150, pn = 50, An = 200, Ft = Gt(void 0);
100
+ function Nn(t) {
101
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
102
+ }
103
+ var Le = { exports: {} };
104
+ /*!
105
+ Copyright (c) 2018 Jed Watson.
106
+ Licensed under the MIT License (MIT), see
107
+ http://jedwatson.github.io/classnames
108
+ */
109
+ (function(t) {
110
+ (function() {
111
+ var e = {}.hasOwnProperty;
112
+ function n() {
113
+ for (var o = "", r = 0; r < arguments.length; r++) {
114
+ var c = arguments[r];
115
+ c && (o = s(o, l(c)));
116
+ }
117
+ return o;
118
+ }
119
+ function l(o) {
120
+ if (typeof o == "string" || typeof o == "number")
121
+ return o;
122
+ if (typeof o != "object")
123
+ return "";
124
+ if (Array.isArray(o))
125
+ return n.apply(null, o);
126
+ if (o.toString !== Object.prototype.toString && !o.toString.toString().includes("[native code]"))
127
+ return o.toString();
128
+ var r = "";
129
+ for (var c in o)
130
+ e.call(o, c) && o[c] && (r = s(r, c));
131
+ return r;
132
+ }
133
+ function s(o, r) {
134
+ return r ? o ? o + " " + r : o + r : o;
135
+ }
136
+ t.exports ? (n.default = n, t.exports = n) : window.classNames = n;
137
+ })();
138
+ })(Le);
139
+ var _n = Le.exports;
140
+ const G = /* @__PURE__ */ Nn(_n), h = ft.getClassNamespace(), Sn = `${h}-table-body-cells`, Rn = `${h}-table-body-virtual-client`, Jt = `${h}-table-bottom-container`, Te = `${h}-table-cell`, In = `${h}-table-cell-client`, Mn = `${h}-table-cell-ghost`, Ce = `${h}-table-cell-ledger-even`, ve = `${h}-table-cell-ledger-odd`, On = `${h}-table-column-header-tr`, yn = `${h}-table-column-headers`, bt = `${h}-table-column-header-cell`, pe = `${h}-table-column-name`, Ae = `${h}-table-column-name-text`, xn = `${h}-table-container`, _t = `${h}-table-dragging`, Ne = `${h}-table-focus-region`, Bn = `${h}-table-has-reorder-handle`, Tt = `${h}-table-header`, Dn = `${h}-table-header-active`, _e = `${h}-table-header-content`, $n = `${h}-table-horizontal-guide`, kt = `${h}-table-last-in-column`, Se = `${h}-table-last-in-row`, Hn = `${h}-table-menu`, Un = `${h}-table-no-horizontal-scroll`, zn = `${h}-table-no-vertical-scroll`, Re = `${h}-table-no-wrap-text`, yt = `${h}-table-overlay`, Yt = `${h}-table-overlay-layer`, Fn = `${h}-table-pagination-bar`, te = `${h}-table-pagination-bar-controls`, Ht = `${h}-table-pagination-bar-text`, Gn = `${h}-table-pagination-layout`, Wn = `${h}-table-quadrant`, Pn = `${h}-table-quadrant-body-container`, Vn = `${h}-table-quadrant-left`, bn = `${h}-table-quadrant-main`, kn = `${h}-table-quadrant-scroll-container`, Yn = `${h}-table-quadrant-stack`, Xn = `${h}-table-quadrant-top`, Kn = `${h}-table-quadrant-top-left`, Qn = `${h}-table-region`, Zn = `${h}-table-reorder-handle`, jn = `${h}-table-reorder-handle-target`, Ie = `${h}-table-resize-guides`, Me = `${h}-table-resize-handle`, Oe = `${h}-table-resize-handle-target`, qn = `${h}-table-resize-horizontal`, Jn = `${h}-table-resize-vertical`, to = `${h}-table-row-headers`, ee = `${h}-table-row-headers-cells-container`, ye = `${h}-table-row-name`, xe = `${h}-table-row-name-text`, eo = `${h}-table-cell-with-expander`, no = `${h}-table-row-expander`, oo = `${h}-table-row-detail`, Xt = `${h}-table-row-selected`, Be = `${h}-table-row-selection-cell`, De = `${h}-table-row-selection-checkbox`, lo = `${h}-table-row-selection-header-cell`, so = `${h}-table-selection-enabled`, $e = `${h}-table-selection-region`, ro = `${h}-table-th-menu`, co = `${h}-table-th-menu-container`, io = `${h}-table-th-menu-container-background`, ao = `${h}-table-th-menu-open`, uo = `${h}-table-thead`, fo = `${h}-table-top-container`, He = `${h}-table-truncated-cell`, Ue = `${h}-table-truncated-text`, ze = `${h}-table-vertical-guide`;
141
+ function Fe(t, e) {
142
+ return typeof e == "number" ? `${t}${e}` : e.indexOf(t) === 0 ? e : `${t}${e}`;
143
+ }
144
+ function Kt(t) {
145
+ return Fe(`${h}-table-cell-col-`, t);
146
+ }
147
+ function vt(t) {
148
+ return Fe(`${h}-table-cell-row-`, t);
149
+ }
150
+ var ct = /* @__PURE__ */ ((t) => (t.CELLS = "cells", t.FULL_ROWS = "full-rows", t.FULL_COLUMNS = "full-columns", t.FULL_TABLE = "full-table", t))(ct || {}), Ge = /* @__PURE__ */ ((t) => (t.CELL = "cell", t))(Ge || {}), ho = /* @__PURE__ */ ((t) => (t.UP = "up", t.DOWN = "down", t.LEFT = "left", t.RIGHT = "right", t))(ho || {});
151
+ class A {
152
+ static getRegionCardinality(e) {
153
+ return e.cols != null && e.rows != null ? "cells" : e.cols != null ? "full-columns" : e.rows != null ? "full-rows" : "full-table";
154
+ }
155
+ static cell(e, n, l, s) {
156
+ return {
157
+ cols: A.normalizeInterval(n, s),
158
+ rows: A.normalizeInterval(e, l)
159
+ };
160
+ }
161
+ static row(e, n) {
162
+ return { rows: A.normalizeInterval(e, n) };
163
+ }
164
+ static column(e, n) {
165
+ return { cols: A.normalizeInterval(e, n) };
166
+ }
167
+ static table() {
168
+ return {};
169
+ }
170
+ static copy(e) {
171
+ const n = A.getRegionCardinality(e);
172
+ return n === "cells" ? A.cell(e.rows[0], e.cols[0], e.rows[1], e.cols[1]) : n === "full-columns" ? A.column(e.cols[0], e.cols[1]) : n === "full-rows" ? A.row(e.rows[0], e.rows[1]) : A.table();
173
+ }
174
+ static update(e, n, l) {
175
+ const s = e.slice();
176
+ return l != null ? s.splice(l, 1, n) : (s.pop(), s.push(n)), s;
177
+ }
178
+ static clampRegion(e, n, l) {
179
+ const s = A.copy(e);
180
+ return e.rows != null && (s.rows[0] = A.clamp(e.rows[0], 0, n), s.rows[1] = A.clamp(e.rows[1], 0, n)), e.cols != null && (s.cols[0] = A.clamp(e.cols[0], 0, l), s.cols[1] = A.clamp(e.cols[1], 0, l)), s;
181
+ }
182
+ static expandRegion(e, n) {
183
+ const l = A.getRegionCardinality(e), s = A.getRegionCardinality(n);
184
+ if (s !== l)
185
+ return n;
186
+ switch (s) {
187
+ case "full-rows":
188
+ return A.row(
189
+ Math.min(e.rows[0], n.rows[0]),
190
+ Math.max(e.rows[1], n.rows[1])
191
+ );
192
+ case "full-columns":
193
+ return A.column(
194
+ Math.min(e.cols[0], n.cols[0]),
195
+ Math.max(e.cols[1], n.cols[1])
196
+ );
197
+ case "cells":
198
+ return A.cell(
199
+ Math.min(e.rows[0], n.rows[0]),
200
+ Math.min(e.cols[0], n.cols[0]),
201
+ Math.max(e.rows[1], n.rows[1]),
202
+ Math.max(e.cols[1], n.cols[1])
203
+ );
204
+ default:
205
+ return A.table();
206
+ }
207
+ }
208
+ static getRegionFromFocusedRegion(e) {
209
+ return A.cell(e.row, e.col);
210
+ }
211
+ static getCellRegionFromRegion(e, n, l) {
212
+ switch (A.getRegionCardinality(e)) {
213
+ case "full-table":
214
+ return A.cell(0, 0, n - 1, l - 1);
215
+ case "full-columns":
216
+ return A.cell(0, e.cols[0], n - 1, e.cols[1]);
217
+ case "full-rows":
218
+ return A.cell(e.rows[0], 0, e.rows[1], l - 1);
219
+ default:
220
+ return A.cell(e.rows[0], e.cols[0], e.rows[1], e.cols[1]);
221
+ }
222
+ }
223
+ static getFocusCellCoordinatesFromRegion(e) {
224
+ switch (A.getRegionCardinality(e)) {
225
+ case "full-table":
226
+ return { col: 0, row: 0 };
227
+ case "full-columns":
228
+ return { col: e.cols[0], row: 0 };
229
+ case "full-rows":
230
+ return { col: 0, row: e.rows[0] };
231
+ default:
232
+ return { col: e.cols[0], row: e.rows[0] };
233
+ }
234
+ }
235
+ static regionsEqual(e, n) {
236
+ return A.intervalsEqual(e.rows, n.rows) && A.intervalsEqual(e.cols, n.cols);
237
+ }
238
+ /**
239
+ * Returns the index of the region that wholly contains the supplied
240
+ * region. Returns -1 if no such region is found.
241
+ */
242
+ static findContainingRegion(e, n) {
243
+ if (e == null)
244
+ return -1;
245
+ for (let l = 0; l < e.length; l++)
246
+ if (A.regionContains(e[l], n))
247
+ return l;
248
+ return -1;
249
+ }
250
+ /**
251
+ * Returns true if the regions fully contain the query region.
252
+ */
253
+ static containsRegion(e, n) {
254
+ return A.overlapsRegion(e, n, !1);
255
+ }
256
+ /**
257
+ * Returns true if the regions at least partially overlap the query region.
258
+ * When `allowPartialOverlap` is false (the default), every interval of the
259
+ * query region must be fully contained in the corresponding interval of a
260
+ * region.
261
+ */
262
+ static overlapsRegion(e, n, l = !1) {
263
+ const s = l ? A.intervalOverlaps : A.intervalContains;
264
+ if (e == null || n == null)
265
+ return !1;
266
+ for (const o of e)
267
+ switch (A.getRegionCardinality(o)) {
268
+ case "full-table":
269
+ return !0;
270
+ case "full-columns":
271
+ if (s(o.cols, n.cols))
272
+ return !0;
273
+ continue;
274
+ case "full-rows":
275
+ if (s(o.rows, n.rows))
276
+ return !0;
277
+ continue;
278
+ case "cells":
279
+ if (s(o.cols, n.cols) && s(o.rows, n.rows))
280
+ return !0;
281
+ continue;
282
+ }
283
+ return !1;
284
+ }
285
+ /**
286
+ * Using the supplied array of potentially non-contiguous `Region`s, returns
287
+ * an ordered array of every unique cell that exists in those regions. The
288
+ * cell coordinates are sorted by row and then column.
289
+ */
290
+ static enumerateUniqueCells(e, n, l) {
291
+ if (e == null || e.length === 0)
292
+ return [];
293
+ const s = /* @__PURE__ */ new Set(), o = [];
294
+ for (const r of e)
295
+ A.eachCellInRegion(r, n, l, (c, i) => {
296
+ const u = `${c}-${i}`;
297
+ s.has(u) || (s.add(u), o.push({ col: i, row: c }));
298
+ });
299
+ return o.sort((r, c) => r.row - c.row || r.col - c.col), o;
300
+ }
301
+ static joinStyledRegionGroups(e, n) {
302
+ const l = [];
303
+ return e != null && e.length > 0 && l.push({ className: $e, regions: e }), n != null && l.push({
304
+ className: Ne,
305
+ regions: [A.getRegionFromFocusedRegion(n)]
306
+ }), l;
307
+ }
308
+ static regionContains(e, n) {
309
+ return A.overlapsRegion([e], n, !1);
310
+ }
311
+ static intervalContains(e, n) {
312
+ return e == null || n == null ? !1 : e[0] <= n[0] && n[1] <= e[1];
313
+ }
314
+ static intervalOverlaps(e, n) {
315
+ return e == null || n == null ? !1 : e[0] <= n[1] && n[0] <= e[1];
316
+ }
317
+ static eachCellInRegion(e, n, l, s) {
318
+ switch (A.getRegionCardinality(e)) {
319
+ case "full-table":
320
+ for (let o = 0; o < n; o++)
321
+ for (let r = 0; r < l; r++)
322
+ s(o, r);
323
+ break;
324
+ case "full-columns":
325
+ for (let o = 0; o < n; o++)
326
+ for (let r = e.cols[0]; r <= e.cols[1]; r++)
327
+ s(o, r);
328
+ break;
329
+ case "full-rows":
330
+ for (let o = e.rows[0]; o <= e.rows[1]; o++)
331
+ for (let r = 0; r < l; r++)
332
+ s(o, r);
333
+ break;
334
+ case "cells":
335
+ for (let o = e.rows[0]; o <= e.rows[1]; o++)
336
+ for (let r = e.cols[0]; r <= e.cols[1]; r++)
337
+ s(o, r);
338
+ break;
339
+ }
340
+ }
341
+ static clamp(e, n, l) {
342
+ return Math.max(n, Math.min(l, e));
343
+ }
344
+ static intervalsEqual(e, n) {
345
+ return e == null ? n == null : n == null ? !1 : e[0] === n[0] && e[1] === n[1];
346
+ }
347
+ static normalizeInterval(e, n) {
348
+ return (n == null ? [e, e] : [e, n]).sort((s, o) => s - o);
349
+ }
350
+ }
351
+ function mo(t) {
352
+ switch (t) {
353
+ case "up":
354
+ return { rows: -1, cols: 0 };
355
+ case "down":
356
+ return { rows: 1, cols: 0 };
357
+ case "left":
358
+ return { rows: 0, cols: -1 };
359
+ case "right":
360
+ return { rows: 0, cols: 1 };
361
+ }
362
+ }
363
+ function dl(t, e) {
364
+ switch (e) {
365
+ case "up":
366
+ return { ...t, focusSelectionIndex: 0, row: t.row - 1 };
367
+ case "down":
368
+ return { ...t, focusSelectionIndex: 0, row: t.row + 1 };
369
+ case "left":
370
+ return { ...t, col: t.col - 1, focusSelectionIndex: 0 };
371
+ case "right":
372
+ return { ...t, col: t.col + 1, focusSelectionIndex: 0 };
373
+ }
374
+ }
375
+ function fl(t, e, n) {
376
+ if (A.getRegionCardinality(t) === "full-table")
377
+ return t;
378
+ const l = A.copy(t);
379
+ let s = 0, o = 0;
380
+ if (n != null) {
381
+ const c = l.rows != null && n.row === l.rows[0], i = l.rows != null && n.row === l.rows[1], u = l.cols != null && n.col === l.cols[0], f = l.cols != null && n.col === l.cols[1];
382
+ e === "up" ? s = c && !i ? 1 : 0 : e === "down" ? s = i && !c ? 0 : 1 : e === "left" ? o = u && !f ? 1 : 0 : o = f && !u ? 0 : 1;
383
+ } else
384
+ s = e === "down" ? 1 : 0, o = e === "right" ? 1 : 0;
385
+ const r = mo(e);
386
+ return l.rows != null && (l.rows[s] += r.rows), l.cols != null && (l.cols[o] += r.cols), l;
387
+ }
388
+ function We(t) {
389
+ return t.getStartVisibleLeafColumns().length;
390
+ }
391
+ function mt(t) {
392
+ return t.getTopRows().length;
393
+ }
394
+ function Ct(t) {
395
+ return t.getStartTotalSize();
396
+ }
397
+ function St(t, e) {
398
+ return e === "start" ? t.getStartVisibleLeafColumns() : t.getCenterVisibleLeafColumns();
399
+ }
400
+ function pt(t, e) {
401
+ return e === "start" ? t.getStartTotalSize() : t.getCenterTotalSize();
402
+ }
403
+ function wo(t, e, n) {
404
+ return e.getIsPinned() === "start" ? e.getStart("start") : Ct(t) + e.getStart("center") - n;
405
+ }
406
+ function xt(t, e) {
407
+ return e(mt(t));
408
+ }
409
+ function ne(t, e, n) {
410
+ if (n < 0)
411
+ return;
412
+ let l = 0;
413
+ const s = St(t, e);
414
+ let o = s.length - 1;
415
+ for (; l <= o; ) {
416
+ const r = l + o >> 1, c = s[r], i = c.getStart(e);
417
+ if (n < i) {
418
+ o = r - 1;
419
+ continue;
420
+ }
421
+ if (n >= i + c.getSize()) {
422
+ l = r + 1;
423
+ continue;
424
+ }
425
+ return c.getIndex();
426
+ }
427
+ }
428
+ function oe(t, e, n, l, s) {
429
+ const o = mt(t), r = t.getRowModel().rows.length, c = e === "top" ? 0 : o, i = e === "top" ? o : r;
430
+ if (n < 0 || c >= i)
431
+ return;
432
+ const u = l(c);
433
+ let f = c, d = i - 1;
434
+ for (; f <= d; ) {
435
+ const E = f + d >> 1, v = l(E) - u;
436
+ if (n < v) {
437
+ d = E - 1;
438
+ continue;
439
+ }
440
+ if (n >= v + s(E)) {
441
+ f = E + 1;
442
+ continue;
443
+ }
444
+ return E;
445
+ }
446
+ }
447
+ function Eo({
448
+ table: t,
449
+ scrollContainerRef: e,
450
+ rowHeaderWidth: n,
451
+ columnHeaderHeight: l,
452
+ getRowTop: s,
453
+ getRowHeight: o
454
+ }, r, c) {
455
+ const i = e.current;
456
+ if (i == null)
457
+ return;
458
+ const u = i.getBoundingClientRect(), f = r - u.left, d = c - u.top, E = Ct(t), v = xt(t, s), N = f - n, g = N - E + i.scrollLeft, L = d - l, T = L - v + i.scrollTop, C = N >= 0 && N < E ? ne(t, "start", N) : ne(t, "center", g), m = L >= 0 && L < v ? oe(t, "top", L, s, o) : oe(t, "center", T, s, o);
459
+ if (!(C == null || m == null))
460
+ return { col: C, row: m };
461
+ }
462
+ class go {
463
+ constructor({ table: e, target: n, selectedRegions: l, numRows: s, numCols: o }) {
464
+ Et(this, "target");
465
+ Et(this, "regions");
466
+ Et(this, "selectedRegions");
467
+ Et(this, "numRows");
468
+ Et(this, "numCols");
469
+ Et(this, "targetRow");
470
+ Et(this, "targetCell");
471
+ var r;
472
+ this.target = n, this.selectedRegions = l, this.numRows = s, this.numCols = o, this.regions = A.overlapsRegion(l, n) ? l : [n], this.targetRow = e.getRowModel().rows[n.rows[0]], this.targetCell = (r = this.targetRow) == null ? void 0 : r.getVisibleCells()[n.cols[0]];
473
+ }
474
+ getTarget() {
475
+ return this.target;
476
+ }
477
+ getRegions() {
478
+ return this.regions;
479
+ }
480
+ getSelectedRegions() {
481
+ return this.selectedRegions;
482
+ }
483
+ getUniqueCells() {
484
+ return A.enumerateUniqueCells(this.regions, this.numRows, this.numCols);
485
+ }
486
+ getTargetRow() {
487
+ return this.targetRow;
488
+ }
489
+ getTargetCell() {
490
+ return this.targetCell;
491
+ }
492
+ }
493
+ function Lo(t) {
494
+ var u, f;
495
+ const e = t.getVisibleLeafColumns(), n = t.state.columnPinning;
496
+ if (n == null || (((u = n.start) == null ? void 0 : u.length) ?? 0) + (((f = n.end) == null ? void 0 : f.length) ?? 0) === 0)
497
+ return e;
498
+ const l = new Map(e.map((d) => [d.id, d])), s = (n.start ?? []).map((d) => l.get(d)).filter((d) => d != null), o = (n.end ?? []).map((d) => l.get(d)).filter((d) => d != null), r = new Set(s.map((d) => d.id)), c = new Set(o.map((d) => d.id)), i = e.filter((d) => !r.has(d.id) && !c.has(d.id));
499
+ return [...s, ...i, ...o];
500
+ }
501
+ function To(t, e, n) {
502
+ if (t.length === 0)
503
+ return null;
504
+ const l = Math.max(0, Math.min(e, t.length - 1)), s = Math.max(0, Math.min(n, t.length - 1));
505
+ let o = Number.POSITIVE_INFINITY, r = Number.NEGATIVE_INFINITY;
506
+ for (let c = l; c <= s; c++) {
507
+ const i = t[c];
508
+ i < o && (o = i), i > r && (r = i);
509
+ }
510
+ return [o, r];
511
+ }
512
+ function Co(t, e, n) {
513
+ if (t.length === 0)
514
+ return null;
515
+ let l = 0, s = t.length - 1, o = -1;
516
+ for (; l <= s; ) {
517
+ const c = l + s >> 1;
518
+ t[c].getDisplayIndex() >= e ? (o = c, s = c - 1) : l = c + 1;
519
+ }
520
+ if (o < 0 || t[o].getDisplayIndex() > n)
521
+ return null;
522
+ l = o, s = t.length - 1;
523
+ let r = o;
524
+ for (; l <= s; ) {
525
+ const c = l + s >> 1;
526
+ t[c].getDisplayIndex() <= n ? (r = c, l = c + 1) : s = c - 1;
527
+ }
528
+ return [o, r];
529
+ }
530
+ function vo(t, e, n, l) {
531
+ const s = t[0] === 0 && t[1] === n - 1, o = e[0] === 0 && e[1] === l - 1;
532
+ return s && o ? A.table() : o ? A.row(t[0], t[1]) : s ? A.column(e[0], e[1]) : A.cell(t[0], e[0], t[1], e[1]);
533
+ }
534
+ function le(t) {
535
+ const e = t.getCellSelectionBounds();
536
+ if (e.length === 0)
537
+ return [];
538
+ const n = t.getRowModel().rows, s = Lo(t).map((r) => r.getIndex()), o = [];
539
+ for (const r of e) {
540
+ const c = Co(n, r.minRowIndex, r.maxRowIndex), i = To(
541
+ s,
542
+ r.minColumnIndex,
543
+ r.maxColumnIndex
544
+ );
545
+ c == null || i == null || o.push(
546
+ vo(
547
+ c,
548
+ i,
549
+ n.length,
550
+ s.length
551
+ )
552
+ );
553
+ }
554
+ return o;
555
+ }
556
+ function po(t, e) {
557
+ if (e == null || e.length === 0)
558
+ return [];
559
+ const n = t.getRowModel().rows, l = t.getVisibleLeafColumns();
560
+ if (n.length === 0 || l.length === 0)
561
+ return [];
562
+ const s = [];
563
+ for (const o of e) {
564
+ let r, c;
565
+ switch (A.getRegionCardinality(o)) {
566
+ case ct.FULL_TABLE:
567
+ r = [0, n.length - 1], c = [0, l.length - 1];
568
+ break;
569
+ case ct.FULL_COLUMNS:
570
+ r = [0, n.length - 1], c = o.cols;
571
+ break;
572
+ case ct.FULL_ROWS:
573
+ r = o.rows, c = [0, l.length - 1];
574
+ break;
575
+ default:
576
+ r = o.rows, c = o.cols;
577
+ break;
578
+ }
579
+ r[0] < 0 || r[1] >= n.length || c[0] < 0 || c[1] >= l.length || s.push({
580
+ anchorRowId: n[r[0]].id,
581
+ anchorColumnId: l[c[0]].id,
582
+ focusRowId: n[r[1]].id,
583
+ focusColumnId: l[c[1]].id
584
+ });
585
+ }
586
+ return s;
587
+ }
588
+ function se(t) {
589
+ const e = t.getFocusedCell();
590
+ if (e == null)
591
+ return;
592
+ const n = t.getRowModel().rows.indexOf(e.row);
593
+ if (!(n < 0))
594
+ return { row: n, col: e.column.getIndex() };
595
+ }
596
+ function Ao(t, e) {
597
+ const n = t.getRowModel().rows[e.row], l = t.getVisibleLeafColumns()[e.col];
598
+ if (!(n == null || l == null))
599
+ return n.getAllCellsByColumnId()[l.id];
600
+ }
601
+ function re(t) {
602
+ return JSON.stringify(
603
+ t.map((e) => ({
604
+ rows: e.rows ?? null,
605
+ cols: e.cols ?? null
606
+ }))
607
+ );
608
+ }
609
+ function No({
610
+ table: t,
611
+ getRowTop: e,
612
+ getRowHeight: n,
613
+ scrollContainerRef: l,
614
+ rowHeaderWidth: s,
615
+ columnHeaderHeight: o,
616
+ bodyContextMenuRenderer: r,
617
+ enableBodyContextMenu: c,
618
+ enableFocusedCell: i = !1,
619
+ onFocusedCell: u,
620
+ onFocusedRegion: f,
621
+ selectedRegions: d,
622
+ onSelection: E,
623
+ selectionModes: v
624
+ }) {
625
+ const N = d != null, g = c ?? r != null, L = Z(!1), T = Z(void 0), C = P(
626
+ (w) => v == null ? !0 : v.includes(w),
627
+ [v]
628
+ ), m = t.state.cellSelection, U = t.state.columnPinning, y = t.getRowModel().rows, z = t.getVisibleLeafColumns(), S = gt(
629
+ () => le(t),
630
+ // The translation helper reads reactive table state (selection, rows,
631
+ // columns, pinning) that the linter cannot see through the `table` prop.
632
+ // eslint-disable-next-line react-hooks/exhaustive-deps
633
+ [m, U, y, t, z]
634
+ ), R = gt(
635
+ () => i ? se(t) : void 0,
636
+ // Same as above: the helper reads the selection and row model from the table.
637
+ // eslint-disable-next-line react-hooks/exhaustive-deps
638
+ [m, i, y, t]
639
+ ), V = gt(() => {
640
+ const w = [];
641
+ return S.length > 0 && w.push({ className: $e, regions: S }), R != null && w.push({
642
+ className: Ne,
643
+ regions: [A.cell(R.row, R.col)]
644
+ }), w;
645
+ }, [R, S]);
646
+ Lt(() => {
647
+ if (!N)
648
+ return;
649
+ const w = re(d ?? []);
650
+ T.current !== w && (T.current = w, t.setCellSelection(po(t, d)));
651
+ }, [d, N, t]);
652
+ const j = Z(null), _ = Z(!1);
653
+ Lt(() => {
654
+ const w = re(S);
655
+ if (j.current !== w) {
656
+ if (j.current = w, !_.current) {
657
+ _.current = !0;
658
+ return;
659
+ }
660
+ N && T.current === w || E == null || E(S);
661
+ }
662
+ }, [N, E, S]);
663
+ const x = Z(null);
664
+ Lt(() => {
665
+ if (!i)
666
+ return;
667
+ const w = R != null ? `${R.row}-${R.col}` : null;
668
+ x.current !== w && (x.current = w, R != null && (u == null || u(R), f == null || f({
669
+ type: Ge.CELL,
670
+ row: R.row,
671
+ col: R.col,
672
+ focusSelectionIndex: 0
673
+ })));
674
+ }, [i, R, u, f]);
675
+ const H = P(() => {
676
+ var w;
677
+ i && ((w = l.current) == null || w.focus());
678
+ }, [i, l]), I = P(() => {
679
+ const w = se(t);
680
+ if (w == null)
681
+ return;
682
+ const p = l.current;
683
+ if (p == null)
684
+ return;
685
+ const $ = t.getVisibleLeafColumns()[w.col];
686
+ if ($ == null)
687
+ return;
688
+ const K = We(t), q = Ct(t), it = mt(t), nt = xt(t, e), tt = $.getStart(), at = tt + $.getSize(), ht = e(w.row), k = ht + n(w.row), Y = p.clientWidth - s - q, ot = p.clientHeight - o - nt;
689
+ let et = p.scrollLeft, rt = p.scrollTop;
690
+ if (w.col >= K) {
691
+ const ut = tt - q, wt = at - q;
692
+ ut < et ? et = Math.max(0, ut) : wt > et + Y && (et = wt - Y);
693
+ }
694
+ if (w.row >= it) {
695
+ const ut = ht - nt, wt = k - nt;
696
+ ut < rt ? rt = Math.max(0, ut) : wt > rt + ot && (rt = wt - ot);
697
+ }
698
+ et !== p.scrollLeft && (p.scrollLeft = et), rt !== p.scrollTop && (p.scrollTop = rt);
699
+ }, [
700
+ o,
701
+ n,
702
+ e,
703
+ s,
704
+ l,
705
+ t
706
+ ]);
707
+ Lt(() => {
708
+ L.current && (L.current = !1, I());
709
+ }, [m, I, t]);
710
+ const X = P(
711
+ (w) => {
712
+ const p = w.metaKey || w.ctrlKey, F = w.key;
713
+ let $;
714
+ if (F === "ArrowUp" ? $ = "up" : F === "ArrowDown" ? $ = "down" : F === "ArrowLeft" ? $ = "left" : F === "ArrowRight" && ($ = "right"), $ != null) {
715
+ w.preventDefault(), w.stopPropagation(), w.shiftKey ? t.extendCellSelection($) : i && (L.current = !0, t.moveCellSelection($));
716
+ return;
717
+ }
718
+ if (F === "Tab" && i) {
719
+ w.preventDefault(), w.stopPropagation(), L.current = !0, t.moveCellSelection(w.shiftKey ? "left" : "right");
720
+ return;
721
+ }
722
+ if (F === "Escape") {
723
+ w.preventDefault(), w.stopPropagation(), t.resetCellSelection(!0);
724
+ return;
725
+ }
726
+ p && F.toLowerCase() === "a" && (w.preventDefault(), w.stopPropagation(), t.selectAllCells());
727
+ },
728
+ [i, t]
729
+ ), M = P(
730
+ (w, p) => Eo(
731
+ { table: t, scrollContainerRef: l, rowHeaderWidth: s, columnHeaderHeight: o, getRowTop: e, getRowHeight: n },
732
+ w,
733
+ p
734
+ ),
735
+ [o, n, e, s, l, t]
736
+ ), O = P(
737
+ (w) => {
738
+ w.button === 0 && H();
739
+ },
740
+ [H]
741
+ ), B = P(
742
+ (w) => {
743
+ if (!g)
744
+ return;
745
+ const p = M(w.clientX, w.clientY);
746
+ if (p == null)
747
+ return;
748
+ const F = Ao(t, p);
749
+ F != null && (F.getIsSelected() || C(ct.CELLS) && t.setCellSelection([
750
+ {
751
+ anchorRowId: F.row.id,
752
+ anchorColumnId: F.column.id,
753
+ focusRowId: F.row.id,
754
+ focusColumnId: F.column.id
755
+ }
756
+ ]));
757
+ },
758
+ [M, g, C, t]
759
+ ), D = P(
760
+ (w) => {
761
+ if (!g || r == null)
762
+ return;
763
+ const p = M(w.clientX, w.clientY);
764
+ if (p == null)
765
+ return;
766
+ const F = new go({
767
+ table: t,
768
+ target: A.cell(p.row, p.col),
769
+ // Read the selection freshly: the right-click may have just moved it.
770
+ selectedRegions: le(t),
771
+ numRows: t.getRowModel().rows.length,
772
+ numCols: t.getVisibleLeafColumns().length
773
+ });
774
+ return r(F) ?? void 0;
775
+ },
776
+ [r, M, g, t]
777
+ ), b = P(
778
+ (w, p) => {
779
+ if (!C(ct.FULL_COLUMNS)) {
780
+ t.resetCellSelection(!0), H();
781
+ return;
782
+ }
783
+ p.preventDefault(), p.stopPropagation();
784
+ const F = t.getRowModel().rows, $ = t.getVisibleLeafColumns()[w];
785
+ $ == null || F.length === 0 || (p.shiftKey ? t.setCellSelection((K) => {
786
+ const q = K[K.length - 1];
787
+ return q == null ? [
788
+ {
789
+ anchorRowId: F[0].id,
790
+ anchorColumnId: $.id,
791
+ focusRowId: F[F.length - 1].id,
792
+ focusColumnId: $.id
793
+ }
794
+ ] : [...K.slice(0, -1), { ...q, focusColumnId: $.id }];
795
+ }) : t.setCellSelection([
796
+ {
797
+ anchorRowId: F[0].id,
798
+ anchorColumnId: $.id,
799
+ focusRowId: F[F.length - 1].id,
800
+ focusColumnId: $.id
801
+ }
802
+ ]), H());
803
+ },
804
+ [H, C, t]
805
+ ), J = P(
806
+ (w, p) => {
807
+ if (!C(ct.FULL_ROWS)) {
808
+ t.resetCellSelection(!0), H();
809
+ return;
810
+ }
811
+ p.preventDefault(), p.stopPropagation();
812
+ const F = t.getRowModel().rows, $ = t.getVisibleLeafColumns(), K = F[w];
813
+ K == null || $.length === 0 || (p.shiftKey ? t.setCellSelection((q) => {
814
+ const it = q[q.length - 1];
815
+ return it == null ? [
816
+ {
817
+ anchorRowId: K.id,
818
+ anchorColumnId: $[0].id,
819
+ focusRowId: K.id,
820
+ focusColumnId: $[$.length - 1].id
821
+ }
822
+ ] : [...q.slice(0, -1), { ...it, focusRowId: K.id }];
823
+ }) : t.setCellSelection([
824
+ {
825
+ anchorRowId: K.id,
826
+ anchorColumnId: $[0].id,
827
+ focusRowId: K.id,
828
+ focusColumnId: $[$.length - 1].id
829
+ }
830
+ ]), H());
831
+ },
832
+ [H, C, t]
833
+ ), st = P(
834
+ (w) => {
835
+ if (!C(ct.FULL_TABLE)) {
836
+ t.resetCellSelection(!0), H();
837
+ return;
838
+ }
839
+ w.preventDefault(), w.stopPropagation(), t.selectAllCells(), H();
840
+ },
841
+ [H, C, t]
842
+ );
843
+ return {
844
+ regionGroups: V,
845
+ handleBodyContextMenu: B,
846
+ handleBodyPointerDown: O,
847
+ handleColumnHeaderMouseDown: b,
848
+ handleKeyDown: X,
849
+ handleMenuMouseDown: st,
850
+ handleRowHeaderMouseDown: J,
851
+ isBodyContextMenuEnabled: g,
852
+ isSelectionModeEnabled: C,
853
+ renderBodyContextMenu: D
854
+ };
855
+ }
856
+ function _o({
857
+ minHeight: t,
858
+ headerRowCount: e
859
+ }) {
860
+ const n = Z(null), [l, s] = lt(null);
861
+ dt(() => {
862
+ const r = n.current;
863
+ if (r == null)
864
+ return;
865
+ const c = () => {
866
+ const u = r.getBoundingClientRect().height;
867
+ u > 0 && s((f) => f === u ? f : u);
868
+ };
869
+ c();
870
+ const i = new ResizeObserver(c);
871
+ return i.observe(r), () => i.disconnect();
872
+ }, []);
873
+ const o = Math.max(0, e) * ge;
874
+ return {
875
+ ref: n,
876
+ height: Math.max(t, o, l ?? 0)
877
+ };
878
+ }
879
+ function So({
880
+ enableGhostCells: t,
881
+ rowHeight: e,
882
+ rowHeaderWidth: n,
883
+ columnHeaderHeight: l,
884
+ totalWidth: s,
885
+ totalHeight: o,
886
+ scrollContainerRef: r
887
+ }) {
888
+ const [c, i] = lt(null);
889
+ if (dt(() => {
890
+ const v = r.current;
891
+ if (v == null)
892
+ return;
893
+ const N = () => {
894
+ i({ width: v.clientWidth, height: v.clientHeight });
895
+ };
896
+ N();
897
+ const g = new ResizeObserver(N);
898
+ return g.observe(v), () => g.disconnect();
899
+ }, [r]), !t || c == null)
900
+ return;
901
+ const u = c.width - n - s, f = c.height - l - o, d = u > 0 ? Math.min(Math.ceil(u / qt), pn) : 0, E = f > 0 ? Math.min(Math.ceil(f / e), An) : 0;
902
+ if (!(d === 0 && E === 0))
903
+ return {
904
+ columnCount: d,
905
+ rowCount: E,
906
+ columnWidth: qt,
907
+ rowHeight: e
908
+ };
909
+ }
910
+ function Pe(t, e) {
911
+ return e == null ? t : t + e.columnCount * e.columnWidth;
912
+ }
913
+ const Ro = 6, Io = 100;
914
+ function Mo({
915
+ rowHeight: t,
916
+ rowCount: e,
917
+ getDetailHeight: n,
918
+ rowHeights: l,
919
+ defaultRowHeights: s,
920
+ enableRowResizing: o = !1,
921
+ minRowHeight: r = Ro,
922
+ maxRowHeight: c = Io,
923
+ onRowHeightChanged: i
924
+ }) {
925
+ const u = l != null, [f, d] = lt(
926
+ s ?? []
927
+ ), [E, v] = lt(null), [N, g] = lt(null), L = Z(null), T = P(
928
+ (M) => u ? l[M] ?? t : f[M] ?? (s == null ? void 0 : s[M]) ?? t,
929
+ [s, f, u, t, l]
930
+ ), { rowTops: C, totalHeight: m } = gt(() => {
931
+ const M = new Array(e + 1);
932
+ let O = 0;
933
+ for (let B = 0; B < e; B++)
934
+ M[B] = O, O += T(B) + ((n == null ? void 0 : n(B)) ?? 0);
935
+ return M[e] = O, { rowTops: M, totalHeight: O };
936
+ }, [n, T, e]), U = P((M) => C[M] ?? 0, [C]), y = P((M) => C[M + 1] - C[M], [C]), z = Z(T);
937
+ z.current = T;
938
+ const S = Z(C);
939
+ S.current = C;
940
+ const R = Z(o);
941
+ R.current = o;
942
+ const V = Z(u);
943
+ V.current = u;
944
+ const j = Z(r);
945
+ j.current = r;
946
+ const _ = Z(c);
947
+ _.current = c;
948
+ const x = Z(i);
949
+ x.current = i;
950
+ const H = P((M) => {
951
+ var b, J;
952
+ const O = L.current;
953
+ if (O == null)
954
+ return;
955
+ const B = "touches" in M ? (b = M.touches[0]) == null ? void 0 : b.clientY : M.clientY;
956
+ if (B == null)
957
+ return;
958
+ const D = Math.min(
959
+ O.max,
960
+ Math.max(O.min, O.startHeight + (B - O.startY))
961
+ );
962
+ V.current || d((st) => {
963
+ const w = st.slice();
964
+ return w[O.index] = D, w;
965
+ }), (J = x.current) == null || J.call(x, O.index, D), g(O.rowTop + D);
966
+ }, []), I = P(() => {
967
+ L.current = null, v(null), g(null), window.removeEventListener("mousemove", H), window.removeEventListener("mouseup", I), window.removeEventListener("touchmove", H), window.removeEventListener("touchend", I), window.removeEventListener("touchcancel", I);
968
+ }, [H]), X = P((M, O) => {
969
+ var J;
970
+ if (!R.current)
971
+ return;
972
+ O.preventDefault(), O.stopPropagation();
973
+ const B = "touches" in O ? (J = O.touches[0]) == null ? void 0 : J.clientY : O.clientY;
974
+ if (B == null)
975
+ return;
976
+ const D = S.current[M] ?? 0, b = z.current(M);
977
+ L.current = {
978
+ index: M,
979
+ startY: B,
980
+ startHeight: b,
981
+ rowTop: D,
982
+ min: j.current,
983
+ max: _.current
984
+ }, v(M), g(D + b), window.addEventListener("mousemove", H), window.addEventListener("mouseup", I), window.addEventListener("touchmove", H), window.addEventListener("touchend", I), window.addEventListener("touchcancel", I);
985
+ }, [H, I]);
986
+ return Lt(() => () => {
987
+ window.removeEventListener("mousemove", H), window.removeEventListener("mouseup", I), window.removeEventListener("touchmove", H), window.removeEventListener("touchend", I), window.removeEventListener("touchcancel", I);
988
+ }, [H, I]), {
989
+ enabled: o,
990
+ getRowHeight: T,
991
+ getRowSpanHeight: y,
992
+ getRowTop: U,
993
+ totalHeight: m,
994
+ resizingRowIndex: E,
995
+ resizingGuideTop: N,
996
+ startRowResize: X
997
+ };
998
+ }
999
+ const Ve = Gt(null);
1000
+ function Rt() {
1001
+ return Wt(Ve);
1002
+ }
1003
+ const be = Gt(null);
1004
+ function Oo() {
1005
+ return Wt(be);
1006
+ }
1007
+ function yo(t, e) {
1008
+ return e < t ? e : t <= e && e < t + 1 ? t : Math.max(0, e - 1);
1009
+ }
1010
+ function xo(t, e, n, l, s) {
1011
+ const [o, r] = lt(null), [c, i] = lt(null), u = Z(null), f = P(
1012
+ (L) => {
1013
+ var z, S;
1014
+ const T = ((z = n.current) == null ? void 0 : z.getBoundingClientRect().left) ?? 0, C = ((S = l.current) == null ? void 0 : S.scrollLeft) ?? 0, m = Ct(t), U = L - T - s;
1015
+ if (U < m) {
1016
+ let R = 0;
1017
+ for (const V of St(t, "start"))
1018
+ if (V.getStart("start") + V.getSize() / 2 < U)
1019
+ R++;
1020
+ else
1021
+ break;
1022
+ return R;
1023
+ }
1024
+ let y = We(t);
1025
+ for (const R of St(t, "center"))
1026
+ if (m + R.getStart("center") - C + R.getSize() / 2 < U)
1027
+ y++;
1028
+ else
1029
+ break;
1030
+ return y;
1031
+ },
1032
+ [n, s, l, t]
1033
+ ), d = P(
1034
+ (L) => {
1035
+ var z;
1036
+ const T = u.current;
1037
+ if (u.current = null, r(null), i(null), T == null)
1038
+ return;
1039
+ const C = t.getVisibleLeafColumns(), m = (z = C[T.oldIndex]) == null ? void 0 : z.id;
1040
+ if (m == null)
1041
+ return;
1042
+ const U = yo(T.oldIndex, f(L)), y = C.map((S) => S.id).filter((S) => S !== m);
1043
+ y.splice(U, 0, m), t.setColumnOrder(y);
1044
+ },
1045
+ [f, t]
1046
+ ), E = P(
1047
+ (L) => {
1048
+ u.current != null && i(f(L.clientX));
1049
+ },
1050
+ [f]
1051
+ ), v = P(
1052
+ (L) => {
1053
+ d(L.clientX);
1054
+ },
1055
+ [d]
1056
+ ), N = P(
1057
+ (L, T) => {
1058
+ e && (T.preventDefault(), u.current = { oldIndex: L.getIndex() }, r(L.id), i(f(T.clientX)), window.addEventListener("pointermove", E), window.addEventListener("pointerup", v), window.addEventListener("pointercancel", v));
1059
+ },
1060
+ [e, f, E, v]
1061
+ );
1062
+ return Lt(() => () => {
1063
+ window.removeEventListener("pointermove", E), window.removeEventListener("pointerup", v), window.removeEventListener("pointercancel", v);
1064
+ }, [E, v]), { contextValue: gt(
1065
+ () => ({ enableColumnReordering: e, reorderingColumnId: o, startReorder: N }),
1066
+ [e, o, N]
1067
+ ), guideIndex: c, reorderingColumnId: o };
1068
+ }
1069
+ function Bo({
1070
+ table: t,
1071
+ reorderingColumnId: e,
1072
+ guideIndex: n,
1073
+ rowHeaderWidth: l,
1074
+ scrollLeft: s
1075
+ }) {
1076
+ if (e == null || n == null)
1077
+ return null;
1078
+ const o = t.getVisibleLeafColumns(), r = t.getStartVisibleLeafColumns().length, c = o[n], i = Ct(t);
1079
+ let u;
1080
+ return n <= r ? u = n < r && c != null ? c.getStart("start") : i : c != null ? u = i + c.getStart("center") - s : u = i + pt(t, "center") - s, /* @__PURE__ */ a("div", { className: G(Ie, Yt), children: /* @__PURE__ */ a(
1081
+ "div",
1082
+ {
1083
+ className: G(yt, ze),
1084
+ style: { left: l + u }
1085
+ }
1086
+ ) });
1087
+ }
1088
+ function Do({
1089
+ table: t,
1090
+ rowHeaderWidth: e,
1091
+ columnHeaderHeight: n,
1092
+ scrollLeft: l,
1093
+ scrollTop: s,
1094
+ frozenRowCount: o,
1095
+ resizingGuideTop: r = null,
1096
+ resizingRowIndex: c = null
1097
+ }) {
1098
+ const i = t.state.columnResizing, u = i == null ? void 0 : i.isResizingColumn, f = u != null && u !== !1 ? t.getColumn(u) : void 0, d = f != null ? e + wo(t, f, l) + f.getSize() + ((i == null ? void 0 : i.deltaOffset) ?? 0) : null, E = r != null && c != null ? n + r - (c < o ? 0 : s) : null;
1099
+ return d == null && E == null ? null : /* @__PURE__ */ W("div", { className: G(Ie, Yt), children: [
1100
+ d != null && /* @__PURE__ */ a(
1101
+ "div",
1102
+ {
1103
+ className: G(yt, ze),
1104
+ style: { left: d }
1105
+ }
1106
+ ),
1107
+ E != null && /* @__PURE__ */ a(
1108
+ "div",
1109
+ {
1110
+ className: G(yt, $n),
1111
+ style: { top: E }
1112
+ }
1113
+ )
1114
+ ] });
1115
+ }
1116
+ function $o({
1117
+ row: t,
1118
+ rowIndex: e,
1119
+ rowExpanderButtonProps: n,
1120
+ rowExpanderIconProps: l
1121
+ }) {
1122
+ const s = t.getIsExpanded(), o = typeof n == "function" ? n(t) : n, r = typeof l == "function" ? l(t) : l;
1123
+ return /* @__PURE__ */ a(
1124
+ "button",
1125
+ {
1126
+ type: "button",
1127
+ "aria-expanded": s,
1128
+ "aria-label": `${s ? "Collapse" : "Expand"} row ${e + 1}`,
1129
+ ...o,
1130
+ className: G(no, o == null ? void 0 : o.className),
1131
+ onMouseDown: (c) => {
1132
+ var i;
1133
+ c.stopPropagation(), (i = o == null ? void 0 : o.onMouseDown) == null || i.call(o, c);
1134
+ },
1135
+ onPointerDown: (c) => {
1136
+ var i;
1137
+ c.stopPropagation(), (i = o == null ? void 0 : o.onPointerDown) == null || i.call(o, c);
1138
+ },
1139
+ onKeyDown: (c) => {
1140
+ var i;
1141
+ c.stopPropagation(), (i = o == null ? void 0 : o.onKeyDown) == null || i.call(o, c);
1142
+ },
1143
+ onClick: (c) => {
1144
+ var i;
1145
+ (i = o == null ? void 0 : o.onClick) == null || i.call(o, c), c.defaultPrevented || t.toggleExpanded();
1146
+ },
1147
+ children: /* @__PURE__ */ a(me, { icon: s ? "caret-down" : "caret-right", size: 14, ...r })
1148
+ }
1149
+ );
1150
+ }
1151
+ function At({
1152
+ loading: t,
1153
+ variableLength: e = !1,
1154
+ children: n
1155
+ }) {
1156
+ if (t) {
1157
+ const l = e ? 75 - Math.floor(Math.random() * 11) * 5 : 100;
1158
+ return /* @__PURE__ */ a("div", { className: ft.SKELETON, style: { width: `${l}%` } });
1159
+ }
1160
+ return /* @__PURE__ */ a(Nt, { children: n });
1161
+ }
1162
+ function Ho({
1163
+ table: t,
1164
+ cell: e,
1165
+ cellProps: n,
1166
+ rowIndex: l,
1167
+ rowTop: s,
1168
+ columnRegion: o,
1169
+ rowHeight: r,
1170
+ loading: c,
1171
+ isExpansionCell: i,
1172
+ rowExpanderButtonProps: u,
1173
+ rowExpanderIconProps: f,
1174
+ isLastInRow: d,
1175
+ isLastInColumn: E
1176
+ }) {
1177
+ var U, y, z;
1178
+ const v = e.column.getSize(), N = e.column.getStart(o), g = i && ((y = (U = e.row).getCanExpand) == null ? void 0 : y.call(U)), L = (z = e.column.columnDef.meta) == null ? void 0 : z.bodyCellClassName, T = g && !c, C = i && e.row.depth > 0 ? { paddingInlineStart: e.row.depth * 16 } : void 0, m = /* @__PURE__ */ a(
1179
+ "div",
1180
+ {
1181
+ className: G(Ue, Re),
1182
+ style: T ? void 0 : C,
1183
+ children: /* @__PURE__ */ a(At, { loading: c, variableLength: !0, children: /* @__PURE__ */ a(t.FlexRender, { cell: e }) })
1184
+ }
1185
+ );
1186
+ return /* @__PURE__ */ a(
1187
+ "div",
1188
+ {
1189
+ ...n,
1190
+ className: G(
1191
+ Te,
1192
+ He,
1193
+ vt(l),
1194
+ Kt(e.column.getIndex()),
1195
+ l % 2 === 0 ? Ce : ve,
1196
+ {
1197
+ [Se]: d,
1198
+ [kt]: E,
1199
+ [ft.LOADING]: c,
1200
+ [Xt]: e.row.getIsSelected()
1201
+ },
1202
+ L,
1203
+ n == null ? void 0 : n.className
1204
+ ),
1205
+ style: {
1206
+ ...n == null ? void 0 : n.style,
1207
+ height: r,
1208
+ left: N,
1209
+ position: "absolute",
1210
+ top: s,
1211
+ width: v
1212
+ },
1213
+ onMouseDown: (S) => {
1214
+ var R;
1215
+ (R = n == null ? void 0 : n.onMouseDown) == null || R.call(n, S), !S.defaultPrevented && S.button === 0 && e.getSelectionStartHandler()(S);
1216
+ },
1217
+ onMouseEnter: (S) => {
1218
+ var R;
1219
+ (R = n == null ? void 0 : n.onMouseEnter) == null || R.call(n, S), S.defaultPrevented || e.getSelectionExtendHandler()(S);
1220
+ },
1221
+ children: T ? /* @__PURE__ */ W("div", { className: eo, style: C, children: [
1222
+ /* @__PURE__ */ a(
1223
+ $o,
1224
+ {
1225
+ row: e.row,
1226
+ rowIndex: l,
1227
+ rowExpanderButtonProps: u,
1228
+ rowExpanderIconProps: f
1229
+ }
1230
+ ),
1231
+ m
1232
+ ] }) : m
1233
+ }
1234
+ );
1235
+ }
1236
+ function Ut({
1237
+ columnIndex: t,
1238
+ rowIndex: e,
1239
+ left: n,
1240
+ top: l,
1241
+ width: s,
1242
+ height: o,
1243
+ loading: r
1244
+ }) {
1245
+ return /* @__PURE__ */ a(
1246
+ "div",
1247
+ {
1248
+ className: G(
1249
+ Te,
1250
+ Mn,
1251
+ He,
1252
+ vt(e),
1253
+ Kt(t),
1254
+ e % 2 === 0 ? Ce : ve,
1255
+ { [ft.LOADING]: r }
1256
+ ),
1257
+ style: { height: o, left: n, position: "absolute", top: l, width: s },
1258
+ children: /* @__PURE__ */ a("div", { className: G(Ue, Re), children: /* @__PURE__ */ a(At, { loading: r, variableLength: !0 }) })
1259
+ }
1260
+ );
1261
+ }
1262
+ function Uo({
1263
+ table: t,
1264
+ ghosts: e,
1265
+ loading: n,
1266
+ columnRegion: l,
1267
+ rowRegion: s,
1268
+ rowIndices: o,
1269
+ regionTop: r,
1270
+ regionHeight: c,
1271
+ getRowTop: i,
1272
+ getRowHeight: u
1273
+ }) {
1274
+ const f = t.getRowModel().rows, d = t.getVisibleLeafColumns().length, E = pt(t, l), v = St(t, l), N = l === "center", g = s === "center";
1275
+ return /* @__PURE__ */ W(Nt, { children: [
1276
+ N && o.map((L) => {
1277
+ var T;
1278
+ return /* @__PURE__ */ a(zt, { children: Array.from({ length: e.columnCount }).map((C, m) => /* @__PURE__ */ a(
1279
+ Ut,
1280
+ {
1281
+ columnIndex: d + m,
1282
+ rowIndex: L,
1283
+ left: E + m * e.columnWidth,
1284
+ top: i(L) - r,
1285
+ width: e.columnWidth,
1286
+ height: u(L),
1287
+ loading: n
1288
+ },
1289
+ `ghost-column-cell-${L}-${m}`
1290
+ )) }, `ghost-column-cells-${((T = f[L]) == null ? void 0 : T.id) ?? L}`);
1291
+ }),
1292
+ g && Array.from({ length: e.rowCount }).map((L, T) => {
1293
+ const C = f.length + T, m = c + T * e.rowHeight;
1294
+ return /* @__PURE__ */ W(zt, { children: [
1295
+ v.map((U) => /* @__PURE__ */ a(
1296
+ Ut,
1297
+ {
1298
+ columnIndex: U.getIndex(),
1299
+ rowIndex: C,
1300
+ left: U.getStart(l),
1301
+ top: m,
1302
+ width: U.getSize(),
1303
+ height: e.rowHeight,
1304
+ loading: n
1305
+ },
1306
+ `ghost-row-cell-${T}-${U.id}`
1307
+ )),
1308
+ N && Array.from({ length: e.columnCount }).map((U, y) => /* @__PURE__ */ a(
1309
+ Ut,
1310
+ {
1311
+ columnIndex: d + y,
1312
+ rowIndex: C,
1313
+ left: E + y * e.columnWidth,
1314
+ top: m,
1315
+ width: e.columnWidth,
1316
+ height: e.rowHeight,
1317
+ loading: n
1318
+ },
1319
+ `ghost-corner-cell-${T}-${y}`
1320
+ ))
1321
+ ] }, `ghost-row-cells-${T}`);
1322
+ })
1323
+ ] });
1324
+ }
1325
+ function ce(t, e, n) {
1326
+ let l = null, s = 0;
1327
+ for (const o of St(t, e)) {
1328
+ const r = o.getIndex();
1329
+ r < n[0] || r > n[1] || (l == null && (l = o.getStart(e)), s += o.getSize());
1330
+ }
1331
+ return l == null ? null : { offset: l, size: s };
1332
+ }
1333
+ function ie(t, e, n, l, s) {
1334
+ const o = mt(t), r = t.getRowModel().rows.length, c = Math.max(n[0], e === "top" ? 0 : o), i = Math.min(n[1], e === "top" ? o - 1 : r - 1);
1335
+ if (c > i)
1336
+ return null;
1337
+ const u = e === "center" ? zo(t, e, l) : 0;
1338
+ return {
1339
+ offset: l(c) - u,
1340
+ size: l(i) + s(i) - l(c)
1341
+ };
1342
+ }
1343
+ function zo(t, e, n) {
1344
+ return e === "center" ? n(mt(t)) : 0;
1345
+ }
1346
+ function Fo(t, e, n, l, s, o) {
1347
+ const r = A.getRegionCardinality(e), c = { offset: 0, size: pt(t, n) }, i = mt(t), u = t.getRowModel().rows.length, f = {
1348
+ offset: 0,
1349
+ size: (l === "top" ? i : u - i) === 0 ? 0 : s(l === "top" ? i - 1 : u - 1) + o(l === "top" ? i - 1 : u - 1) - s(l === "top" ? 0 : i)
1350
+ };
1351
+ let d, E;
1352
+ switch (r) {
1353
+ case ct.CELLS:
1354
+ d = ce(t, n, e.cols), E = ie(t, l, e.rows, s, o);
1355
+ break;
1356
+ case ct.FULL_COLUMNS:
1357
+ d = ce(t, n, e.cols), E = f;
1358
+ break;
1359
+ case ct.FULL_ROWS:
1360
+ d = c, E = ie(t, l, e.rows, s, o);
1361
+ break;
1362
+ default:
1363
+ d = c, E = f;
1364
+ break;
1365
+ }
1366
+ return d == null || E == null || d.size <= 0 || E.size <= 0 ? null : {
1367
+ height: E.size,
1368
+ left: d.offset,
1369
+ top: E.offset,
1370
+ width: d.size
1371
+ };
1372
+ }
1373
+ function Go({
1374
+ table: t,
1375
+ regionGroups: e,
1376
+ columnRegion: n,
1377
+ rowRegion: l,
1378
+ getRowTop: s,
1379
+ getRowHeight: o
1380
+ }) {
1381
+ return /* @__PURE__ */ a("div", { className: Yt, "aria-hidden": !0, children: e.map(
1382
+ (r, c) => r.regions.map((i, u) => {
1383
+ const f = Fo(
1384
+ t,
1385
+ i,
1386
+ n,
1387
+ l,
1388
+ s,
1389
+ o
1390
+ );
1391
+ return f == null ? null : /* @__PURE__ */ a(
1392
+ "div",
1393
+ {
1394
+ className: G(yt, Qn, r.className),
1395
+ style: f
1396
+ },
1397
+ `${c}-${u}`
1398
+ );
1399
+ })
1400
+ ) });
1401
+ }
1402
+ function Wo({
1403
+ table: t,
1404
+ renderRowDetail: e,
1405
+ getCellProps: n,
1406
+ rowExpanderButtonProps: l,
1407
+ rowExpanderIconProps: s,
1408
+ columnRegion: o,
1409
+ rowRegion: r,
1410
+ offsetTop: c = 0,
1411
+ offsetLeft: i = 0,
1412
+ areCellsLoading: u,
1413
+ rowVirtualizer: f,
1414
+ rowResizing: d,
1415
+ ghosts: E,
1416
+ className: v,
1417
+ ...N
1418
+ }) {
1419
+ const g = Rt(), L = g != null && g.isBodyContextMenuEnabled, T = t.getRowModel().rows, C = mt(t), m = r === "top", U = m ? C : T.length - C, y = m ? 0 : d.getRowTop(C), z = m ? d.getRowTop(C) : d.totalHeight - d.getRowTop(C), S = pt(t, o), R = t.getStartVisibleLeafColumns().length > 0 ? "start" : "center", V = t.getCenterVisibleLeafColumns().length > 0 ? "center" : "start", _ = !m && f != null ? f.getVirtualItems() : void 0, x = _ != null ? _.map((I) => C + I.index) : Array.from(
1420
+ { length: U },
1421
+ (I, X) => m ? X : C + X
1422
+ ), H = m ? C - 1 : T.length - 1;
1423
+ return /* @__PURE__ */ a(
1424
+ "div",
1425
+ {
1426
+ ...N,
1427
+ className: G(Pn, v),
1428
+ style: { paddingLeft: i, paddingTop: c },
1429
+ children: /* @__PURE__ */ a("div", { children: /* @__PURE__ */ W(
1430
+ un,
1431
+ {
1432
+ className: G(Rn, In),
1433
+ style: { height: z, width: S },
1434
+ onPointerDown: g == null ? void 0 : g.handleBodyPointerDown,
1435
+ disabled: !L,
1436
+ onContextMenu: L ? g == null ? void 0 : g.handleBodyContextMenu : void 0,
1437
+ content: ({ mouseEvent: I }) => I == null || g == null ? void 0 : g.renderBodyContextMenu(I),
1438
+ children: [
1439
+ /* @__PURE__ */ W("div", { className: Sn, children: [
1440
+ x.map((I) => {
1441
+ const X = T[I];
1442
+ if (X == null)
1443
+ return null;
1444
+ const M = o === "start" ? X.getStartVisibleCells() : X.getCenterVisibleCells(), O = d.getRowTop(I) - y, B = d.getRowHeight(I), D = d.getRowSpanHeight(I) - B;
1445
+ return /* @__PURE__ */ W(zt, { children: [
1446
+ M.map((b, J) => /* @__PURE__ */ a(
1447
+ Ho,
1448
+ {
1449
+ table: t,
1450
+ cell: b,
1451
+ cellProps: n == null ? void 0 : n(b),
1452
+ rowExpanderButtonProps: l,
1453
+ rowExpanderIconProps: s,
1454
+ isExpansionCell: o === R && J === 0,
1455
+ rowIndex: I,
1456
+ rowTop: O,
1457
+ columnRegion: o,
1458
+ rowHeight: B,
1459
+ loading: u,
1460
+ isLastInRow: J === M.length - 1,
1461
+ isLastInColumn: I === H
1462
+ },
1463
+ b.id
1464
+ )),
1465
+ D > 0 && o === V && /* @__PURE__ */ a(
1466
+ "div",
1467
+ {
1468
+ className: oo,
1469
+ style: { top: O + B, height: D, width: S },
1470
+ onPointerDown: (b) => b.stopPropagation(),
1471
+ onKeyDown: (b) => b.stopPropagation(),
1472
+ onContextMenu: (b) => b.stopPropagation(),
1473
+ children: e == null ? void 0 : e(X)
1474
+ }
1475
+ )
1476
+ ] }, X.id);
1477
+ }),
1478
+ E != null && /* @__PURE__ */ a(
1479
+ Uo,
1480
+ {
1481
+ table: t,
1482
+ ghosts: E,
1483
+ loading: u,
1484
+ columnRegion: o,
1485
+ rowRegion: r,
1486
+ rowIndices: x,
1487
+ regionTop: y,
1488
+ regionHeight: z,
1489
+ getRowTop: d.getRowTop,
1490
+ getRowHeight: d.getRowHeight
1491
+ }
1492
+ )
1493
+ ] }),
1494
+ g != null && g.regionGroups.length > 0 && /* @__PURE__ */ a(
1495
+ Go,
1496
+ {
1497
+ table: t,
1498
+ regionGroups: g.regionGroups,
1499
+ columnRegion: o,
1500
+ rowRegion: r,
1501
+ getRowTop: d.getRowTop,
1502
+ getRowHeight: d.getRowHeight
1503
+ }
1504
+ )
1505
+ ]
1506
+ }
1507
+ ) })
1508
+ }
1509
+ );
1510
+ }
1511
+ function Po({
1512
+ row: t,
1513
+ rowIndex: e,
1514
+ rowHeight: n,
1515
+ detailHeight: l,
1516
+ loading: s,
1517
+ isLastInColumn: o,
1518
+ isResizing: r = !1,
1519
+ onResizeStart: c,
1520
+ className: i,
1521
+ ...u
1522
+ }) {
1523
+ const f = Rt();
1524
+ return /* @__PURE__ */ W(
1525
+ "div",
1526
+ {
1527
+ ...u,
1528
+ className: G(Tt, vt(e), {
1529
+ [kt]: o,
1530
+ [ft.LOADING]: s,
1531
+ [Xt]: (t == null ? void 0 : t.getIsSelected()) ?? !1
1532
+ }, i),
1533
+ style: { marginBottom: l, flexBasis: n, height: n, minHeight: 0 },
1534
+ onMouseDown: (d) => f == null ? void 0 : f.handleRowHeaderMouseDown(e, d),
1535
+ children: [
1536
+ /* @__PURE__ */ a("div", { className: ye, children: /* @__PURE__ */ a("div", { className: xe, children: /* @__PURE__ */ a(At, { loading: s, children: /* @__PURE__ */ a("span", { children: e + 1 }) }) }) }),
1537
+ !s && c != null && /* @__PURE__ */ a(
1538
+ "div",
1539
+ {
1540
+ className: G(Oe, qn, {
1541
+ [_t]: r
1542
+ }),
1543
+ onMouseDown: c,
1544
+ onTouchStart: c,
1545
+ children: /* @__PURE__ */ a("div", { className: G(Me, { [_t]: r }) })
1546
+ }
1547
+ )
1548
+ ]
1549
+ }
1550
+ );
1551
+ }
1552
+ function Vo({
1553
+ row: t,
1554
+ rowIndex: e,
1555
+ rowHeight: n,
1556
+ detailHeight: l,
1557
+ loading: s,
1558
+ isLastInColumn: o
1559
+ }) {
1560
+ const r = (t == null ? void 0 : t.getIsSelected()) ?? !1;
1561
+ return /* @__PURE__ */ a(
1562
+ "div",
1563
+ {
1564
+ className: G(Tt, Be, vt(e), {
1565
+ [kt]: o,
1566
+ [ft.LOADING]: s,
1567
+ [Xt]: r
1568
+ }),
1569
+ style: { marginBottom: l, height: n },
1570
+ children: !s && t != null && /* @__PURE__ */ a("div", { className: De, children: /* @__PURE__ */ a(
1571
+ we,
1572
+ {
1573
+ "aria-label": `Select row ${e + 1}`,
1574
+ checked: r,
1575
+ disabled: !t.getCanSelect(),
1576
+ onChange: (c) => t.getToggleSelectedHandler()(c)
1577
+ }
1578
+ ) })
1579
+ }
1580
+ );
1581
+ }
1582
+ function ae({
1583
+ table: t,
1584
+ rowRegion: e,
1585
+ rowHeaderWidth: n,
1586
+ enableRowHeader: l = !0,
1587
+ selectionColumnWidth: s = 0,
1588
+ areRowHeadersLoading: o,
1589
+ rowVirtualizer: r,
1590
+ rowResizing: c,
1591
+ ghosts: i,
1592
+ className: u,
1593
+ ...f
1594
+ }) {
1595
+ if (!l && s === 0)
1596
+ return null;
1597
+ const d = t.getRowModel().rows, E = l ? n : 0, v = mt(t), N = e === "top", g = N ? 0 : v, L = N ? v : d.length - v, T = N ? c.getRowTop(v) : c.totalHeight - c.getRowTop(v), m = !N && r != null ? r.getVirtualItems() : void 0, U = (r == null ? void 0 : r.options.scrollMargin) ?? 0, y = m != null && m.length > 0 ? m[0].start - U : 0, z = m != null && m.length > 0 ? T - (m[m.length - 1].end - U) : 0, S = m != null ? m.map((_) => v + _.index) : Array.from({ length: L }, (_, x) => g + x), R = N ? v - 1 : d.length - 1, V = {
1598
+ height: T,
1599
+ transform: "translateY(0px)",
1600
+ paddingTop: y,
1601
+ paddingBottom: z
1602
+ }, j = i != null && !N ? Array.from({ length: i.rowCount }, (_, x) => d.length + x) : [];
1603
+ return /* @__PURE__ */ a(
1604
+ "div",
1605
+ {
1606
+ ...f,
1607
+ className: G(to, u),
1608
+ style: { width: E + s },
1609
+ children: /* @__PURE__ */ W("div", { style: { display: "flex", height: T }, children: [
1610
+ l && /* @__PURE__ */ a("div", { style: { flex: "0 0 auto", width: n }, children: /* @__PURE__ */ W("div", { className: ee, style: V, children: [
1611
+ S.map((_) => {
1612
+ var x;
1613
+ return /* @__PURE__ */ a(
1614
+ Po,
1615
+ {
1616
+ row: d[_],
1617
+ rowIndex: _,
1618
+ rowHeight: c.getRowHeight(_),
1619
+ detailHeight: c.getRowSpanHeight(_) - c.getRowHeight(_),
1620
+ loading: o,
1621
+ isLastInColumn: _ === R,
1622
+ isResizing: c.resizingRowIndex === _,
1623
+ onResizeStart: c.enabled ? (H) => c.startRowResize(_, H) : void 0
1624
+ },
1625
+ ((x = d[_]) == null ? void 0 : x.id) ?? _
1626
+ );
1627
+ }),
1628
+ j.map((_, x) => /* @__PURE__ */ a(
1629
+ "div",
1630
+ {
1631
+ className: G(Tt, vt(_), {
1632
+ [ft.LOADING]: o
1633
+ }),
1634
+ style: { flexBasis: i == null ? void 0 : i.rowHeight, height: i == null ? void 0 : i.rowHeight, minHeight: 0 },
1635
+ children: /* @__PURE__ */ a("div", { className: ye, children: /* @__PURE__ */ a("div", { className: xe, children: /* @__PURE__ */ a(At, { loading: o }) }) })
1636
+ },
1637
+ `ghost-row-header-${x}`
1638
+ ))
1639
+ ] }) }),
1640
+ s > 0 && /* @__PURE__ */ a("div", { style: { flex: "0 0 auto", width: s }, children: /* @__PURE__ */ W("div", { className: ee, style: V, children: [
1641
+ S.map((_) => {
1642
+ var x;
1643
+ return /* @__PURE__ */ a(
1644
+ Vo,
1645
+ {
1646
+ row: d[_],
1647
+ rowIndex: _,
1648
+ rowHeight: c.getRowHeight(_),
1649
+ detailHeight: c.getRowSpanHeight(_) - c.getRowHeight(_),
1650
+ loading: o,
1651
+ isLastInColumn: _ === R
1652
+ },
1653
+ ((x = d[_]) == null ? void 0 : x.id) ?? _
1654
+ );
1655
+ }),
1656
+ j.map((_, x) => /* @__PURE__ */ a(
1657
+ "div",
1658
+ {
1659
+ className: G(Tt, Be, vt(_), {
1660
+ [ft.LOADING]: o
1661
+ }),
1662
+ style: { height: i == null ? void 0 : i.rowHeight }
1663
+ },
1664
+ `ghost-row-selection-${x}`
1665
+ ))
1666
+ ] }) })
1667
+ ] })
1668
+ }
1669
+ );
1670
+ }
1671
+ function bo({
1672
+ header: t,
1673
+ isOpen: e,
1674
+ onOpenChange: n
1675
+ }) {
1676
+ const l = t.column.getIsSorted(), s = (r) => {
1677
+ t.column.toggleSorting(r), n(!1);
1678
+ }, o = () => {
1679
+ t.column.clearSorting(), n(!1);
1680
+ };
1681
+ return /* @__PURE__ */ W("div", { className: G(co, { [ao]: e }), children: [
1682
+ /* @__PURE__ */ a("div", { className: io }),
1683
+ /* @__PURE__ */ a(
1684
+ dn,
1685
+ {
1686
+ className: ro,
1687
+ content: /* @__PURE__ */ W(fn, { children: [
1688
+ /* @__PURE__ */ a(Dt, { icon: "sort-asc", text: "Sort Asc", onClick: () => s(!1) }),
1689
+ /* @__PURE__ */ a(Dt, { icon: "sort-desc", text: "Sort Desc", onClick: () => s(!0) }),
1690
+ l && /* @__PURE__ */ a(Dt, { icon: "sort", text: "Clear Sort", onClick: o })
1691
+ ] }),
1692
+ isOpen: e,
1693
+ onInteraction: n,
1694
+ placement: "bottom",
1695
+ rootBoundary: "viewport",
1696
+ children: /* @__PURE__ */ a(me, { icon: "chevron-down" })
1697
+ }
1698
+ )
1699
+ ] });
1700
+ }
1701
+ function ko({
1702
+ table: t,
1703
+ header: e,
1704
+ isLastInRow: n,
1705
+ enableSorting: l = !1,
1706
+ loading: s
1707
+ }) {
1708
+ var C;
1709
+ const o = e.getSize(), r = e.column.getIsResizing(), c = e.getResizeHandler(), i = typeof e.column.columnDef.header == "string" ? e.column.columnDef.header : void 0, u = Oo(), f = Rt(), d = (u == null ? void 0 : u.enableColumnReordering) ?? !1, E = (u == null ? void 0 : u.reorderingColumnId) === e.column.id, v = l && e.column.getCanSort(), N = (C = e.column.columnDef.meta) == null ? void 0 : C.headCellClassName, [g, L] = lt(!1), T = e.column.getIndex();
1710
+ return /* @__PURE__ */ W(
1711
+ "div",
1712
+ {
1713
+ className: G(
1714
+ Tt,
1715
+ Kt(T),
1716
+ bt,
1717
+ { [Se]: n },
1718
+ { [Bn]: d },
1719
+ { [Dn]: g },
1720
+ { [ft.LOADING]: s },
1721
+ N
1722
+ ),
1723
+ style: { flexBasis: o, minWidth: 0, width: o },
1724
+ onMouseDown: (m) => f == null ? void 0 : f.handleColumnHeaderMouseDown(T, m),
1725
+ children: [
1726
+ /* @__PURE__ */ W("div", { className: pe, title: i, children: [
1727
+ d && /* @__PURE__ */ a(
1728
+ "div",
1729
+ {
1730
+ className: G(jn, { [_t]: E }),
1731
+ onPointerDown: (m) => u == null ? void 0 : u.startReorder(e.column, m),
1732
+ children: /* @__PURE__ */ a("div", { className: Zn, children: /* @__PURE__ */ a(wn, { title: "Press down to drag" }) })
1733
+ }
1734
+ ),
1735
+ v && !s && /* @__PURE__ */ a(
1736
+ bo,
1737
+ {
1738
+ table: t,
1739
+ header: e,
1740
+ isOpen: g,
1741
+ onOpenChange: L
1742
+ }
1743
+ ),
1744
+ /* @__PURE__ */ a("div", { className: Ae, children: /* @__PURE__ */ a(At, { loading: s, variableLength: !0, children: /* @__PURE__ */ a(t.FlexRender, { header: e }) }) })
1745
+ ] }),
1746
+ /* @__PURE__ */ a("div", { className: _e }),
1747
+ !s && /* @__PURE__ */ a(
1748
+ "div",
1749
+ {
1750
+ className: G(Oe, Jn, {
1751
+ [_t]: r
1752
+ }),
1753
+ onMouseDown: c,
1754
+ onTouchStart: c,
1755
+ children: /* @__PURE__ */ a("div", { className: G(Me, { [_t]: r }) })
1756
+ }
1757
+ )
1758
+ ]
1759
+ }
1760
+ );
1761
+ }
1762
+ function Yo({
1763
+ table: t,
1764
+ headerGroup: e,
1765
+ columnRegion: n,
1766
+ enableSorting: l = !1,
1767
+ areColumnHeadersLoading: s,
1768
+ ghosts: o
1769
+ }) {
1770
+ var i;
1771
+ const r = (i = e.headers[e.headers.length - 1]) == null ? void 0 : i.id, c = Pe(pt(t, n), o);
1772
+ return /* @__PURE__ */ W(
1773
+ "div",
1774
+ {
1775
+ className: G(uo, On),
1776
+ style: { transform: "translateX(0px)", width: c },
1777
+ children: [
1778
+ e.headers.map((u) => /* @__PURE__ */ a(
1779
+ ko,
1780
+ {
1781
+ table: t,
1782
+ header: u,
1783
+ isLastInRow: u.id === r,
1784
+ enableSorting: l,
1785
+ loading: s
1786
+ },
1787
+ u.id
1788
+ )),
1789
+ o != null && Array.from({ length: o.columnCount }).map((u, f) => /* @__PURE__ */ W(
1790
+ "div",
1791
+ {
1792
+ className: G(Tt, bt, {
1793
+ [ft.LOADING]: s
1794
+ }),
1795
+ style: { flexBasis: o.columnWidth, minWidth: 0, width: o.columnWidth },
1796
+ children: [
1797
+ /* @__PURE__ */ a("div", { className: pe, children: /* @__PURE__ */ a("div", { className: Ae, children: /* @__PURE__ */ a(At, { loading: s, variableLength: !0 }) }) }),
1798
+ /* @__PURE__ */ a("div", { className: _e })
1799
+ ]
1800
+ },
1801
+ `ghost-column-header-${f}`
1802
+ ))
1803
+ ]
1804
+ }
1805
+ );
1806
+ }
1807
+ function Xo({
1808
+ table: t,
1809
+ columnRegion: e,
1810
+ enableSorting: n = !1,
1811
+ areColumnHeadersLoading: l,
1812
+ ghosts: s,
1813
+ className: o,
1814
+ ...r
1815
+ }) {
1816
+ const c = e === "start" ? t.getStartHeaderGroups() : t.getCenterHeaderGroups(), i = e === "center" ? s : void 0, u = Pe(pt(t, e), i);
1817
+ return /* @__PURE__ */ a("div", { ...r, className: G(yn, o), children: /* @__PURE__ */ a("div", { style: { width: u }, children: c.map((f) => /* @__PURE__ */ a(
1818
+ Yo,
1819
+ {
1820
+ table: t,
1821
+ headerGroup: f,
1822
+ columnRegion: e,
1823
+ enableSorting: n,
1824
+ areColumnHeadersLoading: l,
1825
+ ghosts: i
1826
+ },
1827
+ f.id
1828
+ )) }) });
1829
+ }
1830
+ function Ko({
1831
+ width: t,
1832
+ height: e,
1833
+ className: n,
1834
+ ...l
1835
+ }) {
1836
+ const s = Rt();
1837
+ return /* @__PURE__ */ a(
1838
+ "div",
1839
+ {
1840
+ ...l,
1841
+ className: G(Hn, n),
1842
+ style: { width: t, height: e },
1843
+ onMouseDown: s == null ? void 0 : s.handleMenuMouseDown
1844
+ }
1845
+ );
1846
+ }
1847
+ function Qo({
1848
+ table: t,
1849
+ width: e,
1850
+ height: n,
1851
+ loading: l = !1
1852
+ }) {
1853
+ const s = t.getIsAllRowsSelected(), o = t.getIsSomeRowsSelected();
1854
+ return /* @__PURE__ */ a(
1855
+ "div",
1856
+ {
1857
+ className: G(
1858
+ Tt,
1859
+ bt,
1860
+ lo
1861
+ ),
1862
+ style: { flex: "0 0 auto", height: n, width: e },
1863
+ children: !l && /* @__PURE__ */ a("div", { className: De, children: /* @__PURE__ */ a(
1864
+ we,
1865
+ {
1866
+ "aria-label": "Select all rows",
1867
+ checked: s,
1868
+ indeterminate: !s && o,
1869
+ onChange: (r) => t.getToggleAllRowsSelectedHandler()(r)
1870
+ }
1871
+ ) })
1872
+ }
1873
+ );
1874
+ }
1875
+ var Q = /* @__PURE__ */ ((t) => (t.MAIN = "main", t.TOP = "top", t.LEFT = "left", t.TOP_LEFT = "top-left", t))(Q || {});
1876
+ function Zo(t) {
1877
+ switch (t) {
1878
+ case Q.MAIN:
1879
+ return bn;
1880
+ case Q.TOP:
1881
+ return Xn;
1882
+ case Q.LEFT:
1883
+ return Vn;
1884
+ case Q.TOP_LEFT:
1885
+ return Kn;
1886
+ default:
1887
+ return;
1888
+ }
1889
+ }
1890
+ function Mt({
1891
+ quadrantType: t,
1892
+ table: e,
1893
+ renderRowDetail: n,
1894
+ getCellProps: l,
1895
+ rowExpanderButtonProps: s,
1896
+ rowExpanderIconProps: o,
1897
+ rowHeaderWidth: r,
1898
+ enableRowHeader: c = !0,
1899
+ columnHeaderHeight: i,
1900
+ columnHeaderMeasureRef: u,
1901
+ enableSorting: f = !1,
1902
+ areCellsLoading: d,
1903
+ areColumnHeadersLoading: E,
1904
+ areRowHeadersLoading: v,
1905
+ rowResizing: N,
1906
+ rowVirtualizer: g,
1907
+ ghosts: L,
1908
+ scrollContainerRef: T,
1909
+ onScroll: C,
1910
+ onWheel: m,
1911
+ style: U,
1912
+ selectionColumnWidth: y = 0
1913
+ }) {
1914
+ const z = t === Q.MAIN, S = t === Q.TOP || t === Q.TOP_LEFT, V = t === Q.LEFT || t === Q.TOP_LEFT ? "start" : "center", j = S ? "top" : "center", _ = t === Q.TOP || t === Q.TOP_LEFT, x = t === Q.TOP_LEFT, H = Rt(), I = Ct(e), X = xt(e, N.getRowTop), M = c ? r : 0, O = (b, J) => /* @__PURE__ */ a(
1915
+ Wo,
1916
+ {
1917
+ table: e,
1918
+ renderRowDetail: n,
1919
+ getCellProps: l,
1920
+ rowExpanderButtonProps: s,
1921
+ rowExpanderIconProps: o,
1922
+ columnRegion: V,
1923
+ rowRegion: j,
1924
+ offsetTop: b,
1925
+ offsetLeft: J,
1926
+ areCellsLoading: d,
1927
+ rowVirtualizer: g,
1928
+ rowResizing: N,
1929
+ ghosts: L
1930
+ }
1931
+ ), B = _ ? /* @__PURE__ */ W(
1932
+ "div",
1933
+ {
1934
+ ref: t === Q.TOP ? u : void 0,
1935
+ className: fo,
1936
+ style: V === "center" ? { paddingLeft: I } : void 0,
1937
+ children: [
1938
+ x && /* @__PURE__ */ W(Nt, { children: [
1939
+ c && /* @__PURE__ */ a(Ko, { width: r, height: i }),
1940
+ y > 0 && /* @__PURE__ */ a(
1941
+ Qo,
1942
+ {
1943
+ table: e,
1944
+ width: y,
1945
+ height: i,
1946
+ loading: v
1947
+ }
1948
+ )
1949
+ ] }),
1950
+ /* @__PURE__ */ a(
1951
+ Xo,
1952
+ {
1953
+ table: e,
1954
+ columnRegion: V,
1955
+ enableSorting: f,
1956
+ areColumnHeadersLoading: E,
1957
+ ghosts: L
1958
+ }
1959
+ )
1960
+ ]
1961
+ }
1962
+ ) : void 0;
1963
+ let D;
1964
+ switch (t) {
1965
+ case Q.MAIN:
1966
+ D = O(
1967
+ i + X,
1968
+ M + y + I
1969
+ );
1970
+ break;
1971
+ case Q.TOP:
1972
+ D = /* @__PURE__ */ W(Nt, { children: [
1973
+ B,
1974
+ O(0, I)
1975
+ ] });
1976
+ break;
1977
+ case Q.LEFT:
1978
+ D = // The frozen rows' band at the top is covered by the TOP_LEFT quadrant.
1979
+ /* @__PURE__ */ a("div", { style: { paddingTop: X }, children: /* @__PURE__ */ W(
1980
+ "div",
1981
+ {
1982
+ className: Jt,
1983
+ style: { width: M + y + I },
1984
+ children: [
1985
+ /* @__PURE__ */ a(
1986
+ ae,
1987
+ {
1988
+ table: e,
1989
+ rowRegion: "center",
1990
+ rowHeaderWidth: r,
1991
+ enableRowHeader: c,
1992
+ selectionColumnWidth: y,
1993
+ areRowHeadersLoading: v,
1994
+ rowVirtualizer: g,
1995
+ rowResizing: N,
1996
+ ghosts: L
1997
+ }
1998
+ ),
1999
+ O(0, 0)
2000
+ ]
2001
+ }
2002
+ ) });
2003
+ break;
2004
+ case Q.TOP_LEFT:
2005
+ D = /* @__PURE__ */ W(Nt, { children: [
2006
+ B,
2007
+ /* @__PURE__ */ W(
2008
+ "div",
2009
+ {
2010
+ className: Jt,
2011
+ style: { width: M + y + I },
2012
+ children: [
2013
+ /* @__PURE__ */ a(
2014
+ ae,
2015
+ {
2016
+ table: e,
2017
+ rowRegion: "top",
2018
+ rowHeaderWidth: r,
2019
+ enableRowHeader: c,
2020
+ selectionColumnWidth: y,
2021
+ areRowHeadersLoading: v,
2022
+ rowVirtualizer: g,
2023
+ rowResizing: N,
2024
+ ghosts: L
2025
+ }
2026
+ ),
2027
+ O(0, 0)
2028
+ ]
2029
+ }
2030
+ )
2031
+ ] });
2032
+ break;
2033
+ default:
2034
+ D = void 0;
2035
+ }
2036
+ return /* @__PURE__ */ a("div", { className: G(Wn, Zo(t)), style: U, children: /* @__PURE__ */ a(
2037
+ "div",
2038
+ {
2039
+ ref: T,
2040
+ className: kn,
2041
+ tabIndex: z && H != null ? 0 : void 0,
2042
+ onKeyDown: z ? H == null ? void 0 : H.handleKeyDown : void 0,
2043
+ onScroll: C,
2044
+ onWheel: m,
2045
+ children: D
2046
+ }
2047
+ ) });
2048
+ }
2049
+ function jo({
2050
+ table: t,
2051
+ renderRowDetail: e,
2052
+ getCellProps: n,
2053
+ rowExpanderButtonProps: l,
2054
+ rowExpanderIconProps: s,
2055
+ rowHeaderWidth: o,
2056
+ enableRowHeader: r = !0,
2057
+ columnHeaderHeight: c,
2058
+ columnHeaderMeasureRef: i,
2059
+ enableColumnReordering: u = !1,
2060
+ enableSorting: f = !1,
2061
+ areCellsLoading: d,
2062
+ areColumnHeadersLoading: E,
2063
+ areRowHeadersLoading: v,
2064
+ selection: N,
2065
+ rowResizing: g,
2066
+ ghosts: L,
2067
+ enableRowVirtualization: T,
2068
+ overscanRowCount: C,
2069
+ scrollContainerRef: m,
2070
+ selectionColumnWidth: U = 0
2071
+ }) {
2072
+ const y = Z(null), z = Z(null), S = Z(null), R = Z(null), V = Ct(t), j = mt(t), _ = xt(t, g.getRowTop), x = (r ? o : 0) + U, H = Ln({
2073
+ table: t,
2074
+ columnHeaderHeight: c,
2075
+ frozenRowCount: j,
2076
+ frozenRowsHeight: _,
2077
+ getRowHeight: g.getRowSpanHeight,
2078
+ scrollContainerRef: m,
2079
+ enableRowVirtualization: T ?? !1,
2080
+ overscanRowCount: C ?? Ee
2081
+ }), { contextValue: I, guideIndex: X, reorderingColumnId: M } = xo(
2082
+ t,
2083
+ u,
2084
+ y,
2085
+ m,
2086
+ x
2087
+ ), [O, B] = lt({ left: 0, top: 0 }), D = t.state.columnResizing, b = (D == null ? void 0 : D.isResizingColumn) != null && D.isResizingColumn !== !1, J = g.resizingGuideTop != null, st = M != null, w = Z(!1);
2088
+ w.current = b || J || st;
2089
+ const [p, F] = lt({ vertical: 0, horizontal: 0 }), $ = P(() => {
2090
+ const k = m.current;
2091
+ k != null && (z.current != null && (z.current.scrollLeft = k.scrollLeft), S.current != null && (S.current.scrollTop = k.scrollTop), R.current != null && (R.current.scrollLeft = 0, R.current.scrollTop = 0));
2092
+ }, [m]), K = P(() => {
2093
+ if ($(), w.current) {
2094
+ const k = m.current;
2095
+ k != null && B({ left: k.scrollLeft, top: k.scrollTop });
2096
+ }
2097
+ }, [m, $]), q = P(() => {
2098
+ const k = m.current;
2099
+ if (k == null)
2100
+ return;
2101
+ const Y = Math.max(0, k.offsetWidth - k.clientWidth), ot = Math.max(0, k.offsetHeight - k.clientHeight);
2102
+ F(
2103
+ (et) => et.vertical === Y && et.horizontal === ot ? et : { vertical: Y, horizontal: ot }
2104
+ );
2105
+ }, [m]), it = t.getTotalSize();
2106
+ dt(() => {
2107
+ const k = m.current;
2108
+ if (k == null)
2109
+ return;
2110
+ q();
2111
+ const Y = new ResizeObserver(q);
2112
+ return Y.observe(k), () => Y.disconnect();
2113
+ }, [q, m]), dt(() => {
2114
+ q();
2115
+ }, [
2116
+ c,
2117
+ V,
2118
+ _,
2119
+ q,
2120
+ g.totalHeight,
2121
+ it
2122
+ ]), dt(() => {
2123
+ $();
2124
+ }, [c, V, _, $]), dt(() => {
2125
+ if (!w.current)
2126
+ return;
2127
+ const k = m.current;
2128
+ if (k == null)
2129
+ return;
2130
+ const Y = k.scrollLeft, ot = k.scrollTop;
2131
+ (Y !== O.left || ot !== O.top) && B({ left: Y, top: ot });
2132
+ }, [
2133
+ b,
2134
+ st,
2135
+ J,
2136
+ m,
2137
+ O.left,
2138
+ O.top
2139
+ ]);
2140
+ const nt = P(
2141
+ (k) => {
2142
+ const Y = m.current;
2143
+ if (Y == null)
2144
+ return;
2145
+ const ot = Math.max(0, Y.scrollWidth - Y.clientWidth), et = Math.max(0, Y.scrollHeight - Y.clientHeight), rt = ue(Y.scrollLeft + k.deltaX, 0, ot), ut = ue(Y.scrollTop + k.deltaY, 0, et);
2146
+ rt !== Y.scrollLeft && (Y.scrollLeft = rt), ut !== Y.scrollTop && (Y.scrollTop = ut);
2147
+ },
2148
+ [m]
2149
+ ), tt = c + _, at = x + V, ht = {
2150
+ table: t,
2151
+ renderRowDetail: e,
2152
+ getCellProps: n,
2153
+ rowExpanderButtonProps: l,
2154
+ rowExpanderIconProps: s,
2155
+ rowHeaderWidth: o,
2156
+ enableRowHeader: r,
2157
+ selectionColumnWidth: U,
2158
+ columnHeaderHeight: c,
2159
+ enableSorting: f,
2160
+ areCellsLoading: d,
2161
+ areColumnHeadersLoading: E,
2162
+ areRowHeadersLoading: v,
2163
+ rowResizing: g,
2164
+ rowVirtualizer: H,
2165
+ ghosts: L
2166
+ };
2167
+ return /* @__PURE__ */ a("div", { ref: y, className: Yn, children: /* @__PURE__ */ a(be.Provider, { value: I, children: /* @__PURE__ */ W(Ve.Provider, { value: N, children: [
2168
+ /* @__PURE__ */ a(
2169
+ Mt,
2170
+ {
2171
+ ...ht,
2172
+ quadrantType: Q.MAIN,
2173
+ scrollContainerRef: m,
2174
+ onScroll: K
2175
+ }
2176
+ ),
2177
+ /* @__PURE__ */ a(
2178
+ Mt,
2179
+ {
2180
+ ...ht,
2181
+ quadrantType: Q.TOP,
2182
+ columnHeaderMeasureRef: i,
2183
+ scrollContainerRef: z,
2184
+ onWheel: nt,
2185
+ style: {
2186
+ height: tt,
2187
+ left: x,
2188
+ right: p.vertical
2189
+ }
2190
+ }
2191
+ ),
2192
+ /* @__PURE__ */ a(
2193
+ Mt,
2194
+ {
2195
+ ...ht,
2196
+ quadrantType: Q.LEFT,
2197
+ scrollContainerRef: S,
2198
+ onWheel: nt,
2199
+ style: {
2200
+ bottom: p.horizontal,
2201
+ top: c,
2202
+ width: at
2203
+ }
2204
+ }
2205
+ ),
2206
+ /* @__PURE__ */ a(
2207
+ Mt,
2208
+ {
2209
+ ...ht,
2210
+ quadrantType: Q.TOP_LEFT,
2211
+ scrollContainerRef: R,
2212
+ onWheel: nt,
2213
+ style: { height: tt, width: at }
2214
+ }
2215
+ ),
2216
+ /* @__PURE__ */ a(
2217
+ Do,
2218
+ {
2219
+ table: t,
2220
+ rowHeaderWidth: x,
2221
+ columnHeaderHeight: c,
2222
+ scrollLeft: O.left,
2223
+ scrollTop: O.top,
2224
+ frozenRowCount: j,
2225
+ resizingGuideTop: g.resizingGuideTop,
2226
+ resizingRowIndex: g.resizingRowIndex
2227
+ }
2228
+ ),
2229
+ /* @__PURE__ */ a(
2230
+ Bo,
2231
+ {
2232
+ table: t,
2233
+ reorderingColumnId: M,
2234
+ guideIndex: X,
2235
+ rowHeaderWidth: x,
2236
+ scrollLeft: O.left
2237
+ }
2238
+ )
2239
+ ] }) }) });
2240
+ }
2241
+ function ue(t, e, n) {
2242
+ return Math.max(e, Math.min(n, t));
2243
+ }
2244
+ function qo({
2245
+ table: t,
2246
+ renderRowDetail: e,
2247
+ getCellProps: n,
2248
+ rowExpanderButtonProps: l,
2249
+ rowExpanderIconProps: s,
2250
+ rowDetailHeight: o,
2251
+ rowHeight: r,
2252
+ rowHeaderWidth: c,
2253
+ enableRowHeader: i = !0,
2254
+ columnHeaderHeight: u,
2255
+ enableColumnReordering: f = !1,
2256
+ enableSorting: d = !1,
2257
+ areCellsLoading: E,
2258
+ areColumnHeadersLoading: v,
2259
+ areRowHeadersLoading: N,
2260
+ enableFocusedCell: g = !1,
2261
+ enableGhostCells: L = !1,
2262
+ bodyContextMenuRenderer: T,
2263
+ enableBodyContextMenu: C,
2264
+ onFocusedCell: m,
2265
+ onFocusedRegion: U,
2266
+ selectedRegions: y,
2267
+ onSelection: z,
2268
+ selectionModes: S,
2269
+ enableRowVirtualization: R,
2270
+ overscanRowCount: V,
2271
+ enableRowResizing: j = !1,
2272
+ rowHeights: _,
2273
+ defaultRowHeights: x,
2274
+ onRowHeightChanged: H,
2275
+ minRowHeight: I,
2276
+ maxRowHeight: X,
2277
+ selectionColumnWidth: M = 0,
2278
+ className: O,
2279
+ ...B
2280
+ }) {
2281
+ const D = Z(null), b = (i ? c : 0) + M, { ref: J, height: st } = _o({
2282
+ minHeight: u,
2283
+ headerRowCount: t.getHeaderGroups().length
2284
+ }), w = gt(() => {
2285
+ var it;
2286
+ if (!e || !t.options.getIsRowExpanded && !((it = t.getIsSomeRowsExpanded) != null && it.call(t)))
2287
+ return;
2288
+ const q = t.getRowModel().rows;
2289
+ return (nt) => {
2290
+ var at;
2291
+ const tt = q[nt];
2292
+ return (at = tt.getIsExpanded) != null && at.call(tt) && tt.getCanExpand() ? Math.max(0, o) : 0;
2293
+ };
2294
+ }, [e, o, t]), p = Mo({
2295
+ rowHeight: r,
2296
+ rowCount: t.getRowModel().rows.length,
2297
+ getDetailHeight: w,
2298
+ rowHeights: _,
2299
+ defaultRowHeights: x,
2300
+ enableRowResizing: j,
2301
+ minRowHeight: I,
2302
+ maxRowHeight: X,
2303
+ onRowHeightChanged: H
2304
+ }), F = No({
2305
+ table: t,
2306
+ getRowTop: p.getRowTop,
2307
+ getRowHeight: p.getRowHeight,
2308
+ scrollContainerRef: D,
2309
+ rowHeaderWidth: b,
2310
+ columnHeaderHeight: st,
2311
+ bodyContextMenuRenderer: T,
2312
+ enableBodyContextMenu: C,
2313
+ enableFocusedCell: g,
2314
+ onFocusedCell: m,
2315
+ onFocusedRegion: U,
2316
+ selectedRegions: y,
2317
+ onSelection: z,
2318
+ selectionModes: S
2319
+ }), $ = So({
2320
+ enableGhostCells: L,
2321
+ rowHeight: r,
2322
+ rowHeaderWidth: b,
2323
+ columnHeaderHeight: st,
2324
+ totalWidth: t.getTotalSize(),
2325
+ totalHeight: p.totalHeight,
2326
+ scrollContainerRef: D
2327
+ }), K = F.isSelectionModeEnabled(ct.CELLS) ? so : void 0;
2328
+ return /* @__PURE__ */ a(
2329
+ "div",
2330
+ {
2331
+ ...B,
2332
+ className: G(xn, K, {
2333
+ [Un]: $ != null && $.columnCount > 0,
2334
+ [zn]: $ != null && $.rowCount > 0
2335
+ }, O),
2336
+ children: /* @__PURE__ */ a(
2337
+ jo,
2338
+ {
2339
+ table: t,
2340
+ renderRowDetail: e,
2341
+ getCellProps: n,
2342
+ rowExpanderButtonProps: l,
2343
+ rowExpanderIconProps: s,
2344
+ rowHeaderWidth: c,
2345
+ enableRowHeader: i,
2346
+ columnHeaderHeight: st,
2347
+ columnHeaderMeasureRef: J,
2348
+ enableColumnReordering: f,
2349
+ enableSorting: d,
2350
+ areCellsLoading: E,
2351
+ areColumnHeadersLoading: v,
2352
+ areRowHeadersLoading: N,
2353
+ selection: F,
2354
+ rowResizing: p,
2355
+ ghosts: $,
2356
+ enableRowVirtualization: R,
2357
+ overscanRowCount: V,
2358
+ scrollContainerRef: D,
2359
+ selectionColumnWidth: M
2360
+ }
2361
+ )
2362
+ }
2363
+ );
2364
+ }
2365
+ const Jo = () => !0;
2366
+ function hl({
2367
+ htmlProps: t,
2368
+ rowHeight: e = Tn,
2369
+ expandedRows: n,
2370
+ initialExpandedRows: l,
2371
+ onExpandedRowsChange: s,
2372
+ renderRowDetail: o,
2373
+ getCellProps: r,
2374
+ rowExpanderButtonProps: c,
2375
+ rowExpanderIconProps: i,
2376
+ rowDetailHeight: u = 100,
2377
+ showRowSelectionCheckboxes: f = !1,
2378
+ rowSelectionColumnWidth: d = vn,
2379
+ rowHeaderWidth: E = Cn,
2380
+ enableRowHeader: v = !0,
2381
+ columnHeaderHeight: N = ge,
2382
+ enableColumnReordering: g = !1,
2383
+ enableSorting: L = !1,
2384
+ loadingOptions: T = [],
2385
+ enableFocusedCell: C = !1,
2386
+ enableGhostCells: m = !1,
2387
+ bodyContextMenuRenderer: U,
2388
+ enableBodyContextMenu: y,
2389
+ onFocusedCell: z,
2390
+ onFocusedRegion: S,
2391
+ selectedRegions: R,
2392
+ onSelection: V,
2393
+ selectionModes: j,
2394
+ enableRowVirtualization: _ = !1,
2395
+ numFrozenColumns: x = 0,
2396
+ numFrozenRows: H = 0,
2397
+ overscanRowCount: I = Ee,
2398
+ columnVisibility: X,
2399
+ enableRowResizing: M = !1,
2400
+ rowHeights: O,
2401
+ defaultRowHeights: B,
2402
+ onRowHeightChanged: D,
2403
+ minRowHeight: b,
2404
+ maxRowHeight: J,
2405
+ rowSelection: st,
2406
+ defaultRowSelection: w,
2407
+ ...p
2408
+ }) {
2409
+ var et, rt, ut, wt, Qt;
2410
+ const [F, $] = jt({
2411
+ value: st ?? ((et = p.state) == null ? void 0 : et.rowSelection),
2412
+ initialValue: w ?? ((rt = p.initialState) == null ? void 0 : rt.rowSelection),
2413
+ finalValue: {},
2414
+ onChange: p.onRowSelectionChange
2415
+ }), K = (ut = p.atoms) == null ? void 0 : ut.expanded, [q, it] = jt({
2416
+ value: (K == null ? void 0 : K.get()) ?? n ?? ((wt = p.state) == null ? void 0 : wt.expanded),
2417
+ initialValue: l ?? ((Qt = p.initialState) == null ? void 0 : Qt.expanded),
2418
+ finalValue: {},
2419
+ onChange: s
2420
+ }), nt = En({
2421
+ ...p,
2422
+ initialState: l === void 0 ? p.initialState : {
2423
+ ...p.initialState,
2424
+ expanded: l
2425
+ },
2426
+ getRowCanExpand: p.getRowCanExpand ?? (o != null && p.enableExpanding !== !1 ? Jo : void 0),
2427
+ enableSorting: L,
2428
+ state: {
2429
+ ...p.state,
2430
+ ...X !== void 0 ? { columnVisibility: X } : {},
2431
+ rowSelection: F,
2432
+ expanded: q
2433
+ },
2434
+ onRowSelectionChange: $,
2435
+ onExpandedChange: (Bt) => {
2436
+ it(Bt), p.onExpandedChange ? p.onExpandedChange(Bt) : K == null || K.set((ke) => de(Bt, ke));
2437
+ }
2438
+ }), tt = Wt(Ft), at = tt ? nt.getPrePaginatedRowModel().rows.length : void 0;
2439
+ dt(() => {
2440
+ at !== void 0 && (tt == null || tt(at));
2441
+ }, [at, tt]), gn({ table: nt, numFrozenColumns: x, numFrozenRows: H });
2442
+ const ht = $t(T, Ot.CELLS), k = $t(
2443
+ T,
2444
+ Ot.COLUMN_HEADERS
2445
+ ), Y = $t(T, Ot.ROW_HEADERS), ot = /* @__PURE__ */ a(
2446
+ qo,
2447
+ {
2448
+ table: nt,
2449
+ rowHeight: e,
2450
+ renderRowDetail: o,
2451
+ getCellProps: r,
2452
+ rowExpanderButtonProps: c,
2453
+ rowExpanderIconProps: i,
2454
+ rowDetailHeight: u,
2455
+ rowHeaderWidth: E,
2456
+ enableRowHeader: v,
2457
+ columnHeaderHeight: N,
2458
+ enableColumnReordering: g,
2459
+ enableSorting: L,
2460
+ areCellsLoading: ht,
2461
+ areColumnHeadersLoading: k,
2462
+ areRowHeadersLoading: Y,
2463
+ enableFocusedCell: C,
2464
+ enableGhostCells: m,
2465
+ bodyContextMenuRenderer: U,
2466
+ enableBodyContextMenu: y,
2467
+ onFocusedCell: z,
2468
+ onFocusedRegion: S,
2469
+ selectedRegions: R,
2470
+ onSelection: V,
2471
+ selectionModes: j,
2472
+ enableRowVirtualization: _,
2473
+ overscanRowCount: I,
2474
+ enableRowResizing: M,
2475
+ rowHeights: O,
2476
+ defaultRowHeights: B,
2477
+ onRowHeightChanged: D,
2478
+ minRowHeight: b,
2479
+ maxRowHeight: J,
2480
+ selectionColumnWidth: f ? d : 0,
2481
+ ...t
2482
+ }
2483
+ );
2484
+ return tt ? /* @__PURE__ */ a(Ft.Provider, { value: void 0, children: ot }) : ot;
2485
+ }
2486
+ const tl = 10, el = [10, 20, 50, 100];
2487
+ function nl({
2488
+ pageIndex: t,
2489
+ pageSize: e,
2490
+ pageCount: n,
2491
+ rowCount: l,
2492
+ pageSizeOptions: s = el,
2493
+ onPageIndexChange: o,
2494
+ onPageSizeChange: r,
2495
+ className: c
2496
+ }) {
2497
+ const i = n != null && n >= 0 ? n : void 0, u = t > 0, f = i === void 0 ? !0 : t < i - 1, d = l === void 0 || l === 0 ? 0 : t * e + 1, E = l === void 0 ? void 0 : Math.min((t + 1) * e, l), v = s.includes(e) ? s : [...s, e].sort((N, g) => N - g);
2498
+ return /* @__PURE__ */ W("div", { className: G(Fn, c), children: [
2499
+ /* @__PURE__ */ W("div", { className: te, children: [
2500
+ /* @__PURE__ */ a("span", { className: Ht, children: "Rows per page:" }),
2501
+ /* @__PURE__ */ a(
2502
+ hn,
2503
+ {
2504
+ "aria-label": "Rows per page",
2505
+ onChange: (N) => r(Number(N.currentTarget.value)),
2506
+ options: v,
2507
+ value: e
2508
+ }
2509
+ ),
2510
+ l !== void 0 && /* @__PURE__ */ W("span", { className: Ht, children: [
2511
+ d === 0 ? 0 : `${d}–${E}`,
2512
+ " of ",
2513
+ l
2514
+ ] })
2515
+ ] }),
2516
+ /* @__PURE__ */ W("div", { className: te, children: [
2517
+ /* @__PURE__ */ W("span", { className: Ht, children: [
2518
+ "Page ",
2519
+ t + 1,
2520
+ i !== void 0 ? ` of ${i}` : ""
2521
+ ] }),
2522
+ /* @__PURE__ */ W(mn, { children: [
2523
+ /* @__PURE__ */ a(
2524
+ It,
2525
+ {
2526
+ "aria-label": "First page",
2527
+ disabled: !u,
2528
+ icon: "double-chevron-left",
2529
+ onClick: () => o(0)
2530
+ }
2531
+ ),
2532
+ /* @__PURE__ */ a(
2533
+ It,
2534
+ {
2535
+ "aria-label": "Previous page",
2536
+ disabled: !u,
2537
+ icon: "chevron-left",
2538
+ onClick: () => o(t - 1)
2539
+ }
2540
+ ),
2541
+ /* @__PURE__ */ a(
2542
+ It,
2543
+ {
2544
+ "aria-label": "Next page",
2545
+ disabled: !f,
2546
+ icon: "chevron-right",
2547
+ onClick: () => o(t + 1)
2548
+ }
2549
+ ),
2550
+ /* @__PURE__ */ a(
2551
+ It,
2552
+ {
2553
+ "aria-label": "Last page",
2554
+ disabled: i === void 0 || !f,
2555
+ icon: "double-chevron-right",
2556
+ onClick: () => {
2557
+ i !== void 0 && o(i - 1);
2558
+ }
2559
+ }
2560
+ )
2561
+ ] })
2562
+ ] })
2563
+ ] });
2564
+ }
2565
+ const ol = Pt({
2566
+ ...Vt,
2567
+ rowPaginationFeature: fe,
2568
+ paginatedRowModel: he()
2569
+ });
2570
+ function ml(t) {
2571
+ function e({
2572
+ data: l,
2573
+ initialState: s,
2574
+ state: o,
2575
+ features: r,
2576
+ onPaginationChange: c,
2577
+ manualPagination: i,
2578
+ pageCount: u,
2579
+ rowCount: f,
2580
+ initialPageIndex: d = 0,
2581
+ initialPageSize: E = tl,
2582
+ pageSizeOptions: v,
2583
+ showPaginationBar: N = !0,
2584
+ paginationBarClassName: g,
2585
+ ...L
2586
+ }) {
2587
+ const [T, C] = lt(() => {
2588
+ var B, D;
2589
+ return {
2590
+ pageIndex: ((B = s == null ? void 0 : s.pagination) == null ? void 0 : B.pageIndex) ?? d,
2591
+ pageSize: ((D = s == null ? void 0 : s.pagination) == null ? void 0 : D.pageSize) ?? E
2592
+ };
2593
+ }), m = o == null ? void 0 : o.pagination, U = m ?? T, { pageIndex: y, pageSize: z } = U, S = P(
2594
+ (B) => {
2595
+ c == null || c(B), m === void 0 && C((D) => de(B, D));
2596
+ },
2597
+ [m, c]
2598
+ ), R = i === !0, [V, j] = lt(), _ = !R && L.getSubRows != null && L.paginateExpandedRows !== !1, x = _ ? V : l.length, H = R ? f : x, I = gt(() => R ? u != null && u >= 0 ? u : f != null ? Math.ceil(f / z) : void 0 : x === void 0 ? void 0 : Math.max(1, Math.ceil(x / z)), [x, R, u, z, f]);
2599
+ Lt(() => {
2600
+ if (I === void 0)
2601
+ return;
2602
+ const B = Math.max(0, I - 1);
2603
+ y > B && S((D) => ({ ...D, pageIndex: B }));
2604
+ }, [S, I, y]);
2605
+ const X = gt(
2606
+ () => r == null ? ol : Pt({
2607
+ ...Vt,
2608
+ ...r,
2609
+ rowPaginationFeature: fe,
2610
+ paginatedRowModel: he()
2611
+ }),
2612
+ [r]
2613
+ ), M = P(
2614
+ (B) => {
2615
+ S((D) => ({
2616
+ ...D,
2617
+ pageIndex: Math.max(0, B)
2618
+ }));
2619
+ },
2620
+ [S]
2621
+ ), O = P(
2622
+ (B) => {
2623
+ S((D) => ({
2624
+ ...D,
2625
+ pageIndex: 0,
2626
+ pageSize: B
2627
+ }));
2628
+ },
2629
+ [S]
2630
+ );
2631
+ return /* @__PURE__ */ W("div", { className: Gn, children: [
2632
+ /* @__PURE__ */ a(Ft.Provider, { value: _ ? j : void 0, children: /* @__PURE__ */ a(
2633
+ t,
2634
+ {
2635
+ ...L,
2636
+ data: l,
2637
+ initialState: s,
2638
+ state: { ...o, pagination: U },
2639
+ features: X,
2640
+ onPaginationChange: S,
2641
+ manualPagination: i,
2642
+ pageCount: u,
2643
+ rowCount: f
2644
+ }
2645
+ ) }),
2646
+ N && /* @__PURE__ */ a(
2647
+ nl,
2648
+ {
2649
+ className: g,
2650
+ onPageIndexChange: M,
2651
+ onPageSizeChange: O,
2652
+ pageCount: I,
2653
+ pageIndex: y,
2654
+ pageSize: z,
2655
+ pageSizeOptions: v,
2656
+ rowCount: H
2657
+ }
2658
+ )
2659
+ ] });
2660
+ }
2661
+ const n = t.displayName ?? t.name ?? "Table";
2662
+ return e.displayName = `withPagination(${n})`, e;
2663
+ }
2664
+ export {
2665
+ hl as BP_Table,
2666
+ Vt as DEFAULT_BP_TABLE_FEATURES,
2667
+ tl as DEFAULT_PAGE_SIZE,
2668
+ el as DEFAULT_PAGE_SIZE_OPTIONS,
2669
+ ho as Direction,
2670
+ Ge as FocusMode,
2671
+ ct as RegionCardinality,
2672
+ A as Regions,
2673
+ Ot as TableLoadingOption,
2674
+ nl as TablePaginationBar,
2675
+ mo as directionToDelta,
2676
+ $t as hasLoadingOption,
2677
+ dl as moveFocusedCell,
2678
+ fl as resizeRegion,
2679
+ ml as withPagination
2680
+ };
2681
+ //# sourceMappingURL=blueprintjs-react-table.js.map