@nivaro/react 0.3.52 → 0.3.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +47 -3
  4. package/dist/shared/components/ItemEditForm.js +3851 -3821
  5. package/dist/shared/components/NotificationBell.js +163 -150
  6. package/dist/shared/components/PageRenderer.js +600 -549
  7. package/dist/shared/components/ProfileView.js +36 -34
  8. package/dist/shared/components/QueryStatStrip.js +96 -89
  9. package/dist/shared/components/QueryTable.js +214 -215
  10. package/dist/shared/components/ReportView.js +548 -529
  11. package/dist/shared/components/alerts/AlertManagerView.js +346 -320
  12. package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
  13. package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
  14. package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
  15. package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
  16. package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
  17. package/dist/shared/components/item-edit/PlanGrid.js +718 -705
  18. package/dist/shared/components/item-edit/SummaryPanel.js +351 -337
  19. package/dist/shared/components/item-edit/line-qty.js +115 -53
  20. package/dist/shared/components/item-edit/save-refusal.js +18 -18
  21. package/dist/shared/components/item-edit/usePersonalDefaults.js +210 -207
  22. package/dist/shared/components/panels/CommentPanel.js +204 -197
  23. package/dist/shared/components/panels/ItemLockBanner.js +318 -291
  24. package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
  25. package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
  26. package/dist/shared/components/panels/RevisionsPanel.js +101 -106
  27. package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
  28. package/dist/shared/components/panels/requirement-side-effects.js +46 -29
  29. package/dist/shared/components/queue/QueueItemSheet.js +219 -146
  30. package/dist/shared/components/queue/QueueWorklist.js +738 -730
  31. package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
  32. package/dist/shared/lib/activity-sentence.js +236 -227
  33. package/dist/shared/lib/record-ref.js +43 -34
  34. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
- import { jsx as o, jsxs as p, Fragment as Pe } from "react/jsx-runtime";
2
- import { Search as dt, Download as it, ArrowUp as ut, ArrowDown as mt, ChevronsDownUp as bt, ChevronsUpDown as ct } from "lucide-react";
3
- import { useState as W, useEffect as pt, useMemo as ht } from "react";
4
- import { evaluateNumeric as xt } from "../lib/expression.js";
1
+ import { jsx as o, jsxs as p, Fragment as Ye } from "react/jsx-runtime";
2
+ import { Search as dt, Download as it, ArrowUp as ut, ArrowDown as bt, ChevronsDownUp as mt, ChevronsUpDown as ct } from "lucide-react";
3
+ import { useState as W, useEffect as pt } from "react";
4
+ import { evaluateNumeric as ht } from "../lib/expression.js";
5
5
  function ft(s) {
6
6
  return `color-mix(in srgb, ${s} 55%, white)`;
7
7
  }
@@ -21,10 +21,10 @@ const Se = {
21
21
  };
22
22
  function Ce(s, t) {
23
23
  var c, u;
24
- const m = Se[s.trim().toLowerCase()];
25
- return m ? [m[0], t ? ((c = Se[t]) == null ? void 0 : c[1]) ?? t : m[1]] : [s, t ? ((u = Se[t]) == null ? void 0 : u[1]) ?? t : ft(s)];
24
+ const b = Se[s.trim().toLowerCase()];
25
+ return b ? [b[0], t ? ((c = Se[t]) == null ? void 0 : c[1]) ?? t : b[1]] : [s, t ? ((u = Se[t]) == null ? void 0 : u[1]) ?? t : ft(s)];
26
26
  }
