@umriss-ui/table 0.2.4 → 0.3.0

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.
package/dist/table.js CHANGED
@@ -1,250 +1,45 @@
1
1
  import "./table.css";
2
- var wt = Object.defineProperty;
3
- var _t = (e, t, n) => t in e ? wt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
4
- var z = (e, t, n) => _t(e, typeof t != "symbol" ? t + "" : t, n);
5
- import { useState as P, useCallback as B, useMemo as V, useRef as oe, useId as Z, useContext as xe, useSyncExternalStore as pe, createContext as Ge, useLayoutEffect as J } from "react";
6
- import { DEFAULT_FORMATS as vt, useVirtual as kt, useFormats as te, useWording as $, Checkbox as ge, DateRangePicker as yt, FormField as Ee, NumberInput as Pe, Popover as Ue, Button as G, TagGroup as Ct, Tag as St, useDensityFor as qe, VisuallyHidden as be, Menu as Nt, MenuItem as At, assess as xt, verdictWeight as Tt, Select as Ot, Input as Rt, DEFAULT_WORDING as It, Badge as Ce, useFreshness as Ft } from "@umriss-ui/core";
7
- import { jsx as c, jsxs as x, Fragment as Q } from "react/jsx-runtime";
8
- import { createPortal as Lt } from "react-dom";
9
- function zt(e) {
10
- const [t, n] = P(/* @__PURE__ */ new Set()), o = B((u) => t.has(u), [t]), r = B((u) => {
11
- n((d) => {
12
- const h = new Set(d);
13
- return h.has(u) ? h.delete(u) : h.add(u), h;
2
+ var Xt = Object.defineProperty;
3
+ var Jt = (e, t, n) => t in e ? Xt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
4
+ var P = (e, t, n) => Jt(e, typeof t != "symbol" ? t + "" : t, n);
5
+ import { useState as z, useCallback as X, useMemo as j, useRef as Z, useId as se, useContext as Ue, useSyncExternalStore as Le, createContext as yt, useLayoutEffect as K } from "react";
6
+ import { DEFAULT_FORMATS as Ct, useVirtual as Qt, useFormats as ue, useWording as U, Checkbox as Se, DateRangePicker as Zt, FormField as rt, NumberInput as st, Popover as St, Button as ee, TagGroup as Nt, Tag as xt, Menu as At, MenuItem as Fe, MenuSeparator as en, VisuallyHidden as Re, useDensityFor as Tt, assess as tn, verdictWeight as Be, Select as nn, Input as on, DEFAULT_WORDING as rn, Badge as Ie, useFreshness as sn } from "@umriss-ui/core";
7
+ import { jsx as l, jsxs as L, Fragment as J } from "react/jsx-runtime";
8
+ import { createPortal as an } from "react-dom";
9
+ function ln(e) {
10
+ const [t, n] = z(/* @__PURE__ */ new Set()), o = X((u) => t.has(u), [t]), r = X((u) => {
11
+ n((h) => {
12
+ const f = new Set(h);
13
+ return f.has(u) ? f.delete(u) : f.add(u), f;
14
14
  });
15
- }, []), i = V(
15
+ }, []), s = j(
16
16
  () => e.length > 0 && e.every((u) => t.has(u)),
17
17
  [e, t]
18
- ), s = V(
19
- () => !i && e.some((u) => t.has(u)),
20
- [e, t, i]
21
- ), l = B(() => {
18
+ ), i = j(
19
+ () => !s && e.some((u) => t.has(u)),
20
+ [e, t, s]
21
+ ), a = X(() => {
22
22
  n((u) => {
23
- const d = new Set(u);
24
- return e.length > 0 && e.every((_) => d.has(_)) ? e.forEach((_) => d.delete(_)) : e.forEach((_) => d.add(_)), d;
23
+ const h = new Set(u);
24
+ return e.length > 0 && e.every((b) => h.has(b)) ? e.forEach((b) => h.delete(b)) : e.forEach((b) => h.add(b)), h;
25
25
  });
26
- }, [e]), a = B(() => n(/* @__PURE__ */ new Set()), []);
27
- return { selected: t, isSelected: o, toggle: r, toggleAll: l, clear: a, allSelected: i, someSelected: s, count: t.size };
28
- }
29
- function Te(e, t) {
30
- return t != null && t.length ? [
31
- ...t.map((n) => e.find((o) => o.id === n)).filter((n) => n !== void 0),
32
- ...e.filter((n) => !t.includes(n.id))
33
- ] : e;
34
- }
35
- const ie = (e) => e == null || typeof e == "number" && Number.isNaN(e), jt = (e, t) => typeof e == "number" && typeof t == "number" ? e - t : vt.compareText(String(e), String(t));
36
- function Oe(e, t, n) {
37
- const {
38
- search: o = "",
39
- filter: r,
40
- sort: i = null,
41
- page: s = 1,
42
- pageSize: l,
43
- hidden: a,
44
- order: u
45
- } = n, d = Te(t, u), h = a != null && a.length ? d.filter((w) => w.hideable === !1 || !a.includes(w.id)) : d, _ = o.trim().toLowerCase(), g = t.filter((w) => w.searchable && w.value), p = (w) => !_ || g.some((C) => {
46
- const I = C.value(w);
47
- return !ie(I) && String(I).toLowerCase().includes(_);
48
- }), b = e.filter((w) => p(w) && (r ? r(w) : !0)), m = (Array.isArray(i) ? i : i ? [i] : []).map((w) => {
49
- const C = t.find((T) => T.id === w.column);
50
- if (!C || !C.compare && !C.value) return null;
51
- const I = w.direction === "asc" ? 1 : -1, A = C.compare, S = C.value;
52
- return S ? (T, L) => {
53
- const F = S(T), E = S(L);
54
- return ie(F) || ie(E) ? ie(F) === ie(E) ? 0 : ie(F) ? 1 : -1 : (A ? A(T, L) : jt(F, E)) * I;
55
- } : (T, L) => A(T, L) * I;
56
- }).filter((w) => w !== null);
57
- m.length > 0 && b.sort((w, C) => {
58
- for (const I of m) {
59
- const A = I(w, C);
60
- if (A !== 0) return A;
61
- }
62
- return 0;
63
- });
64
- const y = l && l > 0 ? l : b.length || 1, O = Math.max(1, Math.ceil(b.length / y)), N = Math.min(Math.max(1, s), O), M = b.slice((N - 1) * y, N * y);
65
- return {
66
- columns: h,
67
- filtered: b,
68
- visible: M,
69
- page: N,
70
- pageCount: O,
71
- columnCount: h.length
72
- };
73
- }
74
- function Et(e, t, n) {
75
- const { rowKey: o, filter: r, defaultSort: i = null, initialView: s, virtual: l } = n, [a, u] = P((s == null ? void 0 : s.search) ?? ""), [d, h] = P(() => {
76
- var k;
77
- return (k = s == null ? void 0 : s.sort) != null && k.length ? [...s.sort] : i ? Array.isArray(i) ? [...i] : [i] : [];
78
- }), [_, g] = P((s == null ? void 0 : s.page) ?? 1), [p, b] = P(
79
- (s == null ? void 0 : s.pageSize) ?? n.pageSize ?? 10
80
- ), [v, m] = P([]), [y, O] = P((s == null ? void 0 : s.hidden) ?? []), [N, M] = P((s == null ? void 0 : s.order) ?? []), [w, C] = P(() => {
81
- if (s != null && s.widths) return { ...s.widths };
82
- const k = {};
83
- for (const R of t)
84
- R.width !== void 0 && (k[R.id] = R.width);
85
- return k;
86
- }), I = l ? 0 : p, A = V(
87
- () => Oe(e, t, {
88
- search: a,
89
- filter: r,
90
- sort: d,
91
- page: _,
92
- pageSize: I,
93
- hidden: y,
94
- order: N
95
- }),
96
- [e, t, a, r, d, _, I, y, N]
97
- ), S = kt(l ? A.filtered.length : 0, {
98
- rowHeight: (l == null ? void 0 : l.rowHeight) ?? 0,
99
- overscan: l == null ? void 0 : l.overscan
100
- }), T = V(
101
- () => l ? A.filtered.slice(S.from, S.to) : A.visible,
102
- [l, A.filtered, A.visible, S.from, S.to]
103
- ), L = V(() => A.filtered.map(o), [A.filtered, o]), F = zt(L), E = B((k) => {
104
- u(k), g(1);
105
- }, []), W = B((k) => {
106
- b(k), g(1);
107
- }, []), q = B((k, R = !1) => {
108
- h((j) => {
109
- const Y = j.find((ne) => ne.column === k);
110
- if (!R) {
111
- const ne = j.length === 1 && (Y == null ? void 0 : Y.direction) === "asc" ? "desc" : "asc";
112
- return [{ column: k, direction: ne }];
113
- }
114
- return Y ? Y.direction === "asc" ? j.map(
115
- (ne) => ne.column === k ? { column: k, direction: "desc" } : ne
116
- ) : j.filter((ne) => ne.column !== k) : [...j, { column: k, direction: "asc" }];
117
- }), g(1);
118
- }, []), D = B((k) => {
119
- m(
120
- (R) => R.includes(k) ? R.filter((j) => j !== k) : [...R, k]
121
- );
122
- }, []), K = B(
123
- (k) => v.includes(k),
124
- [v]
125
- ), ve = B((k) => {
126
- O(
127
- (R) => R.includes(k) ? R.filter((j) => j !== k) : [...R, k]
128
- );
129
- }, []), ht = B((k, R) => {
130
- C((j) => {
131
- if (R === void 0) {
132
- if (!(k in j)) return j;
133
- const Y = { ...j };
134
- return delete Y[k], Y;
135
- }
136
- return { ...j, [k]: R };
137
- });
138
- }, []), mt = B(
139
- (k) => {
140
- var R;
141
- return (R = d.find((j) => j.column === k)) == null ? void 0 : R.direction;
142
- },
143
- [d]
144
- ), pt = B(
145
- (k) => {
146
- if (d.length < 2) return;
147
- const R = d.findIndex((j) => j.column === k);
148
- return R === -1 ? void 0 : R + 1;
149
- },
150
- [d]
151
- ), gt = V(
152
- () => Te(t, N).filter((k) => k.label !== void 0 && k.hideable !== !1).map((k) => ({ id: k.id, label: k.label, visible: !y.includes(k.id) })),
153
- [t, N, y]
154
- ), Le = n.pageSize ?? 10, ze = V(() => {
155
- const k = {};
156
- for (const R of t)
157
- R.width !== void 0 && (k[R.id] = R.width);
158
- return k;
159
- }, [t]), ke = V(() => {
160
- const k = {};
161
- for (const [R, j] of Object.entries(w))
162
- ze[R] !== j && (k[R] = j);
163
- return k;
164
- }, [w, ze]), ye = V(
165
- () => i ? Array.isArray(i) ? i : [i] : [],
166
- [i]
167
- ), je = d.length === ye.length && d.every(
168
- (k, R) => {
169
- var j, Y;
170
- return k.column === ((j = ye[R]) == null ? void 0 : j.column) && k.direction === ((Y = ye[R]) == null ? void 0 : Y.direction);
171
- }
172
- ), bt = V(
173
- () => ({
174
- ...a ? { search: a } : {},
175
- ...d.length && !je ? { sort: d } : {},
176
- /* Without paging there is no page a view could carry - a page three in
177
- the view of a virtualised table would be a promise nobody redeems on
178
- opening. */
179
- ...!l && A.page > 1 ? { page: A.page } : {},
180
- ...!l && p !== Le ? { pageSize: p } : {},
181
- ...y.length ? { hidden: y } : {},
182
- ...N.length ? { order: N } : {},
183
- ...Object.keys(ke).length ? { widths: ke } : {}
184
- }),
185
- [
186
- l,
187
- a,
188
- d,
189
- je,
190
- A.page,
191
- p,
192
- Le,
193
- y,
194
- N,
195
- ke
196
- ]
197
- );
198
- return {
199
- ...A,
200
- visible: T,
201
- virtual: l ? S : void 0,
202
- view: bt,
203
- search: a,
204
- setSearch: E,
205
- sort: d,
206
- toggleSort: q,
207
- sortDirectionOf: mt,
208
- sortRankOf: pt,
209
- setPage: g,
210
- pageSize: p,
211
- setPageSize: W,
212
- expanded: v,
213
- toggleRow: D,
214
- isExpanded: K,
215
- hidden: y,
216
- toggleColumn: ve,
217
- columnChoices: gt,
218
- order: N,
219
- setOrder: M,
220
- widths: w,
221
- setWidth: ht,
222
- selection: F
223
- };
224
- }
225
- function Pt() {
226
- var t;
227
- const e = import.meta;
228
- return typeof ((t = e.env) == null ? void 0 : t.DEV) == "boolean" ? e.env.DEV : typeof process < "u" && (process != null && process.env) ? process.env.NODE_ENV !== "production" : !1;
229
- }
230
- const Ye = Pt(), Me = /* @__PURE__ */ new Set();
231
- function re(e, t) {
232
- !Ye || Me.has(e) || (Me.add(e), console.warn(`@umriss-ui/table: ${t}`));
26
+ }, [e]), c = X(() => n(/* @__PURE__ */ new Set()), []);
27
+ return { selected: t, isSelected: o, toggle: r, toggleAll: a, clear: c, allSelected: s, someSelected: i, count: t.size };
233
28
  }
234
- const U = (e) => e == null || typeof e == "number" && Number.isNaN(e);
235
- function we(e) {
236
- return U(e) ? "empty" : typeof e == "string" ? "text" : typeof e == "number" ? "number" : typeof e == "boolean" ? "boolean" : e instanceof Date ? Number.isNaN(e.getTime()) ? "empty" : "date" : "other";
29
+ const Y = (e) => e == null || typeof e == "number" && Number.isNaN(e);
30
+ function Me(e) {
31
+ return Y(e) ? "empty" : typeof e == "string" ? "text" : typeof e == "number" ? "number" : typeof e == "boolean" ? "boolean" : e instanceof Date ? Number.isNaN(e.getTime()) ? "empty" : "date" : "other";
237
32
  }
238
- function Mt(e, t) {
33
+ function Ft(e, t) {
239
34
  for (const n of e) {
240
- const o = we(t(n));
35
+ const o = Me(t(n));
241
36
  if (o !== "empty") return o;
242
37
  }
243
38
  return "empty";
244
39
  }
245
- const Xe = (e, t) => t ?? e === "number";
246
- function ae(e, t, n, o) {
247
- switch (we(e)) {
40
+ const Ot = (e, t) => t ?? e === "number";
41
+ function _e(e, t, n, o) {
42
+ switch (Me(e)) {
248
43
  case "text":
249
44
  return e;
250
45
  case "number": {
@@ -261,10 +56,10 @@ function ae(e, t, n, o) {
261
56
  return null;
262
57
  }
263
58
  }
264
- function Je(e, t) {
265
- if (!U(e)) {
266
- if (t) return Je(t(e));
267
- switch (we(e)) {
59
+ function ze(e, t) {
60
+ if (!Y(e)) {
61
+ if (t) return ze(t(e));
62
+ switch (Me(e)) {
268
63
  case "text":
269
64
  return e;
270
65
  case "number":
@@ -278,11 +73,11 @@ function Je(e, t) {
278
73
  }
279
74
  }
280
75
  }
281
- const Dt = "ja", Vt = "nein";
282
- function Qe(e, t) {
283
- if (!U(e)) {
284
- if (t) return Qe(t(e));
285
- switch (we(e)) {
76
+ const cn = "ja", un = "nein";
77
+ function Lt(e, t) {
78
+ if (!Y(e)) {
79
+ if (t) return Lt(t(e));
80
+ switch (Me(e)) {
286
81
  case "text":
287
82
  return e;
288
83
  case "number":
@@ -290,203 +85,573 @@ function Qe(e, t) {
290
85
  case "date":
291
86
  return e.toISOString();
292
87
  case "boolean":
293
- return e ? Dt : Vt;
88
+ return e ? cn : un;
294
89
  default:
295
90
  return;
296
91
  }
297
92
  }
298
93
  }
299
- function Ht(e, t, n) {
300
- let o = 0, r = 0;
301
- for (const i of e) {
302
- const s = t(i);
303
- typeof s != "number" || Number.isNaN(s) || (o += s, r += 1);
304
- }
305
- if (r !== 0)
306
- return n === "sum" ? o : o / r;
307
- }
308
- const Re = "absent", le = (e) => U(e) ? Re : e instanceof Date ? `value:${e.getTime()}` : `value:${String(e)}`, Bt = "_frame_10bwr_11 _text_1hv7a_23", $t = "_children_10bwr_23", Wt = "_scroll_10bwr_29 _scroll_1hv7a_40", Kt = "_footerTarget_10bwr_36", Gt = "_table_10bwr_40", Ut = "_th_10bwr_48 _ring_1hv7a_65", qt = "_sticky_10bwr_63", Yt = "_td_10bwr_71", Xt = "_rowHeader_10bwr_83", Jt = "_compact_10bwr_99", Qt = "_numeric_10bwr_114", Zt = "_absent_10bwr_126", en = "_striped_10bwr_130", tn = "_stickyCell_10bwr_154", nn = "_sortButton_10bwr_166 _ring_1hv7a_65", on = "_sortIndicator_10bwr_191", rn = "_sortArrow_10bwr_198", sn = "_sortArrowDesc_10bwr_202", ln = "_sortActive_10bwr_210", cn = "_sortRank_10bwr_216", an = "_thFlex_10bwr_224", dn = "_footerKind_10bwr_245", un = "_emptyCell_10bwr_253", fn = "_empty_10bwr_253", hn = "_emptyTitle_10bwr_269", mn = "_skeleton_10bwr_276", pn = "_toolbar_10bwr_304 _text_1hv7a_23", gn = "_toolbarGroup_10bwr_318", bn = "_toolbarInfo_10bwr_335", wn = "_pagination_10bwr_341 _text_1hv7a_23", _n = "_paginationControls_10bwr_354", vn = "_pageSize_10bwr_361", kn = "_paginationStatus_10bwr_373", yn = "_filterButton_10bwr_382 _ring_1hv7a_65", Cn = "_filterActive_10bwr_405", Sn = "_filterPanel_10bwr_410", Nn = "_filterContent_10bwr_423 _scroll_1hv7a_40", An = "_filterFooter_10bwr_434", xn = "_filterLabel_10bwr_448", Tn = "_filterValue_10bwr_458", On = "_filteredCount_10bwr_464", Rn = "_rangeFields_10bwr_475", In = "_rangePeriod_10bwr_485", Fn = "_conditions_10bwr_491", Ln = "_conditionButton_10bwr_497", zn = "_condition_10bwr_491", jn = "_columnsPanel_10bwr_521", En = "_columnsList_10bwr_529", Pn = "_columnsEntry_10bwr_538", Mn = "_move_10bwr_550", Dn = "_expander_10bwr_585", Vn = "_expanderOpen_10bwr_616", Hn = "_detailRow_10bwr_620", Bn = "_detailCell_10bwr_620", $n = "_actionsCell_10bwr_628", Wn = "_actions_10bwr_628", Kn = "_grip_10bwr_656", Gn = "_virtualBody_10bwr_697", Un = "_virtualRow_10bwr_705", qn = "_fillerRow_10bwr_710", Yn = "_control_10bwr_145", f = {
309
- frame: Bt,
310
- children: $t,
311
- scroll: Wt,
312
- footerTarget: Kt,
313
- table: Gt,
314
- th: Ut,
315
- sticky: qt,
316
- td: Yt,
317
- rowHeader: Xt,
318
- compact: Jt,
319
- numeric: Qt,
320
- absent: Zt,
321
- striped: en,
322
- stickyCell: tn,
323
- sortButton: nn,
324
- sortIndicator: on,
325
- sortArrow: rn,
326
- sortArrowDesc: sn,
327
- sortActive: ln,
328
- sortRank: cn,
329
- thFlex: an,
330
- footerKind: dn,
331
- emptyCell: un,
332
- empty: fn,
333
- emptyTitle: hn,
334
- skeleton: mn,
335
- toolbar: pn,
336
- toolbarGroup: gn,
337
- toolbarInfo: bn,
338
- pagination: wn,
339
- paginationControls: _n,
340
- pageSize: vn,
341
- paginationStatus: kn,
342
- filterButton: yn,
343
- filterActive: Cn,
344
- filterPanel: Sn,
345
- filterContent: Nn,
346
- filterFooter: An,
347
- filterLabel: xn,
348
- filterValue: Tn,
349
- filteredCount: On,
350
- rangeFields: Rn,
351
- rangePeriod: In,
352
- conditions: Fn,
353
- conditionButton: Ln,
354
- condition: zn,
355
- columnsPanel: jn,
356
- columnsList: En,
357
- columnsEntry: Pn,
358
- move: Mn,
359
- expander: Dn,
360
- expanderOpen: Vn,
361
- detailRow: Hn,
362
- detailCell: Bn,
363
- actionsCell: $n,
364
- actions: Wn,
365
- grip: Kn,
366
- virtualBody: Gn,
367
- virtualRow: Un,
368
- fillerRow: qn,
369
- control: Yn
94
+ const Xe = "absent", ge = (e) => Y(e) ? Xe : e instanceof Date ? `value:${e.getTime()}` : `value:${String(e)}`, it = (e) => e instanceof Date ? e.getTime() : typeof e == "number" && !Number.isNaN(e) ? e : void 0;
95
+ function Je(e, t) {
96
+ const n = t.map(e.read).filter((c) => !Y(c) && !(c instanceof Date && Number.isNaN(c.getTime()))), o = e.aggregate;
97
+ if (typeof o == "function") return o(n, t);
98
+ if (o === "count") return n.length;
99
+ if (o === "distinct") return new Set(n.map(ge)).size;
100
+ const r = n.filter((c) => it(c) !== void 0);
101
+ if (r.length === 0) return;
102
+ const s = r.map((c) => it(c)), i = r[0] instanceof Date, a = (c) => i ? new Date(c) : c;
103
+ switch (o) {
104
+ case "sum":
105
+ return s.reduce((c, u) => c + u, 0);
106
+ case "avg":
107
+ return s.reduce((c, u) => c + u, 0) / s.length;
108
+ case "min":
109
+ return a(Math.min(...s));
110
+ case "max":
111
+ return a(Math.max(...s));
112
+ case "range":
113
+ return [a(Math.min(...s)), a(Math.max(...s))];
114
+ }
115
+ }
116
+ const Qe = 3, Ce = (e) => {
117
+ if (!Y(e))
118
+ return e instanceof Date ? e.getTime() : typeof e == "boolean" ? e ? 1 : 0 : typeof e == "number" ? e : String(e);
370
119
  };
371
- function jr(e) {
372
- return e;
120
+ function Pe(e, t, n) {
121
+ const o = Ce(e), r = Ce(t);
122
+ return o === void 0 || r === void 0 ? o === r ? 0 : o === void 0 ? 1 : -1 : typeof o == "number" && typeof r == "number" ? o - r : n(String(o), String(r));
123
+ }
124
+ function dn(e, t) {
125
+ const n = t.compareText ?? Ct.compareText, o = (r, s, i) => {
126
+ var w;
127
+ const a = /* @__PURE__ */ new Map(), c = t.levels[s];
128
+ if (!c) return [];
129
+ const u = /* @__PURE__ */ new Map();
130
+ for (const g of r) {
131
+ const v = c.value(g), N = ge(v);
132
+ let C = u.get(N);
133
+ C || (C = {
134
+ path: JSON.stringify([...i, N]),
135
+ value: Y(v) ? void 0 : v,
136
+ level: s,
137
+ rows: [],
138
+ groups: [],
139
+ aggregates: {}
140
+ }, u.set(N, C), a.set(C, [...i, N])), C.rows.push(g);
141
+ }
142
+ for (const g of u.values())
143
+ for (const v of t.aggregates ?? []) g.aggregates[v.id] = Je(v, g.rows);
144
+ const h = (w = t.sort) == null ? void 0 : w.find(
145
+ (g) => {
146
+ var v;
147
+ return g.column === c.id || ((v = t.aggregates) == null ? void 0 : v.some((N) => N.id === g.column));
148
+ }
149
+ ), f = (h == null ? void 0 : h.direction) === "desc" ? -1 : 1, b = h !== void 0 && h.column !== c.id ? h.column : void 0, p = (g) => {
150
+ let v;
151
+ for (const N of g.rows) {
152
+ const C = c.order(N);
153
+ Ce(C) !== void 0 && (v === void 0 || Pe(C, v, n) < 0) && (v = C);
154
+ }
155
+ return v;
156
+ }, k = (g) => {
157
+ if (b === void 0) return c.order ? p(g) : g.value;
158
+ const v = g.aggregates[b];
159
+ return Array.isArray(v) ? v[0] : v;
160
+ }, m = [...u.values()].sort((g, v) => {
161
+ if (g.value === void 0 || v.value === void 0) return Pe(g.value, v.value, n);
162
+ const N = k(g), C = k(v), D = Pe(N, C, n);
163
+ return Ce(N) === void 0 || Ce(C) === void 0 ? D : D * f;
164
+ });
165
+ for (const g of m)
166
+ g.groups = o(g.rows, s + 1, a.get(g));
167
+ return m;
168
+ };
169
+ return o(e, 0, []);
373
170
  }
374
- const de = /* @__PURE__ */ new WeakMap();
375
- function Ze(e, t) {
376
- return de.set(e, t), e;
171
+ function fn(e, t) {
172
+ const n = /* @__PURE__ */ new Set(), o = (r) => {
173
+ for (const s of r)
174
+ n.add(s.path), o(s.groups);
175
+ };
176
+ return o(e), t.filter((r) => n.has(r));
377
177
  }
378
- const Xn = (e) => de.has(e);
379
- function se(e) {
380
- return e === "list" ? to : e === "range" ? ao : typeof e == "object" && e !== null ? e : void 0;
178
+ const hn = (e) => (t) => {
179
+ if (!(t instanceof Date) || Number.isNaN(t.getTime())) return;
180
+ const n = t.getFullYear(), o = t.getMonth(), r = t.getDate();
181
+ return e === "year" ? new Date(n, 0, 1) : e === "month" ? new Date(n, o, 1) : e === "week" ? new Date(n, o, r - (t.getDay() + 6) % 7) : new Date(n, o, r);
182
+ };
183
+ function gn(e) {
184
+ const t = new Date(e.getFullYear(), e.getMonth(), e.getDate() + 3 - (e.getDay() + 6) % 7), n = new Date(t.getFullYear(), 0, 4);
185
+ return { week: 1 + Math.round((t.getTime() - n.getTime()) / 864e5 / 7 - ((n.getDay() + 6) % 7 - 3) / 7), year: t.getFullYear() };
186
+ }
187
+ function pn(e, t, n, o) {
188
+ if (e === "year") return String(t.getFullYear());
189
+ if (e === "month") return n.month(t);
190
+ if (e === "week") {
191
+ const { week: r, year: s } = gn(t);
192
+ return o.calendarWeek(r, s);
193
+ }
194
+ return n.date(t);
195
+ }
196
+ function mn(e, t) {
197
+ const n = [], o = (r, s) => {
198
+ for (const i of r) {
199
+ const a = t.has(i.path);
200
+ if (i.groups.length === 0 && i.level === 0) {
201
+ if (n.push({ kind: "header", group: i, parents: s, continued: !1 }), !a)
202
+ for (const c of i.rows) n.push({ kind: "row", row: c, parents: [i], span: void 0, first: !1, continued: !1 });
203
+ } else i.groups.length > 0 ? (n.push({ kind: "header", group: i, parents: s, continued: !1 }), a || o(i.groups, [...s, i])) : a ? n.push({ kind: "folded", group: i, parents: s }) : i.rows.forEach((c, u) => n.push({ kind: "row", row: c, parents: s, span: i, first: u === 0, continued: !1 }));
204
+ }
205
+ };
206
+ return o(e, []), n;
207
+ }
208
+ function wn(e, t, n) {
209
+ const o = n > 0 ? n : e.length || 1, r = Math.max(1, Math.ceil(e.length / o)), s = Math.min(Math.max(1, t), r), i = e.slice((s - 1) * o, s * o);
210
+ return { lines: Rt(i), page: s, pageCount: r };
211
+ }
212
+ const Ze = (e) => e.flatMap((t) => t.kind === "row" ? [t.row] : []);
213
+ function Rt(e) {
214
+ const t = e[0];
215
+ if (!t) return [...e];
216
+ const n = t.parents.map((r, s) => ({
217
+ kind: "header",
218
+ group: r,
219
+ parents: t.parents.slice(0, s),
220
+ continued: !0
221
+ })), o = t.kind === "row" && t.span && !t.first ? { ...t, first: !0, continued: !0 } : t;
222
+ return [...n, o, ...e.slice(1)];
381
223
  }
382
224
  function et(e, t) {
225
+ return t != null && t.length ? [
226
+ ...t.map((n) => e.find((o) => o.id === n)).filter((n) => n !== void 0),
227
+ ...e.filter((n) => !t.includes(n.id))
228
+ ] : e;
229
+ }
230
+ const ke = (e) => e == null || typeof e == "number" && Number.isNaN(e), bn = (e, t) => typeof e == "number" && typeof t == "number" ? e - t : Ct.compareText(String(e), String(t));
231
+ function tt(e, t, n) {
232
+ var T;
233
+ const {
234
+ search: o = "",
235
+ filter: r,
236
+ sort: s = null,
237
+ page: i = 1,
238
+ pageSize: a,
239
+ hidden: c,
240
+ order: u
241
+ } = n, h = et(t, u), f = c != null && c.length ? h.filter((x) => x.hideable === !1 || !c.includes(x.id)) : h, b = o.trim().toLowerCase(), p = t.filter((x) => x.searchable && x.value), k = (x) => !b || p.some((_) => {
242
+ const S = _.value(x);
243
+ return !ke(S) && String(S).toLowerCase().includes(b);
244
+ }), m = e.filter((x) => k(x) && (r ? r(x) : !0)), w = Array.isArray(s) ? s : s ? [s] : [], g = w.map((x) => {
245
+ const _ = t.find((I) => I.id === x.column);
246
+ if (!_ || !_.compare && !_.value) return null;
247
+ const S = x.direction === "asc" ? 1 : -1, O = _.compare, A = _.value;
248
+ return A ? (I, $) => {
249
+ const G = A(I), W = A($);
250
+ return ke(G) || ke(W) ? ke(G) === ke(W) ? 0 : ke(G) ? 1 : -1 : (O ? O(I, $) : bn(G, W)) * S;
251
+ } : (I, $) => O(I, $) * S;
252
+ }).filter((x) => x !== null);
253
+ if (g.length > 0 && m.sort((x, _) => {
254
+ for (const S of g) {
255
+ const O = S(x, _);
256
+ if (O !== 0) return O;
257
+ }
258
+ return 0;
259
+ }), (T = n.grouping) != null && T.levels.length) {
260
+ const { folded: x, ..._ } = n.grouping, S = dn(m, { ..._, sort: w }), O = mn(S, x), A = wn(O, i, a ?? 0);
261
+ return {
262
+ columns: f,
263
+ filtered: m,
264
+ visible: Ze(A.lines),
265
+ groups: S,
266
+ lines: O,
267
+ visibleLines: A.lines,
268
+ page: A.page,
269
+ pageCount: A.pageCount,
270
+ columnCount: f.length
271
+ };
272
+ }
273
+ const v = a && a > 0 ? a : m.length || 1, N = Math.max(1, Math.ceil(m.length / v)), C = Math.min(Math.max(1, i), N), D = m.slice((C - 1) * v, C * v);
274
+ return {
275
+ columns: f,
276
+ filtered: m,
277
+ visible: D,
278
+ page: C,
279
+ pageCount: N,
280
+ columnCount: f.length
281
+ };
282
+ }
283
+ function kn(e, t, n) {
284
+ const { rowKey: o, filter: r, defaultSort: s = null, initialView: i, virtual: a, grouping: c } = n, [u, h] = z((i == null ? void 0 : i.search) ?? ""), [f, b] = z(() => {
285
+ var F;
286
+ return (F = i == null ? void 0 : i.sort) != null && F.length ? [...i.sort] : s ? Array.isArray(s) ? [...s] : [s] : [];
287
+ }), [p, k] = z((i == null ? void 0 : i.page) ?? 1), [m, w] = z(
288
+ (i == null ? void 0 : i.pageSize) ?? n.pageSize ?? 10
289
+ ), [g, v] = z([]), [N, C] = z((i == null ? void 0 : i.hidden) ?? []), [D, T] = z((i == null ? void 0 : i.order) ?? []), [x, _] = z(() => {
290
+ if (i != null && i.widths) return { ...i.widths };
291
+ const F = {};
292
+ for (const V of t)
293
+ V.width !== void 0 && (F[V.id] = V.width);
294
+ return F;
295
+ }), S = a ? 0 : m, O = j(
296
+ () => tt(e, t, {
297
+ search: u,
298
+ filter: r,
299
+ sort: f,
300
+ page: p,
301
+ pageSize: S,
302
+ hidden: N,
303
+ order: D,
304
+ grouping: c
305
+ }),
306
+ [e, t, u, r, f, p, S, N, D, c]
307
+ ), A = Qt(a ? (O.lines ?? O.filtered).length : 0, {
308
+ rowHeight: (a == null ? void 0 : a.rowHeight) ?? 0,
309
+ overscan: a == null ? void 0 : a.overscan
310
+ }), I = j(
311
+ () => a && O.lines ? O.lines.slice(A.from, A.to) : O.visibleLines,
312
+ [a, O.lines, O.visibleLines, A.from, A.to]
313
+ ), $ = j(
314
+ () => a ? I ? Ze(I) : O.filtered.slice(A.from, A.to) : O.visible,
315
+ [a, I, O.filtered, O.visible, A.from, A.to]
316
+ ), G = j(() => O.filtered.map(o), [O.filtered, o]), W = ln(G), ie = X((F) => {
317
+ h(F), k(1);
318
+ }, []), ae = X((F) => {
319
+ w(F), k(1);
320
+ }, []), de = X((F, V = !1) => {
321
+ b((B) => {
322
+ const oe = B.find((he) => he.column === F);
323
+ if (!V) {
324
+ const he = B.length === 1 && (oe == null ? void 0 : oe.direction) === "asc" ? "desc" : "asc";
325
+ return [{ column: F, direction: he }];
326
+ }
327
+ return oe ? oe.direction === "asc" ? B.map(
328
+ (he) => he.column === F ? { column: F, direction: "desc" } : he
329
+ ) : B.filter((he) => he.column !== F) : [...B, { column: F, direction: "asc" }];
330
+ }), k(1);
331
+ }, []), fe = X((F) => {
332
+ v(
333
+ (V) => V.includes(F) ? V.filter((B) => B !== F) : [...V, F]
334
+ );
335
+ }, []), we = X(
336
+ (F) => g.includes(F),
337
+ [g]
338
+ ), be = X((F) => {
339
+ C(
340
+ (V) => V.includes(F) ? V.filter((B) => B !== F) : [...V, F]
341
+ );
342
+ }, []), ye = X((F, V) => {
343
+ _((B) => {
344
+ if (V === void 0) {
345
+ if (!(F in B)) return B;
346
+ const oe = { ...B };
347
+ return delete oe[F], oe;
348
+ }
349
+ return { ...B, [F]: V };
350
+ });
351
+ }, []), le = X(
352
+ (F) => {
353
+ var V;
354
+ return (V = f.find((B) => B.column === F)) == null ? void 0 : V.direction;
355
+ },
356
+ [f]
357
+ ), te = X(
358
+ (F) => {
359
+ if (f.length < 2) return;
360
+ const V = f.findIndex((B) => B.column === F);
361
+ return V === -1 ? void 0 : V + 1;
362
+ },
363
+ [f]
364
+ ), y = j(
365
+ () => et(t, D).filter((F) => F.label !== void 0 && F.hideable !== !1).map((F) => ({ id: F.id, label: F.label, visible: !N.includes(F.id) })),
366
+ [t, D, N]
367
+ ), R = n.pageSize ?? 10, q = j(() => {
368
+ const F = {};
369
+ for (const V of t)
370
+ V.width !== void 0 && (F[V.id] = V.width);
371
+ return F;
372
+ }, [t]), H = j(() => {
373
+ const F = {};
374
+ for (const [V, B] of Object.entries(x))
375
+ q[V] !== B && (F[V] = B);
376
+ return F;
377
+ }, [x, q]), M = j(
378
+ () => s ? Array.isArray(s) ? s : [s] : [],
379
+ [s]
380
+ ), Q = f.length === M.length && f.every(
381
+ (F, V) => {
382
+ var B, oe;
383
+ return F.column === ((B = M[V]) == null ? void 0 : B.column) && F.direction === ((oe = M[V]) == null ? void 0 : oe.direction);
384
+ }
385
+ ), ne = j(
386
+ () => ({
387
+ ...u ? { search: u } : {},
388
+ ...f.length && !Q ? { sort: f } : {},
389
+ /* Without paging there is no page a view could carry - a page three in
390
+ the view of a virtualised table would be a promise nobody redeems on
391
+ opening. */
392
+ ...!a && O.page > 1 ? { page: O.page } : {},
393
+ ...!a && m !== R ? { pageSize: m } : {},
394
+ ...N.length ? { hidden: N } : {},
395
+ ...D.length ? { order: D } : {},
396
+ ...Object.keys(H).length ? { widths: H } : {}
397
+ }),
398
+ [
399
+ a,
400
+ u,
401
+ f,
402
+ Q,
403
+ O.page,
404
+ m,
405
+ R,
406
+ N,
407
+ D,
408
+ H
409
+ ]
410
+ );
411
+ return {
412
+ ...O,
413
+ visible: $,
414
+ visibleLines: I,
415
+ virtual: a ? A : void 0,
416
+ view: ne,
417
+ search: u,
418
+ setSearch: ie,
419
+ sort: f,
420
+ toggleSort: de,
421
+ sortDirectionOf: le,
422
+ sortRankOf: te,
423
+ setPage: k,
424
+ pageSize: m,
425
+ setPageSize: ae,
426
+ expanded: g,
427
+ toggleRow: fe,
428
+ isExpanded: we,
429
+ hidden: N,
430
+ toggleColumn: be,
431
+ columnChoices: y,
432
+ order: D,
433
+ setOrder: T,
434
+ widths: x,
435
+ setWidth: ye,
436
+ selection: W
437
+ };
438
+ }
439
+ function vn() {
440
+ var t;
441
+ const e = import.meta;
442
+ return typeof ((t = e.env) == null ? void 0 : t.DEV) == "boolean" ? e.env.DEV : typeof process < "u" && (process != null && process.env) ? process.env.NODE_ENV !== "production" : !1;
443
+ }
444
+ const Mt = vn(), at = /* @__PURE__ */ new Set();
445
+ function pe(e, t) {
446
+ !Mt || at.has(e) || (at.add(e), console.warn(`@umriss-ui/table: ${t}`));
447
+ }
448
+ const _n = "_frame_1wkkr_11 _text_1hv7a_23", yn = "_children_1wkkr_23", Cn = "_scroll_1wkkr_29 _scroll_1hv7a_40", Sn = "_footerTarget_1wkkr_36", Nn = "_table_1wkkr_40", xn = "_th_1wkkr_48 _ring_1hv7a_65", An = "_sticky_1wkkr_63", Tn = "_td_1wkkr_71", Fn = "_rowHeader_1wkkr_83", On = "_compact_1wkkr_99", Ln = "_numeric_1wkkr_114", Rn = "_absent_1wkkr_126", Mn = "_striped_1wkkr_130", Vn = "_stickyCell_1wkkr_154", Dn = "_sortButton_1wkkr_166 _ring_1hv7a_65", In = "_sortIndicator_1wkkr_191", Pn = "_sortArrow_1wkkr_198", Gn = "_sortArrowDesc_1wkkr_202", En = "_sortActive_1wkkr_210", Bn = "_sortRank_1wkkr_216", zn = "_thFlex_1wkkr_224", jn = "_footerKind_1wkkr_245", Hn = "_emptyCell_1wkkr_253", $n = "_empty_1wkkr_253", Kn = "_emptyTitle_1wkkr_269", Wn = "_skeleton_1wkkr_276", qn = "_toolbar_1wkkr_304 _text_1hv7a_23", Yn = "_toolbarGroup_1wkkr_318", Un = "_toolbarInfo_1wkkr_335", Xn = "_pagination_1wkkr_341 _text_1hv7a_23", Jn = "_paginationControls_1wkkr_354", Qn = "_pageSize_1wkkr_361", Zn = "_paginationStatus_1wkkr_373", eo = "_filterButton_1wkkr_382 _ring_1hv7a_65", to = "_filterActive_1wkkr_405", no = "_filterPanel_1wkkr_410", oo = "_filterContent_1wkkr_423 _scroll_1hv7a_40", ro = "_filterFooter_1wkkr_434", so = "_filterLabel_1wkkr_448", io = "_filterValue_1wkkr_458", ao = "_filteredCount_1wkkr_464", lo = "_rangeFields_1wkkr_475", co = "_rangePeriod_1wkkr_485", uo = "_conditions_1wkkr_491", fo = "_conditionButton_1wkkr_497", ho = "_condition_1wkkr_491", go = "_columnsPanel_1wkkr_521", po = "_columnsList_1wkkr_529", mo = "_columnsEntry_1wkkr_538", wo = "_move_1wkkr_550", bo = "_groupingChoice_1wkkr_585", ko = "_groupingHeading_1wkkr_591", vo = "_groupingOptions_1wkkr_600", _o = "_groupingOption_1wkkr_600 _ring_1hv7a_65", yo = "_groupingLevel_1wkkr_639", Co = "_groupingTag_1wkkr_644", So = "_groupingTrigger_1wkkr_651", No = "_groupingPrefix_1wkkr_656", xo = "_groupingPath_1wkkr_661", Ao = "_groupingSeparator_1wkkr_665", To = "_groupHeader_1wkkr_682", Fo = "_spanCell_1wkkr_723", Oo = "_groupFolded_1wkkr_772", Lo = "_spanValue_1wkkr_776", Ro = "_groupLabel_1wkkr_777", Mo = "_spanText_1wkkr_789", Vo = "_groupValue_1wkkr_790", Do = "_groupCount_1wkkr_797", Io = "_continued_1wkkr_811", Po = "_spanSelect_1wkkr_842", Go = "_fold_1wkkr_856", Eo = "_foldClosed_1wkkr_888", Bo = "_foldedCount_1wkkr_898", zo = "_shareHost_1wkkr_906", jo = "_shareBar_1wkkr_913", Ho = "_expander_1wkkr_925", $o = "_expanderOpen_1wkkr_956", Ko = "_detailRow_1wkkr_960", Wo = "_detailCell_1wkkr_960", qo = "_actionsCell_1wkkr_968", Yo = "_actions_1wkkr_968", Uo = "_grip_1wkkr_996", Xo = "_virtualBody_1wkkr_1037", Jo = "_virtualRow_1wkkr_1045", Qo = "_fillerRow_1wkkr_1050", Zo = "_control_1wkkr_145", d = {
449
+ frame: _n,
450
+ children: yn,
451
+ scroll: Cn,
452
+ footerTarget: Sn,
453
+ table: Nn,
454
+ th: xn,
455
+ sticky: An,
456
+ td: Tn,
457
+ rowHeader: Fn,
458
+ compact: On,
459
+ numeric: Ln,
460
+ absent: Rn,
461
+ striped: Mn,
462
+ stickyCell: Vn,
463
+ sortButton: Dn,
464
+ sortIndicator: In,
465
+ sortArrow: Pn,
466
+ sortArrowDesc: Gn,
467
+ sortActive: En,
468
+ sortRank: Bn,
469
+ thFlex: zn,
470
+ footerKind: jn,
471
+ emptyCell: Hn,
472
+ empty: $n,
473
+ emptyTitle: Kn,
474
+ skeleton: Wn,
475
+ toolbar: qn,
476
+ toolbarGroup: Yn,
477
+ toolbarInfo: Un,
478
+ pagination: Xn,
479
+ paginationControls: Jn,
480
+ pageSize: Qn,
481
+ paginationStatus: Zn,
482
+ filterButton: eo,
483
+ filterActive: to,
484
+ filterPanel: no,
485
+ filterContent: oo,
486
+ filterFooter: ro,
487
+ filterLabel: so,
488
+ filterValue: io,
489
+ filteredCount: ao,
490
+ rangeFields: lo,
491
+ rangePeriod: co,
492
+ conditions: uo,
493
+ conditionButton: fo,
494
+ condition: ho,
495
+ columnsPanel: go,
496
+ columnsList: po,
497
+ columnsEntry: mo,
498
+ move: wo,
499
+ groupingChoice: bo,
500
+ groupingHeading: ko,
501
+ groupingOptions: vo,
502
+ groupingOption: _o,
503
+ groupingLevel: yo,
504
+ groupingTag: Co,
505
+ groupingTrigger: So,
506
+ groupingPrefix: No,
507
+ groupingPath: xo,
508
+ groupingSeparator: Ao,
509
+ groupHeader: To,
510
+ spanCell: Fo,
511
+ groupFolded: Oo,
512
+ spanValue: Lo,
513
+ groupLabel: Ro,
514
+ spanText: Mo,
515
+ groupValue: Vo,
516
+ groupCount: Do,
517
+ continued: Io,
518
+ spanSelect: Po,
519
+ fold: Go,
520
+ foldClosed: Eo,
521
+ foldedCount: Bo,
522
+ shareHost: zo,
523
+ shareBar: jo,
524
+ expander: Ho,
525
+ expanderOpen: $o,
526
+ detailRow: Ko,
527
+ detailCell: Wo,
528
+ actionsCell: qo,
529
+ actions: Yo,
530
+ grip: Uo,
531
+ virtualBody: Xo,
532
+ virtualRow: Jo,
533
+ fillerRow: Qo,
534
+ control: Zo
535
+ };
536
+ function Xs(e) {
537
+ return e;
538
+ }
539
+ const Ne = /* @__PURE__ */ new WeakMap();
540
+ function Vt(e, t) {
541
+ return Ne.set(e, t), e;
542
+ }
543
+ const er = (e) => Ne.has(e);
544
+ function me(e) {
545
+ return e === "list" ? sr : e === "range" ? hr : typeof e == "object" && e !== null ? e : void 0;
546
+ }
547
+ function Dt(e, t) {
383
548
  if (t == null) return "empty";
384
- const n = de.get(e);
549
+ const n = Ne.get(e);
385
550
  return n ? n.isCondition(t) ? n.isEmpty(t) ? "empty" : "effective" : "foreign" : "effective";
386
551
  }
387
- function Jn(e, t, n) {
552
+ function tr(e, t, n) {
388
553
  var o;
389
- return U(t) ? ((o = de.get(e)) == null ? void 0 : o.absentMatches(n)) ?? !1 : e.matches(t, n);
554
+ return Y(t) ? ((o = Ne.get(e)) == null ? void 0 : o.absentMatches(n)) ?? !1 : e.matches(t, n);
390
555
  }
391
- function Qn(e, t, n) {
392
- const o = de.get(e);
556
+ function nr(e, t, n) {
557
+ const o = Ne.get(e);
393
558
  return o ? o.describeIn(t, n) : e.describe(t);
394
559
  }
395
- const De = (e) => e instanceof Date ? e.getTime() : typeof e == "number" ? e : void 0, tt = (e) => (t, n) => {
396
- const o = De(t.value), r = De(n.value);
560
+ const lt = (e) => e instanceof Date ? e.getTime() : typeof e == "number" ? e : void 0, It = (e) => (t, n) => {
561
+ const o = lt(t.value), r = lt(n.value);
397
562
  return o !== void 0 && r !== void 0 ? o - r : e.compareText(t.text, n.text);
398
563
  };
399
- function Zn(e, t, n) {
564
+ function or(e, t, n) {
400
565
  const o = /* @__PURE__ */ new Map();
401
566
  let r = !1;
402
- for (const s of e) {
403
- const l = t(s);
404
- if (U(l)) {
567
+ for (const i of e) {
568
+ const a = t(i);
569
+ if (Y(a)) {
405
570
  r = !0;
406
571
  continue;
407
572
  }
408
- const a = l instanceof Date ? `date:${l.getTime()}` : typeof l == "object" || typeof l == "function" ? l : `${typeof l}:${String(l)}`;
409
- o.has(a) || o.set(a, l);
573
+ const c = a instanceof Date ? `date:${a.getTime()}` : typeof a == "object" || typeof a == "function" ? a : `${typeof a}:${String(a)}`;
574
+ o.has(c) || o.set(c, a);
410
575
  }
411
- return { values: [...o.values()].map((s) => ({ value: s, text: String(s) })).sort(tt(n)).map(({ value: s }) => s), absent: r };
576
+ return { values: [...o.values()].map((i) => ({ value: i, text: String(i) })).sort(It(n)).map(({ value: i }) => i), absent: r };
412
577
  }
413
- const Ve = /* @__PURE__ */ new WeakMap();
414
- function Se(e) {
415
- let t = Ve.get(e);
416
- return t || (t = new Set(e.map(le)), Ve.set(e, t)), t;
578
+ const ct = /* @__PURE__ */ new WeakMap();
579
+ function je(e) {
580
+ let t = ct.get(e);
581
+ return t || (t = new Set(e.map(ge)), ct.set(e, t)), t;
417
582
  }
418
- const Ne = (e, t) => U(e) ? t.wording.cellAbsentValue : ae(e, t.format, t.formats, t.wording) ?? String(e);
419
- function eo({
583
+ const He = (e, t) => Y(e) ? t.wording.cellAbsentValue : _e(e, t.format, t.formats, t.wording) ?? String(e);
584
+ function rr({
420
585
  condition: e,
421
586
  setCondition: t,
422
587
  values: n,
423
588
  absentOccurs: o = !1,
424
589
  format: r
425
590
  }) {
426
- const i = te(), s = $(), l = V(() => e ?? [], [e]), a = V(() => {
427
- const h = { formats: i, wording: s, format: r }, _ = n.map((v) => ({ key: le(v), text: Ne(v, h), value: v }));
428
- _.sort(tt(i));
429
- const g = new Set(_.map((v) => v.key)), p = l.filter((v) => !U(v) && !g.has(le(v))).map((v) => ({ key: le(v), text: Ne(v, h), value: v })), b = o || l.some(U) ? [{ key: Re, text: s.cellAbsentValue, value: null }] : [];
430
- return [..._, ...p, ...b];
431
- }, [n, l, o, r, i, s]), u = Se(l), d = (h) => {
432
- const _ = u.has(h.key) ? l.filter((g) => le(g) !== h.key) : [...l, h.value];
433
- t(_.length > 0 ? _ : null);
591
+ const s = ue(), i = U(), a = j(() => e ?? [], [e]), c = j(() => {
592
+ const f = { formats: s, wording: i, format: r }, b = n.map((w) => ({ key: ge(w), text: He(w, f), value: w }));
593
+ b.sort(It(s));
594
+ const p = new Set(b.map((w) => w.key)), k = a.filter((w) => !Y(w) && !p.has(ge(w))).map((w) => ({ key: ge(w), text: He(w, f), value: w })), m = o || a.some(Y) ? [{ key: Xe, text: i.cellAbsentValue, value: null }] : [];
595
+ return [...b, ...k, ...m];
596
+ }, [n, a, o, r, s, i]), u = je(a), h = (f) => {
597
+ const b = u.has(f.key) ? a.filter((p) => ge(p) !== f.key) : [...a, f.value];
598
+ t(b.length > 0 ? b : null);
434
599
  };
435
- return /* @__PURE__ */ c("div", { className: f.filterContent, children: a.map((h) => /* @__PURE__ */ c(
436
- ge,
600
+ return /* @__PURE__ */ l("div", { className: d.filterContent, children: c.map((f) => /* @__PURE__ */ l(
601
+ Se,
437
602
  {
438
- label: h.text,
439
- checked: u.has(h.key),
440
- onChange: () => d(h)
603
+ label: f.text,
604
+ checked: u.has(f.key),
605
+ onChange: () => h(f)
441
606
  },
442
- h.key
607
+ f.key
443
608
  )) });
444
609
  }
445
- const to = Ze(
610
+ const sr = Vt(
446
611
  {
447
- matches: (e, t) => Se(t).has(le(e)),
448
- Input: eo,
449
- describe: (e) => e.map((t) => U(t) ? "–" : String(t)).join(", ")
612
+ matches: (e, t) => je(t).has(ge(e)),
613
+ Input: rr,
614
+ describe: (e) => e.map((t) => Y(t) ? "–" : String(t)).join(", ")
450
615
  },
451
616
  {
452
617
  isCondition: (e) => Array.isArray(e),
453
618
  isEmpty: (e) => e.length === 0,
454
- absentMatches: (e) => Se(e).has(Re),
619
+ absentMatches: (e) => je(e).has(Xe),
455
620
  /* From three values on the first two and how many more: a condition is one
456
621
  line in the table toolbar, not a list. */
457
622
  describeIn: (e, t) => {
458
- const n = e.map((r) => Ne(r, t));
623
+ const n = e.map((r) => He(r, t));
459
624
  if (n.length <= 2) return n.join(", ");
460
625
  const o = n.length - 2;
461
626
  return `${n.slice(0, 2).join(", ")} ${t.wording.moreValues(o, t.formats.count(o))}`;
462
627
  }
463
628
  }
464
- ), no = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()).getTime(), oo = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + 1).getTime(), ce = (e) => typeof e == "number" && Number.isFinite(e), ee = (e) => e instanceof Date && !Number.isNaN(e.getTime()), ro = (e) => ee(e) ? no(e) : ce(e) ? e : void 0, so = (e) => ee(e) ? { value: oo(e), open: !0 } : ce(e) ? { value: e, open: !1 } : void 0, fe = (e, t) => ee(e) ? t.formats.date(e) : ae(e, t.format, t.formats, t.wording) ?? String(e);
465
- function io({ condition: e, setCondition: t }) {
466
- const n = $(), [o, r] = P(null), i = o !== null, s = o ? o.from : ce(e == null ? void 0 : e.from) ? e.from : null, l = o ? o.to : ce(e == null ? void 0 : e.to) ? e.to : null, a = (u, d) => {
467
- const h = { from: s, to: l, [u]: d };
468
- if (h.from !== null && h.to !== null && h.from > h.to) {
469
- r(h);
629
+ ), ir = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()).getTime(), ar = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + 1).getTime(), ve = (e) => typeof e == "number" && Number.isFinite(e), ce = (e) => e instanceof Date && !Number.isNaN(e.getTime()), lr = (e) => ce(e) ? ir(e) : ve(e) ? e : void 0, cr = (e) => ce(e) ? { value: ar(e), open: !0 } : ve(e) ? { value: e, open: !1 } : void 0, Ae = (e, t) => ce(e) ? t.formats.date(e) : _e(e, t.format, t.formats, t.wording) ?? String(e);
630
+ function ur({ condition: e, setCondition: t }) {
631
+ const n = U(), [o, r] = z(null), s = o !== null, i = o ? o.from : ve(e == null ? void 0 : e.from) ? e.from : null, a = o ? o.to : ve(e == null ? void 0 : e.to) ? e.to : null, c = (u, h) => {
632
+ const f = { from: i, to: a, [u]: h };
633
+ if (f.from !== null && f.to !== null && f.from > f.to) {
634
+ r(f);
470
635
  return;
471
636
  }
472
- if (r(null), h.from === null && h.to === null) {
637
+ if (r(null), f.from === null && f.to === null) {
473
638
  t(null);
474
639
  return;
475
640
  }
476
641
  t({
477
- ...h.from !== null ? { from: h.from } : {},
478
- ...h.to !== null ? { to: h.to } : {}
642
+ ...f.from !== null ? { from: f.from } : {},
643
+ ...f.to !== null ? { to: f.to } : {}
479
644
  });
480
645
  };
481
- return /* @__PURE__ */ x("div", { className: f.rangeFields, children: [
482
- /* @__PURE__ */ c(Ee, { label: n.filterFrom, children: /* @__PURE__ */ c(Pe, { size: "sm", value: s, invalid: i, onChange: (u) => a("from", u) }) }),
483
- /* @__PURE__ */ c(Ee, { label: n.filterTo, error: i ? n.rangeInvalid : void 0, children: /* @__PURE__ */ c(Pe, { size: "sm", value: l, onChange: (u) => a("to", u) }) })
646
+ return /* @__PURE__ */ L("div", { className: d.rangeFields, children: [
647
+ /* @__PURE__ */ l(rt, { label: n.filterFrom, children: /* @__PURE__ */ l(st, { size: "sm", value: i, invalid: s, onChange: (u) => c("from", u) }) }),
648
+ /* @__PURE__ */ l(rt, { label: n.filterTo, error: s ? n.rangeInvalid : void 0, children: /* @__PURE__ */ l(st, { size: "sm", value: a, onChange: (u) => c("to", u) }) })
484
649
  ] });
485
650
  }
486
- function lo({ condition: e, setCondition: t }) {
487
- const n = ee(e == null ? void 0 : e.from) && ee(e == null ? void 0 : e.to) ? { from: e.from, to: e.to } : null;
488
- return /* @__PURE__ */ c("div", { className: f.rangePeriod, children: /* @__PURE__ */ c(
489
- yt,
651
+ function dr({ condition: e, setCondition: t }) {
652
+ const n = ce(e == null ? void 0 : e.from) && ce(e == null ? void 0 : e.to) ? { from: e.from, to: e.to } : null;
653
+ return /* @__PURE__ */ l("div", { className: d.rangePeriod, children: /* @__PURE__ */ l(
654
+ Zt,
490
655
  {
491
656
  size: "sm",
492
657
  clearable: !0,
@@ -495,46 +660,46 @@ function lo({ condition: e, setCondition: t }) {
495
660
  }
496
661
  ) });
497
662
  }
498
- function co(e) {
499
- return e.kind === "date" ? /* @__PURE__ */ c(lo, { ...e }) : /* @__PURE__ */ c(io, { ...e });
663
+ function fr(e) {
664
+ return e.kind === "date" ? /* @__PURE__ */ l(dr, { ...e }) : /* @__PURE__ */ l(ur, { ...e });
500
665
  }
501
- const ao = Ze(
666
+ const hr = Vt(
502
667
  {
503
668
  matches: (e, t) => {
504
- const n = ee(e) ? e.getTime() : ce(e) ? e : void 0;
669
+ const n = ce(e) ? e.getTime() : ve(e) ? e : void 0;
505
670
  if (n === void 0) return !1;
506
- const o = ro(t.from), r = so(t.to);
671
+ const o = lr(t.from), r = cr(t.to);
507
672
  return !(o !== void 0 && n < o || r !== void 0 && (r.open ? n >= r.value : n > r.value));
508
673
  },
509
- Input: co,
674
+ Input: fr,
510
675
  describe: (e) => [e.from, e.to].map((t) => t === void 0 ? "" : String(t)).join("–")
511
676
  },
512
677
  {
513
678
  isCondition: (e) => typeof e != "object" || e === null || Array.isArray(e) || e instanceof Date ? !1 : Object.entries(e).every(
514
- ([n, o]) => (n === "from" || n === "to") && (o === void 0 || ce(o) || ee(o))
679
+ ([n, o]) => (n === "from" || n === "to") && (o === void 0 || ve(o) || ce(o))
515
680
  ),
516
681
  isEmpty: (e) => e.from === void 0 && e.to === void 0,
517
682
  absentMatches: () => !1,
518
683
  describeIn: (e, t) => {
519
684
  const { from: n, to: o } = e;
520
685
  if (n !== void 0 && o !== void 0) {
521
- const r = ee(n) && ee(o) && n.getFullYear() === o.getFullYear();
686
+ const r = ce(n) && ce(o) && n.getFullYear() === o.getFullYear();
522
687
  return t.wording.rangeFromTo(
523
- r ? t.formats.dateShort(n) : fe(n, t),
524
- fe(o, t)
688
+ r ? t.formats.dateShort(n) : Ae(n, t),
689
+ Ae(o, t)
525
690
  );
526
691
  }
527
- return n !== void 0 ? t.wording.rangeFrom(fe(n, t)) : o === void 0 ? "" : t.wording.rangeTo(fe(o, t));
692
+ return n !== void 0 ? t.wording.rangeFrom(Ae(n, t)) : o === void 0 ? "" : t.wording.rangeTo(Ae(o, t));
528
693
  }
529
694
  }
530
695
  );
531
- class He {
696
+ class Ge {
532
697
  constructor(t) {
533
- z(this, "entries", /* @__PURE__ */ new Map());
698
+ P(this, "entries", /* @__PURE__ */ new Map());
534
699
  /** Keys in the order of the running pass. */
535
- z(this, "pass", []);
700
+ P(this, "pass", []);
536
701
  /** Order from the markers in the DOM, after the last commit. */
537
- z(this, "dom", []);
702
+ P(this, "dom", []);
538
703
  this.markerAttribute = t;
539
704
  }
540
705
  note(t) {
@@ -555,12 +720,13 @@ class He {
555
720
  return this.dom = n, this.pass = n, o !== this.ordered().map((r) => r.key).join("|");
556
721
  }
557
722
  }
558
- const uo = (e) => JSON.stringify([
723
+ const ut = (e) => JSON.stringify([
559
724
  e.id,
560
725
  e.label,
561
726
  typeof e.value == "string" ? e.value : "ƒ",
562
727
  e.format,
563
- e.footer,
728
+ typeof e.aggregate == "function" ? "ƒ" : e.aggregate,
729
+ e.share,
564
730
  e.rowHeader,
565
731
  e.rightAligned,
566
732
  e.width,
@@ -572,51 +738,62 @@ const uo = (e) => JSON.stringify([
572
738
  typeof e.filter == "object" ? "own" : e.filter,
573
739
  !!e.presentation,
574
740
  !!e.ownSortValue,
575
- !!e.ownExportValue
576
- ]), fo = (e, t) => e == null ? void 0 : e[t];
577
- class ho {
741
+ !!e.ownExportValue,
742
+ !!e.ownGroupValue,
743
+ e.group,
744
+ e.groupable
745
+ ]), dt = (e, t) => e == null ? void 0 : e[t];
746
+ class gr {
578
747
  constructor() {
579
- z(this, "columns", new He("data-umriss-column"));
580
- z(this, "actions", new He("data-umriss-action"));
581
- z(this, "signatures", /* @__PURE__ */ new Map());
748
+ P(this, "columns", new Ge("data-umriss-column"));
749
+ P(this, "actions", new Ge("data-umriss-action"));
750
+ /** The group keys: values to group by that are no column. */
751
+ P(this, "groupKeys", new Ge("data-umriss-groupkey"));
752
+ P(this, "signatures", /* @__PURE__ */ new Map());
582
753
  /** The row detail: the presentation of the `RowDetail` that registered last. */
583
- z(this, "detail", null);
754
+ P(this, "detail", null);
584
755
  /** How many `RowActions` stand right now. */
585
- z(this, "actionGroups", /* @__PURE__ */ new Set());
756
+ P(this, "actionGroups", /* @__PURE__ */ new Set());
586
757
  /** Whether the row header column sticks - it then stands first, on screen, in
587
758
  the column menu and in the export alike. */
588
- z(this, "stickyRowHeader", !1);
759
+ P(this, "stickyRowHeader", !1);
589
760
  /* Without a pagination bar the table does not page: one that stops quietly at
590
761
  the tenth row because nobody put one there is a trap (found at the alarm
591
762
  list, umriss-table 13). Without a table toolbar, but with a search or a
592
763
  column filter, the table puts one there itself (table-filters 04):
593
764
  conditions and the ratio need a place, and a place that came into being
594
765
  only with the first condition would shift the table. */
595
- z(this, "parts", /* @__PURE__ */ new Map());
766
+ P(this, "parts", /* @__PURE__ */ new Map());
596
767
  /** The element the table's children stand in - for the markers. */
597
- z(this, "children", null);
598
- z(this, "hook", null);
599
- z(this, "structure", 0);
600
- z(this, "values", 0);
601
- z(this, "presentation", 0);
602
- z(this, "hookVersion", 0);
603
- z(this, "reported", "");
604
- z(this, "listeners", /* @__PURE__ */ new Set());
768
+ P(this, "children", null);
769
+ P(this, "hook", null);
770
+ P(this, "structure", 0);
771
+ P(this, "values", 0);
772
+ P(this, "presentation", 0);
773
+ P(this, "hookVersion", 0);
774
+ P(this, "reported", "");
775
+ P(this, "listeners", /* @__PURE__ */ new Set());
605
776
  /* --- Subscription ------------------------------------------------------------- */
606
- z(this, "subscribe", (t) => (this.listeners.add(t), () => {
777
+ P(this, "subscribe", (t) => (this.listeners.add(t), () => {
607
778
  this.listeners.delete(t);
608
779
  }));
609
780
  /** What the hook reads. */
610
- z(this, "structureVersion", () => this.structure);
781
+ P(this, "structureVersion", () => this.structure);
611
782
  /** What body and unbound parts read. Every counter only rises, so the sum
612
783
  rises exactly when one of them rises. */
613
- z(this, "bodyVersion", () => this.structure + this.values + this.presentation + this.hookVersion);
784
+ P(this, "bodyVersion", () => this.structure + this.values + this.presentation + this.hookVersion);
785
+ /** The group whose fold takes the focus after its line was drawn anew - a
786
+ folded span is a new row, and the focus would otherwise be lost. */
787
+ P(this, "pendingFoldFocus", null);
788
+ /** Whether the table lets itself be grouped at all (`<Table groupable>`). */
789
+ P(this, "tableGroupable", !0);
790
+ P(this, "groupingCache", null);
614
791
  /* --- The kind of a column ------------------------------------------------------- */
615
- z(this, "kinds", /* @__PURE__ */ new Map());
792
+ P(this, "kinds", /* @__PURE__ */ new Map());
616
793
  /* --- The model ------------------------------------------------------------------ */
617
- z(this, "modelCache", null);
618
- z(this, "projectionCache", null);
619
- z(this, "unpaged", null);
794
+ P(this, "modelCache", null);
795
+ P(this, "projectionCache", null);
796
+ P(this, "unpaged", null);
620
797
  }
621
798
  /** Reports from a layout effect what has changed since the last report.
622
799
  Without a change nothing happens. */
@@ -631,30 +808,30 @@ class ho {
631
808
  /** The table renders: a new pass begins. Idempotent - a second call within
632
809
  the same pass clears what is empty anyway. */
633
810
  beginPass() {
634
- this.columns.pass = [], this.actions.pass = [];
811
+ this.columns.pass = [], this.actions.pass = [], this.groupKeys.pass = [];
635
812
  }
636
813
  /** After the commit: check the order against the DOM. */
637
814
  checkOrder() {
638
- this.children && (this.columns.check(this.children) && this.structure++, this.actions.check(this.children) && this.structure++);
815
+ this.children && (this.columns.check(this.children) && this.structure++, this.actions.check(this.children) && this.structure++, this.groupKeys.check(this.children) && this.structure++);
639
816
  }
640
817
  /* --- Columns ------------------------------------------------------------------ */
641
818
  /** A column registers during the render. Idempotent: the same spec changes no
642
819
  version. */
643
820
  registerColumn(t, n) {
644
- const o = this.columns.entries.get(t), r = uo(n);
821
+ const o = this.columns.entries.get(t), r = ut(n);
645
822
  if (o) {
646
- const i = o.spec;
647
- this.signatures.get(t) !== r && this.structure++, (i.value !== n.value || i.ownSortValue !== n.ownSortValue) && this.values++, (i.presentation !== n.presentation || i.ownExportValue !== n.ownExportValue) && this.presentation++, o.spec = n;
823
+ const s = o.spec;
824
+ this.signatures.get(t) !== r && this.structure++, (s.value !== n.value || s.ownSortValue !== n.ownSortValue || s.ownGroupValue !== n.ownGroupValue) && this.values++, (s.presentation !== n.presentation || s.ownExportValue !== n.ownExportValue || s.aggregate !== n.aggregate) && this.presentation++, o.spec = n;
648
825
  } else {
649
- const i = {
826
+ const s = {
650
827
  key: t,
651
828
  spec: n,
652
- read: (s) => {
653
- const l = i.spec.value;
654
- return typeof l == "string" ? fo(s, l) : l(s);
829
+ read: (i) => {
830
+ const a = s.spec.value;
831
+ return typeof a == "string" ? dt(i, a) : a(i);
655
832
  }
656
833
  };
657
- this.columns.entries.set(t, i), this.structure++;
834
+ this.columns.entries.set(t, s), this.structure++;
658
835
  }
659
836
  this.signatures.set(t, r), this.columns.note(t), this.checkUniqueness();
660
837
  }
@@ -670,8 +847,8 @@ class ho {
670
847
  const t = /* @__PURE__ */ new Set();
671
848
  let n = 0;
672
849
  for (const { spec: o } of this.columns.entries.values())
673
- t.has(o.id) && re(`id:${o.id}`, `Two columns carry the id "${o.id}". The second one is passed over.`), t.add(o.id), o.rowHeader && n++;
674
- n > 1 && re("rowHeader", "More than one column is `rowHeader`. A table has at most one row header; the first one holds.");
850
+ t.has(o.id) && pe(`id:${o.id}`, `Two columns carry the id "${o.id}". The second one is passed over.`), t.add(o.id), o.rowHeader && n++;
851
+ n > 1 && pe("rowHeader", "More than one column is `rowHeader`. A table has at most one row header; the first one holds.");
675
852
  }
676
853
  /** The table says during the render whether its row header sticks. Idempotent. */
677
854
  setStickyRowHeader(t) {
@@ -696,11 +873,99 @@ class ho {
696
873
  rowHeader() {
697
874
  return this.orderedColumns().find((t) => t.spec.rowHeader);
698
875
  }
876
+ /* --- Group keys and the grouping ---------------------------------------------- */
877
+ /** A group key registers during the render, as a column does. Idempotent. */
878
+ registerGroupKey(t, n) {
879
+ const o = this.groupKeys.entries.get(t), r = ut(n);
880
+ if (o)
881
+ this.signatures.get(t) !== r && this.structure++, (o.spec.value !== n.value || o.spec.ownGroupValue !== n.ownGroupValue) && this.values++, o.spec = n;
882
+ else {
883
+ const s = {
884
+ key: t,
885
+ spec: n,
886
+ read: (i) => {
887
+ const a = s.spec.value;
888
+ return typeof a == "string" ? dt(i, a) : a(i);
889
+ }
890
+ };
891
+ this.groupKeys.entries.set(t, s), this.structure++;
892
+ }
893
+ this.signatures.set(t, r), this.groupKeys.note(t);
894
+ }
895
+ ensureGroupKey(t, n) {
896
+ this.groupKeys.entries.has(t) || this.registerGroupKey(t, n);
897
+ }
898
+ removeGroupKey(t) {
899
+ this.groupKeys.entries.delete(t) && (this.signatures.delete(t), this.kinds.delete(t), this.structure++);
900
+ }
901
+ requestFoldFocus(t) {
902
+ this.pendingFoldFocus = t;
903
+ }
904
+ /** Whether this group's fold is to take the focus now - once. */
905
+ takeFoldFocus(t) {
906
+ return this.pendingFoldFocus !== t ? !1 : (this.pendingFoldFocus = null, !0);
907
+ }
908
+ setTableGroupable(t) {
909
+ this.tableGroupable !== t && (this.tableGroupable = t, this.structure++);
910
+ }
911
+ /** Everything a table can be grouped by: its columns, then its group keys. */
912
+ groupingEntries(t) {
913
+ if (!this.tableGroupable) return [];
914
+ const n = /* @__PURE__ */ new Set();
915
+ return [...this.orderedColumns(), ...this.groupKeys.ordered()].filter((o) => {
916
+ if (n.has(o.spec.id)) return !1;
917
+ n.add(o.spec.id);
918
+ const { groupable: r, ownGroupValue: s } = o.spec;
919
+ return r ?? (this.kindOf(o, t) !== "other" || !!s);
920
+ });
921
+ }
922
+ /** The ids of a grouping that something groupable carries - at most three,
923
+ each once. */
924
+ effectiveGrouping(t, n) {
925
+ const o = new Set(this.groupingEntries(n).map((r) => r.spec.id));
926
+ return [...new Set(t)].filter((r) => o.has(r)).slice(0, Qe);
927
+ }
928
+ /** The levels and aggregates for the model - the same identity as long as
929
+ nothing changed that they read. */
930
+ groupingModel(t, n) {
931
+ var a;
932
+ const o = [t.join("|"), this.structure, this.values].join(":");
933
+ if (((a = this.groupingCache) == null ? void 0 : a.key) === o) return this.groupingCache;
934
+ const r = this.groupingEntries(n), s = t.map((c) => r.find((u) => u.spec.id === c)).filter((c) => c !== void 0).map((c) => ({
935
+ id: c.spec.id,
936
+ value: (u) => {
937
+ const h = c.read(u);
938
+ if (h == null) return;
939
+ const { ownGroupValue: f, group: b } = c.spec;
940
+ return f ? f(h) : b ? hn(b)(h) : h;
941
+ },
942
+ /* A value of one's own is a name; its groups stand by what they hold. */
943
+ order: c.spec.ownGroupValue ? (u) => ze(c.read(u), c.spec.ownSortValue) : void 0
944
+ })), i = this.orderedColumns().filter((c) => c.spec.aggregate !== void 0).map(
945
+ (c) => ({
946
+ id: c.spec.id,
947
+ read: c.read,
948
+ /* Read with the latest spec on every call: an aggregate of one's own
949
+ written in the call is a new function on every render. */
950
+ aggregate: typeof c.spec.aggregate == "function" ? (u, h) => c.spec.aggregate(u, h) : c.spec.aggregate
951
+ })
952
+ );
953
+ return this.groupingCache = { key: o, levels: s, aggregates: i }, this.groupingCache;
954
+ }
955
+ /** The grouping for the body's own pass: resolved against the columns of
956
+ this pass, so that even the first frame stands grouped. */
957
+ groupingFor(t) {
958
+ var r;
959
+ const n = this.effectiveGrouping(t.publicSnapshot.grouping, t.rows);
960
+ if (n.length === 0) return;
961
+ const o = this.groupingModel(n, t.rows);
962
+ return ((r = t.grouping) == null ? void 0 : r.levels) === o.levels ? t.grouping : { ...o, folded: t.folded, compareText: t.formats.compareText };
963
+ }
699
964
  /** The kind of a column, read off the rows passed in and remembered. */
700
965
  kindOf(t, n) {
701
966
  const o = this.kinds.get(t.key);
702
967
  if (o && o.rows === n && o.value === t.spec.value) return o.kind;
703
- const r = Mt(n, t.read);
968
+ const r = Ft(n, t.read);
704
969
  return this.kinds.set(t.key, { rows: n, value: t.spec.value, kind: r }), r;
705
970
  }
706
971
  /** Can it be sorted by this column? Without a statement: when its value is
@@ -714,42 +979,45 @@ class ho {
714
979
  that the model reads - that is how the body recognises whether it may take
715
980
  over the hook's calculation. */
716
981
  modelColumns(t, n) {
717
- var s;
718
- const o = this.orderedColumns(), r = [this.structure, this.values, o.map((l) => l.key).join("|")].join(":");
719
- if (((s = this.modelCache) == null ? void 0 : s.key) === r && this.modelCache.rows === t && this.modelCache.formats === n)
982
+ var i;
983
+ const o = this.orderedColumns(), r = [this.structure, this.values, o.map((a) => a.key).join("|")].join(":");
984
+ if (((i = this.modelCache) == null ? void 0 : i.key) === r && this.modelCache.rows === t && this.modelCache.formats === n)
720
985
  return this.modelCache.columns;
721
- const i = o.map((l) => {
722
- const { spec: a } = l, u = this.kindOf(l, t), d = this.isSortable(l, t), h = a.searchable ?? u === "text", _ = (g) => Je(l.read(g), a.ownSortValue);
986
+ const s = o.map((a) => {
987
+ const { spec: c } = a, u = this.kindOf(a, t), h = this.isSortable(a, t), f = c.searchable ?? u === "text", b = (p) => ze(a.read(p), c.ownSortValue);
723
988
  return {
724
- id: a.id,
725
- label: a.label,
726
- value: d || h ? _ : void 0,
989
+ id: c.id,
990
+ label: c.label,
991
+ value: h || f ? b : void 0,
727
992
  /* Text sorts with the provider's comparison, not with the built-in
728
993
  German one (spec, the table of defaults). */
729
- compare: u === "text" && !a.ownSortValue ? (g, p) => n.compareText(String(_(g)), String(_(p))) : void 0,
730
- searchable: h,
731
- hideable: !a.rowHeader,
732
- resizable: a.resizable,
733
- width: a.width
994
+ compare: u === "text" && !c.ownSortValue ? (p, k) => n.compareText(String(b(p)), String(b(k))) : void 0,
995
+ searchable: f,
996
+ hideable: !c.rowHeader,
997
+ resizable: c.resizable,
998
+ width: c.width
734
999
  };
735
1000
  });
736
- return this.modelCache = { key: r, rows: t, formats: n, columns: i }, i;
1001
+ return this.modelCache = { key: r, rows: t, formats: n, columns: s }, s;
737
1002
  }
738
1003
  /** The projection for the body. Without a pagination bar it is a single page
739
1004
  holding all the filtered rows. */
740
1005
  projection() {
741
1006
  var n;
742
1007
  const t = this.computedProjection();
743
- return this.paginates() || this.hook.companion.virtual ? t : (((n = this.unpaged) == null ? void 0 : n.from) !== t && (this.unpaged = { from: t, projection: { ...t, visible: t.filtered, page: 1, pageCount: 1 } }), this.unpaged.projection);
1008
+ return this.paginates() || this.hook.companion.virtual ? t : (((n = this.unpaged) == null ? void 0 : n.from) !== t && (this.unpaged = {
1009
+ from: t,
1010
+ projection: { ...t, visible: t.filtered, visibleLines: t.lines, page: 1, pageCount: 1 }
1011
+ }), this.unpaged.projection);
744
1012
  }
745
1013
  /** The hook's projection when it calculated with the same columns - otherwise
746
1014
  a new one, with the columns of this pass. */
747
1015
  computedProjection() {
748
- var l;
1016
+ var a;
749
1017
  const t = this.hook, n = this.modelColumns(t.rows, t.formats), o = t.companion;
750
1018
  if (n === t.modelColumns)
751
1019
  return o;
752
- if (((l = this.projectionCache) == null ? void 0 : l.hook) === t && this.projectionCache.columns === n) return this.projectionCache.projection;
1020
+ if (((a = this.projectionCache) == null ? void 0 : a.hook) === t && this.projectionCache.columns === n) return this.projectionCache.projection;
753
1021
  const r = {
754
1022
  search: o.search,
755
1023
  filter: t.filter,
@@ -757,9 +1025,10 @@ class ho {
757
1025
  page: o.page,
758
1026
  pageSize: o.virtual ? 0 : o.pageSize,
759
1027
  hidden: o.hidden,
760
- order: o.order
761
- }, i = Oe(t.admitted, n, r), s = o.virtual ? { ...i, visible: i.filtered.slice(o.virtual.from, o.virtual.to) } : i;
762
- return this.projectionCache = { hook: t, columns: n, projection: s }, s;
1028
+ order: o.order,
1029
+ grouping: this.groupingFor(t)
1030
+ }, s = tt(t.admitted, n, r), i = o.virtual ? pr(s, o.virtual.from, o.virtual.to) : s;
1031
+ return this.projectionCache = { hook: t, columns: n, projection: i }, i;
763
1032
  }
764
1033
  /* --- The hook's snapshot ---------------------------------------------------------- */
765
1034
  /** The hook deposits its snapshot during the render. Idempotent for the same
@@ -788,9 +1057,11 @@ class ho {
788
1057
  paginates() {
789
1058
  return this.count("pagination") > 0;
790
1059
  }
791
- /** Whether the table puts up a table toolbar of its own. */
1060
+ /** Whether the table puts up a table toolbar of its own - also while it is
1061
+ grouped: the tag that names and removes the grouping needs a place. */
792
1062
  needsOwnToolbar() {
793
- return this.count("toolbar") > 0 ? !1 : this.count("search") > 0 || this.orderedColumns().some((t) => se(t.spec.filter) !== void 0);
1063
+ var t;
1064
+ return this.count("toolbar") > 0 ? !1 : this.count("search") > 0 || this.orderedColumns().some((n) => me(n.spec.filter) !== void 0) || (((t = this.hook) == null ? void 0 : t.publicSnapshot.grouping.length) ?? 0) > 0;
794
1065
  }
795
1066
  /* --- Row detail ------------------------------------------------------------------- */
796
1067
  registerDetail(t, n) {
@@ -827,78 +1098,83 @@ class ho {
827
1098
  this.actions.entries.delete(t) && this.structure++;
828
1099
  }
829
1100
  }
830
- const nt = /* @__PURE__ */ new WeakMap(), mo = (e, t) => {
831
- nt.set(e, t);
832
- }, po = (e) => typeof e == "function" || typeof e == "object" && e !== null ? nt.get(e) : void 0, H = (...e) => e.filter(Boolean).join(" ");
833
- function ot({
1101
+ function pr(e, t, n) {
1102
+ if (!e.lines) return { ...e, visible: e.filtered.slice(t, n) };
1103
+ const o = e.lines.slice(t, n);
1104
+ return { ...e, visibleLines: o, visible: Ze(o) };
1105
+ }
1106
+ const Pt = /* @__PURE__ */ new WeakMap(), mr = (e, t) => {
1107
+ Pt.set(e, t);
1108
+ }, wr = (e) => typeof e == "function" || typeof e == "object" && e !== null ? Pt.get(e) : void 0, E = (...e) => e.filter(Boolean).join(" ");
1109
+ function Gt({
834
1110
  entry: e,
835
1111
  registry: t,
836
1112
  hook: n,
837
1113
  anchor: o,
838
1114
  focus: r,
839
- open: i,
840
- setOpen: s,
841
- panelId: l
1115
+ open: s,
1116
+ setOpen: i,
1117
+ panelId: a
842
1118
  }) {
843
- const a = $(), u = te(), { id: d, label: h, format: _ } = e.spec, { values: g, absent: p } = V(() => Zn(n.admitted, e.read, u), [n.admitted, e, u]), b = se(e.spec.filter);
844
- if (!b) return null;
845
- const v = n.publicSnapshot, m = b.Input, y = Xn(b) ? { absentOccurs: p, format: _, kind: t.kindOf(e, n.rows) } : {}, O = () => {
846
- var N;
847
- s(!1), (N = (r ?? o).current) == null || N.focus();
1119
+ const c = U(), u = ue(), { id: h, label: f, format: b } = e.spec, { values: p, absent: k } = j(() => or(n.admitted, e.read, u), [n.admitted, e, u]), m = me(e.spec.filter);
1120
+ if (!m) return null;
1121
+ const w = n.publicSnapshot, g = m.Input, v = er(m) ? { absentOccurs: k, format: b, kind: t.kindOf(e, n.rows) } : {}, N = () => {
1122
+ var C;
1123
+ i(!1), (C = (r ?? o).current) == null || C.focus();
848
1124
  };
849
- return /* @__PURE__ */ x(
850
- Ue,
1125
+ return /* @__PURE__ */ L(
1126
+ St,
851
1127
  {
852
- open: i,
853
- onOpenChange: s,
1128
+ open: s,
1129
+ onOpenChange: i,
854
1130
  anchorRef: o,
855
1131
  align: "end",
856
1132
  role: "dialog",
857
- ariaLabel: a.filterColumn(h),
858
- id: l,
859
- className: f.filterPanel,
1133
+ ariaLabel: c.filterColumn(f),
1134
+ id: a,
1135
+ className: d.filterPanel,
860
1136
  children: [
861
- /* @__PURE__ */ c(
862
- m,
1137
+ /* @__PURE__ */ l(
1138
+ g,
863
1139
  {
864
- condition: v.filter[d] ?? null,
865
- setCondition: (N) => v.setFilter(d, N),
866
- values: g,
867
- column: { id: d, label: h },
868
- ...y
1140
+ condition: w.filter[h] ?? null,
1141
+ setCondition: (C) => w.setFilter(h, C),
1142
+ values: p,
1143
+ column: { id: h, label: f },
1144
+ ...v
869
1145
  }
870
1146
  ),
871
- /* @__PURE__ */ x("div", { className: f.filterFooter, children: [
872
- /* @__PURE__ */ c(G, { size: "sm", variant: "ghost", onClick: () => v.setFilter(d, null), children: a.filterReset }),
873
- /* @__PURE__ */ c(G, { size: "sm", onClick: O, children: a.filterDone })
1147
+ /* @__PURE__ */ L("div", { className: d.filterFooter, children: [
1148
+ /* @__PURE__ */ l(ee, { size: "sm", variant: "ghost", onClick: () => w.setFilter(h, null), children: c.filterReset }),
1149
+ /* @__PURE__ */ l(ee, { size: "sm", onClick: N, children: c.filterDone })
874
1150
  ] })
875
1151
  ]
876
1152
  }
877
1153
  );
878
1154
  }
879
- function go({
1155
+ function br({
880
1156
  entry: e,
881
1157
  registry: t,
882
1158
  hook: n
883
1159
  }) {
884
- const o = $(), [r, i] = P(!1), s = oe(null), l = Z(), { id: a, label: u } = e.spec, d = a in n.publicSnapshot.filter;
885
- return /* @__PURE__ */ x(Q, { children: [
886
- /* @__PURE__ */ c(
1160
+ const o = U(), [r, s] = z(!1), i = Z(null), a = se(), { id: c, label: u } = e.spec, h = c in n.publicSnapshot.filter;
1161
+ return /* @__PURE__ */ L(J, { children: [
1162
+ /* @__PURE__ */ l(
887
1163
  "button",
888
1164
  {
889
- ref: s,
1165
+ ref: i,
890
1166
  type: "button",
891
- className: H(f.filterButton, d && f.filterActive),
1167
+ className: E(d.filterButton, h && d.filterActive),
892
1168
  "aria-label": o.filterColumn(u),
893
1169
  "aria-haspopup": "dialog",
894
1170
  "aria-expanded": r,
895
- "aria-controls": r ? l : void 0,
896
- onClick: () => i(!r),
897
- children: /* @__PURE__ */ c("svg", { viewBox: "0 0 14 14", width: "13", height: "13", "aria-hidden": "true", children: /* @__PURE__ */ c(
1171
+ "aria-controls": r ? a : void 0,
1172
+ onClick: () => s(!r),
1173
+ children: /* @__PURE__ */ l("svg", { viewBox: "0 0 14 14", width: "13", height: "13", "aria-hidden": "true", children: /* @__PURE__ */ l(
898
1174
  "path",
899
1175
  {
900
1176
  d: "M1.8 2.6h10.4L8.3 7.5v3.4l-2.6 1.1V7.5L1.8 2.6z",
901
- fill: d ? "currentColor" : "none",
1177
+ fill: h ? "currentColor" : "none",
902
1178
  stroke: "currentColor",
903
1179
  strokeWidth: "1.4",
904
1180
  strokeLinecap: "round",
@@ -907,167 +1183,531 @@ function go({
907
1183
  ) })
908
1184
  }
909
1185
  ),
910
- /* @__PURE__ */ c(
911
- ot,
1186
+ /* @__PURE__ */ l(
1187
+ Gt,
912
1188
  {
913
1189
  entry: e,
914
1190
  registry: t,
915
1191
  hook: n,
916
- anchor: s,
1192
+ anchor: i,
917
1193
  open: r,
918
- setOpen: i,
919
- panelId: l
1194
+ setOpen: s,
1195
+ panelId: a
920
1196
  }
921
1197
  )
922
1198
  ] });
923
1199
  }
924
- function bo({ registry: e, hook: t }) {
925
- const n = $(), o = te(), r = Object.entries(t.publicSnapshot.filter).flatMap(([i, s]) => {
926
- const l = e.columnById(i), a = l ? se(l.spec.filter) : void 0;
927
- if (!l || !a) return [];
928
- const u = { formats: o, wording: n, format: l.spec.format, kind: e.kindOf(l, t.rows) };
929
- return [{ entry: l, text: Qn(a, s, u) }];
1200
+ function kr({ registry: e, hook: t }) {
1201
+ const n = U(), o = ue(), r = Object.entries(t.publicSnapshot.filter).flatMap(([s, i]) => {
1202
+ const a = e.columnById(s), c = a ? me(a.spec.filter) : void 0;
1203
+ if (!a || !c) return [];
1204
+ const u = { formats: o, wording: n, format: a.spec.format, kind: e.kindOf(a, t.rows) };
1205
+ return [{ entry: a, text: nr(c, i, u) }];
930
1206
  });
931
- return r.length === 0 ? null : /* @__PURE__ */ c(Ct, { "aria-label": n.conditions, className: f.conditions, children: r.map(({ entry: i, text: s }) => /* @__PURE__ */ c(wo, { entry: i, text: s, registry: e, hook: t }, i.spec.id)) });
1207
+ return r.length === 0 ? null : /* @__PURE__ */ l(Nt, { "aria-label": n.conditions, className: d.conditions, children: r.map(({ entry: s, text: i }) => /* @__PURE__ */ l(vr, { entry: s, text: i, registry: e, hook: t }, s.spec.id)) });
932
1208
  }
933
- function wo({
1209
+ function vr({
934
1210
  entry: e,
935
1211
  text: t,
936
1212
  registry: n,
937
1213
  hook: o
938
1214
  }) {
939
- const r = $(), [i, s] = P(!1), l = oe(null), a = oe(null), u = Z(), { id: d, label: h } = e.spec;
940
- return /* @__PURE__ */ x(Q, { children: [
941
- /* @__PURE__ */ c(
942
- St,
1215
+ const r = U(), [s, i] = z(!1), a = Z(null), c = Z(null), u = se(), { id: h, label: f } = e.spec;
1216
+ return /* @__PURE__ */ L(J, { children: [
1217
+ /* @__PURE__ */ l(
1218
+ xt,
943
1219
  {
944
- ref: l,
945
- className: f.condition,
946
- onRemove: () => o.publicSnapshot.setFilter(d, null),
947
- removeLabel: r.removeConditionNamed(h, t),
948
- children: /* @__PURE__ */ x(
1220
+ ref: a,
1221
+ className: d.condition,
1222
+ onRemove: () => o.publicSnapshot.setFilter(h, null),
1223
+ removeLabel: r.removeConditionNamed(f, t),
1224
+ children: /* @__PURE__ */ L(
949
1225
  "button",
950
1226
  {
951
- ref: a,
1227
+ ref: c,
952
1228
  type: "button",
953
- className: f.conditionButton,
954
- "aria-label": r.editConditionNamed(h, t),
1229
+ className: d.conditionButton,
1230
+ "aria-label": r.editConditionNamed(f, t),
955
1231
  "aria-haspopup": "dialog",
956
- "aria-expanded": i,
957
- "aria-controls": i ? u : void 0,
958
- onClick: () => s(!i),
1232
+ "aria-expanded": s,
1233
+ "aria-controls": s ? u : void 0,
1234
+ onClick: () => i(!s),
959
1235
  children: [
960
- /* @__PURE__ */ c("span", { className: f.filterLabel, children: h }),
961
- /* @__PURE__ */ c("span", { className: f.filterValue, children: t })
1236
+ /* @__PURE__ */ l("span", { className: d.filterLabel, children: f }),
1237
+ /* @__PURE__ */ l("span", { className: d.filterValue, children: t })
962
1238
  ]
963
1239
  }
964
1240
  )
965
1241
  }
966
1242
  ),
967
- /* @__PURE__ */ c(
968
- ot,
1243
+ /* @__PURE__ */ l(
1244
+ Gt,
969
1245
  {
970
1246
  entry: e,
971
1247
  registry: n,
972
1248
  hook: o,
973
- anchor: l,
974
- focus: a,
975
- open: i,
976
- setOpen: s,
1249
+ anchor: a,
1250
+ focus: c,
1251
+ open: s,
1252
+ setOpen: i,
977
1253
  panelId: u
978
1254
  }
979
1255
  )
980
1256
  ] });
981
1257
  }
982
- const Be = ";", _o = `\r
983
- `, vo = "\uFEFF", ko = (e) => String(e).replace(".", ","), rt = (e) => /[";\r\n]/.test(e) ? `"${e.replace(/"/g, '""')}"` : e, yo = (e, t) => {
1258
+ const ft = ";", _r = `\r
1259
+ `, yr = "\uFEFF", Cr = (e) => String(e).replace(".", ","), Et = (e) => /[";\r\n]/.test(e) ? `"${e.replace(/"/g, '""')}"` : e, Sr = (e, t) => {
984
1260
  var o;
985
1261
  const n = (o = t.value) == null ? void 0 : o.call(t, e);
986
- return n == null ? "" : rt(typeof n == "number" ? ko(n) : String(n));
1262
+ return n == null ? "" : Et(typeof n == "number" ? Cr(n) : String(n));
987
1263
  };
988
- function Co(e, t) {
989
- const n = t.map((r) => rt(r.label ?? r.id)).join(Be), o = e.map((r) => t.map((i) => yo(r, i)).join(Be));
990
- return vo + [n, ...o].join(_o);
1264
+ function Nr(e, t) {
1265
+ const n = t.map((r) => Et(r.label ?? r.id)).join(ft), o = e.map((r) => t.map((s) => Sr(r, s)).join(ft));
1266
+ return yr + [n, ...o].join(_r);
991
1267
  }
992
- function st(e) {
1268
+ function Bt(e) {
993
1269
  const t = new Map(e.orderedColumns().map((o) => [o.spec.id, o])), n = e.projection().columns.map((o) => t.get(o.id)).filter((o) => o !== void 0);
994
1270
  return e.withStickyHeaderFirst(n.map((o) => ({ id: o.spec.id, e: o }))).map(({ e: o }) => o);
995
1271
  }
996
- function it(e) {
1272
+ function zt(e) {
997
1273
  e.setSearch("");
998
1274
  for (const t of Object.keys(e.filter)) e.setFilter(t, null);
999
1275
  }
1000
- function So(e) {
1276
+ function xr(e) {
1001
1277
  const t = e.hook;
1002
1278
  if (!t) return "";
1003
- const n = st(e).filter((o) => e.kindOf(o, t.rows) !== "other" || o.spec.ownExportValue).map(
1279
+ const n = Bt(e).filter((o) => e.kindOf(o, t.rows) !== "other" || o.spec.ownExportValue).map(
1004
1280
  (o) => ({
1005
1281
  id: o.spec.id,
1006
1282
  label: o.spec.label,
1007
- value: (r) => Qe(o.read(r), o.spec.ownExportValue)
1283
+ value: (r) => Lt(o.read(r), o.spec.ownExportValue)
1008
1284
  })
1009
1285
  );
1010
- return Co(e.projection().filtered, n);
1286
+ return Nr(e.projection().filtered, n);
1287
+ }
1288
+ const Ar = (e, t, n) => {
1289
+ var o;
1290
+ return ((o = e.groupingEntries(t.rows).find((r) => r.spec.id === n)) == null ? void 0 : o.spec.label) ?? n;
1291
+ };
1292
+ function Tr({ registry: e, hook: t }) {
1293
+ const n = U(), o = e.groupingEntries(t.rows);
1294
+ if (o.length === 0) return null;
1295
+ const { grouping: r, setGrouping: s } = t.publicSnapshot;
1296
+ return /* @__PURE__ */ L("section", { className: d.groupingChoice, "aria-label": n.grouping, children: [
1297
+ /* @__PURE__ */ l("h3", { className: d.groupingHeading, children: n.grouping }),
1298
+ /* @__PURE__ */ l("div", { className: d.groupingOptions, children: o.map((i) => {
1299
+ const { id: a, label: c } = i.spec, u = r.indexOf(a), h = u !== -1;
1300
+ return /* @__PURE__ */ L(
1301
+ "button",
1302
+ {
1303
+ type: "button",
1304
+ className: d.groupingOption,
1305
+ "aria-label": n.groupBy(c),
1306
+ "aria-pressed": h,
1307
+ disabled: !h && r.length >= Qe,
1308
+ onClick: () => s(h ? r.filter((f) => f !== a) : [...r, a]),
1309
+ children: [
1310
+ h && /* @__PURE__ */ l("span", { className: d.groupingLevel, "aria-hidden": "true", children: u + 1 }),
1311
+ c
1312
+ ]
1313
+ },
1314
+ a
1315
+ );
1316
+ }) })
1317
+ ] });
1318
+ }
1319
+ function Fr({ registry: e, hook: t }) {
1320
+ const n = U(), o = t.publicSnapshot, { grouping: r } = o;
1321
+ if (r.length === 0) return null;
1322
+ const s = r.map((i) => Ar(e, t, i));
1323
+ return (
1324
+ /* In a tag group, as the conditions stand: the tag is one stop, its button
1325
+ the thing one tabs to, and the ring stands on the tag. */
1326
+ /* @__PURE__ */ l(Nt, { "aria-label": n.groupedBy, className: d.groupingTag, children: /* @__PURE__ */ l(xt, { onRemove: () => o.setGrouping([]), removeLabel: n.removeGrouping, children: /* @__PURE__ */ L(
1327
+ At,
1328
+ {
1329
+ trigger: /* @__PURE__ */ L("button", { type: "button", className: E(d.conditionButton, d.groupingTrigger), children: [
1330
+ /* @__PURE__ */ l("span", { className: d.groupingPrefix, children: n.groupedBy }),
1331
+ s.map((i, a) => /* @__PURE__ */ L("span", { className: d.groupingPath, children: [
1332
+ a > 0 && /* @__PURE__ */ l("span", { className: d.groupingSeparator, "aria-hidden": "true", children: "›" }),
1333
+ i
1334
+ ] }, r[a]))
1335
+ ] }),
1336
+ children: [
1337
+ r.map((i, a) => /* @__PURE__ */ l(Fe, { onSelect: () => o.setGrouping(r.filter((c) => c !== i)), children: n.removeGroupingLevel(s[a]) }, i)),
1338
+ /* @__PURE__ */ l(en, {}),
1339
+ /* @__PURE__ */ l(Fe, { onSelect: o.unfoldAll, children: n.unfoldAll }),
1340
+ /* @__PURE__ */ l(Fe, { onSelect: o.foldAll, children: n.foldAll })
1341
+ ]
1342
+ }
1343
+ ) }) })
1344
+ );
1011
1345
  }
1012
- function lt({
1346
+ function jt({
1013
1347
  registry: e,
1014
1348
  className: t,
1015
1349
  children: n,
1016
1350
  own: o = !1
1017
1351
  }) {
1018
- const r = $(), i = te(), s = (e == null ? void 0 : e.hook) ?? null;
1019
- let l = null, a = null;
1020
- if (e && s) {
1021
- const u = s.publicSnapshot, d = u.search !== "" || Object.keys(u.filter).length > 0, h = o ? [] : u.filtered.filter((g) => u.selection.isSelected(s.rowKey(g))), _ = e.hasRowActions() ? e.actions.ordered().filter((g) => g.spec.bulk) : [];
1022
- l = /* @__PURE__ */ c(bo, { registry: e, hook: s }), a = /* @__PURE__ */ x("div", { className: f.toolbarGroup, children: [
1023
- /* @__PURE__ */ c("span", { role: "status", className: f.filteredCount, children: d ? r.filteredOfTotal(i.count(u.filtered.length), i.count(s.admitted.length)) : "" }),
1024
- d && /* @__PURE__ */ c(G, { size: "sm", variant: "ghost", onClick: () => it(u), children: r.resetAll }),
1025
- h.length > 0 && /* @__PURE__ */ x(Q, { children: [
1026
- /* @__PURE__ */ c("span", { className: f.toolbarInfo, children: r.selectedCount(h.length, i.count(h.length)) }),
1027
- _.map(({ key: g, spec: p }) => /* @__PURE__ */ c(
1028
- G,
1352
+ const r = U(), s = ue(), i = (e == null ? void 0 : e.hook) ?? null;
1353
+ let a = null, c = null;
1354
+ if (e && i) {
1355
+ const u = i.publicSnapshot, h = u.search !== "" || Object.keys(u.filter).length > 0, f = o ? [] : u.filtered.filter((p) => u.selection.isSelected(i.rowKey(p))), b = e.hasRowActions() ? e.actions.ordered().filter((p) => p.spec.bulk) : [];
1356
+ a = /* @__PURE__ */ L(J, { children: [
1357
+ /* @__PURE__ */ l(Fr, { registry: e, hook: i }),
1358
+ /* @__PURE__ */ l(kr, { registry: e, hook: i })
1359
+ ] }), c = /* @__PURE__ */ L("div", { className: d.toolbarGroup, children: [
1360
+ /* @__PURE__ */ l("span", { role: "status", className: d.filteredCount, children: h ? r.filteredOfTotal(s.count(u.filtered.length), s.count(i.admitted.length)) : "" }),
1361
+ h && /* @__PURE__ */ l(ee, { size: "sm", variant: "ghost", onClick: () => zt(u), children: r.resetAll }),
1362
+ f.length > 0 && /* @__PURE__ */ L(J, { children: [
1363
+ /* @__PURE__ */ l("span", { className: d.toolbarInfo, children: r.selectedCount(f.length, s.count(f.length)) }),
1364
+ b.map(({ key: p, spec: k }) => /* @__PURE__ */ l(
1365
+ ee,
1029
1366
  {
1030
1367
  size: "sm",
1031
- variant: p.tone === "danger" ? "danger" : "secondary",
1032
- onClick: () => p.onSelect(h),
1033
- children: p.label
1368
+ variant: k.tone === "danger" ? "danger" : "secondary",
1369
+ onClick: () => k.onSelect(f),
1370
+ children: k.label
1034
1371
  },
1035
- g
1372
+ p
1036
1373
  ))
1037
1374
  ] })
1038
1375
  ] });
1039
1376
  }
1040
- return /* @__PURE__ */ x("div", { className: H(f.toolbar, t), children: [
1041
- /* @__PURE__ */ x("div", { className: f.toolbarGroup, children: [
1377
+ return /* @__PURE__ */ L("div", { className: E(d.toolbar, t), children: [
1378
+ /* @__PURE__ */ L("div", { className: d.toolbarGroup, children: [
1042
1379
  n,
1043
- l
1380
+ a
1044
1381
  ] }),
1045
- a
1382
+ c
1046
1383
  ] });
1047
1384
  }
1048
- const Ae = Ge(null), No = () => () => {
1049
- }, $e = () => 0;
1050
- function ue(e) {
1385
+ const $e = yt(null), Or = () => () => {
1386
+ }, ht = () => 0;
1387
+ function xe(e) {
1051
1388
  var r;
1052
- const t = xe(Ae), n = e ? po(e.Table) ?? null : (t == null ? void 0 : t.registry) ?? null;
1053
- pe(
1054
- n ? n.subscribe : No,
1055
- n ? n.bodyVersion : $e,
1056
- n ? n.bodyVersion : $e
1389
+ const t = Ue($e), n = e ? wr(e.Table) ?? null : (t == null ? void 0 : t.registry) ?? null;
1390
+ Le(
1391
+ n ? n.subscribe : Or,
1392
+ n ? n.bodyVersion : ht,
1393
+ n ? n.bodyVersion : ht
1057
1394
  );
1058
1395
  const o = (r = n == null ? void 0 : n.hook) == null ? void 0 : r.publicSnapshot;
1059
1396
  return !n || !o ? null : { registry: n, snapshot: o, inside: !e && t !== null, footerTarget: e ? null : (t == null ? void 0 : t.footerTarget) ?? null };
1060
1397
  }
1061
- function Ao(e) {
1398
+ function Ht({ wording: e }) {
1399
+ return /* @__PURE__ */ L(J, { children: [
1400
+ /* @__PURE__ */ l("span", { "aria-hidden": "true", className: d.absent, children: "—" }),
1401
+ /* @__PURE__ */ l(Re, { children: e.cellAbsentValue })
1402
+ ] });
1403
+ }
1404
+ const Lr = { sum: "Σ", avg: "⌀", min: "min", max: "max" }, Rr = (e, t) => ({
1405
+ sum: t.footerSum,
1406
+ avg: t.footerAverage,
1407
+ min: t.footerMinimum,
1408
+ max: t.footerMaximum,
1409
+ range: t.footerRange,
1410
+ count: t.footerCount,
1411
+ distinct: t.footerDistinct
1412
+ })[e] ?? t.footerAggregate;
1413
+ function Ke({
1414
+ entry: e,
1415
+ rows: t,
1416
+ formats: n,
1417
+ wording: o,
1418
+ signed: r = !1
1419
+ }) {
1420
+ const { aggregate: s, format: i, presentation: a } = e.spec;
1421
+ if (!s) return null;
1422
+ const c = typeof s == "function" ? "own" : s, u = Je({ id: e.spec.id, read: e.read, aggregate: s }, t), h = (p) => _e(p, i, n, o);
1423
+ let f;
1424
+ if (Y(u)) f = /* @__PURE__ */ l(Ht, { wording: o });
1425
+ else if (c === "range" && i === "date" && Mr(u)) {
1426
+ const [p, k] = u;
1427
+ f = p.getTime() === k.getTime() ? n.date(p) : o.rangeFromTo(n.dateShort(p), n.dateShort(k));
1428
+ } else if (c === "count" || c === "distinct") f = n.count(u);
1429
+ else if (c === "range") {
1430
+ const [p, k] = u;
1431
+ f = h(p) === h(k) ? h(p) : o.rangeFromTo(h(p) ?? "", h(k) ?? "");
1432
+ } else c === "own" && a ? f = a(u, t[0]) : f = h(u);
1433
+ const b = Lr[c];
1434
+ return /* @__PURE__ */ L(J, { children: [
1435
+ r && b && /* @__PURE__ */ l("span", { "aria-hidden": "true", className: d.footerKind, children: b }),
1436
+ r && /* @__PURE__ */ L(Re, { children: [
1437
+ Rr(c, o),
1438
+ " "
1439
+ ] }),
1440
+ f
1441
+ ] });
1442
+ }
1443
+ const Mr = ([e, t]) => e instanceof Date && t instanceof Date && e.getFullYear() === t.getFullYear();
1444
+ function $t(e, t) {
1445
+ const n = e.spec.aggregate;
1446
+ return n === "count" || n === "distinct" ? !0 : e.spec.rightAligned !== void 0 ? e.spec.rightAligned : Ft(t, e.read) === "number";
1447
+ }
1448
+ function Vr(e, t) {
1449
+ const n = /* @__PURE__ */ new Map();
1450
+ for (const [o, r] of t) {
1451
+ const s = e.get(o);
1452
+ s !== void 0 && Math.abs(s - r) >= 0.5 && n.set(o, s - r);
1453
+ }
1454
+ return n;
1455
+ }
1456
+ function Kt(e, t) {
1457
+ const n = getComputedStyle(e).getPropertyValue(t).trim(), o = Number.parseFloat(n);
1458
+ return Number.isFinite(o) ? n.endsWith("ms") ? o : o * 1e3 : 0;
1459
+ }
1460
+ const Dr = (e) => {
1461
+ const t = /* @__PURE__ */ new Map(), n = e.getBoundingClientRect().top;
1462
+ for (const o of Array.from(e.querySelectorAll("tbody > tr[data-motion]")))
1463
+ t.set(o.dataset.motion, o.getBoundingClientRect().top - n);
1464
+ return t;
1465
+ };
1466
+ function Ir(e, t) {
1467
+ const n = Z(null);
1468
+ K(() => {
1469
+ const o = e.current;
1470
+ if (!o) return;
1471
+ const r = Dr(o), s = n.current;
1472
+ if (n.current = { trigger: t, positions: r }, !s || s.trigger === t) return;
1473
+ const i = Kt(o, "--u-duration-medium");
1474
+ if (i === 0 || typeof o.animate != "function") return;
1475
+ const a = getComputedStyle(o).getPropertyValue("--u-ease-out").trim() || "ease-out", c = Vr(s.positions, r);
1476
+ for (const u of Array.from(o.querySelectorAll("tbody > tr[data-motion]"))) {
1477
+ const h = u.dataset.motion, f = c.get(h);
1478
+ f !== void 0 ? u.animate([{ transform: `translateY(${f}px)` }, { transform: "none" }], { duration: i, easing: a }) : s.positions.has(h) || u.animate([{ opacity: 0, transform: "translateY(-4px)" }, { opacity: 1, transform: "none" }], { duration: i, easing: a });
1479
+ }
1480
+ });
1481
+ }
1482
+ function Pr(e, t, n) {
1483
+ const o = Z(t);
1484
+ K(() => {
1485
+ const r = e.current, s = o.current;
1486
+ if (o.current = t, !r || s === t || typeof r.animate != "function") return;
1487
+ const i = Kt(r, "--u-duration-medium");
1488
+ if (i === 0) return;
1489
+ const a = performance.now();
1490
+ let c = requestAnimationFrame(function u(h) {
1491
+ const f = Math.min(1, (h - a) / i), b = 1 - (1 - f) ** 3;
1492
+ r.textContent = n(Math.round(s + (t - s) * b)), f < 1 && (c = requestAnimationFrame(u));
1493
+ });
1494
+ return () => {
1495
+ cancelAnimationFrame(c), r.textContent = n(t);
1496
+ };
1497
+ }, [e, t, n]);
1498
+ }
1499
+ function Ve(e, t, n, o) {
1500
+ if (t === void 0) return o.groupNoValue;
1501
+ const r = e == null ? void 0 : e.spec;
1502
+ if (r != null && r.group && t instanceof Date) return pn(r.group, t, n, o);
1503
+ const s = r != null && r.ownGroupValue || r == null ? void 0 : r.format;
1504
+ return _e(t, s, n, o) ?? String(t);
1505
+ }
1506
+ function We({ entry: e, group: t, formats: n, wording: o }) {
1507
+ const r = e == null ? void 0 : e.spec;
1508
+ return t.value !== void 0 && (r != null && r.presentation) && !r.ownGroupValue && !r.group ? /* @__PURE__ */ l(J, { children: r.presentation(t.value, t.rows[0]) }) : /* @__PURE__ */ l(J, { children: Ve(e, t.value, n, o) });
1509
+ }
1510
+ function qe({
1511
+ group: e,
1512
+ parent: t,
1513
+ entry: n,
1514
+ open: o,
1515
+ registry: r,
1516
+ hook: s,
1517
+ formats: i,
1518
+ wording: a
1519
+ }) {
1520
+ const c = Z(null);
1521
+ K(() => {
1522
+ c.current && r.takeFoldFocus(e.path) && c.current.focus();
1523
+ });
1524
+ const u = Ve(n, e.value, i, a), h = i.count(e.rows.length), f = () => {
1525
+ r.requestFoldFocus(e.path), s.publicSnapshot.toggleFold(e.path);
1526
+ }, b = (p) => {
1527
+ if (p.altKey && (p.key === "ArrowLeft" || p.key === "ArrowRight")) {
1528
+ p.preventDefault(), r.requestFoldFocus(e.path), gt(e, p.key === "ArrowLeft", s);
1529
+ return;
1530
+ }
1531
+ if (p.key === "ArrowRight" && !o)
1532
+ p.preventDefault(), f();
1533
+ else if (p.key === "ArrowLeft") {
1534
+ if (p.preventDefault(), o) f();
1535
+ else if (t) {
1536
+ const k = p.currentTarget.closest("table"), m = Array.from((k == null ? void 0 : k.querySelectorAll("[data-fold-path]")) ?? []).find(
1537
+ (w) => w.dataset.foldPath === t.path
1538
+ );
1539
+ m == null || m.focus();
1540
+ }
1541
+ }
1542
+ };
1543
+ return /* @__PURE__ */ l(
1544
+ "button",
1545
+ {
1546
+ ref: c,
1547
+ type: "button",
1548
+ className: E(d.fold, !o && d.foldClosed),
1549
+ "data-fold-path": e.path,
1550
+ "aria-expanded": o,
1551
+ "aria-label": o ? a.foldGroup(u, h) : a.unfoldGroup(u, h),
1552
+ onKeyDown: b,
1553
+ onClick: (p) => {
1554
+ if (!p.altKey) return f();
1555
+ r.requestFoldFocus(e.path), gt(e, o, s);
1556
+ },
1557
+ children: /* @__PURE__ */ l("svg", { viewBox: "0 0 12 12", width: "12", height: "12", "aria-hidden": "true", children: /* @__PURE__ */ l("path", { d: "M3 4.5 6 7.5 9 4.5", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
1558
+ }
1559
+ );
1560
+ }
1561
+ function Gr({ value: e, formats: t }) {
1562
+ const n = Z(null);
1563
+ return Pr(n, e, t.count), /* @__PURE__ */ l("span", { ref: n, className: d.groupCount, children: t.count(e) });
1564
+ }
1565
+ function Ye({ group: e, entry: t, hook: n, formats: o, wording: r }) {
1566
+ const { selection: s } = n.publicSnapshot, i = e.rows.map(n.rowKey), a = i.filter((u) => s.isSelected(u)).length, c = a === i.length;
1567
+ return /* @__PURE__ */ l(
1568
+ Se,
1569
+ {
1570
+ "aria-label": r.selectGroup(Ve(t, e.value, o, r)),
1571
+ checked: c,
1572
+ indeterminate: a > 0 && !c,
1573
+ onChange: () => {
1574
+ for (const u of i) s.isSelected(u) === c && s.toggle(u);
1575
+ }
1576
+ }
1577
+ );
1578
+ }
1579
+ function gt(e, t, n) {
1580
+ const o = n.publicSnapshot, r = [], s = (i) => {
1581
+ for (const a of i)
1582
+ a.level === e.level ? r.push(a) : s(a.groups);
1583
+ };
1584
+ s(n.companion.groups ?? []);
1585
+ for (const i of r)
1586
+ o.folded.includes(i.path) !== t && o.toggleFold(i.path);
1587
+ }
1588
+ function Er({
1589
+ line: e,
1590
+ entry: t,
1591
+ selectable: n,
1592
+ registry: o,
1593
+ hook: r,
1594
+ formats: s,
1595
+ wording: i
1596
+ }) {
1597
+ const a = e.span;
1598
+ return /* @__PURE__ */ l("td", { className: E(d.td, d.spanCell), children: e.first && /* @__PURE__ */ L("span", { className: d.spanValue, children: [
1599
+ n && /* @__PURE__ */ l("span", { className: d.spanSelect, children: /* @__PURE__ */ l(Ye, { group: a, entry: t, hook: r, formats: s, wording: i }) }),
1600
+ /* @__PURE__ */ l(qe, { group: a, parent: e.parents.at(-1), entry: t, open: !0, registry: o, hook: r, formats: s, wording: i }),
1601
+ /* @__PURE__ */ L("span", { className: d.spanText, title: Ve(t, a.value, s, i), children: [
1602
+ /* @__PURE__ */ l(We, { entry: t, group: a, formats: s, wording: i }),
1603
+ e.continued && /* @__PURE__ */ l("span", { className: d.continued, children: i.groupContinued })
1604
+ ] }),
1605
+ /* @__PURE__ */ l("span", { className: d.groupCount, children: s.count(a.rows.length) })
1606
+ ] }) });
1607
+ }
1608
+ function pt({
1609
+ line: e,
1610
+ index: t,
1611
+ absolute: n,
1612
+ spanEntry: o,
1613
+ levelEntry: r,
1614
+ columns: s,
1615
+ controlColumns: i,
1616
+ selectable: a,
1617
+ hasActions: c,
1618
+ total: u,
1619
+ siblings: h,
1620
+ depth: f,
1621
+ registry: b,
1622
+ hook: p,
1623
+ formats: k,
1624
+ wording: m
1625
+ }) {
1626
+ const { group: w } = e, g = e.kind === "header", v = g && !p.publicSnapshot.folded.includes(w.path), N = s.findIndex((S) => S.spec.aggregate !== void 0), C = N === -1 ? s.length : N, D = s.slice(C), T = s.find((S) => S.spec.aggregate === "sum" && S.spec.share !== !1), x = n !== void 0, _ = /* @__PURE__ */ L("span", { className: d.groupLabel, children: [
1627
+ /* @__PURE__ */ l(qe, { group: w, parent: e.parents.at(-1), entry: r, open: v, registry: b, hook: p, formats: k, wording: m }),
1628
+ /* @__PURE__ */ l("span", { className: d.groupValue, children: /* @__PURE__ */ l(We, { entry: r, group: w, formats: k, wording: m }) }),
1629
+ /* @__PURE__ */ l(Gr, { value: w.rows.length, formats: k }),
1630
+ g && e.continued && /* @__PURE__ */ l("span", { className: d.continued, children: m.groupContinued })
1631
+ ] });
1632
+ return /* @__PURE__ */ L(
1633
+ "tr",
1634
+ {
1635
+ className: E(g ? d.groupHeader : d.groupFolded, x && d.virtualRow),
1636
+ "data-line": e.kind,
1637
+ "data-level": w.level,
1638
+ "data-motion": n !== void 0 || !(g && e.continued) ? `${e.kind}:${w.path}` : void 0,
1639
+ "data-continued": g && e.continued ? "" : void 0,
1640
+ "data-group-first": g ? void 0 : "",
1641
+ "data-row": x ? n : void 0,
1642
+ "aria-rowindex": x ? n + 2 : void 0,
1643
+ "data-index": t,
1644
+ style: g ? { "--u-header-level": w.level } : void 0,
1645
+ "aria-level": g ? w.level + 1 : f,
1646
+ "aria-expanded": v,
1647
+ "aria-posinset": h.indexOf(w) + 1 || void 0,
1648
+ "aria-setsize": h.length || void 0,
1649
+ children: [
1650
+ Array.from({ length: i }, (S, O) => /* @__PURE__ */ l("td", { className: E(d.td, d.control), children: O === 0 && a && g && /* @__PURE__ */ l(Ye, { group: w, entry: r, hook: p, formats: k, wording: m }) }, `c${O}`)),
1651
+ g ? /* @__PURE__ */ l("td", { className: d.td, colSpan: (o ? 1 : 0) + C, style: { paddingLeft: `calc(var(--u-space-3) + ${w.level * 20}px)` }, children: _ }) : /* @__PURE__ */ L(J, { children: [
1652
+ /* @__PURE__ */ l("td", { className: E(d.td, d.spanCell), children: /* @__PURE__ */ L("span", { className: d.spanValue, children: [
1653
+ a && /* @__PURE__ */ l("span", { className: d.spanSelect, children: /* @__PURE__ */ l(Ye, { group: w, entry: o, hook: p, formats: k, wording: m }) }),
1654
+ /* @__PURE__ */ l(qe, { group: w, parent: e.parents.at(-1), entry: o, open: !1, registry: b, hook: p, formats: k, wording: m }),
1655
+ /* @__PURE__ */ l("span", { className: d.spanText, children: /* @__PURE__ */ l(We, { entry: o, group: w, formats: k, wording: m }) }),
1656
+ /* @__PURE__ */ l("span", { className: d.groupCount, children: k.count(w.rows.length) })
1657
+ ] }) }),
1658
+ C > 0 && /* @__PURE__ */ l("td", { className: E(d.td, d.foldedCount), colSpan: C, children: m.entries(w.rows.length, k.count(w.rows.length)) })
1659
+ ] }),
1660
+ D.map((S) => /* @__PURE__ */ l(
1661
+ Br,
1662
+ {
1663
+ entry: S,
1664
+ group: w,
1665
+ share: g && S === T,
1666
+ total: u,
1667
+ formats: k,
1668
+ wording: m
1669
+ },
1670
+ S.key
1671
+ )),
1672
+ c && /* @__PURE__ */ l("td", { className: d.td })
1673
+ ]
1674
+ }
1675
+ );
1676
+ }
1677
+ function Br({
1678
+ entry: e,
1679
+ group: t,
1680
+ share: n,
1681
+ total: o,
1682
+ formats: r,
1683
+ wording: s
1684
+ }) {
1685
+ const { spec: i } = e;
1686
+ if (!i.aggregate) return /* @__PURE__ */ l("td", { className: d.td });
1687
+ let a = null;
1688
+ if (n && i.aggregate === "sum" && i.share !== !1) {
1689
+ const c = Je({ id: i.id, read: e.read, aggregate: "sum" }, o), u = t.aggregates[i.id];
1690
+ if (typeof c == "number" && c > 0 && typeof u == "number" && u > 0) {
1691
+ const h = Math.min(1, u / c);
1692
+ a = /* @__PURE__ */ l("span", { className: d.shareBar, style: { width: `${Math.max(2, Math.round(h * 64))}px` }, "aria-hidden": "true" });
1693
+ }
1694
+ }
1695
+ return /* @__PURE__ */ l("td", { className: E(d.td, $t(e, t.rows) && d.numeric, d.aggregateCell), "data-aggregate": typeof i.aggregate == "function" ? "own" : i.aggregate, children: a ? /* @__PURE__ */ L("span", { className: d.shareHost, children: [
1696
+ /* @__PURE__ */ l(Ke, { entry: e, rows: t.rows, formats: r, wording: s }),
1697
+ a
1698
+ ] }) : /* @__PURE__ */ l(Ke, { entry: e, rows: t.rows, formats: r, wording: s }) });
1699
+ }
1700
+ function zr(e) {
1062
1701
  const t = typeof e.value == "string" ? e.value : void 0;
1063
1702
  let n = e.id ?? t;
1064
- return n === void 0 && (re(`without-id:${e.label}`, `The column "${e.label}" has a computed value but no id. Its label serves as the id.`), n = e.label), e.children !== void 0 && typeof e.children != "function" && re(`children:${n}`, `The children of the column "${n}" are not a function and are passed over.`), {
1703
+ return n === void 0 && (pe(`without-id:${e.label}`, `The column "${e.label}" has a computed value but no id. Its label serves as the id.`), n = e.label), e.footer !== void 0 && pe(`footer:${n}`, `The column "${n}" uses \`footer\`, which is called \`aggregate\` now. The old name goes with the next minor version.`), e.children !== void 0 && typeof e.children != "function" && pe(`children:${n}`, `The children of the column "${n}" are not a function and are passed over.`), {
1065
1704
  id: n,
1066
1705
  label: e.label,
1067
1706
  value: e.value,
1068
1707
  presentation: typeof e.children == "function" ? e.children : void 0,
1069
1708
  format: e.format,
1070
- footer: e.footer,
1709
+ aggregate: e.aggregate ?? e.footer,
1710
+ share: e.share,
1071
1711
  rowHeader: e.rowHeader === !0,
1072
1712
  rightAligned: e.numeric,
1073
1713
  width: e.width,
@@ -1076,217 +1716,315 @@ function Ao(e) {
1076
1716
  searchable: e.searchable,
1077
1717
  filter: e.filter,
1078
1718
  ownSortValue: e.sortValue,
1079
- ownExportValue: e.exportValue
1719
+ ownExportValue: e.exportValue,
1720
+ ownGroupValue: e.groupValue,
1721
+ group: e.group,
1722
+ groupable: e.groupable
1080
1723
  };
1081
1724
  }
1082
- function ct({ wording: e }) {
1083
- return /* @__PURE__ */ x(Q, { children: [
1084
- /* @__PURE__ */ c("span", { "aria-hidden": "true", className: f.absent, children: "—" }),
1085
- /* @__PURE__ */ c(be, { children: e.cellAbsentValue })
1086
- ] });
1087
- }
1088
- function xo(e, t, n, o, r) {
1725
+ function jr(e, t, n, o, r) {
1089
1726
  if (!t) return n.rowKey(e);
1090
- const i = t.read(e);
1091
- return U(i) ? r.cellAbsentValue : ae(i, t.spec.format, o, r) ?? n.rowKey(e);
1092
- }
1093
- const me = 34;
1094
- function To(e) {
1095
- function t(l) {
1096
- const a = Z(), u = xe(Ae), d = Ao(l);
1097
- return e.registerColumn(a, d), J(
1727
+ const s = t.read(e);
1728
+ return Y(s) ? r.cellAbsentValue : _e(s, t.spec.format, o, r) ?? n.rowKey(e);
1729
+ }
1730
+ const Oe = 34;
1731
+ function Hr(e) {
1732
+ function t(c) {
1733
+ const u = se(), h = Ue($e), f = zr(c);
1734
+ return e.registerColumn(u, f), K(
1098
1735
  () => () => {
1099
- e.removeColumn(a), e.commit();
1736
+ e.removeColumn(u), e.commit();
1100
1737
  },
1101
- [a]
1102
- ), J(() => {
1103
- e.ensureColumn(a, d), e.checkOrder(), e.commit();
1104
- }), Ye && u && u.registry !== e && re(
1105
- `foreign:${d.id}`,
1106
- `The column "${d.id}" comes from a different useTable call than the table it stands in. It reads the rows of its own hook.`
1107
- ), /* @__PURE__ */ c("span", { hidden: !0, "data-umriss-column": a });
1108
- }
1109
- function n({ children: l }) {
1110
- const a = Z();
1111
- return e.registerDetail(a, l), J(
1738
+ [u]
1739
+ ), K(() => {
1740
+ e.ensureColumn(u, f), e.checkOrder(), e.commit();
1741
+ }), Mt && h && h.registry !== e && pe(
1742
+ `foreign:${f.id}`,
1743
+ `The column "${f.id}" comes from a different useTable call than the table it stands in. It reads the rows of its own hook.`
1744
+ ), /* @__PURE__ */ l("span", { hidden: !0, "data-umriss-column": u });
1745
+ }
1746
+ function n({ children: c }) {
1747
+ const u = se();
1748
+ return e.registerDetail(u, c), K(
1112
1749
  () => () => {
1113
- e.removeDetail(a), e.commit();
1750
+ e.removeDetail(u), e.commit();
1114
1751
  },
1115
- [a]
1116
- ), J(() => {
1117
- e.detail || e.registerDetail(a, l), e.commit();
1752
+ [u]
1753
+ ), K(() => {
1754
+ e.detail || e.registerDetail(u, c), e.commit();
1118
1755
  }), null;
1119
1756
  }
1120
- function o({ children: l }) {
1121
- const a = Z();
1122
- return e.registerActionGroup(a), J(
1757
+ function o({ children: c }) {
1758
+ const u = se();
1759
+ return e.registerActionGroup(u), K(
1123
1760
  () => () => {
1124
- e.removeActionGroup(a), e.commit();
1761
+ e.removeActionGroup(u), e.commit();
1125
1762
  },
1126
- [a]
1127
- ), J(() => {
1128
- e.registerActionGroup(a), e.commit();
1129
- }), /* @__PURE__ */ c(Q, { children: l });
1130
- }
1131
- function r(l) {
1132
- const a = Z(), u = {
1133
- label: l.children,
1134
- bulk: l.bulk === !0,
1135
- tone: l.tone ?? "default",
1136
- onSelect: l.onSelect
1763
+ [u]
1764
+ ), K(() => {
1765
+ e.registerActionGroup(u), e.commit();
1766
+ }), /* @__PURE__ */ l(J, { children: c });
1767
+ }
1768
+ function r(c) {
1769
+ const u = se(), h = {
1770
+ label: c.children,
1771
+ bulk: c.bulk === !0,
1772
+ tone: c.tone ?? "default",
1773
+ onSelect: c.onSelect
1137
1774
  };
1138
- return e.registerAction(a, u), J(
1775
+ return e.registerAction(u, h), K(
1139
1776
  () => () => {
1140
- e.removeAction(a), e.commit();
1777
+ e.removeAction(u), e.commit();
1141
1778
  },
1142
- [a]
1143
- ), J(() => {
1144
- e.ensureAction(a, u), e.checkOrder(), e.commit();
1145
- }), /* @__PURE__ */ c("span", { hidden: !0, "data-umriss-action": a });
1146
- }
1147
- function i(l) {
1148
- e.beginPass(), e.setStickyRowHeader(l.stickyRowHeader === !0);
1149
- const a = oe(null), [u, d] = P(null);
1150
- J(() => {
1151
- e.children = a.current, e.checkOrder(), e.commit();
1779
+ [u]
1780
+ ), K(() => {
1781
+ e.ensureAction(u, h), e.checkOrder(), e.commit();
1782
+ }), /* @__PURE__ */ l("span", { hidden: !0, "data-umriss-action": u });
1783
+ }
1784
+ function s(c) {
1785
+ const u = se(), h = typeof c.value == "string" ? c.value : void 0, b = {
1786
+ id: c.id ?? h ?? c.label,
1787
+ label: c.label,
1788
+ value: c.value,
1789
+ rowHeader: !1,
1790
+ resizable: !1,
1791
+ ownGroupValue: c.groupValue,
1792
+ group: c.group,
1793
+ groupable: !0
1794
+ };
1795
+ return e.registerGroupKey(u, b), K(
1796
+ () => () => {
1797
+ e.removeGroupKey(u), e.commit();
1798
+ },
1799
+ [u]
1800
+ ), K(() => {
1801
+ e.ensureGroupKey(u, b), e.checkOrder(), e.commit();
1802
+ }), /* @__PURE__ */ l("span", { hidden: !0, "data-umriss-groupkey": u });
1803
+ }
1804
+ function i(c) {
1805
+ e.beginPass(), e.setStickyRowHeader(c.stickyRowHeader === !0), e.setTableGroupable(c.groupable !== !1);
1806
+ const u = Z(null), [h, f] = z(null);
1807
+ K(() => {
1808
+ e.children = u.current, e.checkOrder(), e.commit();
1152
1809
  });
1153
- const h = V(() => ({ registry: e, footerTarget: u }), [u]);
1154
- return /* @__PURE__ */ c(Ae.Provider, { value: h, children: /* @__PURE__ */ x("div", { className: H(f.frame, l.className), children: [
1155
- /* @__PURE__ */ c("div", { ref: a, className: f.children, children: l.children }),
1156
- /* @__PURE__ */ c(Oo, { registry: e }),
1157
- /* @__PURE__ */ c(Ro, { registry: e, props: l }),
1158
- /* @__PURE__ */ c("div", { ref: d, className: f.footerTarget })
1810
+ const b = j(() => ({ registry: e, footerTarget: h }), [h]);
1811
+ return /* @__PURE__ */ l($e.Provider, { value: b, children: /* @__PURE__ */ L("div", { className: E(d.frame, c.className), children: [
1812
+ /* @__PURE__ */ l("div", { ref: u, className: d.children, children: c.children }),
1813
+ /* @__PURE__ */ l($r, { registry: e }),
1814
+ /* @__PURE__ */ l(Kr, { registry: e, props: c }),
1815
+ /* @__PURE__ */ l("div", { ref: f, className: d.footerTarget })
1159
1816
  ] }) });
1160
1817
  }
1161
- const s = { Table: i, Column: t, RowDetail: n, RowActions: o, Action: r };
1162
- return mo(i, e), s;
1818
+ const a = { Table: i, Column: t, RowDetail: n, RowActions: o, Action: r, GroupBy: s };
1819
+ return mr(i, e), a;
1163
1820
  }
1164
- function Oo({ registry: e }) {
1165
- return pe(e.subscribe, e.bodyVersion, e.bodyVersion), !e.hook || !e.needsOwnToolbar() ? null : /* @__PURE__ */ c(lt, { registry: e, own: !0 });
1821
+ function $r({ registry: e }) {
1822
+ return Le(e.subscribe, e.bodyVersion, e.bodyVersion), !e.hook || !e.needsOwnToolbar() ? null : /* @__PURE__ */ l(jt, { registry: e, own: !0 });
1166
1823
  }
1167
- function Ro({ registry: e, props: t }) {
1824
+ function Kr({ registry: e, props: t }) {
1168
1825
  const {
1169
1826
  selectable: n = !1,
1170
1827
  stickyHeader: o = !1,
1171
1828
  stickyRowHeader: r = !1,
1172
- striped: i = !1,
1173
- density: s,
1174
- maxHeight: l,
1175
- empty: a,
1829
+ striped: s = !1,
1830
+ density: i,
1831
+ maxHeight: a,
1832
+ empty: c,
1176
1833
  loading: u = !1,
1177
- rowProps: d,
1178
- ariaLabel: h
1834
+ rowProps: h,
1835
+ ariaLabel: f
1179
1836
  } = t;
1180
- pe(e.subscribe, e.bodyVersion, e.bodyVersion);
1181
- const _ = $(), g = te(), p = qe(s, "regular"), b = Z(), v = e.hook;
1837
+ Le(e.subscribe, e.bodyVersion, e.bodyVersion);
1838
+ const b = U(), p = ue(), k = Tt(i, "regular"), m = se(), w = Z(null);
1839
+ K(() => {
1840
+ var H, M;
1841
+ const y = w.current;
1842
+ if (!y || !o) return;
1843
+ const R = ((H = y.tHead) == null ? void 0 : H.getBoundingClientRect().height) ?? 0, q = ((M = y.querySelector("tr[data-line='header']")) == null ? void 0 : M.getBoundingClientRect().height) ?? 0;
1844
+ y.style.setProperty("--u-table-head", `${R}px`), y.style.setProperty("--u-table-group-header", `${q}px`), y.parentElement && mt(y.parentElement);
1845
+ });
1846
+ const g = e.hook && !e.hook.companion.virtual ? e.hook.publicSnapshot : null;
1847
+ Ir(w, g ? `${g.grouping.join("|")}#${g.folded.join("|")}` : "");
1848
+ const v = e.hook;
1182
1849
  if (!v) return null;
1183
- const m = v.publicSnapshot, y = e.projection(), O = e.rowHeader(), N = st(e), M = e.detail, w = e.hasRowActions() ? e.actions.ordered() : [], C = v.companion.virtual, I = (n ? 1 : 0) + (M ? 1 : 0), A = I + N.length + (w.length > 0 ? 1 : 0), S = I * me, T = (D) => r && D === O, L = y.visible, F = !u && N.some((D) => D.spec.footer), E = m.search !== "" || Object.keys(m.filter).length > 0, W = (D, K, ve) => /* @__PURE__ */ c(
1184
- Fo,
1850
+ const N = v.publicSnapshot, C = e.projection(), D = e.rowHeader(), T = Bt(e), x = e.detail, _ = e.hasRowActions() ? e.actions.ordered() : [], S = v.companion.virtual, O = N.grouping, A = O.length > 0 ? C.visibleLines : void 0, I = A ? e.groupingEntries(v.rows) : [], $ = (y) => I.find((R) => R.spec.id === y), G = A && O.length > 1 ? $(O.at(-1)) : void 0, W = A ? T.filter((y) => !O.includes(y.spec.id)) : T, ie = (n ? 1 : 0) + (x ? 1 : 0), ae = ie + (G ? 1 : 0) + W.length + (_.length > 0 ? 1 : 0), de = ie * Oe, fe = (y) => r && y === D, we = C.visible, be = !u && W.some((y) => y.spec.aggregate), ye = N.search !== "" || Object.keys(N.filter).length > 0, le = (y, R, q, H) => /* @__PURE__ */ l(
1851
+ Wr,
1185
1852
  {
1186
- row: D,
1187
- index: K,
1188
- absolute: C ? ve : void 0,
1853
+ row: y,
1854
+ index: R,
1855
+ absolute: S ? q : void 0,
1189
1856
  registry: e,
1190
1857
  hook: v,
1191
- columns: N,
1192
- header: O,
1858
+ columns: W,
1859
+ line: H,
1860
+ spanEntry: G,
1861
+ header: D,
1193
1862
  selectable: n,
1194
- actions: w,
1863
+ actions: _,
1195
1864
  stickyRowHeader: r,
1196
- rowHeaderLeft: S,
1197
- columnCount: A,
1198
- rowProps: d,
1199
- baseId: b,
1200
- formats: g,
1201
- wording: _
1865
+ rowHeaderLeft: de,
1866
+ columnCount: ae,
1867
+ rowProps: h,
1868
+ baseId: m,
1869
+ formats: p,
1870
+ wording: b
1202
1871
  },
1203
- v.rowKey(D)
1872
+ v.rowKey(y)
1204
1873
  );
1205
- let q;
1206
- return u ? q = /* @__PURE__ */ c("tbody", { children: /* @__PURE__ */ c(Po, { columns: A }) }) : y.filtered.length === 0 ? q = /* @__PURE__ */ c("tbody", { children: /* @__PURE__ */ c("tr", { children: /* @__PURE__ */ c("td", { colSpan: A, className: f.emptyCell, children: /* @__PURE__ */ c("div", { className: f.empty, children: v.admitted.length > 0 && E ? /* @__PURE__ */ x(Q, { children: [
1207
- /* @__PURE__ */ c("p", { className: f.emptyTitle, children: _.nothingMatchesFilters }),
1208
- /* @__PURE__ */ c(G, { size: "sm", variant: "ghost", onClick: () => it(m), children: _.resetAll })
1209
- ] }) : a ?? /* @__PURE__ */ c("p", { className: f.emptyTitle, children: _.noEntries }) }) }) }) }) : C ? q = /* @__PURE__ */ c(Mo, { virtual: C, colSpan: A, children: L.map((D, K) => W(D, K, C.from + K)) }) : q = /* @__PURE__ */ c("tbody", { children: L.map((D, K) => W(D, K, K)) }), /* @__PURE__ */ c(
1874
+ let te;
1875
+ if (u)
1876
+ te = /* @__PURE__ */ l("tbody", { children: /* @__PURE__ */ l(Jr, { columns: ae }) });
1877
+ else if (C.filtered.length === 0)
1878
+ te = /* @__PURE__ */ l("tbody", { children: /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l("td", { colSpan: ae, className: d.emptyCell, children: /* @__PURE__ */ l("div", { className: d.empty, children: v.admitted.length > 0 && ye ? /* @__PURE__ */ L(J, { children: [
1879
+ /* @__PURE__ */ l("p", { className: d.emptyTitle, children: b.nothingMatchesFilters }),
1880
+ /* @__PURE__ */ l(ee, { size: "sm", variant: "ghost", onClick: () => zt(N), children: b.resetAll })
1881
+ ] }) : c ?? /* @__PURE__ */ l("p", { className: d.emptyTitle, children: b.noEntries }) }) }) }) });
1882
+ else if (A) {
1883
+ const y = S ? Rt(A).map((M) => M.kind === "folded" || !M.continued ? M : { ...M, continued: !1 }) : A, R = y.length - A.length, q = S && S.from > 0 ? S.fillerBefore / S.from : 0, H = (M, Q) => {
1884
+ var V, B;
1885
+ const ne = Q - R, F = S ? S.from + ne : ne;
1886
+ return ne < 0 ? M.kind === "row" ? null : /* @__PURE__ */ l(
1887
+ pt,
1888
+ {
1889
+ line: M,
1890
+ index: Q,
1891
+ absolute: void 0,
1892
+ spanEntry: G,
1893
+ levelEntry: $(O[M.group.level]),
1894
+ columns: W,
1895
+ controlColumns: ie,
1896
+ selectable: n,
1897
+ hasActions: _.length > 0,
1898
+ total: C.filtered,
1899
+ siblings: ((V = M.parents.at(-1)) == null ? void 0 : V.groups) ?? C.groups ?? [],
1900
+ depth: O.length,
1901
+ registry: e,
1902
+ hook: v,
1903
+ formats: p,
1904
+ wording: b
1905
+ },
1906
+ `${M.kind}:${M.group.path}:repeated`
1907
+ ) : M.kind === "row" ? le(M.row, ne, F, M) : /* @__PURE__ */ l(
1908
+ pt,
1909
+ {
1910
+ line: M,
1911
+ index: ne,
1912
+ absolute: S ? F : void 0,
1913
+ spanEntry: G,
1914
+ levelEntry: $(O[M.group.level]),
1915
+ columns: W,
1916
+ controlColumns: ie,
1917
+ selectable: n,
1918
+ hasActions: _.length > 0,
1919
+ total: C.filtered,
1920
+ siblings: ((B = M.parents.at(-1)) == null ? void 0 : B.groups) ?? C.groups ?? [],
1921
+ depth: O.length,
1922
+ registry: e,
1923
+ hook: v,
1924
+ formats: p,
1925
+ wording: b
1926
+ },
1927
+ `${M.kind}:${M.group.path}${M.kind === "header" && M.continued ? ":continued" : ""}`
1928
+ );
1929
+ };
1930
+ te = S ? /* @__PURE__ */ l(
1931
+ kt,
1932
+ {
1933
+ virtual: { ...S, fillerBefore: Math.max(0, S.fillerBefore - R * q) },
1934
+ colSpan: ae,
1935
+ children: y.map(H)
1936
+ }
1937
+ ) : /* @__PURE__ */ l("tbody", { children: A.map(H) });
1938
+ } else S ? te = /* @__PURE__ */ l(kt, { virtual: S, colSpan: ae, children: we.map((y, R) => le(y, R, S.from + R)) }) : te = /* @__PURE__ */ l("tbody", { children: we.map((y, R) => le(y, R, R)) });
1939
+ return /* @__PURE__ */ l(
1210
1940
  "div",
1211
1941
  {
1212
- ref: C == null ? void 0 : C.scrollRef,
1213
- onScroll: C == null ? void 0 : C.onScroll,
1214
- className: f.scroll,
1215
- style: l ? { maxHeight: l } : void 0,
1216
- children: /* @__PURE__ */ x(
1942
+ ref: S == null ? void 0 : S.scrollRef,
1943
+ onScroll: (y) => {
1944
+ S == null || S.onScroll(), A && o && mt(y.currentTarget);
1945
+ },
1946
+ className: d.scroll,
1947
+ style: a ? { maxHeight: a } : void 0,
1948
+ children: /* @__PURE__ */ L(
1217
1949
  "table",
1218
1950
  {
1219
- "aria-label": h,
1220
- "aria-rowcount": C ? y.filtered.length + 1 + (F ? 1 : 0) : void 0,
1951
+ ref: w,
1952
+ role: A ? "treegrid" : void 0,
1953
+ "data-depth": A ? O.length : void 0,
1954
+ style: A ? { "--u-header-levels": O.length - 1 } : void 0,
1955
+ "aria-label": f,
1956
+ "aria-rowcount": S ? (C.lines ?? C.filtered).length + 1 + (be ? 1 : 0) : void 0,
1221
1957
  "aria-busy": u || void 0,
1222
- className: H(
1223
- f.table,
1224
- p === "compact" && f.compact,
1225
- o && f.sticky,
1226
- i && f.striped
1958
+ className: E(
1959
+ d.table,
1960
+ k === "compact" && d.compact,
1961
+ o && d.sticky,
1962
+ s && d.striped
1227
1963
  ),
1228
1964
  children: [
1229
- /* @__PURE__ */ c("thead", { children: /* @__PURE__ */ x("tr", { "aria-rowindex": C ? 1 : void 0, children: [
1230
- n && /* @__PURE__ */ c(
1965
+ /* @__PURE__ */ l("thead", { children: /* @__PURE__ */ L("tr", { "aria-rowindex": S ? 1 : void 0, children: [
1966
+ n && /* @__PURE__ */ l(
1231
1967
  "th",
1232
1968
  {
1233
1969
  scope: "col",
1234
- className: H(f.th, f.control, r && f.stickyCell),
1970
+ className: E(d.th, d.control, r && d.stickyCell),
1235
1971
  style: r ? { left: 0 } : void 0,
1236
- children: /* @__PURE__ */ c(
1237
- ge,
1972
+ children: /* @__PURE__ */ l(
1973
+ Se,
1238
1974
  {
1239
- "aria-label": _.selectAllRows,
1240
- checked: m.selection.allSelected,
1241
- indeterminate: m.selection.someSelected,
1242
- onChange: m.selection.toggleAll
1975
+ "aria-label": b.selectAllRows,
1976
+ checked: N.selection.allSelected,
1977
+ indeterminate: N.selection.someSelected,
1978
+ onChange: N.selection.toggleAll
1243
1979
  }
1244
1980
  )
1245
1981
  }
1246
1982
  ),
1247
- M && /* @__PURE__ */ c(
1983
+ x && /* @__PURE__ */ l(
1248
1984
  "td",
1249
1985
  {
1250
- className: H(f.th, f.control, r && f.stickyCell),
1251
- style: r ? { left: (n ? 1 : 0) * me } : void 0
1986
+ className: E(d.th, d.control, r && d.stickyCell),
1987
+ style: r ? { left: (n ? 1 : 0) * Oe } : void 0
1252
1988
  }
1253
1989
  ),
1254
- N.map((D) => /* @__PURE__ */ c(
1255
- Io,
1990
+ G && (e.columnById(G.spec.id) === G ? /* @__PURE__ */ l(wt, { entry: G, registry: e, hook: v, sticky: !1, left: de }) : /* @__PURE__ */ l("th", { scope: "col", className: d.th, children: G.spec.label })),
1991
+ W.map((y) => /* @__PURE__ */ l(
1992
+ wt,
1256
1993
  {
1257
- entry: D,
1994
+ entry: y,
1258
1995
  registry: e,
1259
1996
  hook: v,
1260
- sticky: T(D),
1261
- left: S
1997
+ sticky: fe(y),
1998
+ left: de
1262
1999
  },
1263
- D.key
2000
+ y.key
1264
2001
  )),
1265
- w.length > 0 && /* @__PURE__ */ c("th", { scope: "col", className: H(f.th, f.actionsCell), children: /* @__PURE__ */ c(be, { children: _.rowActions }) })
2002
+ _.length > 0 && /* @__PURE__ */ l("th", { scope: "col", className: E(d.th, d.actionsCell), children: /* @__PURE__ */ l(Re, { children: b.rowActions }) })
1266
2003
  ] }) }),
1267
- q,
1268
- F && /* @__PURE__ */ c("tfoot", { children: /* @__PURE__ */ x("tr", { "aria-rowindex": C ? y.filtered.length + 2 : void 0, children: [
1269
- Array.from({ length: I }, (D, K) => /* @__PURE__ */ c(
2004
+ te,
2005
+ be && /* @__PURE__ */ l("tfoot", { children: /* @__PURE__ */ L("tr", { "aria-rowindex": S ? (C.lines ?? C.filtered).length + 2 : void 0, children: [
2006
+ Array.from({ length: ie }, (y, R) => /* @__PURE__ */ l(
1270
2007
  "td",
1271
2008
  {
1272
- className: H(f.td, f.control, r && f.stickyCell),
1273
- style: r ? { left: K * me } : void 0
2009
+ className: E(d.td, d.control, r && d.stickyCell),
2010
+ style: r ? { left: R * Oe } : void 0
1274
2011
  },
1275
- K
2012
+ R
1276
2013
  )),
1277
- N.map((D) => /* @__PURE__ */ c(
1278
- zo,
2014
+ G && /* @__PURE__ */ l("td", { className: d.td }),
2015
+ W.map((y) => /* @__PURE__ */ l(
2016
+ Yr,
1279
2017
  {
1280
- entry: D,
1281
- rows: y.filtered,
1282
- formats: g,
1283
- wording: _,
1284
- sticky: T(D),
1285
- left: S
2018
+ entry: y,
2019
+ rows: C.filtered,
2020
+ formats: p,
2021
+ wording: b,
2022
+ sticky: fe(y),
2023
+ left: de
1286
2024
  },
1287
- D.key
2025
+ y.key
1288
2026
  )),
1289
- w.length > 0 && /* @__PURE__ */ c("td", { className: f.td })
2027
+ _.length > 0 && /* @__PURE__ */ l("td", { className: d.td })
1290
2028
  ] }) })
1291
2029
  ]
1292
2030
  }
@@ -1294,92 +2032,98 @@ function Ro({ registry: e, props: t }) {
1294
2032
  }
1295
2033
  );
1296
2034
  }
1297
- function Io({
2035
+ function mt(e) {
2036
+ for (const t of Array.from(e.querySelectorAll("tbody > tr[data-line='header']"))) {
2037
+ const n = t.cells[t.cells.length - 1], o = !!n && n.getBoundingClientRect().top > t.getBoundingClientRect().top + 0.5;
2038
+ t.toggleAttribute("data-stuck", o);
2039
+ }
2040
+ }
2041
+ function wt({
1298
2042
  entry: e,
1299
2043
  registry: t,
1300
2044
  hook: n,
1301
2045
  sticky: o,
1302
2046
  left: r
1303
2047
  }) {
1304
- const { spec: i } = e, s = n.publicSnapshot, l = t.kindOf(e, n.rows), a = Xe(l, i.rightAligned), u = t.isSortable(e, n.rows), d = i.id, h = s.sort.findIndex((w) => w.column === d), _ = h === -1 ? void 0 : s.sort[h].direction, g = s.sort.length > 1 && h !== -1 ? h + 1 : void 0, p = s.widths[d], b = 48, v = (w) => {
1305
- w.stopPropagation(), w.preventDefault();
1306
- const C = w.currentTarget, I = C.closest("th");
1307
- if (!I) return;
1308
- const A = w.clientX, S = I.getBoundingClientRect().width, T = w.pointerId;
1309
- C.setPointerCapture(T);
1310
- const L = (E) => {
1311
- E.pointerId === T && s.setWidth(d, Math.max(b, S + (E.clientX - A)));
1312
- }, F = (E) => {
1313
- E.pointerId === T && (C.removeEventListener("pointermove", L), C.removeEventListener("pointerup", F), C.removeEventListener("pointercancel", F), C.hasPointerCapture(T) && C.releasePointerCapture(T));
2048
+ const { spec: s } = e, i = n.publicSnapshot, a = t.kindOf(e, n.rows), c = Ot(a, s.rightAligned), u = t.isSortable(e, n.rows), h = s.id, f = i.sort.findIndex((T) => T.column === h), b = f === -1 ? void 0 : i.sort[f].direction, p = i.sort.length > 1 && f !== -1 ? f + 1 : void 0, k = i.widths[h], m = 48, w = (T) => {
2049
+ T.stopPropagation(), T.preventDefault();
2050
+ const x = T.currentTarget, _ = x.closest("th");
2051
+ if (!_) return;
2052
+ const S = T.clientX, O = _.getBoundingClientRect().width, A = T.pointerId;
2053
+ x.setPointerCapture(A);
2054
+ const I = (G) => {
2055
+ G.pointerId === A && i.setWidth(h, Math.max(m, O + (G.clientX - S)));
2056
+ }, $ = (G) => {
2057
+ G.pointerId === A && (x.removeEventListener("pointermove", I), x.removeEventListener("pointerup", $), x.removeEventListener("pointercancel", $), x.hasPointerCapture(A) && x.releasePointerCapture(A));
1314
2058
  };
1315
- C.addEventListener("pointermove", L), C.addEventListener("pointerup", F), C.addEventListener("pointercancel", F);
1316
- }, m = (w) => {
1317
- const C = w == null ? void 0 : w.parentElement, I = w == null ? void 0 : w.closest("table");
1318
- if (!w || !C || !I) return;
1319
- const A = Array.from(C.children).indexOf(w), S = C.children.length, T = { cell: w.style.width, table: I.style.width };
1320
- w.style.width = "", I.style.width = "auto";
1321
- let L = 0;
1322
- for (const F of Array.from(I.rows)) {
1323
- if (F.cells.length !== S) continue;
1324
- const E = F.cells[A];
1325
- E && (L = Math.max(L, E.scrollWidth));
2059
+ x.addEventListener("pointermove", I), x.addEventListener("pointerup", $), x.addEventListener("pointercancel", $);
2060
+ }, g = (T) => {
2061
+ const x = T == null ? void 0 : T.parentElement, _ = T == null ? void 0 : T.closest("table");
2062
+ if (!T || !x || !_) return;
2063
+ const S = Array.from(x.children).indexOf(T), O = x.children.length, A = { cell: T.style.width, table: _.style.width };
2064
+ T.style.width = "", _.style.width = "auto";
2065
+ let I = 0;
2066
+ for (const $ of Array.from(_.rows)) {
2067
+ if ($.cells.length !== O) continue;
2068
+ const G = $.cells[S];
2069
+ G && (I = Math.max(I, G.scrollWidth));
1326
2070
  }
1327
- w.style.width = T.cell, I.style.width = T.table, L > 0 && s.setWidth(d, Math.max(b, L + 1));
1328
- }, y = (w) => {
1329
- if (!i.resizable || !w.altKey) return;
1330
- const C = w.key === "ArrowRight", I = w.key === "ArrowLeft", A = w.key === "Home";
1331
- if (!C && !I && !A) return;
1332
- w.preventDefault();
1333
- const S = w.currentTarget;
1334
- if (A) {
1335
- m(S);
2071
+ T.style.width = A.cell, _.style.width = A.table, I > 0 && i.setWidth(h, Math.max(m, I + 1));
2072
+ }, v = (T) => {
2073
+ if (!s.resizable || !T.altKey) return;
2074
+ const x = T.key === "ArrowRight", _ = T.key === "ArrowLeft", S = T.key === "Home";
2075
+ if (!x && !_ && !S) return;
2076
+ T.preventDefault();
2077
+ const O = T.currentTarget;
2078
+ if (S) {
2079
+ g(O);
1336
2080
  return;
1337
2081
  }
1338
- const T = S.getBoundingClientRect().width, L = w.shiftKey ? 32 : 8;
1339
- s.setWidth(d, Math.max(b, T + (C ? L : -L)));
1340
- }, O = u ? /* @__PURE__ */ x(
2082
+ const A = O.getBoundingClientRect().width, I = T.shiftKey ? 32 : 8;
2083
+ i.setWidth(h, Math.max(m, A + (x ? I : -I)));
2084
+ }, N = u ? /* @__PURE__ */ L(
1341
2085
  "button",
1342
2086
  {
1343
2087
  type: "button",
1344
- className: f.sortButton,
1345
- onClick: (w) => s.toggleSort(d, w.shiftKey || w.metaKey),
2088
+ className: d.sortButton,
2089
+ onClick: (T) => i.toggleSort(h, T.shiftKey || T.metaKey),
1346
2090
  children: [
1347
- /* @__PURE__ */ c("span", { children: i.label }),
1348
- g !== void 0 && /* @__PURE__ */ c("span", { className: f.sortRank, "aria-hidden": "true", children: g }),
1349
- /* @__PURE__ */ c("span", { className: H(f.sortIndicator, _ && f.sortActive), "aria-hidden": "true", children: _ ? /* @__PURE__ */ c("svg", { viewBox: "0 0 10 10", width: "10", height: "10", className: H(f.sortArrow, _ === "desc" && f.sortArrowDesc), children: /* @__PURE__ */ c("path", { d: "M2.2 6.2 5 3.4l2.8 2.8", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }) }) : /* @__PURE__ */ x("svg", { viewBox: "0 0 10 12", width: "10", height: "12", children: [
1350
- /* @__PURE__ */ c("path", { d: "M2.4 4.4 5 1.8l2.6 2.6", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
1351
- /* @__PURE__ */ c("path", { d: "M2.4 7.6 5 10.2l2.6-2.6", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
2091
+ /* @__PURE__ */ l("span", { children: s.label }),
2092
+ p !== void 0 && /* @__PURE__ */ l("span", { className: d.sortRank, "aria-hidden": "true", children: p }),
2093
+ /* @__PURE__ */ l("span", { className: E(d.sortIndicator, b && d.sortActive), "aria-hidden": "true", children: b ? /* @__PURE__ */ l("svg", { viewBox: "0 0 10 10", width: "10", height: "10", className: E(d.sortArrow, b === "desc" && d.sortArrowDesc), children: /* @__PURE__ */ l("path", { d: "M2.2 6.2 5 3.4l2.8 2.8", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }) }) : /* @__PURE__ */ L("svg", { viewBox: "0 0 10 12", width: "10", height: "12", children: [
2094
+ /* @__PURE__ */ l("path", { d: "M2.4 4.4 5 1.8l2.6 2.6", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
2095
+ /* @__PURE__ */ l("path", { d: "M2.4 7.6 5 10.2l2.6-2.6", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
1352
2096
  ] }) })
1353
2097
  ]
1354
2098
  }
1355
- ) : i.label, N = _ === "asc" ? "ascending" : _ === "desc" ? "descending" : "none", M = se(i.filter) !== void 0 && !(i.filter === "list" && l === "other");
1356
- return /* @__PURE__ */ x(
2099
+ ) : s.label, C = b === "asc" ? "ascending" : b === "desc" ? "descending" : "none", D = me(s.filter) !== void 0 && !(s.filter === "list" && a === "other");
2100
+ return /* @__PURE__ */ L(
1357
2101
  "th",
1358
2102
  {
1359
2103
  scope: "col",
1360
- "data-column": d,
1361
- "aria-sort": u ? N : void 0,
1362
- tabIndex: i.resizable && !u ? 0 : void 0,
1363
- onKeyDown: y,
1364
- className: H(f.th, a && f.numeric, o && f.stickyCell),
2104
+ "data-column": h,
2105
+ "aria-sort": u ? C : void 0,
2106
+ tabIndex: s.resizable && !u ? 0 : void 0,
2107
+ onKeyDown: v,
2108
+ className: E(d.th, c && d.numeric, o && d.stickyCell),
1365
2109
  style: {
1366
- ...p !== void 0 ? { width: p } : {},
2110
+ ...k !== void 0 ? { width: k } : {},
1367
2111
  ...o ? { left: r } : {}
1368
2112
  },
1369
2113
  children: [
1370
- M ? /* @__PURE__ */ x("span", { className: f.thFlex, children: [
1371
- O,
1372
- /* @__PURE__ */ c(go, { entry: e, registry: t, hook: n })
1373
- ] }) : O,
1374
- i.resizable && /* @__PURE__ */ c(
2114
+ D ? /* @__PURE__ */ L("span", { className: d.thFlex, children: [
2115
+ N,
2116
+ /* @__PURE__ */ l(br, { entry: e, registry: t, hook: n })
2117
+ ] }) : N,
2118
+ s.resizable && /* @__PURE__ */ l(
1375
2119
  "span",
1376
2120
  {
1377
2121
  role: "presentation",
1378
- className: f.grip,
1379
- onPointerDown: v,
1380
- onClick: (w) => w.stopPropagation(),
1381
- onDoubleClick: (w) => {
1382
- w.stopPropagation(), m(w.currentTarget.closest("th"));
2122
+ className: d.grip,
2123
+ onPointerDown: w,
2124
+ onClick: (T) => T.stopPropagation(),
2125
+ onDoubleClick: (T) => {
2126
+ T.stopPropagation(), g(T.currentTarget.closest("th"));
1383
2127
  }
1384
2128
  }
1385
2129
  )
@@ -1387,612 +2131,652 @@ function Io({
1387
2131
  }
1388
2132
  );
1389
2133
  }
1390
- function Fo({
2134
+ function Wr({
1391
2135
  row: e,
1392
2136
  index: t,
1393
2137
  absolute: n,
1394
2138
  registry: o,
1395
2139
  hook: r,
1396
- columns: i,
1397
- header: s,
1398
- selectable: l,
1399
- actions: a,
2140
+ columns: s,
2141
+ header: i,
2142
+ selectable: a,
2143
+ actions: c,
1400
2144
  stickyRowHeader: u,
1401
- rowHeaderLeft: d,
1402
- columnCount: h,
1403
- rowProps: _,
1404
- baseId: g,
1405
- formats: p,
1406
- wording: b
2145
+ rowHeaderLeft: h,
2146
+ columnCount: f,
2147
+ rowProps: b,
2148
+ baseId: p,
2149
+ formats: k,
2150
+ wording: m,
2151
+ line: w,
2152
+ spanEntry: g
1407
2153
  }) {
1408
- const v = xe(at), m = r.publicSnapshot, y = r.rowKey(e), O = xo(e, s, r, p, b), N = o.detail, M = N !== null && m.expanded.includes(y), w = `${g}-detail-${t}`, { className: C, ...I } = (_ == null ? void 0 : _(e)) ?? {}, A = n !== void 0;
1409
- return /* @__PURE__ */ x(Q, { children: [
1410
- /* @__PURE__ */ x(
2154
+ const v = Ue(Wt), N = r.publicSnapshot, C = r.rowKey(e), D = jr(e, i, r, k, m), T = o.detail, x = T !== null && N.expanded.includes(C), _ = `${p}-detail-${t}`, { className: S, ...O } = (b == null ? void 0 : b(e)) ?? {}, A = n !== void 0;
2155
+ return /* @__PURE__ */ L(J, { children: [
2156
+ /* @__PURE__ */ L(
1411
2157
  "tr",
1412
2158
  {
1413
- ...I,
1414
- className: H(C, A && f.virtualRow),
2159
+ ...O,
2160
+ className: E(S, A && d.virtualRow),
1415
2161
  "data-row": A ? n : void 0,
2162
+ "data-line": w ? "row" : void 0,
2163
+ "data-motion": C,
2164
+ "data-group-first": w != null && w.first ? "" : void 0,
2165
+ "aria-level": w ? w.parents.length + 1 : void 0,
2166
+ "aria-posinset": w ? (w.span ?? w.parents.at(-1)).rows.indexOf(e) + 1 : void 0,
2167
+ "aria-setsize": w ? (w.span ?? w.parents.at(-1)).rows.length : void 0,
1416
2168
  tabIndex: A ? n === v ? 0 : -1 : void 0,
1417
2169
  "data-even": A && n % 2 === 1 ? "" : void 0,
1418
2170
  "aria-rowindex": A ? n + 2 : void 0,
1419
2171
  children: [
1420
- l && /* @__PURE__ */ c(
2172
+ a && /* @__PURE__ */ l(
1421
2173
  "td",
1422
2174
  {
1423
- className: H(f.td, f.control, u && f.stickyCell),
2175
+ className: E(d.td, d.control, u && d.stickyCell),
1424
2176
  style: u ? { left: 0 } : void 0,
1425
- children: /* @__PURE__ */ c(
1426
- ge,
2177
+ children: /* @__PURE__ */ l(
2178
+ Se,
1427
2179
  {
1428
- "aria-label": b.selectRow(O),
1429
- checked: m.selection.isSelected(y),
1430
- onChange: () => m.selection.toggle(y)
2180
+ "aria-label": m.selectRow(D),
2181
+ checked: N.selection.isSelected(C),
2182
+ onChange: () => N.selection.toggle(C)
1431
2183
  }
1432
2184
  )
1433
2185
  }
1434
2186
  ),
1435
- N && /* @__PURE__ */ c(
2187
+ T && /* @__PURE__ */ l(
1436
2188
  "td",
1437
2189
  {
1438
- className: H(f.td, f.control, u && f.stickyCell),
1439
- style: u ? { left: (l ? 1 : 0) * me } : void 0,
1440
- children: /* @__PURE__ */ c(
2190
+ className: E(d.td, d.control, u && d.stickyCell),
2191
+ style: u ? { left: (a ? 1 : 0) * Oe } : void 0,
2192
+ children: /* @__PURE__ */ l(
1441
2193
  "button",
1442
2194
  {
1443
2195
  type: "button",
1444
- "aria-expanded": M,
1445
- "aria-controls": M ? w : void 0,
1446
- "aria-label": M ? b.collapseRowNamed(O) : b.expandRowNamed(O),
1447
- className: H(f.expander, M && f.expanderOpen),
1448
- onClick: () => m.toggleRow(y),
1449
- children: /* @__PURE__ */ c("svg", { viewBox: "0 0 10 10", width: "10", height: "10", "aria-hidden": "true", children: /* @__PURE__ */ c("path", { d: "M3.5 1.5 7 5l-3.5 3.5", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
2196
+ "aria-expanded": x,
2197
+ "aria-controls": x ? _ : void 0,
2198
+ "aria-label": x ? m.collapseRowNamed(D) : m.expandRowNamed(D),
2199
+ className: E(d.expander, x && d.expanderOpen),
2200
+ onClick: () => N.toggleRow(C),
2201
+ children: /* @__PURE__ */ l("svg", { viewBox: "0 0 10 10", width: "10", height: "10", "aria-hidden": "true", children: /* @__PURE__ */ l("path", { d: "M3.5 1.5 7 5l-3.5 3.5", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
1450
2202
  }
1451
2203
  )
1452
2204
  }
1453
2205
  ),
1454
- i.map((S) => /* @__PURE__ */ c(
1455
- Lo,
2206
+ w && w.span && /* @__PURE__ */ l(Er, { line: { ...w, span: w.span }, entry: g, selectable: a, registry: o, hook: r, formats: k, wording: m }),
2207
+ s.map((I) => /* @__PURE__ */ l(
2208
+ qr,
1456
2209
  {
1457
- entry: S,
2210
+ entry: I,
1458
2211
  row: e,
1459
- kind: o.kindOf(S, r.rows),
1460
- sticky: u && S === s,
1461
- left: d,
1462
- formats: p,
1463
- wording: b
2212
+ kind: o.kindOf(I, r.rows),
2213
+ sticky: u && I === i,
2214
+ left: h,
2215
+ formats: k,
2216
+ wording: m
1464
2217
  },
1465
- S.key
2218
+ I.key
1466
2219
  )),
1467
- a.length > 0 && /* @__PURE__ */ c("td", { className: H(f.td, f.actionsCell), children: /* @__PURE__ */ c(Eo, { actions: a, row: e, name: O, wording: b }) })
2220
+ c.length > 0 && /* @__PURE__ */ l("td", { className: E(d.td, d.actionsCell), children: /* @__PURE__ */ l(Xr, { actions: c, row: e, name: D, wording: m }) })
1468
2221
  ]
1469
2222
  }
1470
2223
  ),
1471
- M && N && /* @__PURE__ */ c("tr", { id: w, className: f.detailRow, children: /* @__PURE__ */ c("td", { colSpan: h, className: f.detailCell, children: N.presentation(e) }) })
2224
+ x && T && /* @__PURE__ */ l("tr", { id: _, className: d.detailRow, children: /* @__PURE__ */ l("td", { colSpan: f, className: d.detailCell, children: T.presentation(e) }) })
1472
2225
  ] });
1473
2226
  }
1474
- function Lo({
2227
+ function qr({
1475
2228
  entry: e,
1476
2229
  row: t,
1477
2230
  kind: n,
1478
2231
  sticky: o,
1479
2232
  left: r,
1480
- formats: i,
1481
- wording: s
2233
+ formats: s,
2234
+ wording: i
1482
2235
  }) {
1483
- const { spec: l } = e, a = e.read(t), u = Xe(n, l.rightAligned);
1484
- let d;
1485
- U(a) ? d = /* @__PURE__ */ c(ct, { wording: s }) : l.presentation ? d = l.presentation(a, t) : d = ae(a, l.format, i, s);
1486
- const h = l.rowHeader ? "th" : "td";
1487
- return /* @__PURE__ */ c(
1488
- h,
2236
+ const { spec: a } = e, c = e.read(t), u = Ot(n, a.rightAligned);
2237
+ let h;
2238
+ Y(c) ? h = /* @__PURE__ */ l(Ht, { wording: i }) : a.presentation ? h = a.presentation(c, t) : h = _e(c, a.format, s, i);
2239
+ const f = a.rowHeader ? "th" : "td";
2240
+ return /* @__PURE__ */ l(
2241
+ f,
1489
2242
  {
1490
- scope: l.rowHeader ? "row" : void 0,
1491
- className: H(f.td, u && f.numeric, l.rowHeader && f.rowHeader, o && f.stickyCell),
2243
+ scope: a.rowHeader ? "row" : void 0,
2244
+ className: E(d.td, u && d.numeric, a.rowHeader && d.rowHeader, o && d.stickyCell),
1492
2245
  style: o ? { left: r } : void 0,
1493
- children: d
2246
+ children: h
1494
2247
  }
1495
2248
  );
1496
2249
  }
1497
- function zo({
2250
+ function Yr({
1498
2251
  entry: e,
1499
2252
  rows: t,
1500
2253
  formats: n,
1501
2254
  wording: o,
1502
2255
  sticky: r,
1503
- left: i
2256
+ left: s
1504
2257
  }) {
1505
- const { footer: s, format: l } = e.spec, a = H(f.td, f.numeric, r && f.stickyCell), u = r ? { left: i } : void 0;
1506
- if (!s) return /* @__PURE__ */ c("td", { className: H(f.td, r && f.stickyCell), style: u });
1507
- const d = Ht(t, e.read, s);
1508
- return /* @__PURE__ */ x("td", { className: a, style: u, "data-footer": s, children: [
1509
- /* @__PURE__ */ c("span", { "aria-hidden": "true", className: f.footerKind, children: s === "sum" ? "Σ" : "⌀" }),
1510
- /* @__PURE__ */ x(be, { children: [
1511
- s === "sum" ? o.footerSum : o.footerAverage,
1512
- " "
1513
- ] }),
1514
- d === void 0 ? /* @__PURE__ */ c(ct, { wording: o }) : ae(d, l, n, o)
1515
- ] });
2258
+ const i = r ? { left: s } : void 0;
2259
+ if (!e.spec.aggregate) return /* @__PURE__ */ l("td", { className: E(d.td, r && d.stickyCell), style: i });
2260
+ const a = typeof e.spec.aggregate == "function" ? "own" : e.spec.aggregate;
2261
+ return /* @__PURE__ */ l("td", { className: E(d.td, $t(e, t) && d.numeric, r && d.stickyCell), style: i, "data-footer": a, children: /* @__PURE__ */ l(Ke, { entry: e, rows: t, formats: n, wording: o, signed: !0 }) });
1516
2262
  }
1517
- const jo = 2;
1518
- function Eo({
2263
+ const Ur = 2;
2264
+ function Xr({
1519
2265
  actions: e,
1520
2266
  row: t,
1521
2267
  name: n,
1522
2268
  wording: o
1523
2269
  }) {
1524
- const r = (i) => {
1525
- const s = i.onSelect;
1526
- s(i.bulk ? [t] : t);
2270
+ const r = (s) => {
2271
+ const i = s.onSelect;
2272
+ i(s.bulk ? [t] : t);
1527
2273
  };
1528
- return e.length <= jo ? /* @__PURE__ */ c("div", { className: f.actions, children: e.map(({ key: i, spec: s }) => /* @__PURE__ */ c(
1529
- G,
2274
+ return e.length <= Ur ? /* @__PURE__ */ l("div", { className: d.actions, children: e.map(({ key: s, spec: i }) => /* @__PURE__ */ l(
2275
+ ee,
1530
2276
  {
1531
2277
  size: "sm",
1532
2278
  variant: "ghost",
1533
- "aria-label": o.rowAction(s.label, n),
1534
- onClick: () => r(s),
1535
- children: s.label
2279
+ "aria-label": o.rowAction(i.label, n),
2280
+ onClick: () => r(i),
2281
+ children: i.label
1536
2282
  },
1537
- i
1538
- )) }) : /* @__PURE__ */ c("div", { className: f.actions, children: /* @__PURE__ */ c(
1539
- Nt,
2283
+ s
2284
+ )) }) : /* @__PURE__ */ l("div", { className: d.actions, children: /* @__PURE__ */ l(
2285
+ At,
1540
2286
  {
1541
2287
  align: "end",
1542
- trigger: /* @__PURE__ */ c(G, { size: "sm", variant: "ghost", "aria-label": o.rowActionsMenu(n), children: "⋯" }),
1543
- children: e.map(({ key: i, spec: s }) => /* @__PURE__ */ c(At, { tone: s.tone, onSelect: () => r(s), children: s.label }, i))
2288
+ trigger: /* @__PURE__ */ l(ee, { size: "sm", variant: "ghost", "aria-label": o.rowActionsMenu(n), children: "⋯" }),
2289
+ children: e.map(({ key: s, spec: i }) => /* @__PURE__ */ l(Fe, { tone: i.tone, onSelect: () => r(i), children: i.label }, s))
1544
2290
  }
1545
2291
  ) });
1546
2292
  }
1547
- function Po({ columns: e, rows: t = 4 }) {
2293
+ function Jr({ columns: e, rows: t = 4 }) {
1548
2294
  const n = [72, 48, 60, 40, 56, 64];
1549
- return /* @__PURE__ */ c(Q, { children: Array.from({ length: t }, (o, r) => /* @__PURE__ */ c("tr", { "aria-hidden": "true", children: Array.from({ length: e }, (i, s) => /* @__PURE__ */ c("td", { className: f.td, children: /* @__PURE__ */ c("span", { className: f.skeleton, style: { width: `${n[(r + s) % n.length]}%` } }) }, s)) }, r)) });
2295
+ return /* @__PURE__ */ l(J, { children: Array.from({ length: t }, (o, r) => /* @__PURE__ */ l("tr", { "aria-hidden": "true", children: Array.from({ length: e }, (s, i) => /* @__PURE__ */ l("td", { className: d.td, children: /* @__PURE__ */ l("span", { className: d.skeleton, style: { width: `${n[(r + i) % n.length]}%` } }) }, i)) }, r)) });
1550
2296
  }
1551
- const at = Ge(0);
1552
- function We({ height: e, colSpan: t }) {
1553
- return e <= 0 ? null : /* @__PURE__ */ c("tr", { "aria-hidden": "true", "data-filler": "", className: f.fillerRow, children: /* @__PURE__ */ c("td", { colSpan: t, style: { height: e } }) });
2297
+ const Wt = yt(0);
2298
+ function bt({ height: e, colSpan: t }) {
2299
+ return e <= 0 ? null : /* @__PURE__ */ l("tr", { "aria-hidden": "true", "data-filler": "", className: d.fillerRow, children: /* @__PURE__ */ l("td", { colSpan: t, style: { height: e } }) });
1554
2300
  }
1555
- function Mo({
2301
+ function kt({
1556
2302
  virtual: e,
1557
2303
  colSpan: t,
1558
2304
  children: n
1559
2305
  }) {
1560
- const { count: o, fillerBefore: r, fillerAfter: i, showRow: s } = e, l = oe(null), [a, u] = P(0), d = (g, p) => {
1561
- l.current = p, u(p), s(p), requestAnimationFrame(() => {
1562
- var b;
1563
- (b = g.querySelector(`[data-row="${p}"]`)) == null || b.focus();
2306
+ const { count: o, fillerBefore: r, fillerAfter: s, showRow: i } = e, a = Z(null), [c, u] = z(0), h = (p, k) => {
2307
+ a.current = k, u(k), i(k), requestAnimationFrame(() => {
2308
+ var m;
2309
+ (m = p.querySelector(`[data-row="${k}"]`)) == null || m.focus();
1564
2310
  });
1565
- }, h = a >= e.from && a < e.to ? a : e.from, _ = (g) => {
1566
- if (g.defaultPrevented || o === 0) return;
1567
- const p = g.target, b = p.closest("[data-row]");
1568
- if (b && p !== b) return;
1569
- const v = b ? Number(b.dataset.row) : l.current ?? -1;
1570
- let m = null;
1571
- g.key === "ArrowDown" ? m = Math.min(o - 1, v + 1) : g.key === "ArrowUp" ? m = Math.max(0, v - 1) : g.key === "Home" ? m = 0 : g.key === "End" && (m = o - 1), !(m === null || m === v) && (g.preventDefault(), d(g.currentTarget, m));
2311
+ }, f = c >= e.from && c < e.to ? c : e.from, b = (p) => {
2312
+ if (p.defaultPrevented || o === 0) return;
2313
+ const k = p.target, m = k.closest("[data-row]");
2314
+ if (m && k !== m) return;
2315
+ const w = m ? Number(m.dataset.row) : a.current ?? -1;
2316
+ let g = null;
2317
+ p.key === "ArrowDown" ? g = Math.min(o - 1, w + 1) : p.key === "ArrowUp" ? g = Math.max(0, w - 1) : p.key === "Home" ? g = 0 : p.key === "End" && (g = o - 1), !(g === null || g === w) && (p.preventDefault(), h(p.currentTarget, g));
1572
2318
  };
1573
- return /* @__PURE__ */ c(
2319
+ return /* @__PURE__ */ l(
1574
2320
  "tbody",
1575
2321
  {
1576
- className: f.virtualBody,
1577
- onKeyDown: _,
1578
- onFocus: (g) => {
1579
- const p = g.target.closest("[data-row]");
1580
- p && u(Number(p.dataset.row));
2322
+ className: d.virtualBody,
2323
+ onKeyDown: b,
2324
+ onFocus: (p) => {
2325
+ const k = p.target.closest("[data-row]");
2326
+ k && u(Number(k.dataset.row));
1581
2327
  },
1582
- children: /* @__PURE__ */ x(at.Provider, { value: h, children: [
1583
- /* @__PURE__ */ c(We, { height: r, colSpan: t }),
2328
+ children: /* @__PURE__ */ L(Wt.Provider, { value: f, children: [
2329
+ /* @__PURE__ */ l(bt, { height: r, colSpan: t }),
1584
2330
  n,
1585
- /* @__PURE__ */ c(We, { height: i, colSpan: t })
2331
+ /* @__PURE__ */ l(bt, { height: s, colSpan: t })
1586
2332
  ] })
1587
2333
  }
1588
2334
  );
1589
2335
  }
1590
- const Do = "_verdict_a8pbv_6", Vo = "_glyph_a8pbv_13", Ho = "_value_a8pbv_23", Bo = "_excess_a8pbv_28", he = {
1591
- verdict: Do,
1592
- glyph: Vo,
1593
- value: Ho,
1594
- excess: Bo
1595
- }, Ke = (e, t, n) => t === "percent" ? n.percent(e) : t === "count" ? n.count(e) : n.number(e, typeof t == "object" ? t.decimals : void 0), $o = (e, t) => e === "alarm" ? t.verdictAlarm : e === "warning" ? t.verdictWarning : e === "unknown" ? t.verdictUnknown : t.verdictOk, Wo = {
2336
+ const Qr = "_verdict_a8pbv_6", Zr = "_glyph_a8pbv_13", es = "_value_a8pbv_23", ts = "_excess_a8pbv_28", Te = {
2337
+ verdict: Qr,
2338
+ glyph: Zr,
2339
+ value: es,
2340
+ excess: ts
2341
+ }, vt = (e, t, n) => t === "percent" ? n.percent(e) : t === "count" ? n.count(e) : n.number(e, typeof t == "object" ? t.decimals : void 0), ns = (e, t) => e === "alarm" ? t.verdictAlarm : e === "warning" ? t.verdictWarning : e === "unknown" ? t.verdictUnknown : t.verdictOk, os = {
1596
2342
  ok: "✓",
1597
2343
  unknown: "?",
1598
2344
  warning: "▲",
1599
2345
  alarm: "■"
1600
2346
  };
1601
- function Ko({ reading: e, format: t }) {
1602
- const n = te(), o = $(), { measured: r, assessment: i } = e, s = $o(i.verdict, o);
1603
- return /* @__PURE__ */ x("span", { className: he.verdict, "data-verdict": i.verdict, title: s, children: [
1604
- /* @__PURE__ */ c("span", { "aria-hidden": "true", className: he.glyph, children: Wo[i.verdict] }),
1605
- /* @__PURE__ */ c("span", { className: he.value, children: r === null ? o.statAbsentValue : Ke(r, t, n) }),
1606
- i.excess !== void 0 && /* @__PURE__ */ x("span", { className: he.excess, children: [
2347
+ function rs({ reading: e, format: t }) {
2348
+ const n = ue(), o = U(), { measured: r, assessment: s } = e, i = ns(s.verdict, o);
2349
+ return /* @__PURE__ */ L("span", { className: Te.verdict, "data-verdict": s.verdict, title: i, children: [
2350
+ /* @__PURE__ */ l("span", { "aria-hidden": "true", className: Te.glyph, children: os[s.verdict] }),
2351
+ /* @__PURE__ */ l("span", { className: Te.value, children: r === null ? o.statAbsentValue : vt(r, t, n) }),
2352
+ s.excess !== void 0 && /* @__PURE__ */ L("span", { className: Te.excess, children: [
1607
2353
  "+",
1608
- Ke(i.excess, t, n)
2354
+ vt(s.excess, t, n)
1609
2355
  ] }),
1610
- /* @__PURE__ */ c(be, { children: s })
2356
+ /* @__PURE__ */ l(Re, { children: i })
1611
2357
  ] });
1612
2358
  }
1613
- const Go = (e) => e.measured;
1614
- function Uo(e) {
1615
- return function({ id: n, value: o, label: r, limits: i, format: s, sortBy: l = "verdict", width: a, resizable: u }) {
1616
- const d = JSON.stringify(i), h = V(() => {
1617
- const g = JSON.parse(d);
1618
- return (p) => {
1619
- const b = typeof o == "string" ? p == null ? void 0 : p[o] : o(p);
2359
+ const ss = (e) => e.measured, is = (e) => e.reduce(
2360
+ (t, n) => !t || Be(n.assessment.verdict) > Be(t.assessment.verdict) ? n : t,
2361
+ void 0
2362
+ );
2363
+ function as(e) {
2364
+ return function({ id: n, value: o, label: r, limits: s, format: i, sortBy: a = "verdict", width: c, resizable: u, aggregate: h }) {
2365
+ const f = JSON.stringify(s), b = j(() => {
2366
+ const k = JSON.parse(f);
2367
+ return (m) => {
2368
+ const w = typeof o == "string" ? m == null ? void 0 : m[o] : o(m);
1620
2369
  return {
1621
- measured: typeof b == "number" && Number.isFinite(b) ? b : null,
1622
- assessment: xt(b, g)
2370
+ measured: typeof w == "number" && Number.isFinite(w) ? w : null,
2371
+ assessment: tn(w, k)
1623
2372
  };
1624
2373
  };
1625
- }, [o, d]), _ = B(
1626
- (g) => l === "value" ? g.measured : Tt(g.assessment.verdict),
1627
- [l]
2374
+ }, [o, f]), p = X(
2375
+ (k) => a === "value" ? k.measured : Be(k.assessment.verdict),
2376
+ [a]
1628
2377
  );
1629
- return /* @__PURE__ */ c(
2378
+ return /* @__PURE__ */ l(
1630
2379
  e,
1631
2380
  {
1632
2381
  id: n ?? (typeof o == "string" ? o : void 0),
1633
2382
  label: r,
1634
2383
  numeric: !0,
1635
- width: a,
2384
+ width: c,
1636
2385
  resizable: u,
1637
- value: h,
1638
- sortValue: _,
1639
- exportValue: Go,
1640
- children: (g) => /* @__PURE__ */ c(Ko, { reading: g, format: s })
2386
+ value: b,
2387
+ sortValue: p,
2388
+ exportValue: ss,
2389
+ aggregate: h === "worst" ? is : void 0,
2390
+ children: (k) => /* @__PURE__ */ l(rs, { reading: k, format: i })
1641
2391
  }
1642
2392
  );
1643
2393
  };
1644
2394
  }
1645
- const dt = (e) => re(
2395
+ const qt = (e) => pe(
1646
2396
  `condition-foreign:${e}`,
1647
2397
  `The condition for "${e}" is not of the kind of its filter and is passed over.`
1648
2398
  );
1649
- function ut(e, t, n) {
1650
- const o = e.columnById(t), r = o ? se(o.spec.filter) : void 0;
2399
+ function Yt(e, t, n) {
2400
+ const o = e.columnById(t), r = o ? me(o.spec.filter) : void 0;
1651
2401
  if (!r) return !1;
1652
- const i = et(r, n);
1653
- return i === "foreign" && dt(t), i === "effective";
2402
+ const s = Dt(r, n);
2403
+ return s === "foreign" && qt(t), s === "effective";
1654
2404
  }
1655
- function qo(e, t) {
2405
+ function ls(e, t) {
1656
2406
  if (e.length === 0) return;
1657
2407
  let n = -1, o = [];
1658
2408
  return (r) => {
1659
2409
  if (n !== t.structureVersion()) {
1660
2410
  n = t.structureVersion(), o = [];
1661
- for (const [i, s] of e) {
1662
- const l = t.columnById(i);
1663
- l && ut(t, i, s) && o.push({ entry: l, condition: s });
2411
+ for (const [s, i] of e) {
2412
+ const a = t.columnById(s);
2413
+ a && Yt(t, s, i) && o.push({ entry: a, condition: i });
1664
2414
  }
1665
2415
  }
1666
- return o.every(({ entry: i, condition: s }) => {
1667
- const l = se(i.spec.filter);
1668
- return !l || Jn(l, i.read(r), s);
2416
+ return o.every(({ entry: s, condition: i }) => {
2417
+ const a = me(s.spec.filter);
2418
+ return !a || tr(a, s.read(r), i);
1669
2419
  });
1670
2420
  };
1671
2421
  }
1672
- function Yo(e, t) {
1673
- const n = V(() => t ? e.filter((s) => t(s)) : e, [e, t]), [o, r] = P(() => ({ source: e, result: n }));
2422
+ function cs(e, t) {
2423
+ const n = j(() => t ? e.filter((i) => t(i)) : e, [e, t]), [o, r] = z(() => ({ source: e, result: n }));
1674
2424
  if (!t) return e;
1675
- const i = o.source === e && (o.result === n || o.result.length === n.length && o.result.every((s, l) => s === n[l]));
1676
- return i || r({ source: e, result: n }), i ? o.result : n;
2425
+ const s = o.source === e && (o.result === n || o.result.length === n.length && o.result.every((i, a) => i === n[a]));
2426
+ return s || r({ source: e, result: n }), s ? o.result : n;
1677
2427
  }
1678
- function Xo(e, t) {
1679
- var l, a, u, d, h, _;
2428
+ function us(e, t) {
2429
+ var a, c, u, h, f, b;
1680
2430
  if (t.size === 0) return e;
1681
- const n = (l = e.sort) == null ? void 0 : l.filter((g) => t.has(g.column)), o = (a = e.hidden) == null ? void 0 : a.filter((g) => t.has(g)), r = (u = e.order) == null ? void 0 : u.filter((g) => t.has(g)), i = e.widths ? Object.fromEntries(Object.entries(e.widths).filter(([g]) => t.has(g))) : void 0;
1682
- return (n == null ? void 0 : n.length) === ((d = e.sort) == null ? void 0 : d.length) && (o == null ? void 0 : o.length) === ((h = e.hidden) == null ? void 0 : h.length) && (r == null ? void 0 : r.length) === ((_ = e.order) == null ? void 0 : _.length) && Object.keys(i ?? {}).length === Object.keys(e.widths ?? {}).length ? e : {
2431
+ const n = (a = e.sort) == null ? void 0 : a.filter((p) => t.has(p.column)), o = (c = e.hidden) == null ? void 0 : c.filter((p) => t.has(p)), r = (u = e.order) == null ? void 0 : u.filter((p) => t.has(p)), s = e.widths ? Object.fromEntries(Object.entries(e.widths).filter(([p]) => t.has(p))) : void 0;
2432
+ return (n == null ? void 0 : n.length) === ((h = e.sort) == null ? void 0 : h.length) && (o == null ? void 0 : o.length) === ((f = e.hidden) == null ? void 0 : f.length) && (r == null ? void 0 : r.length) === ((b = e.order) == null ? void 0 : b.length) && Object.keys(s ?? {}).length === Object.keys(e.widths ?? {}).length ? e : {
1683
2433
  ...e.search ? { search: e.search } : {},
1684
2434
  ...e.page ? { page: e.page } : {},
1685
2435
  ...e.pageSize ? { pageSize: e.pageSize } : {},
1686
2436
  ...n != null && n.length ? { sort: n } : {},
1687
2437
  ...o != null && o.length ? { hidden: o } : {},
1688
2438
  ...r != null && r.length ? { order: r } : {},
1689
- ...i && Object.keys(i).length ? { widths: i } : {}
2439
+ ...s && Object.keys(s).length ? { widths: s } : {}
2440
+ };
2441
+ }
2442
+ const Ee = (e) => e === void 0 ? [] : typeof e == "string" ? [e] : [...e], ds = (e, t) => e.length === t.length && e.every((n, o) => n === t[o]);
2443
+ function _t(e) {
2444
+ const t = [], n = (o) => {
2445
+ for (const r of o)
2446
+ t.push(r.path), n(r.groups);
1690
2447
  };
2448
+ return n(e ?? []), t;
1691
2449
  }
1692
- const Jo = (e, t) => e.size === t.size && [...e].every((n) => t.has(n));
1693
- function Qo(e, t) {
2450
+ const fs = (e, t) => e.size === t.size && [...e].every((n) => t.has(n));
2451
+ function hs(e, t) {
1694
2452
  const n = {};
1695
2453
  for (const o of e) o.width !== void 0 && (n[o.id] = o.width);
1696
2454
  return { ...n, ...t };
1697
2455
  }
1698
- function Zo(e, t) {
1699
- const [n] = P(() => new ho()), [o] = P(() => {
1700
- const S = To(n);
1701
- return { ...S, VerdictColumn: Uo(S.Column) };
2456
+ function gs(e, t) {
2457
+ const [n] = z(() => new gr()), [o] = z(() => {
2458
+ const y = Hr(n);
2459
+ return { ...y, VerdictColumn: as(y.Column) };
1702
2460
  });
1703
- pe(n.subscribe, n.structureVersion, n.structureVersion);
1704
- const r = te(), i = e, s = n.modelColumns(i, r), [l] = P(() => t.initialView), [a, u] = P(() => Object.entries((l == null ? void 0 : l.conditions) ?? {})), d = V(() => qo(a, n), [a, n]), h = t.preFilter ?? t.filter, _ = Yo(i, h), g = t.rowKey, p = Et(_, s, {
1705
- rowKey: g,
2461
+ Le(n.subscribe, n.structureVersion, n.structureVersion);
2462
+ const r = ue(), s = e, i = n.modelColumns(s, r), [a] = z(() => t.initialView), [c, u] = z(() => Object.entries((a == null ? void 0 : a.conditions) ?? {})), h = j(() => ls(c, n), [c, n]), f = t.preFilter ?? t.filter, b = cs(s, f), [p, k] = z(
2463
+ () => a != null && a.grouping ? [...a.grouping] : Ee(t.defaultGrouping)
2464
+ ), [m, w] = z(() => (a == null ? void 0 : a.folded) ?? []), g = n.orderedColumns().length + n.groupKeys.entries.size > 0, v = g ? n.effectiveGrouping(p, s) : p.slice(0, Qe), N = v.join("|"), C = j(() => new Set(m), [m]), D = v.length ? n.groupingModel(v, s) : null, T = j(
2465
+ () => D && D.levels.length ? { ...D, folded: C, compareText: r.compareText } : void 0,
2466
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- the model's identity carries the ids and the columns
2467
+ [D, C, r.compareText, N]
2468
+ ), x = t.rowKey, _ = kn(b, i, {
2469
+ rowKey: x,
1706
2470
  pageSize: t.pageSize,
1707
2471
  defaultSort: t.defaultSort,
1708
- filter: d,
1709
- initialView: l,
1710
- virtual: t.virtual
1711
- }), { setPage: b } = p, v = B(
1712
- (S, T) => {
1713
- let L = T == null;
1714
- if (!L && n.orderedColumns().length > 0) {
1715
- const F = n.columnById(S), E = F ? se(F.spec.filter) : void 0;
1716
- if (!E) {
1717
- re(
1718
- `condition-without-filter:${S}`,
1719
- F ? `The column "${S}" has no filter; its condition is passed over.` : `No column is called "${S}"; its condition is passed over.`
2472
+ filter: h,
2473
+ initialView: a,
2474
+ virtual: t.virtual,
2475
+ grouping: T
2476
+ }), { setPage: S } = _, O = X(
2477
+ (y, R) => {
2478
+ let q = R == null;
2479
+ if (!q && n.orderedColumns().length > 0) {
2480
+ const H = n.columnById(y), M = H ? me(H.spec.filter) : void 0;
2481
+ if (!M) {
2482
+ pe(
2483
+ `condition-without-filter:${y}`,
2484
+ H ? `The column "${y}" has no filter; its condition is passed over.` : `No column is called "${y}"; its condition is passed over.`
1720
2485
  );
1721
2486
  return;
1722
2487
  }
1723
- const W = et(E, T);
1724
- if (W === "foreign") {
1725
- dt(S);
2488
+ const Q = Dt(M, R);
2489
+ if (Q === "foreign") {
2490
+ qt(y);
1726
2491
  return;
1727
2492
  }
1728
- L = W === "empty";
2493
+ q = Q === "empty";
1729
2494
  }
1730
- u((F) => {
1731
- const E = F.findIndex(([W]) => W === S);
1732
- return L ? E === -1 ? F : F.filter((W, q) => q !== E) : E === -1 ? [...F, [S, T]] : F.map((W, q) => q === E ? [S, T] : W);
1733
- }), b(1);
2495
+ u((H) => {
2496
+ const M = H.findIndex(([Q]) => Q === y);
2497
+ return q ? M === -1 ? H : H.filter((Q, ne) => ne !== M) : M === -1 ? [...H, [y, R]] : H.map((Q, ne) => ne === M ? [y, R] : Q);
2498
+ }), S(1);
1734
2499
  },
1735
- [n, b]
1736
- ), m = new Set(n.orderedColumns().map((S) => S.spec.id)), [y, O] = P(() => /* @__PURE__ */ new Set());
1737
- if (!Jo(y, m)) {
1738
- const S = new Set([...y].filter((T) => !m.has(T)));
1739
- O(m), a.some(([T]) => S.has(T)) && u((T) => T.filter(([L]) => !S.has(L)));
2500
+ [n, S]
2501
+ ), A = new Set(n.orderedColumns().map((y) => y.spec.id)), [I, $] = z(() => /* @__PURE__ */ new Set());
2502
+ if (!fs(I, A)) {
2503
+ const y = new Set([...I].filter((R) => !A.has(R)));
2504
+ $(A), c.some(([R]) => y.has(R)) && u((R) => R.filter(([q]) => !y.has(q)));
1740
2505
  }
1741
- const N = m.size === 0 ? a : a.filter(([S, T]) => ut(n, S, T)), M = Xo(p.view, m), w = N.length > 0 ? { ...M, conditions: Object.fromEntries(N) } : M, C = m.size === 0 ? p.sort : p.sort.filter((S) => m.has(S.column)), I = n.paginates() || t.virtual !== void 0, A = {
2506
+ const G = A.size === 0 ? c : c.filter(([y, R]) => Yt(n, y, R)), W = us(_.view, A), ie = G.length > 0 ? { ...W, conditions: Object.fromEntries(G) } : W, ae = A.size === 0 ? _.sort : _.sort.filter((y) => A.has(y.column)), de = g ? n.effectiveGrouping(Ee(t.defaultGrouping), s) : Ee(t.defaultGrouping), fe = _.groups ? fn(_.groups, m) : g ? [] : [...m], we = {
2507
+ ...ie,
2508
+ ...ds(v, de) ? {} : { grouping: v },
2509
+ ...fe.length ? { folded: fe } : {}
2510
+ }, be = (y) => {
2511
+ k([...y]), S(1);
2512
+ }, ye = (y) => {
2513
+ _t(_.groups).includes(y) && w((R) => R.includes(y) ? R.filter((q) => q !== y) : [...R, y]);
2514
+ }, le = n.paginates() || t.virtual !== void 0, te = {
1742
2515
  rows: e,
1743
- filtered: p.filtered,
1744
- visible: I ? p.visible : p.filtered,
1745
- page: I ? p.page : 1,
1746
- pageCount: I ? p.pageCount : 1,
1747
- pageSize: p.pageSize,
1748
- setPage: p.setPage,
1749
- setPageSize: p.setPageSize,
1750
- search: p.search,
1751
- setSearch: p.setSearch,
1752
- sort: C,
1753
- toggleSort: p.toggleSort,
1754
- hidden: p.hidden,
1755
- toggleColumn: p.toggleColumn,
1756
- order: p.order,
1757
- setOrder: p.setOrder,
1758
- widths: Qo(s, p.widths),
1759
- setWidth: p.setWidth,
1760
- expanded: p.expanded,
1761
- toggleRow: p.toggleRow,
1762
- filter: Object.fromEntries(N),
1763
- setFilter: v,
1764
- selection: t.selection ?? p.selection,
1765
- view: w,
1766
- asCsv: () => So(n),
2516
+ filtered: _.filtered,
2517
+ visible: le ? _.visible : _.filtered,
2518
+ page: le ? _.page : 1,
2519
+ pageCount: le ? _.pageCount : 1,
2520
+ pageSize: _.pageSize,
2521
+ setPage: _.setPage,
2522
+ setPageSize: _.setPageSize,
2523
+ search: _.search,
2524
+ setSearch: _.setSearch,
2525
+ sort: ae,
2526
+ toggleSort: _.toggleSort,
2527
+ hidden: _.hidden,
2528
+ toggleColumn: _.toggleColumn,
2529
+ order: _.order,
2530
+ setOrder: _.setOrder,
2531
+ widths: hs(i, _.widths),
2532
+ setWidth: _.setWidth,
2533
+ expanded: _.expanded,
2534
+ toggleRow: _.toggleRow,
2535
+ filter: Object.fromEntries(G),
2536
+ setFilter: O,
2537
+ selection: t.selection ?? _.selection,
2538
+ view: we,
2539
+ grouping: v,
2540
+ setGrouping: be,
2541
+ folded: fe,
2542
+ toggleFold: ye,
2543
+ foldAll: () => w(_t(_.groups)),
2544
+ unfoldAll: () => w([]),
2545
+ asCsv: () => xr(n),
1767
2546
  virtual: t.virtual !== void 0
1768
2547
  };
1769
2548
  return n.setHook({
1770
- rows: i,
1771
- admitted: _,
1772
- modelColumns: s,
1773
- companion: p,
1774
- filter: d,
1775
- publicSnapshot: A,
1776
- rowKey: g,
2549
+ rows: s,
2550
+ admitted: b,
2551
+ modelColumns: i,
2552
+ companion: _,
2553
+ filter: h,
2554
+ grouping: T,
2555
+ folded: C,
2556
+ publicSnapshot: te,
2557
+ rowKey: x,
1777
2558
  formats: r
1778
- }), { ...A, ...o };
2559
+ }), { ...te, ...o };
1779
2560
  }
1780
- function Er(e) {
2561
+ function Js(e) {
1781
2562
  return e;
1782
2563
  }
1783
- function Ie(e, t) {
1784
- const n = Z();
1785
- e == null || e.register(t, n), J(() => {
2564
+ function nt(e, t) {
2565
+ const n = se();
2566
+ e == null || e.register(t, n), K(() => {
1786
2567
  if (e)
1787
2568
  return e.register(t, n), e.commit(), () => {
1788
2569
  e.remove(t, n), e.commit();
1789
2570
  };
1790
2571
  }, [e, t, n]);
1791
2572
  }
1792
- function Pr({ children: e, className: t, of: n }) {
1793
- const o = ue(n);
1794
- Ie(o == null ? void 0 : o.registry, "toolbar");
2573
+ function Qs({ children: e, className: t, of: n }) {
2574
+ const o = xe(n);
2575
+ nt(o == null ? void 0 : o.registry, "toolbar");
1795
2576
  const r = o == null ? void 0 : o.registry;
1796
- return /* @__PURE__ */ c(lt, { registry: r ?? null, className: t, children: e });
1797
- }
1798
- function Mr({ placeholder: e, "aria-label": t, className: n, of: o }) {
1799
- const r = ue(o), i = $();
1800
- if (Ie(r == null ? void 0 : r.registry, "search"), !r) return null;
1801
- const { snapshot: s } = r;
1802
- return /* @__PURE__ */ c(
1803
- Rt,
2577
+ return /* @__PURE__ */ l(jt, { registry: r ?? null, className: t, children: e });
2578
+ }
2579
+ function Zs({ placeholder: e, "aria-label": t, className: n, of: o }) {
2580
+ const r = xe(o), s = U();
2581
+ if (nt(r == null ? void 0 : r.registry, "search"), !r) return null;
2582
+ const { snapshot: i } = r;
2583
+ return /* @__PURE__ */ l(
2584
+ on,
1804
2585
  {
1805
2586
  size: "sm",
1806
2587
  type: "search",
1807
2588
  className: n,
1808
- value: s.search,
1809
- onChange: (l) => s.setSearch(l.target.value),
2589
+ value: i.search,
2590
+ onChange: (a) => i.setSearch(a.target.value),
1810
2591
  clearable: !0,
1811
- onClear: () => s.setSearch(""),
1812
- placeholder: e ?? i.tableSearchPlaceholder,
1813
- "aria-label": t ?? i.tableSearchLabel
2592
+ onClear: () => i.setSearch(""),
2593
+ placeholder: e ?? s.tableSearchPlaceholder,
2594
+ "aria-label": t ?? s.tableSearchLabel
1814
2595
  }
1815
2596
  );
1816
2597
  }
1817
- function Dr({ of: e }) {
1818
- var v;
1819
- const t = ue(e), n = $(), [o, r] = P(!1), i = oe(null), s = oe(null), l = Z(), [a, u] = P(null);
1820
- if (J(() => {
1821
- var N;
1822
- if (!a || !s.current) return;
1823
- const m = Array.from(s.current.children).find(
1824
- (M) => M.dataset.column === a.id
1825
- ), y = m == null ? void 0 : m.querySelector(`[data-direction="${a.direction}"]`), O = m == null ? void 0 : m.querySelector(
1826
- `[data-direction="${a.direction === "forward" ? "backward" : "forward"}"]`
2598
+ function ei({ of: e }) {
2599
+ var w;
2600
+ const t = xe(e), n = U(), [o, r] = z(!1), s = Z(null), i = Z(null), a = se(), [c, u] = z(null);
2601
+ if (K(() => {
2602
+ var C;
2603
+ if (!c || !i.current) return;
2604
+ const g = Array.from(i.current.children).find(
2605
+ (D) => D.dataset.column === c.id
2606
+ ), v = g == null ? void 0 : g.querySelector(`[data-direction="${c.direction}"]`), N = g == null ? void 0 : g.querySelector(
2607
+ `[data-direction="${c.direction === "forward" ? "backward" : "forward"}"]`
1827
2608
  );
1828
- (N = y && !y.disabled ? y : O) == null || N.focus();
1829
- }, [a]), !t) return null;
1830
- const { registry: d, snapshot: h } = t, _ = d.hook, g = d.withStickyHeaderFirst(
1831
- Te(d.modelColumns(_.rows, _.formats), h.order)
1832
- ), p = d.stickyRowHeader ? ((v = g[0]) == null ? void 0 : v.hideable) === !1 : !1, b = (m, y) => {
1833
- const O = g.map((M) => M.id), N = m + y;
1834
- N < 0 || N >= O.length || ([O[m], O[N]] = [O[N], O[m]], h.setOrder(O), u({ id: g[m].id, direction: y < 0 ? "forward" : "backward" }));
2609
+ (C = v && !v.disabled ? v : N) == null || C.focus();
2610
+ }, [c]), !t) return null;
2611
+ const { registry: h, snapshot: f } = t, b = h.hook, p = h.withStickyHeaderFirst(
2612
+ et(h.modelColumns(b.rows, b.formats), f.order)
2613
+ ), k = h.stickyRowHeader ? ((w = p[0]) == null ? void 0 : w.hideable) === !1 : !1, m = (g, v) => {
2614
+ const N = p.map((D) => D.id), C = g + v;
2615
+ C < 0 || C >= N.length || ([N[g], N[C]] = [N[C], N[g]], f.setOrder(N), u({ id: p[g].id, direction: v < 0 ? "forward" : "backward" }));
1835
2616
  };
1836
- return /* @__PURE__ */ x(Q, { children: [
1837
- /* @__PURE__ */ c(
1838
- G,
2617
+ return /* @__PURE__ */ L(J, { children: [
2618
+ /* @__PURE__ */ l(
2619
+ ee,
1839
2620
  {
1840
- ref: i,
2621
+ ref: s,
1841
2622
  size: "sm",
1842
2623
  "aria-haspopup": "dialog",
1843
2624
  "aria-expanded": o,
1844
- "aria-controls": o ? l : void 0,
2625
+ "aria-controls": o ? a : void 0,
1845
2626
  onClick: () => r(!o),
1846
2627
  children: n.columns
1847
2628
  }
1848
2629
  ),
1849
- /* @__PURE__ */ c(
1850
- Ue,
2630
+ /* @__PURE__ */ L(
2631
+ St,
1851
2632
  {
1852
2633
  open: o,
1853
2634
  onOpenChange: r,
1854
- anchorRef: i,
2635
+ anchorRef: s,
1855
2636
  align: "end",
1856
2637
  role: "dialog",
1857
2638
  ariaLabel: n.arrangeColumns,
1858
- id: l,
1859
- className: f.columnsPanel,
1860
- children: /* @__PURE__ */ c("ul", { ref: s, className: f.columnsList, "aria-label": n.arrangeColumns, children: g.map((m, y) => {
1861
- const O = m.label ?? m.id;
1862
- return /* @__PURE__ */ x("li", { className: f.columnsEntry, "data-column": m.id, children: [
1863
- /* @__PURE__ */ c(
1864
- ge,
1865
- {
1866
- label: O,
1867
- checked: !h.hidden.includes(m.id),
1868
- disabled: m.hideable === !1,
1869
- onChange: () => h.toggleColumn(m.id)
1870
- }
1871
- ),
1872
- /* @__PURE__ */ c(
1873
- "button",
1874
- {
1875
- type: "button",
1876
- className: f.move,
1877
- "data-direction": "forward",
1878
- "aria-label": n.columnForward(O),
1879
- disabled: y === 0 || p && y <= 1,
1880
- onClick: () => b(y, -1),
1881
- children: /* @__PURE__ */ c("svg", { viewBox: "0 0 10 10", width: "10", height: "10", "aria-hidden": "true", children: /* @__PURE__ */ c("path", { d: "M2 6.5 5 3.5l3 3", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
1882
- }
1883
- ),
1884
- /* @__PURE__ */ c(
1885
- "button",
1886
- {
1887
- type: "button",
1888
- className: f.move,
1889
- "data-direction": "backward",
1890
- "aria-label": n.columnBackward(O),
1891
- disabled: y === g.length - 1 || p && y === 0,
1892
- onClick: () => b(y, 1),
1893
- children: /* @__PURE__ */ c("svg", { viewBox: "0 0 10 10", width: "10", height: "10", "aria-hidden": "true", children: /* @__PURE__ */ c("path", { d: "M2 3.5 5 6.5l3-3", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
1894
- }
1895
- )
1896
- ] }, m.id);
1897
- }) })
2639
+ id: a,
2640
+ className: d.columnsPanel,
2641
+ children: [
2642
+ /* @__PURE__ */ l("ul", { ref: i, className: d.columnsList, "aria-label": n.arrangeColumns, children: p.map((g, v) => {
2643
+ const N = g.label ?? g.id;
2644
+ return /* @__PURE__ */ L("li", { className: d.columnsEntry, "data-column": g.id, children: [
2645
+ /* @__PURE__ */ l(
2646
+ Se,
2647
+ {
2648
+ label: N,
2649
+ checked: !f.hidden.includes(g.id),
2650
+ disabled: g.hideable === !1,
2651
+ onChange: () => f.toggleColumn(g.id)
2652
+ }
2653
+ ),
2654
+ /* @__PURE__ */ l(
2655
+ "button",
2656
+ {
2657
+ type: "button",
2658
+ className: d.move,
2659
+ "data-direction": "forward",
2660
+ "aria-label": n.columnForward(N),
2661
+ disabled: v === 0 || k && v <= 1,
2662
+ onClick: () => m(v, -1),
2663
+ children: /* @__PURE__ */ l("svg", { viewBox: "0 0 10 10", width: "10", height: "10", "aria-hidden": "true", children: /* @__PURE__ */ l("path", { d: "M2 6.5 5 3.5l3 3", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
2664
+ }
2665
+ ),
2666
+ /* @__PURE__ */ l(
2667
+ "button",
2668
+ {
2669
+ type: "button",
2670
+ className: d.move,
2671
+ "data-direction": "backward",
2672
+ "aria-label": n.columnBackward(N),
2673
+ disabled: v === p.length - 1 || k && v === 0,
2674
+ onClick: () => m(v, 1),
2675
+ children: /* @__PURE__ */ l("svg", { viewBox: "0 0 10 10", width: "10", height: "10", "aria-hidden": "true", children: /* @__PURE__ */ l("path", { d: "M2 3.5 5 6.5l3-3", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
2676
+ }
2677
+ )
2678
+ ] }, g.id);
2679
+ }) }),
2680
+ /* @__PURE__ */ l(Tr, { registry: h, hook: b })
2681
+ ]
1898
2682
  }
1899
2683
  )
1900
2684
  ] });
1901
2685
  }
1902
- function Vr({ filename: e, onExport: t, of: n }) {
1903
- const o = ue(n), r = $();
2686
+ function ti({ filename: e, onExport: t, of: n }) {
2687
+ const o = xe(n), r = U();
1904
2688
  if (!o) return null;
1905
- const { snapshot: i } = o;
1906
- return /* @__PURE__ */ c(G, { size: "sm", onClick: () => {
1907
- const l = i.asCsv();
2689
+ const { snapshot: s } = o;
2690
+ return /* @__PURE__ */ l(ee, { size: "sm", onClick: () => {
2691
+ const a = s.asCsv();
1908
2692
  if (t) {
1909
- t(l);
2693
+ t(a);
1910
2694
  return;
1911
2695
  }
1912
- const a = URL.createObjectURL(new Blob([l], { type: "text/csv;charset=utf-8" })), u = document.createElement("a");
1913
- u.href = a, u.download = e ?? r.exportFileName, u.click(), setTimeout(() => URL.revokeObjectURL(a), 1e4);
2696
+ const c = URL.createObjectURL(new Blob([a], { type: "text/csv;charset=utf-8" })), u = document.createElement("a");
2697
+ u.href = c, u.download = e ?? r.exportFileName, u.click(), setTimeout(() => URL.revokeObjectURL(c), 1e4);
1914
2698
  }, children: r.exportLabel });
1915
2699
  }
1916
- function Hr({ pageSizes: e = [10, 25, 50], className: t, of: n }) {
1917
- const o = ue(n), r = $(), i = te();
1918
- if (Ie(o == null ? void 0 : o.registry, "pagination"), !o || o.snapshot.virtual) return null;
1919
- const { snapshot: s } = o, l = s.filtered.length, a = e.includes(s.pageSize) ? e : [...e, s.pageSize].sort((d, h) => d - h), u = /* @__PURE__ */ x("nav", { "aria-label": r.pagination, className: H(f.pagination, t), children: [
1920
- /* @__PURE__ */ c("span", { children: r.entries(l, i.count(l)) }),
1921
- /* @__PURE__ */ x("div", { className: f.paginationControls, children: [
1922
- /* @__PURE__ */ x("label", { className: f.pageSize, children: [
2700
+ function ni({ pageSizes: e = [10, 25, 50], className: t, of: n }) {
2701
+ const o = xe(n), r = U(), s = ue();
2702
+ if (nt(o == null ? void 0 : o.registry, "pagination"), !o || o.snapshot.virtual) return null;
2703
+ const { snapshot: i } = o, a = i.filtered.length, c = e.includes(i.pageSize) ? e : [...e, i.pageSize].sort((h, f) => h - f), u = /* @__PURE__ */ L("nav", { "aria-label": r.pagination, className: E(d.pagination, t), children: [
2704
+ /* @__PURE__ */ l("span", { children: r.entries(a, s.count(a)) }),
2705
+ /* @__PURE__ */ L("div", { className: d.paginationControls, children: [
2706
+ /* @__PURE__ */ L("label", { className: d.pageSize, children: [
1923
2707
  r.rows,
1924
- /* @__PURE__ */ c(
1925
- Ot,
2708
+ /* @__PURE__ */ l(
2709
+ nn,
1926
2710
  {
1927
2711
  selectSize: "sm",
1928
- value: s.pageSize,
1929
- onChange: (d) => s.setPageSize(Number(d.target.value)),
2712
+ value: i.pageSize,
2713
+ onChange: (h) => i.setPageSize(Number(h.target.value)),
1930
2714
  "aria-label": r.rowsPerPage,
1931
- children: a.map((d) => /* @__PURE__ */ c("option", { value: d, children: d }, d))
2715
+ children: c.map((h) => /* @__PURE__ */ l("option", { value: h, children: h }, h))
1932
2716
  }
1933
2717
  )
1934
2718
  ] }),
1935
- /* @__PURE__ */ c("span", { className: f.paginationStatus, children: r.pageOfPages(s.page, s.pageCount) }),
1936
- /* @__PURE__ */ c(G, { size: "sm", disabled: s.page <= 1, onClick: () => s.setPage(s.page - 1), children: r.previousPage }),
1937
- /* @__PURE__ */ c(G, { size: "sm", disabled: s.page >= s.pageCount, onClick: () => s.setPage(s.page + 1), children: r.nextPage })
2719
+ /* @__PURE__ */ l("span", { className: d.paginationStatus, children: r.pageOfPages(i.page, i.pageCount) }),
2720
+ /* @__PURE__ */ l(ee, { size: "sm", disabled: i.page <= 1, onClick: () => i.setPage(i.page - 1), children: r.previousPage }),
2721
+ /* @__PURE__ */ l(ee, { size: "sm", disabled: i.page >= i.pageCount, onClick: () => i.setPage(i.page + 1), children: r.nextPage })
1938
2722
  ] })
1939
2723
  ] });
1940
- return o.inside ? o.footerTarget ? Lt(u, o.footerTarget) : null : u;
2724
+ return o.inside ? o.footerTarget ? an(u, o.footerTarget) : null : u;
1941
2725
  }
1942
- const er = ["high", "medium", "low"], tr = (e) => er.indexOf(e), nr = (e) => e === "standing-unacknowledged" || e === "standing-acknowledged", _e = (e) => e === "standing-acknowledged" || e === "cleared-acknowledged", or = (e) => e === "cleared-acknowledged";
1943
- function rr(e, t) {
2726
+ const ps = ["high", "medium", "low"], ms = (e) => ps.indexOf(e), ws = (e) => e === "standing-unacknowledged" || e === "standing-acknowledged", De = (e) => e === "standing-acknowledged" || e === "cleared-acknowledged", bs = (e) => e === "cleared-acknowledged";
2727
+ function ks(e, t) {
1944
2728
  switch (t) {
1945
2729
  case "raised":
1946
2730
  return "standing-unacknowledged";
1947
2731
  case "acknowledged":
1948
- return nr(e) ? "standing-acknowledged" : "cleared-acknowledged";
2732
+ return ws(e) ? "standing-acknowledged" : "cleared-acknowledged";
1949
2733
  case "cleared":
1950
- return _e(e) ? "cleared-acknowledged" : "cleared-unacknowledged";
2734
+ return De(e) ? "cleared-acknowledged" : "cleared-unacknowledged";
1951
2735
  }
1952
2736
  }
1953
- const Br = (e, t) => e.direction === "obere" ? t <= e.returnTo : t >= e.returnTo, Fe = (e, t, n) => e > n - t && e <= n, $r = (e, t, n) => e.reduce((o, r) => o + (Fe(r, t, n) ? 1 : 0), 0);
1954
- function sr(e, t, n) {
2737
+ const oi = (e, t) => e.direction === "obere" ? t <= e.returnTo : t >= e.returnTo, ot = (e, t, n) => e > n - t && e <= n, ri = (e, t, n) => e.reduce((o, r) => o + (ot(r, t, n) ? 1 : 0), 0);
2738
+ function vs(e, t, n) {
1955
2739
  const o = /* @__PURE__ */ new Map();
1956
2740
  for (const r of e)
1957
- Fe(r.raised, t, n) && o.set(r.type, (o.get(r.type) ?? 0) + 1);
2741
+ ot(r.raised, t, n) && o.set(r.type, (o.get(r.type) ?? 0) + 1);
1958
2742
  return o;
1959
2743
  }
1960
- function ir(e) {
2744
+ function _s(e) {
1961
2745
  let t = Number.POSITIVE_INFINITY;
1962
2746
  for (const n of e) n < t && (t = n);
1963
2747
  return t;
1964
2748
  }
1965
- function lr(e) {
2749
+ function ys(e) {
1966
2750
  let t = Number.NEGATIVE_INFINITY;
1967
2751
  for (const n of e) n > t && (t = n);
1968
2752
  return t;
1969
2753
  }
1970
- function cr(e, t, n) {
1971
- const o = e.filter((i) => Fe(i.raised, t.windowMs, n));
2754
+ function Cs(e, t, n) {
2755
+ const o = e.filter((s) => ot(s.raised, t.windowMs, n));
1972
2756
  if (o.length < t.atLeast) return null;
1973
- const r = o.map((i) => i.raised);
2757
+ const r = o.map((s) => s.raised);
1974
2758
  return {
1975
2759
  // No spread: a flood is the case with many elements, and an argument list
1976
2760
  // of that size blows the call stack at some point. A loop cannot.
1977
- from: ir(r),
1978
- to: lr(r),
2761
+ from: _s(r),
2762
+ to: ys(r),
1979
2763
  count: o.length,
1980
- alarms: o.map((i) => i.id)
2764
+ alarms: o.map((s) => s.id)
1981
2765
  };
1982
2766
  }
1983
- function ar(e, t) {
2767
+ function Ss(e, t) {
1984
2768
  const n = new Set(t);
1985
2769
  return e.reduce(
1986
- (o, r) => o + (n.has(r.id) && !_e(r.lifecycle) ? 1 : 0),
2770
+ (o, r) => o + (n.has(r.id) && !De(r.lifecycle) ? 1 : 0),
1987
2771
  0
1988
2772
  );
1989
2773
  }
1990
- function Wr(e, t, n) {
2774
+ function si(e, t, n) {
1991
2775
  const o = new Set(t);
1992
2776
  let r = 0;
1993
- return { alarms: e.map((s) => !o.has(s.id) || _e(s.lifecycle) ? s : (r += 1, { ...s, lifecycle: rr(s.lifecycle, "acknowledged"), acknowledgedAt: n })), count: r };
2777
+ return { alarms: e.map((i) => !o.has(i.id) || De(i.lifecycle) ? i : (r += 1, { ...i, lifecycle: ks(i.lifecycle, "acknowledged"), acknowledgedAt: n })), count: r };
1994
2778
  }
1995
- const dr = (e) => [
2779
+ const Ns = (e) => [
1996
2780
  {
1997
2781
  id: "type",
1998
2782
  label: e.columnAlarm,
@@ -2006,70 +2790,70 @@ const dr = (e) => [
2006
2790
  level of the order asks only about the acknowledgement and expressly not
2007
2791
  about whether the alarm is still standing. Otherwise the fleeting alarm
2008
2792
  falls back down again. */
2009
- { id: "acknowledgement", label: e.columnAcknowledgement, value: (t) => _e(t.lifecycle) ? 1 : 0 },
2793
+ { id: "acknowledgement", label: e.columnAcknowledgement, value: (t) => De(t.lifecycle) ? 1 : 0 },
2010
2794
  { id: "raised", label: e.columnRaised, value: (t) => t.alarm.raised },
2011
2795
  { id: "age", label: e.columnAge, value: (t) => t.age },
2012
2796
  { id: "frequency", label: e.columnFrequency, value: (t) => t.frequency }
2013
- ], ur = dr(It), fr = [
2797
+ ], xs = Ns(rn), As = [
2014
2798
  { column: "priority", direction: "asc" },
2015
2799
  { column: "acknowledgement", direction: "asc" },
2016
2800
  { column: "raised", direction: "desc" }
2017
- ], hr = (e) => ({
2801
+ ], Ts = (e) => ({
2018
2802
  id: e,
2019
2803
  label: e,
2020
2804
  priority: "high"
2021
2805
  });
2022
- function Kr(e, t = {}) {
2806
+ function ii(e, t = {}) {
2023
2807
  const {
2024
2808
  alarms: n,
2025
2809
  types: o,
2026
2810
  asOf: r,
2027
- chatter: i,
2028
- flood: s,
2029
- keepDone: l = !1,
2030
- columns: a = ur
2031
- } = e, u = new Map(o.map((b) => [b.id, b])), d = sr(n, (i == null ? void 0 : i.windowMs) ?? 1 / 0, r), h = s ? cr(n, s, r) : null, _ = new Set((h == null ? void 0 : h.alarms) ?? []), g = n.filter((b) => l || !or(b.lifecycle)).map((b) => {
2032
- const v = u.get(b.type) ?? hr(b.type), m = d.get(b.type) ?? 0;
2811
+ chatter: s,
2812
+ flood: i,
2813
+ keepDone: a = !1,
2814
+ columns: c = xs
2815
+ } = e, u = new Map(o.map((m) => [m.id, m])), h = vs(n, (s == null ? void 0 : s.windowMs) ?? 1 / 0, r), f = i ? Cs(n, i, r) : null, b = new Set((f == null ? void 0 : f.alarms) ?? []), p = n.filter((m) => a || !bs(m.lifecycle)).map((m) => {
2816
+ const w = u.get(m.type) ?? Ts(m.type), g = h.get(m.type) ?? 0;
2033
2817
  return {
2034
- id: b.id,
2035
- alarm: b,
2036
- type: v,
2037
- lifecycle: b.lifecycle,
2038
- priority: v.priority,
2039
- rank: tr(v.priority),
2040
- age: r - b.raised,
2041
- duration: (b.cleared ?? r) - b.raised,
2042
- frequency: m,
2043
- chatters: i !== void 0 && m >= i.atLeast,
2044
- inFlood: _.has(b.id)
2818
+ id: m.id,
2819
+ alarm: m,
2820
+ type: w,
2821
+ lifecycle: m.lifecycle,
2822
+ priority: w.priority,
2823
+ rank: ms(w.priority),
2824
+ age: r - m.raised,
2825
+ duration: (m.cleared ?? r) - m.raised,
2826
+ frequency: g,
2827
+ chatters: s !== void 0 && g >= s.atLeast,
2828
+ inFlood: b.has(m.id)
2045
2829
  };
2046
- }), p = Oe(g, a, {
2830
+ }), k = tt(p, c, {
2047
2831
  ...t,
2048
- sort: t.sort === void 0 ? fr : t.sort
2832
+ sort: t.sort === void 0 ? As : t.sort
2049
2833
  });
2050
2834
  return {
2051
- ...p,
2052
- flood: h,
2053
- standingUnacknowledged: p.filtered.reduce(
2054
- (b, v) => b + (v.lifecycle === "standing-unacknowledged" ? 1 : 0),
2835
+ ...k,
2836
+ flood: f,
2837
+ standingUnacknowledged: k.filtered.reduce(
2838
+ (m, w) => m + (w.lifecycle === "standing-unacknowledged" ? 1 : 0),
2055
2839
  0
2056
2840
  )
2057
2841
  };
2058
2842
  }
2059
- const mr = "_list_alpwk_4 _text_1hv7a_23", pr = "_bar_alpwk_12", gr = "_heading_alpwk_19", br = "_filler_alpwk_25", wr = "_asOf_alpwk_29", _r = "_live_alpwk_46", vr = "_label_alpwk_51", kr = "_counter_alpwk_55", yr = "_lifecycle_alpwk_59", Cr = "_empty_alpwk_63", Sr = "_row_alpwk_70", X = {
2060
- list: mr,
2061
- bar: pr,
2062
- heading: gr,
2063
- filler: br,
2064
- asOf: wr,
2065
- live: _r,
2066
- label: vr,
2067
- counter: kr,
2068
- lifecycle: yr,
2069
- empty: Cr,
2070
- row: Sr
2843
+ const Fs = "_list_alpwk_4 _text_1hv7a_23", Os = "_bar_alpwk_12", Ls = "_heading_alpwk_19", Rs = "_filler_alpwk_25", Ms = "_asOf_alpwk_29", Vs = "_live_alpwk_46", Ds = "_label_alpwk_51", Is = "_counter_alpwk_55", Ps = "_lifecycle_alpwk_59", Gs = "_empty_alpwk_63", Es = "_row_alpwk_70", re = {
2844
+ list: Fs,
2845
+ bar: Os,
2846
+ heading: Ls,
2847
+ filler: Rs,
2848
+ asOf: Ms,
2849
+ live: Vs,
2850
+ label: Ds,
2851
+ counter: Is,
2852
+ lifecycle: Ps,
2853
+ empty: Gs,
2854
+ row: Es
2071
2855
  };
2072
- function Nr(e, t) {
2856
+ function Bs(e, t) {
2073
2857
  switch (e) {
2074
2858
  case "standing-unacknowledged":
2075
2859
  return t.lifecycleStandingUnacknowledged;
@@ -2081,108 +2865,108 @@ function Nr(e, t) {
2081
2865
  return t.lifecycleClearedAcknowledged;
2082
2866
  }
2083
2867
  }
2084
- function Ar(e, t) {
2868
+ function zs(e, t) {
2085
2869
  return e === "high" ? t.priorityHigh : e === "medium" ? t.priorityMedium : t.priorityLow;
2086
2870
  }
2087
- function xr(e) {
2871
+ function js(e) {
2088
2872
  return e === "high" ? "danger" : e === "medium" ? "warning" : "neutral";
2089
2873
  }
2090
- function Tr(e, t) {
2091
- const n = Math.max(0, Math.floor(e / 6e4)), o = Math.floor(n / 60), r = n % 60, i = [];
2092
- return o > 0 && i.push(t.hoursShort(o)), (o === 0 || r > 0) && i.push(t.minutesShort(r)), i.join(" ");
2874
+ function Hs(e, t) {
2875
+ const n = Math.max(0, Math.floor(e / 6e4)), o = Math.floor(n / 60), r = n % 60, s = [];
2876
+ return o > 0 && s.push(t.hoursShort(o)), (o === 0 || r > 0) && s.push(t.minutesShort(r)), s.join(" ");
2093
2877
  }
2094
- function Gr(e) {
2878
+ function ai(e) {
2095
2879
  const { asOf: t, freshness: n, ...o } = e;
2096
- return t === void 0 || n === void 0 ? /* @__PURE__ */ c(ft, { ...o, freshness: null }) : /* @__PURE__ */ c(Or, { ...o, asOf: t, ages: n });
2880
+ return t === void 0 || n === void 0 ? /* @__PURE__ */ l(Ut, { ...o, freshness: null }) : /* @__PURE__ */ l($s, { ...o, asOf: t, ages: n });
2097
2881
  }
2098
- function Or({
2882
+ function $s({
2099
2883
  asOf: e,
2100
2884
  ages: t,
2101
2885
  ...n
2102
2886
  }) {
2103
- const o = Ft(e, t);
2104
- return /* @__PURE__ */ c(ft, { ...n, freshness: o });
2887
+ const o = sn(e, t);
2888
+ return /* @__PURE__ */ l(Ut, { ...n, freshness: o });
2105
2889
  }
2106
- function ft({
2890
+ function Ut({
2107
2891
  view: e,
2108
2892
  selection: t,
2109
2893
  onAcknowledge: n,
2110
2894
  density: o,
2111
2895
  className: r,
2112
- freshness: i,
2113
- ...s
2896
+ freshness: s,
2897
+ ...i
2114
2898
  }) {
2115
- const l = $(), a = te(), u = i !== null, d = (i == null ? void 0 : i.freshness) === "lost", { Table: h, Column: _ } = Zo(e.visible, { rowKey: (m) => m.id, selection: t }), g = V(() => e.filtered.map((m) => m.alarm), [e.filtered]), p = V(() => t === void 0 ? [] : e.filtered.map((m) => m.id).filter((m) => t.selected.has(m)), [e.filtered, t]), b = V(() => ar(g, p), [g, p]), v = qe(o, "compact");
2116
- return /* @__PURE__ */ x("div", { className: [X.list, r].filter(Boolean).join(" "), ...s, children: [
2117
- /* @__PURE__ */ x("div", { className: X.bar, children: [
2118
- /* @__PURE__ */ c("span", { className: X.heading, children: l.alarms }),
2119
- e.flood !== null && /* @__PURE__ */ c(Ce, { tone: "warning", children: l.floodHint(e.flood.count) }),
2120
- u && i !== null && /* @__PURE__ */ x("span", { className: X.asOf, "data-freshness": i.freshness, children: [
2121
- i.freshness === "lost" ? l.freshnessDisconnected : i.freshness === "stale" ? l.freshnessStale : l.freshnessFresh,
2122
- i.age !== null && ` · ${a.relative(i.age)}`
2899
+ const a = U(), c = ue(), u = s !== null, h = (s == null ? void 0 : s.freshness) === "lost", { Table: f, Column: b } = gs(e.visible, { rowKey: (g) => g.id, selection: t }), p = j(() => e.filtered.map((g) => g.alarm), [e.filtered]), k = j(() => t === void 0 ? [] : e.filtered.map((g) => g.id).filter((g) => t.selected.has(g)), [e.filtered, t]), m = j(() => Ss(p, k), [p, k]), w = Tt(o, "compact");
2900
+ return /* @__PURE__ */ L("div", { className: [re.list, r].filter(Boolean).join(" "), ...i, children: [
2901
+ /* @__PURE__ */ L("div", { className: re.bar, children: [
2902
+ /* @__PURE__ */ l("span", { className: re.heading, children: a.alarms }),
2903
+ e.flood !== null && /* @__PURE__ */ l(Ie, { tone: "warning", children: a.floodHint(e.flood.count) }),
2904
+ u && s !== null && /* @__PURE__ */ L("span", { className: re.asOf, "data-freshness": s.freshness, children: [
2905
+ s.freshness === "lost" ? a.freshnessDisconnected : s.freshness === "stale" ? a.freshnessStale : a.freshnessFresh,
2906
+ s.age !== null && ` · ${c.relative(s.age)}`
2123
2907
  ] }),
2124
- /* @__PURE__ */ c("span", { className: X.filler }),
2125
- t !== void 0 && n !== void 0 && /* @__PURE__ */ c(G, { variant: "primary", size: "sm", disabled: b === 0, onClick: () => n(p), children: b === 0 ? l.acknowledgeAlarm : l.acknowledgeAlarms(b) })
2908
+ /* @__PURE__ */ l("span", { className: re.filler }),
2909
+ t !== void 0 && n !== void 0 && /* @__PURE__ */ l(ee, { variant: "primary", size: "sm", disabled: m === 0, onClick: () => n(k), children: m === 0 ? a.acknowledgeAlarm : a.acknowledgeAlarms(m) })
2126
2910
  ] }),
2127
- /* @__PURE__ */ c("div", { "aria-live": "polite", "aria-atomic": "true", className: X.live, children: l.standingUnacknowledged(e.standingUnacknowledged) }),
2128
- /* @__PURE__ */ x(
2129
- h,
2911
+ /* @__PURE__ */ l("div", { "aria-live": "polite", "aria-atomic": "true", className: re.live, children: a.standingUnacknowledged(e.standingUnacknowledged) }),
2912
+ /* @__PURE__ */ L(
2913
+ f,
2130
2914
  {
2131
- ariaLabel: l.alarms,
2915
+ ariaLabel: a.alarms,
2132
2916
  selectable: t !== void 0,
2133
- density: v,
2917
+ density: w,
2134
2918
  stickyHeader: !0,
2135
- rowProps: (m) => ({ className: X.row, "data-lifecycle": m.lifecycle, "data-priority": m.priority }),
2136
- empty: /* @__PURE__ */ c("span", { className: X.empty, children: d ? l.noAlarmsDisconnected : l.noAlarms }),
2919
+ rowProps: (g) => ({ className: re.row, "data-lifecycle": g.lifecycle, "data-priority": g.priority }),
2920
+ empty: /* @__PURE__ */ l("span", { className: re.empty, children: h ? a.noAlarmsDisconnected : a.noAlarms }),
2137
2921
  children: [
2138
- /* @__PURE__ */ c(_, { id: "type", label: l.columnAlarm, value: (m) => m.type.label, rowHeader: !0, sortable: !1, children: (m, y) => /* @__PURE__ */ x(Q, { children: [
2139
- /* @__PURE__ */ c("span", { className: X.label, children: m }),
2140
- y.chatters && /* @__PURE__ */ c(Ce, { tone: "warning", pill: !0, className: X.counter, children: l.chatterHint(y.frequency) })
2922
+ /* @__PURE__ */ l(b, { id: "type", label: a.columnAlarm, value: (g) => g.type.label, rowHeader: !0, sortable: !1, children: (g, v) => /* @__PURE__ */ L(J, { children: [
2923
+ /* @__PURE__ */ l("span", { className: re.label, children: g }),
2924
+ v.chatters && /* @__PURE__ */ l(Ie, { tone: "warning", pill: !0, className: re.counter, children: a.chatterHint(v.frequency) })
2141
2925
  ] }) }),
2142
- /* @__PURE__ */ c(_, { value: "lifecycle", label: l.columnLifecycleState, sortable: !1, children: (m) => /* @__PURE__ */ c("span", { className: X.lifecycle, children: Nr(m, l) }) }),
2143
- /* @__PURE__ */ c(_, { value: "priority", label: l.columnPriority, sortable: !1, children: (m) => /* @__PURE__ */ c(Ce, { tone: xr(m), children: Ar(m, l) }) }),
2144
- /* @__PURE__ */ c(
2145
- _,
2926
+ /* @__PURE__ */ l(b, { value: "lifecycle", label: a.columnLifecycleState, sortable: !1, children: (g) => /* @__PURE__ */ l("span", { className: re.lifecycle, children: Bs(g, a) }) }),
2927
+ /* @__PURE__ */ l(b, { value: "priority", label: a.columnPriority, sortable: !1, children: (g) => /* @__PURE__ */ l(Ie, { tone: js(g), children: zs(g, a) }) }),
2928
+ /* @__PURE__ */ l(
2929
+ b,
2146
2930
  {
2147
2931
  id: "raised",
2148
- label: l.columnRaised,
2149
- value: (m) => new Date(m.alarm.raised),
2932
+ label: a.columnRaised,
2933
+ value: (g) => new Date(g.alarm.raised),
2150
2934
  numeric: !0,
2151
2935
  sortable: !1
2152
2936
  }
2153
2937
  ),
2154
- /* @__PURE__ */ c(_, { value: "duration", label: l.columnDuration, sortable: !1, children: (m) => Tr(m, l) }),
2155
- /* @__PURE__ */ c(_, { value: "frequency", label: l.columnFrequency, format: "count", sortable: !1 })
2938
+ /* @__PURE__ */ l(b, { value: "duration", label: a.columnDuration, sortable: !1, children: (g) => Hs(g, a) }),
2939
+ /* @__PURE__ */ l(b, { value: "frequency", label: a.columnFrequency, format: "count", sortable: !1 })
2156
2940
  ]
2157
2941
  }
2158
2942
  )
2159
2943
  ] });
2160
2944
  }
2161
2945
  export {
2162
- ur as ALARM_COLUMNS,
2163
- Gr as AlarmList,
2164
- Dr as ColumnMenu,
2165
- fr as DEFAULT_ORDER,
2166
- Vr as Export,
2167
- er as PRIORITIES,
2168
- Hr as Pagination,
2169
- Mr as Search,
2170
- Pr as Toolbar,
2171
- Wr as acknowledge,
2172
- dr as alarmColumns,
2173
- Kr as alarmModel,
2174
- Er as column,
2175
- jr as columnFilter,
2176
- ar as countAcknowledgeable,
2177
- $r as countInWindow,
2178
- cr as detectFlood,
2179
- sr as frequencyByType,
2180
- Br as hasReturned,
2181
- _e as isAcknowledged,
2182
- or as isDone,
2183
- nr as isStanding,
2184
- rr as nextLifecycleState,
2185
- tr as priorityRank,
2186
- Zo as useTable,
2187
- zt as useTableSelection
2946
+ xs as ALARM_COLUMNS,
2947
+ ai as AlarmList,
2948
+ ei as ColumnMenu,
2949
+ As as DEFAULT_ORDER,
2950
+ ti as Export,
2951
+ ps as PRIORITIES,
2952
+ ni as Pagination,
2953
+ Zs as Search,
2954
+ Qs as Toolbar,
2955
+ si as acknowledge,
2956
+ Ns as alarmColumns,
2957
+ ii as alarmModel,
2958
+ Js as column,
2959
+ Xs as columnFilter,
2960
+ Ss as countAcknowledgeable,
2961
+ ri as countInWindow,
2962
+ Cs as detectFlood,
2963
+ vs as frequencyByType,
2964
+ oi as hasReturned,
2965
+ De as isAcknowledged,
2966
+ bs as isDone,
2967
+ ws as isStanding,
2968
+ ks as nextLifecycleState,
2969
+ ms as priorityRank,
2970
+ gs as useTable,
2971
+ ln as useTableSelection
2188
2972
  };