@nivaro/react 0.3.20 → 0.3.22

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.
@@ -1,10 +1,11 @@
1
- import { jsx as o, jsxs as f, Fragment as Te } from "react/jsx-runtime";
2
- import { useState as A, useEffect as Ue, useMemo as Je } from "react";
3
- import { evaluateNumeric as Ge } from "../lib/expression.js";
4
- function Ke(i) {
1
+ import { jsx as s, jsxs as p, Fragment as Re } from "react/jsx-runtime";
2
+ import { ChevronsDownUp as Be, ChevronsUpDown as Qe } from "lucide-react";
3
+ import { useState as Y, useEffect as Ve, useMemo as Pe } from "react";
4
+ import { evaluateNumeric as Ye } from "../lib/expression.js";
5
+ function Xe(i) {
5
6
  return `color-mix(in srgb, ${i} 55%, white)`;
6
7
  }
7
- const pe = {
8
+ const fe = {
8
9
  // Brand ink for TEXT: the raw brand (cyan on white ≈ 1.6:1) is a fill
9
10
  // colour, not a text colour — mix toward black in light mode, raw in dark.
10
11
  accent: ["color-mix(in srgb, rgb(var(--nvr-cyan-rgb)) 56%, black)", "rgb(var(--nvr-cyan-rgb))"],
@@ -18,12 +19,12 @@ const pe = {
18
19
  warning: ["var(--nvr-role-warning, #b45309)", "var(--nvr-role-warning-dark, #d4936a)"],
19
20
  info: ["var(--nvr-role-info, #4f46e5)", "var(--nvr-role-info-dark, #8fa6c9)"]
20
21
  };
21
- function he(i, r) {
22
+ function xe(i, r) {
22
23
  var M, k;
23
- const x = pe[i.trim().toLowerCase()];
24
- return x ? [x[0], r ? ((M = pe[r]) == null ? void 0 : M[1]) ?? r : x[1]] : [i, r ? ((k = pe[r]) == null ? void 0 : k[1]) ?? r : Ke(i)];
24
+ const x = fe[i.trim().toLowerCase()];
25
+ return x ? [x[0], r ? ((M = fe[r]) == null ? void 0 : M[1]) ?? r : x[1]] : [i, r ? ((k = fe[r]) == null ? void 0 : k[1]) ?? r : Xe(i)];
25
26
  }
26
- const Be = /^[-+−]?\$?0(?:\.0+)?%?$/, fe = (i) => i === "—" ? /* @__PURE__ */ o("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : Be.test(i) ? /* @__PURE__ */ o("span", { className: "text-slate-500 dark:text-slate-400", children: i }) : i, ze = [
27
+ const Ze = /^[-+−]?\$?0(?:\.0+)?%?$/, ke = (i) => i === "—" ? /* @__PURE__ */ s("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : Ze.test(i) ? /* @__PURE__ */ s("span", { className: "text-slate-500 dark:text-slate-400", children: i }) : i, Te = [
27
28
  "jan",
28
29
  "feb",
29
30
  "mar",
@@ -36,7 +37,7 @@ const Be = /^[-+−]?\$?0(?:\.0+)?%?$/, fe = (i) => i === "—" ? /* @__PURE__ *
36
37
  "oct",
37
38
  "nov",
38
39
  "dec"
39
- ], Qe = [
40
+ ], je = [
40
41
  "Jan",
41
42
  "Feb",
42
43
  "Mar",
@@ -50,8 +51,8 @@ const Be = /^[-+−]?\$?0(?:\.0+)?%?$/, fe = (i) => i === "—" ? /* @__PURE__ *
50
51
  "Nov",
51
52
  "Dec"
52
53
  ];
53
- function Ve(i, r, x, M = "month") {
54
- const k = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Set();
54
+ function et(i, r, x, M = "month") {
55
+ const k = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Set();
55
56
  for (const m of i) {
56
57
  const W = r.key_fields.map((_) => String(m[_] ?? "")).join("|");
57
58
  let u = k.get(W);
@@ -60,36 +61,36 @@ function Ve(i, r, x, M = "month") {
60
61
  for (const _ of r.key_fields) u[_] = m[_];
61
62
  k.set(W, u);
62
63
  }
63
- const oe = String(m[r.date_field] ?? ""), w = /^(\d{4})-(\d{2})/.exec(oe);
64
+ const de = String(m[r.date_field] ?? ""), w = /^(\d{4})-(\d{2})/.exec(de);
64
65
  if (!w) continue;
65
- const G = Number(m[r.value_field]) || 0;
66
+ const A = Number(m[r.value_field]) || 0;
66
67
  if (Number(w[1]) === x) {
67
- const _ = Number(w[2]) - 1, q = M === "quarter" ? `q${Math.floor(_ / 3) + 1}` : ze[_];
68
- q && (u[q] = (Number(u[q]) || 0) + G);
68
+ const _ = Number(w[2]) - 1, C = M === "quarter" ? `q${Math.floor(_ / 3) + 1}` : Te[_];
69
+ C && (u[C] = (Number(u[C]) || 0) + A);
69
70
  } else
70
- I.add(w[1]), u[`y${w[1]}`] = (Number(u[`y${w[1]}`]) || 0) + G;
71
- r.total !== !1 && (u.total = (Number(u.total) || 0) + G);
71
+ R.add(w[1]), u[`y${w[1]}`] = (Number(u[`y${w[1]}`]) || 0) + A;
72
+ r.total !== !1 && (u.total = (Number(u.total) || 0) + A);
72
73
  }
73
- const le = [...I].filter((m) => Number(m) < x).sort(), R = [...I].filter((m) => Number(m) > x).sort(), P = M === "quarter" ? [1, 2, 3, 4].map((m) => ({
74
+ const oe = [...R].filter((m) => Number(m) < x).sort(), E = [...R].filter((m) => Number(m) > x).sort(), G = M === "quarter" ? [1, 2, 3, 4].map((m) => ({
74
75
  field: `q${m}`,
75
76
  label: `Q${m}`,
76
77
  format: "currency",
77
78
  sum: !0
78
- })) : ze.map((m, W) => ({
79
+ })) : Te.map((m, W) => ({
79
80
  field: m,
80
- label: Qe[W],
81
+ label: je[W],
81
82
  format: "currency",
82
83
  sum: !0
83
- })), L = r.color ? { color: r.color, color_negative: r.color_negative } : {}, se = [
84
- ...le.map((m) => ({
84
+ })), L = r.color ? { color: r.color, color_negative: r.color_negative } : {}, ne = [
85
+ ...oe.map((m) => ({
85
86
  field: `y${m}`,
86
87
  label: m,
87
88
  format: "currency",
88
89
  sum: !0,
89
90
  ...L
90
91
  })),
91
- ...P.map((m) => ({ ...m, ...L })),
92
- ...R.map((m) => ({
92
+ ...G.map((m) => ({ ...m, ...L })),
93
+ ...E.map((m) => ({
93
94
  field: `y${m}`,
94
95
  label: m,
95
96
  format: "currency",
@@ -106,12 +107,12 @@ function Ve(i, r, x, M = "month") {
106
107
  }
107
108
  ] : []
108
109
  ];
109
- return { rows: [...k.values()], columns: se };
110
+ return { rows: [...k.values()], columns: ne };
110
111
  }
111
- function D(i, r) {
112
- return Ge(i, r);
112
+ function I(i, r) {
113
+ return Ye(i, r);
113
114
  }
114
- function ae(i, r) {
115
+ function se(i, r) {
115
116
  if (i == null || i === "") return "—";
116
117
  const x = Number(i);
117
118
  if (!Number.isFinite(x)) return String(i);
@@ -133,32 +134,32 @@ function ae(i, r) {
133
134
  return String(i);
134
135
  }
135
136
  }
136
- function xe(i) {
137
+ function ge(i) {
137
138
  return i.replace(/_/g, " ").replace(/\b\w/g, (r) => r.toUpperCase());
138
139
  }
139
- function Xe({
140
+ function st({
140
141
  rows: i,
141
142
  config: r,
142
143
  onRowClick: x,
143
144
  pivotYear: M,
144
145
  rowActions: k,
145
- emptyLabel: I,
146
- emptyText: le
146
+ emptyLabel: R,
147
+ emptyText: oe
147
148
  }) {
148
- var we, _e, Se, qe, Ce, Fe, Me;
149
- const [R, P] = A(() => /* @__PURE__ */ new Set()), [L, se] = A("month"), [m, W] = A(
149
+ var Ce, qe, Fe, Me, Oe, Ee, ze;
150
+ const [E, G] = Y(() => /* @__PURE__ */ new Set()), [L, ne] = Y("month"), [m, W] = Y(
150
151
  () => new Set(((r == null ? void 0 : r.toggles) ?? []).filter((e) => e.default_on === !1).map((e) => e.label))
151
- ), [u, oe] = A(null), [w, G] = A({
152
+ ), [u, de] = Y(null), [w, A] = Y({
152
153
  overflows: !1,
153
154
  canScrollRight: !1,
154
155
  cueInset: { right: 0, bottom: 0 }
155
156
  });
156
- if (Ue(() => {
157
+ if (Ve(() => {
157
158
  if (!u) return;
158
159
  const e = () => {
159
- const a = u.scrollWidth > u.clientWidth + 1, n = u.scrollWidth > u.clientWidth + u.scrollLeft + 1, l = u.querySelector("[data-qt-actions-head]"), s = r != null && r.sticky && l ? l.offsetWidth : 0, b = u.offsetWidth - u.clientWidth + s, y = u.offsetHeight - u.clientHeight;
160
- G(
161
- (F) => F.overflows === a && F.canScrollRight === n && F.cueInset.right === b && F.cueInset.bottom === y ? F : { overflows: a, canScrollRight: n, cueInset: { right: b, bottom: y } }
160
+ const a = u.scrollWidth > u.clientWidth + 1, n = u.scrollWidth > u.clientWidth + u.scrollLeft + 1, l = u.querySelector("[data-qt-actions-head]"), o = r != null && r.sticky && l ? l.offsetWidth : 0, b = u.offsetWidth - u.clientWidth + o, N = u.offsetHeight - u.clientHeight;
161
+ A(
162
+ (F) => F.overflows === a && F.canScrollRight === n && F.cueInset.right === b && F.cueInset.bottom === N ? F : { overflows: a, canScrollRight: n, cueInset: { right: b, bottom: N } }
162
163
  );
163
164
  };
164
165
  e();
@@ -167,13 +168,13 @@ function Xe({
167
168
  t.disconnect(), u.removeEventListener("scroll", e);
168
169
  };
169
170
  }, [u, r == null ? void 0 : r.sticky]), !i || i.length === 0)
170
- return /* @__PURE__ */ o("p", { className: "px-1 py-2 text-[12px] italic text-slate-400", children: le || (I ? `No ${I.toLowerCase()} yet` : "No data") });
171
+ return /* @__PURE__ */ s("p", { className: "px-1 py-2 text-[12px] italic text-slate-400", children: oe || (R ? `No ${R.toLowerCase()} yet` : "No data") });
171
172
  let _ = null;
172
173
  if (r != null && r.pivot) {
173
- const e = M ?? r.pivot.year ?? (/* @__PURE__ */ new Date()).getFullYear(), t = Ve(i, r.pivot, e, L);
174
+ const e = M ?? r.pivot.year ?? (/* @__PURE__ */ new Date()).getFullYear(), t = et(i, r.pivot, e, L);
174
175
  i = t.rows, _ = t.columns;
175
176
  }
176
- let q = i;
177
+ let C = i;
177
178
  if (r != null && r.group_by) {
178
179
  const e = r.group_by, t = /* @__PURE__ */ new Map();
179
180
  for (const a of i) {
@@ -182,36 +183,36 @@ function Xe({
182
183
  t.set(n, { ...a, [e]: n });
183
184
  continue;
184
185
  }
185
- for (const [s, b] of Object.entries(a)) {
186
- if (s === e) continue;
187
- const y = Number(b);
188
- Number.isFinite(y) && typeof b != "boolean" && (l[s] = (Number(l[s]) || 0) + y);
186
+ for (const [o, b] of Object.entries(a)) {
187
+ if (o === e) continue;
188
+ const N = Number(b);
189
+ Number.isFinite(N) && typeof b != "boolean" && (l[o] = (Number(l[o]) || 0) + N);
189
190
  }
190
191
  }
191
- q = [...t.entries()].sort(([a], [n]) => a.localeCompare(n)).map(([, a]) => a);
192
+ C = [...t.entries()].sort(([a], [n]) => a.localeCompare(n)).map(([, a]) => a);
192
193
  }
193
- const ke = _ ? [
194
+ const ye = _ ? [
194
195
  // Key columns first (configured, else the pivot's key fields), then
195
196
  // the generated year/month/total columns.
196
- ...(we = r == null ? void 0 : r.columns) != null && we.length ? r.columns : (((_e = r == null ? void 0 : r.pivot) == null ? void 0 : _e.key_fields) ?? []).map((e) => ({ field: e })),
197
+ ...(Ce = r == null ? void 0 : r.columns) != null && Ce.length ? r.columns : (((qe = r == null ? void 0 : r.pivot) == null ? void 0 : qe.key_fields) ?? []).map((e) => ({ field: e })),
197
198
  ..._
198
- ] : r != null && r.columns && r.columns.length > 0 ? r.columns : Object.keys(q[0]).map((e) => ({ field: e })), K = /* @__PURE__ */ new Set();
199
+ ] : r != null && r.columns && r.columns.length > 0 ? r.columns : Object.keys(C[0]).map((e) => ({ field: e })), B = /* @__PURE__ */ new Set();
199
200
  {
200
201
  const e = [];
201
- for (const t of ke)
202
+ for (const t of ye)
202
203
  t.field && e.push(t.field), t.stack && e.push(t.stack);
203
204
  for (const t of (r == null ? void 0 : r.toggles) ?? []) {
204
205
  const a = !m.has(t.label);
205
206
  if (t.hide_when_on ? a : !a)
206
207
  for (const l of e)
207
- ((Se = t.fields) != null && Se.includes(l) || t.suffix && l.endsWith(t.suffix)) && K.add(l);
208
+ ((Fe = t.fields) != null && Fe.includes(l) || t.suffix && l.endsWith(t.suffix)) && B.add(l);
208
209
  }
209
210
  }
210
- const p = ke.filter((e) => {
211
+ const h = ye.filter((e) => {
211
212
  if (!e.field) return !0;
212
- const t = K.has(e.field), a = e.stack ? K.has(e.stack) : !0;
213
+ const t = B.has(e.field), a = e.stack ? B.has(e.stack) : !0;
213
214
  return !(t && a);
214
- }), ge = (e) => !!e.field && !K.has(e.field), ve = (e) => !!e.stack && !K.has(e.stack), De = [
215
+ }), ve = (e) => !!e.field && !B.has(e.field), Ne = (e) => !!e.stack && !B.has(e.stack), We = [
215
216
  "Jan",
216
217
  "Feb",
217
218
  "Mar",
@@ -224,15 +225,15 @@ function Xe({
224
225
  "Oct",
225
226
  "Nov",
226
227
  "Dec"
227
- ], Y = (r == null ? void 0 : r.highlight_group) === "$current_month" ? De[(/* @__PURE__ */ new Date()).getMonth()] : (r == null ? void 0 : r.highlight_group) ?? null, ye = (e) => !!Y && (e.group === Y || !e.group && e.label === Y), X = (e) => ye(e) ? "bg-[#6366f10f] dark:bg-[#a5b4fc12]" : "", B = (e, t) => {
228
+ ], X = (r == null ? void 0 : r.highlight_group) === "$current_month" ? We[(/* @__PURE__ */ new Date()).getMonth()] : (r == null ? void 0 : r.highlight_group) ?? null, $e = (e) => !!X && (e.group === X || !e.group && e.label === X), Z = (e) => $e(e) ? "bg-[#6366f10f] dark:bg-[#a5b4fc12]" : "", Q = (e, t) => {
228
229
  if (!e.color) return;
229
- const a = e.color_negative && typeof t == "number" && t < 0, [n, l] = a ? he(e.color_negative) : he(e.color, e.color_dark);
230
+ const a = e.color_negative && typeof t == "number" && t < 0, [n, l] = a ? xe(e.color_negative) : xe(e.color, e.color_dark);
230
231
  return { "--qtc": n, "--qtcd": l };
231
- }, ne = (e, t) => e.color ? "text-[color:var(--qtc)] dark:text-[color:var(--qtcd)]" : t, de = (e) => {
232
+ }, ie = (e, t) => e.color ? "text-[color:var(--qtc)] dark:text-[color:var(--qtcd)]" : t, ue = (e) => {
232
233
  if (!e.stack_color) return;
233
- const [t, a] = he(e.stack_color, e.stack_color_dark);
234
+ const [t, a] = xe(e.stack_color, e.stack_color_dark);
234
235
  return { "--qts": t, "--qtsd": a };
235
- }, E = (e, t) => t.formula ? D(t.formula, e) : t.field ? e[t.field] : null, Ie = Je(() => {
236
+ }, z = (e, t) => t.formula ? I(t.formula, e) : t.field ? e[t.field] : null, He = Pe(() => {
236
237
  const e = /* @__PURE__ */ new Map();
237
238
  for (const t of (r == null ? void 0 : r.columns) ?? [])
238
239
  !t.percent_of_total || !t.field || e.set(
@@ -240,23 +241,23 @@ function Xe({
240
241
  i.reduce((a, n) => a + (Number(n[t.field]) || 0), 0)
241
242
  );
242
243
  return e;
243
- }, [i, r]), Re = (e, t) => {
244
- const a = Number(E(e, t)), n = t.progress_max ? t.progress_max.includes("{{") ? D(t.progress_max, e) : Number(e[t.progress_max]) : null, l = n && Number.isFinite(n) && n > 0 && Number.isFinite(a) ? a / n * 100 : null;
245
- return /* @__PURE__ */ f(
244
+ }, [i, r]), Ue = (e, t) => {
245
+ const a = Number(z(e, t)), n = t.progress_max ? t.progress_max.includes("{{") ? I(t.progress_max, e) : Number(e[t.progress_max]) : null, l = n && Number.isFinite(n) && n > 0 && Number.isFinite(a) ? a / n * 100 : null;
246
+ return /* @__PURE__ */ p(
246
247
  "div",
247
248
  {
248
249
  className: "flex min-w-[130px] items-center justify-end gap-1.5",
249
- title: l === null ? void 0 : `${l.toLocaleString("en-US", { maximumFractionDigits: 1 })}% of ${ae(n, t.format)}`,
250
+ title: l === null ? void 0 : `${l.toLocaleString("en-US", { maximumFractionDigits: 1 })}% of ${se(n, t.format)}`,
250
251
  children: [
251
- /* @__PURE__ */ o("span", { children: ae(E(e, t), t.format) }),
252
- /* @__PURE__ */ o("div", { className: "h-1 w-10 shrink-0 overflow-hidden rounded-full bg-slate-100 dark:bg-muted", children: /* @__PURE__ */ o(
252
+ /* @__PURE__ */ s("span", { children: se(z(e, t), t.format) }),
253
+ /* @__PURE__ */ s("div", { className: "h-1 w-10 shrink-0 overflow-hidden rounded-full bg-slate-100 dark:bg-muted", children: /* @__PURE__ */ s(
253
254
  "div",
254
255
  {
255
256
  className: `h-full rounded-full ${l !== null && l > 100 ? "bg-red-500" : "bg-nvr-cyan"}`,
256
257
  style: { width: `${l === null ? 0 : Math.min(l, 100)}%` }
257
258
  }
258
259
  ) }),
259
- /* @__PURE__ */ o("span", { className: "w-9 shrink-0 text-right text-[10px] tabular-nums text-slate-400", children: l === null ? "—" : `${l.toLocaleString("en-US", { maximumFractionDigits: 0 })}%` })
260
+ /* @__PURE__ */ s("span", { className: "w-9 shrink-0 text-right text-[10px] tabular-nums text-slate-400", children: l === null ? "—" : `${l.toLocaleString("en-US", { maximumFractionDigits: 0 })}%` })
260
261
  ]
261
262
  }
262
263
  );
@@ -264,32 +265,32 @@ function Xe({
264
265
  let H = null;
265
266
  if (r != null && r.totals) {
266
267
  const e = {}, t = (a) => {
267
- e[a] = q.reduce((n, l) => {
268
- const s = Number(l[a]);
269
- return Number.isFinite(s) ? n + s : n;
268
+ e[a] = C.reduce((n, l) => {
269
+ const o = Number(l[a]);
270
+ return Number.isFinite(o) ? n + o : n;
270
271
  }, 0);
271
272
  };
272
- for (const a of p)
273
+ for (const a of h)
273
274
  a.field && t(a.field), a.stack && t(a.stack);
274
275
  H = e;
275
276
  }
276
- const C = (e) => e.format && e.format !== "text", ie = (e, t) => {
277
- if (!(r != null && r.row_format_field) || !C(t)) return t.format;
277
+ const q = (e) => e.format && e.format !== "text", be = (e, t) => {
278
+ if (!(r != null && r.row_format_field) || !q(t)) return t.format;
278
279
  const a = e[r.row_format_field];
279
280
  return a === "currency" || a === "number" ? a : t.format;
280
- }, T = (e, t) => r != null && r.zero_dash && Number(e) === 0 ? "—" : ae(e, t), Z = (e, t) => {
281
+ }, T = (e, t) => r != null && r.zero_dash && Number(e) === 0 ? "—" : se(e, t), j = (e, t) => {
281
282
  var n;
282
283
  if ((n = t.sparkline_fields) != null && n.length) {
283
- const l = t.sparkline_fields.map((d) => Number(e[d]) || 0), s = Math.max(...l, 1), b = Math.min(...l, 0), y = Math.max(s - b, 1), F = l.map(
284
- (d, h) => `${h / Math.max(l.length - 1, 1) * 60},${17 - (d - b) / y * 15}`
284
+ const l = t.sparkline_fields.map((d) => Number(e[d]) || 0), o = Math.max(...l, 1), b = Math.min(...l, 0), N = Math.max(o - b, 1), F = l.map(
285
+ (d, f) => `${f / Math.max(l.length - 1, 1) * 60},${17 - (d - b) / N * 15}`
285
286
  ).join(" ");
286
- return /* @__PURE__ */ o(
287
+ return /* @__PURE__ */ s(
287
288
  "svg",
288
289
  {
289
290
  viewBox: "0 0 60 18",
290
291
  className: "inline-block h-[18px] w-[60px]",
291
- "data-tip": l.map((d) => ae(d, t.format)).join(" · "),
292
- children: /* @__PURE__ */ o(
292
+ "data-tip": l.map((d) => se(d, t.format)).join(" · "),
293
+ children: /* @__PURE__ */ s(
293
294
  "polyline",
294
295
  {
295
296
  points: F,
@@ -303,74 +304,74 @@ function Xe({
303
304
  );
304
305
  }
305
306
  if (t.percent_of_total && t.field) {
306
- const l = Number(E(e, t)), s = Ie.get(t.field) ?? 0, b = s > 0 && Number.isFinite(l) ? l / s * 100 : null;
307
- return /* @__PURE__ */ f("span", { className: "inline-flex items-baseline gap-1", children: [
308
- T(E(e, t), t.format),
309
- b != null && /* @__PURE__ */ f("span", { className: "text-[9.5px] text-slate-400", children: [
307
+ const l = Number(z(e, t)), o = He.get(t.field) ?? 0, b = o > 0 && Number.isFinite(l) ? l / o * 100 : null;
308
+ return /* @__PURE__ */ p("span", { className: "inline-flex items-baseline gap-1", children: [
309
+ T(z(e, t), t.format),
310
+ b != null && /* @__PURE__ */ p("span", { className: "text-[9.5px] text-slate-400", children: [
310
311
  b.toLocaleString("en-US", { maximumFractionDigits: 1 }),
311
312
  "%"
312
313
  ] })
313
314
  ] });
314
315
  }
315
- if (t.display === "progress") return Re(e, t);
316
+ if (t.display === "progress") return Ue(e, t);
316
317
  if (t.stack)
317
- return /* @__PURE__ */ f("span", { className: "inline-flex flex-col items-end leading-[15px]", style: de(t), children: [
318
- ge(t) && /* @__PURE__ */ o("span", { children: fe(T(E(e, t), ie(e, t))) }),
319
- ve(t) && /* @__PURE__ */ o(
318
+ return /* @__PURE__ */ p("span", { className: "inline-flex flex-col items-end leading-[15px]", style: ue(t), children: [
319
+ ve(t) && /* @__PURE__ */ s("span", { children: ke(T(z(e, t), be(e, t))) }),
320
+ Ne(t) && /* @__PURE__ */ s(
320
321
  "span",
321
322
  {
322
323
  className: `text-[10.5px] ${t.stack_color ? "text-[color:var(--qts)] dark:text-[color:var(--qtsd)]" : "text-slate-400"}`,
323
- children: fe(T(e[t.stack], ie(e, t)))
324
+ children: ke(T(e[t.stack], be(e, t)))
324
325
  }
325
326
  )
326
327
  ] });
327
- const a = E(e, t);
328
- return t.empty_label !== void 0 && (a == null || a === "") ? t.empty_label ? /* @__PURE__ */ o("span", { className: "text-slate-500 dark:text-slate-400", children: t.empty_label }) : null : fe(T(a, ie(e, t)));
329
- }, Ne = p.some((e) => e.group), ue = [];
328
+ const a = z(e, t);
329
+ return t.empty_label !== void 0 && (a == null || a === "") ? t.empty_label ? /* @__PURE__ */ s("span", { className: "text-slate-500 dark:text-slate-400", children: t.empty_label }) : null : ke(T(a, be(e, t)));
330
+ }, we = h.some((e) => e.group), me = [];
330
331
  {
331
332
  let e = -1, t;
332
- for (const a of p)
333
- a.group && a.group !== t && e++, ue.push(a.group ? e : -1), t = a.group;
333
+ for (const a of h)
334
+ a.group && a.group !== t && e++, me.push(a.group ? e : -1), t = a.group;
334
335
  }
335
- const be = (e) => Ne && ue[e] >= 0 && ue[e] % 2 === 1 ? "bg-slate-50/70 dark:bg-muted/20" : "", g = !!(r != null && r.sticky), Q = "border-r border-slate-200 dark:border-border", We = (e, t) => g && e === 0 ? `sticky left-0 z-[1] ${Q} ${t}` : "", $e = (e) => g ? e === 0 ? `sticky left-0 top-0 z-[3] ${Q} bg-slate-50 dark:bg-muted` : "sticky top-0 z-[2] bg-white dark:bg-card" : "", U = (e) => g && (e === 0 || e === 1) ? "pl-3" : "", j = w.overflows ? "border-l border-slate-200 dark:border-border" : "", me = (e) => g ? `sticky right-0 z-[2] ${j} ${e}` : "", V = (e, t, a = 0, n) => {
336
+ const ce = (e) => we && me[e] >= 0 && me[e] % 2 === 1 ? "bg-slate-50/70 dark:bg-muted/20" : "", g = !!(r != null && r.sticky), V = "border-r border-slate-200 dark:border-border", Je = (e, t) => g && e === 0 ? `sticky left-0 z-[1] ${V} ${t}` : "", _e = (e) => g ? e === 0 ? `sticky left-0 top-0 z-[3] ${V} bg-slate-50 dark:bg-muted` : "sticky top-0 z-[2] bg-white dark:bg-card" : "", U = (e) => g && (e === 0 || e === 1) ? "pl-3" : "", ee = w.overflows ? "border-l border-slate-200 dark:border-border" : "", pe = (e) => g ? `sticky right-0 z-[2] ${ee} ${e}` : "", P = (e, t, a = 0, n) => {
336
337
  const l = a === !0 ? 1 : a === !1 ? 0 : a;
337
- return /* @__PURE__ */ f(
338
+ return /* @__PURE__ */ p(
338
339
  "tr",
339
340
  {
340
341
  onClick: x ? () => x(e) : void 0,
341
342
  className: `group/qtr border-b border-slate-100 dark:border-border/50 ${x ? "cursor-pointer" : ""} ${l >= 2 ? "bg-sky-50/70 hover:bg-sky-100/60 dark:bg-sky-500/10 dark:hover:bg-sky-500/15" : "hover:bg-slate-50 dark:hover:bg-muted/40"}`,
342
343
  children: [
343
- p.map((s, b) => /* @__PURE__ */ o(
344
+ h.map((o, b) => /* @__PURE__ */ s(
344
345
  "td",
345
346
  {
346
- className: `whitespace-nowrap py-1.5 pr-3 ${s.max_width ? "overflow-hidden text-ellipsis" : ""} ${U(b)} ${ne(s, "text-slate-700 dark:text-slate-200")} ${C(s) ? "text-right tabular-nums" : ""} ${s.group ? "min-w-[58px]" : ""} ${X(s) || be(b)} ${We(b, "bg-slate-50 group-hover/qtr:bg-slate-100 dark:bg-muted dark:group-hover/qtr:bg-muted")}`,
347
+ className: `whitespace-nowrap py-1.5 pr-3 ${o.max_width ? "overflow-hidden text-ellipsis" : ""} ${U(b)} ${ie(o, "text-slate-700 dark:text-slate-200")} ${q(o) ? "text-right tabular-nums" : ""} ${o.group ? "min-w-[58px]" : ""} ${Z(o) || ce(b)} ${Je(b, "bg-slate-50 group-hover/qtr:bg-slate-100 dark:bg-muted dark:group-hover/qtr:bg-muted")}`,
347
348
  style: {
348
349
  ...l > 0 && b === 0 ? { paddingLeft: 2 + l * 16 } : {},
349
- ...s.max_width ? { maxWidth: s.max_width } : {},
350
- ...B(s, Number(E(e, s))) ?? {}
350
+ ...o.max_width ? { maxWidth: o.max_width } : {},
351
+ ...Q(o, Number(z(e, o))) ?? {}
351
352
  },
352
- title: s.max_width ? String(E(e, s) ?? "") : void 0,
353
- children: b === 0 && n !== void 0 ? n : Z(e, s)
353
+ title: o.max_width ? String(z(e, o) ?? "") : void 0,
354
+ children: b === 0 && n !== void 0 ? n : j(e, o)
354
355
  },
355
- s.field ?? s.label ?? b
356
+ o.field ?? o.label ?? b
356
357
  )),
357
- k && /* @__PURE__ */ o(
358
+ k && /* @__PURE__ */ s(
358
359
  "td",
359
360
  {
360
- className: `py-1 pl-2 pr-3 text-right ${me(
361
+ className: `py-1 pl-2 pr-3 text-right ${pe(
361
362
  l >= 2 ? "bg-[#f3f9fe] group-hover/qtr:bg-[#e7f3fd] dark:bg-card dark:group-hover/qtr:bg-muted" : "bg-white group-hover/qtr:bg-slate-50 dark:bg-card dark:group-hover/qtr:bg-muted"
362
363
  )}`,
363
- children: /* @__PURE__ */ o("span", { className: "inline-flex flex-nowrap gap-1", children: k.map((s) => /* @__PURE__ */ o(
364
+ children: /* @__PURE__ */ s("span", { className: "inline-flex flex-nowrap gap-1", children: k.map((o) => /* @__PURE__ */ s(
364
365
  "button",
365
366
  {
366
367
  type: "button",
367
368
  onClick: (b) => {
368
- b.stopPropagation(), s.onClick(e);
369
+ b.stopPropagation(), o.onClick(e);
369
370
  },
370
371
  className: "whitespace-nowrap rounded border border-nvr-cyan/40 bg-nvr-cyan/10 px-1.5 py-0.5 text-[11px] text-slate-700 hover:brightness-105 dark:text-slate-200",
371
- children: s.label
372
+ children: o.label
372
373
  },
373
- s.label
374
+ o.label
374
375
  )) })
375
376
  }
376
377
  )
@@ -379,117 +380,125 @@ function Xe({
379
380
  t
380
381
  );
381
382
  };
382
- let ce;
383
+ let he;
384
+ const J = [];
383
385
  if (r != null && r.tree_group_by) {
384
- const e = r.tree_group_by, t = q.filter((l) => !String(l[e] ?? "").trim()), a = /* @__PURE__ */ new Map();
385
- for (const l of q) {
386
- const s = String(l[e] ?? "").trim();
387
- if (!s) continue;
388
- const b = a.get(s) ?? [];
389
- b.push(l), a.set(s, b);
386
+ const e = r.tree_group_by, t = C.filter((l) => !String(l[e] ?? "").trim()), a = /* @__PURE__ */ new Map();
387
+ for (const l of C) {
388
+ const o = String(l[e] ?? "").trim();
389
+ if (!o) continue;
390
+ const b = a.get(o) ?? [];
391
+ b.push(l), a.set(o, b);
390
392
  }
391
- const n = [...a.entries()].sort(([l], [s]) => l.localeCompare(s)).map(([l, s]) => {
392
- const b = r.tree_collapsed ? !R.has(l) : R.has(l), y = { [e]: l }, F = (d) => {
393
- y[d] = s.reduce((h, ee) => {
394
- const J = Number(ee[d]);
395
- return Number.isFinite(J) ? h + J : h;
393
+ const n = [...a.entries()].sort(([l], [o]) => l.localeCompare(o)).map(([l, o]) => {
394
+ const b = r.tree_collapsed ? !E.has(l) : E.has(l);
395
+ J.push({ key: l, startsCollapsed: !!r.tree_collapsed });
396
+ const N = { [e]: l }, F = (d) => {
397
+ N[d] = o.reduce((f, re) => {
398
+ const K = Number(re[d]);
399
+ return Number.isFinite(K) ? f + K : f;
396
400
  }, 0);
397
401
  };
398
- for (const d of p)
402
+ for (const d of h)
399
403
  d.field && d.field !== e && F(d.field), d.stack && F(d.stack);
400
- return /* @__PURE__ */ o(
401
- Le,
404
+ return /* @__PURE__ */ s(
405
+ Ie,
402
406
  {
403
- header: /* @__PURE__ */ f(
407
+ header: /* @__PURE__ */ p(
404
408
  "tr",
405
409
  {
406
410
  className: "cursor-pointer border-b border-slate-200 bg-slate-100/80 dark:border-border dark:bg-muted",
407
- onClick: () => P((d) => {
408
- const h = new Set(d);
409
- return h.has(l) ? h.delete(l) : h.add(l), h;
411
+ onClick: () => G((d) => {
412
+ const f = new Set(d);
413
+ return f.has(l) ? f.delete(l) : f.add(l), f;
410
414
  }),
411
415
  children: [
412
- p.map((d, h) => /* @__PURE__ */ o(
416
+ h.map((d, f) => /* @__PURE__ */ s(
413
417
  "td",
414
418
  {
415
- className: `whitespace-nowrap py-1.5 pr-3 ${U(h)} text-[11.5px] font-semibold ${ne(d, "text-slate-600 dark:text-slate-300")} ${C(d) ? "text-right tabular-nums" : ""} ${X(d)} ${g && h === 0 ? `sticky left-0 z-[1] ${Q} bg-slate-100 dark:bg-muted` : ""}`,
416
- style: B(
419
+ className: `whitespace-nowrap py-1.5 pr-3 ${U(f)} text-[11.5px] font-semibold ${ie(d, "text-slate-600 dark:text-slate-300")} ${q(d) ? "text-right tabular-nums" : ""} ${Z(d)} ${g && f === 0 ? `sticky left-0 z-[1] ${V} bg-slate-100 dark:bg-muted` : ""}`,
420
+ style: Q(
417
421
  d,
418
- Number(d.formula ? D(d.formula, y) : y[d.field ?? ""])
422
+ Number(d.formula ? I(d.formula, N) : N[d.field ?? ""])
419
423
  ),
420
- children: h === 0 ? `${b ? "▸" : "▾"} ${l}` : d.formula ? T(D(d.formula, y), d.format) : d.field && d.field !== e && C(d) ? Z(y, d) : ""
424
+ children: f === 0 ? `${b ? "▸" : "▾"} ${l}` : d.formula ? T(I(d.formula, N), d.format) : d.field && d.field !== e && q(d) ? j(N, d) : ""
421
425
  },
422
- d.field ?? d.label ?? h
426
+ d.field ?? d.label ?? f
423
427
  )),
424
- k && /* @__PURE__ */ o("td", { className: me("bg-slate-100 dark:bg-muted") })
428
+ k && /* @__PURE__ */ s("td", { className: pe("bg-slate-100 dark:bg-muted") })
425
429
  ]
426
430
  }
427
431
  ),
428
432
  children: !b && (() => {
429
433
  const d = r.tree_sub_split;
430
434
  if (!d)
431
- return s.map((N, S) => {
432
- var z;
433
- let $;
434
- if (r.tree_strip_section_prefix && ((z = p[0]) != null && z.field)) {
435
- const O = String(N[p[0].field] ?? "");
436
- O.startsWith(`${l} - `) && ($ = O.slice(l.length + 3));
435
+ return o.map(($, S) => {
436
+ var D;
437
+ let v;
438
+ if (r.tree_strip_section_prefix && ((D = h[0]) != null && D.field)) {
439
+ const O = String($[h[0].field] ?? "");
440
+ O.startsWith(`${l} - `) && (v = O.slice(l.length + 3));
437
441
  }
438
- return V(N, `${l}-${S}`, 1, $);
442
+ return P($, `${l}-${S}`, 1, v);
439
443
  });
440
- const h = d.separator ?? " - ", ee = [], J = /* @__PURE__ */ new Map();
441
- for (const N of s) {
442
- const S = String(N[d.field] ?? ""), $ = S.lastIndexOf(h);
443
- if ($ <= 0) {
444
- ee.push(N);
444
+ const f = d.separator ?? " - ", re = [], K = /* @__PURE__ */ new Map();
445
+ for (const $ of o) {
446
+ const S = String($[d.field] ?? ""), v = S.lastIndexOf(f);
447
+ if (v <= 0) {
448
+ re.push($);
445
449
  continue;
446
450
  }
447
- const z = S.slice(0, $), O = J.get(z) ?? [];
448
- O.push(N), J.set(z, O);
451
+ const D = S.slice(0, v), O = K.get(D) ?? [];
452
+ O.push($), K.set(D, O);
449
453
  }
450
454
  return [
451
- ...ee.map((N, S) => V(N, `${l}-flat-${S}`, 1)),
452
- ...[...J.entries()].sort(([N], [S]) => N.localeCompare(S)).map(([N, S]) => {
453
- const $ = `s:${l}|${N}`, z = r.tree_sub_collapsed ?? !0 ? !R.has($) : R.has($), O = {}, Oe = (c) => {
454
- O[c] = S.reduce((v, te) => {
455
- const re = Number(te[c]);
456
- return Number.isFinite(re) ? v + re : v;
455
+ ...re.map(($, S) => P($, `${l}-flat-${S}`, 1)),
456
+ ...[...K.entries()].sort(([$], [S]) => $.localeCompare(S)).map(([$, S]) => {
457
+ const v = `s:${l}|${$}`;
458
+ J.push({
459
+ key: v,
460
+ startsCollapsed: r.tree_sub_collapsed ?? !0
461
+ });
462
+ const D = r.tree_sub_collapsed ?? !0 ? !E.has(v) : E.has(v), O = {}, De = (c) => {
463
+ O[c] = S.reduce((y, ae) => {
464
+ const le = Number(ae[c]);
465
+ return Number.isFinite(le) ? y + le : y;
457
466
  }, 0);
458
467
  };
459
- for (const c of p)
460
- c.field && c.field !== e && Oe(c.field), c.stack && Oe(c.stack);
461
- return /* @__PURE__ */ o(
462
- Le,
468
+ for (const c of h)
469
+ c.field && c.field !== e && De(c.field), c.stack && De(c.stack);
470
+ return /* @__PURE__ */ s(
471
+ Ie,
463
472
  {
464
- header: /* @__PURE__ */ f(
473
+ header: /* @__PURE__ */ p(
465
474
  "tr",
466
475
  {
467
476
  className: "cursor-pointer border-b border-slate-200/80 bg-slate-100/70 dark:border-border/60 dark:bg-muted/50",
468
- onClick: () => P((c) => {
469
- const v = new Set(c);
470
- return v.has($) ? v.delete($) : v.add($), v;
477
+ onClick: () => G((c) => {
478
+ const y = new Set(c);
479
+ return y.has(v) ? y.delete(v) : y.add(v), y;
471
480
  }),
472
481
  children: [
473
- p.map((c, v) => /* @__PURE__ */ o(
482
+ h.map((c, y) => /* @__PURE__ */ s(
474
483
  "td",
475
484
  {
476
- className: `whitespace-nowrap py-1.5 pr-3 ${U(v)} text-[11.5px] font-medium text-slate-600 dark:text-slate-300 ${C(c) ? "text-right tabular-nums" : ""} ${g && v === 0 ? `sticky left-0 z-[1] ${Q} bg-slate-100/80 dark:bg-muted` : ""}`,
477
- style: v === 0 ? { paddingLeft: 18 } : void 0,
478
- children: v === 0 ? `${z ? "▸" : "▾"} ${N}` : c.formula ? T(D(c.formula, O), c.format) : c.field && c.field !== e && C(c) ? Z(O, c) : ""
485
+ className: `whitespace-nowrap py-1.5 pr-3 ${U(y)} text-[11.5px] font-medium text-slate-600 dark:text-slate-300 ${q(c) ? "text-right tabular-nums" : ""} ${g && y === 0 ? `sticky left-0 z-[1] ${V} bg-slate-100/80 dark:bg-muted` : ""}`,
486
+ style: y === 0 ? { paddingLeft: 18 } : void 0,
487
+ children: y === 0 ? `${D ? "▸" : "▾"} ${$}` : c.formula ? T(I(c.formula, O), c.format) : c.field && c.field !== e && q(c) ? j(O, c) : ""
479
488
  },
480
- c.field ?? c.label ?? v
489
+ c.field ?? c.label ?? y
481
490
  )),
482
- k && /* @__PURE__ */ o("td", { className: me("bg-slate-100 dark:bg-muted") })
491
+ k && /* @__PURE__ */ s("td", { className: pe("bg-slate-100 dark:bg-muted") })
483
492
  ]
484
493
  }
485
494
  ),
486
- children: !z && S.map((c, v) => {
487
- var Ee;
488
- const te = String(c[d.field] ?? ""), re = te.slice(te.lastIndexOf(h) + h.length), He = ((Ee = p[0]) == null ? void 0 : Ee.field) === d.field ? re : void 0;
489
- return V(c, `${$}-${v}`, 2, He);
495
+ children: !D && S.map((c, y) => {
496
+ var Le;
497
+ const ae = String(c[d.field] ?? ""), le = ae.slice(ae.lastIndexOf(f) + f.length), Ae = ((Le = h[0]) == null ? void 0 : Le.field) === d.field ? le : void 0;
498
+ return P(c, `${v}-${y}`, 2, Ae);
490
499
  })
491
500
  },
492
- $
501
+ v
493
502
  );
494
503
  })
495
504
  ];
@@ -498,14 +507,31 @@ function Xe({
498
507
  l
499
508
  );
500
509
  });
501
- ce = [...t.map((l, s) => V(l, `flat-${s}`)), ...n];
510
+ he = [...t.map((l, o) => P(l, `flat-${o}`)), ...n];
502
511
  } else
503
- ce = q.map((e, t) => V(e, String(t)));
504
- return /* @__PURE__ */ f("div", { className: g ? "flex min-h-0 flex-1 flex-col" : void 0, children: [
505
- (((qe = r == null ? void 0 : r.pivot) == null ? void 0 : qe.quarter_toggle) || (((Ce = r == null ? void 0 : r.toggles) == null ? void 0 : Ce.length) ?? 0) > 0) && /* @__PURE__ */ f("div", { className: "flex shrink-0 items-center justify-between gap-2 pb-2", children: [
506
- (((Fe = r == null ? void 0 : r.toggles) == null ? void 0 : Fe.length) ?? 0) > 0 ? /* @__PURE__ */ o("div", { className: "inline-flex gap-0.5 rounded-md border border-slate-200 bg-slate-50 p-0.5 dark:border-border dark:bg-muted/40", children: r.toggles.map((e) => {
512
+ he = C.map((e, t) => P(e, String(t)));
513
+ const Ke = (e) => e.startsCollapsed ? E.has(e.key) : !E.has(e.key), te = J.length > 0 && J.every(Ke), Ge = (e) => G(
514
+ new Set(
515
+ J.filter((t) => e ? t.startsCollapsed : !t.startsCollapsed).map((t) => t.key)
516
+ )
517
+ ), Se = J.length > 0 ? /* @__PURE__ */ p(
518
+ "button",
519
+ {
520
+ type: "button",
521
+ "data-query-tree-toggle": te ? "collapse" : "expand",
522
+ onClick: () => Ge(!te),
523
+ className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-slate-200 px-2 text-[11.5px] font-medium text-slate-600 transition-colors hover:bg-slate-50 hover:text-slate-800 dark:border-border dark:text-slate-300 dark:hover:bg-muted dark:hover:text-slate-100",
524
+ children: [
525
+ te ? /* @__PURE__ */ s(Be, { className: "h-3.5 w-3.5", "aria-hidden": !0 }) : /* @__PURE__ */ s(Qe, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
526
+ te ? "Collapse all" : "Expand all"
527
+ ]
528
+ }
529
+ ) : null;
530
+ return /* @__PURE__ */ p("div", { className: g ? "flex min-h-0 flex-1 flex-col" : void 0, children: [
531
+ (((Me = r == null ? void 0 : r.pivot) == null ? void 0 : Me.quarter_toggle) || (((Oe = r == null ? void 0 : r.toggles) == null ? void 0 : Oe.length) ?? 0) > 0 || Se) && /* @__PURE__ */ p("div", { className: "flex shrink-0 items-center justify-between gap-2 pb-2", children: [
532
+ (((Ee = r == null ? void 0 : r.toggles) == null ? void 0 : Ee.length) ?? 0) > 0 ? /* @__PURE__ */ s("div", { className: "inline-flex gap-0.5 rounded-md border border-slate-200 bg-slate-50 p-0.5 dark:border-border dark:bg-muted/40", children: r.toggles.map((e) => {
507
533
  const t = !m.has(e.label);
508
- return /* @__PURE__ */ o(
534
+ return /* @__PURE__ */ s(
509
535
  "button",
510
536
  {
511
537
  type: "button",
@@ -519,40 +545,43 @@ function Xe({
519
545
  },
520
546
  e.label
521
547
  );
522
- }) }) : /* @__PURE__ */ o("span", {}),
523
- ((Me = r == null ? void 0 : r.pivot) == null ? void 0 : Me.quarter_toggle) && /* @__PURE__ */ o("div", { className: "inline-flex gap-0.5 rounded-md border border-slate-200 p-0.5 dark:border-border", children: ["month", "quarter"].map((e) => /* @__PURE__ */ o(
524
- "button",
525
- {
526
- type: "button",
527
- onClick: () => se(e),
528
- className: `rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${L === e ? "bg-nvr-cyan/10 text-slate-800 dark:text-slate-100" : "text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"}`,
529
- children: e === "month" ? "Monthly" : "Quarterly"
530
- },
531
- e
532
- )) })
548
+ }) }) : /* @__PURE__ */ s("span", {}),
549
+ /* @__PURE__ */ p("div", { className: "flex items-center gap-2", children: [
550
+ Se,
551
+ ((ze = r == null ? void 0 : r.pivot) == null ? void 0 : ze.quarter_toggle) && /* @__PURE__ */ s("div", { className: "inline-flex gap-0.5 rounded-md border border-slate-200 p-0.5 dark:border-border", children: ["month", "quarter"].map((e) => /* @__PURE__ */ s(
552
+ "button",
553
+ {
554
+ type: "button",
555
+ onClick: () => ne(e),
556
+ className: `rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${L === e ? "bg-nvr-cyan/10 text-slate-800 dark:text-slate-100" : "text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"}`,
557
+ children: e === "month" ? "Monthly" : "Quarterly"
558
+ },
559
+ e
560
+ )) })
561
+ ] })
533
562
  ] }),
534
- /* @__PURE__ */ f("div", { className: g ? "relative flex min-h-0 flex-1 flex-col" : "relative", children: [
535
- /* @__PURE__ */ o(
563
+ /* @__PURE__ */ p("div", { className: g ? "relative flex min-h-0 flex-1 flex-col" : "relative", children: [
564
+ /* @__PURE__ */ s(
536
565
  "div",
537
566
  {
538
- ref: oe,
567
+ ref: de,
539
568
  className: g ? "min-h-0 flex-1 overflow-auto" : "overflow-x-auto",
540
- children: /* @__PURE__ */ f("table", { className: "w-full border-separate border-spacing-0 text-[12px] [&>tbody>tr.border-b>td]:border-b [&>tbody>tr.border-b>td]:[border-bottom-color:inherit] [&>tbody:has(+tfoot)>tr:last-child>td]:border-b-0 [&>tfoot>tr.border-t>td]:border-t [&>tfoot>tr.border-t>td]:[border-top-color:inherit]", children: [
541
- /* @__PURE__ */ o("thead", { children: Ne ? /* @__PURE__ */ f(Te, { children: [
542
- /* @__PURE__ */ f("tr", { children: [
569
+ children: /* @__PURE__ */ p("table", { className: "w-full border-separate border-spacing-0 text-[12px] [&>tbody>tr.border-b>td]:border-b [&>tbody>tr.border-b>td]:[border-bottom-color:inherit] [&>tbody:has(+tfoot)>tr:last-child>td]:border-b-0 [&>tfoot>tr.border-t>td]:border-t [&>tfoot>tr.border-t>td]:[border-top-color:inherit]", children: [
570
+ /* @__PURE__ */ s("thead", { children: we ? /* @__PURE__ */ p(Re, { children: [
571
+ /* @__PURE__ */ p("tr", { children: [
543
572
  (() => {
544
573
  const e = [];
545
574
  let t = 0;
546
- for (; t < p.length; ) {
547
- const a = p[t];
575
+ for (; t < h.length; ) {
576
+ const a = h[t];
548
577
  if (!a.group) {
549
578
  e.push(
550
- /* @__PURE__ */ o(
579
+ /* @__PURE__ */ s(
551
580
  "th",
552
581
  {
553
582
  rowSpan: 2,
554
- className: `whitespace-nowrap border-b border-slate-200 py-1.5 pr-3 align-bottom text-[10.5px] font-semibold uppercase tracking-wider text-slate-500 dark:border-border dark:text-slate-400 ${C(a) ? "text-right" : "text-left"} ${$e(t)}`,
555
- children: a.label ?? xe(a.field ?? "")
583
+ className: `whitespace-nowrap border-b border-slate-200 py-1.5 pr-3 align-bottom text-[10.5px] font-semibold uppercase tracking-wider text-slate-500 dark:border-border dark:text-slate-400 ${q(a) ? "text-right" : "text-left"} ${_e(t)}`,
584
+ children: a.label ?? ge(a.field ?? "")
556
585
  },
557
586
  `u-${a.field ?? t}`
558
587
  )
@@ -560,14 +589,14 @@ function Xe({
560
589
  continue;
561
590
  }
562
591
  let n = 1;
563
- for (; t + n < p.length && p[t + n].group === a.group; )
592
+ for (; t + n < h.length && h[t + n].group === a.group; )
564
593
  n++;
565
594
  e.push(
566
- /* @__PURE__ */ o(
595
+ /* @__PURE__ */ s(
567
596
  "th",
568
597
  {
569
598
  colSpan: n,
570
- className: `whitespace-nowrap border-b border-slate-100 py-1 pr-3 text-center text-[11px] font-semibold dark:border-border/60 ${a.group === Y ? "border-t-2 border-t-[#6366f1] bg-[#6366f10f] text-[#4f46e5] dark:border-t-[#a5b4fc] dark:bg-[#a5b4fc12] dark:text-[#a5b4fc]" : `text-slate-600 dark:text-slate-300 ${be(t)}`} ${g ? "sticky top-0 z-[2] bg-white dark:bg-card" : ""}`.trim(),
599
+ className: `whitespace-nowrap border-b border-slate-100 py-1 pr-3 text-center text-[11px] font-semibold dark:border-border/60 ${a.group === X ? "border-t-2 border-t-[#6366f1] bg-[#6366f10f] text-[#4f46e5] dark:border-t-[#a5b4fc] dark:bg-[#a5b4fc12] dark:text-[#a5b4fc]" : `text-slate-600 dark:text-slate-300 ${ce(t)}`} ${g ? "sticky top-0 z-[2] bg-white dark:bg-card" : ""}`.trim(),
571
600
  children: a.group
572
601
  },
573
602
  `g-${a.group}-${t}`
@@ -576,47 +605,47 @@ function Xe({
576
605
  }
577
606
  return e;
578
607
  })(),
579
- k && /* @__PURE__ */ o(
608
+ k && /* @__PURE__ */ s(
580
609
  "th",
581
610
  {
582
611
  rowSpan: 2,
583
612
  "aria-label": "Actions",
584
613
  "data-qt-actions-head": "",
585
- className: `border-b border-slate-200 dark:border-border ${g ? `sticky right-0 top-0 z-[3] ${j} bg-white dark:bg-card` : ""}`
614
+ className: `border-b border-slate-200 dark:border-border ${g ? `sticky right-0 top-0 z-[3] ${ee} bg-white dark:bg-card` : ""}`
586
615
  }
587
616
  )
588
617
  ] }),
589
- /* @__PURE__ */ o("tr", { children: p.map(
590
- (e, t) => e.group ? /* @__PURE__ */ o(
618
+ /* @__PURE__ */ s("tr", { children: h.map(
619
+ (e, t) => e.group ? /* @__PURE__ */ s(
591
620
  "th",
592
621
  {
593
- className: `min-w-[58px] whitespace-nowrap border-b border-slate-200 py-1 pr-3 ${U(t)} text-[11px] font-medium text-slate-500 dark:border-border dark:text-slate-400 ${C(e) ? "text-right" : "text-left"} ${X(e) || be(t)} ${g ? "sticky top-[26px] z-[2] bg-white dark:bg-card" : ""}`,
594
- children: e.label ?? xe(e.field ?? "")
622
+ className: `min-w-[58px] whitespace-nowrap border-b border-slate-200 py-1 pr-3 ${U(t)} text-[11px] font-medium text-slate-500 dark:border-border dark:text-slate-400 ${q(e) ? "text-right" : "text-left"} ${Z(e) || ce(t)} ${g ? "sticky top-[26px] z-[2] bg-white dark:bg-card" : ""}`,
623
+ children: e.label ?? ge(e.field ?? "")
595
624
  },
596
625
  e.field ?? e.label ?? t
597
626
  ) : null
598
627
  ) })
599
- ] }) : /* @__PURE__ */ f("tr", { className: "border-b border-slate-200 dark:border-border", children: [
600
- p.map((e, t) => /* @__PURE__ */ f(
628
+ ] }) : /* @__PURE__ */ p("tr", { className: "border-b border-slate-200 dark:border-border", children: [
629
+ h.map((e, t) => /* @__PURE__ */ p(
601
630
  "th",
602
631
  {
603
- className: `whitespace-nowrap border-b border-slate-200 py-1.5 pr-3 ${U(t)} text-[10.5px] font-semibold uppercase tracking-wider dark:border-border ${ye(e) ? "border-t-2 border-t-[#6366f1] bg-[#6366f10f] text-[#4f46e5] dark:border-t-[#a5b4fc] dark:bg-[#a5b4fc12] dark:text-[#a5b4fc]" : "text-slate-500 dark:text-slate-400"} ${e.stack ? "min-w-[64px]" : ""} ${C(e) ? "text-right" : "text-left"} ${$e(t)}`,
632
+ className: `whitespace-nowrap border-b border-slate-200 py-1.5 pr-3 ${U(t)} text-[10.5px] font-semibold uppercase tracking-wider dark:border-border ${$e(e) ? "border-t-2 border-t-[#6366f1] bg-[#6366f10f] text-[#4f46e5] dark:border-t-[#a5b4fc] dark:bg-[#a5b4fc12] dark:text-[#a5b4fc]" : "text-slate-500 dark:text-slate-400"} ${e.stack ? "min-w-[64px]" : ""} ${q(e) ? "text-right" : "text-left"} ${_e(t)}`,
604
633
  children: [
605
- e.label ?? xe(e.field ?? ""),
606
- e.stack && (r == null ? void 0 : r.stack_legend) && /* @__PURE__ */ f(
634
+ e.label ?? ge(e.field ?? ""),
635
+ e.stack && (r == null ? void 0 : r.stack_legend) && /* @__PURE__ */ p(
607
636
  "span",
608
637
  {
609
638
  className: "flex justify-end gap-1.5 text-[9px] font-medium normal-case tracking-normal",
610
- style: de(e) ? { ...de(e), ...B(e) ?? {} } : B(e),
639
+ style: ue(e) ? { ...ue(e), ...Q(e) ?? {} } : Q(e),
611
640
  children: [
612
- ge(e) && /* @__PURE__ */ o(
641
+ ve(e) && /* @__PURE__ */ s(
613
642
  "span",
614
643
  {
615
644
  className: e.color ? "text-[color:var(--qtc)] dark:text-[color:var(--qtcd)]" : "",
616
645
  children: r.stack_legend[0]
617
646
  }
618
647
  ),
619
- ve(e) && /* @__PURE__ */ o(
648
+ Ne(e) && /* @__PURE__ */ s(
620
649
  "span",
621
650
  {
622
651
  className: e.stack_color ? "text-[color:var(--qts)] dark:text-[color:var(--qtsd)]" : "",
@@ -630,36 +659,36 @@ function Xe({
630
659
  },
631
660
  e.field ?? e.label ?? t
632
661
  )),
633
- k && /* @__PURE__ */ o(
662
+ k && /* @__PURE__ */ s(
634
663
  "th",
635
664
  {
636
665
  "aria-label": "Actions",
637
666
  "data-qt-actions-head": "",
638
- className: g ? `sticky right-0 top-0 z-[3] ${j} bg-white dark:bg-card` : void 0
667
+ className: g ? `sticky right-0 top-0 z-[3] ${ee} bg-white dark:bg-card` : void 0
639
668
  }
640
669
  )
641
670
  ] }) }),
642
- /* @__PURE__ */ o("tbody", { children: ce }),
643
- H && /* @__PURE__ */ o("tfoot", { children: /* @__PURE__ */ f("tr", { className: "border-t border-slate-300 font-semibold dark:border-border", children: [
644
- p.map((e, t) => /* @__PURE__ */ o(
671
+ /* @__PURE__ */ s("tbody", { children: he }),
672
+ H && /* @__PURE__ */ s("tfoot", { children: /* @__PURE__ */ p("tr", { className: "border-t border-slate-300 font-semibold dark:border-border", children: [
673
+ h.map((e, t) => /* @__PURE__ */ s(
645
674
  "td",
646
675
  {
647
- className: `whitespace-nowrap py-1.5 pr-3 ${U(t)} ${ne(e, "")} ${C(e) ? "text-right tabular-nums" : ""} ${X(e)} ${g ? `sticky bottom-0 border-t border-slate-300 dark:border-border ${t === 0 ? `left-0 z-[3] ${Q} bg-slate-50 dark:bg-muted` : "z-[2] bg-white dark:bg-card"}` : ""}`,
648
- style: B(
676
+ className: `whitespace-nowrap py-1.5 pr-3 ${U(t)} ${ie(e, "")} ${q(e) ? "text-right tabular-nums" : ""} ${Z(e)} ${g ? `sticky bottom-0 border-t border-slate-300 dark:border-border ${t === 0 ? `left-0 z-[3] ${V} bg-slate-50 dark:bg-muted` : "z-[2] bg-white dark:bg-card"}` : ""}`,
677
+ style: Q(
649
678
  e,
650
679
  Number(
651
- e.formula ? D(e.formula, H) : H[e.field ?? ""]
680
+ e.formula ? I(e.formula, H) : H[e.field ?? ""]
652
681
  )
653
682
  ),
654
- children: t === 0 && !e.sum && !e.formula ? "Total" : e.sum || e.formula ? e.formula ? T(D(e.formula, H), e.format) : Z(H, e) : ""
683
+ children: t === 0 && !e.sum && !e.formula ? "Total" : e.sum || e.formula ? e.formula ? T(I(e.formula, H), e.format) : j(H, e) : ""
655
684
  },
656
685
  e.field ?? e.label ?? t
657
686
  )),
658
- k && /* @__PURE__ */ o(
687
+ k && /* @__PURE__ */ s(
659
688
  "td",
660
689
  {
661
- className: `py-1.5 pr-3 text-right ${g ? `sticky bottom-0 right-0 z-[3] border-t border-slate-300 ${j} bg-white dark:border-border dark:bg-card` : ""}`,
662
- children: /* @__PURE__ */ o("span", { className: "inline-flex flex-nowrap gap-1.5", children: k.map((e) => /* @__PURE__ */ o(
690
+ className: `py-1.5 pr-3 text-right ${g ? `sticky bottom-0 right-0 z-[3] border-t border-slate-300 ${ee} bg-white dark:border-border dark:bg-card` : ""}`,
691
+ children: /* @__PURE__ */ s("span", { className: "inline-flex flex-nowrap gap-1.5", children: k.map((e) => /* @__PURE__ */ s(
663
692
  "button",
664
693
  {
665
694
  type: "button",
@@ -677,7 +706,7 @@ function Xe({
677
706
  ),
678
707
  w.canScrollRight && // More columns to the right: fade the edge so readers know the
679
708
  // table scrolls sideways (the native scrollbar is often invisible).
680
- /* @__PURE__ */ o(
709
+ /* @__PURE__ */ s(
681
710
  "div",
682
711
  {
683
712
  "aria-hidden": !0,
@@ -689,16 +718,16 @@ function Xe({
689
718
  ] })
690
719
  ] });
691
720
  }
692
- function Le({ header: i, children: r }) {
693
- return /* @__PURE__ */ f(Te, { children: [
721
+ function Ie({ header: i, children: r }) {
722
+ return /* @__PURE__ */ p(Re, { children: [
694
723
  i,
695
724
  r
696
725
  ] });
697
726
  }
698
727
  export {
699
- pe as COLOR_ROLES,
700
- Xe as QueryTable,
701
- he as colorPair,
702
- Ke as darkVariant,
703
- Ve as pivotQueryRows
728
+ fe as COLOR_ROLES,
729
+ st as QueryTable,
730
+ xe as colorPair,
731
+ Xe as darkVariant,
732
+ et as pivotQueryRows
704
733
  };