serverside_pivot 0.0.96 → 0.0.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +5 -4
  2. package/dist/react/chunks/ContextMenu-DQGCdUhU.mjs +211 -0
  3. package/dist/react/chunks/{DetailDrawer-DgKSC5Vu.mjs → DetailDrawer-yMFRd6Td.mjs} +1 -1
  4. package/dist/react/chunks/{DetailSidePanel-CC5Dugyl.mjs → DetailSidePanel-B6fYMnn7.mjs} +1 -1
  5. package/dist/react/chunks/{DetailSurfaceContent-CrQVHlcU.mjs → DetailSurfaceContent-B9cfLYti.mjs} +1 -1
  6. package/dist/react/chunks/{ECharts2dRenderer-46gLrUdf.mjs → ECharts2dRenderer-ER6rHtch.mjs} +1 -1
  7. package/dist/react/chunks/{ECharts3dRenderer-Dg4ta5Bl.mjs → ECharts3dRenderer-BMVfbpXH.mjs} +1 -1
  8. package/dist/react/chunks/{EditSidePanel-CkShaByb.mjs → EditSidePanel-BjJd5BaX.mjs} +1 -1
  9. package/dist/react/chunks/{InlineDetailPanel-mnwjoD0I.mjs → InlineDetailPanel-Bbkpv9jz.mjs} +1 -1
  10. package/dist/react/chunks/{PivotCharts-MX-Z7DlR.mjs → PivotCharts-P5cBJcwu.mjs} +5 -3
  11. package/dist/react/chunks/{ReportEditor-U0E42xKL.mjs → ReportEditor-P4UZ97Ik.mjs} +174 -175
  12. package/dist/react/chunks/{SidebarPanel-BzRW1Kgq.mjs → SidebarPanel-DRoxHRhK.mjs} +1039 -1024
  13. package/dist/react/chunks/{SparklineDetailGraph-35Tim_8B.mjs → SparklineDetailGraph-C9UX-feP.mjs} +22 -22
  14. package/dist/react/chunks/clientCoreRuntime-n2guUxhp.mjs +790 -0
  15. package/dist/react/chunks/{installCanvasRenderer-DRq0xpXO.mjs → installCanvasRenderer-BR0XmdVX.mjs} +1 -1
  16. package/dist/react/chunks/{react-CL4GbEOd.mjs → react-B5JcZShu.mjs} +17394 -13825
  17. package/dist/react/chunks/{xlsx.mini.min-kfIgXMVB.mjs → xlsx.mini.min-YUTWASKG.mjs} +1 -1
  18. package/dist/react/components/DashTanstackPivot.react.d.ts +6 -0
  19. package/dist/react/components/GlobalSearchInput.d.ts +17 -0
  20. package/dist/react/components/LiveCellDisplay.d.ts +25 -0
  21. package/dist/react/components/LiveExplainSidePanel.d.ts +15 -0
  22. package/dist/react/components/LiveStreamDiffBar.d.ts +15 -0
  23. package/dist/react/hooks/useDismiss.d.ts +43 -0
  24. package/dist/react/hooks/usePivotNormalization.d.ts +4 -0
  25. package/dist/react/hooks/usePrefersReducedMotion.d.ts +8 -0
  26. package/dist/react/hooks/useRenderHelpers.d.ts +1 -1
  27. package/dist/react/hooks/useRowCache.d.ts +2 -0
  28. package/dist/react/hooks/useServerSideRowModel.d.ts +1 -1
  29. package/dist/react/index.mjs +28 -19
  30. package/dist/react/react.d.ts +6 -1
  31. package/dist/react/runtime/client/clientPivotTransport.d.ts +16 -0
  32. package/dist/react/runtime/client/clientResponsePostProcessor.d.ts +8 -1
  33. package/dist/react/runtime/client/clientSubscriptionEngine.d.ts +88 -0
  34. package/dist/react/runtime/client/duckdbWasmExecutor.d.ts +22 -0
  35. package/dist/react/runtime/client/index.d.ts +1 -0
  36. package/dist/react/runtime/client/types.d.ts +6 -0
  37. package/dist/react/runtime/core/clientCoreRuntime.d.ts +46 -0
  38. package/dist/react/runtime/core/duckdbSqlEmitter.d.ts +37 -0
  39. package/dist/react/runtime/core/semanticIr.generated.d.ts +196 -0
  40. package/dist/react/runtime/responseQueue.d.ts +21 -0
  41. package/dist/react/runtime/rowIdentity.d.ts +20 -0
  42. package/dist/react/runtime/runtimeDomains.d.ts +8 -1
  43. package/dist/react/runtime/streamingTypes.d.ts +182 -0
  44. package/dist/react/runtime/useRuntimeViewportTableData.d.ts +1 -1
  45. package/dist/react/runtime/useViewportSubscriptionStore.d.ts +112 -0
  46. package/dist/react/runtime/useWorkspaceStatusPresentation.d.ts +1 -1
  47. package/dist/react/utils/helpers.d.ts +1 -1
  48. package/dist/react/utils/pivotLayoutUtils.d.ts +3 -3
  49. package/dist/react/utils/rowMotion.d.ts +108 -0
  50. package/dist/react/utils/styles.d.ts +1 -0
  51. package/package.json +6 -8
  52. package/dist/react/chunks/ContextMenu-DJuS4qTZ.mjs +0 -198