27
- const kt = /^[-+−]?\$?0(?:\.0+)?%?$/, qe = (s) => s === "—" ? /* @__PURE__ */ o("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : kt.test(s) ? /* @__PURE__ */ o("span", { className: "text-slate-500 dark:text-slate-400", children: s }) : s, Ge = [
27
+ const xt = /^[-+−]?\$?0(?:\.0+)?%?$/, qe = (s) => s === "—" ? /* @__PURE__ */ o("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : xt.test(s) ? /* @__PURE__ */ o("span", { className: "text-slate-500 dark:text-slate-400", children: s }) : s, Qe = [
28
28
  "jan",
29
29
  "feb",
30
30
  "mar",
@@ -37,7 +37,7 @@ const kt = /^[-+−]?\$?0(?:\.0+)?%?$/, qe = (s) => s === "—" ? /* @__PURE__ *
37
37
  "oct",
38
38
  "nov",
39
39
  "dec"
40
- ], yt = [
40
+ ], kt = [
41
41
  "Jan",
42
42
  "Feb",
43
43
  "Mar",
@@ -50,8 +50,8 @@ const kt = /^[-+−]?\$?0(?:\.0+)?%?$/, qe = (s) => s === "—" ? /* @__PURE__ *
50
50
  "Oct",
51
51
  "Nov",
52
52
  "Dec"
53
- ], vt = "Undated";
54
- function Nt(s, t, m, c = "month") {
53
+ ], yt = "Undated";
54
+ function vt(s, t, b, c = "month") {
55
55
  const u = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Set();
56
56
  let y = !1;
57
57
  for (const h of s) {
@@ -64,27 +64,27 @@ function Nt(s, t, m, c = "month") {
64
64
  }
65
65
  const z = String(h[t.date_field] ?? ""), I = /^(\d{4})-(\d{2})/.exec(z);
66
66
  if (!I) {
67
- if (z !== vt) continue;
67
+ if (z !== yt) continue;
68
68
  const O = Number(h[t.value_field]) || 0;
69
69
  y = !0, w.undated = (Number(w.undated) || 0) + O, t.total !== !1 && (w.total = (Number(w.total) || 0) + O);
70
70
  continue;
71
71
  }
72
72
  const V = Number(h[t.value_field]) || 0;
73
- if (Number(I[1]) === m) {
74
- const O = Number(I[2]) - 1, k = c === "quarter" ? `q${Math.floor(O / 3) + 1}` : Ge[O];
73
+ if (Number(I[1]) === b) {
74
+ const O = Number(I[2]) - 1, k = c === "quarter" ? `q${Math.floor(O / 3) + 1}` : Qe[O];
75
75
  k && (w[k] = (Number(w[k]) || 0) + V);
76
76
  } else
77
77
  g.add(I[1]), w[`y${I[1]}`] = (Number(w[`y${I[1]}`]) || 0) + V;
78
78
  t.total !== !1 && (w.total = (Number(w.total) || 0) + V);
79
79
  }
80
- const v = [...g].filter((h) => Number(h) < m).sort(), L = [...g].filter((h) => Number(h) > m).sort(), se = c === "quarter" ? [1, 2, 3, 4].map((h) => ({
80
+ const v = [...g].filter((h) => Number(h) < b).sort(), L = [...g].filter((h) => Number(h) > b).sort(), se = c === "quarter" ? [1, 2, 3, 4].map((h) => ({
81
81
  field: `q${h}`,
82
82
  label: `Q${h}`,
83
83
  format: "currency",
84
84
  sum: !0
85
- })) : Ge.map((h, A) => ({
85
+ })) : Qe.map((h, A) => ({
86
86
  field: h,
87
- label: yt[A],
87
+ label: kt[A],
88
88
  format: "currency",
89
89
  sum: !0
90
90
  })), K = t.color ? { color: t.color, color_negative: t.color_negative } : {}, q = [
@@ -116,31 +116,31 @@ function Nt(s, t, m, c = "month") {
116
116
  ];
117
117
  return { rows: [...u.values()], columns: q };
118
118
  }
119
- const gt = (s) => s != null && s !== "" && Number.isFinite(Number(s));
120
- function wt(s, t) {
121
- const m = {}, c = (u, g) => {
119
+ const Nt = (s) => s != null && s !== "" && Number.isFinite(Number(s));
120
+ function gt(s, t) {
121
+ const b = {}, c = (u, g) => {
122
122
  let y = !1, v = 0;
123
123
  for (const L of s)
124
- gt(L[u]) && (y = !0, v += Number(L[u]));
125
- m[u] = y || !g || m[u] === 0 ? v : null;
124
+ Nt(L[u]) && (y = !0, v += Number(L[u]));
125
+ b[u] = y || !g || b[u] === 0 ? v : null;
126
126
  };
127
127
  for (const u of t) {
128
128
  const g = u.null_when_empty ?? u.format === "currency";
129
129
  u.field && c(u.field, g), u.stack && c(u.stack, g);
130
130
  }
131
- return m;
131
+ return b;
132
132
  }
133
133
  function j(s, t) {
134
- return xt(s, t);
134
+ return ht(s, t);
135
135
  }
136
136
  function ae(s, t) {
137
137
  if (s == null || s === "") return "—";
138
- const m = Number(s);
139
- if (!Number.isFinite(m)) return String(s);
138
+ const b = Number(s);
139
+ if (!Number.isFinite(b)) return String(s);
140
140
  switch (t) {
141
141
  case "currency": {
142
- const c = Number.isInteger(m);
143
- return m.toLocaleString("en-US", {
142
+ const c = Number.isInteger(b);
143
+ return b.toLocaleString("en-US", {
144
144
  style: "currency",
145
145
  currency: "USD",
146
146
  minimumFractionDigits: c ? 0 : 2,
@@ -148,9 +148,9 @@ function ae(s, t) {
148
148
  });
149
149
  }
150
150
  case "percent":
151
- return `${m.toLocaleString("en-US", { maximumFractionDigits: 1 })}%`;
151
+ return `${b.toLocaleString("en-US", { maximumFractionDigits: 1 })}%`;
152
152
  case "number":
153
- return m.toLocaleString("en-US", { maximumFractionDigits: 2 });
153
+ return b.toLocaleString("en-US", { maximumFractionDigits: 2 });
154
154
  default:
155
155
  return String(s);
156
156
  }
@@ -158,19 +158,19 @@ function ae(s, t) {
158
158
  function le(s) {
159
159
  return s.replace(/_/g, " ").replace(/\b\w/g, (t) => t.toUpperCase());
160
160
  }
161
- function Lt({
161
+ function Et({
162
162
  rows: s,
163
163
  config: t,
164
- onRowClick: m,
164
+ onRowClick: b,
165
165
  pivotYear: c,
166
166
  rowActions: u,
167
167
  emptyLabel: g,
168
168
  emptyText: y
169
169
  }) {
170
- var De, Re, ze, Ie, He, We, Ke, Ae, Je, je;
171
- const [v, L] = W(() => /* @__PURE__ */ new Set()), [se, K] = W("month"), [q, h] = W(null), [A, w] = W(""), [z, I] = W(!!((De = t == null ? void 0 : t.hide_empty) != null && De.default_on)), [V, O] = W(
170
+ var Re, ze, Ie, He, We, Ke, Ae, Je, je, Ve;
171
+ const [v, L] = W(() => /* @__PURE__ */ new Set()), [se, K] = W("month"), [q, h] = W(null), [A, w] = W(""), [z, I] = W(!!((Re = t == null ? void 0 : t.hide_empty) != null && Re.default_on)), [V, O] = W(
172
172
  () => new Set(((t == null ? void 0 : t.toggles) ?? []).filter((e) => e.default_on === !1).map((e) => e.label))
173
- ), [k, Ye] = W(null), [oe, Xe] = W({
173
+ ), [k, Xe] = W(null), [oe, Ze] = W({
174
174
  overflows: !1,
175
175
  canScrollRight: !1,
176
176
  cueInset: { right: 0, bottom: 0 }
@@ -178,9 +178,9 @@ function Lt({
178
178
  if (pt(() => {
179
179
  if (!k) return;
180
180
  const e = () => {
181
- const a = k.scrollWidth > k.clientWidth + 1, n = k.scrollWidth > k.clientWidth + k.scrollLeft + 1, l = k.querySelector("[data-qt-actions-head]"), d = t != null && t.sticky && l ? l.offsetWidth : 0, b = k.offsetWidth - k.clientWidth + d, F = k.offsetHeight - k.clientHeight;
182
- Xe(
183
- (D) => D.overflows === a && D.canScrollRight === n && D.cueInset.right === b && D.cueInset.bottom === F ? D : { overflows: a, canScrollRight: n, cueInset: { right: b, bottom: F } }
181
+ const a = k.scrollWidth > k.clientWidth + 1, d = k.scrollWidth > k.clientWidth + k.scrollLeft + 1, l = k.querySelector("[data-qt-actions-head]"), n = t != null && t.sticky && l ? l.offsetWidth : 0, m = k.offsetWidth - k.clientWidth + n, F = k.offsetHeight - k.clientHeight;
182
+ Ze(
183
+ (M) => M.overflows === a && M.canScrollRight === d && M.cueInset.right === m && M.cueInset.bottom === F ? M : { overflows: a, canScrollRight: d, cueInset: { right: m, bottom: F } }
184
184
  );
185
185
  };
186
186
  e();
@@ -190,34 +190,34 @@ function Lt({
190
190
  };
191
191
  }, [k, t == null ? void 0 : t.sticky]), !s || s.length === 0)
192
192
  return /* @__PURE__ */ o("p", { className: "px-1 py-2 text-[12px] italic text-slate-400", children: y || (g ? `No ${g.toLowerCase()} yet` : "No data") });
193
- let xe = null;
193
+ let fe = null;
194
194
  if (t != null && t.pivot) {
195
- const e = c ?? t.pivot.year ?? (/* @__PURE__ */ new Date()).getFullYear(), r = Nt(s, t.pivot, e, se);
196
- s = r.rows, xe = r.columns;
195
+ const e = c ?? t.pivot.year ?? (/* @__PURE__ */ new Date()).getFullYear(), r = vt(s, t.pivot, e, se);
196
+ s = r.rows, fe = r.columns;
197
197
  }
198
- let S = s;
198
+ let $ = s;
199
199
  if (t != null && t.group_by) {
200
200
  const e = t.group_by, r = /* @__PURE__ */ new Map();
201
201
  for (const a of s) {
202
- const n = String(a[e] ?? "—"), l = r.get(n);
202
+ const d = String(a[e] ?? "—"), l = r.get(d);
203
203
  if (!l) {
204
- r.set(n, { ...a, [e]: n });
204
+ r.set(d, { ...a, [e]: d });
205
205
  continue;
206
206
  }
207
- for (const [d, b] of Object.entries(a)) {
208
- if (d === e) continue;
209
- const F = Number(b);
210
- Number.isFinite(F) && typeof b != "boolean" && (l[d] = (Number(l[d]) || 0) + F);
207
+ for (const [n, m] of Object.entries(a)) {
208
+ if (n === e) continue;
209
+ const F = Number(m);
210
+ Number.isFinite(F) && typeof m != "boolean" && (l[n] = (Number(l[n]) || 0) + F);
211
211
  }
212
212
  }
213
- S = [...r.entries()].sort(([a], [n]) => a.localeCompare(n)).map(([, a]) => a);
213
+ $ = [...r.entries()].sort(([a], [d]) => a.localeCompare(d)).map(([, a]) => a);
214
214
  }
215
- const Fe = xe ? [
215
+ const Fe = fe ? [
216
216
  // Key columns first (configured, else the pivot's key fields), then
217
217
  // the generated year/month/total columns.
218
- ...(Re = t == null ? void 0 : t.columns) != null && Re.length ? t.columns : (((ze = t == null ? void 0 : t.pivot) == null ? void 0 : ze.key_fields) ?? []).map((e) => ({ field: e })),
219
- ...xe
220
- ] : t != null && t.columns && t.columns.length > 0 ? t.columns : Object.keys(S[0]).map((e) => ({ field: e })), Y = /* @__PURE__ */ new Set();
218
+ ...(ze = t == null ? void 0 : t.columns) != null && ze.length ? t.columns : (((Ie = t == null ? void 0 : t.pivot) == null ? void 0 : Ie.key_fields) ?? []).map((e) => ({ field: e })),
219
+ ...fe
220
+ ] : t != null && t.columns && t.columns.length > 0 ? t.columns : Object.keys($[0]).map((e) => ({ field: e })), Y = /* @__PURE__ */ new Set();
221
221
  {
222
222
  const e = [];
223
223
  for (const r of Fe)
@@ -226,14 +226,14 @@ function Lt({
226
226
  const a = !V.has(r.label);
227
227
  if (r.hide_when_on ? a : !a)
228
228
  for (const l of e)
229
- ((Ie = r.fields) != null && Ie.includes(l) || r.suffix && l.endsWith(r.suffix)) && Y.add(l);
229
+ ((He = r.fields) != null && He.includes(l) || r.suffix && l.endsWith(r.suffix)) && Y.add(l);
230
230
  }
231
231
  }
232
- const f = Fe.filter((e) => {
232
+ const x = Fe.filter((e) => {
233
233
  if (!e.field) return !0;
234
234
  const r = Y.has(e.field), a = e.stack ? Y.has(e.stack) : !0;
235
235
  return !(r && a);
236
- }), fe = (e) => !!e.field && !Y.has(e.field), Ee = (e) => !!e.stack && !Y.has(e.stack), Ze = [
236
+ }), xe = (e) => !!e.field && !Y.has(e.field), Ee = (e) => !!e.stack && !Y.has(e.stack), et = [
237
237
  "Jan",
238
238
  "Feb",
239
239
  "Mar",
@@ -246,29 +246,27 @@ function Lt({
246
246
  "Oct",
247
247
  "Nov",
248
248
  "Dec"
249
- ], ne = (t == null ? void 0 : t.highlight_group) === "$current_month" ? Ze[(/* @__PURE__ */ new Date()).getMonth()] : (t == null ? void 0 : t.highlight_group) ?? null, Le = (e) => !!ne && (e.group === ne || !e.group && e.label === ne), de = (e) => Le(e) ? "bg-[#6366f10f] dark:bg-[#a5b4fc12]" : "", X = (e, r) => {
249
+ ], ne = (t == null ? void 0 : t.highlight_group) === "$current_month" ? et[(/* @__PURE__ */ new Date()).getMonth()] : (t == null ? void 0 : t.highlight_group) ?? null, Le = (e) => !!ne && (e.group === ne || !e.group && e.label === ne), de = (e) => Le(e) ? "bg-[#6366f10f] dark:bg-[#a5b4fc12]" : "", X = (e, r) => {
250
250
  if (!e.color) return;
251
- const a = e.color_negative && typeof r == "number" && r < 0, [n, l] = a ? Ce(e.color_negative) : Ce(e.color, e.color_dark);
252
- return { "--qtc": n, "--qtcd": l };
251
+ const a = e.color_negative && typeof r == "number" && r < 0, [d, l] = a ? Ce(e.color_negative) : Ce(e.color, e.color_dark);
252
+ return { "--qtc": d, "--qtcd": l };
253
253
  }, ke = (e, r) => e.color ? "text-[color:var(--qtc)] dark:text-[color:var(--qtcd)]" : r, ye = (e) => {
254
254
  if (!e.stack_color) return;
255
255
  const [r, a] = Ce(e.stack_color, e.stack_color_dark);
256
256
  return { "--qts": r, "--qtsd": a };
257
- }, T = (e, r) => r.formula ? j(r.formula, e) : r.field ? e[r.field] : null, et = ht(() => {
258
- const e = /* @__PURE__ */ new Map();
259
- for (const r of (t == null ? void 0 : t.columns) ?? [])
260
- !r.percent_of_total || !r.field || e.set(
261
- r.field,
262
- s.reduce((a, n) => a + (Number(n[r.field]) || 0), 0)
263
- );
264
- return e;
265
- }, [s, t]), tt = (e, r) => {
266
- const a = Number(T(e, r)), n = r.progress_max ? r.progress_max.includes("{{") ? j(r.progress_max, e) : Number(e[r.progress_max]) : null, l = n && Number.isFinite(n) && n > 0 && Number.isFinite(a) ? a / n * 100 : null;
257
+ }, T = (e, r) => r.formula ? j(r.formula, e) : r.field ? e[r.field] : null, Oe = /* @__PURE__ */ new Map();
258
+ for (const e of (t == null ? void 0 : t.columns) ?? [])
259
+ !e.percent_of_total || !e.field || Oe.set(
260
+ e.field,
261
+ s.reduce((r, a) => r + (Number(a[e.field]) || 0), 0)
262
+ );
263
+ const tt = (e, r) => {
264
+ const a = Number(T(e, r)), d = r.progress_max ? r.progress_max.includes("{{") ? j(r.progress_max, e) : Number(e[r.progress_max]) : null, l = d && Number.isFinite(d) && d > 0 && Number.isFinite(a) ? a / d * 100 : null;
267
265
  return /* @__PURE__ */ p(
268
266
  "div",
269
267
  {
270
268
  className: "flex min-w-[130px] items-center justify-end gap-1.5",
271
- title: l === null ? void 0 : `${l.toLocaleString("en-US", { maximumFractionDigits: 1 })}% of ${ae(n, r.format)}`,
269
+ title: l === null ? void 0 : `${l.toLocaleString("en-US", { maximumFractionDigits: 1 })}% of ${ae(d, r.format)}`,
272
270
  children: [
273
271
  /* @__PURE__ */ o("span", { children: ae(T(e, r), r.format) }),
274
272
  /* @__PURE__ */ o("div", { className: "h-1 w-10 shrink-0 overflow-hidden rounded-full bg-slate-100 dark:bg-muted", children: /* @__PURE__ */ o(
@@ -282,41 +280,41 @@ function Lt({
282
280
  ]
283
281
  }
284
282
  );
285
- }, Z = ((He = t == null ? void 0 : t.hide_empty) == null ? void 0 : He.fields) ?? [];
286
- Z.length > 0 && z && (S = S.filter(
283
+ }, Z = ((We = t == null ? void 0 : t.hide_empty) == null ? void 0 : We.fields) ?? [];
284
+ Z.length > 0 && z && ($ = $.filter(
287
285
  (e) => Z.some((r) => {
288
286
  const a = e[r];
289
287
  return a != null && a !== "" && Number(a) !== 0;
290
288
  })
291
289
  ));
292
290
  const ie = t != null && t.search ? A.trim().toLowerCase() : "";
293
- ie && (S = S.filter(
294
- (e) => f.some((r) => {
291
+ ie && ($ = $.filter(
292
+ (e) => x.some((r) => {
295
293
  const a = T(e, r);
296
294
  return a == null || a === "" ? !1 : String(a).toLowerCase().includes(ie) || ae(a, r.format).toLowerCase().includes(ie);
297
295
  })
298
296
  ));
299
297
  const ve = !!(t != null && t.sortable) && !(t != null && t.tree_group_by), ee = (e, r) => e.field ?? e.label ?? String(r);
300
298
  if (ve && q) {
301
- const e = f.findIndex((a, n) => ee(a, n) === q.key), r = e >= 0 ? f[e] : null;
302
- r && (S = [...S].sort(
303
- (a, n) => $t(T(a, r), T(n, r), q.dir)
299
+ const e = x.findIndex((a, d) => ee(a, d) === q.key), r = e >= 0 ? x[e] : null;
300
+ r && ($ = [...$].sort(
301
+ (a, d) => wt(T(a, r), T(d, r), q.dir)
304
302
  ));
305
303
  }
306
304
  const rt = (e) => h(
307
305
  (r) => !r || r.key !== e ? { key: e, dir: 1 } : r.dir === 1 ? { key: e, dir: -1 } : null
308
306
  );
309
307
  let B = null;
310
- t != null && t.totals && (B = wt(S, f));
311
- const M = (e) => e.format && e.format !== "text", Ne = (e, r) => {
312
- if (!(t != null && t.row_format_field) || !M(r)) return r.format;
308
+ t != null && t.totals && (B = gt($, x));
309
+ const U = (e) => e.format && e.format !== "text", Ne = (e, r) => {
310
+ if (!(t != null && t.row_format_field) || !U(r)) return r.format;
313
311
  const a = e[t.row_format_field];
314
312
  return a === "currency" || a === "number" ? a : r.format;
315
313
  }, J = (e, r) => t != null && t.zero_dash && Number(e) === 0 ? "—" : ae(e, r), ue = (e, r) => {
316
- var n;
317
- if ((n = r.sparkline_fields) != null && n.length) {
318
- const l = r.sparkline_fields.map((i) => Number(e[i]) || 0), d = Math.max(...l, 1), b = Math.min(...l, 0), F = Math.max(d - b, 1), D = l.map(
319
- (i, N) => `${N / Math.max(l.length - 1, 1) * 60},${17 - (i - b) / F * 15}`
314
+ var d;
315
+ if ((d = r.sparkline_fields) != null && d.length) {
316
+ const l = r.sparkline_fields.map((i) => Number(e[i]) || 0), n = Math.max(...l, 1), m = Math.min(...l, 0), F = Math.max(n - m, 1), M = l.map(
317
+ (i, N) => `${N / Math.max(l.length - 1, 1) * 60},${17 - (i - m) / F * 15}`
320
318
  ).join(" ");
321
319
  return /* @__PURE__ */ o(
322
320
  "svg",
@@ -327,7 +325,7 @@ function Lt({
327
325
  children: /* @__PURE__ */ o(
328
326
  "polyline",
329
327
  {
330
- points: D,
328
+ points: M,
331
329
  fill: "none",
332
330
  stroke: "#00a5cc",
333
331
  strokeWidth: "1.5",
@@ -338,11 +336,11 @@ function Lt({
338
336
  );
339
337
  }
340
338
  if (r.percent_of_total && r.field) {
341
- const l = Number(T(e, r)), d = et.get(r.field) ?? 0, b = d > 0 && Number.isFinite(l) ? l / d * 100 : null;
339
+ const l = Number(T(e, r)), n = Oe.get(r.field) ?? 0, m = n > 0 && Number.isFinite(l) ? l / n * 100 : null;
342
340
  return /* @__PURE__ */ p("span", { className: "inline-flex items-baseline gap-1", children: [
343
341
  J(T(e, r), r.format),
344
- b != null && /* @__PURE__ */ p("span", { className: "text-[9.5px] text-slate-400", children: [
345
- b.toLocaleString("en-US", { maximumFractionDigits: 1 }),
342
+ m != null && /* @__PURE__ */ p("span", { className: "text-[9.5px] text-slate-400", children: [
343
+ m.toLocaleString("en-US", { maximumFractionDigits: 1 }),
346
344
  "%"
347
345
  ] })
348
346
  ] });
@@ -350,7 +348,7 @@ function Lt({
350
348
  if (r.display === "progress") return tt(e, r);
351
349
  if (r.stack)
352
350
  return /* @__PURE__ */ p("span", { className: "inline-flex flex-col items-end leading-[15px]", style: ye(r), children: [
353
- fe(r) && /* @__PURE__ */ o("span", { children: qe(J(T(e, r), Ne(e, r))) }),
351
+ xe(r) && /* @__PURE__ */ o("span", { children: qe(J(T(e, r), Ne(e, r))) }),
354
352
  Ee(r) && /* @__PURE__ */ o(
355
353
  "span",
356
354
  {
@@ -361,33 +359,33 @@ function Lt({
361
359
  ] });
362
360
  const a = T(e, r);
363
361
  return r.empty_label !== void 0 && (a == null || a === "") ? r.empty_label ? /* @__PURE__ */ o("span", { className: "text-slate-500 dark:text-slate-400", children: r.empty_label }) : null : qe(J(a, Ne(e, r)));
364
- }, Oe = f.some((e) => e.group), ge = [];
362
+ }, Te = x.some((e) => e.group), ge = [];
365
363
  {
366
364
  let e = -1, r;
367
- for (const a of f)
365
+ for (const a of x)
368
366
  a.group && a.group !== r && e++, ge.push(a.group ? e : -1), r = a.group;
369
367
  }
370
- const we = (e) => Oe && ge[e] >= 0 && ge[e] % 2 === 1 ? "bg-slate-50/70 dark:bg-muted/20" : "", $ = !!(t != null && t.sticky), te = "border-r border-slate-200 dark:border-border", at = (e, r) => $ && e === 0 ? `sticky left-0 z-[1] ${te} ${r}` : "", Te = (e) => $ ? e === 0 ? `sticky left-0 top-0 z-[3] ${te} bg-slate-50 dark:bg-muted` : "sticky top-0 z-[2] bg-white dark:bg-card" : "", G = (e) => $ && (e === 0 || e === 1) ? "pl-3" : "", me = oe.overflows ? "border-l border-slate-200 dark:border-border" : "", $e = (e) => $ ? `sticky right-0 z-[2] ${me} ${e}` : "", re = (e, r, a = 0, n) => {
368
+ const we = (e) => Te && ge[e] >= 0 && ge[e] % 2 === 1 ? "bg-slate-50/70 dark:bg-muted/20" : "", _ = !!(t != null && t.sticky), te = "border-r border-slate-200 dark:border-border", at = (e, r) => _ && e === 0 ? `sticky left-0 z-[1] ${te} ${r}` : "", Ue = (e) => _ ? e === 0 ? `sticky left-0 top-0 z-[3] ${te} bg-slate-50 dark:bg-muted` : "sticky top-0 z-[2] bg-white dark:bg-card" : "", G = (e) => _ && (e === 0 || e === 1) ? "pl-3" : "", be = oe.overflows ? "border-l border-slate-200 dark:border-border" : "", $e = (e) => _ ? `sticky right-0 z-[2] ${be} ${e}` : "", re = (e, r, a = 0, d) => {
371
369
  const l = a === !0 ? 1 : a === !1 ? 0 : a;
372
370
  return /* @__PURE__ */ p(
373
371
  "tr",
374
372
  {
375
- onClick: m ? () => m(e) : void 0,
376
- className: `group/qtr border-b border-slate-100 dark:border-border/50 ${m ? "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"}`,
373
+ onClick: b ? () => b(e) : void 0,
374
+ className: `group/qtr border-b border-slate-100 dark:border-border/50 ${b ? "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"}`,
377
375
  children: [
378
- f.map((d, b) => /* @__PURE__ */ o(
376
+ x.map((n, m) => /* @__PURE__ */ o(
379
377
  "td",
380
378
  {
381
- className: `whitespace-nowrap py-1.5 pr-3 ${d.max_width ? "overflow-hidden text-ellipsis" : ""} ${G(b)} ${ke(d, "text-slate-700 dark:text-slate-200")} ${M(d) ? "text-right tabular-nums" : ""} ${d.group ? "min-w-[58px]" : ""} ${de(d) || we(b)} ${at(b, "bg-slate-50 group-hover/qtr:bg-slate-100 dark:bg-muted dark:group-hover/qtr:bg-muted")}`,
379
+ className: `whitespace-nowrap py-1.5 pr-3 ${n.max_width ? "overflow-hidden text-ellipsis" : ""} ${G(m)} ${ke(n, "text-slate-700 dark:text-slate-200")} ${U(n) ? "text-right tabular-nums" : ""} ${n.group ? "min-w-[58px]" : ""} ${de(n) || we(m)} ${at(m, "bg-slate-50 group-hover/qtr:bg-slate-100 dark:bg-muted dark:group-hover/qtr:bg-muted")}`,
382
380
  style: {
383
- ...l > 0 && b === 0 ? { paddingLeft: 2 + l * 16 } : {},
384
- ...d.max_width ? { maxWidth: d.max_width } : {},
385
- ...X(d, Number(T(e, d))) ?? {}
381
+ ...l > 0 && m === 0 ? { paddingLeft: 2 + l * 16 } : {},
382
+ ...n.max_width ? { maxWidth: n.max_width } : {},
383
+ ...X(n, Number(T(e, n))) ?? {}
386
384
  },
387
- title: d.max_width ? String(T(e, d) ?? "") : void 0,
388
- children: b === 0 && n !== void 0 ? n : ue(e, d)
385
+ title: n.max_width ? String(T(e, n) ?? "") : void 0,
386
+ children: m === 0 && d !== void 0 ? d : ue(e, n)
389
387
  },
390
- d.field ?? d.label ?? b
388
+ n.field ?? n.label ?? m
391
389
  )),
392
390
  u && /* @__PURE__ */ o(
393
391
  "td",
@@ -395,17 +393,17 @@ function Lt({
395
393
  className: `py-1 pl-2 pr-3 text-right ${$e(
396
394
  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"
397
395
  )}`,
398
- children: /* @__PURE__ */ o("span", { className: "inline-flex flex-nowrap gap-1", children: u.map((d) => /* @__PURE__ */ o(
396
+ children: /* @__PURE__ */ o("span", { className: "inline-flex flex-nowrap gap-1", children: u.map((n) => /* @__PURE__ */ o(
399
397
  "button",
400
398
  {
401
399
  type: "button",
402
- onClick: (b) => {
403
- b.stopPropagation(), d.onClick(e);
400
+ onClick: (m) => {
401
+ m.stopPropagation(), n.onClick(e);
404
402
  },
405
403
  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",
406
- children: d.label
404
+ children: n.label
407
405
  },
408
- d.label
406
+ n.label
409
407
  )) })
410
408
  }
411
409
  )
@@ -417,26 +415,26 @@ function Lt({
417
415
  let _e;
418
416
  const Q = [];
419
417
  if (t != null && t.tree_group_by) {
420
- const e = t.tree_group_by, r = S.filter((l) => !String(l[e] ?? "").trim()), a = /* @__PURE__ */ new Map();
421
- for (const l of S) {
422
- const d = String(l[e] ?? "").trim();
423
- if (!d) continue;
424
- const b = a.get(d) ?? [];
425
- b.push(l), a.set(d, b);
418
+ const e = t.tree_group_by, r = $.filter((l) => !String(l[e] ?? "").trim()), a = /* @__PURE__ */ new Map();
419
+ for (const l of $) {
420
+ const n = String(l[e] ?? "").trim();
421
+ if (!n) continue;
422
+ const m = a.get(n) ?? [];
423
+ m.push(l), a.set(n, m);
426
424
  }
427
- const n = [...a.entries()].sort(([l], [d]) => l.localeCompare(d)).map(([l, d]) => {
428
- const b = t.tree_collapsed ? !v.has(l) : v.has(l);
425
+ const d = [...a.entries()].sort(([l], [n]) => l.localeCompare(n)).map(([l, n]) => {
426
+ const m = t.tree_collapsed ? !v.has(l) : v.has(l);
429
427
  Q.push({ key: l, startsCollapsed: !!t.tree_collapsed });
430
- const F = { [e]: l }, D = (i) => {
431
- F[i] = d.reduce((N, ce) => {
428
+ const F = { [e]: l }, M = (i) => {
429
+ F[i] = n.reduce((N, ce) => {
432
430
  const P = Number(ce[i]);
433
431
  return Number.isFinite(P) ? N + P : N;
434
432
  }, 0);
435
433
  };
436
- for (const i of f)
437
- i.field && i.field !== e && D(i.field), i.stack && D(i.stack);
434
+ for (const i of x)
435
+ i.field && i.field !== e && M(i.field), i.stack && M(i.stack);
438
436
  return /* @__PURE__ */ o(
439
- Qe,
437
+ Pe,
440
438
  {
441
439
  header: /* @__PURE__ */ p(
442
440
  "tr",
@@ -447,15 +445,15 @@ function Lt({
447
445
  return N.has(l) ? N.delete(l) : N.add(l), N;
448
446
  }),
449
447
  children: [
450
- f.map((i, N) => /* @__PURE__ */ o(
448
+ x.map((i, N) => /* @__PURE__ */ o(
451
449
  "td",
452
450
  {
453
- className: `whitespace-nowrap py-1.5 pr-3 ${G(N)} text-[11.5px] font-semibold ${ke(i, "text-slate-600 dark:text-slate-300")} ${M(i) ? "text-right tabular-nums" : ""} ${de(i)} ${$ && N === 0 ? `sticky left-0 z-[1] ${te} bg-slate-100 dark:bg-muted` : ""}`,
451
+ className: `whitespace-nowrap py-1.5 pr-3 ${G(N)} text-[11.5px] font-semibold ${ke(i, "text-slate-600 dark:text-slate-300")} ${U(i) ? "text-right tabular-nums" : ""} ${de(i)} ${_ && N === 0 ? `sticky left-0 z-[1] ${te} bg-slate-100 dark:bg-muted` : ""}`,
454
452
  style: X(
455
453
  i,
456
454
  Number(i.formula ? j(i.formula, F) : F[i.field ?? ""])
457
455
  ),
458
- children: N === 0 ? `${b ? "▸" : "▾"} ${l}` : i.formula ? J(j(i.formula, F), i.format) : i.field && i.field !== e && M(i) ? ue(F, i) : ""
456
+ children: N === 0 ? `${m ? "▸" : "▾"} ${l}` : i.formula ? J(j(i.formula, F), i.format) : i.field && i.field !== e && U(i) ? ue(F, i) : ""
459
457
  },
460
458
  i.field ?? i.label ?? N
461
459
  )),
@@ -463,73 +461,73 @@ function Lt({
463
461
  ]
464
462
  }
465
463
  ),
466
- children: !b && (() => {
464
+ children: !m && (() => {
467
465
  const i = t.tree_sub_split;
468
466
  if (!i)
469
- return d.map((E, U) => {
467
+ return n.map((E, D) => {
470
468
  var H;
471
469
  let C;
472
- if (t.tree_strip_section_prefix && ((H = f[0]) != null && H.field)) {
473
- const R = String(E[f[0].field] ?? "");
470
+ if (t.tree_strip_section_prefix && ((H = x[0]) != null && H.field)) {
471
+ const R = String(E[x[0].field] ?? "");
474
472
  R.startsWith(`${l} - `) && (C = R.slice(l.length + 3));
475
473
  }
476
- return re(E, `${l}-${U}`, 1, C);
474
+ return re(E, `${l}-${D}`, 1, C);
477
475
  });
478
476
  const N = i.separator ?? " - ", ce = [], P = /* @__PURE__ */ new Map();
479
- for (const E of d) {
480
- const U = String(E[i.field] ?? ""), C = U.lastIndexOf(N);
477
+ for (const E of n) {
478
+ const D = String(E[i.field] ?? ""), C = D.lastIndexOf(N);
481
479
  if (C <= 0) {
482
480
  ce.push(E);
483
481
  continue;
484
482
  }
485
- const H = U.slice(0, C), R = P.get(H) ?? [];
483
+ const H = D.slice(0, C), R = P.get(H) ?? [];
486
484
  R.push(E), P.set(H, R);
487
485
  }
488
486
  return [
489
- ...ce.map((E, U) => re(E, `${l}-flat-${U}`, 1)),
490
- ...[...P.entries()].sort(([E], [U]) => E.localeCompare(U)).map(([E, U]) => {
487
+ ...ce.map((E, D) => re(E, `${l}-flat-${D}`, 1)),
488
+ ...[...P.entries()].sort(([E], [D]) => E.localeCompare(D)).map(([E, D]) => {
491
489
  const C = `s:${l}|${E}`;
492
490
  Q.push({
493
491
  key: C,
494
492
  startsCollapsed: t.tree_sub_collapsed ?? !0
495
493
  });
496
- const H = t.tree_sub_collapsed ?? !0 ? !v.has(C) : v.has(C), R = {}, Ve = (x) => {
497
- R[x] = U.reduce((_, pe) => {
498
- const he = Number(pe[x]);
499
- return Number.isFinite(he) ? _ + he : _;
494
+ const H = t.tree_sub_collapsed ?? !0 ? !v.has(C) : v.has(C), R = {}, Be = (f) => {
495
+ R[f] = D.reduce((S, pe) => {
496
+ const he = Number(pe[f]);
497
+ return Number.isFinite(he) ? S + he : S;
500
498
  }, 0);
501
499
  };
502
- for (const x of f)
503
- x.field && x.field !== e && Ve(x.field), x.stack && Ve(x.stack);
500
+ for (const f of x)
501
+ f.field && f.field !== e && Be(f.field), f.stack && Be(f.stack);
504
502
  return /* @__PURE__ */ o(
505
- Qe,
503
+ Pe,
506
504
  {
507
505
  header: /* @__PURE__ */ p(
508
506
  "tr",
509
507
  {
510
508
  className: "cursor-pointer border-b border-slate-200/80 bg-slate-100/70 dark:border-border/60 dark:bg-muted/50",
511
- onClick: () => L((x) => {
512
- const _ = new Set(x);
513
- return _.has(C) ? _.delete(C) : _.add(C), _;
509
+ onClick: () => L((f) => {
510
+ const S = new Set(f);
511
+ return S.has(C) ? S.delete(C) : S.add(C), S;
514
512
  }),
515
513
  children: [
516
- f.map((x, _) => /* @__PURE__ */ o(
514
+ x.map((f, S) => /* @__PURE__ */ o(
517
515
  "td",
518
516
  {
519
- className: `whitespace-nowrap py-1.5 pr-3 ${G(_)} text-[11.5px] font-medium text-slate-600 dark:text-slate-300 ${M(x) ? "text-right tabular-nums" : ""} ${$ && _ === 0 ? `sticky left-0 z-[1] ${te} bg-slate-100/80 dark:bg-muted` : ""}`,
520
- style: _ === 0 ? { paddingLeft: 18 } : void 0,
521
- children: _ === 0 ? `${H ? "▸" : "▾"} ${E}` : x.formula ? J(j(x.formula, R), x.format) : x.field && x.field !== e && M(x) ? ue(R, x) : ""
517
+ className: `whitespace-nowrap py-1.5 pr-3 ${G(S)} text-[11.5px] font-medium text-slate-600 dark:text-slate-300 ${U(f) ? "text-right tabular-nums" : ""} ${_ && S === 0 ? `sticky left-0 z-[1] ${te} bg-slate-100/80 dark:bg-muted` : ""}`,
518
+ style: S === 0 ? { paddingLeft: 18 } : void 0,
519
+ children: S === 0 ? `${H ? "▸" : "▾"} ${E}` : f.formula ? J(j(f.formula, R), f.format) : f.field && f.field !== e && U(f) ? ue(R, f) : ""
522
520
  },
523
- x.field ?? x.label ?? _
521
+ f.field ?? f.label ?? S
524
522
  )),
525
523
  u && /* @__PURE__ */ o("td", { className: $e("bg-slate-100 dark:bg-muted") })
526
524
  ]
527
525
  }
528
526
  ),
529
- children: !H && U.map((x, _) => {
530
- var Be;
531
- const pe = String(x[i.field] ?? ""), he = pe.slice(pe.lastIndexOf(N) + N.length), nt = ((Be = f[0]) == null ? void 0 : Be.field) === i.field ? he : void 0;
532
- return re(x, `${C}-${_}`, 2, nt);
527
+ children: !H && D.map((f, S) => {
528
+ var Ge;
529
+ const pe = String(f[i.field] ?? ""), he = pe.slice(pe.lastIndexOf(N) + N.length), nt = ((Ge = x[0]) == null ? void 0 : Ge.field) === i.field ? he : void 0;
530
+ return re(f, `${C}-${S}`, 2, nt);
533
531
  })
534
532
  },
535
533
  C
@@ -541,26 +539,26 @@ function Lt({
541
539
  l
542
540
  );
543
541
  });
544
- _e = [...r.map((l, d) => re(l, `flat-${d}`)), ...n];
542
+ _e = [...r.map((l, n) => re(l, `flat-${n}`)), ...d];
545
543
  } else
546
- _e = S.map((e, r) => re(e, String(r)));
547
- const lt = (e) => e.startsCollapsed ? v.has(e.key) : !v.has(e.key), be = Q.length > 0 && Q.every(lt), st = (e) => L(
544
+ _e = $.map((e, r) => re(e, String(r)));
545
+ const lt = (e) => e.startsCollapsed ? v.has(e.key) : !v.has(e.key), me = Q.length > 0 && Q.every(lt), st = (e) => L(
548
546
  new Set(
549
547
  Q.filter((r) => e ? r.startsCollapsed : !r.startsCollapsed).map((r) => r.key)
550
548
  )
551
- ), Me = Q.length > 0 ? /* @__PURE__ */ p(
549
+ ), De = Q.length > 0 ? /* @__PURE__ */ p(
552
550
  "button",
553
551
  {
554
552
  type: "button",
555
- "data-query-tree-toggle": be ? "collapse" : "expand",
556
- onClick: () => st(!be),
553
+ "data-query-tree-toggle": me ? "collapse" : "expand",
554
+ onClick: () => st(!me),
557
555
  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",
558
556
  children: [
559
- be ? /* @__PURE__ */ o(bt, { className: "h-3.5 w-3.5", "aria-hidden": !0 }) : /* @__PURE__ */ o(ct, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
560
- be ? "Collapse all" : "Expand all"
557
+ me ? /* @__PURE__ */ o(mt, { className: "h-3.5 w-3.5", "aria-hidden": !0 }) : /* @__PURE__ */ o(ct, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
558
+ me ? "Collapse all" : "Expand all"
561
559
  ]
562
560
  }
563
- ) : null, ot = typeof (t == null ? void 0 : t.export_csv) == "object" && t.export_csv.filename ? t.export_csv.filename : "export.csv", Ue = t != null && t.search || t != null && t.export_csv || Z.length > 0 ? /* @__PURE__ */ p("div", { className: "flex flex-wrap items-center gap-2", children: [
561
+ ) : null, ot = typeof (t == null ? void 0 : t.export_csv) == "object" && t.export_csv.filename ? t.export_csv.filename : "export.csv", Me = t != null && t.search || t != null && t.export_csv || Z.length > 0 ? /* @__PURE__ */ p("div", { className: "flex flex-wrap items-center gap-2", children: [
564
562
  (t == null ? void 0 : t.search) && /* @__PURE__ */ p("label", { className: "relative inline-flex items-center", children: [
565
563
  /* @__PURE__ */ o(
566
564
  dt,
@@ -590,7 +588,7 @@ function Lt({
590
588
  "data-qt-hide-empty": z ? "on" : "off",
591
589
  onClick: () => I((e) => !e),
592
590
  className: `h-7 whitespace-nowrap rounded-md border px-2.5 text-[11.5px] font-medium transition-colors ${z ? "border-nvr-cyan bg-nvr-cyan text-white" : "border-slate-200 text-slate-600 hover:bg-slate-50 dark:border-border dark:text-slate-300 dark:hover:bg-muted"}`,
593
- children: ((We = t == null ? void 0 : t.hide_empty) == null ? void 0 : We.label) ?? "Hide empty rows"
591
+ children: ((Ke = t == null ? void 0 : t.hide_empty) == null ? void 0 : Ke.label) ?? "Hide empty rows"
594
592
  }
595
593
  ),
596
594
  (ie || z && Z.length > 0) && /* @__PURE__ */ p(
@@ -599,7 +597,7 @@ function Lt({
599
597
  className: "text-[11.5px] tabular-nums text-slate-500 dark:text-slate-400",
600
598
  "data-qt-shown": "",
601
599
  children: [
602
- S.length.toLocaleString("en-US"),
600
+ $.length.toLocaleString("en-US"),
603
601
  " of ",
604
602
  s.length.toLocaleString("en-US"),
605
603
  " rows"
@@ -611,11 +609,11 @@ function Lt({
611
609
  {
612
610
  type: "button",
613
611
  "data-qt-csv": "",
614
- onClick: () => St(
612
+ onClick: () => _t(
615
613
  ot,
616
- _t(
617
- f.filter((e) => fe(e) || !e.field),
618
- S,
614
+ $t(
615
+ x.filter((e) => xe(e) || !e.field),
616
+ $,
619
617
  T,
620
618
  (e) => e.label ?? le(e.field ?? "")
621
619
  )
@@ -628,10 +626,10 @@ function Lt({
628
626
  }
629
627
  )
630
628
  ] }) : null;
631
- return /* @__PURE__ */ p("div", { className: $ ? "flex min-h-0 flex-1 flex-col" : void 0, children: [
632
- Ue && /* @__PURE__ */ o("div", { className: "shrink-0 pb-2", children: Ue }),
633
- (((Ke = t == null ? void 0 : t.pivot) == null ? void 0 : Ke.quarter_toggle) || (((Ae = t == null ? void 0 : t.toggles) == null ? void 0 : Ae.length) ?? 0) > 0 || Me) && /* @__PURE__ */ p("div", { className: "flex shrink-0 flex-wrap items-center justify-between gap-2 pb-2", children: [
634
- (((Je = t == null ? void 0 : t.toggles) == null ? void 0 : Je.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: t.toggles.map((e) => {
629
+ return /* @__PURE__ */ p("div", { className: _ ? "flex min-h-0 flex-1 flex-col" : void 0, children: [
630
+ Me && /* @__PURE__ */ o("div", { className: "shrink-0 pb-2", children: Me }),
631
+ (((Ae = t == null ? void 0 : t.pivot) == null ? void 0 : Ae.quarter_toggle) || (((Je = t == null ? void 0 : t.toggles) == null ? void 0 : Je.length) ?? 0) > 0 || De) && /* @__PURE__ */ p("div", { className: "flex shrink-0 flex-wrap items-center justify-between gap-2 pb-2", children: [
632
+ (((je = t == null ? void 0 : t.toggles) == null ? void 0 : je.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: t.toggles.map((e) => {
635
633
  const r = !V.has(e.label);
636
634
  return /* @__PURE__ */ o(
637
635
  "button",
@@ -639,8 +637,8 @@ function Lt({
639
637
  type: "button",
640
638
  "aria-pressed": r,
641
639
  onClick: () => O((a) => {
642
- const n = new Set(a);
643
- return n.has(e.label) ? n.delete(e.label) : n.add(e.label), n;
640
+ const d = new Set(a);
641
+ return d.has(e.label) ? d.delete(e.label) : d.add(e.label), d;
644
642
  }),
645
643
  className: `whitespace-nowrap rounded px-2.5 py-1 text-[11.5px] font-medium transition-colors ${r ? "bg-nvr-cyan text-white shadow-sm" : "text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200"}`,
646
644
  children: e.label
@@ -649,8 +647,8 @@ function Lt({
649
647
  );
650
648
  }) }) : /* @__PURE__ */ o("span", {}),
651
649
  /* @__PURE__ */ p("div", { className: "ml-auto flex items-center gap-2", children: [
652
- Me,
653
- ((je = t == null ? void 0 : t.pivot) == null ? void 0 : je.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(
650
+ De,
651
+ ((Ve = t == null ? void 0 : t.pivot) == null ? void 0 : Ve.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(
654
652
  "button",
655
653
  {
656
654
  type: "button",
@@ -662,27 +660,27 @@ function Lt({
662
660
  )) })
663
661
  ] })
664
662
  ] }),
665
- /* @__PURE__ */ p("div", { className: $ ? "relative flex min-h-0 flex-1 flex-col" : "relative", children: [
663
+ /* @__PURE__ */ p("div", { className: _ ? "relative flex min-h-0 flex-1 flex-col" : "relative", children: [
666
664
  /* @__PURE__ */ o(
667
665
  "div",
668
666
  {
669
- ref: Ye,
670
- className: $ ? "min-h-0 flex-1 overflow-auto" : "overflow-x-auto",
667
+ ref: Xe,
668
+ className: _ ? "min-h-0 flex-1 overflow-auto" : "overflow-x-auto",
671
669
  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: [
672
- /* @__PURE__ */ o("thead", { children: Oe ? /* @__PURE__ */ p(Pe, { children: [
670
+ /* @__PURE__ */ o("thead", { children: Te ? /* @__PURE__ */ p(Ye, { children: [
673
671
  /* @__PURE__ */ p("tr", { children: [
674
672
  (() => {
675
673
  const e = [];
676
674
  let r = 0;
677
- for (; r < f.length; ) {
678
- const a = f[r];
675
+ for (; r < x.length; ) {
676
+ const a = x[r];
679
677
  if (!a.group) {
680
678
  e.push(
681
679
  /* @__PURE__ */ o(
682
680
  "th",
683
681
  {
684
682
  rowSpan: 2,
685
- 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 ${M(a) ? "text-right" : "text-left"} ${Te(r)}`,
683
+ 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 ${U(a) ? "text-right" : "text-left"} ${Ue(r)}`,
686
684
  children: a.label ?? le(a.field ?? "")
687
685
  },
688
686
  `u-${a.field ?? r}`
@@ -690,20 +688,20 @@ function Lt({
690
688
  ), r++;
691
689
  continue;
692
690
  }
693
- let n = 1;
694
- for (; r + n < f.length && f[r + n].group === a.group; )
695
- n++;
691
+ let d = 1;
692
+ for (; r + d < x.length && x[r + d].group === a.group; )
693
+ d++;
696
694
  e.push(
697
695
  /* @__PURE__ */ o(
698
696
  "th",
699
697
  {
700
- colSpan: n,
701
- className: `whitespace-nowrap border-b border-slate-100 py-1 pr-3 text-center text-[11px] font-semibold dark:border-border/60 ${a.group === ne ? "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 ${we(r)}`} ${$ ? "sticky top-0 z-[2] bg-white dark:bg-card" : ""}`.trim(),
698
+ colSpan: d,
699
+ className: `whitespace-nowrap border-b border-slate-100 py-1 pr-3 text-center text-[11px] font-semibold dark:border-border/60 ${a.group === ne ? "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 ${we(r)}`} ${_ ? "sticky top-0 z-[2] bg-white dark:bg-card" : ""}`.trim(),
702
700
  children: a.group
703
701
  },
704
702
  `g-${a.group}-${r}`
705
703
  )
706
- ), r += n;
704
+ ), r += d;
707
705
  }
708
706
  return e;
709
707
  })(),
@@ -713,25 +711,25 @@ function Lt({
713
711
  rowSpan: 2,
714
712
  "aria-label": "Actions",
715
713
  "data-qt-actions-head": "",
716
- className: `border-b border-slate-200 dark:border-border ${$ ? `sticky right-0 top-0 z-[3] ${me} bg-white dark:bg-card` : ""}`
714
+ className: `border-b border-slate-200 dark:border-border ${_ ? `sticky right-0 top-0 z-[3] ${be} bg-white dark:bg-card` : ""}`
717
715
  }
718
716
  )
719
717
  ] }),
720
- /* @__PURE__ */ o("tr", { children: f.map(
718
+ /* @__PURE__ */ o("tr", { children: x.map(
721
719
  (e, r) => e.group ? /* @__PURE__ */ o(
722
720
  "th",
723
721
  {
724
- className: `min-w-[58px] whitespace-nowrap border-b border-slate-200 py-1 pr-3 ${G(r)} text-[11px] font-medium text-slate-500 dark:border-border dark:text-slate-400 ${M(e) ? "text-right" : "text-left"} ${de(e) || we(r)} ${$ ? "sticky top-[26px] z-[2] bg-white dark:bg-card" : ""}`,
722
+ className: `min-w-[58px] whitespace-nowrap border-b border-slate-200 py-1 pr-3 ${G(r)} text-[11px] font-medium text-slate-500 dark:border-border dark:text-slate-400 ${U(e) ? "text-right" : "text-left"} ${de(e) || we(r)} ${_ ? "sticky top-[26px] z-[2] bg-white dark:bg-card" : ""}`,
725
723
  children: e.label ?? le(e.field ?? "")
726
724
  },
727
725
  e.field ?? e.label ?? r
728
726
  ) : null
729
727
  ) })
730
728
  ] }) : /* @__PURE__ */ p("tr", { className: "border-b border-slate-200 dark:border-border", children: [
731
- f.map((e, r) => /* @__PURE__ */ p(
729
+ x.map((e, r) => /* @__PURE__ */ p(
732
730
  "th",
733
731
  {
734
- className: `whitespace-nowrap border-b border-slate-200 py-1.5 pr-3 ${G(r)} text-[10.5px] font-semibold uppercase tracking-wider dark:border-border ${Le(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]" : ""} ${M(e) ? "text-right" : "text-left"} ${Te(r)}`,
732
+ className: `whitespace-nowrap border-b border-slate-200 py-1.5 pr-3 ${G(r)} text-[10.5px] font-semibold uppercase tracking-wider dark:border-border ${Le(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]" : ""} ${U(e) ? "text-right" : "text-left"} ${Ue(r)}`,
735
733
  "aria-sort": ve && (q == null ? void 0 : q.key) === ee(e, r) ? q.dir === 1 ? "ascending" : "descending" : void 0,
736
734
  children: [
737
735
  ve ? /* @__PURE__ */ p(
@@ -740,10 +738,10 @@ function Lt({
740
738
  type: "button",
741
739
  "data-qt-sort": ee(e, r),
742
740
  onClick: () => rt(ee(e, r)),
743
- className: `inline-flex items-center gap-0.5 font-semibold uppercase tracking-wider hover:text-slate-800 dark:hover:text-slate-100 ${M(e) ? "flex-row-reverse" : ""}`,
741
+ className: `inline-flex items-center gap-0.5 font-semibold uppercase tracking-wider hover:text-slate-800 dark:hover:text-slate-100 ${U(e) ? "flex-row-reverse" : ""}`,
744
742
  children: [
745
743
  e.label ?? le(e.field ?? ""),
746
- (q == null ? void 0 : q.key) === ee(e, r) && (q.dir === 1 ? /* @__PURE__ */ o(ut, { className: "h-3 w-3", "aria-hidden": !0 }) : /* @__PURE__ */ o(mt, { className: "h-3 w-3", "aria-hidden": !0 }))
744
+ (q == null ? void 0 : q.key) === ee(e, r) && (q.dir === 1 ? /* @__PURE__ */ o(ut, { className: "h-3 w-3", "aria-hidden": !0 }) : /* @__PURE__ */ o(bt, { className: "h-3 w-3", "aria-hidden": !0 }))
747
745
  ]
748
746
  }
749
747
  ) : e.label ?? le(e.field ?? ""),
@@ -753,7 +751,7 @@ function Lt({
753
751
  className: "flex justify-end gap-1.5 text-[9px] font-medium normal-case tracking-normal",
754
752
  style: ye(e) ? { ...ye(e), ...X(e) ?? {} } : X(e),
755
753
  children: [
756
- fe(e) && /* @__PURE__ */ o(
754
+ xe(e) && /* @__PURE__ */ o(
757
755
  "span",
758
756
  {
759
757
  className: e.color ? "text-[color:var(--qtc)] dark:text-[color:var(--qtcd)]" : "",
@@ -779,16 +777,16 @@ function Lt({
779
777
  {
780
778
  "aria-label": "Actions",
781
779
  "data-qt-actions-head": "",
782
- className: $ ? `sticky right-0 top-0 z-[3] ${me} bg-white dark:bg-card` : void 0
780
+ className: _ ? `sticky right-0 top-0 z-[3] ${be} bg-white dark:bg-card` : void 0
783
781
  }
784
782
  )
785
783
  ] }) }),
786
784
  /* @__PURE__ */ o("tbody", { children: _e }),
787
785
  B && /* @__PURE__ */ o("tfoot", { children: /* @__PURE__ */ p("tr", { className: "border-t border-slate-300 font-semibold dark:border-border", children: [
788
- f.map((e, r) => /* @__PURE__ */ o(
786
+ x.map((e, r) => /* @__PURE__ */ o(
789
787
  "td",
790
788
  {
791
- className: `whitespace-nowrap py-1.5 pr-3 ${G(r)} ${ke(e, "")} ${M(e) ? "text-right tabular-nums" : ""} ${de(e)} ${$ ? `sticky bottom-0 border-t border-slate-300 dark:border-border ${r === 0 ? `left-0 z-[3] ${te} bg-slate-50 dark:bg-muted` : "z-[2] bg-white dark:bg-card"}` : ""}`,
789
+ className: `whitespace-nowrap py-1.5 pr-3 ${G(r)} ${ke(e, "")} ${U(e) ? "text-right tabular-nums" : ""} ${de(e)} ${_ ? `sticky bottom-0 border-t border-slate-300 dark:border-border ${r === 0 ? `left-0 z-[3] ${te} bg-slate-50 dark:bg-muted` : "z-[2] bg-white dark:bg-card"}` : ""}`,
792
790
  style: X(
793
791
  e,
794
792
  Number(
@@ -802,12 +800,13 @@ function Lt({
802
800
  u && /* @__PURE__ */ o(
803
801
  "td",
804
802
  {
805
- className: `py-1.5 pr-3 text-right ${$ ? `sticky bottom-0 right-0 z-[3] border-t border-slate-300 ${me} bg-white dark:border-border dark:bg-card` : ""}`,
803
+ className: `py-1.5 pr-3 text-right ${_ ? `sticky bottom-0 right-0 z-[3] border-t border-slate-300 ${be} bg-white dark:border-border dark:bg-card` : ""}`,
806
804
  children: /* @__PURE__ */ o("span", { className: "inline-flex flex-nowrap gap-1.5", children: u.map((e) => /* @__PURE__ */ o(
807
805
  "button",
808
806
  {
809
807
  type: "button",
810
- onClick: () => e.onClick(null),
808
+ "data-qt-total-action": e.label,
809
+ onClick: () => e.onClick(null, $),
811
810
  className: "whitespace-nowrap rounded border border-[#a13ffb66] bg-[#a13ffb1a] px-1.5 py-0.5 text-[11px] text-slate-700 hover:brightness-105 dark:text-slate-200",
812
811
  children: e.label
813
812
  },
@@ -833,43 +832,43 @@ function Lt({
833
832
  ] })
834
833
  ] });
835
834
  }
836
- function $t(s, t, m = 1) {
835
+ function wt(s, t, b = 1) {
837
836
  const c = (y) => y == null || y === "";
838
837
  if (c(s) && c(t)) return 0;
839
838
  if (c(s)) return 1;
840
839
  if (c(t)) return -1;
841
840
  const u = typeof s == "number" ? s : Number(s), g = typeof t == "number" ? t : Number(t);
842
- return Number.isFinite(u) && Number.isFinite(g) ? (u - g) * m : String(s).localeCompare(String(t), void 0, { numeric: !0, sensitivity: "base" }) * m;
841
+ return Number.isFinite(u) && Number.isFinite(g) ? (u - g) * b : String(s).localeCompare(String(t), void 0, { numeric: !0, sensitivity: "base" }) * b;
843
842
  }
844
- function _t(s, t, m, c) {
843
+ function $t(s, t, b, c) {
845
844
  const u = (y) => {
846
845
  if (y == null) return "";
847
846
  const v = typeof y == "object" ? JSON.stringify(y) : String(y), L = /^[=+\-@]/.test(v) && !/^-?\d/.test(v) ? `'${v}` : v;
848
847
  return /[",\r\n]/.test(L) ? `"${L.replace(/"/g, '""')}"` : L;
849
848
  }, g = [s.map((y) => u(c(y))).join(",")];
850
- for (const y of t) g.push(s.map((v) => u(m(y, v))).join(","));
849
+ for (const y of t) g.push(s.map((v) => u(b(y, v))).join(","));
851
850
  return `${g.join(`\r
852
851
  `)}\r
853
852
  `;
854
853
  }
855
- function St(s, t) {
856
- const m = URL.createObjectURL(new Blob([`\uFEFF${t}`], { type: "text/csv;charset=utf-8" })), c = document.createElement("a");
857
- c.href = m, c.download = s, document.body.appendChild(c), c.click(), c.remove(), setTimeout(() => URL.revokeObjectURL(m), 0);
854
+ function _t(s, t) {
855
+ const b = URL.createObjectURL(new Blob([`\uFEFF${t}`], { type: "text/csv;charset=utf-8" })), c = document.createElement("a");
856
+ c.href = b, c.download = s, document.body.appendChild(c), c.click(), c.remove(), setTimeout(() => URL.revokeObjectURL(b), 0);
858
857
  }
859
- function Qe({ header: s, children: t }) {
860
- return /* @__PURE__ */ p(Pe, { children: [
858
+ function Pe({ header: s, children: t }) {
859
+ return /* @__PURE__ */ p(Ye, { children: [
861
860
  s,
862
861
  t
863
862
  ] });
864
863
  }
865
864
  export {
866
865
  Se as COLOR_ROLES,
867
- Lt as QueryTable,
868
- vt as UNDATED_KEY,
866
+ Et as QueryTable,
867
+ yt as UNDATED_KEY,
869
868
  Ce as colorPair,
870
869
  ft as darkVariant,
871
- Nt as pivotQueryRows,
872
- _t as queryTableCsv,
873
- wt as queryTableTotals,
874
- $t as sortCompare
870
+ vt as pivotQueryRows,
871
+ $t as queryTableCsv,
872
+ gt as queryTableTotals,
873
+ wt as sortCompare
875
874
  };