@@ -1,5 +1,5 @@
1
- import t, { useState as H, useRef as Fe, useMemo as W, useCallback as B, useEffect as Ee } from "react";
2
- import { ab as St, an as wt, I as m, ao as Ct, T as U, ad as kt, _ as M, ap as At } from "./react-CL4GbEOd.mjs";
1
+ import t, { useState as H, useRef as Be, useMemo as W, useCallback as F, useEffect as Ee } from "react";
2
+ import { ad as St, ap as wt, I as m, aq as Ct, T as U, af as At, a0 as M, ar as kt } from "./react-B5JcZShu.mjs";
3
3
  const oe = () => `r${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`, Qe = [
4
4
  { value: "eq", label: "Equals" },
5
5
  { value: "not_eq", label: "Not equals" },
@@ -22,7 +22,7 @@ const oe = () => `r${Date.now().toString(36)}${Math.random().toString(36).slice(
22
22
  gte: ">=",
23
23
  lt: "<",
24
24
  lte: "<="
25
- }, Ft = /* @__PURE__ */ new Set([
25
+ }, Bt = /* @__PURE__ */ new Set([
26
26
  "depth",
27
27
  "_id",
28
28
  "_path",
@@ -32,7 +32,7 @@ const oe = () => `r${Date.now().toString(36)}${Math.random().toString(36).slice(
32
32
  "_has_children",
33
33
  "_is_expanded",
34
34
  "__col_schema"
35
- ]), T = "default", De = "branch:", Ue = ["", "solid", "dashed", "dotted", "double"], et = (e = "") => ({ _id: oe(), field: e, operator: "eq", value: "", values: [] }), Le = () => ({ op: "AND", clauses: [] }), Bt = () => ({ _id: oe(), label: "", condition: Le(), child: null }), Se = (e = {}) => {
35
+ ]), T = "default", De = "branch:", Ue = ["", "solid", "dashed", "dotted", "double"], et = (e = "") => ({ _id: oe(), field: e, operator: "eq", value: "", values: [] }), Le = () => ({ op: "AND", clauses: [] }), Ft = () => ({ _id: oe(), label: "", condition: Le(), child: null }), Se = (e = {}) => {
36
36
  const l = e && typeof e == "object" ? e : {}, n = Number(l.indent), a = Number(l.borderWidth), r = typeof l.borderStyle == "string" && Ue.includes(l.borderStyle) ? l.borderStyle : "";
37
37
  return {
38
38
  indent: Number.isFinite(n) && n >= 0 ? Math.floor(n) : "",
@@ -114,7 +114,7 @@ const _e = (e) => `${De}${e}`, Ce = (e) => {
114
114
  );
115
115
  return (e || []).filter(
116
116
  /** @param {any} [field] @returns {any} */
117
- (a) => a && typeof a == "string" && !Ft.has(a) && (!a.startsWith("_") || kt(a)) && !n.has(a)
117
+ (a) => a && typeof a == "string" && !Bt.has(a) && (!a.startsWith("_") || At(a)) && !n.has(a)
118
118
  );
119
119
  }, Nt = (e) => {
120
120
  const l = [
@@ -125,11 +125,11 @@ const _e = (e) => `${De}${e}`, Ce = (e) => {
125
125
  /** @param {any} [config] @returns {any} */
126
126
  (n) => {
127
127
  if (!n || !n.field || !n.agg) return;
128
- const a = n.agg === "formula" ? n.field : `${n.field}_${n.agg}`, r = n.agg === "formula" ? n.label || M(n.field) : `${M(n.field)} (${At(n.agg, n.weightField)})`;
128
+ const a = n.agg === "formula" ? n.field : `${n.field}_${n.agg}`, r = n.agg === "formula" ? n.label || M(n.field) : `${M(n.field)} (${kt(n.agg, n.weightField)})`;
129
129
  l.push({ value: a, label: r });
130
130
  }
131
131
  ), l;
132
- }, ke = (e) => !e || !e.clauses || e.clauses.length === 0 ? "No filter" : e.clauses.map(
132
+ }, Ae = (e) => !e || !e.clauses || e.clauses.length === 0 ? "No filter" : e.clauses.map(
133
133
  /** @param {any} [clause] @returns {any} */
134
134
  (l) => {
135
135
  const n = M(l.field), a = $t[l.operator] || l.operator;
@@ -203,7 +203,7 @@ const _e = (e) => `${De}${e}`, Ce = (e) => {
203
203
  const r = [], i = [], s = (n || []).some(
204
204
  /** @param {any} [config] @returns {any} */
205
205
  (y) => y && y.field && y.agg
206
- ), f = new Set(Array.isArray(l) ? l : []), E = /* @__PURE__ */ new Map(), b = Array.isArray(a) ? a : [], F = (y, C) => {
206
+ ), f = new Set(Array.isArray(l) ? l : []), E = /* @__PURE__ */ new Map(), b = Array.isArray(a) ? a : [], B = (y, C) => {
207
207
  const c = y.trim().toLowerCase();
208
208
  if (c) {
209
209
  if (E.has(c)) {
@@ -214,13 +214,13 @@ const _e = (e) => `${De}${e}`, Ce = (e) => {
214
214
  }
215
215
  }, N = (y, C, c = /* @__PURE__ */ new Set()) => {
216
216
  if (!y) return;
217
- const h = y._id || `${C}:${y.field || ""}`;
218
- if (c.has(h)) {
217
+ const g = y._id || `${C}:${y.field || ""}`;
218
+ if (c.has(g)) {
219
219
  r.push(`Circular row override detected at ${C}.`);
220
220
  return;
221
221
  }
222
222
  const v = new Set(c);
223
- v.add(h), y.field ? f.size > 0 && !f.has(y.field) && r.push(`Field "${M(y.field)}" at ${C} is no longer available.`) : r.push(`Missing field at ${C}.`), F(lt(y), C), y.topN && !s && r.push(`Top-N at ${C} needs at least one measure selected.`), y.filters && !Ne(y.filters) ? r.push(`Level filter at ${C} has incomplete rules.`) : y.filters && !Ye(y.filters, b) && r.push(`Level filter at ${C} does not match any loaded rows.`), y.defaultChild && N(y.defaultChild, `${C} > Default children`, v), (y.branches || []).forEach(
223
+ v.add(g), y.field ? f.size > 0 && !f.has(y.field) && r.push(`Field "${M(y.field)}" at ${C} is no longer available.`) : r.push(`Missing field at ${C}.`), B(lt(y), C), y.topN && !s && r.push(`Top-N at ${C} needs at least one measure selected.`), y.filters && !Ne(y.filters) ? r.push(`Level filter at ${C} has incomplete rules.`) : y.filters && !Ye(y.filters, b) && r.push(`Level filter at ${C} does not match any loaded rows.`), y.defaultChild && N(y.defaultChild, `${C} > Default children`, v), (y.branches || []).forEach(
224
224
  /** @param {any} [branch] @param {any} [index] @returns {any} */
225
225
  (u, D) => {
226
226
  const R = u.label && u.label.trim() ? u.label.trim() : `Row override ${D + 1}`, x = `${C} > ${R}`;
@@ -241,7 +241,7 @@ const _e = (e) => `${De}${e}`, Ce = (e) => {
241
241
  }
242
242
  }
243
243
  return n || null;
244
- }, Be = (e, l, n) => {
244
+ }, Fe = (e, l, n) => {
245
245
  const a = ae(e, l);
246
246
  return a && a.branches[n] ? a.branches[n] : null;
247
247
  }, _ = (e, l, n) => {
@@ -321,12 +321,12 @@ const _e = (e) => `${De}${e}`, Ce = (e) => {
321
321
  branchBadge: null,
322
322
  branchDepth: 0
323
323
  }), l;
324
- }, re = (e = []) => e.join(">"), Ae = (e = [], l = []) => re(e) === re(l), Q = (e) => e == null ? "" : String(e), Z = (e) => e ? e.type === "node" ? `node:${re(e.path)}` : e.type === "branch" ? `branch:${re(e.nodePath)}:${e.branchIndex}` : e.type === "rowPath" ? `rowPath:${re(e.nodePath)}:${e.field}:${Q(e.value)}` : "" : "", we = (e, l) => (e || []).find(
324
+ }, re = (e = []) => e.join(">"), ke = (e = [], l = []) => re(e) === re(l), Q = (e) => e == null ? "" : String(e), Z = (e) => e ? e.type === "node" ? `node:${re(e.path)}` : e.type === "branch" ? `branch:${re(e.nodePath)}:${e.branchIndex}` : e.type === "rowPath" ? `rowPath:${re(e.nodePath)}:${e.field}:${Q(e.value)}` : "" : "", we = (e, l) => (e || []).find(
325
325
  /** @param {any} [item] @returns {any} */
326
- (n) => n.kind === "node" && Ae(n.nodePath, l)
326
+ (n) => n.kind === "node" && ke(n.nodePath, l)
327
327
  ) || null, rt = (e, l, n) => (e || []).find(
328
328
  /** @param {any} [item] @returns {any} */
329
- (a) => a.kind === "branch" && Ae(a.nodePath, l) && a.branchIndex === n
329
+ (a) => a.kind === "branch" && ke(a.nodePath, l) && a.branchIndex === n
330
330
  ) || null, Xe = (e, l, n) => {
331
331
  if (!e || !l) return !1;
332
332
  const a = Q(n);
@@ -335,7 +335,7 @@ const _e = (e) => `${De}${e}`, Ce = (e) => {
335
335
  (i) => !i || i.field !== l ? !1 : i.operator === "eq" || i.operator === "=" ? Q(i.value) === a : i.operator === "in" ? Array.isArray(i.values) && i.values.map(Q).includes(a) : !1
336
336
  );
337
337
  }, _t = (e, l, n, a = "") => ({
338
- ...Bt(),
338
+ ...Ft(),
339
339
  label: Q(n || l),
340
340
  condition: {
341
341
  op: "AND",
@@ -414,7 +414,7 @@ const _e = (e) => `${De}${e}`, Ce = (e) => {
414
414
  r && a.push(r);
415
415
  const i = (e || []).filter(
416
416
  /** @param {any} [item] @returns {any} */
417
- (s) => s.kind === "branch" && Ae(s.nodePath, l.path)
417
+ (s) => s.kind === "branch" && ke(s.nodePath, l.path)
418
418
  ).sort(
419
419
  /** @param {any} [left] @param {any} [right] @returns {any} */
420
420
  (s, f) => s.branchIndex - f.branchIndex
@@ -517,28 +517,28 @@ function ne({
517
517
  return /* @__PURE__ */ t.createElement("section", { "data-report-section": i || l, style: Vt(e) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "12px" } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", gap: "8px", minWidth: 0 } }, /* @__PURE__ */ t.createElement("div", { style: { color: e.textSec, display: "flex", alignItems: "center", paddingTop: "1px", flexShrink: 0 } }, a), /* @__PURE__ */ t.createElement("div", { style: { minWidth: 0 } }, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "13px", fontWeight: 900, color: e.text } }, l), n && /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: e.textSec, lineHeight: 1.45, marginTop: "2px" } }, n))), r && /* @__PURE__ */ t.createElement("div", { style: { flexShrink: 0 } }, r)), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "10px" } }, s));
518
518
  }
519
519
  function Pe({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClose: r, theme: i, title: s, description: f }) {
520
- const [E, b] = H(() => ze(e)), F = q(i), N = B(() => {
520
+ const [E, b] = H(() => ze(e)), B = q(i), N = F(() => {
521
521
  b(
522
522
  /** @param {any} [prev] @returns {any} */
523
523
  (c) => ({ ...c, clauses: [...c.clauses, et(l[0] || "")] })
524
524
  );
525
- }, [l]), y = B((c, h) => {
525
+ }, [l]), y = F((c, g) => {
526
526
  b(
527
527
  /** @param {any} [prev] @returns {any} */
528
528
  (v) => ({
529
529
  ...v,
530
530
  clauses: v.clauses.map(
531
531
  /** @param {any} [clause] @param {any} [clauseIndex] @returns {any} */
532
- (u, D) => D === c ? { ...u, ...h } : u
532
+ (u, D) => D === c ? { ...u, ...g } : u
533
533
  )
534
534
  })
535
535
  );
536
- }, []), C = B((c) => {
536
+ }, []), C = F((c) => {
537
537
  b(
538
538
  /** @param {any} [prev] @returns {any} */
539
- (h) => ({
540
- ...h,
541
- clauses: h.clauses.filter(
539
+ (g) => ({
540
+ ...g,
541
+ clauses: g.clauses.filter(
542
542
  /** @param {any} [_] @param {any} [clauseIndex] @returns {any} */
543
543
  (v, u) => u !== c
544
544
  )
@@ -547,8 +547,8 @@ function Pe({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
547
547
  }, []);
548
548
  return Ee(() => {
549
549
  if (typeof r != "function") return;
550
- const c = (h) => {
551
- h.key === "Escape" && !h.defaultPrevented && (h.preventDefault(), r());
550
+ const c = (g) => {
551
+ g.key === "Escape" && !g.defaultPrevented && (g.preventDefault(), r());
552
552
  };
553
553
  return window.addEventListener("keydown", c), () => window.removeEventListener("keydown", c);
554
554
  }, [r]), /* @__PURE__ */ t.createElement(
@@ -560,8 +560,6 @@ function Pe({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
560
560
  inset: 0,
561
561
  zIndex: 9999,
562
562
  background: "rgba(15, 23, 42, 0.38)",
563
- backdropFilter: "blur(6px)",
564
- WebkitBackdropFilter: "blur(6px)",
565
563
  display: "flex",
566
564
  alignItems: "center",
567
565
  justifyContent: "center"
@@ -592,7 +590,7 @@ function Pe({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
592
590
  type: "button",
593
591
  onClick: () => b(
594
592
  /** @param {any} [prev] @returns {any} */
595
- (h) => ({ ...h, op: c })
593
+ (g) => ({ ...g, op: c })
596
594
  ),
597
595
  style: {
598
596
  padding: "5px 12px",
@@ -609,7 +607,7 @@ function Pe({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
609
607
  ))),
610
608
  /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, E.clauses.length === 0 && /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", color: i.textSec, fontStyle: "italic" } }, "No clauses means this row override matches every row at this level."), E.clauses.map(
611
609
  /** @param {any} [clause] @param {any} [index] @returns {any} */
612
- (c, h) => /* @__PURE__ */ t.createElement(
610
+ (c, g) => /* @__PURE__ */ t.createElement(
613
611
  "div",
614
612
  {
615
613
  key: c._id,
@@ -623,15 +621,15 @@ function Pe({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
623
621
  alignItems: "flex-start"
624
622
  }
625
623
  },
626
- /* @__PURE__ */ t.createElement("div", { style: { width: "32px", paddingTop: "6px", textAlign: "center", fontSize: "10px", fontWeight: 800, color: i.textSec } }, h > 0 ? E.op : ""),
624
+ /* @__PURE__ */ t.createElement("div", { style: { width: "32px", paddingTop: "6px", textAlign: "center", fontSize: "10px", fontWeight: 800, color: i.textSec } }, g > 0 ? E.op : ""),
627
625
  /* @__PURE__ */ t.createElement("div", { style: { flex: 1, display: "flex", flexDirection: "column", gap: "8px" } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(
628
626
  U,
629
627
  {
630
628
  size: "sm",
631
629
  "aria-label": "Filter field",
632
630
  value: c.field,
633
- onChange: (v) => y(h, { field: v.target.value }),
634
- style: { ...F, flex: 1, minWidth: "140px" }
631
+ onChange: (v) => y(g, { field: v.target.value }),
632
+ style: { ...B, flex: 1, minWidth: "140px" }
635
633
  },
636
634
  l.map(
637
635
  /** @param {any} [field] @returns {any} */
@@ -645,13 +643,13 @@ function Pe({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
645
643
  value: c.operator,
646
644
  onChange: (v) => {
647
645
  const u = v.target.value, D = pe.has(u), R = pe.has(c.operator);
648
- y(h, {
646
+ y(g, {
649
647
  operator: u,
650
648
  values: D ? R ? c.values : c.value ? [c.value] : [] : c.values,
651
649
  value: D ? c.value : c.values[0] || c.value || ""
652
650
  });
653
651
  },
654
- style: { ...F, width: "160px", flexShrink: 0 }
652
+ style: { ...B, width: "160px", flexShrink: 0 }
655
653
  },
656
654
  Qe.map((v) => /* @__PURE__ */ t.createElement("option", { key: v.value, value: v.value }, v.label))
657
655
  )), pe.has(c.operator) ? /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, c.values.length > 0 && /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexWrap: "wrap", gap: "6px" } }, c.values.map(
@@ -660,7 +658,7 @@ function Pe({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
660
658
  "button",
661
659
  {
662
660
  type: "button",
663
- onClick: () => y(h, {
661
+ onClick: () => y(g, {
664
662
  values: c.values.filter(
665
663
  /** @param {any} [_] @param {any} [currentIndex] @returns {any} */
666
664
  (D, R) => R !== u
@@ -674,12 +672,12 @@ function Pe({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
674
672
  "input",
675
673
  {
676
674
  placeholder: "Type a value and press Enter",
677
- style: F,
675
+ style: B,
678
676
  onKeyDown: (
679
677
  /** @param {any} event */
680
678
  ((v) => {
681
679
  const u = v.target.value.trim();
682
- v.key === "Enter" && u && (c.values.includes(u) || y(h, { values: [...c.values, u] }), v.target.value = "", v.preventDefault());
680
+ v.key === "Enter" && u && (c.values.includes(u) || y(g, { values: [...c.values, u] }), v.target.value = "", v.preventDefault());
683
681
  })
684
682
  )
685
683
  }
@@ -687,16 +685,16 @@ function Pe({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
687
685
  "input",
688
686
  {
689
687
  value: c.value,
690
- onChange: (v) => y(h, { value: v.target.value }),
688
+ onChange: (v) => y(g, { value: v.target.value }),
691
689
  placeholder: "Value",
692
- style: F
690
+ style: B
693
691
  }
694
692
  )),
695
693
  /* @__PURE__ */ t.createElement(
696
694
  "button",
697
695
  {
698
696
  type: "button",
699
- onClick: () => C(h),
697
+ onClick: () => C(g),
700
698
  style: { background: "none", border: "none", cursor: "pointer", color: "#B91C1C", padding: "6px" }
701
699
  },
702
700
  /* @__PURE__ */ t.createElement(m.Delete, null)
@@ -817,12 +815,12 @@ function it({
817
815
  );
818
816
  }
819
817
  function Jt({ item: e, selected: l, theme: n, sortByOptions: a, getFieldLabel: r = M, onSelect: i }) {
820
- const s = e.node, f = Lt(e), E = s.field ? r(s.field) : "Select field", b = lt(s), F = tt(s.sortBy, a);
821
- return /* @__PURE__ */ t.createElement("button", { type: "button", onClick: i, style: at(n, l, e.depth) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "10px" } }, /* @__PURE__ */ t.createElement("div", { style: { minWidth: 0, display: "flex", flexDirection: "column", gap: "7px" } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n, tone: e.branchBadge ? "primary" : "neutral" }, f), /* @__PURE__ */ t.createElement("span", { style: { fontSize: "12px", fontWeight: 800, color: n.text } }, E)), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: n.textSec } }, "Header: ", b), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n }, s.topN ? `Top ${s.topN}` : "All rows"), /* @__PURE__ */ t.createElement(X, { theme: n }, F ? `Sort ${s.sortDir}${s.sortAbs ? " |abs|" : ""} by ${F}` : "Default sort"), s.defaultChild && /* @__PURE__ */ t.createElement(X, { theme: n }, "Has next level"), s.branches.length > 0 && /* @__PURE__ */ t.createElement(X, { theme: n, tone: "primary" }, s.branches.length, " row override", s.branches.length === 1 ? "" : "s"))), /* @__PURE__ */ t.createElement("span", { style: { color: l ? n.primary || "#2563EB" : n.textSec, flexShrink: 0 } }, /* @__PURE__ */ t.createElement(m.ChevronRight, null))));
818
+ const s = e.node, f = Lt(e), E = s.field ? r(s.field) : "Select field", b = lt(s), B = tt(s.sortBy, a);
819
+ return /* @__PURE__ */ t.createElement("button", { type: "button", onClick: i, style: at(n, l, e.depth) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "10px" } }, /* @__PURE__ */ t.createElement("div", { style: { minWidth: 0, display: "flex", flexDirection: "column", gap: "7px" } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n, tone: e.branchBadge ? "primary" : "neutral" }, f), /* @__PURE__ */ t.createElement("span", { style: { fontSize: "12px", fontWeight: 800, color: n.text } }, E)), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: n.textSec } }, "Header: ", b), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n }, s.topN ? `Top ${s.topN}` : "All rows"), /* @__PURE__ */ t.createElement(X, { theme: n }, B ? `Sort ${s.sortDir}${s.sortAbs ? " |abs|" : ""} by ${B}` : "Default sort"), s.defaultChild && /* @__PURE__ */ t.createElement(X, { theme: n }, "Has next level"), s.branches.length > 0 && /* @__PURE__ */ t.createElement(X, { theme: n, tone: "primary" }, s.branches.length, " row override", s.branches.length === 1 ? "" : "s"))), /* @__PURE__ */ t.createElement("span", { style: { color: l ? n.primary || "#2563EB" : n.textSec, flexShrink: 0 } }, /* @__PURE__ */ t.createElement(m.ChevronRight, null))));
822
820
  }
823
821
  function Gt({ item: e, selected: l, theme: n, onSelect: a }) {
824
822
  const r = e.branch, i = r.label && r.label.trim() ? r.label.trim() : "Display original label";
825
- return /* @__PURE__ */ t.createElement("button", { type: "button", onClick: a, style: at(n, l, e.depth) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "10px" } }, /* @__PURE__ */ t.createElement("div", { style: { minWidth: 0, display: "flex", flexDirection: "column", gap: "7px" } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n, tone: "primary" }, `Row override ${e.badge}`), /* @__PURE__ */ t.createElement("span", { style: { fontSize: "12px", fontWeight: 800, color: n.text } }, i)), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: n.textSec, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, ke(r.condition)), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n }, r.child ? "Custom children" : "Default children"))), /* @__PURE__ */ t.createElement("span", { style: { color: l ? n.primary || "#2563EB" : n.textSec, flexShrink: 0 } }, /* @__PURE__ */ t.createElement(m.ChevronRight, null))));
823
+ return /* @__PURE__ */ t.createElement("button", { type: "button", onClick: a, style: at(n, l, e.depth) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "10px" } }, /* @__PURE__ */ t.createElement("div", { style: { minWidth: 0, display: "flex", flexDirection: "column", gap: "7px" } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n, tone: "primary" }, `Row override ${e.badge}`), /* @__PURE__ */ t.createElement("span", { style: { fontSize: "12px", fontWeight: 800, color: n.text } }, i)), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: n.textSec, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, Ae(r.condition)), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n }, r.child ? "Custom children" : "Default children"))), /* @__PURE__ */ t.createElement("span", { style: { color: l ? n.primary || "#2563EB" : n.textSec, flexShrink: 0 } }, /* @__PURE__ */ t.createElement(m.ChevronRight, null))));
826
824
  }
827
825
  function st({
828
826
  item: e,
@@ -835,7 +833,7 @@ function st({
835
833
  onDragOver: f,
836
834
  onDrop: E
837
835
  }) {
838
- const b = e.node, F = b.field ? r(b.field) : "Select field", N = b.label && b.label.trim() ? b.label.trim() : F, y = tt(b.sortBy, a);
836
+ const b = e.node, B = b.field ? r(b.field) : "Select field", N = b.label && b.label.trim() ? b.label.trim() : B, y = tt(b.sortBy, a);
839
837
  return /* @__PURE__ */ t.createElement(
840
838
  "button",
841
839
  {
@@ -859,7 +857,7 @@ function st({
859
857
  }
860
858
  },
861
859
  /* @__PURE__ */ t.createElement("span", { style: { cursor: "grab", display: "inline-flex" } }, /* @__PURE__ */ t.createElement(m.DragIndicator, null)),
862
- /* @__PURE__ */ t.createElement("div", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", gap: "7px", minWidth: 0 } }, /* @__PURE__ */ t.createElement("span", { style: { fontSize: "11px", fontWeight: 800, color: n.textSec, flexShrink: 0 } }, "Level ", e.levelNumber), /* @__PURE__ */ t.createElement("span", { style: { fontSize: "12px", fontWeight: 800, color: n.text, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, N)), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: n.textSec, marginTop: "3px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, F, y ? ` · ${b.sortDir === "asc" ? "Asc" : "Desc"}${b.sortAbs ? " |abs|" : ""} by ${y}` : "", b.topN ? ` · Top ${b.topN}` : "", b.filters && b.filters.clauses && b.filters.clauses.length > 0 ? ` · ${b.filters.clauses.length} filter${b.filters.clauses.length === 1 ? "" : "s"}` : "")),
860
+ /* @__PURE__ */ t.createElement("div", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", gap: "7px", minWidth: 0 } }, /* @__PURE__ */ t.createElement("span", { style: { fontSize: "11px", fontWeight: 800, color: n.textSec, flexShrink: 0 } }, "Level ", e.levelNumber), /* @__PURE__ */ t.createElement("span", { style: { fontSize: "12px", fontWeight: 800, color: n.text, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, N)), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: n.textSec, marginTop: "3px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, B, y ? ` · ${b.sortDir === "asc" ? "Asc" : "Desc"}${b.sortAbs ? " |abs|" : ""} by ${y}` : "", b.topN ? ` · Top ${b.topN}` : "", b.filters && b.filters.clauses && b.filters.clauses.length > 0 ? ` · ${b.filters.clauses.length} filter${b.filters.clauses.length === 1 ? "" : "s"}` : "")),
863
861
  /* @__PURE__ */ t.createElement("span", { style: { color: l ? n.primary || "#2563EB" : n.textSec, flexShrink: 0 } }, /* @__PURE__ */ t.createElement(m.ChevronRight, null))
864
862
  );
865
863
  }
@@ -874,7 +872,7 @@ function Yt({
874
872
  onApply: f,
875
873
  onRemove: E,
876
874
  onEditFilter: b,
877
- titleLabel: F = "Title",
875
+ titleLabel: B = "Title",
878
876
  canRemove: N = !0
879
877
  }) {
880
878
  const y = q(i), C = e && e.levelNumber ? `Level ${e.levelNumber}` : "Level", c = !!(l.filters && l.filters.clauses && l.filters.clauses.length > 0), v = [
@@ -923,7 +921,7 @@ function Yt({
923
921
  (u) => /* @__PURE__ */ t.createElement("option", { key: u, value: u }, a(u))
924
922
  )
925
923
  )),
926
- /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(i) }, F), /* @__PURE__ */ t.createElement(
924
+ /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(i) }, B), /* @__PURE__ */ t.createElement(
927
925
  "input",
928
926
  {
929
927
  value: l.label,
@@ -1014,7 +1012,7 @@ function Yt({
1014
1012
  })
1015
1013
  },
1016
1014
  /* @__PURE__ */ t.createElement(m.Filter, null),
1017
- /* @__PURE__ */ t.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1 } }, c ? ke(l.filters) : "No filter (show all rows)")
1015
+ /* @__PURE__ */ t.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1 } }, c ? Ae(l.filters) : "No filter (show all rows)")
1018
1016
  ), c && /* @__PURE__ */ t.createElement(
1019
1017
  "button",
1020
1018
  {
@@ -1059,11 +1057,11 @@ function Zt({
1059
1057
  onApply: s,
1060
1058
  onCancel: f
1061
1059
  }) {
1062
- const [E, b] = H(null), [F, N] = H(!1), y = e && e.child ? e.child : Y(""), C = Array.isArray(e && e.selectedPath) ? e.selectedPath : [], c = ae(y, C) || y, h = !!(c.filters && c.filters.clauses && c.filters.clauses.length > 0), v = We(y, e.childLevelNumber || 2), u = Math.max(0, C.length), D = (e && Number.isFinite(Number(e.childLevelNumber)) ? Number(e.childLevelNumber) : 2) + C.length, R = q(r), x = [
1060
+ const [E, b] = H(null), [B, N] = H(!1), y = e && e.child ? e.child : Y(""), C = Array.isArray(e && e.selectedPath) ? e.selectedPath : [], c = ae(y, C) || y, g = !!(c.filters && c.filters.clauses && c.filters.clauses.length > 0), v = We(y, e.childLevelNumber || 2), u = Math.max(0, C.length), D = (e && Number.isFinite(Number(e.childLevelNumber)) ? Number(e.childLevelNumber) : 2) + C.length, R = q(r), x = [
1063
1061
  c.field ? n(c.field) : "Select field",
1064
1062
  e.title && e.title.trim() ? `Title: ${e.title.trim()}` : null,
1065
1063
  c.topN ? `Top ${c.topN}` : null,
1066
- h ? `${c.filters.clauses.length} filter${c.filters.clauses.length === 1 ? "" : "s"}` : null
1064
+ g ? `${c.filters.clauses.length} filter${c.filters.clauses.length === 1 ? "" : "s"}` : null
1067
1065
  ].filter(Boolean), w = (d) => {
1068
1066
  i({
1069
1067
  ...e,
@@ -1082,9 +1080,9 @@ function Zt({
1082
1080
  y,
1083
1081
  C,
1084
1082
  /** @param {any} [node] @returns {any} */
1085
- (A) => ({
1086
- ...A,
1087
- defaultChild: A.defaultChild || Y("")
1083
+ (k) => ({
1084
+ ...k,
1085
+ defaultChild: k.defaultChild || Y("")
1088
1086
  })
1089
1087
  ),
1090
1088
  selectedPath: d
@@ -1102,11 +1100,11 @@ function Zt({
1102
1100
  })
1103
1101
  )
1104
1102
  });
1105
- }, ye = (d, A) => {
1106
- d === null || d === A || (i({
1103
+ }, ye = (d, k) => {
1104
+ d === null || d === k || (i({
1107
1105
  ...e,
1108
- child: nt(y, d, A),
1109
- selectedPath: Ie(A)
1106
+ child: nt(y, d, k),
1107
+ selectedPath: Ie(k)
1110
1108
  }), b(null));
1111
1109
  };
1112
1110
  return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("div", { style: ue(r) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "12px" } }, /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "14px", fontWeight: 800, color: r.text } }, e.rowLabel || "Selected row"), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", color: r.textSec, marginTop: "2px" } }, "Override applies to this row only.")), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", flexShrink: 0 } }, /* @__PURE__ */ t.createElement("button", { type: "button", onClick: f, style: j(r) }, /* @__PURE__ */ t.createElement(m.Close, null), " Close"), /* @__PURE__ */ t.createElement(
@@ -1140,18 +1138,18 @@ function Zt({
1140
1138
  onSelect: () => K(d.index),
1141
1139
  onDragStart: (
1142
1140
  /** @param {any} [event] @returns {any} */
1143
- ((A) => {
1144
- b(d.index), A.dataTransfer.effectAllowed = "move";
1141
+ ((k) => {
1142
+ b(d.index), k.dataTransfer.effectAllowed = "move";
1145
1143
  })
1146
1144
  ),
1147
1145
  onDragOver: (
1148
1146
  /** @param {any} [event] @returns {any} */
1149
- ((A) => A.preventDefault())
1147
+ ((k) => k.preventDefault())
1150
1148
  ),
1151
1149
  onDrop: (
1152
1150
  /** @param {any} [event] @returns {any} */
1153
- ((A) => {
1154
- A.preventDefault(), ye(E, d.index);
1151
+ ((k) => {
1152
+ k.preventDefault(), ye(E, d.index);
1155
1153
  })
1156
1154
  )
1157
1155
  }
@@ -1195,8 +1193,8 @@ function Zt({
1195
1193
  min: "1",
1196
1194
  value: c.topN || "",
1197
1195
  onChange: (d) => {
1198
- const A = d.target.value === "" ? null : parseInt(d.target.value, 10);
1199
- w({ ...c, topN: A && A > 0 ? A : null });
1196
+ const k = d.target.value === "" ? null : parseInt(d.target.value, 10);
1197
+ w({ ...c, topN: k && k > 0 ? k : null });
1200
1198
  },
1201
1199
  placeholder: "All",
1202
1200
  style: { ...R, textAlign: "center" }
@@ -1265,13 +1263,13 @@ function Zt({
1265
1263
  gap: "8px",
1266
1264
  textAlign: "left",
1267
1265
  cursor: "pointer",
1268
- background: h ? `${r.primary || "#2563EB"}08` : r.hover || "#F8FAFC",
1269
- borderColor: h ? `${r.primary || "#2563EB"}45` : void 0
1266
+ background: g ? `${r.primary || "#2563EB"}08` : r.hover || "#F8FAFC",
1267
+ borderColor: g ? `${r.primary || "#2563EB"}45` : void 0
1270
1268
  })
1271
1269
  },
1272
1270
  /* @__PURE__ */ t.createElement(m.Filter, null),
1273
- /* @__PURE__ */ t.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1 } }, h ? ke(c.filters) : "No filter (show all children)")
1274
- ), h && /* @__PURE__ */ t.createElement(
1271
+ /* @__PURE__ */ t.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1 } }, g ? Ae(c.filters) : "No filter (show all children)")
1272
+ ), g && /* @__PURE__ */ t.createElement(
1275
1273
  "button",
1276
1274
  {
1277
1275
  type: "button",
@@ -1315,7 +1313,7 @@ function Zt({
1315
1313
  " ",
1316
1314
  c.defaultChild ? "Open next level" : "Add next level"
1317
1315
  ), c.defaultChild && /* @__PURE__ */ t.createElement("button", { type: "button", onClick: ie, style: j(r, !1, !0) }, /* @__PURE__ */ t.createElement(m.Delete, null), " Remove next level"))
1318
- )), F && /* @__PURE__ */ t.createElement(
1316
+ )), B && /* @__PURE__ */ t.createElement(
1319
1317
  Pe,
1320
1318
  {
1321
1319
  title: `Filter children of "${e.rowLabel || "this row"}"`,
@@ -1347,12 +1345,12 @@ function Xt({
1347
1345
  onRemoveCustomChildren: s,
1348
1346
  onRemove: f
1349
1347
  }) {
1350
- const E = q(n), b = ke(l.condition);
1348
+ const E = q(n), b = Ae(l.condition);
1351
1349
  return /* @__PURE__ */ t.createElement("div", { style: ue(n) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "12px" } }, /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "14px", fontWeight: 800, color: n.text } }, `Row override ${e.badge}`), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", color: n.textSec, marginTop: "2px" } }, "Use a row override when matching rows need a different label or child breakdown.")), /* @__PURE__ */ t.createElement("button", { type: "button", onClick: f, style: j(n, !1, !0) }, /* @__PURE__ */ t.createElement(m.Delete, null), " Remove override")), /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(n) }, "Display As"), /* @__PURE__ */ t.createElement(
1352
1350
  "input",
1353
1351
  {
1354
1352
  value: l.label,
1355
- onChange: (F) => a({ ...l, label: F.target.value }),
1353
+ onChange: (B) => a({ ...l, label: B.target.value }),
1356
1354
  placeholder: "Label to show for matching rows",
1357
1355
  style: E
1358
1356
  }
@@ -1400,39 +1398,39 @@ function el({
1400
1398
  colFields: f,
1401
1399
  setColFields: E,
1402
1400
  setValConfigs: b,
1403
- savedReports: F,
1401
+ savedReports: B,
1404
1402
  setSavedReports: N,
1405
1403
  activeReportId: y,
1406
1404
  setActiveReportId: C,
1407
1405
  showNotification: c,
1408
- requestedSelection: h = null,
1406
+ requestedSelection: g = null,
1409
1407
  showReportConfigColumn: v = !0,
1410
1408
  setShowReportConfigColumn: u
1411
1409
  }) {
1412
- const [D, R] = H(""), [x, w] = H(null), [K, fe] = H(null), [ie, ye] = H(null), [d, A] = H(null), [ct, Te] = H(null), xe = Fe(null), se = Fe(!1), je = Fe(null), g = W(
1410
+ const [D, R] = H(""), [x, w] = H(null), [K, fe] = H(null), [ie, ye] = H(null), [d, k] = H(null), [ct, Te] = H(null), xe = Be(null), se = Be(!1), je = Be(null), h = W(
1413
1411
  () => e && e.root ? V(e.root) : null,
1414
1412
  [e]
1415
1413
  ), O = W(
1416
1414
  () => Rt(n, s),
1417
1415
  [n, s]
1418
- ), ee = B(
1416
+ ), ee = F(
1419
1417
  (o) => St(o, a),
1420
1418
  [a]
1421
1419
  ), be = W(
1422
1420
  () => Nt(s),
1423
1421
  [s]
1424
1422
  ), J = W(
1425
- () => Ze(g, { allFields: O, valConfigs: s, data: i }),
1426
- [g, O, s, i]
1427
- ), $ = B((o) => {
1423
+ () => Ze(h, { allFields: O, valConfigs: s, data: i }),
1424
+ [h, O, s, i]
1425
+ ), $ = F((o) => {
1428
1426
  l(
1429
1427
  /** @param {any} [prev] @returns {any} */
1430
1428
  (p) => {
1431
- const S = p && typeof p == "object" ? p : {}, k = S.root ? V(S.root) : null, P = typeof o == "function" ? o(k) : o;
1429
+ const S = p && typeof p == "object" ? p : {}, A = S.root ? V(S.root) : null, P = typeof o == "function" ? o(A) : o;
1432
1430
  return { ...S, root: P };
1433
1431
  }
1434
1432
  );
1435
- }, [l]), te = W(() => zt(g), [g]), I = W(() => We(g), [g]), ce = W(
1433
+ }, [l]), te = W(() => zt(h), [h]), I = W(() => We(h), [h]), ce = W(
1436
1434
  () => jt(te, x),
1437
1435
  [te, x]
1438
1436
  );
@@ -1444,97 +1442,98 @@ function el({
1444
1442
  [te, x]
1445
1443
  );
1446
1444
  const le = W(() => {
1447
- if (!g || !x) return null;
1445
+ if (!h || !x) return null;
1448
1446
  if (x.type === "node") {
1449
- const o = ae(g, x.path);
1447
+ const o = ae(h, x.path);
1450
1448
  return o ? { type: "node", node: o } : null;
1451
1449
  }
1452
1450
  if (x.type === "branch") {
1453
- const o = Be(g, x.nodePath, x.branchIndex);
1451
+ const o = Fe(h, x.nodePath, x.branchIndex);
1454
1452
  return o ? { type: "branch", branch: o } : null;
1455
1453
  }
1456
1454
  return null;
1457
- }, [g, x]), $e = W(() => !K || !g ? null : Be(g, K.nodePath, K.branchIndex), [K, g]), Me = B((o) => {
1458
- if (!o || o.type !== "rowPath" || !g) return !1;
1459
- const p = Array.isArray(o.nodePath) ? o.nodePath : [], S = ae(g, p);
1455
+ }, [h, x]), $e = W(() => !K || !h ? null : Fe(h, K.nodePath, K.branchIndex), [K, h]), Me = F((o) => {
1456
+ if (!o || o.type !== "rowPath" || !h) return !1;
1457
+ const p = Array.isArray(o.nodePath) ? o.nodePath : [], S = ae(h, p);
1460
1458
  if (!S) return !1;
1461
- const k = Array.isArray(S.branches) ? S.branches : [], P = k.findIndex(
1459
+ const A = Array.isArray(S.branches) ? S.branches : [], P = A.findIndex(
1462
1460
  /** @param {any} [branch] @returns {any} */
1463
1461
  (de) => Xe(de, o.field, o.value)
1464
- ), z = P >= 0 ? k[P] : null, he = z && z.child ? z.child : S.defaultChild || Y(""), G = Q(o.label || o.value);
1465
- return A({
1462
+ ), z = P >= 0 ? A[P] : null, ge = z && z.child ? z.child : S.defaultChild || Y(""), G = Q(o.label || o.value);
1463
+ return k({
1466
1464
  request: o,
1467
1465
  nodePath: p,
1468
1466
  branchIndex: P,
1469
1467
  rowLabel: G,
1470
1468
  title: z && z.label ? z.label : G,
1471
- child: Oe(he) || Y(""),
1469
+ child: Oe(ge) || Y(""),
1472
1470
  selectedPath: [],
1473
1471
  childLevelNumber: Number.isFinite(Number(o.levelNumber)) ? Number(o.levelNumber) + 1 : 2
1474
1472
  }), w({ type: "node", path: p }), !0;
1475
- }, [g]);
1473
+ }, [h]);
1476
1474
  Ee(() => {
1477
- if (!g) {
1475
+ if (!h) {
1478
1476
  x !== null && w(null);
1479
1477
  return;
1480
1478
  }
1481
1479
  if (x) {
1482
1480
  if (x.type === "node") {
1483
- ae(g, x.path) || w({ type: "node", path: [] });
1481
+ ae(h, x.path) || w({ type: "node", path: [] });
1484
1482
  return;
1485
1483
  }
1486
- Be(g, x.nodePath, x.branchIndex) || w({ type: "node", path: x.nodePath });
1484
+ Fe(h, x.nodePath, x.branchIndex) || w({ type: "node", path: x.nodePath });
1487
1485
  }
1488
- }, [g, x]);
1489
- const ge = B(() => {
1486
+ }, [h, x]);
1487
+ const he = F(() => {
1490
1488
  const o = xe.current;
1491
1489
  !o || typeof o.scrollIntoView != "function" || window.requestAnimationFrame(() => {
1492
- o.scrollIntoView({ block: "start", behavior: "smooth" });
1490
+ const p = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
1491
+ o.scrollIntoView({ block: "start", behavior: p ? "auto" : "smooth" });
1493
1492
  });
1494
1493
  }, []);
1495
1494
  Ee(() => {
1496
- if (h && je.current !== h) {
1497
- if (je.current = h, se.current = !0, h.type === "rowPath") {
1498
- Me(h) || (se.current = !1);
1495
+ if (g && je.current !== g) {
1496
+ if (je.current = g, se.current = !0, g.type === "rowPath") {
1497
+ Me(g) || (se.current = !1);
1499
1498
  return;
1500
1499
  }
1501
- if (Z(h) === Z(x)) {
1502
- se.current = !1, ge();
1500
+ if (Z(g) === Z(x)) {
1501
+ se.current = !1, he();
1503
1502
  return;
1504
1503
  }
1505
- w(h);
1504
+ w(g);
1506
1505
  }
1507
- }, [Me, h, ge, x]), Ee(() => {
1508
- se.current && (se.current = !1, ge());
1509
- }, [ge, x]);
1510
- const He = B((o, p) => {
1506
+ }, [Me, g, he, x]), Ee(() => {
1507
+ se.current && (se.current = !1, he());
1508
+ }, [he, x]);
1509
+ const He = F((o, p) => {
1511
1510
  $(
1512
1511
  /** @param {any} [prevRoot] @returns {any} */
1513
1512
  (S) => _(S, o, () => p)
1514
1513
  );
1515
- }, [$]), Ve = B((o, p, S) => {
1514
+ }, [$]), Ve = F((o, p, S) => {
1516
1515
  $(
1517
1516
  /** @param {any} [prevRoot] @returns {any} */
1518
- (k) => me(k, o, p, () => S)
1517
+ (A) => me(A, o, p, () => S)
1519
1518
  );
1520
- }, [$]), dt = B((o) => {
1519
+ }, [$]), dt = F((o) => {
1521
1520
  const p = Y(o);
1522
- $(p), A(null), w({ type: "node", path: [] });
1521
+ $(p), k(null), w({ type: "node", path: [] });
1523
1522
  }, [$]);
1524
- B((o, p) => {
1523
+ F((o, p) => {
1525
1524
  p || $(
1526
1525
  /** @param {any} [prevRoot] @returns {any} */
1527
1526
  (S) => _(
1528
1527
  S,
1529
1528
  o,
1530
1529
  /** @param {any} [node] @returns {any} */
1531
- (k) => ({
1532
- ...k,
1530
+ (A) => ({
1531
+ ...A,
1533
1532
  defaultChild: Y("")
1534
1533
  })
1535
1534
  )
1536
1535
  ), w({ type: "node", path: [...o, T] });
1537
- }, [$]), B((o) => {
1536
+ }, [$]), F((o) => {
1538
1537
  $(
1539
1538
  /** @param {any} [prevRoot] @returns {any} */
1540
1539
  (p) => _(
@@ -1548,11 +1547,11 @@ function el({
1548
1547
  )
1549
1548
  ), w({ type: "node", path: o });
1550
1549
  }, [$]);
1551
- const pt = B((o, p, S) => {
1550
+ const pt = F((o, p, S) => {
1552
1551
  S || $(
1553
1552
  /** @param {any} [prevRoot] @returns {any} */
1554
- (k) => me(
1555
- k,
1553
+ (A) => me(
1554
+ A,
1556
1555
  o,
1557
1556
  p,
1558
1557
  /** @param {any} [branch] @returns {any} */
@@ -1562,7 +1561,7 @@ function el({
1562
1561
  })
1563
1562
  )
1564
1563
  ), w({ type: "node", path: [...o, _e(p)] });
1565
- }, [O, $]), ut = B((o, p) => {
1564
+ }, [O, $]), ut = F((o, p) => {
1566
1565
  $(
1567
1566
  /** @param {any} [prevRoot] @returns {any} */
1568
1567
  (S) => me(
@@ -1570,15 +1569,15 @@ function el({
1570
1569
  o,
1571
1570
  p,
1572
1571
  /** @param {any} [branch] @returns {any} */
1573
- (k) => ({
1574
- ...k,
1572
+ (A) => ({
1573
+ ...A,
1575
1574
  child: null
1576
1575
  })
1577
1576
  )
1578
1577
  ), w({ type: "branch", nodePath: o, branchIndex: p });
1579
- }, [$]), ft = B((o) => {
1578
+ }, [$]), ft = F((o) => {
1580
1579
  if (o.length === 0) {
1581
- $(null), A(null), w(null);
1580
+ $(null), k(null), w(null);
1582
1581
  return;
1583
1582
  }
1584
1583
  const p = o.slice(0, -1), S = o[o.length - 1];
@@ -1597,79 +1596,79 @@ function el({
1597
1596
  ), w({ type: "node", path: p });
1598
1597
  return;
1599
1598
  }
1600
- const k = Ce(S);
1601
- k >= 0 && ($(
1599
+ const A = Ce(S);
1600
+ A >= 0 && ($(
1602
1601
  /** @param {any} [prevRoot] @returns {any} */
1603
1602
  (P) => me(
1604
1603
  P,
1605
1604
  p,
1606
- k,
1605
+ A,
1607
1606
  /** @param {any} [branch] @returns {any} */
1608
1607
  (z) => ({
1609
1608
  ...z,
1610
1609
  child: null
1611
1610
  })
1612
1611
  )
1613
- ), w({ type: "branch", nodePath: p, branchIndex: k }));
1614
- }, [$]), yt = B((o, p) => {
1612
+ ), w({ type: "branch", nodePath: p, branchIndex: A }));
1613
+ }, [$]), yt = F((o, p) => {
1615
1614
  $(
1616
1615
  /** @param {any} [prevRoot] @returns {any} */
1617
1616
  (S) => _(
1618
1617
  S,
1619
1618
  o,
1620
1619
  /** @param {any} [node] @returns {any} */
1621
- (k) => ({
1622
- ...k,
1623
- branches: k.branches.filter(
1620
+ (A) => ({
1621
+ ...A,
1622
+ branches: A.branches.filter(
1624
1623
  /** @param {any} [_] @param {any} [index] @returns {any} */
1625
1624
  (P, z) => z !== p
1626
1625
  )
1627
1626
  })
1628
1627
  )
1629
1628
  ), w({ type: "node", path: o });
1630
- }, [$]), xt = B((o) => {
1631
- A(null), w({ type: "node", path: o });
1632
- }, []), qe = B((o) => {
1629
+ }, [$]), xt = F((o) => {
1630
+ k(null), w({ type: "node", path: o });
1631
+ }, []), qe = F((o) => {
1633
1632
  if (o) {
1634
- if (A(null), o.kind === "branch") {
1633
+ if (k(null), o.kind === "branch") {
1635
1634
  w({ type: "branch", nodePath: o.nodePath, branchIndex: o.branchIndex });
1636
1635
  return;
1637
1636
  }
1638
1637
  w({ type: "node", path: o.nodePath });
1639
1638
  }
1640
- }, []), bt = B(() => {
1641
- if (!g || !I.length) return;
1639
+ }, []), bt = F(() => {
1640
+ if (!h || !I.length) return;
1642
1641
  const o = I[I.length - 1];
1643
1642
  if (!o || !o.node || !o.node.field) return;
1644
1643
  const p = [...o.path, T];
1645
- A(null), $(
1644
+ k(null), $(
1646
1645
  /** @param {any} [prevRoot] @returns {any} */
1647
1646
  (S) => _(
1648
1647
  S,
1649
1648
  o.path,
1650
1649
  /** @param {any} [node] @returns {any} */
1651
- (k) => ({
1652
- ...k,
1653
- defaultChild: k.defaultChild || Y("")
1650
+ (A) => ({
1651
+ ...A,
1652
+ defaultChild: A.defaultChild || Y("")
1654
1653
  })
1655
1654
  )
1656
1655
  ), w({ type: "node", path: p });
1657
- }, [I, g, $]), gt = B((o, p) => {
1656
+ }, [I, h, $]), ht = F((o, p) => {
1658
1657
  o === null || o === p || ($(
1659
1658
  /** @param {any} [prevRoot] @returns {any} */
1660
1659
  (S) => nt(S, o, p)
1661
1660
  ), w({ type: "node", path: Ie(p) }), Te(null));
1662
- }, [$]), ht = B(() => {
1663
- A(null), w(null);
1664
- }, []), vt = B(() => {
1661
+ }, [$]), gt = F(() => {
1662
+ k(null), w(null);
1663
+ }, []), vt = F(() => {
1665
1664
  if (!J.valid) {
1666
1665
  c && c(J.errors[0] || "Fix report validation errors before applying.", "error");
1667
1666
  return;
1668
1667
  }
1669
1668
  w(null);
1670
- }, [J, c]), mt = B(() => {
1669
+ }, [J, c]), mt = F(() => {
1671
1670
  if (!d || !d.request) return;
1672
- const o = d.request, p = Array.isArray(d.nodePath) ? d.nodePath : [], S = Tt(d.child), k = {
1671
+ const o = d.request, p = Array.isArray(d.nodePath) ? d.nodePath : [], S = Tt(d.child), A = {
1673
1672
  ..._t(o.field, o.value, d.title || d.rowLabel, ""),
1674
1673
  label: Q(d.title || d.rowLabel || o.value),
1675
1674
  sourceRowPath: Array.isArray(o.pathValues) ? o.pathValues.map(String).filter(Boolean) : [],
@@ -1684,30 +1683,30 @@ function el({
1684
1683
  ...G,
1685
1684
  branches: de.map(
1686
1685
  /** @param {any} [branch] @param {any} [index] @returns {any} */
1687
- (ve, Et) => Et === Je ? { ...k, _id: ve._id || k._id } : ve
1686
+ (ve, Et) => Et === Je ? { ...A, _id: ve._id || A._id } : ve
1688
1687
  )
1689
1688
  } : {
1690
1689
  ...G,
1691
- branches: [...de, k]
1690
+ branches: [...de, A]
1692
1691
  };
1693
- }, z = _(g, p, P), he = Ze(z, { allFields: O, valConfigs: s, data: i });
1694
- if (!he.valid) {
1695
- c && c(he.errors[0] || "Fix report validation errors before applying.", "error");
1692
+ }, z = _(h, p, P), ge = Ze(z, { allFields: O, valConfigs: s, data: i });
1693
+ if (!ge.valid) {
1694
+ c && c(ge.errors[0] || "Fix report validation errors before applying.", "error");
1696
1695
  return;
1697
1696
  }
1698
1697
  $(
1699
1698
  /** @param {any} [prevRoot] @returns {any} */
1700
1699
  (G) => _(G, p, P)
1701
- ), A(null), w(null), c && c(`Applied settings for ${d.rowLabel || "row"}`, "info");
1702
- }, [O, i, g, d, $, c, s]), Ke = B(() => {
1703
- if (!g || !g.field) return;
1700
+ ), k(null), w(null), c && c(`Applied settings for ${d.rowLabel || "row"}`, "info");
1701
+ }, [O, i, h, d, $, c, s]), Ke = F(() => {
1702
+ if (!h || !h.field) return;
1704
1703
  if (!J.valid) {
1705
1704
  c && c(J.errors[0] || "Fix report validation errors before saving.", "error");
1706
1705
  return;
1707
1706
  }
1708
- const o = `report-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`, p = D.trim() || `Report ${(F || []).length + 1}`;
1707
+ const o = `report-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`, p = D.trim() || `Report ${(B || []).length + 1}`;
1709
1708
  N([
1710
- ...F || [],
1709
+ ...B || [],
1711
1710
  {
1712
1711
  id: o,
1713
1712
  name: p,
@@ -1716,15 +1715,15 @@ function el({
1716
1715
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
1717
1716
  }
1718
1717
  ]), C(o), R(""), c && c(`Report "${p}" saved`, "info");
1719
- }, [f, s, e, D, J, g, F, C, N, c]);
1720
- return /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "18px", padding: "2px 0 8px" } }, (F || []).length > 0 && /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(r) }, /* @__PURE__ */ t.createElement(m.Save, null), " Saved Reports"), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "6px" } }, (F || []).map(
1718
+ }, [f, s, e, D, J, h, B, C, N, c]);
1719
+ return /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "18px", padding: "2px 0 8px" } }, (B || []).length > 0 && /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(r) }, /* @__PURE__ */ t.createElement(m.Save, null), " Saved Reports"), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "6px" } }, (B || []).map(
1721
1720
  /** @param {any} [report] @returns {any} */
1722
1721
  (o) => /* @__PURE__ */ t.createElement(
1723
1722
  "div",
1724
1723
  {
1725
1724
  key: o.id,
1726
1725
  onClick: () => {
1727
- Ct(o, { setReportDef: l, setActiveReportId: C, setColFields: E, setValConfigs: b }), A(null), w({ type: "node", path: [] });
1726
+ Ct(o, { setReportDef: l, setActiveReportId: C, setColFields: E, setValConfigs: b }), k(null), w({ type: "node", path: [] });
1728
1727
  },
1729
1728
  style: {
1730
1729
  display: "flex",
@@ -1748,7 +1747,7 @@ function el({
1748
1747
  /** @param {any} [prev] @returns {any} */
1749
1748
  (S) => (S || []).filter(
1750
1749
  /** @param {any} [current] @returns {any} */
1751
- (k) => k.id !== o.id
1750
+ (A) => A.id !== o.id
1752
1751
  )
1753
1752
  ), y === o.id && C(null);
1754
1753
  },
@@ -1765,7 +1764,7 @@ function el({
1765
1764
  title: "Report Levels",
1766
1765
  description: "Default hierarchy applied to every row unless a row override changes its children.",
1767
1766
  icon: /* @__PURE__ */ t.createElement(m.ReportLevel, null),
1768
- action: g && /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap", justifyContent: "flex-end" } }, typeof u == "function" && /* @__PURE__ */ t.createElement(
1767
+ action: h && /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap", justifyContent: "flex-end" } }, typeof u == "function" && /* @__PURE__ */ t.createElement(
1769
1768
  "button",
1770
1769
  {
1771
1770
  type: "button",
@@ -1792,7 +1791,7 @@ function el({
1792
1791
  " Add next level"
1793
1792
  ))
1794
1793
  },
1795
- g ? /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, I.map(
1794
+ h ? /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, I.map(
1796
1795
  /** @param {any} [item] @returns {any} */
1797
1796
  (o) => /* @__PURE__ */ t.createElement(
1798
1797
  st,
@@ -1817,7 +1816,7 @@ function el({
1817
1816
  onDrop: (
1818
1817
  /** @param {any} [event] @returns {any} */
1819
1818
  ((p) => {
1820
- p.preventDefault(), gt(ct, o.index);
1819
+ p.preventDefault(), ht(ct, o.index);
1821
1820
  })
1822
1821
  )
1823
1822
  }
@@ -1839,7 +1838,7 @@ function el({
1839
1838
  (o) => /* @__PURE__ */ t.createElement("option", { key: o, value: o }, ee(o))
1840
1839
  )
1841
1840
  )))
1842
- ), g && /* @__PURE__ */ t.createElement(
1841
+ ), h && /* @__PURE__ */ t.createElement(
1843
1842
  ne,
1844
1843
  {
1845
1844
  theme: r,
@@ -1876,7 +1875,7 @@ function el({
1876
1875
  }
1877
1876
  )
1878
1877
  ))
1879
- ), g && d && /* @__PURE__ */ t.createElement("div", { ref: xe }, /* @__PURE__ */ t.createElement(
1878
+ ), h && d && /* @__PURE__ */ t.createElement("div", { ref: xe }, /* @__PURE__ */ t.createElement(
1880
1879
  ne,
1881
1880
  {
1882
1881
  theme: r,
@@ -1893,12 +1892,12 @@ function el({
1893
1892
  getFieldLabel: ee,
1894
1893
  sortByOptions: be,
1895
1894
  theme: r,
1896
- onChange: A,
1895
+ onChange: k,
1897
1896
  onApply: mt,
1898
- onCancel: ht
1897
+ onCancel: gt
1899
1898
  }
1900
1899
  )
1901
- )), g && !d && x && le && le.type === "node" && /* @__PURE__ */ t.createElement("div", { ref: xe }, /* @__PURE__ */ t.createElement(
1900
+ )), h && !d && x && le && le.type === "node" && /* @__PURE__ */ t.createElement("div", { ref: xe }, /* @__PURE__ */ t.createElement(
1902
1901
  ne,
1903
1902
  {
1904
1903
  theme: r,
@@ -1912,7 +1911,7 @@ function el({
1912
1911
  {
1913
1912
  item: I.find(
1914
1913
  /** @param {any} [item] @returns {any} */
1915
- (o) => Ae(o.path, x.path)
1914
+ (o) => ke(o.path, x.path)
1916
1915
  ) || (ce ? { ...ce, path: ce.nodePath } : { path: x.path, levelNumber: x.path.length + 1 }),
1917
1916
  node: le.node,
1918
1917
  allFields: O,
@@ -1929,7 +1928,7 @@ function el({
1929
1928
  titleLabel: "Title"
1930
1929
  }
1931
1930
  )
1932
- )), g && !d && x && le && le.type === "branch" && ce && /* @__PURE__ */ t.createElement("div", { ref: xe }, /* @__PURE__ */ t.createElement(
1931
+ )), h && !d && x && le && le.type === "branch" && ce && /* @__PURE__ */ t.createElement("div", { ref: xe }, /* @__PURE__ */ t.createElement(
1933
1932
  ne,
1934
1933
  {
1935
1934
  theme: r,
@@ -1980,7 +1979,7 @@ function el({
1980
1979
  {
1981
1980
  type: "button",
1982
1981
  onClick: Ke,
1983
- disabled: !g || !g.field || !J.valid,
1982
+ disabled: !h || !h.field || !J.valid,
1984
1983
  style: {
1985
1984
  display: "inline-flex",
1986
1985
  alignItems: "center",
@@ -1993,7 +1992,7 @@ function el({
1993
1992
  fontWeight: 800,
1994
1993
  color: "#fff",
1995
1994
  cursor: "pointer",
1996
- opacity: !g || !g.field || !J.valid ? 0.5 : 1
1995
+ opacity: !h || !h.field || !J.valid ? 0.5 : 1
1997
1996
  }
1998
1997
  },
1999
1998
  /* @__PURE__ */ t.createElement(m.Save, null),
@@ -2018,7 +2017,7 @@ function el({
2018
2017
  onClose: () => fe(null)
2019
2018
  }
2020
2019
  ), ie && (() => {
2021
- const o = ae(g, ie);
2020
+ const o = ae(h, ie);
2022
2021
  return o ? /* @__PURE__ */ t.createElement(
2023
2022
  Pe,
2024
2023
  {