@adoptai/genui-components 0.1.45 → 0.1.54

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 (56) hide show
  1. package/dist/builders/BlockForm.d.ts +31 -0
  2. package/dist/builders/BlockForm.d.ts.map +1 -0
  3. package/dist/builders/BuilderForm.d.ts +10 -2
  4. package/dist/builders/BuilderForm.d.ts.map +1 -1
  5. package/dist/builders/BuilderRecap.d.ts.map +1 -1
  6. package/dist/builders/ContextSlot.d.ts +6 -0
  7. package/dist/builders/ContextSlot.d.ts.map +1 -1
  8. package/dist/builders/FieldRenderer.d.ts +5 -2
  9. package/dist/builders/FieldRenderer.d.ts.map +1 -1
  10. package/dist/builders/StepperBuilder.d.ts +4 -2
  11. package/dist/builders/StepperBuilder.d.ts.map +1 -1
  12. package/dist/builders/fields.d.ts +22 -1
  13. package/dist/builders/fields.d.ts.map +1 -1
  14. package/dist/builders/hooks.d.ts +17 -0
  15. package/dist/builders/hooks.d.ts.map +1 -1
  16. package/dist/builders/index.d.ts +5 -5
  17. package/dist/builders/index.d.ts.map +1 -1
  18. package/dist/builders/resolver.d.ts +4 -1
  19. package/dist/builders/resolver.d.ts.map +1 -1
  20. package/dist/builders/schemas.d.ts +196 -1
  21. package/dist/builders/schemas.d.ts.map +1 -1
  22. package/dist/composites/journal-entry/resolver.cjs +2 -2
  23. package/dist/composites/journal-entry/resolver.cjs.map +1 -1
  24. package/dist/composites/journal-entry/resolver.js +2 -2
  25. package/dist/composites/journal-entry/resolver.js.map +1 -1
  26. package/dist/composites/workflow-stepper/resolver.cjs +2 -0
  27. package/dist/composites/workflow-stepper/resolver.cjs.map +1 -1
  28. package/dist/composites/workflow-stepper/resolver.d.ts.map +1 -1
  29. package/dist/composites/workflow-stepper/resolver.js +2 -0
  30. package/dist/composites/workflow-stepper/resolver.js.map +1 -1
  31. package/dist/index.cjs +1398 -780
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.js +1398 -780
  34. package/dist/index.js.map +1 -1
  35. package/dist/renderer.cjs +7 -5
  36. package/dist/renderer.cjs.map +1 -1
  37. package/dist/renderer.js +7 -5
  38. package/dist/renderer.js.map +1 -1
  39. package/dist/resolver.cjs +7 -5
  40. package/dist/resolver.cjs.map +1 -1
  41. package/dist/resolver.js +7 -5
  42. package/dist/resolver.js.map +1 -1
  43. package/dist/schemas/index.cjs +3 -3
  44. package/dist/schemas/index.cjs.map +1 -1
  45. package/dist/schemas/index.d.ts +1 -0
  46. package/dist/schemas/index.d.ts.map +1 -1
  47. package/dist/schemas/index.js +3 -3
  48. package/dist/schemas/index.js.map +1 -1
  49. package/dist/schemas/workflow-stepper.d.ts +1 -0
  50. package/dist/schemas/workflow-stepper.d.ts.map +1 -1
  51. package/dist/tool-definitions.json +4 -3
  52. package/package.json +2 -2
  53. package/dist/builders/EscalationCard.d.ts +0 -17
  54. package/dist/builders/EscalationCard.d.ts.map +0 -1
  55. package/dist/builders/FormBuilder.d.ts +0 -19
  56. package/dist/builders/FormBuilder.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -226,7 +226,7 @@ function alignFromSeparator(cell) {
226
226
  return "left";
227
227
  }
228
228
  function MarkdownBlock({ content }) {
229
- var _a;
229
+ var _a2;
230
230
  const lines = content.split("\n");
231
231
  const elements = [];
232
232
  let key = 0;
@@ -246,7 +246,7 @@ function MarkdownBlock({ content }) {
246
246
  3: { size: "12px", weight: 600, serif: false, mt: "12px" },
247
247
  4: { size: "11px", weight: 600, serif: false, mt: "10px" }
248
248
  };
249
- const s = (_a = cfg[level]) != null ? _a : cfg[3];
249
+ const s = (_a2 = cfg[level]) != null ? _a2 : cfg[3];
250
250
  elements.push(
251
251
  /* @__PURE__ */ jsx(
252
252
  "div",
@@ -367,8 +367,8 @@ function MarkdownBlock({ content }) {
367
367
  i++;
368
368
  }
369
369
  const colAlign = (idx) => {
370
- var _a2;
371
- return (_a2 = aligns[idx]) != null ? _a2 : "left";
370
+ var _a3;
371
+ return (_a3 = aligns[idx]) != null ? _a3 : "left";
372
372
  };
373
373
  elements.push(
374
374
  /* @__PURE__ */ jsx("div", { style: { margin: "6px 0 10px 0", overflowX: "auto" }, children: /* @__PURE__ */ jsxs(
@@ -401,7 +401,7 @@ function MarkdownBlock({ content }) {
401
401
  idx
402
402
  )) }) }),
403
403
  /* @__PURE__ */ jsx("tbody", { children: rows.map((cells, rIdx) => /* @__PURE__ */ jsx("tr", { children: headers.map((_, cIdx) => {
404
- var _a2;
404
+ var _a3;
405
405
  return /* @__PURE__ */ jsx(
406
406
  "td",
407
407
  {
@@ -412,7 +412,7 @@ function MarkdownBlock({ content }) {
412
412
  color: "var(--foreground)",
413
413
  verticalAlign: "top"
414
414
  },
415
- children: renderInline((_a2 = cells[cIdx]) != null ? _a2 : "")
415
+ children: renderInline((_a3 = cells[cIdx]) != null ? _a3 : "")
416
416
  },
417
417
  cIdx
418
418
  );
@@ -487,7 +487,7 @@ function splitEdge(line) {
487
487
  return null;
488
488
  }
489
489
  function parseMermaidFlow(source) {
490
- var _a, _b, _c;
490
+ var _a2, _b, _c;
491
491
  const lines = source.split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("%%"));
492
492
  if (!lines.length) return null;
493
493
  const header = lines[0].toLowerCase();
@@ -499,7 +499,7 @@ function parseMermaidFlow(source) {
499
499
  rl: "RL",
500
500
  bt: "BT"
501
501
  };
502
- const dirToken = (_b = (_a = header.split(/\s+/)[1]) == null ? void 0 : _a.toLowerCase()) != null ? _b : "td";
502
+ const dirToken = (_b = (_a2 = header.split(/\s+/)[1]) == null ? void 0 : _a2.toLowerCase()) != null ? _b : "td";
503
503
  const direction = (_c = directionMap[dirToken]) != null ? _c : "TB";
504
504
  const nodeMap = /* @__PURE__ */ new Map();
505
505
  const edges = [];
@@ -742,51 +742,51 @@ function DoneBadge() {
742
742
  return /* @__PURE__ */ jsx("span", { className: "gx-done-badge", "aria-hidden": "true", children: /* @__PURE__ */ jsx("svg", { width: "9", height: "9", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "4", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" }) }) });
743
743
  }
744
744
  function RectNode({ data }) {
745
- var _a;
745
+ var _a2;
746
746
  const s = data.status;
747
747
  return /* @__PURE__ */ jsxs("div", { className: nodeClass(s), style: __spreadProps(__spreadValues({}, nodeBase), { borderRadius: "6px" }), children: [
748
748
  /* @__PURE__ */ jsx(Handles, { dir: data.direction }),
749
749
  s === "done" && /* @__PURE__ */ jsx(DoneBadge, {}),
750
- String((_a = data.label) != null ? _a : "")
750
+ String((_a2 = data.label) != null ? _a2 : "")
751
751
  ] });
752
752
  }
753
753
  function RoundedNode({ data }) {
754
- var _a;
754
+ var _a2;
755
755
  const s = data.status;
756
756
  return /* @__PURE__ */ jsxs("div", { className: nodeClass(s), style: __spreadProps(__spreadValues({}, nodeBase), { borderRadius: "999px" }), children: [
757
757
  /* @__PURE__ */ jsx(Handles, { dir: data.direction }),
758
758
  s === "done" && /* @__PURE__ */ jsx(DoneBadge, {}),
759
- String((_a = data.label) != null ? _a : "")
759
+ String((_a2 = data.label) != null ? _a2 : "")
760
760
  ] });
761
761
  }
762
762
  function CircleNode({ data }) {
763
- var _a;
763
+ var _a2;
764
764
  const s = data.status;
765
765
  return /* @__PURE__ */ jsxs("div", { className: nodeClass(s), style: __spreadProps(__spreadValues({}, nodeBase), { borderRadius: "50%", padding: "6px" }), children: [
766
766
  /* @__PURE__ */ jsx(Handles, { dir: data.direction }),
767
767
  s === "done" && /* @__PURE__ */ jsx(DoneBadge, {}),
768
- String((_a = data.label) != null ? _a : "")
768
+ String((_a2 = data.label) != null ? _a2 : "")
769
769
  ] });
770
770
  }
771
771
  function DiamondNode({ data }) {
772
- var _a;
772
+ var _a2;
773
773
  const s = data.status;
774
774
  return /* @__PURE__ */ jsxs("div", { className: nodeClass(s), style: { position: "relative", width: "100%", height: "100%", display: "flex", alignItems: "center", justifyContent: "center", border: "none", background: "transparent" }, children: [
775
775
  /* @__PURE__ */ jsx(Handles, { dir: data.direction }),
776
776
  s === "done" && /* @__PURE__ */ jsx(DoneBadge, {}),
777
777
  /* @__PURE__ */ jsx("svg", { style: { position: "absolute", inset: 0, width: "100%", height: "100%", overflow: "visible" }, viewBox: "0 0 1 1", preserveAspectRatio: "none", children: /* @__PURE__ */ jsx("polygon", { className: "gx-flow-poly", points: "0.5,0.03 0.97,0.5 0.5,0.97 0.03,0.5", fill: "var(--gx-bg)", stroke: "var(--gx-outline)", strokeWidth: "1.5", vectorEffect: "non-scaling-stroke" }) }),
778
- /* @__PURE__ */ jsx("span", { style: { position: "relative", zIndex: 1, fontFamily: "var(--gx-font)", fontSize: "11px", fontWeight: 500, color: "var(--gx-text)", textAlign: "center", lineHeight: 1.25, userSelect: "none", padding: "0 22px", maxWidth: "100%" }, children: String((_a = data.label) != null ? _a : "") })
778
+ /* @__PURE__ */ jsx("span", { style: { position: "relative", zIndex: 1, fontFamily: "var(--gx-font)", fontSize: "11px", fontWeight: 500, color: "var(--gx-text)", textAlign: "center", lineHeight: 1.25, userSelect: "none", padding: "0 22px", maxWidth: "100%" }, children: String((_a2 = data.label) != null ? _a2 : "") })
779
779
  ] });
780
780
  }
781
781
  function CylinderNode({ data }) {
782
- var _a;
782
+ var _a2;
783
783
  const a = 5;
784
784
  const s = data.status;
785
785
  return /* @__PURE__ */ jsxs("div", { className: nodeClass(s), style: { position: "relative", width: "100%", height: "100%", border: "none", background: "transparent" }, children: [
786
786
  /* @__PURE__ */ jsx(Handles, { dir: data.direction }),
787
787
  s === "done" && /* @__PURE__ */ jsx(DoneBadge, {}),
788
788
  /* @__PURE__ */ jsx("div", { style: { position: "absolute", top: 0, left: 0, right: 0, height: a * 2, border: "1.5px solid var(--gx-outline)", borderRadius: "50%", background: "var(--gx-bg)", zIndex: 1 } }),
789
- /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: `${a}px 0`, border: "1.5px solid var(--gx-outline)", borderTop: "none", borderBottom: "none", background: "var(--gx-bg)", display: "flex", alignItems: "center", justifyContent: "center", fontFamily: "var(--gx-font)", fontSize: "12px", fontWeight: 500, color: "var(--gx-text)" }, children: String((_a = data.label) != null ? _a : "") }),
789
+ /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: `${a}px 0`, border: "1.5px solid var(--gx-outline)", borderTop: "none", borderBottom: "none", background: "var(--gx-bg)", display: "flex", alignItems: "center", justifyContent: "center", fontFamily: "var(--gx-font)", fontSize: "12px", fontWeight: 500, color: "var(--gx-text)" }, children: String((_a2 = data.label) != null ? _a2 : "") }),
790
790
  /* @__PURE__ */ jsx("div", { style: { position: "absolute", bottom: 0, left: 0, right: 0, height: a * 2, border: "1.5px solid var(--gx-outline)", borderRadius: "50%", background: "var(--gx-bg)", zIndex: 1 } })
791
791
  ] });
792
792
  }
@@ -924,31 +924,31 @@ function FullscreenModal({ nodes, edges, title, onClose }) {
924
924
  function usePrefersReducedMotion() {
925
925
  const [reduced, setReduced] = useState(false);
926
926
  useEffect(() => {
927
- var _a;
927
+ var _a2;
928
928
  if (typeof matchMedia === "undefined") return;
929
929
  const mq = matchMedia("(prefers-reduced-motion: reduce)");
930
930
  setReduced(mq.matches);
931
931
  const h = () => setReduced(mq.matches);
932
- (_a = mq.addEventListener) == null ? void 0 : _a.call(mq, "change", h);
932
+ (_a2 = mq.addEventListener) == null ? void 0 : _a2.call(mq, "change", h);
933
933
  return () => {
934
- var _a2;
935
- return (_a2 = mq.removeEventListener) == null ? void 0 : _a2.call(mq, "change", h);
934
+ var _a3;
935
+ return (_a3 = mq.removeEventListener) == null ? void 0 : _a3.call(mq, "change", h);
936
936
  };
937
937
  }, []);
938
938
  return reduced;
939
939
  }
940
940
  function topoOrder(nodeIds, edges) {
941
- var _a, _b, _c, _d;
941
+ var _a2, _b, _c, _d;
942
942
  const indeg = new Map(nodeIds.map((id) => [id, 0]));
943
943
  const adj = new Map(nodeIds.map((id) => [id, []]));
944
944
  for (const e of edges) {
945
945
  if (!indeg.has(e.target) || !adj.has(e.source)) continue;
946
- indeg.set(e.target, ((_a = indeg.get(e.target)) != null ? _a : 0) + 1);
946
+ indeg.set(e.target, ((_a2 = indeg.get(e.target)) != null ? _a2 : 0) + 1);
947
947
  adj.get(e.source).push(e.target);
948
948
  }
949
949
  const queue = nodeIds.filter((id) => {
950
- var _a2;
951
- return ((_a2 = indeg.get(id)) != null ? _a2 : 0) === 0;
950
+ var _a3;
951
+ return ((_a3 = indeg.get(id)) != null ? _a3 : 0) === 0;
952
952
  });
953
953
  const seen = /* @__PURE__ */ new Set();
954
954
  const order = [];
@@ -1001,11 +1001,11 @@ function useAutoplay(order, enabled) {
1001
1001
  }, [order, step]);
1002
1002
  }
1003
1003
  function resolveStates(nodes, nodeStates) {
1004
- var _a, _b;
1004
+ var _a2, _b;
1005
1005
  if (!nodeStates) return {};
1006
1006
  const m = {};
1007
1007
  for (const n of nodes) {
1008
- const label = (_a = n.data) == null ? void 0 : _a.label;
1008
+ const label = (_a2 = n.data) == null ? void 0 : _a2.label;
1009
1009
  const st = (_b = nodeStates[n.id]) != null ? _b : label ? nodeStates[label] : void 0;
1010
1010
  if (st) m[n.id] = st;
1011
1011
  }
@@ -1021,8 +1021,8 @@ function Inner({ diagram, title, autoplay, nodeStates }) {
1021
1021
  const layout = useMemo(() => parsed ? computeLayout(parsed) : null, [parsed]);
1022
1022
  const themedEdges = useMemo(
1023
1023
  () => {
1024
- var _a;
1025
- return ((_a = layout == null ? void 0 : layout.edges) != null ? _a : []).map((e) => __spreadProps(__spreadValues({}, e), {
1024
+ var _a2;
1025
+ return ((_a2 = layout == null ? void 0 : layout.edges) != null ? _a2 : []).map((e) => __spreadProps(__spreadValues({}, e), {
1026
1026
  style: __spreadProps(__spreadValues({}, e.style), { stroke: tokens.ACCENT, strokeWidth: 1.75 }),
1027
1027
  labelStyle: { fill: tokens.MUTED, fontSize: 10, fontFamily: "var(--font-sans, Figtree, system-ui, sans-serif)" },
1028
1028
  labelBgStyle: { fill: "#ffffff", fillOpacity: 0.92 },
@@ -1033,21 +1033,21 @@ function Inner({ diagram, title, autoplay, nodeStates }) {
1033
1033
  );
1034
1034
  const order = useMemo(
1035
1035
  () => {
1036
- var _a, _b;
1037
- return topoOrder(((_a = layout == null ? void 0 : layout.nodes) != null ? _a : []).map((n) => n.id), (_b = layout == null ? void 0 : layout.edges) != null ? _b : []);
1036
+ var _a2, _b;
1037
+ return topoOrder(((_a2 = layout == null ? void 0 : layout.nodes) != null ? _a2 : []).map((n) => n.id), (_b = layout == null ? void 0 : layout.edges) != null ? _b : []);
1038
1038
  },
1039
1039
  [layout]
1040
1040
  );
1041
1041
  const autoStatus = useAutoplay(order, !!autoplay);
1042
1042
  const staticStatus = useMemo(() => {
1043
- var _a;
1044
- return resolveStates((_a = layout == null ? void 0 : layout.nodes) != null ? _a : [], nodeStates);
1043
+ var _a2;
1044
+ return resolveStates((_a2 = layout == null ? void 0 : layout.nodes) != null ? _a2 : [], nodeStates);
1045
1045
  }, [layout, nodeStates]);
1046
1046
  const statusMap = autoplay ? autoStatus : staticStatus;
1047
1047
  const displayNodes = useMemo(
1048
1048
  () => {
1049
- var _a;
1050
- return ((_a = layout == null ? void 0 : layout.nodes) != null ? _a : []).map((n) => __spreadProps(__spreadValues({}, n), { data: __spreadProps(__spreadValues({}, n.data), { status: statusMap[n.id] }) }));
1049
+ var _a2;
1050
+ return ((_a2 = layout == null ? void 0 : layout.nodes) != null ? _a2 : []).map((n) => __spreadProps(__spreadValues({}, n), { data: __spreadProps(__spreadValues({}, n.data), { status: statusMap[n.id] }) }));
1051
1051
  },
1052
1052
  [layout, statusMap]
1053
1053
  );
@@ -1263,8 +1263,8 @@ function PdfViewer({ url, base64, onLoadSuccess }) {
1263
1263
  useEffect(() => {
1264
1264
  if (numPages <= 1) return;
1265
1265
  const handler = (e) => {
1266
- var _a;
1267
- const tag = (_a = e.target) == null ? void 0 : _a.tagName;
1266
+ var _a2;
1267
+ const tag = (_a2 = e.target) == null ? void 0 : _a2.tagName;
1268
1268
  if (tag === "INPUT" || tag === "TEXTAREA") return;
1269
1269
  if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
1270
1270
  e.preventDefault();
@@ -1423,8 +1423,8 @@ function ExcelViewer({ url, base64, onLoadSuccess }) {
1423
1423
  useEffect(() => {
1424
1424
  if (sheetNames.length <= 1) return;
1425
1425
  const handler = (e) => {
1426
- var _a;
1427
- const tag = (_a = e.target) == null ? void 0 : _a.tagName;
1426
+ var _a2;
1427
+ const tag = (_a2 = e.target) == null ? void 0 : _a2.tagName;
1428
1428
  if (tag === "INPUT" || tag === "TEXTAREA") return;
1429
1429
  if (e.key === "ArrowLeft") {
1430
1430
  e.preventDefault();
@@ -1478,8 +1478,8 @@ function ExcelViewer({ url, base64, onLoadSuccess }) {
1478
1478
  name
1479
1479
  )) }),
1480
1480
  /* @__PURE__ */ jsx("div", { style: { overflow: "auto", maxHeight: "500px" }, children: /* @__PURE__ */ jsx("table", { style: { width: "100%", borderCollapse: "collapse", fontSize: "12px" }, children: /* @__PURE__ */ jsx("tbody", { children: data.map((row, ri) => /* @__PURE__ */ jsx("tr", { children: row.map((cell, ci) => {
1481
- var _a, _b;
1482
- const isHeader = ri === 0 || ri === 2 && ((_a = data[0]) == null ? void 0 : _a[0]) && !((_b = data[1]) == null ? void 0 : _b[0]);
1481
+ var _a2, _b;
1482
+ const isHeader = ri === 0 || ri === 2 && ((_a2 = data[0]) == null ? void 0 : _a2[0]) && !((_b = data[1]) == null ? void 0 : _b[0]);
1483
1483
  const Tag = isHeader ? "th" : "td";
1484
1484
  return /* @__PURE__ */ jsx(
1485
1485
  Tag,
@@ -1626,8 +1626,8 @@ function CsvViewer({ url, base64, delimiter, maxRows }) {
1626
1626
  i
1627
1627
  )) }) }),
1628
1628
  /* @__PURE__ */ jsx("tbody", { children: shown.map((row, ri) => /* @__PURE__ */ jsx("tr", { children: header.map((_, ci) => {
1629
- var _a;
1630
- const cell = (_a = row[ci]) != null ? _a : "";
1629
+ var _a2;
1630
+ const cell = (_a2 = row[ci]) != null ? _a2 : "";
1631
1631
  return /* @__PURE__ */ jsx(
1632
1632
  "td",
1633
1633
  {
@@ -1934,12 +1934,12 @@ var statusCardSchema = z.object({
1934
1934
  z.object({
1935
1935
  label: z.string(),
1936
1936
  variant: z.string().transform((v) => {
1937
- var _a;
1938
- return (_a = variantMap[v]) != null ? _a : "bordered";
1937
+ var _a2;
1938
+ return (_a2 = variantMap[v]) != null ? _a2 : "bordered";
1939
1939
  }).default("bordered"),
1940
1940
  color: z.string().transform((v) => {
1941
- var _a;
1942
- return (_a = colorMap[v]) != null ? _a : "default";
1941
+ var _a2;
1942
+ return (_a2 = colorMap[v]) != null ? _a2 : "default";
1943
1943
  }).default("default")
1944
1944
  })
1945
1945
  ).max(3).optional()
@@ -2231,9 +2231,9 @@ var groupedTableSchema = z.object({
2231
2231
  key: z.string(),
2232
2232
  label: z.string(),
2233
2233
  align: z.string().transform((v) => {
2234
- var _a;
2234
+ var _a2;
2235
2235
  const map = { left: "start", right: "end", start: "start", center: "center", end: "end" };
2236
- return (_a = map[v]) != null ? _a : "start";
2236
+ return (_a2 = map[v]) != null ? _a2 : "start";
2237
2237
  }).default("start")
2238
2238
  })).min(1).max(10),
2239
2239
  groups: z.array(groupSchema).min(1).max(20)
@@ -4725,8 +4725,8 @@ var comboChartSchema = z.object({
4725
4725
  lines: z.array(seriesRef).max(4).optional(),
4726
4726
  data: z.array(z.record(z.string(), z.union([z.string(), z.number()]))).min(2).max(500)
4727
4727
  }).refine((v) => {
4728
- var _a, _b, _c, _d;
4729
- return ((_b = (_a = v.bars) == null ? void 0 : _a.length) != null ? _b : 0) + ((_d = (_c = v.lines) == null ? void 0 : _c.length) != null ? _d : 0) >= 1;
4728
+ var _a2, _b, _c, _d;
4729
+ return ((_b = (_a2 = v.bars) == null ? void 0 : _a2.length) != null ? _b : 0) + ((_d = (_c = v.lines) == null ? void 0 : _c.length) != null ? _d : 0) >= 1;
4730
4730
  }, {
4731
4731
  message: "combo-chart needs at least one bar or line series"
4732
4732
  });
@@ -5227,7 +5227,7 @@ var workflowStepperSchema = z.object({
5227
5227
  n: z.number().int().positive().optional(),
5228
5228
  title: z.string(),
5229
5229
  sub: z.string().optional(),
5230
- status: z.enum(["done", "active", "review", "pending", "failed"]),
5230
+ status: z.enum(["done", "active", "review", "pending", "blocked", "failed"]),
5231
5231
  assignees: z.array(
5232
5232
  z.object({
5233
5233
  name: z.string(),
@@ -5242,7 +5242,7 @@ var workflowStepperSchema = z.object({
5242
5242
  });
5243
5243
  var workflowStepperTool = {
5244
5244
  name: "render_workflow_stepper",
5245
- description: "Render a recurring-process workflow stepper \u2014 a horizontal strip of sequential step cards (e.g. a monthly close pipeline) with per-step status (done/active/review/pending/failed) and human + agent assignee avatars. Use for org processes with named steps and owners, NOT for generic progress bars or project phase summaries.",
5245
+ description: "Render a recurring-process workflow stepper \u2014 a horizontal strip of sequential step cards (e.g. a monthly close pipeline) with per-step status (done/active/review/pending/blocked/failed) and human + agent assignee avatars. Use for org processes with named steps and owners, NOT for generic progress bars or project phase summaries.",
5246
5246
  input_schema: {
5247
5247
  type: "object",
5248
5248
  properties: {
@@ -5263,7 +5263,7 @@ var workflowStepperTool = {
5263
5263
  n: { type: "number", description: "Step number; defaults to index + 1" },
5264
5264
  title: { type: "string" },
5265
5265
  sub: { type: "string", description: "Short status caption, e.g. '7 accounts \xB7 2 exceptions'" },
5266
- status: { type: "string", enum: ["done", "active", "review", "pending", "failed"] },
5266
+ status: { type: "string", enum: ["done", "active", "review", "pending", "blocked", "failed"] },
5267
5267
  assignees: {
5268
5268
  type: "array",
5269
5269
  maxItems: 6,
@@ -5303,12 +5303,12 @@ function buildRenderUITool(selectedSchemas) {
5303
5303
 
5304
5304
  // src/schemas/coercePayload.ts
5305
5305
  function coercePayload(data) {
5306
- var _a, _b, _c;
5306
+ var _a2, _b, _c;
5307
5307
  if (!data || typeof data !== "object" || Array.isArray(data)) return data;
5308
5308
  const obj = data;
5309
5309
  const type = obj.type;
5310
5310
  if (typeof type !== "string" || !(type in schemaRegistry)) return data;
5311
- const props = (_c = (_b = (_a = schemaRegistry[type]) == null ? void 0 : _a.tool) == null ? void 0 : _b.input_schema) == null ? void 0 : _c.properties;
5311
+ const props = (_c = (_b = (_a2 = schemaRegistry[type]) == null ? void 0 : _a2.tool) == null ? void 0 : _b.input_schema) == null ? void 0 : _c.properties;
5312
5312
  if (!props || typeof props !== "object") return data;
5313
5313
  let out = null;
5314
5314
  for (const [key, propSchema] of Object.entries(props)) {
@@ -5469,8 +5469,8 @@ function ComponentActions({ children, onDownloadCSV, columnConfig, filename = "c
5469
5469
  useEffect(() => {
5470
5470
  if (!open) return;
5471
5471
  const handler = (e) => {
5472
- var _a, _b;
5473
- if ((_a = menuRef.current) == null ? void 0 : _a.contains(e.target)) return;
5472
+ var _a2, _b;
5473
+ if ((_a2 = menuRef.current) == null ? void 0 : _a2.contains(e.target)) return;
5474
5474
  if ((_b = btnRef.current) == null ? void 0 : _b.contains(e.target)) return;
5475
5475
  close();
5476
5476
  };
@@ -5669,9 +5669,9 @@ var td = (align, last) => ({
5669
5669
  whiteSpace: align === "end" || align === "center" ? "nowrap" : "normal"
5670
5670
  });
5671
5671
  function DataTableResolver(p) {
5672
- var _a, _b, _c;
5672
+ var _a2, _b, _c;
5673
5673
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
5674
- const columns = (_a = p.columns) != null ? _a : [];
5674
+ const columns = (_a2 = p.columns) != null ? _a2 : [];
5675
5675
  const rows = (_b = p.rows) != null ? _b : [];
5676
5676
  const { visibleColumns, hidden, toggle, showAll, hideAll, allColumns } = useColumnVisibility(columns);
5677
5677
  return /* @__PURE__ */ jsx(
@@ -5679,8 +5679,8 @@ function DataTableResolver(p) {
5679
5679
  {
5680
5680
  filename: (_c = p.title) != null ? _c : "data-table",
5681
5681
  onDownloadCSV: () => {
5682
- var _a2;
5683
- return downloadCSV(visibleColumns, rows, (_a2 = p.title) != null ? _a2 : "data-table");
5682
+ var _a3;
5683
+ return downloadCSV(visibleColumns, rows, (_a3 = p.title) != null ? _a3 : "data-table");
5684
5684
  },
5685
5685
  columnConfig: { columns: allColumns, hidden, onToggle: toggle, onShowAll: showAll, onHideAll: hideAll },
5686
5686
  children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
@@ -5688,8 +5688,8 @@ function DataTableResolver(p) {
5688
5688
  /* @__PURE__ */ jsx("div", { style: { overflowX: "auto", borderRadius: "0.75rem", border: `1px solid ${BORDER4}`, boxShadow: "0 1px 2px rgba(0,0,0,0.03), 0 4px 12px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ jsxs("table", { style: { width: "100%", borderCollapse: "collapse" }, children: [
5689
5689
  /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: visibleColumns.map((col) => /* @__PURE__ */ jsx("th", { style: th(col.align), children: col.label }, col.key)) }) }),
5690
5690
  /* @__PURE__ */ jsx("tbody", { children: rows.map((row, ri) => /* @__PURE__ */ jsx("tr", { style: { background: ri % 2 === 0 ? "white" : "#fafafa" }, children: visibleColumns.map((col) => {
5691
- var _a2;
5692
- return /* @__PURE__ */ jsx("td", { style: td(col.align, ri === rows.length - 1), children: String((_a2 = row[col.key]) != null ? _a2 : "\u2014") }, col.key);
5691
+ var _a3;
5692
+ return /* @__PURE__ */ jsx("td", { style: td(col.align, ri === rows.length - 1), children: String((_a3 = row[col.key]) != null ? _a3 : "\u2014") }, col.key);
5693
5693
  }) }, ri)) })
5694
5694
  ] }) })
5695
5695
  ] })
@@ -5740,9 +5740,9 @@ var S = {
5740
5740
  label: { fontSize: "12px", color: MUTED, flexShrink: 0 }
5741
5741
  };
5742
5742
  function StatusCardResolver(p) {
5743
- var _a, _b, _c, _d, _e;
5743
+ var _a2, _b, _c, _d, _e;
5744
5744
  const { ACCENT: ACCENT2, MUTED: MUTED2 } = useTheme();
5745
- const status = (_a = p.status) != null ? _a : "default";
5745
+ const status = (_a2 = p.status) != null ? _a2 : "default";
5746
5746
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "status-card", children: /* @__PURE__ */ jsxs("div", { style: S.card, children: [
5747
5747
  /* @__PURE__ */ jsxs("div", { style: S.header, children: [
5748
5748
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", flexWrap: "wrap" }, children: [
@@ -5765,8 +5765,8 @@ function StatusCardResolver(p) {
5765
5765
  p.subtitle && /* @__PURE__ */ jsx("p", { style: S.subtitle, children: /* @__PURE__ */ jsx(Markdown, { inline: true, content: p.subtitle }) })
5766
5766
  ] }),
5767
5767
  /* @__PURE__ */ jsx("div", { style: S.content, children: /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, children: ((_c = p.fields) != null ? _c : []).map((field, i) => {
5768
- var _a2;
5769
- return /* @__PURE__ */ jsxs("div", { style: __spreadValues(__spreadValues({}, S.fieldRow), i === ((_a2 = p.fields) != null ? _a2 : []).length - 1 ? { borderBottom: "none" } : {}), children: [
5768
+ var _a3;
5769
+ return /* @__PURE__ */ jsxs("div", { style: __spreadValues(__spreadValues({}, S.fieldRow), i === ((_a3 = p.fields) != null ? _a3 : []).length - 1 ? { borderBottom: "none" } : {}), children: [
5770
5770
  /* @__PURE__ */ jsx("span", { style: S.label, children: field.label }),
5771
5771
  /* @__PURE__ */ jsx("span", { style: {
5772
5772
  fontSize: "13px",
@@ -5819,8 +5819,8 @@ var statusStyles = {
5819
5819
  default: { border: "#dedede", bg: "#f6f6f6", icon: "\u2139" }
5820
5820
  };
5821
5821
  function AlertResolver(p) {
5822
- var _a, _b;
5823
- const status = toAlertStatus((_a = p.color) != null ? _a : "default");
5822
+ var _a2, _b;
5823
+ const status = toAlertStatus((_a2 = p.color) != null ? _a2 : "default");
5824
5824
  const s = statusStyles[status];
5825
5825
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "alert", children: /* @__PURE__ */ jsx("div", { style: { width: "100%" }, children: /* @__PURE__ */ jsxs(
5826
5826
  "div",
@@ -5937,9 +5937,9 @@ var cardStyle = {
5937
5937
  overflow: "hidden"
5938
5938
  };
5939
5939
  function StatGridResolver(p) {
5940
- var _a;
5940
+ var _a2;
5941
5941
  const { MUTED: MUTED2 } = useTheme();
5942
- return /* @__PURE__ */ jsx(ComponentActions, { filename: "stat-grid", children: /* @__PURE__ */ jsx("div", { style: { width: "100%", display: "grid", gap: "10px", gridTemplateColumns: "repeat(auto-fill, minmax(min(140px, 100%), 1fr))" }, children: ((_a = p.stats) != null ? _a : []).map((stat, i) => /* @__PURE__ */ jsx("div", { style: cardStyle, children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "4px", padding: "4px 0", minWidth: 0 }, children: [
5942
+ return /* @__PURE__ */ jsx(ComponentActions, { filename: "stat-grid", children: /* @__PURE__ */ jsx("div", { style: { width: "100%", display: "grid", gap: "10px", gridTemplateColumns: "repeat(auto-fill, minmax(min(140px, 100%), 1fr))" }, children: ((_a2 = p.stats) != null ? _a2 : []).map((stat, i) => /* @__PURE__ */ jsx("div", { style: cardStyle, children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "4px", padding: "4px 0", minWidth: 0 }, children: [
5943
5943
  /* @__PURE__ */ jsx("p", { style: __spreadValues({ fontSize: "11.5px", color: MUTED2, letterSpacing: "0.02em", textTransform: "uppercase", margin: 0 }, TRUNCATE), children: stat.label }),
5944
5944
  /* @__PURE__ */ jsx(
5945
5945
  FitText,
@@ -5958,7 +5958,7 @@ function StatGridResolver(p) {
5958
5958
  init_Markdown();
5959
5959
  init_ThemeContext();
5960
5960
  function TabsPanelResolver(p) {
5961
- var _a;
5961
+ var _a2;
5962
5962
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2 } = useTheme();
5963
5963
  const [activeIdx, setActiveIdx] = useState(0);
5964
5964
  const activeTab = p.tabs[activeIdx];
@@ -5977,8 +5977,8 @@ function TabsPanelResolver(p) {
5977
5977
  borderRight: `1px solid ${BORDER4}`,
5978
5978
  borderBottom: `1px solid ${BORDER4}`
5979
5979
  },
5980
- children: ((_a = p.tabs) != null ? _a : []).map((tab, i) => {
5981
- var _a2;
5980
+ children: ((_a2 = p.tabs) != null ? _a2 : []).map((tab, i) => {
5981
+ var _a3;
5982
5982
  const isActive = i === activeIdx;
5983
5983
  return /* @__PURE__ */ jsxs(
5984
5984
  "button",
@@ -5999,7 +5999,7 @@ function TabsPanelResolver(p) {
5999
5999
  color: isActive ? "var(--foreground)" : MUTED2,
6000
6000
  position: "relative",
6001
6001
  transition: "all 0.15s ease",
6002
- borderRadius: i === 0 ? "8px 0 0 0" : i === ((_a2 = p.tabs) != null ? _a2 : []).length - 1 ? "0 8px 0 0" : "0"
6002
+ borderRadius: i === 0 ? "8px 0 0 0" : i === ((_a3 = p.tabs) != null ? _a3 : []).length - 1 ? "0 8px 0 0" : "0"
6003
6003
  },
6004
6004
  children: [
6005
6005
  isActive && /* @__PURE__ */ jsx(
@@ -6073,16 +6073,16 @@ var thStyle = {
6073
6073
  whiteSpace: "nowrap"
6074
6074
  };
6075
6075
  function SparklineTableResolver(p) {
6076
- var _a, _b, _c;
6076
+ var _a2, _b, _c;
6077
6077
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
6078
- const { visibleColumns, hidden, toggle, showAll, hideAll, allColumns } = useColumnVisibility((_a = p.columns) != null ? _a : []);
6078
+ const { visibleColumns, hidden, toggle, showAll, hideAll, allColumns } = useColumnVisibility((_a2 = p.columns) != null ? _a2 : []);
6079
6079
  return /* @__PURE__ */ jsx(
6080
6080
  ComponentActions,
6081
6081
  {
6082
6082
  filename: (_b = p.title) != null ? _b : "sparkline-table",
6083
6083
  onDownloadCSV: () => {
6084
- var _a2;
6085
- return downloadCSV(visibleColumns, p.rows, (_a2 = p.title) != null ? _a2 : "sparkline-table");
6084
+ var _a3;
6085
+ return downloadCSV(visibleColumns, p.rows, (_a3 = p.title) != null ? _a3 : "sparkline-table");
6086
6086
  },
6087
6087
  columnConfig: { columns: allColumns, hidden, onToggle: toggle, onShowAll: showAll, onHideAll: hideAll },
6088
6088
  children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
@@ -6093,10 +6093,10 @@ function SparklineTableResolver(p) {
6093
6093
  /* @__PURE__ */ jsx("th", { style: __spreadProps(__spreadValues({}, thStyle), { textAlign: "center" }), children: p.sparklineLabel })
6094
6094
  ] }) }),
6095
6095
  /* @__PURE__ */ jsx("tbody", { children: ((_c = p.rows) != null ? _c : []).map((row, ri) => {
6096
- var _a2;
6097
- return /* @__PURE__ */ jsxs("tr", { style: { background: ri % 2 === 0 ? "white" : "#fafafa", borderBottom: ri < ((_a2 = p.rows) != null ? _a2 : []).length - 1 ? "1px solid #f2f2f2" : "none" }, children: [
6096
+ var _a3;
6097
+ return /* @__PURE__ */ jsxs("tr", { style: { background: ri % 2 === 0 ? "white" : "#fafafa", borderBottom: ri < ((_a3 = p.rows) != null ? _a3 : []).length - 1 ? "1px solid #f2f2f2" : "none" }, children: [
6098
6098
  visibleColumns.map((col) => {
6099
- var _a3;
6099
+ var _a4;
6100
6100
  return /* @__PURE__ */ jsx("td", { style: {
6101
6101
  padding: "8px 10px",
6102
6102
  fontSize: "13px",
@@ -6104,7 +6104,7 @@ function SparklineTableResolver(p) {
6104
6104
  fontVariantNumeric: "tabular-nums",
6105
6105
  whiteSpace: col.align === "end" || col.align === "center" ? "nowrap" : "normal",
6106
6106
  textAlign: col.align === "end" ? "right" : col.align === "center" ? "center" : "left"
6107
- }, children: String((_a3 = row[col.key]) != null ? _a3 : "\u2014") }, col.key);
6107
+ }, children: String((_a4 = row[col.key]) != null ? _a4 : "\u2014") }, col.key);
6108
6108
  }),
6109
6109
  /* @__PURE__ */ jsx("td", { style: { padding: "6px 12px", textAlign: "center", verticalAlign: "middle" }, children: /* @__PURE__ */ jsx(SparklinePath, { points: row.sparkline }) })
6110
6110
  ] }, ri);
@@ -6143,17 +6143,17 @@ var th2 = {
6143
6143
  background: PAPER
6144
6144
  };
6145
6145
  function HeatmapTableResolver(p) {
6146
- var _a, _b, _c, _d, _e;
6146
+ var _a2, _b, _c, _d, _e;
6147
6147
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
6148
- const colDefs = ((_a = p.columns) != null ? _a : []).map((c) => ({ key: c.key, label: c.label }));
6148
+ const colDefs = ((_a2 = p.columns) != null ? _a2 : []).map((c) => ({ key: c.key, label: c.label }));
6149
6149
  const { visibleColumns, hidden, toggle, showAll, hideAll, allColumns } = useColumnVisibility(colDefs);
6150
6150
  const visibleKeys = new Set(visibleColumns.map((c) => c.key));
6151
6151
  const csvRows = ((_b = p.rows) != null ? _b : []).map((row) => {
6152
- var _a2;
6152
+ var _a3;
6153
6153
  const obj = { Asset: row.rowLabel };
6154
- ((_a2 = row.cells) != null ? _a2 : []).forEach((cell, ci) => {
6155
- var _a3;
6156
- if (ci < ((_a3 = p.columns) != null ? _a3 : []).length) obj[p.columns[ci].key] = cell.value;
6154
+ ((_a3 = row.cells) != null ? _a3 : []).forEach((cell, ci) => {
6155
+ var _a4;
6156
+ if (ci < ((_a4 = p.columns) != null ? _a4 : []).length) obj[p.columns[ci].key] = cell.value;
6157
6157
  });
6158
6158
  return obj;
6159
6159
  });
@@ -6162,8 +6162,8 @@ function HeatmapTableResolver(p) {
6162
6162
  {
6163
6163
  filename: (_c = p.title) != null ? _c : "heatmap-table",
6164
6164
  onDownloadCSV: () => {
6165
- var _a2;
6166
- return downloadCSV([{ key: "Asset", label: "Asset" }, ...visibleColumns], csvRows, (_a2 = p.title) != null ? _a2 : "heatmap-table");
6165
+ var _a3;
6166
+ return downloadCSV([{ key: "Asset", label: "Asset" }, ...visibleColumns], csvRows, (_a3 = p.title) != null ? _a3 : "heatmap-table");
6167
6167
  },
6168
6168
  columnConfig: { columns: allColumns, hidden, onToggle: toggle, onShowAll: showAll, onHideAll: hideAll },
6169
6169
  children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
@@ -6174,12 +6174,12 @@ function HeatmapTableResolver(p) {
6174
6174
  ((_d = p.columns) != null ? _d : []).map((col) => visibleKeys.has(col.key) ? /* @__PURE__ */ jsx("th", { style: th2, children: col.label }, col.key) : null)
6175
6175
  ] }) }),
6176
6176
  /* @__PURE__ */ jsx("tbody", { children: ((_e = p.rows) != null ? _e : []).map((row, ri) => {
6177
- var _a2, _b2;
6178
- return /* @__PURE__ */ jsxs("tr", { style: { borderBottom: ri < ((_a2 = p.rows) != null ? _a2 : []).length - 1 ? "1px solid #e5e5e5" : "none" }, children: [
6177
+ var _a3, _b2;
6178
+ return /* @__PURE__ */ jsxs("tr", { style: { borderBottom: ri < ((_a3 = p.rows) != null ? _a3 : []).length - 1 ? "1px solid #e5e5e5" : "none" }, children: [
6179
6179
  /* @__PURE__ */ jsx("td", { style: { padding: "8px 10px", fontWeight: 500, color: "var(--foreground)", fontSize: "12.5px", background: "white" }, children: row.rowLabel }),
6180
6180
  ((_b2 = row.cells) != null ? _b2 : []).map((cell, ci) => {
6181
- var _a3;
6182
- return ci < ((_a3 = p.columns) != null ? _a3 : []).length && visibleKeys.has(p.columns[ci].key) ? /* @__PURE__ */ jsx(
6181
+ var _a4;
6182
+ return ci < ((_a4 = p.columns) != null ? _a4 : []).length && visibleKeys.has(p.columns[ci].key) ? /* @__PURE__ */ jsx(
6183
6183
  "td",
6184
6184
  {
6185
6185
  style: {
@@ -6224,9 +6224,9 @@ var thStyle2 = {
6224
6224
  whiteSpace: "nowrap"
6225
6225
  };
6226
6226
  function ScreenerTableResolver(p) {
6227
- var _a, _b, _c, _d, _e, _f;
6227
+ var _a2, _b, _c, _d, _e, _f;
6228
6228
  const { ACCENT: ACCENT2, BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
6229
- const [activeFilters, setActiveFilters] = useState(new Set((_a = p.activeFilters) != null ? _a : []));
6229
+ const [activeFilters, setActiveFilters] = useState(new Set((_a2 = p.activeFilters) != null ? _a2 : []));
6230
6230
  const { visibleColumns, hidden, toggle, showAll, hideAll, allColumns } = useColumnVisibility((_b = p.columns) != null ? _b : []);
6231
6231
  const toggleFilter = (f) => setActiveFilters((prev) => {
6232
6232
  const next = new Set(prev);
@@ -6238,8 +6238,8 @@ function ScreenerTableResolver(p) {
6238
6238
  {
6239
6239
  filename: (_c = p.title) != null ? _c : "screener-table",
6240
6240
  onDownloadCSV: () => {
6241
- var _a2;
6242
- return downloadCSV(visibleColumns, p.rows, (_a2 = p.title) != null ? _a2 : "screener-table");
6241
+ var _a3;
6242
+ return downloadCSV(visibleColumns, p.rows, (_a3 = p.title) != null ? _a3 : "screener-table");
6243
6243
  },
6244
6244
  columnConfig: { columns: allColumns, hidden, onToggle: toggle, onShowAll: showAll, onHideAll: hideAll },
6245
6245
  children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
@@ -6263,9 +6263,9 @@ function ScreenerTableResolver(p) {
6263
6263
  /* @__PURE__ */ jsx("div", { style: { overflowX: "auto", borderRadius: "0.75rem", border: `1px solid ${BORDER4}`, boxShadow: "0 1px 2px rgba(0,0,0,0.03), 0 4px 12px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ jsxs("table", { style: { width: "100%", borderCollapse: "collapse", minWidth: "420px" }, children: [
6264
6264
  /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: visibleColumns.map((col) => /* @__PURE__ */ jsx("th", { style: __spreadProps(__spreadValues({}, thStyle2), { textAlign: col.align === "end" ? "right" : col.align === "center" ? "center" : "left" }), children: col.label }, col.key)) }) }),
6265
6265
  /* @__PURE__ */ jsx("tbody", { children: ((_f = p.rows) != null ? _f : []).map((row, ri) => {
6266
- var _a2;
6267
- return /* @__PURE__ */ jsx("tr", { style: { background: ri % 2 === 0 ? "white" : "#fafafa", borderBottom: ri < ((_a2 = p.rows) != null ? _a2 : []).length - 1 ? "1px solid #f2f2f2" : "none" }, children: visibleColumns.map((col) => {
6268
- var _a3;
6266
+ var _a3;
6267
+ return /* @__PURE__ */ jsx("tr", { style: { background: ri % 2 === 0 ? "white" : "#fafafa", borderBottom: ri < ((_a3 = p.rows) != null ? _a3 : []).length - 1 ? "1px solid #f2f2f2" : "none" }, children: visibleColumns.map((col) => {
6268
+ var _a4;
6269
6269
  const raw = row[col.key];
6270
6270
  return /* @__PURE__ */ jsx("td", { style: {
6271
6271
  padding: "8px 10px",
@@ -6274,7 +6274,7 @@ function ScreenerTableResolver(p) {
6274
6274
  fontVariantNumeric: "tabular-nums",
6275
6275
  whiteSpace: col.align === "end" || col.align === "center" || col.meterKey ? "nowrap" : "normal",
6276
6276
  textAlign: col.align === "end" ? "right" : col.align === "center" ? "center" : "left"
6277
- }, children: col.meterKey && typeof raw === "number" ? /* @__PURE__ */ jsx(MeterBar, { value: raw, max: (_a3 = col.meterMax) != null ? _a3 : 100 }) : String(raw != null ? raw : "\u2014") }, col.key);
6277
+ }, children: col.meterKey && typeof raw === "number" ? /* @__PURE__ */ jsx(MeterBar, { value: raw, max: (_a4 = col.meterMax) != null ? _a4 : 100 }) : String(raw != null ? raw : "\u2014") }, col.key);
6278
6278
  }) }, ri);
6279
6279
  }) })
6280
6280
  ] }) })
@@ -6295,7 +6295,7 @@ var th3 = {
6295
6295
  background: PAPER
6296
6296
  };
6297
6297
  function GroupRows({ group, columns, depth }) {
6298
- var _a, _b;
6298
+ var _a2, _b;
6299
6299
  const [open, setOpen] = useState(true);
6300
6300
  const indent = depth * 14;
6301
6301
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -6314,9 +6314,9 @@ function GroupRows({ group, columns, depth }) {
6314
6314
  }
6315
6315
  ),
6316
6316
  open && /* @__PURE__ */ jsxs(Fragment, { children: [
6317
- (_a = group.subGroups) == null ? void 0 : _a.map((sub, si) => /* @__PURE__ */ jsx(GroupRows, { group: __spreadProps(__spreadValues({}, sub), { subGroups: void 0 }), columns, depth: depth + 1 }, si)),
6317
+ (_a2 = group.subGroups) == null ? void 0 : _a2.map((sub, si) => /* @__PURE__ */ jsx(GroupRows, { group: __spreadProps(__spreadValues({}, sub), { subGroups: void 0 }), columns, depth: depth + 1 }, si)),
6318
6318
  ((_b = group.rows) != null ? _b : []).map((row, ri) => /* @__PURE__ */ jsx("tr", { style: { borderBottom: "1px solid #f2f2f2" }, children: columns.map((col, ci) => {
6319
- var _a2;
6319
+ var _a3;
6320
6320
  return /* @__PURE__ */ jsx(
6321
6321
  "td",
6322
6322
  {
@@ -6328,7 +6328,7 @@ function GroupRows({ group, columns, depth }) {
6328
6328
  fontVariantNumeric: "tabular-nums",
6329
6329
  textAlign: col.align === "end" ? "right" : col.align === "center" ? "center" : "left"
6330
6330
  },
6331
- children: String((_a2 = row[col.key]) != null ? _a2 : "\u2014")
6331
+ children: String((_a3 = row[col.key]) != null ? _a3 : "\u2014")
6332
6332
  },
6333
6333
  col.key
6334
6334
  );
@@ -6337,14 +6337,14 @@ function GroupRows({ group, columns, depth }) {
6337
6337
  ] });
6338
6338
  }
6339
6339
  function GroupedTableResolver(p) {
6340
- var _a, _b, _c, _d;
6340
+ var _a2, _b, _c, _d;
6341
6341
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
6342
- const { visibleColumns, hidden, toggle, showAll, hideAll, allColumns } = useColumnVisibility((_a = p.columns) != null ? _a : []);
6342
+ const { visibleColumns, hidden, toggle, showAll, hideAll, allColumns } = useColumnVisibility((_a2 = p.columns) != null ? _a2 : []);
6343
6343
  const flatRows = [];
6344
6344
  const flatten = (groups) => {
6345
- var _a2;
6345
+ var _a3;
6346
6346
  for (const g of groups) {
6347
- for (const row of (_a2 = g.rows) != null ? _a2 : []) flatRows.push(row);
6347
+ for (const row of (_a3 = g.rows) != null ? _a3 : []) flatRows.push(row);
6348
6348
  if (g.subGroups) flatten(g.subGroups);
6349
6349
  }
6350
6350
  };
@@ -6354,8 +6354,8 @@ function GroupedTableResolver(p) {
6354
6354
  {
6355
6355
  filename: (_c = p.title) != null ? _c : "grouped-table",
6356
6356
  onDownloadCSV: () => {
6357
- var _a2;
6358
- return downloadCSV(visibleColumns, flatRows, (_a2 = p.title) != null ? _a2 : "grouped-table");
6357
+ var _a3;
6358
+ return downloadCSV(visibleColumns, flatRows, (_a3 = p.title) != null ? _a3 : "grouped-table");
6359
6359
  },
6360
6360
  columnConfig: { columns: allColumns, hidden, onToggle: toggle, onShowAll: showAll, onHideAll: hideAll },
6361
6361
  children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
@@ -6399,16 +6399,16 @@ var dotColor = {
6399
6399
  neutral: "#888888"
6400
6400
  };
6401
6401
  function NewsFeedResolver(p) {
6402
- var _a, _b;
6402
+ var _a2, _b;
6403
6403
  const { ACCENT: ACCENT2, MUTED: MUTED2 } = useTheme();
6404
6404
  const [filter, setFilter] = useState(null);
6405
6405
  const sentiments = ["positive", "neutral", "negative"].filter(
6406
6406
  (s) => {
6407
- var _a2;
6408
- return ((_a2 = p.items) != null ? _a2 : []).some((i) => i.sentiment === s);
6407
+ var _a3;
6408
+ return ((_a3 = p.items) != null ? _a3 : []).some((i) => i.sentiment === s);
6409
6409
  }
6410
6410
  );
6411
- const visible = filter ? ((_a = p.items) != null ? _a : []).filter((i) => i.sentiment === filter) : p.items;
6411
+ const visible = filter ? ((_a2 = p.items) != null ? _a2 : []).filter((i) => i.sentiment === filter) : p.items;
6412
6412
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "news-feed", children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
6413
6413
  p.title && /* @__PURE__ */ jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
6414
6414
  sentiments.length > 1 && /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "6px" }, children: sentiments.map((s) => /* @__PURE__ */ jsx("button", { onClick: () => setFilter(filter === s ? null : s), style: sentimentStyle(s, filter === s), children: s }, s)) }),
@@ -6469,9 +6469,9 @@ var tooltipStyle = {
6469
6469
  color: "var(--foreground)"
6470
6470
  };
6471
6471
  function AreaChartResolver(p) {
6472
- var _a, _b, _c, _d;
6472
+ var _a2, _b, _c, _d;
6473
6473
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
6474
- const series = (_a = p.series) != null ? _a : [];
6474
+ const series = (_a2 = p.series) != null ? _a2 : [];
6475
6475
  const data = (_b = p.data) != null ? _b : [];
6476
6476
  const xKey = (_c = p.xKey) != null ? _c : "x";
6477
6477
  const { isVisible, toggle } = useSeriesToggle(series.map((s) => s.dataKey));
@@ -6560,12 +6560,12 @@ var tooltipStyle2 = {
6560
6560
  };
6561
6561
  var tdStyle = { padding: "5px 10px 5px 0", fontSize: "12.5px", verticalAlign: "middle" };
6562
6562
  function AllocationDonutResolver(p) {
6563
- var _a, _b;
6563
+ var _a2, _b;
6564
6564
  const { BORDER: BORDER4, MUTED: MUTED2, CHART_PALETTE: CHART_PALETTE2 } = useTheme();
6565
- const slices = (_a = p.slices) != null ? _a : [];
6565
+ const slices = (_a2 = p.slices) != null ? _a2 : [];
6566
6566
  const allData = slices.map((s, i) => {
6567
- var _a2;
6568
- return __spreadProps(__spreadValues({}, s), { fill: (_a2 = s.color) != null ? _a2 : PALETTE[i % PALETTE.length] });
6567
+ var _a3;
6568
+ return __spreadProps(__spreadValues({}, s), { fill: (_a3 = s.color) != null ? _a3 : PALETTE[i % PALETTE.length] });
6569
6569
  });
6570
6570
  const { isVisible, toggle } = useSeriesToggle(allData.map((s) => s.label));
6571
6571
  const data = allData.filter((s) => isVisible(s.label));
@@ -6659,10 +6659,10 @@ var tooltipStyle3 = {
6659
6659
  color: "var(--foreground)"
6660
6660
  };
6661
6661
  function WaterfallChartResolver(p) {
6662
- var _a, _b, _c;
6662
+ var _a2, _b, _c;
6663
6663
  const { ACCENT: ACCENT2, BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
6664
6664
  const { isVisible, toggle } = useSeriesToggle(["Positive", "Negative", "Total"]);
6665
- const unit = (_a = p.unit) != null ? _a : "";
6665
+ const unit = (_a2 = p.unit) != null ? _a2 : "";
6666
6666
  const bars = (_b = p.bars) != null ? _b : [];
6667
6667
  let running = 0;
6668
6668
  const chartData = bars.map((bar) => {
@@ -6939,9 +6939,9 @@ function FlowCanvasRenderer({
6939
6939
  ] });
6940
6940
  }
6941
6941
  function FlowCanvasResolver(p) {
6942
- var _a;
6942
+ var _a2;
6943
6943
  const { ACCENT: ACCENT2, BORDER: BORDER4 } = useTheme();
6944
- return /* @__PURE__ */ jsx(ComponentActions, { filename: (_a = p.title) != null ? _a : "flow-canvas", children: /* @__PURE__ */ jsx(
6944
+ return /* @__PURE__ */ jsx(ComponentActions, { filename: (_a2 = p.title) != null ? _a2 : "flow-canvas", children: /* @__PURE__ */ jsx(
6945
6945
  FlowCanvasRenderer,
6946
6946
  {
6947
6947
  diagram: p.diagram,
@@ -6964,13 +6964,13 @@ var categoryLabels = {
6964
6964
  other: "Other"
6965
6965
  };
6966
6966
  function TrialBalanceResolver(p) {
6967
- var _a, _b, _c, _d;
6967
+ var _a2, _b, _c, _d;
6968
6968
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
6969
6969
  let totalDebit = 0;
6970
6970
  let totalCredit = 0;
6971
- ((_a = p.groups) != null ? _a : []).forEach((g) => {
6972
- var _a2;
6973
- return ((_a2 = g.accounts) != null ? _a2 : []).forEach((a) => {
6971
+ ((_a2 = p.groups) != null ? _a2 : []).forEach((g) => {
6972
+ var _a3;
6973
+ return ((_a3 = g.accounts) != null ? _a3 : []).forEach((a) => {
6974
6974
  totalDebit += a.debit;
6975
6975
  totalCredit += a.credit;
6976
6976
  });
@@ -6978,12 +6978,12 @@ function TrialBalanceResolver(p) {
6978
6978
  const balanced = Math.abs(totalDebit - totalCredit) < 5e-3;
6979
6979
  const csvCols = [{ key: "category", label: "Category" }, { key: "code", label: "Code" }, { key: "name", label: "Account" }, { key: "debit", label: "Debit" }, { key: "credit", label: "Credit" }];
6980
6980
  const csvRows = ((_b = p.groups) != null ? _b : []).flatMap((g) => {
6981
- var _a2;
6982
- return ((_a2 = g.accounts) != null ? _a2 : []).map((a) => ({ category: g.category, code: a.code, name: a.name, debit: a.debit, credit: a.credit }));
6981
+ var _a3;
6982
+ return ((_a3 = g.accounts) != null ? _a3 : []).map((a) => ({ category: g.category, code: a.code, name: a.name, debit: a.debit, credit: a.credit }));
6983
6983
  });
6984
6984
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_c = p.title) != null ? _c : "trial-balance", onDownloadCSV: () => {
6985
- var _a2;
6986
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "trial-balance");
6985
+ var _a3;
6986
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "trial-balance");
6987
6987
  }, children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
6988
6988
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
6989
6989
  p.title && /* @__PURE__ */ jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
@@ -7016,9 +7016,9 @@ function TrialBalanceResolver(p) {
7016
7016
  }, children: h }, h)) }) }),
7017
7017
  /* @__PURE__ */ jsxs("tbody", { children: [
7018
7018
  ((_d = p.groups) != null ? _d : []).map((group) => {
7019
- var _a2, _b2, _c2;
7019
+ var _a3, _b2, _c2;
7020
7020
  let gDebit = 0, gCredit = 0;
7021
- ((_a2 = group.accounts) != null ? _a2 : []).forEach((a) => {
7021
+ ((_a3 = group.accounts) != null ? _a3 : []).forEach((a) => {
7022
7022
  gDebit += a.debit;
7023
7023
  gCredit += a.credit;
7024
7024
  });
@@ -7067,25 +7067,25 @@ var statusColors = {
7067
7067
  };
7068
7068
  var fmt2 = (v, currency) => new Intl.NumberFormat("en-US", { style: "currency", currency: currency || "USD", minimumFractionDigits: 2 }).format(v);
7069
7069
  function JournalEntryResolver(p) {
7070
- var _a, _b, _c;
7070
+ var _a2, _b, _c;
7071
7071
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2 } = useTheme();
7072
7072
  const csvCols = [{ key: "entryId", label: "Entry ID" }, { key: "date", label: "Date" }, { key: "status", label: "Status" }, { key: "account", label: "Account" }, { key: "description", label: "Description" }, { key: "debit", label: "Debit" }, { key: "credit", label: "Credit" }];
7073
- const csvRows = ((_a = p.entries) != null ? _a : []).flatMap((e) => {
7074
- var _a2;
7075
- return ((_a2 = e.lines) != null ? _a2 : []).map((l) => {
7076
- var _a3;
7077
- return { entryId: e.entryId, date: e.date, status: e.status, account: l.account, description: (_a3 = l.description) != null ? _a3 : "", debit: l.debit, credit: l.credit };
7073
+ const csvRows = ((_a2 = p.entries) != null ? _a2 : []).flatMap((e) => {
7074
+ var _a3;
7075
+ return ((_a3 = e.lines) != null ? _a3 : []).map((l) => {
7076
+ var _a4;
7077
+ return { entryId: e.entryId, date: e.date, status: e.status, account: l.account, description: (_a4 = l.description) != null ? _a4 : "", debit: l.debit, credit: l.credit };
7078
7078
  });
7079
7079
  });
7080
7080
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "journal-entry", onDownloadCSV: () => {
7081
- var _a2;
7082
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "journal-entry");
7081
+ var _a3;
7082
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "journal-entry");
7083
7083
  }, children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "14px" }, children: [
7084
7084
  p.title && /* @__PURE__ */ jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
7085
7085
  ((_c = p.entries) != null ? _c : []).map((entry) => {
7086
- var _a2, _b2;
7086
+ var _a3, _b2, _c2;
7087
7087
  let totalDebit = 0, totalCredit = 0;
7088
- ((_a2 = entry.lines) != null ? _a2 : []).forEach((l) => {
7088
+ ((_a3 = entry.lines) != null ? _a3 : []).forEach((l) => {
7089
7089
  totalDebit += l.debit;
7090
7090
  totalCredit += l.credit;
7091
7091
  });
@@ -7109,11 +7109,11 @@ function JournalEntryResolver(p) {
7109
7109
  letterSpacing: "0.02em"
7110
7110
  }, children: h }, h)) }) }),
7111
7111
  /* @__PURE__ */ jsxs("tbody", { children: [
7112
- entry.lines.map((line, li) => {
7113
- var _a3;
7112
+ ((_c2 = entry.lines) != null ? _c2 : []).map((line, li) => {
7113
+ var _a4;
7114
7114
  return /* @__PURE__ */ jsxs("tr", { style: { background: li % 2 === 0 ? "white" : "#fafafa" }, children: [
7115
7115
  /* @__PURE__ */ jsx("td", { style: { padding: "6px 12px", fontSize: "13px" }, children: line.account }),
7116
- /* @__PURE__ */ jsx("td", { style: { padding: "6px 12px", fontSize: "12px", color: MUTED2 }, children: (_a3 = line.description) != null ? _a3 : "\u2014" }),
7116
+ /* @__PURE__ */ jsx("td", { style: { padding: "6px 12px", fontSize: "12px", color: MUTED2 }, children: (_a4 = line.description) != null ? _a4 : "\u2014" }),
7117
7117
  /* @__PURE__ */ jsx("td", { style: { padding: "6px 12px", fontSize: "13px", textAlign: "right", fontVariantNumeric: "tabular-nums" }, children: line.debit > 0 ? fmt2(line.debit, p.currency) : "\u2014" }),
7118
7118
  /* @__PURE__ */ jsx("td", { style: { padding: "6px 12px", fontSize: "13px", textAlign: "right", fontVariantNumeric: "tabular-nums" }, children: line.credit > 0 ? fmt2(line.credit, p.currency) : "\u2014" })
7119
7119
  ] }, li);
@@ -7144,17 +7144,17 @@ function agingHeat(index, total) {
7144
7144
  return `rgba(220, 38, 38, ${alpha})`;
7145
7145
  }
7146
7146
  function AgingReportResolver(p) {
7147
- var _a, _b, _c, _d;
7147
+ var _a2, _b, _c, _d;
7148
7148
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2 } = useTheme();
7149
- const buckets = (_a = p.buckets) != null ? _a : [];
7149
+ const buckets = (_a2 = p.buckets) != null ? _a2 : [];
7150
7150
  const entities = (_b = p.entities) != null ? _b : [];
7151
7151
  const currency = (_c = p.currency) != null ? _c : "USD";
7152
7152
  const bucketCount = buckets.length;
7153
7153
  const totals = new Array(bucketCount).fill(0);
7154
7154
  let grandTotal = 0;
7155
7155
  entities.forEach((e) => {
7156
- var _a2, _b2;
7157
- ((_a2 = e.amounts) != null ? _a2 : []).forEach((a, i) => {
7156
+ var _a3, _b2;
7157
+ ((_a3 = e.amounts) != null ? _a3 : []).forEach((a, i) => {
7158
7158
  if (i < bucketCount) totals[i] += a;
7159
7159
  });
7160
7160
  grandTotal += (_b2 = e.total) != null ? _b2 : 0;
@@ -7168,8 +7168,8 @@ function AgingReportResolver(p) {
7168
7168
  return row;
7169
7169
  });
7170
7170
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_d = p.title) != null ? _d : "aging-report", onDownloadCSV: () => {
7171
- var _a2;
7172
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "aging-report");
7171
+ var _a3;
7172
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "aging-report");
7173
7173
  }, children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
7174
7174
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
7175
7175
  p.title && /* @__PURE__ */ jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
@@ -7187,12 +7187,12 @@ function AgingReportResolver(p) {
7187
7187
  ] }) }),
7188
7188
  /* @__PURE__ */ jsxs("tbody", { children: [
7189
7189
  entities.map((entity, ri) => {
7190
- var _a2;
7190
+ var _a3;
7191
7191
  return /* @__PURE__ */ jsxs("tr", { style: { background: ri % 2 === 0 ? "white" : "#fafafa" }, children: [
7192
7192
  /* @__PURE__ */ jsx("td", { style: { padding: "6px 12px", fontSize: "13px", borderBottom: `1px solid #f2f2f2`, maxWidth: "200px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: entity.name }),
7193
7193
  buckets.map((_, bi) => {
7194
- var _a3, _b2;
7195
- const val = bi < ((_a3 = entity.amounts) != null ? _a3 : []).length ? ((_b2 = entity.amounts) != null ? _b2 : [])[bi] : 0;
7194
+ var _a4, _b2;
7195
+ const val = bi < ((_a4 = entity.amounts) != null ? _a4 : []).length ? ((_b2 = entity.amounts) != null ? _b2 : [])[bi] : 0;
7196
7196
  const isLast = bi === bucketCount - 1;
7197
7197
  return /* @__PURE__ */ jsx("td", { style: {
7198
7198
  padding: "6px 12px",
@@ -7205,7 +7205,7 @@ function AgingReportResolver(p) {
7205
7205
  fontWeight: isLast && val > 0 ? 600 : void 0
7206
7206
  }, children: val !== 0 ? fmt3(val, currency) : "\u2014" }, bi);
7207
7207
  }),
7208
- /* @__PURE__ */ jsx("td", { style: { padding: "6px 12px", fontSize: "13px", textAlign: "right", fontVariantNumeric: "tabular-nums", fontWeight: 600, borderBottom: `1px solid #f2f2f2` }, children: fmt3((_a2 = entity.total) != null ? _a2 : 0, currency) })
7208
+ /* @__PURE__ */ jsx("td", { style: { padding: "6px 12px", fontSize: "13px", textAlign: "right", fontVariantNumeric: "tabular-nums", fontWeight: 600, borderBottom: `1px solid #f2f2f2` }, children: fmt3((_a3 = entity.total) != null ? _a3 : 0, currency) })
7209
7209
  ] }, ri);
7210
7210
  }),
7211
7211
  /* @__PURE__ */ jsxs("tr", { style: { background: PAPER2 }, children: [
@@ -7223,14 +7223,14 @@ init_ThemeContext();
7223
7223
  var fmt4 = (v, currency) => new Intl.NumberFormat("en-US", { style: "currency", currency: currency || "USD", minimumFractionDigits: 2 }).format(v);
7224
7224
  var pctFmt = (v) => isFinite(v) ? `${v > 0 ? "+" : ""}${v.toFixed(1)}%` : "N/A";
7225
7225
  function VarianceAnalysisResolver(p) {
7226
- var _a, _b, _c, _d;
7226
+ var _a2, _b, _c, _d;
7227
7227
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
7228
- const maxAbsVar = Math.max(...((_a = p.rows) != null ? _a : []).filter((r) => !r.isSubtotal).map((r) => Math.abs(r.actual - r.budget)), 1);
7228
+ const maxAbsVar = Math.max(...((_a2 = p.rows) != null ? _a2 : []).filter((r) => !r.isSubtotal).map((r) => Math.abs(r.actual - r.budget)), 1);
7229
7229
  const csvCols = [{ key: "lineItem", label: "Line Item" }, { key: "budget", label: "Budget" }, { key: "actual", label: "Actual" }, { key: "variance", label: "Variance $" }, { key: "variancePct", label: "Variance %" }];
7230
7230
  const csvRows = ((_b = p.rows) != null ? _b : []).map((r) => ({ lineItem: r.lineItem, budget: r.budget, actual: r.actual, variance: r.actual - r.budget, variancePct: r.budget !== 0 ? ((r.actual - r.budget) / Math.abs(r.budget) * 100).toFixed(1) + "%" : "N/A" }));
7231
7231
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_c = p.title) != null ? _c : "variance-analysis", onDownloadCSV: () => {
7232
- var _a2;
7233
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "variance-analysis");
7232
+ var _a3;
7233
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "variance-analysis");
7234
7234
  }, children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
7235
7235
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
7236
7236
  p.title && /* @__PURE__ */ jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
@@ -7251,7 +7251,7 @@ function VarianceAnalysisResolver(p) {
7251
7251
  width: i === 5 ? "60px" : void 0
7252
7252
  }, children: h }, h || i)) }) }),
7253
7253
  /* @__PURE__ */ jsx("tbody", { children: ((_d = p.rows) != null ? _d : []).map((row, ri) => {
7254
- var _a2;
7254
+ var _a3;
7255
7255
  const variance = row.actual - row.budget;
7256
7256
  const pct = row.budget !== 0 ? variance / Math.abs(row.budget) * 100 : NaN;
7257
7257
  const favorable = p.favorableDirection === "higher" ? variance >= 0 : variance <= 0;
@@ -7262,7 +7262,7 @@ function VarianceAnalysisResolver(p) {
7262
7262
  fontWeight: row.isSubtotal ? 700 : void 0,
7263
7263
  borderTop: row.isSubtotal ? `1px solid ${BORDER4}` : void 0
7264
7264
  }, children: [
7265
- /* @__PURE__ */ jsx("td", { style: { padding: "6px 10px", paddingLeft: `${12 + ((_a2 = row.indent) != null ? _a2 : 0) * 16}px`, fontSize: "13px", borderBottom: `1px solid #f2f2f2` }, children: row.lineItem }),
7265
+ /* @__PURE__ */ jsx("td", { style: { padding: "6px 10px", paddingLeft: `${12 + ((_a3 = row.indent) != null ? _a3 : 0) * 16}px`, fontSize: "13px", borderBottom: `1px solid #f2f2f2` }, children: row.lineItem }),
7266
7266
  /* @__PURE__ */ jsx("td", { style: { padding: "6px 10px", fontSize: "13px", textAlign: "right", fontVariantNumeric: "tabular-nums", borderBottom: `1px solid #f2f2f2` }, children: fmt4(row.budget, p.currency) }),
7267
7267
  /* @__PURE__ */ jsx("td", { style: { padding: "6px 10px", fontSize: "13px", textAlign: "right", fontVariantNumeric: "tabular-nums", borderBottom: `1px solid #f2f2f2` }, children: fmt4(row.actual, p.currency) }),
7268
7268
  /* @__PURE__ */ jsxs("td", { style: { padding: "6px 10px", fontSize: "13px", textAlign: "right", fontVariantNumeric: "tabular-nums", borderBottom: `1px solid #f2f2f2`, color }, children: [
@@ -7296,16 +7296,16 @@ function abbreviate(v) {
7296
7296
  }
7297
7297
  var fmt5 = (v, currency) => new Intl.NumberFormat("en-US", { style: "currency", currency: currency || "USD", minimumFractionDigits: 2 }).format(v);
7298
7298
  function StackedBreakdownResolver(p) {
7299
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
7299
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
7300
7300
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, CHART_PALETTE: CHART_PALETTE2 } = useTheme();
7301
- const { isVisible, toggle } = useSeriesToggle(((_a = p.categories) != null ? _a : []).map((c) => c.name));
7301
+ const { isVisible, toggle } = useSeriesToggle(((_a2 = p.categories) != null ? _a2 : []).map((c) => c.name));
7302
7302
  const chartData = ((_b = p.periods) != null ? _b : []).map((period, pi) => {
7303
- var _a2;
7303
+ var _a3;
7304
7304
  const row = { period };
7305
7305
  let total = 0;
7306
- ((_a2 = p.categories) != null ? _a2 : []).forEach((cat) => {
7307
- var _a3, _b2;
7308
- const v = pi < ((_a3 = cat.values) != null ? _a3 : []).length ? ((_b2 = cat.values) != null ? _b2 : [])[pi] : 0;
7306
+ ((_a3 = p.categories) != null ? _a3 : []).forEach((cat) => {
7307
+ var _a4, _b2;
7308
+ const v = pi < ((_a4 = cat.values) != null ? _a4 : []).length ? ((_b2 = cat.values) != null ? _b2 : [])[pi] : 0;
7309
7309
  row[cat.name] = v;
7310
7310
  total += v;
7311
7311
  });
@@ -7319,8 +7319,8 @@ function StackedBreakdownResolver(p) {
7319
7319
  {
7320
7320
  filename: (_e = p.title) != null ? _e : "stacked-breakdown",
7321
7321
  onDownloadCSV: () => {
7322
- var _a2;
7323
- return downloadCSV(csvCols, chartData, (_a2 = p.title) != null ? _a2 : "stacked-breakdown");
7322
+ var _a3;
7323
+ return downloadCSV(csvCols, chartData, (_a3 = p.title) != null ? _a3 : "stacked-breakdown");
7324
7324
  },
7325
7325
  children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "12px" }, children: [
7326
7326
  p.title && /* @__PURE__ */ jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
@@ -7329,13 +7329,13 @@ function StackedBreakdownResolver(p) {
7329
7329
  /* @__PURE__ */ jsx(YAxis, { tick: { fontSize: 11, fill: MUTED2 }, axisLine: false, tickLine: false, width: 52, tickFormatter: abbreviate }),
7330
7330
  /* @__PURE__ */ jsx(Tooltip, { contentStyle: tooltipStyle4, formatter: (value) => [fmt5(value, p.currency), ""], cursor: { fill: "#f2f2f2" } }),
7331
7331
  ((_f = p.categories) != null ? _f : []).map((cat, ci) => {
7332
- var _a2, _b2;
7332
+ var _a3, _b2;
7333
7333
  return /* @__PURE__ */ jsx(
7334
7334
  Bar,
7335
7335
  {
7336
7336
  dataKey: cat.name,
7337
7337
  stackId: "tax",
7338
- fill: (_a2 = cat.color) != null ? _a2 : PALETTE2[ci % PALETTE2.length],
7338
+ fill: (_a3 = cat.color) != null ? _a3 : PALETTE2[ci % PALETTE2.length],
7339
7339
  radius: ci === ((_b2 = p.categories) != null ? _b2 : []).length - 1 ? [3, 3, 0, 0] : void 0,
7340
7340
  hide: !isVisible(cat.name)
7341
7341
  },
@@ -7344,7 +7344,7 @@ function StackedBreakdownResolver(p) {
7344
7344
  })
7345
7345
  ] }) }),
7346
7346
  /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "14px" }, children: ((_g = p.categories) != null ? _g : []).map((cat, ci) => {
7347
- var _a2;
7347
+ var _a3;
7348
7348
  return /* @__PURE__ */ jsxs(
7349
7349
  "div",
7350
7350
  {
@@ -7368,7 +7368,7 @@ function StackedBreakdownResolver(p) {
7368
7368
  height: "10px",
7369
7369
  borderRadius: "2px",
7370
7370
  flexShrink: 0,
7371
- background: (_a2 = cat.color) != null ? _a2 : PALETTE2[ci % PALETTE2.length],
7371
+ background: (_a3 = cat.color) != null ? _a3 : PALETTE2[ci % PALETTE2.length],
7372
7372
  display: "inline-block",
7373
7373
  opacity: isVisible(cat.name) ? 1 : 0.3,
7374
7374
  transition: "opacity 0.15s"
@@ -7386,15 +7386,15 @@ function StackedBreakdownResolver(p) {
7386
7386
  ] }) }),
7387
7387
  /* @__PURE__ */ jsxs("tbody", { children: [
7388
7388
  ((_i = p.categories) != null ? _i : []).map((cat, ci) => {
7389
- var _a2, _b2;
7389
+ var _a3, _b2;
7390
7390
  return /* @__PURE__ */ jsxs("tr", { style: { background: ci % 2 === 0 ? "white" : "#fafafa" }, children: [
7391
7391
  /* @__PURE__ */ jsxs("td", { style: { padding: "6px 12px", fontSize: "13px", borderBottom: `1px solid #f2f2f2` }, children: [
7392
- /* @__PURE__ */ jsx("span", { style: { display: "inline-block", width: "8px", height: "8px", borderRadius: "2px", background: (_a2 = cat.color) != null ? _a2 : PALETTE2[ci % PALETTE2.length], marginRight: "6px" } }),
7392
+ /* @__PURE__ */ jsx("span", { style: { display: "inline-block", width: "8px", height: "8px", borderRadius: "2px", background: (_a3 = cat.color) != null ? _a3 : PALETTE2[ci % PALETTE2.length], marginRight: "6px" } }),
7393
7393
  cat.name
7394
7394
  ] }),
7395
7395
  ((_b2 = p.periods) != null ? _b2 : []).map((_, pi) => {
7396
- var _a3, _b3;
7397
- const v = pi < ((_a3 = cat.values) != null ? _a3 : []).length ? ((_b3 = cat.values) != null ? _b3 : [])[pi] : 0;
7396
+ var _a4, _b3;
7397
+ const v = pi < ((_a4 = cat.values) != null ? _a4 : []).length ? ((_b3 = cat.values) != null ? _b3 : [])[pi] : 0;
7398
7398
  return /* @__PURE__ */ jsx("td", { style: { padding: "6px 12px", fontSize: "13px", textAlign: "right", fontVariantNumeric: "tabular-nums", whiteSpace: "nowrap", borderBottom: `1px solid #f2f2f2`, color: v < 0 ? "#dc2626" : void 0 }, children: v < 0 ? `(${fmt5(Math.abs(v), p.currency)})` : fmt5(v, p.currency) }, pi);
7399
7399
  })
7400
7400
  ] }, cat.name);
@@ -7429,9 +7429,9 @@ var tooltipStyle5 = {
7429
7429
  color: "var(--foreground)"
7430
7430
  };
7431
7431
  function ComparativeBarChartResolver(p) {
7432
- var _a, _b, _c, _d;
7432
+ var _a2, _b, _c, _d;
7433
7433
  const { BORDER: BORDER4, MUTED: MUTED2, CHART_PALETTE: CHART_PALETTE2 } = useTheme();
7434
- const series = (_a = p.series) != null ? _a : [];
7434
+ const series = (_a2 = p.series) != null ? _a2 : [];
7435
7435
  const data = (_b = p.data) != null ? _b : [];
7436
7436
  const xKey = (_c = p.xKey) != null ? _c : "x";
7437
7437
  const horizontal = p.orientation === "horizontal";
@@ -7459,13 +7459,13 @@ function ComparativeBarChartResolver(p) {
7459
7459
  ),
7460
7460
  /* @__PURE__ */ jsx(Tooltip, { contentStyle: tooltipStyle5, cursor: { fill: "#f2f2f2" } }),
7461
7461
  series.map((s, si) => {
7462
- var _a2;
7462
+ var _a3;
7463
7463
  return /* @__PURE__ */ jsx(
7464
7464
  Bar,
7465
7465
  {
7466
7466
  dataKey: s.dataKey,
7467
7467
  name: s.name,
7468
- fill: (_a2 = s.color) != null ? _a2 : PALETTE3[si % PALETTE3.length],
7468
+ fill: (_a3 = s.color) != null ? _a3 : PALETTE3[si % PALETTE3.length],
7469
7469
  stackId: stacked ? "stack" : void 0,
7470
7470
  radius: horizontal ? void 0 : [3, 3, 0, 0],
7471
7471
  hide: !isVisible(s.dataKey),
@@ -7476,7 +7476,7 @@ function ComparativeBarChartResolver(p) {
7476
7476
  })
7477
7477
  ] }) }),
7478
7478
  series.length > 1 && /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "14px" }, children: series.map((s, si) => {
7479
- var _a2;
7479
+ var _a3;
7480
7480
  return /* @__PURE__ */ jsxs(
7481
7481
  "div",
7482
7482
  {
@@ -7497,7 +7497,7 @@ function ComparativeBarChartResolver(p) {
7497
7497
  width: "10px",
7498
7498
  height: "10px",
7499
7499
  borderRadius: "2px",
7500
- background: (_a2 = s.color) != null ? _a2 : PALETTE3[si % PALETTE3.length],
7500
+ background: (_a3 = s.color) != null ? _a3 : PALETTE3[si % PALETTE3.length],
7501
7501
  display: "inline-block",
7502
7502
  opacity: isVisible(s.dataKey) ? 1 : 0.3,
7503
7503
  transition: "opacity 0.15s"
@@ -7528,8 +7528,8 @@ var priorityConfig = {
7528
7528
  low: { color: MUTED, bg: "#f2f2f2" }
7529
7529
  };
7530
7530
  function ItemRow({ item }) {
7531
- var _a, _b;
7532
- const sc = (_a = statusConfig[item.status]) != null ? _a : statusConfig["not-started"];
7531
+ var _a2, _b;
7532
+ const sc = (_a2 = statusConfig[item.status]) != null ? _a2 : statusConfig["not-started"];
7533
7533
  const pc = (_b = priorityConfig[item.priority]) != null ? _b : priorityConfig.medium;
7534
7534
  return /* @__PURE__ */ jsxs("div", { style: {
7535
7535
  display: "flex",
@@ -7598,24 +7598,24 @@ function Section({ section }) {
7598
7598
  ] });
7599
7599
  }
7600
7600
  function ComplianceChecklistResolver(p) {
7601
- var _a, _b, _c, _d;
7601
+ var _a2, _b, _c, _d;
7602
7602
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
7603
- const allItems = ((_a = p.sections) != null ? _a : []).flatMap((s) => s.items);
7603
+ const allItems = ((_a2 = p.sections) != null ? _a2 : []).flatMap((s) => s.items);
7604
7604
  const total = allItems.length;
7605
7605
  const completed = allItems.filter((i) => i.status === "completed").length;
7606
7606
  const overdue = allItems.filter((i) => i.status === "overdue").length;
7607
7607
  const pct = total > 0 ? Math.round(completed / total * 100) : 0;
7608
7608
  const csvCols = [{ key: "section", label: "Section" }, { key: "id", label: "ID" }, { key: "description", label: "Description" }, { key: "status", label: "Status" }, { key: "priority", label: "Priority" }, { key: "assignee", label: "Assignee" }, { key: "dueDate", label: "Due Date" }];
7609
7609
  const csvRows = ((_b = p.sections) != null ? _b : []).flatMap((s) => {
7610
- var _a2;
7611
- return ((_a2 = s.items) != null ? _a2 : []).map((i) => {
7612
- var _a3, _b2;
7613
- return { section: s.sectionTitle, id: i.id, description: i.description, status: i.status, priority: i.priority, assignee: (_a3 = i.assignee) != null ? _a3 : "", dueDate: (_b2 = i.dueDate) != null ? _b2 : "" };
7610
+ var _a3;
7611
+ return ((_a3 = s.items) != null ? _a3 : []).map((i) => {
7612
+ var _a4, _b2;
7613
+ return { section: s.sectionTitle, id: i.id, description: i.description, status: i.status, priority: i.priority, assignee: (_a4 = i.assignee) != null ? _a4 : "", dueDate: (_b2 = i.dueDate) != null ? _b2 : "" };
7614
7614
  });
7615
7615
  });
7616
7616
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_c = p.title) != null ? _c : "compliance-checklist", onDownloadCSV: () => {
7617
- var _a2;
7618
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "compliance-checklist");
7617
+ var _a3;
7618
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "compliance-checklist");
7619
7619
  }, children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
7620
7620
  p.title && /* @__PURE__ */ jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
7621
7621
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
@@ -7677,9 +7677,9 @@ function DiffCell({ diff, currency }) {
7677
7677
  );
7678
7678
  }
7679
7679
  function ReconciliationViewResolver(p) {
7680
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
7680
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
7681
7681
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2 } = useTheme();
7682
- const sourceA = (_a = p.sourceA) != null ? _a : { label: "Source A" };
7682
+ const sourceA = (_a2 = p.sourceA) != null ? _a2 : { label: "Source A" };
7683
7683
  const sourceB = (_b = p.sourceB) != null ? _b : { label: "Source B" };
7684
7684
  const [activeTab, setActiveTab] = useState("matched");
7685
7685
  const balanceA = (_d = (_c = p.summary) == null ? void 0 : _c.balanceA) != null ? _d : 0;
@@ -7696,7 +7696,7 @@ function ReconciliationViewResolver(p) {
7696
7696
  ];
7697
7697
  const csvRows = [
7698
7698
  ...((_i = p.matched) != null ? _i : []).map((m) => {
7699
- var _a2;
7699
+ var _a3;
7700
7700
  return {
7701
7701
  type: "Matched",
7702
7702
  date: m.date,
@@ -7704,11 +7704,11 @@ function ReconciliationViewResolver(p) {
7704
7704
  amountA: m.amountA,
7705
7705
  amountB: m.amountB,
7706
7706
  diff: m.amountA - m.amountB,
7707
- reference: (_a2 = m.reference) != null ? _a2 : ""
7707
+ reference: (_a3 = m.reference) != null ? _a3 : ""
7708
7708
  };
7709
7709
  }),
7710
7710
  ...((_j = p.unmatchedA) != null ? _j : []).map((u) => {
7711
- var _a2;
7711
+ var _a3;
7712
7712
  return {
7713
7713
  type: `Unmatched ${sourceA.label}`,
7714
7714
  date: u.date,
@@ -7716,11 +7716,11 @@ function ReconciliationViewResolver(p) {
7716
7716
  amountA: u.amount,
7717
7717
  amountB: "",
7718
7718
  diff: "",
7719
- reference: (_a2 = u.reference) != null ? _a2 : ""
7719
+ reference: (_a3 = u.reference) != null ? _a3 : ""
7720
7720
  };
7721
7721
  }),
7722
7722
  ...((_k = p.unmatchedB) != null ? _k : []).map((u) => {
7723
- var _a2;
7723
+ var _a3;
7724
7724
  return {
7725
7725
  type: `Unmatched ${sourceB.label}`,
7726
7726
  date: u.date,
@@ -7728,7 +7728,7 @@ function ReconciliationViewResolver(p) {
7728
7728
  amountA: "",
7729
7729
  amountB: u.amount,
7730
7730
  diff: "",
7731
- reference: (_a2 = u.reference) != null ? _a2 : ""
7731
+ reference: (_a3 = u.reference) != null ? _a3 : ""
7732
7732
  };
7733
7733
  })
7734
7734
  ];
@@ -7744,8 +7744,8 @@ function ReconciliationViewResolver(p) {
7744
7744
  {
7745
7745
  filename: (_s = p.title) != null ? _s : "reconciliation-view",
7746
7746
  onDownloadCSV: () => {
7747
- var _a2;
7748
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "reconciliation-view");
7747
+ var _a3;
7748
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "reconciliation-view");
7749
7749
  },
7750
7750
  children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "0" }, children: [
7751
7751
  p.title && /* @__PURE__ */ jsx(
@@ -7916,7 +7916,7 @@ function ReconciliationViewResolver(p) {
7916
7916
  borderBottom: `1px solid ${BORDER4}`
7917
7917
  },
7918
7918
  children: tabs.map((tab, i) => {
7919
- var _a2;
7919
+ var _a3;
7920
7920
  const isActive = activeTab === tab.key;
7921
7921
  return /* @__PURE__ */ jsxs(
7922
7922
  "button",
@@ -7953,7 +7953,7 @@ function ReconciliationViewResolver(p) {
7953
7953
  left: "16px",
7954
7954
  right: "16px",
7955
7955
  height: "2px",
7956
- background: (_a2 = tab.accent) != null ? _a2 : ACCENT2,
7956
+ background: (_a3 = tab.accent) != null ? _a3 : ACCENT2,
7957
7957
  borderRadius: "2px 2px 0 0"
7958
7958
  }
7959
7959
  }
@@ -8019,7 +8019,7 @@ function ReconciliationViewResolver(p) {
8019
8019
  )
8020
8020
  ) }) }),
8021
8021
  /* @__PURE__ */ jsx("tbody", { children: ((_u = p.matched) != null ? _u : []).map((m, ri) => {
8022
- var _a2;
8022
+ var _a3;
8023
8023
  const diff = m.amountA - m.amountB;
8024
8024
  const isZero = Math.abs(diff) < 5e-3;
8025
8025
  return /* @__PURE__ */ jsxs(
@@ -8114,7 +8114,7 @@ function ReconciliationViewResolver(p) {
8114
8114
  borderBottom: `1px solid ${INNER_BORDER}`,
8115
8115
  letterSpacing: "0.02em"
8116
8116
  },
8117
- children: (_a2 = m.reference) != null ? _a2 : "\u2014"
8117
+ children: (_a3 = m.reference) != null ? _a3 : "\u2014"
8118
8118
  }
8119
8119
  )
8120
8120
  ]
@@ -8124,8 +8124,8 @@ function ReconciliationViewResolver(p) {
8124
8124
  }) })
8125
8125
  ] })),
8126
8126
  (activeTab === "unmatchedA" || activeTab === "unmatchedB") && (() => {
8127
- var _a2, _b2;
8128
- const items = activeTab === "unmatchedA" ? (_a2 = p.unmatchedA) != null ? _a2 : [] : (_b2 = p.unmatchedB) != null ? _b2 : [];
8127
+ var _a3, _b2;
8128
+ const items = activeTab === "unmatchedA" ? (_a3 = p.unmatchedA) != null ? _a3 : [] : (_b2 = p.unmatchedB) != null ? _b2 : [];
8129
8129
  const sourceLabel = activeTab === "unmatchedA" ? sourceA.label : sourceB.label;
8130
8130
  if (items.length === 0)
8131
8131
  return /* @__PURE__ */ jsx(
@@ -8157,7 +8157,7 @@ function ReconciliationViewResolver(p) {
8157
8157
  )
8158
8158
  ) }) }),
8159
8159
  /* @__PURE__ */ jsx("tbody", { children: items.map((item, ri) => {
8160
- var _a3;
8160
+ var _a4;
8161
8161
  return /* @__PURE__ */ jsxs(
8162
8162
  "tr",
8163
8163
  {
@@ -8249,7 +8249,7 @@ function ReconciliationViewResolver(p) {
8249
8249
  borderBottom: `1px solid ${INNER_BORDER}`,
8250
8250
  letterSpacing: "0.02em"
8251
8251
  },
8252
- children: (_a3 = item.reference) != null ? _a3 : "\u2014"
8252
+ children: (_a4 = item.reference) != null ? _a4 : "\u2014"
8253
8253
  }
8254
8254
  )
8255
8255
  ]
@@ -8323,9 +8323,9 @@ function ChangesView({ changes }) {
8323
8323
  ] }, i)) });
8324
8324
  }
8325
8325
  function EventCard({ event }) {
8326
- var _a;
8326
+ var _a2;
8327
8327
  const [showChanges, setShowChanges] = useState(false);
8328
- const ac = (_a = actionConfig[event.action]) != null ? _a : actionConfig.commented;
8328
+ const ac = (_a2 = actionConfig[event.action]) != null ? _a2 : actionConfig.commented;
8329
8329
  const hasChanges = event.changes && event.changes.length > 0;
8330
8330
  return /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "12px", position: "relative" }, children: [
8331
8331
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", flexShrink: 0 }, children: [
@@ -8369,9 +8369,9 @@ function EventCard({ event }) {
8369
8369
  ] });
8370
8370
  }
8371
8371
  function AuditTrailResolver(p) {
8372
- var _a, _b;
8372
+ var _a2, _b;
8373
8373
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
8374
- const sorted = [...(_a = p.events) != null ? _a : []].sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
8374
+ const sorted = [...(_a2 = p.events) != null ? _a2 : []].sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
8375
8375
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "audit-trail", children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
8376
8376
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
8377
8377
  p.title && /* @__PURE__ */ jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
@@ -8391,12 +8391,12 @@ function useFullscreen(ref) {
8391
8391
  return () => document.removeEventListener("fullscreenchange", handler);
8392
8392
  }, []);
8393
8393
  const enter = useCallback(() => {
8394
- var _a, _b;
8395
- (_b = (_a = ref.current) == null ? void 0 : _a.requestFullscreen) == null ? void 0 : _b.call(_a);
8394
+ var _a2, _b;
8395
+ (_b = (_a2 = ref.current) == null ? void 0 : _a2.requestFullscreen) == null ? void 0 : _b.call(_a2);
8396
8396
  }, [ref]);
8397
8397
  const exit = useCallback(() => {
8398
- var _a;
8399
- if (document.fullscreenElement) (_a = document.exitFullscreen) == null ? void 0 : _a.call(document);
8398
+ var _a2;
8399
+ if (document.fullscreenElement) (_a2 = document.exitFullscreen) == null ? void 0 : _a2.call(document);
8400
8400
  }, []);
8401
8401
  const toggle = useCallback(() => {
8402
8402
  if (isFullscreen) exit();
@@ -8421,8 +8421,8 @@ var highlightColors = {
8421
8421
  blue: { bg: "rgba(29,78,216,0.12)", border: "#1d4ed8" }
8422
8422
  };
8423
8423
  function sanitizeFilename(name) {
8424
- var _a;
8425
- return (_a = name.replace(/\.\.\//g, "").replace(/\.\.\\/g, "").split(/[/\\]/).pop()) != null ? _a : name;
8424
+ var _a2;
8425
+ return (_a2 = name.replace(/\.\.\//g, "").replace(/\.\.\\/g, "").split(/[/\\]/).pop()) != null ? _a2 : name;
8426
8426
  }
8427
8427
  function IconButton({ title, onClick, href, download, children }) {
8428
8428
  const style = {
@@ -8459,12 +8459,12 @@ function DownloadIcon() {
8459
8459
  ] });
8460
8460
  }
8461
8461
  function DocumentPreviewResolver(p) {
8462
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
8462
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
8463
8463
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2 } = useTheme();
8464
8464
  const [currentPage, setCurrentPage] = useState(0);
8465
8465
  const containerRef = useRef(null);
8466
8466
  const { isFullscreen, toggle } = useFullscreen(containerRef);
8467
- const hasRealFile = !!(((_a = p.source) == null ? void 0 : _a.url) || ((_b = p.source) == null ? void 0 : _b.base64));
8467
+ const hasRealFile = !!(((_a2 = p.source) == null ? void 0 : _a2.url) || ((_b = p.source) == null ? void 0 : _b.base64));
8468
8468
  const isPdf = p.documentType === "pdf";
8469
8469
  const isExcel = p.documentType === "excel";
8470
8470
  const totalPages = ((_c = p.pages) != null ? _c : []).length;
@@ -8527,7 +8527,7 @@ function DocumentPreviewResolver(p) {
8527
8527
  href: (_k = (_j = p.source) == null ? void 0 : _j.url) != null ? _k : void 0,
8528
8528
  download: sanitizeFilename((_m = (_l = p.source) == null ? void 0 : _l.filename) != null ? _m : "file"),
8529
8529
  onClick: !((_n = p.source) == null ? void 0 : _n.url) && ((_o = p.source) == null ? void 0 : _o.base64) ? () => {
8530
- var _a2, _b2;
8530
+ var _a3, _b2;
8531
8531
  const mime = isPdf ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
8532
8532
  const binary = atob(p.source.base64);
8533
8533
  const bytes = new Uint8Array(binary.length);
@@ -8535,7 +8535,7 @@ function DocumentPreviewResolver(p) {
8535
8535
  const blob = new Blob([bytes], { type: mime });
8536
8536
  const a = document.createElement("a");
8537
8537
  a.href = URL.createObjectURL(blob);
8538
- a.download = sanitizeFilename((_b2 = (_a2 = p.source) == null ? void 0 : _a2.filename) != null ? _b2 : "file");
8538
+ a.download = sanitizeFilename((_b2 = (_a3 = p.source) == null ? void 0 : _a3.filename) != null ? _b2 : "file");
8539
8539
  a.click();
8540
8540
  URL.revokeObjectURL(a.href);
8541
8541
  } : void 0,
@@ -8590,8 +8590,8 @@ function DocumentPreviewResolver(p) {
8590
8590
  (_u = page == null ? void 0 : page.label) != null ? _u : "this page"
8591
8591
  ] }),
8592
8592
  pageHighlights.length > 0 && /* @__PURE__ */ jsx("div", { style: { padding: "0 20px 20px", display: "flex", flexDirection: "column", gap: "6px" }, children: pageHighlights.map((h, i) => {
8593
- var _a2;
8594
- const hc = (_a2 = highlightColors[h.color]) != null ? _a2 : highlightColors.yellow;
8593
+ var _a3;
8594
+ const hc = (_a3 = highlightColors[h.color]) != null ? _a3 : highlightColors.yellow;
8595
8595
  return /* @__PURE__ */ jsxs("div", { style: { padding: "6px 10px", borderRadius: "4px", background: hc.bg, borderLeft: `3px solid ${hc.border}`, fontSize: "12px" }, children: [
8596
8596
  /* @__PURE__ */ jsx("span", { style: { fontWeight: 600 }, children: h.text }),
8597
8597
  h.note && /* @__PURE__ */ jsxs("span", { style: { color: MUTED2, marginLeft: "8px" }, children: [
@@ -8647,10 +8647,10 @@ function ConfidenceBar({ confidence, height = 6 }) {
8647
8647
  );
8648
8648
  }
8649
8649
  function StepCard({ step, isLast }) {
8650
- var _a;
8650
+ var _a2;
8651
8651
  const [expanded, setExpanded] = useState(false);
8652
8652
  const cfg = stepTypeConfig[step.stepType];
8653
- const detail = (_a = step.detail) != null ? _a : "";
8653
+ const detail = (_a2 = step.detail) != null ? _a2 : "";
8654
8654
  const isLong = detail.length > 100;
8655
8655
  const displayDetail = isLong && !expanded ? detail.slice(0, 100) + "..." : detail;
8656
8656
  const metaEntries = step.metadata ? Object.entries(step.metadata) : [];
@@ -8781,9 +8781,9 @@ function statusColor(status) {
8781
8781
  }
8782
8782
  }
8783
8783
  function ProvenanceChainResolver(p) {
8784
- var _a, _b, _c, _d;
8784
+ var _a2, _b, _c, _d;
8785
8785
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
8786
- const steps = (_a = p.steps) != null ? _a : [];
8786
+ const steps = (_a2 = p.steps) != null ? _a2 : [];
8787
8787
  const stepsWithConf = steps.filter((s) => s.confidence != null && s.confidence > 0);
8788
8788
  const derivedConfidence = stepsWithConf.length > 0 ? stepsWithConf.reduce((sum, s) => sum + s.confidence, 0) / stepsWithConf.length : 0;
8789
8789
  const raw = (_b = p.conclusion) != null ? _b : { status: "not-qualified", value: "", confidence: 0 };
@@ -8934,8 +8934,8 @@ function highlightSnippet(snippet, highlights) {
8934
8934
  });
8935
8935
  }
8936
8936
  function ResultCard({ result, isLast }) {
8937
- var _a;
8938
- const badge = result.sourceType ? (_a = badgeColors[result.sourceType]) != null ? _a : badgeColors.other : null;
8937
+ var _a2;
8938
+ const badge = result.sourceType ? (_a2 = badgeColors[result.sourceType]) != null ? _a2 : badgeColors.other : null;
8939
8939
  const pct = Math.round(result.relevance * 100);
8940
8940
  const titleEl = /* @__PURE__ */ jsx("span", { style: { fontSize: "13px", fontWeight: 700, color: "var(--foreground)" }, children: result.title });
8941
8941
  return /* @__PURE__ */ jsxs(
@@ -9026,9 +9026,9 @@ function ResultCard({ result, isLast }) {
9026
9026
  );
9027
9027
  }
9028
9028
  function SearchResultsResolver(p) {
9029
- var _a, _b, _c, _d, _e, _f;
9029
+ var _a2, _b, _c, _d, _e, _f;
9030
9030
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
9031
- return /* @__PURE__ */ jsx(ComponentActions, { filename: (_a = p.title) != null ? _a : "search-results", children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
9031
+ return /* @__PURE__ */ jsx(ComponentActions, { filename: (_a2 = p.title) != null ? _a2 : "search-results", children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
9032
9032
  /* @__PURE__ */ jsx(
9033
9033
  "p",
9034
9034
  {
@@ -9064,8 +9064,8 @@ function SearchResultsResolver(p) {
9064
9064
  background: "white"
9065
9065
  },
9066
9066
  children: ((_f = p.results) != null ? _f : []).map((result, i) => {
9067
- var _a2;
9068
- return /* @__PURE__ */ jsx(ResultCard, { result, isLast: i === ((_a2 = p.results) != null ? _a2 : []).length - 1 }, i);
9067
+ var _a3;
9068
+ return /* @__PURE__ */ jsx(ResultCard, { result, isLast: i === ((_a3 = p.results) != null ? _a3 : []).length - 1 }, i);
9069
9069
  })
9070
9070
  }
9071
9071
  )
@@ -9082,8 +9082,8 @@ var resultConfig = {
9082
9082
  na: { color: MUTED, bg: "#f2f2f2", label: "N/A" }
9083
9083
  };
9084
9084
  function ResultBadge({ result, size = "normal" }) {
9085
- var _a;
9086
- const cfg = (_a = resultConfig[result]) != null ? _a : resultConfig.na;
9085
+ var _a2;
9086
+ const cfg = (_a2 = resultConfig[result]) != null ? _a2 : resultConfig.na;
9087
9087
  const isNormal = size === "normal";
9088
9088
  return /* @__PURE__ */ jsx(
9089
9089
  "span",
@@ -9215,9 +9215,9 @@ function PartSection({ part, defaultOpen }) {
9215
9215
  ] });
9216
9216
  }
9217
9217
  function LegalTestResultResolver(p) {
9218
- var _a, _b;
9218
+ var _a2, _b;
9219
9219
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, PAPER: PAPER2 } = useTheme();
9220
- return /* @__PURE__ */ jsx(ComponentActions, { filename: (_a = p.title) != null ? _a : "legal-test-result", children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
9220
+ return /* @__PURE__ */ jsx(ComponentActions, { filename: (_a2 = p.title) != null ? _a2 : "legal-test-result", children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
9221
9221
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px", flexWrap: "wrap" }, children: [
9222
9222
  p.title && /* @__PURE__ */ jsx(
9223
9223
  "span",
@@ -9277,9 +9277,9 @@ function lineColor(left, right) {
9277
9277
  return "#d6d3d1";
9278
9278
  }
9279
9279
  function EngagementPipelineResolver(p) {
9280
- var _a, _b, _c, _d, _e;
9280
+ var _a2, _b, _c, _d, _e;
9281
9281
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
9282
- const phases = (_a = p.phases) != null ? _a : [];
9282
+ const phases = (_a2 = p.phases) != null ? _a2 : [];
9283
9283
  const defaultActive = phases.findIndex(
9284
9284
  (ph) => ph.status === "in-progress" || ph.status === "blocked"
9285
9285
  );
@@ -9363,8 +9363,8 @@ function EngagementPipelineResolver(p) {
9363
9363
  overflow: "auto"
9364
9364
  },
9365
9365
  children: ((_d = p.phases) != null ? _d : []).map((phase, i) => {
9366
- var _a2;
9367
- const color = (_a2 = statusColor2[phase.status]) != null ? _a2 : "#d6d3d1";
9366
+ var _a3;
9367
+ const color = (_a3 = statusColor2[phase.status]) != null ? _a3 : "#d6d3d1";
9368
9368
  const isCurrent = i === activeIdx;
9369
9369
  const size = isCurrent ? 28 : 20;
9370
9370
  return /* @__PURE__ */ jsxs(React41.Fragment, { children: [
@@ -9672,10 +9672,10 @@ function Avatar({ name, avatar, hovered }) {
9672
9672
  );
9673
9673
  }
9674
9674
  function EntityCardGridResolver(p) {
9675
- var _a, _b;
9675
+ var _a2, _b;
9676
9676
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
9677
9677
  const [hoveredId, setHoveredId] = useState(null);
9678
- return /* @__PURE__ */ jsx(ComponentActions, { filename: (_a = p.title) != null ? _a : "entity-card-grid", children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
9678
+ return /* @__PURE__ */ jsx(ComponentActions, { filename: (_a2 = p.title) != null ? _a2 : "entity-card-grid", children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
9679
9679
  p.title && /* @__PURE__ */ jsx(
9680
9680
  "p",
9681
9681
  {
@@ -9755,8 +9755,8 @@ function EntityCardGridResolver(p) {
9755
9755
  ] })
9756
9756
  ] }),
9757
9757
  item.badges && item.badges.length > 0 && /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: item.badges.map((badge, i) => {
9758
- var _a2, _b2;
9759
- const c = (_b2 = BADGE_COLORS[(_a2 = badge.color) != null ? _a2 : "gray"]) != null ? _b2 : BADGE_COLORS.gray;
9758
+ var _a3, _b2;
9759
+ const c = (_b2 = BADGE_COLORS[(_a3 = badge.color) != null ? _a3 : "gray"]) != null ? _b2 : BADGE_COLORS.gray;
9760
9760
  return /* @__PURE__ */ jsx(
9761
9761
  "span",
9762
9762
  {
@@ -9868,8 +9868,8 @@ function formatTime(ts) {
9868
9868
  }
9869
9869
  }
9870
9870
  function StepRow({ step }) {
9871
- var _a, _b, _c;
9872
- const color = (_a = stepStatusColors[step.status]) != null ? _a : MUTED;
9871
+ var _a2, _b, _c;
9872
+ const color = (_a2 = stepStatusColors[step.status]) != null ? _a2 : MUTED;
9873
9873
  return /* @__PURE__ */ jsxs(
9874
9874
  "div",
9875
9875
  {
@@ -9928,10 +9928,10 @@ function StepRow({ step }) {
9928
9928
  );
9929
9929
  }
9930
9930
  function JobTrackerResolver(p) {
9931
- var _a, _b, _c, _d, _e, _f, _g;
9931
+ var _a2, _b, _c, _d, _e, _f, _g;
9932
9932
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, PAPER: PAPER2 } = useTheme();
9933
9933
  const [stepsOpen, setStepsOpen] = useState(true);
9934
- const barColor = (_a = statusColors2[p.status]) != null ? _a : MUTED2;
9934
+ const barColor = (_a2 = statusColors2[p.status]) != null ? _a2 : MUTED2;
9935
9935
  const badge = (_b = statusBadgeConfig[p.status]) != null ? _b : statusBadgeConfig.queued;
9936
9936
  const progress = (_c = p.progress) != null ? _c : p.status === "completed" ? 100 : 0;
9937
9937
  return /* @__PURE__ */ jsxs(ComponentActions, { filename: (_d = p.title) != null ? _d : "job-tracker", children: [
@@ -10199,8 +10199,8 @@ var sourceTypeColors = {
10199
10199
  workpaper: { bg: "#fff7ed", color: "#f59e0b" }
10200
10200
  };
10201
10201
  function getSourceTypeBadgeStyle(sourceType) {
10202
- var _a;
10203
- const entry = (_a = sourceTypeColors[sourceType]) != null ? _a : { bg: "#f2f2f2", color: MUTED };
10202
+ var _a2;
10203
+ const entry = (_a2 = sourceTypeColors[sourceType]) != null ? _a2 : { bg: "#f2f2f2", color: MUTED };
10204
10204
  return {
10205
10205
  display: "inline-block",
10206
10206
  fontSize: "9px",
@@ -10422,7 +10422,7 @@ function CitationMarker({
10422
10422
  );
10423
10423
  }
10424
10424
  function CitedAnswerResolver(p) {
10425
- var _a, _b, _c, _d, _e;
10425
+ var _a2, _b, _c, _d, _e;
10426
10426
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, SECONDARY: SECONDARY2 } = useTheme();
10427
10427
  const [expandedIds, setExpandedIds] = useState(/* @__PURE__ */ new Set());
10428
10428
  const toggleCitation = (id) => {
@@ -10437,7 +10437,7 @@ function CitedAnswerResolver(p) {
10437
10437
  });
10438
10438
  };
10439
10439
  const parts = parseAnswer(p.answer, p.citations);
10440
- return /* @__PURE__ */ jsx(ComponentActions, { filename: (_a = p.title) != null ? _a : "cited-answer", children: /* @__PURE__ */ jsxs(
10440
+ return /* @__PURE__ */ jsx(ComponentActions, { filename: (_a2 = p.title) != null ? _a2 : "cited-answer", children: /* @__PURE__ */ jsxs(
10441
10441
  "div",
10442
10442
  {
10443
10443
  style: {
@@ -10555,8 +10555,8 @@ var CURRENCY_SYMBOLS = {
10555
10555
  BRL: "R$"
10556
10556
  };
10557
10557
  function getCurrencySymbol(currency) {
10558
- var _a;
10559
- return (_a = CURRENCY_SYMBOLS[currency.toUpperCase()]) != null ? _a : currency + " ";
10558
+ var _a2;
10559
+ return (_a2 = CURRENCY_SYMBOLS[currency.toUpperCase()]) != null ? _a2 : currency + " ";
10560
10560
  }
10561
10561
  function formatAmount(amount, currency) {
10562
10562
  const sym = getCurrencySymbol(currency);
@@ -10725,9 +10725,9 @@ function formatSummaryAmount(amount, currency) {
10725
10725
  return `${sym}${formatted}`;
10726
10726
  }
10727
10727
  function TransactionFeedResolver(p) {
10728
- var _a, _b, _c, _d, _e;
10728
+ var _a2, _b, _c, _d, _e;
10729
10729
  const { BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
10730
- const currency = (_a = p.currency) != null ? _a : "USD";
10730
+ const currency = (_a2 = p.currency) != null ? _a2 : "USD";
10731
10731
  const [hoveredIndex, setHoveredIndex] = useState(null);
10732
10732
  const hasBalance = ((_b = p.transactions) != null ? _b : []).some((tx) => tx.balance != null);
10733
10733
  const totalInflows = p.transactions.filter((tx) => tx.amount > 0 && tx.status !== "reversed").reduce((sum, tx) => sum + tx.amount, 0);
@@ -10742,11 +10742,11 @@ function TransactionFeedResolver(p) {
10742
10742
  { key: "balance", label: "Balance" }
10743
10743
  ];
10744
10744
  const csvRows = ((_c = p.transactions) != null ? _c : []).map((tx) => {
10745
- var _a2, _b2, _c2;
10745
+ var _a3, _b2, _c2;
10746
10746
  return {
10747
10747
  date: tx.date,
10748
10748
  description: tx.description,
10749
- counterparty: (_a2 = tx.counterparty) != null ? _a2 : "",
10749
+ counterparty: (_a3 = tx.counterparty) != null ? _a3 : "",
10750
10750
  category: (_b2 = tx.category) != null ? _b2 : "",
10751
10751
  amount: tx.amount,
10752
10752
  balance: (_c2 = tx.balance) != null ? _c2 : ""
@@ -10764,8 +10764,8 @@ function TransactionFeedResolver(p) {
10764
10764
  {
10765
10765
  filename: (_d = p.title) != null ? _d : "transaction-feed",
10766
10766
  onDownloadCSV: () => {
10767
- var _a2;
10768
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "transaction-feed");
10767
+ var _a3;
10768
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "transaction-feed");
10769
10769
  },
10770
10770
  children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
10771
10771
  p.title && /* @__PURE__ */ jsx(
@@ -10803,7 +10803,7 @@ function TransactionFeedResolver(p) {
10803
10803
  }
10804
10804
  ),
10805
10805
  /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, children: ((_e = p.transactions) != null ? _e : []).map((tx, i) => {
10806
- var _a2;
10806
+ var _a3;
10807
10807
  return /* @__PURE__ */ jsx(
10808
10808
  TransactionRow,
10809
10809
  {
@@ -10813,7 +10813,7 @@ function TransactionFeedResolver(p) {
10813
10813
  onMouseEnter: () => setHoveredIndex(i),
10814
10814
  onMouseLeave: () => setHoveredIndex(null)
10815
10815
  },
10816
- (_a2 = tx.id) != null ? _a2 : i
10816
+ (_a3 = tx.id) != null ? _a3 : i
10817
10817
  );
10818
10818
  }) }),
10819
10819
  /* @__PURE__ */ jsxs(
@@ -10870,10 +10870,10 @@ var docTypeConfig = {
10870
10870
  csv: { label: "CSV", color: "#7c3aed", bg: "#f5f3ff" }
10871
10871
  };
10872
10872
  function getDocConfig(docType) {
10873
- var _a;
10873
+ var _a2;
10874
10874
  if (!docType) return { label: "FILE", color: MUTED, bg: "#f2f2f2" };
10875
10875
  const key = docType.toLowerCase().replace(/^\./, "");
10876
- return (_a = docTypeConfig[key]) != null ? _a : { label: key.toUpperCase().slice(0, 4), color: MUTED, bg: "#f2f2f2" };
10876
+ return (_a2 = docTypeConfig[key]) != null ? _a2 : { label: key.toUpperCase().slice(0, 4), color: MUTED, bg: "#f2f2f2" };
10877
10877
  }
10878
10878
  function formatDate2(dateStr) {
10879
10879
  if (!dateStr) return "";
@@ -10884,7 +10884,7 @@ function formatDate2(dateStr) {
10884
10884
  }
10885
10885
  }
10886
10886
  function FileRow({ item }) {
10887
- var _a;
10887
+ var _a2;
10888
10888
  const [hovered, setHovered] = useState(false);
10889
10889
  const cfg = getDocConfig(item.docType);
10890
10890
  return /* @__PURE__ */ jsxs(
@@ -10955,7 +10955,7 @@ function FileRow({ item }) {
10955
10955
  ] }),
10956
10956
  item.author && /* @__PURE__ */ jsx("span", { style: { fontSize: "11px", color: MUTED, flexShrink: 0, maxWidth: "100px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: item.author }),
10957
10957
  item.size && /* @__PURE__ */ jsx("span", { style: { fontSize: "11px", color: MUTED, flexShrink: 0, minWidth: "50px", textAlign: "right" }, children: item.size }),
10958
- (item.modifiedAt || item.createdAt) && /* @__PURE__ */ jsx("span", { style: { fontSize: "11px", color: MUTED, flexShrink: 0, minWidth: "80px", textAlign: "right" }, children: formatDate2((_a = item.modifiedAt) != null ? _a : item.createdAt) })
10958
+ (item.modifiedAt || item.createdAt) && /* @__PURE__ */ jsx("span", { style: { fontSize: "11px", color: MUTED, flexShrink: 0, minWidth: "80px", textAlign: "right" }, children: formatDate2((_a2 = item.modifiedAt) != null ? _a2 : item.createdAt) })
10959
10959
  ]
10960
10960
  }
10961
10961
  );
@@ -11001,15 +11001,15 @@ function GroupSection({ groupName, items }) {
11001
11001
  }
11002
11002
  ),
11003
11003
  open && items.map((item, i) => {
11004
- var _a;
11005
- return /* @__PURE__ */ jsx(FileRow, { item }, (_a = item.id) != null ? _a : i);
11004
+ var _a2;
11005
+ return /* @__PURE__ */ jsx(FileRow, { item }, (_a2 = item.id) != null ? _a2 : i);
11006
11006
  })
11007
11007
  ] });
11008
11008
  }
11009
11009
  function FileBrowserResolver(p) {
11010
- var _a, _b, _c, _d;
11010
+ var _a2, _b, _c, _d;
11011
11011
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, PAPER: PAPER2 } = useTheme();
11012
- const items = (_a = p.items) != null ? _a : [];
11012
+ const items = (_a2 = p.items) != null ? _a2 : [];
11013
11013
  const hasGroups = items.some((item) => item.group);
11014
11014
  const groups = /* @__PURE__ */ new Map();
11015
11015
  if (hasGroups) {
@@ -11062,8 +11062,8 @@ function FileBrowserResolver(p) {
11062
11062
  fontSize: "13px",
11063
11063
  color: MUTED2
11064
11064
  }, children: "No files" }) : hasGroups ? Array.from(groups.entries()).map(([groupName, items2]) => /* @__PURE__ */ jsx(GroupSection, { groupName, items: items2 }, groupName)) : items.map((item, i) => {
11065
- var _a2;
11066
- return /* @__PURE__ */ jsx(FileRow, { item }, (_a2 = item.id) != null ? _a2 : i);
11065
+ var _a3;
11066
+ return /* @__PURE__ */ jsx(FileRow, { item }, (_a3 = item.id) != null ? _a3 : i);
11067
11067
  })
11068
11068
  ] })
11069
11069
  ] }) });
@@ -11107,7 +11107,7 @@ var PREVIEW_EXTS = {
11107
11107
  docx: "docx"
11108
11108
  };
11109
11109
  function extOf(fileType, filename) {
11110
- var _a;
11110
+ var _a2;
11111
11111
  if (fileType && fileType.includes("/")) {
11112
11112
  const mime = fileType.toLowerCase();
11113
11113
  if (mime.includes("pdf")) return "pdf";
@@ -11120,11 +11120,11 @@ function extOf(fileType, filename) {
11120
11120
  const t = fileType.toLowerCase().replace(/[^a-z0-9]/g, "");
11121
11121
  if (t) return t;
11122
11122
  }
11123
- return ((_a = (filename || "").split(".").pop()) == null ? void 0 : _a.toLowerCase().replace(/[^a-z0-9]/g, "")) || "";
11123
+ return ((_a2 = (filename || "").split(".").pop()) == null ? void 0 : _a2.toLowerCase().replace(/[^a-z0-9]/g, "")) || "";
11124
11124
  }
11125
11125
  function previewKindFor(fileType, filename) {
11126
- var _a;
11127
- return (_a = PREVIEW_EXTS[extOf(fileType, filename)]) != null ? _a : null;
11126
+ var _a2;
11127
+ return (_a2 = PREVIEW_EXTS[extOf(fileType, filename)]) != null ? _a2 : null;
11128
11128
  }
11129
11129
  function isPreviewable(fileType, filename) {
11130
11130
  return previewKindFor(fileType, filename) !== null;
@@ -11702,8 +11702,8 @@ function Chevron({ open }) {
11702
11702
  );
11703
11703
  }
11704
11704
  function DownloadCardResolver(p) {
11705
- var _a, _b;
11706
- const files = (_a = p.files) != null ? _a : [];
11705
+ var _a2, _b;
11706
+ const files = (_a2 = p.files) != null ? _a2 : [];
11707
11707
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "download-card", children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
11708
11708
  p.title && /* @__PURE__ */ jsx(
11709
11709
  "p",
@@ -11875,10 +11875,10 @@ function ServiceCard({ item, isHovered, onHover, onLeave: onLeave2 }) {
11875
11875
  );
11876
11876
  }
11877
11877
  function OpsDashboardResolver(p) {
11878
- var _a, _b, _c;
11878
+ var _a2, _b, _c;
11879
11879
  const { BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
11880
11880
  const [hoveredId, setHoveredId] = useState(null);
11881
- const hasRunning = ((_a = p.items) != null ? _a : []).some((item) => item.state === "running");
11881
+ const hasRunning = ((_a2 = p.items) != null ? _a2 : []).some((item) => item.state === "running");
11882
11882
  return /* @__PURE__ */ jsxs(ComponentActions, { filename: (_b = p.title) != null ? _b : "ops-dashboard", children: [
11883
11883
  hasRunning && /* @__PURE__ */ jsx("style", { children: PULSE_KEYFRAMES }),
11884
11884
  /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
@@ -11962,8 +11962,8 @@ function CopyButton({ value, rowHovered }) {
11962
11962
  );
11963
11963
  }
11964
11964
  function ValueCell({ item }) {
11965
- var _a, _b;
11966
- const t = (_a = item.type) != null ? _a : "text";
11965
+ var _a2, _b;
11966
+ const t = (_a2 = item.type) != null ? _a2 : "text";
11967
11967
  switch (t) {
11968
11968
  case "url":
11969
11969
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -12070,9 +12070,9 @@ function ItemsList({ items, isLastGroup, indexOffset }) {
12070
12070
  )) });
12071
12071
  }
12072
12072
  function KeyValueListResolver(p) {
12073
- var _a, _b, _c;
12073
+ var _a2, _b, _c;
12074
12074
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, SECONDARY: SECONDARY2 } = useTheme();
12075
- const groups = (_a = p.groups) != null ? _a : [];
12075
+ const groups = (_a2 = p.groups) != null ? _a2 : [];
12076
12076
  const items = (_b = p.items) != null ? _b : [];
12077
12077
  const hasGroups = groups.length > 0;
12078
12078
  const hasItems = items.length > 0;
@@ -12101,12 +12101,12 @@ function KeyValueListResolver(p) {
12101
12101
  },
12102
12102
  children: [
12103
12103
  hasGroups && groups.map((group, gi) => {
12104
- var _a2;
12105
- const groupItems = (_a2 = group.items) != null ? _a2 : [];
12104
+ var _a3;
12105
+ const groupItems = (_a3 = group.items) != null ? _a3 : [];
12106
12106
  const isLastGroup = gi === groups.length - 1 && !hasItems;
12107
12107
  const prevItemCount = groups.slice(0, gi).reduce((sum, g) => {
12108
- var _a3;
12109
- return sum + ((_a3 = g.items) != null ? _a3 : []).length;
12108
+ var _a4;
12109
+ return sum + ((_a4 = g.items) != null ? _a4 : []).length;
12110
12110
  }, 0);
12111
12111
  return /* @__PURE__ */ jsxs(React41.Fragment, { children: [
12112
12112
  /* @__PURE__ */ jsxs(
@@ -12141,8 +12141,8 @@ function KeyValueListResolver(p) {
12141
12141
  ] }, gi);
12142
12142
  }),
12143
12143
  hasItems && /* @__PURE__ */ jsx(ItemsList, { items, isLastGroup: true, indexOffset: hasGroups ? groups.reduce((sum, g) => {
12144
- var _a2;
12145
- return sum + ((_a2 = g.items) != null ? _a2 : []).length;
12144
+ var _a3;
12145
+ return sum + ((_a3 = g.items) != null ? _a3 : []).length;
12146
12146
  }, 0) : 0 })
12147
12147
  ]
12148
12148
  }
@@ -12160,24 +12160,24 @@ var categoryLabels2 = {
12160
12160
  function computeSectionTotal(section) {
12161
12161
  if (section.total) return section.total;
12162
12162
  const currentPeriod = section.subsections.reduce((sum, sub) => {
12163
- var _a, _b, _c;
12164
- return sum + ((_c = (_a = sub.subtotal) == null ? void 0 : _a.currentPeriod) != null ? _c : ((_b = sub.items) != null ? _b : []).reduce((s, i) => s + i.currentPeriod, 0));
12163
+ var _a2, _b, _c;
12164
+ return sum + ((_c = (_a2 = sub.subtotal) == null ? void 0 : _a2.currentPeriod) != null ? _c : ((_b = sub.items) != null ? _b : []).reduce((s, i) => s + i.currentPeriod, 0));
12165
12165
  }, 0);
12166
12166
  const priorPeriod = section.subsections.reduce((sum, sub) => {
12167
- var _a, _b, _c;
12168
- return sum + ((_c = (_a = sub.subtotal) == null ? void 0 : _a.priorPeriod) != null ? _c : ((_b = sub.items) != null ? _b : []).reduce((s, i) => {
12169
- var _a2;
12170
- return s + ((_a2 = i.priorPeriod) != null ? _a2 : 0);
12167
+ var _a2, _b, _c;
12168
+ return sum + ((_c = (_a2 = sub.subtotal) == null ? void 0 : _a2.priorPeriod) != null ? _c : ((_b = sub.items) != null ? _b : []).reduce((s, i) => {
12169
+ var _a3;
12170
+ return s + ((_a3 = i.priorPeriod) != null ? _a3 : 0);
12171
12171
  }, 0));
12172
12172
  }, 0);
12173
12173
  return { currentPeriod, priorPeriod: priorPeriod || void 0 };
12174
12174
  }
12175
12175
  function BalanceSheetResolver(p) {
12176
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
12176
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
12177
12177
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
12178
12178
  const hasPrior = !!p.priorPeriodLabel;
12179
12179
  const colSpan = hasPrior ? 3 : 2;
12180
- const sectionTotals = new Map(((_a = p.sections) != null ? _a : []).map((s) => [s.category, computeSectionTotal(s)]));
12180
+ const sectionTotals = new Map(((_a2 = p.sections) != null ? _a2 : []).map((s) => [s.category, computeSectionTotal(s)]));
12181
12181
  const assetsTotal = (_c = (_b = sectionTotals.get("assets")) == null ? void 0 : _b.currentPeriod) != null ? _c : 0;
12182
12182
  let leTotal;
12183
12183
  if (p.totalLiabilitiesAndEquity) {
@@ -12196,22 +12196,22 @@ function BalanceSheetResolver(p) {
12196
12196
  const csvRows = ((_j = p.sections) != null ? _j : []).flatMap(
12197
12197
  (section) => section.subsections.flatMap(
12198
12198
  (sub) => {
12199
- var _a2;
12200
- return ((_a2 = sub.items) != null ? _a2 : []).map((item) => {
12201
- var _a3;
12199
+ var _a3;
12200
+ return ((_a3 = sub.items) != null ? _a3 : []).map((item) => {
12201
+ var _a4;
12202
12202
  return __spreadValues({
12203
12203
  category: section.category,
12204
12204
  subsection: sub.label,
12205
12205
  name: item.name,
12206
12206
  currentPeriod: item.currentPeriod
12207
- }, hasPrior ? { priorPeriod: (_a3 = item.priorPeriod) != null ? _a3 : "" } : {});
12207
+ }, hasPrior ? { priorPeriod: (_a4 = item.priorPeriod) != null ? _a4 : "" } : {});
12208
12208
  });
12209
12209
  }
12210
12210
  )
12211
12211
  );
12212
12212
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_k = p.title) != null ? _k : "balance-sheet", onDownloadCSV: () => {
12213
- var _a2;
12214
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "balance-sheet");
12213
+ var _a3;
12214
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "balance-sheet");
12215
12215
  }, children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
12216
12216
  p.metadata && /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "2px", position: "relative" }, children: [
12217
12217
  p.metadata.status && /* @__PURE__ */ jsx("span", { style: {
@@ -12285,7 +12285,7 @@ function BalanceSheetResolver(p) {
12285
12285
  ] }) }),
12286
12286
  /* @__PURE__ */ jsxs("tbody", { children: [
12287
12287
  ((_p = p.sections) != null ? _p : []).map((section) => {
12288
- var _a2;
12288
+ var _a3;
12289
12289
  return /* @__PURE__ */ jsxs(React41.Fragment, { children: [
12290
12290
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan, style: {
12291
12291
  padding: "8px 12px",
@@ -12296,9 +12296,9 @@ function BalanceSheetResolver(p) {
12296
12296
  borderBottom: `1px solid ${BORDER4}`,
12297
12297
  textTransform: "uppercase",
12298
12298
  letterSpacing: "0.04em"
12299
- }, children: (_a2 = categoryLabels2[section.category]) != null ? _a2 : section.category }) }),
12299
+ }, children: (_a3 = categoryLabels2[section.category]) != null ? _a3 : section.category }) }),
12300
12300
  section.subsections.map((sub, si) => {
12301
- var _a3;
12301
+ var _a4;
12302
12302
  return /* @__PURE__ */ jsxs(React41.Fragment, { children: [
12303
12303
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan, style: {
12304
12304
  padding: "6px 10px 6px 24px",
@@ -12307,7 +12307,7 @@ function BalanceSheetResolver(p) {
12307
12307
  color: "var(--foreground)",
12308
12308
  borderBottom: `1px solid #f2f2f2`
12309
12309
  }, children: sub.label }) }),
12310
- ((_a3 = sub.items) != null ? _a3 : []).map((item, ii) => /* @__PURE__ */ jsxs("tr", { style: { background: "white" }, children: [
12310
+ ((_a4 = sub.items) != null ? _a4 : []).map((item, ii) => /* @__PURE__ */ jsxs("tr", { style: { background: "white" }, children: [
12311
12311
  /* @__PURE__ */ jsx("td", { style: { padding: "6px 10px 6px 40px", fontSize: "13px", color: "var(--foreground)", borderBottom: `1px solid #f2f2f2` }, children: item.name }),
12312
12312
  /* @__PURE__ */ jsx("td", { style: { padding: "6px 10px", fontSize: "13px", fontVariantNumeric: "tabular-nums", textAlign: "right", borderBottom: `1px solid #f2f2f2` }, children: item.currentPeriod !== 0 ? fmt7(item.currentPeriod, p.currency) : "\u2014" }),
12313
12313
  hasPrior && /* @__PURE__ */ jsx("td", { style: { padding: "6px 10px", fontSize: "13px", fontVariantNumeric: "tabular-nums", textAlign: "right", borderBottom: `1px solid #f2f2f2` }, children: item.priorPeriod != null && item.priorPeriod !== 0 ? fmt7(item.priorPeriod, p.currency) : "\u2014" })
@@ -12323,12 +12323,12 @@ function BalanceSheetResolver(p) {
12323
12323
  ] }, si);
12324
12324
  }),
12325
12325
  (() => {
12326
- var _a3;
12326
+ var _a4;
12327
12327
  const total = sectionTotals.get(section.category);
12328
12328
  return /* @__PURE__ */ jsxs("tr", { style: { background: PAPER2 }, children: [
12329
12329
  /* @__PURE__ */ jsxs("td", { style: { padding: "8px 10px", fontSize: "12px", fontWeight: 600, borderTop: `1px solid ${BORDER4}`, borderBottom: `1px solid ${BORDER4}` }, children: [
12330
12330
  "Total ",
12331
- (_a3 = categoryLabels2[section.category]) != null ? _a3 : section.category
12331
+ (_a4 = categoryLabels2[section.category]) != null ? _a4 : section.category
12332
12332
  ] }),
12333
12333
  /* @__PURE__ */ jsx("td", { style: { padding: "8px 10px", fontSize: "12px", fontWeight: 600, textAlign: "right", fontVariantNumeric: "tabular-nums", borderTop: `1px solid ${BORDER4}`, borderBottom: `1px solid ${BORDER4}` }, children: fmt7(total.currentPeriod, p.currency) }),
12334
12334
  hasPrior && /* @__PURE__ */ jsx("td", { style: { padding: "8px 10px", fontSize: "12px", fontWeight: 600, textAlign: "right", fontVariantNumeric: "tabular-nums", borderTop: `1px solid ${BORDER4}`, borderBottom: `1px solid ${BORDER4}` }, children: total.priorPeriod != null ? fmt7(total.priorPeriod, p.currency) : "\u2014" })
@@ -12358,23 +12358,23 @@ var pctFmt2 = (amount, revenue) => {
12358
12358
  return `${(amount / revenue * 100).toFixed(1)}%`;
12359
12359
  };
12360
12360
  function IncomeStatementResolver(p) {
12361
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
12361
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
12362
12362
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
12363
- const currency = (_a = p.currency) != null ? _a : "USD";
12363
+ const currency = (_a2 = p.currency) != null ? _a2 : "USD";
12364
12364
  const periods = (_b = p.periods) != null ? _b : [];
12365
12365
  const sections = (_c = p.sections) != null ? _c : [];
12366
12366
  const calculatedTotals = (_d = p.calculatedTotals) != null ? _d : {};
12367
12367
  const showPct = (_e = p.showPercentOfRevenue) != null ? _e : false;
12368
12368
  const isTotalRow = (li) => {
12369
- var _a2;
12370
- return li.isSubtotal === true || /^\s*(total|subtotal)\b/i.test((_a2 = li.name) != null ? _a2 : "");
12369
+ var _a3;
12370
+ return li.isSubtotal === true || /^\s*(total|subtotal)\b/i.test((_a3 = li.name) != null ? _a3 : "");
12371
12371
  };
12372
12372
  const revenueTotals = periods.map(
12373
12373
  (_, pi) => {
12374
- var _a2, _b2, _c2;
12375
- return (_c2 = ((_b2 = (_a2 = sections[0]) == null ? void 0 : _a2.lineItems) != null ? _b2 : []).filter((li) => !isTotalRow(li)).reduce((sum, li) => {
12376
- var _a3, _b3;
12377
- return sum + ((_b3 = ((_a3 = li.amounts) != null ? _a3 : [])[pi]) != null ? _b3 : 0);
12374
+ var _a3, _b2, _c2;
12375
+ return (_c2 = ((_b2 = (_a3 = sections[0]) == null ? void 0 : _a3.lineItems) != null ? _b2 : []).filter((li) => !isTotalRow(li)).reduce((sum, li) => {
12376
+ var _a4, _b3;
12377
+ return sum + ((_b3 = ((_a4 = li.amounts) != null ? _a4 : [])[pi]) != null ? _b3 : 0);
12378
12378
  }, 0)) != null ? _c2 : 0;
12379
12379
  }
12380
12380
  );
@@ -12388,8 +12388,8 @@ function IncomeStatementResolver(p) {
12388
12388
  for (const li of (_f = section.lineItems) != null ? _f : []) {
12389
12389
  const row = { section: section.label, name: li.name };
12390
12390
  periods.forEach((period, pi) => {
12391
- var _a2, _b2;
12392
- row[period] = (_b2 = ((_a2 = li.amounts) != null ? _a2 : [])[pi]) != null ? _b2 : 0;
12391
+ var _a3, _b2;
12392
+ row[period] = (_b2 = ((_a3 = li.amounts) != null ? _a3 : [])[pi]) != null ? _b2 : 0;
12393
12393
  });
12394
12394
  csvRows.push(row);
12395
12395
  }
@@ -12398,13 +12398,13 @@ function IncomeStatementResolver(p) {
12398
12398
  const operatingIncome = calculatedTotals.operatingIncome;
12399
12399
  const rawNetIncome = calculatedTotals.netIncome;
12400
12400
  const netIncome = rawNetIncome && rawNetIncome.length > 0 ? rawNetIncome : periods.map((_, pi) => {
12401
- var _a2;
12401
+ var _a3;
12402
12402
  let total = 0;
12403
12403
  for (const section of sections) {
12404
- const sectionSum = ((_a2 = section.lineItems) != null ? _a2 : []).reduce(
12404
+ const sectionSum = ((_a3 = section.lineItems) != null ? _a3 : []).reduce(
12405
12405
  (s, li) => {
12406
- var _a3, _b2;
12407
- return s + ((_b2 = ((_a3 = li.amounts) != null ? _a3 : [])[pi]) != null ? _b2 : 0);
12406
+ var _a4, _b2;
12407
+ return s + ((_b2 = ((_a4 = li.amounts) != null ? _a4 : [])[pi]) != null ? _b2 : 0);
12408
12408
  },
12409
12409
  0
12410
12410
  );
@@ -12415,31 +12415,31 @@ function IncomeStatementResolver(p) {
12415
12415
  if (grossProfit) {
12416
12416
  const row = { section: "", name: "GROSS PROFIT" };
12417
12417
  periods.forEach((period, pi) => {
12418
- var _a2;
12419
- row[period] = (_a2 = grossProfit[pi]) != null ? _a2 : 0;
12418
+ var _a3;
12419
+ row[period] = (_a3 = grossProfit[pi]) != null ? _a3 : 0;
12420
12420
  });
12421
12421
  csvRows.push(row);
12422
12422
  }
12423
12423
  if (operatingIncome) {
12424
12424
  const row = { section: "", name: "OPERATING INCOME" };
12425
12425
  periods.forEach((period, pi) => {
12426
- var _a2;
12427
- row[period] = (_a2 = operatingIncome[pi]) != null ? _a2 : 0;
12426
+ var _a3;
12427
+ row[period] = (_a3 = operatingIncome[pi]) != null ? _a3 : 0;
12428
12428
  });
12429
12429
  csvRows.push(row);
12430
12430
  }
12431
12431
  {
12432
12432
  const row = { section: "", name: "NET INCOME" };
12433
12433
  periods.forEach((period, pi) => {
12434
- var _a2;
12435
- row[period] = (_a2 = netIncome[pi]) != null ? _a2 : 0;
12434
+ var _a3;
12435
+ row[period] = (_a3 = netIncome[pi]) != null ? _a3 : 0;
12436
12436
  });
12437
12437
  csvRows.push(row);
12438
12438
  }
12439
12439
  const colCount = showPct ? 1 + periods.length * 2 : 1 + periods.length;
12440
12440
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_g = p.title) != null ? _g : "income-statement", onDownloadCSV: () => {
12441
- var _a2;
12442
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "income-statement");
12441
+ var _a3;
12442
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "income-statement");
12443
12443
  }, children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
12444
12444
  p.metadata && /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "2px", position: "relative" }, children: [
12445
12445
  p.metadata.status && /* @__PURE__ */ jsx("span", { style: {
@@ -12504,7 +12504,7 @@ function IncomeStatementResolver(p) {
12504
12504
  ] }) }),
12505
12505
  /* @__PURE__ */ jsxs("tbody", { children: [
12506
12506
  sections.map((section, si) => {
12507
- var _a2;
12507
+ var _a3;
12508
12508
  const isSubtotal = section.sectionType === "subtotal";
12509
12509
  return /* @__PURE__ */ jsxs(React41.Fragment, { children: [
12510
12510
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: colCount, style: {
@@ -12517,9 +12517,9 @@ function IncomeStatementResolver(p) {
12517
12517
  textTransform: "uppercase",
12518
12518
  letterSpacing: "0.04em"
12519
12519
  }, children: section.label }) }),
12520
- ((_a2 = section.lineItems) != null ? _a2 : []).map((li, li_i) => {
12521
- var _a3, _b2;
12522
- const indent = (_a3 = li.indent) != null ? _a3 : 0;
12520
+ ((_a3 = section.lineItems) != null ? _a3 : []).map((li, li_i) => {
12521
+ var _a4, _b2;
12522
+ const indent = (_a4 = li.indent) != null ? _a4 : 0;
12523
12523
  const amounts = (_b2 = li.amounts) != null ? _b2 : [];
12524
12524
  return /* @__PURE__ */ jsxs("tr", { style: {
12525
12525
  background: isSubtotal ? PAPER2 : "white",
@@ -12534,8 +12534,8 @@ function IncomeStatementResolver(p) {
12534
12534
  borderBottom: `1px solid #f2f2f2`
12535
12535
  }, children: li.name }),
12536
12536
  periods.map((_, pi) => {
12537
- var _a4;
12538
- const val = (_a4 = amounts[pi]) != null ? _a4 : 0;
12537
+ var _a5;
12538
+ const val = (_a5 = amounts[pi]) != null ? _a5 : 0;
12539
12539
  const isNeg = val < 0;
12540
12540
  return /* @__PURE__ */ jsxs(React41.Fragment, { children: [
12541
12541
  /* @__PURE__ */ jsx("td", { style: {
@@ -12569,8 +12569,8 @@ function IncomeStatementResolver(p) {
12569
12569
  borderBottom: `1px solid ${BORDER4}`
12570
12570
  }, children: "GROSS PROFIT" }),
12571
12571
  periods.map((_, pi) => {
12572
- var _a2;
12573
- const val = (_a2 = grossProfit[pi]) != null ? _a2 : 0;
12572
+ var _a3;
12573
+ const val = (_a3 = grossProfit[pi]) != null ? _a3 : 0;
12574
12574
  const isNeg = val < 0;
12575
12575
  return /* @__PURE__ */ jsxs(React41.Fragment, { children: [
12576
12576
  /* @__PURE__ */ jsx("td", { style: {
@@ -12604,8 +12604,8 @@ function IncomeStatementResolver(p) {
12604
12604
  borderBottom: `1px solid ${BORDER4}`
12605
12605
  }, children: "OPERATING INCOME" }),
12606
12606
  periods.map((_, pi) => {
12607
- var _a2;
12608
- const val = (_a2 = operatingIncome[pi]) != null ? _a2 : 0;
12607
+ var _a3;
12608
+ const val = (_a3 = operatingIncome[pi]) != null ? _a3 : 0;
12609
12609
  const isNeg = val < 0;
12610
12610
  return /* @__PURE__ */ jsxs(React41.Fragment, { children: [
12611
12611
  /* @__PURE__ */ jsx("td", { style: {
@@ -12638,8 +12638,8 @@ function IncomeStatementResolver(p) {
12638
12638
  borderTop: `2px solid ${BORDER4}`
12639
12639
  }, children: "NET INCOME" }),
12640
12640
  periods.map((_, pi) => {
12641
- var _a2;
12642
- const val = (_a2 = netIncome[pi]) != null ? _a2 : 0;
12641
+ var _a3;
12642
+ const val = (_a3 = netIncome[pi]) != null ? _a3 : 0;
12643
12643
  const isNeg = val < 0;
12644
12644
  return /* @__PURE__ */ jsxs(React41.Fragment, { children: [
12645
12645
  /* @__PURE__ */ jsx("td", { style: {
@@ -12684,17 +12684,17 @@ var fmt9 = (v, currency) => {
12684
12684
  return v < 0 ? `(${formatted})` : formatted;
12685
12685
  };
12686
12686
  function deriveNetCash(a) {
12687
- var _a;
12687
+ var _a2;
12688
12688
  if (a.netCash != null && a.netCash !== 0) return a.netCash;
12689
- return ((_a = a.lineItems) != null ? _a : []).filter((li) => !li.isSubtotal).reduce((sum, li) => sum + li.amount, 0);
12689
+ return ((_a2 = a.lineItems) != null ? _a2 : []).filter((li) => !li.isSubtotal).reduce((sum, li) => sum + li.amount, 0);
12690
12690
  }
12691
12691
  function CashFlowStatementResolver(p) {
12692
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
12692
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
12693
12693
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
12694
- const activities = ((_a = p.activities) != null ? _a : []).map((a) => {
12695
- var _a2;
12694
+ const activities = ((_a2 = p.activities) != null ? _a2 : []).map((a) => {
12695
+ var _a3;
12696
12696
  return __spreadProps(__spreadValues({}, a), {
12697
- lineItems: (_a2 = a.lineItems) != null ? _a2 : [],
12697
+ lineItems: (_a3 = a.lineItems) != null ? _a3 : [],
12698
12698
  netCash: deriveNetCash(a)
12699
12699
  });
12700
12700
  });
@@ -12713,19 +12713,19 @@ function CashFlowStatementResolver(p) {
12713
12713
  ...hasPrior ? [{ key: "priorAmount", label: priorLabel }] : []
12714
12714
  ];
12715
12715
  const csvRows = activities.flatMap((a) => {
12716
- var _a2, _b2, _c2, _d2;
12716
+ var _a3, _b2, _c2, _d2;
12717
12717
  return [
12718
12718
  ...a.lineItems.map((li) => {
12719
- var _a3, _b3;
12719
+ var _a4, _b3;
12720
12720
  return {
12721
- activity: (_a3 = activityLabels[a.activityType]) != null ? _a3 : a.activityType,
12721
+ activity: (_a4 = activityLabels[a.activityType]) != null ? _a4 : a.activityType,
12722
12722
  name: li.name,
12723
12723
  amount: li.amount,
12724
12724
  priorAmount: (_b3 = li.priorAmount) != null ? _b3 : ""
12725
12725
  };
12726
12726
  }),
12727
12727
  {
12728
- activity: (_a2 = activityLabels[a.activityType]) != null ? _a2 : a.activityType,
12728
+ activity: (_a3 = activityLabels[a.activityType]) != null ? _a3 : a.activityType,
12729
12729
  name: `Net Cash from ${(_c2 = (_b2 = activityLabels[a.activityType]) == null ? void 0 : _b2.replace("Cash Flows from ", "")) != null ? _c2 : a.activityType}`,
12730
12730
  amount: a.netCash,
12731
12731
  priorAmount: (_d2 = a.priorNetCash) != null ? _d2 : ""
@@ -12738,8 +12738,8 @@ function CashFlowStatementResolver(p) {
12738
12738
  {
12739
12739
  filename: (_e = p.title) != null ? _e : "cash-flow-statement",
12740
12740
  onDownloadCSV: () => {
12741
- var _a2;
12742
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "cash-flow-statement");
12741
+ var _a3;
12742
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "cash-flow-statement");
12743
12743
  },
12744
12744
  children: /* @__PURE__ */ jsxs(
12745
12745
  "div",
@@ -12860,7 +12860,7 @@ function CashFlowStatementResolver(p) {
12860
12860
  ] }) }),
12861
12861
  /* @__PURE__ */ jsxs("tbody", { children: [
12862
12862
  activities.map((activity, ai) => {
12863
- var _a2, _b2, _c2;
12863
+ var _a3, _b2, _c2;
12864
12864
  return /* @__PURE__ */ jsxs(React41.Fragment, { children: [
12865
12865
  ai > 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx(
12866
12866
  "td",
@@ -12883,12 +12883,12 @@ function CashFlowStatementResolver(p) {
12883
12883
  textTransform: "uppercase",
12884
12884
  letterSpacing: "0.04em"
12885
12885
  },
12886
- children: (_a2 = activityLabels[activity.activityType]) != null ? _a2 : activity.activityType
12886
+ children: (_a3 = activityLabels[activity.activityType]) != null ? _a3 : activity.activityType
12887
12887
  }
12888
12888
  ) }),
12889
12889
  activity.lineItems.map((li, li_i) => {
12890
- var _a3, _b3;
12891
- const indent = (_a3 = li.indent) != null ? _a3 : 0;
12890
+ var _a4, _b3;
12891
+ const indent = (_a4 = li.indent) != null ? _a4 : 0;
12892
12892
  const isSub = (_b3 = li.isSubtotal) != null ? _b3 : false;
12893
12893
  return /* @__PURE__ */ jsxs(
12894
12894
  "tr",
@@ -13157,7 +13157,7 @@ var formatDate4 = (iso) => {
13157
13157
  };
13158
13158
  var accountTypeBadge = ACCOUNT_TYPE_COLORS;
13159
13159
  function GeneralLedgerResolver(p) {
13160
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
13160
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
13161
13161
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
13162
13162
  const csvCols = [
13163
13163
  { key: "date", label: "Date" },
@@ -13167,11 +13167,11 @@ function GeneralLedgerResolver(p) {
13167
13167
  { key: "credit", label: "Credit" },
13168
13168
  { key: "runningBalance", label: "Balance" }
13169
13169
  ];
13170
- const csvRows = ((_a = p.transactions) != null ? _a : []).map((t) => {
13171
- var _a2;
13170
+ const csvRows = ((_a2 = p.transactions) != null ? _a2 : []).map((t) => {
13171
+ var _a3;
13172
13172
  return {
13173
13173
  date: t.date,
13174
- reference: (_a2 = t.reference) != null ? _a2 : "",
13174
+ reference: (_a3 = t.reference) != null ? _a3 : "",
13175
13175
  description: t.description,
13176
13176
  debit: t.debit,
13177
13177
  credit: t.credit,
@@ -13184,8 +13184,8 @@ function GeneralLedgerResolver(p) {
13184
13184
  {
13185
13185
  filename: (_d = p.title) != null ? _d : "general-ledger",
13186
13186
  onDownloadCSV: () => {
13187
- var _a2;
13188
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "general-ledger");
13187
+ var _a3;
13188
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "general-ledger");
13189
13189
  },
13190
13190
  children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
13191
13191
  p.title && /* @__PURE__ */ jsx(
@@ -13443,14 +13443,14 @@ var fmt11 = (v, currency) => {
13443
13443
  return v < 0 ? `(${s})` : s;
13444
13444
  };
13445
13445
  function ChartOfAccountsResolver(p) {
13446
- var _a, _b, _c, _d, _e, _f, _g;
13446
+ var _a2, _b, _c, _d, _e, _f, _g;
13447
13447
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
13448
- const hasSubType = ((_a = p.accounts) != null ? _a : []).some((a) => a.subType);
13448
+ const hasSubType = ((_a2 = p.accounts) != null ? _a2 : []).some((a) => a.subType);
13449
13449
  const showBalances = (_b = p.showBalances) != null ? _b : false;
13450
13450
  const currency = (_c = p.currency) != null ? _c : "USD";
13451
13451
  const activeCount = ((_d = p.accounts) != null ? _d : []).filter((a) => {
13452
- var _a2;
13453
- return !a.isHeader && ((_a2 = a.status) != null ? _a2 : "active") === "active";
13452
+ var _a3;
13453
+ return !a.isHeader && ((_a3 = a.status) != null ? _a3 : "active") === "active";
13454
13454
  }).length;
13455
13455
  const inactiveCount = ((_e = p.accounts) != null ? _e : []).filter((a) => !a.isHeader && a.status === "inactive").length;
13456
13456
  const csvCols = [
@@ -13462,12 +13462,12 @@ function ChartOfAccountsResolver(p) {
13462
13462
  ...showBalances ? [{ key: "balance", label: "Balance" }] : []
13463
13463
  ];
13464
13464
  const csvRows = p.accounts.filter((a) => !a.isHeader).map((a) => {
13465
- var _a2, _b2, _c2;
13465
+ var _a3, _b2, _c2;
13466
13466
  return {
13467
13467
  code: a.code,
13468
13468
  name: a.name,
13469
13469
  accountType: a.accountType,
13470
- subType: (_a2 = a.subType) != null ? _a2 : "",
13470
+ subType: (_a3 = a.subType) != null ? _a3 : "",
13471
13471
  status: ((_b2 = a.status) != null ? _b2 : "active").charAt(0).toUpperCase() + ((_c2 = a.status) != null ? _c2 : "active").slice(1),
13472
13472
  balance: a.balance != null ? a.balance : ""
13473
13473
  };
@@ -13477,8 +13477,8 @@ function ChartOfAccountsResolver(p) {
13477
13477
  {
13478
13478
  filename: (_f = p.title) != null ? _f : "chart-of-accounts",
13479
13479
  onDownloadCSV: () => {
13480
- var _a2;
13481
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "chart-of-accounts");
13480
+ var _a3;
13481
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "chart-of-accounts");
13482
13482
  },
13483
13483
  children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
13484
13484
  p.title && /* @__PURE__ */ jsx(
@@ -13610,9 +13610,9 @@ function ChartOfAccountsResolver(p) {
13610
13610
  )
13611
13611
  ] }) }),
13612
13612
  /* @__PURE__ */ jsx("tbody", { children: ((_g = p.accounts) != null ? _g : []).map((account, ri) => {
13613
- var _a2, _b2, _c2;
13613
+ var _a3, _b2, _c2;
13614
13614
  const isInactive = account.status === "inactive";
13615
- const indent = (_a2 = account.indent) != null ? _a2 : 0;
13615
+ const indent = (_a3 = account.indent) != null ? _a3 : 0;
13616
13616
  if (account.isHeader) {
13617
13617
  const colSpan = 3 + (hasSubType ? 1 : 0) + 1 + (showBalances ? 1 : 0);
13618
13618
  return /* @__PURE__ */ jsx("tr", { style: { background: PAPER2 }, children: /* @__PURE__ */ jsx(
@@ -13801,9 +13801,9 @@ var formatDate5 = (d) => {
13801
13801
  }
13802
13802
  };
13803
13803
  function InvoiceDetailResolver(p) {
13804
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
13804
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
13805
13805
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
13806
- const statusStyle = (_a = STATUS_COLORS2[p.status]) != null ? _a : STATUS_COLORS2.void;
13806
+ const statusStyle = (_a2 = STATUS_COLORS2[p.status]) != null ? _a2 : STATUS_COLORS2.void;
13807
13807
  const isOverdue = p.status === "overdue";
13808
13808
  return /* @__PURE__ */ jsx(ComponentActions, { filename: `invoice-${p.invoiceNumber}`, children: /* @__PURE__ */ jsxs(
13809
13809
  "div",
@@ -14282,7 +14282,7 @@ function InvoiceDetailResolver(p) {
14282
14282
  h
14283
14283
  )) }) }),
14284
14284
  /* @__PURE__ */ jsx("tbody", { children: ((_q = p.payments) != null ? _q : []).map((pmt, i) => {
14285
- var _a2;
14285
+ var _a3;
14286
14286
  return /* @__PURE__ */ jsxs("tr", { children: [
14287
14287
  /* @__PURE__ */ jsx(
14288
14288
  "td",
@@ -14330,7 +14330,7 @@ function InvoiceDetailResolver(p) {
14330
14330
  color: MUTED2,
14331
14331
  borderBottom: `1px solid #f2f2f2`
14332
14332
  },
14333
- children: (_a2 = pmt.reference) != null ? _a2 : "\u2014"
14333
+ children: (_a3 = pmt.reference) != null ? _a3 : "\u2014"
14334
14334
  }
14335
14335
  )
14336
14336
  ] }, i);
@@ -14418,14 +14418,14 @@ var tdStyle2 = (align = "left", last = false) => ({
14418
14418
  whiteSpace: "nowrap"
14419
14419
  });
14420
14420
  function AmortizationTableResolver(p) {
14421
- var _a, _b, _c, _d, _e, _f, _g;
14421
+ var _a2, _b, _c, _d, _e, _f, _g;
14422
14422
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
14423
- const currency = (_a = p.currency) != null ? _a : "USD";
14423
+ const currency = (_a2 = p.currency) != null ? _a2 : "USD";
14424
14424
  const payments = (_b = p.payments) != null ? _b : [];
14425
14425
  const hasDate = payments.some((r) => r.paymentDate);
14426
14426
  const hasExtra = payments.some((r) => {
14427
- var _a2;
14428
- return ((_a2 = r.extra) != null ? _a2 : 0) > 0;
14427
+ var _a3;
14428
+ return ((_a3 = r.extra) != null ? _a3 : 0) > 0;
14429
14429
  });
14430
14430
  const derivedMonthly = payments.length > 0 ? payments[0].payment : 0;
14431
14431
  const derivedTotalInterest = payments.reduce((s, r) => s + r.interest, 0);
@@ -14446,10 +14446,10 @@ function AmortizationTableResolver(p) {
14446
14446
  { key: "balance", label: "Balance" }
14447
14447
  ];
14448
14448
  const csvRows = payments.map((r) => {
14449
- var _a2, _b2;
14449
+ var _a3, _b2;
14450
14450
  return {
14451
14451
  period: r.period,
14452
- paymentDate: (_a2 = r.paymentDate) != null ? _a2 : "",
14452
+ paymentDate: (_a3 = r.paymentDate) != null ? _a3 : "",
14453
14453
  payment: r.payment,
14454
14454
  principal: r.principal,
14455
14455
  interest: r.interest,
@@ -14462,8 +14462,8 @@ function AmortizationTableResolver(p) {
14462
14462
  {
14463
14463
  filename: (_g = p.title) != null ? _g : "amortization-table",
14464
14464
  onDownloadCSV: () => {
14465
- var _a2;
14466
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "amortization-table");
14465
+ var _a3;
14466
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "amortization-table");
14467
14467
  },
14468
14468
  children: /* @__PURE__ */ jsxs(
14469
14469
  "div",
@@ -14705,7 +14705,7 @@ function AmortizationTableResolver(p) {
14705
14705
  /* @__PURE__ */ jsx("th", { style: thStyle3("right"), children: "Balance" })
14706
14706
  ] }) }),
14707
14707
  /* @__PURE__ */ jsx("tbody", { children: payments.map((row, ri) => {
14708
- var _a2, _b2, _c2, _d2;
14708
+ var _a3, _b2, _c2, _d2;
14709
14709
  const isLast = ri === payments.length - 1;
14710
14710
  const principalPct = row.payment > 0 ? Math.min(row.principal / row.payment * 100, 100) : 0;
14711
14711
  const balanceIsZero = originalAmount > 0 && row.balance < originalAmount * 0.01;
@@ -14755,7 +14755,7 @@ function AmortizationTableResolver(p) {
14755
14755
  }
14756
14756
  )
14757
14757
  ] }),
14758
- hasDate && /* @__PURE__ */ jsx("td", { style: tdStyle2("left", isLast), children: (_a2 = row.paymentDate) != null ? _a2 : "\u2014" }),
14758
+ hasDate && /* @__PURE__ */ jsx("td", { style: tdStyle2("left", isLast), children: (_a3 = row.paymentDate) != null ? _a3 : "\u2014" }),
14759
14759
  /* @__PURE__ */ jsx("td", { style: tdStyle2("right", isLast), children: fmt13(row.payment, currency) }),
14760
14760
  /* @__PURE__ */ jsx(
14761
14761
  "td",
@@ -14834,9 +14834,9 @@ var TH_STYLE = {
14834
14834
  };
14835
14835
  var TH_RIGHT = __spreadProps(__spreadValues({}, TH_STYLE), { textAlign: "right" });
14836
14836
  function DepreciationScheduleResolver(p) {
14837
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
14837
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
14838
14838
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
14839
- const currency = (_a = p.currency) != null ? _a : "USD";
14839
+ const currency = (_a2 = p.currency) != null ? _a2 : "USD";
14840
14840
  const fmt18 = (v) => {
14841
14841
  if (v === 0) return "\u2014";
14842
14842
  return new Intl.NumberFormat("en-US", {
@@ -14879,11 +14879,11 @@ function DepreciationScheduleResolver(p) {
14879
14879
  { key: "bookValue", label: "Book Value" }
14880
14880
  ];
14881
14881
  const csvRows = ((_g = p.assets) != null ? _g : []).map((a) => {
14882
- var _a2, _b2, _c2, _d2;
14882
+ var _a3, _b2, _c2, _d2;
14883
14883
  return {
14884
14884
  id: a.id,
14885
14885
  name: a.name,
14886
- category: (_a2 = a.category) != null ? _a2 : "",
14886
+ category: (_a3 = a.category) != null ? _a3 : "",
14887
14887
  acquiredDate: a.acquiredDate,
14888
14888
  cost: a.cost,
14889
14889
  usefulLife: (_b2 = a.usefulLife) != null ? _b2 : "",
@@ -14898,8 +14898,8 @@ function DepreciationScheduleResolver(p) {
14898
14898
  {
14899
14899
  filename: (_h = p.title) != null ? _h : "depreciation-schedule",
14900
14900
  onDownloadCSV: () => {
14901
- var _a2;
14902
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "depreciation-schedule");
14901
+ var _a3;
14902
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "depreciation-schedule");
14903
14903
  },
14904
14904
  children: /* @__PURE__ */ jsxs(
14905
14905
  "div",
@@ -14979,7 +14979,7 @@ function DepreciationScheduleResolver(p) {
14979
14979
  ] }) }),
14980
14980
  /* @__PURE__ */ jsxs("tbody", { children: [
14981
14981
  ((_i = p.assets) != null ? _i : []).map((asset, ri) => {
14982
- var _a2, _b2, _c2;
14982
+ var _a3, _b2, _c2;
14983
14983
  const catColor = asset.category && CATEGORY_COLORS[asset.category] || DEFAULT_CATEGORY_COLOR;
14984
14984
  const bvRatio = asset.cost > 0 ? asset.bookValue / asset.cost : 0;
14985
14985
  const barColor = bvRatio > 0.5 ? "#15803d" : bvRatio > 0.2 ? "#f59e0b" : "#dc2626";
@@ -15063,7 +15063,7 @@ function DepreciationScheduleResolver(p) {
15063
15063
  borderBottom: "1px solid #f2f2f2",
15064
15064
  whiteSpace: "nowrap"
15065
15065
  },
15066
- children: (_a2 = asset.usefulLife) != null ? _a2 : "\u2014"
15066
+ children: (_a3 = asset.usefulLife) != null ? _a3 : "\u2014"
15067
15067
  }
15068
15068
  ),
15069
15069
  /* @__PURE__ */ jsx(
@@ -15272,12 +15272,12 @@ var PRIORITY_STYLES = {
15272
15272
  low: { color: "#777777", bg: "#f2f2f2", label: "LOW" }
15273
15273
  };
15274
15274
  function EscalationCardResolver(p) {
15275
- var _a, _b, _c, _d;
15275
+ var _a2, _b, _c, _d;
15276
15276
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
15277
15277
  const [cardHovered, setCardHovered] = useState(false);
15278
15278
  const [btnHovered, setBtnHovered] = useState(false);
15279
15279
  const priorityStyle = p.priority ? PRIORITY_STYLES[p.priority] : null;
15280
- const railColor = (_a = priorityStyle == null ? void 0 : priorityStyle.color) != null ? _a : ACCENT2;
15280
+ const railColor = (_a2 = priorityStyle == null ? void 0 : priorityStyle.color) != null ? _a2 : ACCENT2;
15281
15281
  const iconBg = (_b = priorityStyle == null ? void 0 : priorityStyle.bg) != null ? _b : "#fff2ec";
15282
15282
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_c = p.title) != null ? _c : "escalation", children: /* @__PURE__ */ jsx("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: /* @__PURE__ */ jsxs(
15283
15283
  "div",
@@ -15409,9 +15409,9 @@ function fmt14(v, unit) {
15409
15409
  return /^[$€£¥]/.test(unit) ? `${unit}${n}` : `${n}${unit === "%" ? "%" : ` ${unit}`}`;
15410
15410
  }
15411
15411
  function LineChartResolver(p) {
15412
- var _a, _b, _c, _d;
15412
+ var _a2, _b, _c, _d;
15413
15413
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
15414
- const series = (_a = p.series) != null ? _a : [];
15414
+ const series = (_a2 = p.series) != null ? _a2 : [];
15415
15415
  const data = (_b = p.data) != null ? _b : [];
15416
15416
  const xKey = (_c = p.xKey) != null ? _c : "x";
15417
15417
  const { isVisible, toggle } = useSeriesToggle(series.map((s) => s.dataKey));
@@ -15439,14 +15439,14 @@ function LineChartResolver(p) {
15439
15439
  }
15440
15440
  ),
15441
15441
  series.map((s, i) => {
15442
- var _a2;
15442
+ var _a3;
15443
15443
  return /* @__PURE__ */ jsx(
15444
15444
  Line,
15445
15445
  {
15446
15446
  type: p.smooth ? "monotone" : "linear",
15447
15447
  dataKey: s.dataKey,
15448
15448
  name: s.name,
15449
- stroke: (_a2 = s.color) != null ? _a2 : CHART_PALETTE[i % CHART_PALETTE.length],
15449
+ stroke: (_a3 = s.color) != null ? _a3 : CHART_PALETTE[i % CHART_PALETTE.length],
15450
15450
  strokeWidth: 2,
15451
15451
  dot: false,
15452
15452
  activeDot: { r: 4, strokeWidth: 2, stroke: "white" },
@@ -15458,7 +15458,7 @@ function LineChartResolver(p) {
15458
15458
  })
15459
15459
  ] }) }),
15460
15460
  series.length > 1 && /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "14px" }, children: series.map((s, i) => {
15461
- var _a2;
15461
+ var _a3;
15462
15462
  return /* @__PURE__ */ jsxs(
15463
15463
  "div",
15464
15464
  {
@@ -15479,7 +15479,7 @@ function LineChartResolver(p) {
15479
15479
  width: "16px",
15480
15480
  height: "2px",
15481
15481
  borderRadius: "9999px",
15482
- background: (_a2 = s.color) != null ? _a2 : CHART_PALETTE[i % CHART_PALETTE.length],
15482
+ background: (_a3 = s.color) != null ? _a3 : CHART_PALETTE[i % CHART_PALETTE.length],
15483
15483
  display: "inline-block",
15484
15484
  opacity: isVisible(s.dataKey) ? 1 : 0.3,
15485
15485
  transition: "opacity 0.15s"
@@ -15508,15 +15508,15 @@ function fmt15(v, unit) {
15508
15508
  return /^[$€£¥]/.test(unit) ? `${unit}${n}` : `${n}${unit === "%" ? "%" : ` ${unit}`}`;
15509
15509
  }
15510
15510
  function ComboChartResolver(p) {
15511
- var _a, _b, _c, _d, _e;
15511
+ var _a2, _b, _c, _d, _e;
15512
15512
  const { BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
15513
- const bars = (_a = p.bars) != null ? _a : [];
15513
+ const bars = (_a2 = p.bars) != null ? _a2 : [];
15514
15514
  const lines = (_b = p.lines) != null ? _b : [];
15515
15515
  const data = (_c = p.data) != null ? _c : [];
15516
15516
  const xKey = (_d = p.xKey) != null ? _d : "x";
15517
15517
  const hasRight = bars.some((b) => b.axis === "right") || lines.some((l) => {
15518
- var _a2;
15519
- return ((_a2 = l.axis) != null ? _a2 : "right") === "right";
15518
+ var _a3;
15519
+ return ((_a3 = l.axis) != null ? _a3 : "right") === "right";
15520
15520
  });
15521
15521
  const all = [
15522
15522
  ...bars.map((b) => __spreadProps(__spreadValues({}, b), { kind: "bar" })),
@@ -15524,9 +15524,9 @@ function ComboChartResolver(p) {
15524
15524
  ];
15525
15525
  const { isVisible, toggle } = useSeriesToggle(all.map((s) => s.dataKey));
15526
15526
  const colorOf = (dataKey, fallbackIdx) => {
15527
- var _a2;
15527
+ var _a3;
15528
15528
  const s = all.find((x) => x.dataKey === dataKey);
15529
- return (_a2 = s == null ? void 0 : s.color) != null ? _a2 : CHART_PALETTE[fallbackIdx % CHART_PALETTE.length];
15529
+ return (_a3 = s == null ? void 0 : s.color) != null ? _a3 : CHART_PALETTE[fallbackIdx % CHART_PALETTE.length];
15530
15530
  };
15531
15531
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_e = p.title) != null ? _e : "combo-chart", children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "12px" }, children: [
15532
15532
  p.title && /* @__PURE__ */ jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
@@ -15558,11 +15558,11 @@ function ComboChartResolver(p) {
15558
15558
  ),
15559
15559
  /* @__PURE__ */ jsx(Tooltip, { contentStyle: tooltipStyle7, cursor: { fill: "rgba(0,0,0,0.03)" } }),
15560
15560
  bars.map((b, i) => {
15561
- var _a2;
15561
+ var _a3;
15562
15562
  return /* @__PURE__ */ jsx(
15563
15563
  Bar,
15564
15564
  {
15565
- yAxisId: (_a2 = b.axis) != null ? _a2 : "left",
15565
+ yAxisId: (_a3 = b.axis) != null ? _a3 : "left",
15566
15566
  dataKey: b.dataKey,
15567
15567
  name: b.name,
15568
15568
  fill: colorOf(b.dataKey, i),
@@ -15575,11 +15575,11 @@ function ComboChartResolver(p) {
15575
15575
  );
15576
15576
  }),
15577
15577
  lines.map((l, i) => {
15578
- var _a2;
15578
+ var _a3;
15579
15579
  return /* @__PURE__ */ jsx(
15580
15580
  Line,
15581
15581
  {
15582
- yAxisId: (_a2 = l.axis) != null ? _a2 : "right",
15582
+ yAxisId: (_a3 = l.axis) != null ? _a3 : "right",
15583
15583
  type: "monotone",
15584
15584
  dataKey: l.dataKey,
15585
15585
  name: l.name,
@@ -15639,9 +15639,9 @@ function fmt16(v, unit) {
15639
15639
  return /^[$€£¥]/.test(unit) ? `${unit}${n}` : `${n}${unit === "%" ? "%" : ` ${unit}`}`;
15640
15640
  }
15641
15641
  function GaugeChartResolver(p) {
15642
- var _a, _b;
15642
+ var _a2, _b;
15643
15643
  const { MUTED: MUTED2, ACCENT: ACCENT2, PAPER: PAPER2 } = useTheme();
15644
- const items = (_a = p.items) != null ? _a : [];
15644
+ const items = (_a2 = p.items) != null ? _a2 : [];
15645
15645
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "gauge-chart", children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "12px" }, children: [
15646
15646
  p.title && /* @__PURE__ */ jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
15647
15647
  /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px", justifyContent: items.length === 1 ? "center" : "space-around" }, children: items.map((it, i) => {
@@ -15720,24 +15720,24 @@ function makeCellContent(total, currency) {
15720
15720
  };
15721
15721
  }
15722
15722
  function TreemapChartResolver(p) {
15723
- var _a, _b;
15723
+ var _a2, _b;
15724
15724
  useTheme();
15725
- const nodes = (_a = p.nodes) != null ? _a : [];
15725
+ const nodes = (_a2 = p.nodes) != null ? _a2 : [];
15726
15726
  const total = nodes.reduce((s, n) => s + (n.value || 0), 0);
15727
15727
  const data = nodes.map((n, i) => {
15728
- var _a2;
15728
+ var _a3;
15729
15729
  return {
15730
15730
  name: n.name,
15731
15731
  value: n.value,
15732
- fill: (_a2 = n.color) != null ? _a2 : CHART_PALETTE[i % CHART_PALETTE.length]
15732
+ fill: (_a3 = n.color) != null ? _a3 : CHART_PALETTE[i % CHART_PALETTE.length]
15733
15733
  };
15734
15734
  });
15735
15735
  const csv = () => {
15736
- var _a2;
15736
+ var _a3;
15737
15737
  return downloadCSV(
15738
15738
  [{ key: "name", label: "Name" }, { key: "value", label: "Value" }],
15739
15739
  nodes.map((n) => ({ name: n.name, value: n.value })),
15740
- (_a2 = p.title) != null ? _a2 : "treemap-chart"
15740
+ (_a3 = p.title) != null ? _a3 : "treemap-chart"
15741
15741
  );
15742
15742
  };
15743
15743
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "treemap-chart", onDownloadCSV: csv, children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "12px" }, children: [
@@ -15772,9 +15772,9 @@ var tooltipStyle9 = {
15772
15772
  color: "var(--foreground)"
15773
15773
  };
15774
15774
  function RadarChartResolver(p) {
15775
- var _a, _b, _c;
15775
+ var _a2, _b, _c;
15776
15776
  const { BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
15777
- const series = (_a = p.series) != null ? _a : [];
15777
+ const series = (_a2 = p.series) != null ? _a2 : [];
15778
15778
  const data = (_b = p.data) != null ? _b : [];
15779
15779
  const { isVisible, toggle } = useSeriesToggle(series.map((s) => s.dataKey));
15780
15780
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_c = p.title) != null ? _c : "radar-chart", children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "12px" }, children: [
@@ -15785,8 +15785,8 @@ function RadarChartResolver(p) {
15785
15785
  /* @__PURE__ */ jsx(PolarRadiusAxis, { tick: { fontSize: 10, fill: MUTED2 }, axisLine: false }),
15786
15786
  /* @__PURE__ */ jsx(Tooltip, { contentStyle: tooltipStyle9, formatter: (value) => p.unit ? `${Number(value)}${p.unit}` : `${Number(value)}` }),
15787
15787
  series.map((s, i) => {
15788
- var _a2;
15789
- const c = (_a2 = s.color) != null ? _a2 : CHART_PALETTE[i % CHART_PALETTE.length];
15788
+ var _a3;
15789
+ const c = (_a3 = s.color) != null ? _a3 : CHART_PALETTE[i % CHART_PALETTE.length];
15790
15790
  return /* @__PURE__ */ jsx(
15791
15791
  Radar,
15792
15792
  {
@@ -15804,8 +15804,8 @@ function RadarChartResolver(p) {
15804
15804
  })
15805
15805
  ] }) }),
15806
15806
  series.length > 1 && /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "14px", justifyContent: "center" }, children: series.map((s, i) => {
15807
- var _a2;
15808
- const c = (_a2 = s.color) != null ? _a2 : CHART_PALETTE[i % CHART_PALETTE.length];
15807
+ var _a3;
15808
+ const c = (_a3 = s.color) != null ? _a3 : CHART_PALETTE[i % CHART_PALETTE.length];
15809
15809
  return /* @__PURE__ */ jsxs(
15810
15810
  "div",
15811
15811
  {
@@ -15854,24 +15854,24 @@ function money2(v, currency) {
15854
15854
  return currency ? `${currency}${n}` : n;
15855
15855
  }
15856
15856
  function FunnelChartResolver(p) {
15857
- var _a, _b, _c, _d;
15857
+ var _a2, _b, _c, _d;
15858
15858
  const { MUTED: MUTED2 } = useTheme();
15859
- const stages = (_a = p.stages) != null ? _a : [];
15859
+ const stages = (_a2 = p.stages) != null ? _a2 : [];
15860
15860
  const data = stages.map((s, i) => {
15861
- var _a2;
15861
+ var _a3;
15862
15862
  return {
15863
15863
  name: s.label,
15864
15864
  value: s.value,
15865
- fill: (_a2 = s.color) != null ? _a2 : CHART_PALETTE[i % CHART_PALETTE.length]
15865
+ fill: (_a3 = s.color) != null ? _a3 : CHART_PALETTE[i % CHART_PALETTE.length]
15866
15866
  };
15867
15867
  });
15868
15868
  const first = (_c = (_b = stages[0]) == null ? void 0 : _b.value) != null ? _c : 0;
15869
15869
  const csv = () => {
15870
- var _a2;
15870
+ var _a3;
15871
15871
  return downloadCSV(
15872
15872
  [{ key: "label", label: "Stage" }, { key: "value", label: "Value" }],
15873
15873
  stages.map((s) => ({ label: s.label, value: s.value })),
15874
- (_a2 = p.title) != null ? _a2 : "funnel-chart"
15874
+ (_a3 = p.title) != null ? _a3 : "funnel-chart"
15875
15875
  );
15876
15876
  };
15877
15877
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_d = p.title) != null ? _d : "funnel-chart", onDownloadCSV: csv, children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "12px" }, children: [
@@ -15884,13 +15884,13 @@ function FunnelChartResolver(p) {
15884
15884
  ] })
15885
15885
  ] }) }),
15886
15886
  /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: stages.map((s, i) => {
15887
- var _a2;
15887
+ var _a3;
15888
15888
  const prior = i === 0 ? null : stages[i - 1].value;
15889
15889
  const stepPct = prior && prior > 0 ? Math.round(s.value / prior * 100) : null;
15890
15890
  const ofTop = first > 0 ? Math.round(s.value / first * 100) : null;
15891
15891
  return /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", fontSize: "12px" }, children: [
15892
15892
  /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "8px", color: "var(--foreground)" }, children: [
15893
- /* @__PURE__ */ jsx("span", { style: { width: "10px", height: "10px", borderRadius: "3px", background: (_a2 = s.color) != null ? _a2 : CHART_PALETTE[i % CHART_PALETTE.length] } }),
15893
+ /* @__PURE__ */ jsx("span", { style: { width: "10px", height: "10px", borderRadius: "3px", background: (_a3 = s.color) != null ? _a3 : CHART_PALETTE[i % CHART_PALETTE.length] } }),
15894
15894
  s.label
15895
15895
  ] }),
15896
15896
  /* @__PURE__ */ jsxs("span", { style: { color: MUTED2, fontVariantNumeric: "tabular-nums" }, children: [
@@ -15913,22 +15913,22 @@ function fmt17(v, unit) {
15913
15913
  return /^[$€£¥]/.test(unit) ? `${unit}${n}` : `${n}${unit === "%" ? "%" : ` ${unit}`}`;
15914
15914
  }
15915
15915
  function BulletChartResolver(p) {
15916
- var _a, _b;
15916
+ var _a2, _b;
15917
15917
  const { MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
15918
- const items = (_a = p.items) != null ? _a : [];
15918
+ const items = (_a2 = p.items) != null ? _a2 : [];
15919
15919
  const csv = () => {
15920
- var _a2;
15920
+ var _a3;
15921
15921
  return downloadCSV(
15922
15922
  [{ key: "label", label: "KPI" }, { key: "value", label: "Actual" }, { key: "target", label: "Target" }],
15923
15923
  items.map((it) => ({ label: it.label, value: it.value, target: it.target })),
15924
- (_a2 = p.title) != null ? _a2 : "bullet-chart"
15924
+ (_a3 = p.title) != null ? _a3 : "bullet-chart"
15925
15925
  );
15926
15926
  };
15927
15927
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "bullet-chart", onDownloadCSV: csv, children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "12px" }, children: [
15928
15928
  p.title && /* @__PURE__ */ jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
15929
15929
  /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: items.map((it, i) => {
15930
- var _a2;
15931
- const max = (_a2 = it.max) != null ? _a2 : Math.max(it.value, it.target) * 1.25 || 1;
15930
+ var _a3;
15931
+ const max = (_a3 = it.max) != null ? _a3 : Math.max(it.value, it.target) * 1.25 || 1;
15932
15932
  const valPct = Math.max(0, Math.min(100, it.value / max * 100));
15933
15933
  const tgtPct = Math.max(0, Math.min(100, it.target / max * 100));
15934
15934
  const ratio = it.target > 0 ? it.value / it.target : 1;
@@ -15958,20 +15958,20 @@ function axisFmt(v, unit) {
15958
15958
  return /^[$€£¥]/.test(unit) ? `${unit}${n}` : `${n}${unit === "%" ? "%" : ` ${unit}`}`;
15959
15959
  }
15960
15960
  function ScatterChartResolver(p) {
15961
- var _a, _b;
15961
+ var _a2, _b;
15962
15962
  const { BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
15963
- const series = (_a = p.series) != null ? _a : [];
15963
+ const series = (_a2 = p.series) != null ? _a2 : [];
15964
15964
  const hasZ = series.some((s) => s.points.some((pt) => pt.z != null));
15965
15965
  const { isVisible, toggle } = useSeriesToggle(series.map((s) => s.name));
15966
15966
  const tooltipContent = (props) => {
15967
- var _a2, _b2;
15967
+ var _a3, _b2;
15968
15968
  const { active, payload } = props;
15969
15969
  if (!active || !payload || !payload.length) return null;
15970
15970
  const d = payload[0].payload;
15971
15971
  return /* @__PURE__ */ jsxs("div", { style: { fontSize: "12px", borderRadius: "8px", border: `1px solid ${BORDER4}`, background: "white", boxShadow: "0 4px 12px rgba(0,0,0,0.08)", color: "var(--foreground)", padding: "8px 10px" }, children: [
15972
15972
  d.label && /* @__PURE__ */ jsx("div", { style: { fontWeight: 600, marginBottom: "2px" }, children: d.label }),
15973
15973
  /* @__PURE__ */ jsxs("div", { style: { color: MUTED2 }, children: [
15974
- (_a2 = p.xLabel) != null ? _a2 : "x",
15974
+ (_a3 = p.xLabel) != null ? _a3 : "x",
15975
15975
  ": ",
15976
15976
  axisFmt(d.x, p.xUnit)
15977
15977
  ] }),
@@ -16019,13 +16019,13 @@ function ScatterChartResolver(p) {
16019
16019
  hasZ && /* @__PURE__ */ jsx(ZAxis, { type: "number", dataKey: "z", range: [60, 420] }),
16020
16020
  /* @__PURE__ */ jsx(Tooltip, { content: tooltipContent, cursor: { strokeDasharray: "3 3" } }),
16021
16021
  series.map((s, i) => {
16022
- var _a2;
16022
+ var _a3;
16023
16023
  return /* @__PURE__ */ jsx(
16024
16024
  Scatter,
16025
16025
  {
16026
16026
  name: s.name,
16027
16027
  data: s.points,
16028
- fill: (_a2 = s.color) != null ? _a2 : CHART_PALETTE[i % CHART_PALETTE.length],
16028
+ fill: (_a3 = s.color) != null ? _a3 : CHART_PALETTE[i % CHART_PALETTE.length],
16029
16029
  fillOpacity: 0.7,
16030
16030
  hide: !isVisible(s.name),
16031
16031
  isAnimationActive: false
@@ -16035,8 +16035,8 @@ function ScatterChartResolver(p) {
16035
16035
  })
16036
16036
  ] }) }),
16037
16037
  series.length > 1 && /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "14px" }, children: series.map((s, i) => {
16038
- var _a2;
16039
- const c = (_a2 = s.color) != null ? _a2 : CHART_PALETTE[i % CHART_PALETTE.length];
16038
+ var _a3;
16039
+ const c = (_a3 = s.color) != null ? _a3 : CHART_PALETTE[i % CHART_PALETTE.length];
16040
16040
  return /* @__PURE__ */ jsxs(
16041
16041
  "div",
16042
16042
  {
@@ -16120,7 +16120,7 @@ function brandIconUrl(name) {
16120
16120
  }
16121
16121
  var CONNECTED_GREEN = "#15803d";
16122
16122
  function ConnectIntegrationResolver(p) {
16123
- var _a;
16123
+ var _a2;
16124
16124
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
16125
16125
  const [cardHovered, setCardHovered] = useState(false);
16126
16126
  const [btnHovered, setBtnHovered] = useState(false);
@@ -16130,7 +16130,7 @@ function ConnectIntegrationResolver(p) {
16130
16130
  const iconSrc = p.iconUrl || brandIconUrl(name);
16131
16131
  const showImg = Boolean(iconSrc) && !imgFailed;
16132
16132
  const connected = p.status === "connected";
16133
- const label = (_a = p.ctaLabel) != null ? _a : connected ? "Open" : "Connect";
16133
+ const label = (_a2 = p.ctaLabel) != null ? _a2 : connected ? "Open" : "Connect";
16134
16134
  return /* @__PURE__ */ jsx(ComponentActions, { filename: name, children: /* @__PURE__ */ jsx("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: /* @__PURE__ */ jsxs(
16135
16135
  "div",
16136
16136
  {
@@ -16283,14 +16283,14 @@ init_ThemeContext();
16283
16283
  var CONNECTED_GREEN2 = "#15803d";
16284
16284
  var CONNECTED_BG = "#eaf6ee";
16285
16285
  function IntegrationsListResolver(p) {
16286
- var _a, _b;
16286
+ var _a2, _b;
16287
16287
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
16288
16288
  const integrations = Array.isArray(p.integrations) ? p.integrations : [];
16289
16289
  const [rowHover, setRowHover] = useState(null);
16290
16290
  const [btnHover, setBtnHover] = useState(null);
16291
16291
  const [failed, setFailed] = useState({});
16292
16292
  const connectedCount = integrations.filter((i) => i.status === "connected").length;
16293
- return /* @__PURE__ */ jsx(ComponentActions, { filename: (_a = p.title) != null ? _a : "integrations", children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "11px" }, children: [
16293
+ return /* @__PURE__ */ jsx(ComponentActions, { filename: (_a2 = p.title) != null ? _a2 : "integrations", children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "11px" }, children: [
16294
16294
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
16295
16295
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "baseline", justifyContent: "space-between", gap: "12px" }, children: [
16296
16296
  /* @__PURE__ */ jsx(
@@ -16564,11 +16564,11 @@ function layoutGraph(steps, startX = 0, startY = 0, keyPrefix = "") {
16564
16564
  let prevId = null;
16565
16565
  let totalW = NODE_W;
16566
16566
  steps.forEach((step, idx) => {
16567
- var _a, _b, _c, _d;
16567
+ var _a2, _b, _c, _d;
16568
16568
  const op = step.operation;
16569
16569
  const isBranch = op === "BRANCH" || op === "CONDITION";
16570
16570
  const isFanOut = op === "FAN_OUT";
16571
- const baseId = `${keyPrefix}${(_a = step.id) != null ? _a : `s${idx}`}`;
16571
+ const baseId = `${keyPrefix}${(_a2 = step.id) != null ? _a2 : `s${idx}`}`;
16572
16572
  if (isFanOut && ((_b = step.subSteps) == null ? void 0 : _b.length)) {
16573
16573
  const foNodeId = baseId;
16574
16574
  const res = layoutGraph(step.subSteps, 0, 0, `${baseId}/`);
@@ -16610,10 +16610,10 @@ function layoutGraph(steps, startX = 0, startY = 0, keyPrefix = "") {
16610
16610
  if (prevId) edges.push({ from: prevId, to: bNodeId });
16611
16611
  y += BRANCH_NODE_H + GAP_Y;
16612
16612
  const branchResults = step.branches.map((br, bi) => {
16613
- var _a2;
16613
+ var _a3;
16614
16614
  return __spreadValues({
16615
16615
  branch: __spreadProps(__spreadValues({}, br), { color: BRANCH_COLORS[bi % BRANCH_COLORS.length], _gid: `${bNodeId}-b${bi}` })
16616
- }, layoutGraph((_a2 = br.steps) != null ? _a2 : [], 0, 0, `${bNodeId}/b${bi}/`));
16616
+ }, layoutGraph((_a3 = br.steps) != null ? _a3 : [], 0, 0, `${bNodeId}/b${bi}/`));
16617
16617
  });
16618
16618
  let bTotalW = branchResults.reduce((sum, r) => sum + r.totalW + GAP_X, 0) - GAP_X;
16619
16619
  if (!Number.isFinite(bTotalW) || bTotalW <= 0) bTotalW = NODE_W;
@@ -16769,10 +16769,10 @@ var ellipsis = {
16769
16769
  display: "block"
16770
16770
  };
16771
16771
  function PipelinePreviewResolver(p) {
16772
- var _a, _b, _c, _d, _e, _f, _g;
16772
+ var _a2, _b, _c, _d, _e, _f, _g;
16773
16773
  const { MUTED: MUTED2, PAPER: PAPER2, BORDER: BORDER4, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
16774
16774
  const [btnHovered, setBtnHovered] = useState(false);
16775
- const stateCfg = STATE_CONFIG[(_a = p.state) != null ? _a : "draft"];
16775
+ const stateCfg = STATE_CONFIG[(_a2 = p.state) != null ? _a2 : "draft"];
16776
16776
  const destinations = (_b = p.destinations) != null ? _b : [];
16777
16777
  const steps = (_c = p.steps) != null ? _c : [];
16778
16778
  const workstreams = (_d = p.workstreams) != null ? _d : [];
@@ -17177,6 +17177,7 @@ var STATUS_COLORS3 = {
17177
17177
  // filled from theme ACCENT at render time
17178
17178
  review: "#f59e0b",
17179
17179
  pending: "#9ca3af",
17180
+ blocked: "#b45309",
17180
17181
  failed: "#dc2626"
17181
17182
  };
17182
17183
  var STATUS_LABELS = {
@@ -17184,6 +17185,7 @@ var STATUS_LABELS = {
17184
17185
  active: "In progress",
17185
17186
  review: "In review",
17186
17187
  pending: "Pending",
17188
+ blocked: "Blocked",
17187
17189
  failed: "Failed"
17188
17190
  };
17189
17191
  var HUMAN_PALETTE = ["#2563eb", "#0f766e", "#7c3aed", "#b45309", "#be185d", "#4d7c0f"];
@@ -17193,10 +17195,10 @@ function hashColor(name) {
17193
17195
  return HUMAN_PALETTE[Math.abs(h) % HUMAN_PALETTE.length];
17194
17196
  }
17195
17197
  function initialsOf(a) {
17196
- var _a, _b, _c, _d;
17198
+ var _a2, _b, _c, _d;
17197
17199
  if (a.initials) return a.initials.slice(0, 2).toUpperCase();
17198
17200
  const parts = a.name.trim().split(/\s+/);
17199
- return (((_b = (_a = parts[0]) == null ? void 0 : _a[0]) != null ? _b : "") + ((_d = (_c = parts[1]) == null ? void 0 : _c[0]) != null ? _d : "")).toUpperCase() || "?";
17201
+ return (((_b = (_a2 = parts[0]) == null ? void 0 : _a2[0]) != null ? _b : "") + ((_d = (_c = parts[1]) == null ? void 0 : _c[0]) != null ? _d : "")).toUpperCase() || "?";
17200
17202
  }
17201
17203
  function SparkMark({ size, color }) {
17202
17204
  return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
@@ -17264,8 +17266,8 @@ function AvatarStack({ assignees, accent }) {
17264
17266
  ] });
17265
17267
  }
17266
17268
  function IndexDot({ step, index, accent }) {
17267
- var _a;
17268
- const n = (_a = step.n) != null ? _a : index + 1;
17269
+ var _a2;
17270
+ const n = (_a2 = step.n) != null ? _a2 : index + 1;
17269
17271
  const base = {
17270
17272
  width: 18,
17271
17273
  height: 18,
@@ -17301,8 +17303,8 @@ function useContainerWidth(ref) {
17301
17303
  const el = ref.current;
17302
17304
  if (!el || typeof ResizeObserver === "undefined") return;
17303
17305
  const ro = new ResizeObserver((entries) => {
17304
- var _a;
17305
- const cr = (_a = entries[0]) == null ? void 0 : _a.contentRect;
17306
+ var _a2;
17307
+ const cr = (_a2 = entries[0]) == null ? void 0 : _a2.contentRect;
17306
17308
  if (cr) setW(cr.width);
17307
17309
  });
17308
17310
  ro.observe(el);
@@ -17391,9 +17393,9 @@ function WorkflowStepperRenderer({
17391
17393
  loadingSteps = 6,
17392
17394
  showProgress = true
17393
17395
  }) {
17394
- var _a, _b, _c, _d, _e, _f;
17396
+ var _a2, _b, _c, _d, _e, _f;
17395
17397
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
17396
- const steps = (_a = data.steps) != null ? _a : [];
17398
+ const steps = (_a2 = data.steps) != null ? _a2 : [];
17397
17399
  const activeStepId = (_d = (_c = data.active_step) != null ? _c : (_b = steps.find((s) => s.status === "active")) == null ? void 0 : _b.id) != null ? _d : null;
17398
17400
  const interactive = typeof onSelectStep === "function";
17399
17401
  const statusColor3 = (s) => s === "active" ? ACCENT2 : STATUS_COLORS3[s];
@@ -17621,13 +17623,13 @@ function WorkflowStepperRenderer({
17621
17623
  .wfs-scroller:hover::-webkit-scrollbar-thumb{background:#aab2c2;background-clip:padding-box}
17622
17624
  ` }),
17623
17625
  steps.map((step, i) => {
17624
- var _a2;
17626
+ var _a3;
17625
17627
  const isSelected = selectedStep === step.id;
17626
17628
  const isActive = step.status === "active";
17627
17629
  const reached = step.status !== "pending";
17628
17630
  const clickable = interactive && reached;
17629
17631
  const color = statusColor3(step.status);
17630
- const humans = ((_a2 = step.assignees) != null ? _a2 : []).filter((a) => a.kind === "human");
17632
+ const humans = ((_a3 = step.assignees) != null ? _a3 : []).filter((a) => a.kind === "human");
17631
17633
  const roleCaption = humans.map((h) => h.role).filter(Boolean).slice(0, 2).join(" \xB7 ");
17632
17634
  return /* @__PURE__ */ jsxs(React41.Fragment, { children: [
17633
17635
  i > 0 && /* @__PURE__ */ jsx(
@@ -17824,9 +17826,9 @@ function WorkflowStepperRenderer({
17824
17826
  ] });
17825
17827
  }
17826
17828
  function WorkflowStepperResolver(p) {
17827
- var _a;
17829
+ var _a2;
17828
17830
  const { selectedStepId, onStepSelect } = useGenUIInteraction();
17829
- return /* @__PURE__ */ jsx(ComponentActions, { filename: (_a = p.title) != null ? _a : "workflow-stepper", children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: 10 }, children: [
17831
+ return /* @__PURE__ */ jsx(ComponentActions, { filename: (_a2 = p.title) != null ? _a2 : "workflow-stepper", children: /* @__PURE__ */ jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: 10 }, children: [
17830
17832
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap" }, children: [
17831
17833
  /* @__PURE__ */ jsx(
17832
17834
  "p",
@@ -18061,12 +18063,57 @@ var BUILDER_FIELD_TYPES = [
18061
18063
  "multi_select",
18062
18064
  "date",
18063
18065
  "checkbox",
18064
- "file_upload"
18066
+ "file_upload",
18067
+ // Server-backed search-as-you-type combobox. Unlike `select` (static
18068
+ // `options`), it queries an allowlisted `source` via host-injected callbacks
18069
+ // (onEntitySearch/onEntityCreate) and can create a new record inline.
18070
+ "entity_picker",
18071
+ // Assign a set of files to role categories (grouped cards + inline Move).
18072
+ // Self-contained: candidate files + AI suggestions ride the `file_map` config
18073
+ // in the payload (no host callback). Submitted value = {category_id:[path]}.
18074
+ "file_map"
18065
18075
  ];
18066
18076
  var builderFieldOptionSchema = z.object({
18067
18077
  value: z.string(),
18068
18078
  label: z.string()
18069
18079
  });
18080
+ z.object({
18081
+ value: z.string(),
18082
+ label: z.string(),
18083
+ description: z.string().optional().nullable(),
18084
+ meta: z.string().optional().nullable()
18085
+ });
18086
+ var entityCreateFieldSchema = z.object({
18087
+ name: z.string(),
18088
+ label: z.string(),
18089
+ field_type: z.enum(["text", "textarea", "number", "date", "checkbox", "select"]).optional().default("text"),
18090
+ required: z.boolean().optional().default(false),
18091
+ placeholder: z.string().optional().default(""),
18092
+ options: z.array(builderFieldOptionSchema).optional().nullable()
18093
+ });
18094
+ var fileMapCategorySchema = z.object({
18095
+ id: z.string(),
18096
+ label: z.string(),
18097
+ hint: z.string().optional().nullable()
18098
+ });
18099
+ var fileMapFileSchema = z.object({
18100
+ path: z.string(),
18101
+ name: z.string().optional().nullable(),
18102
+ type: z.string().optional().nullable(),
18103
+ // ext, e.g. "csv"
18104
+ size: z.string().optional().nullable()
18105
+ // pre-formatted, e.g. "600 B"
18106
+ });
18107
+ var fileMapConfigSchema = z.object({
18108
+ categories: z.array(fileMapCategorySchema).min(1),
18109
+ files: z.array(fileMapFileSchema),
18110
+ /** AI seed: {category_id: [file_path]}. */
18111
+ suggestions: z.record(z.string(), z.array(z.string())).optional().nullable(),
18112
+ /** {file_path: HIGH|MEDIUM|LOW} for the suggested rows. */
18113
+ confidence: z.record(z.string(), z.enum(["HIGH", "MEDIUM", "LOW"])).optional().nullable(),
18114
+ /** Allow files to stay unassigned (default true). */
18115
+ allow_unassigned: z.boolean().optional().default(true)
18116
+ });
18070
18117
  var builderFieldValidationSchema = z.object({
18071
18118
  min: z.number().optional(),
18072
18119
  max: z.number().optional(),
@@ -18083,7 +18130,17 @@ var builderFieldSchema = z.object({
18083
18130
  description: z.string().optional().default(""),
18084
18131
  options: z.array(builderFieldOptionSchema).optional().nullable(),
18085
18132
  default_value: z.any().optional().nullable(),
18086
- validation: builderFieldValidationSchema.nullable()
18133
+ validation: builderFieldValidationSchema.nullable(),
18134
+ // --- entity_picker config (ignored by other field types) ---
18135
+ /** Allowlisted entity source the host knows how to search/create, e.g.
18136
+ * "workstreams". NOT a raw URL — the host maps it to a real endpoint. */
18137
+ source: z.string().optional().nullable(),
18138
+ /** Show the inline "Create new …" affordance (host still enforces perms). */
18139
+ allow_create: z.boolean().optional().default(false),
18140
+ /** Fields for the inline create sub-form (defaults to a single `name`). */
18141
+ create_fields: z.array(entityCreateFieldSchema).optional().nullable(),
18142
+ // --- file_map config (ignored by other field types) ---
18143
+ file_map: fileMapConfigSchema.optional().nullable()
18087
18144
  });
18088
18145
  var builderBlockSchema = z.object({
18089
18146
  id: z.string(),
@@ -18114,7 +18171,7 @@ function validateBuilderPayload(data) {
18114
18171
  };
18115
18172
  }
18116
18173
 
18117
- // src/builders/FormBuilder.tsx
18174
+ // src/builders/BlockForm.tsx
18118
18175
  init_ThemeContext();
18119
18176
 
18120
18177
  // src/builders/FieldRenderer.tsx
@@ -18169,7 +18226,7 @@ function TextAreaField({ field, value, onChange, disabled, error }) {
18169
18226
  );
18170
18227
  }
18171
18228
  function NumberField({ field, value, onChange, disabled, error }) {
18172
- var _a, _b;
18229
+ var _a2, _b;
18173
18230
  const base = useInputBase();
18174
18231
  return /* @__PURE__ */ jsx(
18175
18232
  "input",
@@ -18182,7 +18239,7 @@ function NumberField({ field, value, onChange, disabled, error }) {
18182
18239
  },
18183
18240
  placeholder: field.placeholder || "",
18184
18241
  disabled,
18185
- min: (_a = field.validation) == null ? void 0 : _a.min,
18242
+ min: (_a2 = field.validation) == null ? void 0 : _a2.min,
18186
18243
  max: (_b = field.validation) == null ? void 0 : _b.max,
18187
18244
  style: error ? __spreadValues(__spreadValues({}, base), INPUT_ERROR) : base
18188
18245
  }
@@ -18328,9 +18385,9 @@ function FileUploadField({ field, value, onChange, disabled, onFileUpload, error
18328
18385
  const [entries, setEntries] = useState(() => {
18329
18386
  const arr = Array.isArray(value) ? value : value && typeof value === "object" ? [value] : [];
18330
18387
  return arr.map((item) => {
18331
- var _a, _b;
18388
+ var _a2, _b;
18332
18389
  const r = item;
18333
- return { key: keyRef.current += 1, name: (_b = (_a = r.filename) != null ? _a : r.name) != null ? _b : "file", size: r.size, status: "done", result: r };
18390
+ return { key: keyRef.current += 1, name: (_b = (_a2 = r.filename) != null ? _a2 : r.name) != null ? _b : "file", size: r.size, status: "done", result: r };
18334
18391
  });
18335
18392
  });
18336
18393
  const entriesRef = React41.useRef(entries);
@@ -18364,19 +18421,19 @@ function FileUploadField({ field, value, onChange, disabled, onFileUpload, error
18364
18421
  });
18365
18422
  };
18366
18423
  const handleInput = (e) => {
18367
- var _a;
18368
- addFiles(Array.from((_a = e.target.files) != null ? _a : []));
18424
+ var _a2;
18425
+ addFiles(Array.from((_a2 = e.target.files) != null ? _a2 : []));
18369
18426
  if (inputRef.current) inputRef.current.value = "";
18370
18427
  };
18371
18428
  const handleDrop = (e) => {
18372
- var _a;
18429
+ var _a2;
18373
18430
  e.preventDefault();
18374
18431
  setDragOver(false);
18375
- addFiles(Array.from((_a = e.dataTransfer.files) != null ? _a : []));
18432
+ addFiles(Array.from((_a2 = e.dataTransfer.files) != null ? _a2 : []));
18376
18433
  };
18377
18434
  const openPicker = () => {
18378
- var _a;
18379
- if (interactive) (_a = inputRef.current) == null ? void 0 : _a.click();
18435
+ var _a2;
18436
+ if (interactive) (_a2 = inputRef.current) == null ? void 0 : _a2.click();
18380
18437
  };
18381
18438
  const removeEntry = (key) => commit(entriesRef.current.filter((e) => e.key !== key));
18382
18439
  const borderColor = dragOver ? ACCENT2 : error ? "#dc2626" : BORDER4;
@@ -18453,112 +18510,619 @@ function FileUploadField({ field, value, onChange, disabled, onFileUpload, error
18453
18510
  })
18454
18511
  ] });
18455
18512
  }
18456
- var FIELD_REGISTRY = {
18457
- text: TextField,
18458
- textarea: TextAreaField,
18459
- number: NumberField,
18460
- select: SelectField,
18461
- multi_select: MultiSelectField,
18462
- date: DateField,
18463
- checkbox: CheckboxField,
18464
- file_upload: FileUploadField
18465
- };
18466
- function FieldRenderer({ field, value, onChange, disabled, error, onFileUpload, dense }) {
18467
- const { MUTED: MUTED2 } = useTheme();
18468
- const FieldComp = FIELD_REGISTRY[field.field_type] || FIELD_REGISTRY.text;
18469
- return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "3px" }, children: [
18470
- field.field_type !== "checkbox" && /* @__PURE__ */ jsxs("label", { style: { fontSize: "12px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "0.01em" }, children: [
18471
- field.label,
18472
- field.required && /* @__PURE__ */ jsx("span", { style: { color: "#dc2626", marginLeft: "2px" }, children: "*" })
18473
- ] }),
18474
- field.description && !dense && /* @__PURE__ */ jsx("div", { style: { fontSize: "11px", color: MUTED2, lineHeight: 1.4 }, children: field.description }),
18475
- /* @__PURE__ */ jsx(FieldComp, { field, value, onChange, disabled, error, dense, onFileUpload: field.field_type === "file_upload" ? onFileUpload : void 0 }),
18476
- error && /* @__PURE__ */ jsx("div", { style: { fontSize: "11px", color: "#dc2626", fontWeight: 500, marginTop: "1px" }, children: error })
18513
+ function highlightMatch(label, q, accent) {
18514
+ const query = q.trim();
18515
+ if (!query) return label;
18516
+ const i = label.toLowerCase().indexOf(query.toLowerCase());
18517
+ if (i < 0) return label;
18518
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
18519
+ label.slice(0, i),
18520
+ /* @__PURE__ */ jsx("span", { style: { fontWeight: 700, color: accent }, children: label.slice(i, i + query.length) }),
18521
+ label.slice(i + query.length)
18477
18522
  ] });
18478
18523
  }
18479
- var SlotErrorBoundary = class extends React41.Component {
18480
- constructor(props) {
18481
- super(props);
18482
- this.state = { hasError: false };
18483
- }
18484
- static getDerivedStateFromError() {
18485
- return { hasError: true };
18486
- }
18487
- render() {
18488
- if (this.state.hasError) return null;
18489
- return this.props.children;
18490
- }
18491
- };
18492
- function ContextSlot({ payload }) {
18493
- if (!payload || typeof payload.type !== "string") return null;
18494
- return /* @__PURE__ */ jsx("div", { style: S2.slot, children: /* @__PURE__ */ jsx(SlotErrorBoundary, { children: resolveUI(payload) }) });
18495
- }
18496
- var S2 = {
18497
- slot: {
18498
- marginBottom: "8px",
18499
- borderRadius: "0.5rem",
18500
- overflow: "hidden"
18501
- }
18502
- };
18503
-
18504
- // src/builders/BuilderRecap.tsx
18505
- init_ThemeContext();
18506
- function BuilderRecap({ builder, state }) {
18507
- const t = useTheme();
18508
- const blocks = builder.blocks || [];
18509
- const display = (field, value) => {
18510
- if (value == null || value === "") return "";
18511
- const opt = (v) => {
18512
- var _a, _b, _c;
18513
- return (_c = (_b = (_a = field.options) == null ? void 0 : _a.find((o) => o.value === v)) == null ? void 0 : _b.label) != null ? _c : String(v);
18524
+ function EntityPickerField({ field, value, onChange, disabled, error, onEntitySearch, onEntityCreate }) {
18525
+ const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, PAPER: PAPER2 } = useTheme();
18526
+ const base = useInputBase();
18527
+ const source = field.source || "";
18528
+ const [open, setOpen] = useState(false);
18529
+ const [query, setQuery] = useState("");
18530
+ const [results, setResults] = useState([]);
18531
+ const [loading, setLoading] = useState(false);
18532
+ const [err, setErr] = useState(null);
18533
+ const [hi, setHi] = useState(0);
18534
+ const [selectedLabel, setSelectedLabel] = useState(null);
18535
+ const [creating, setCreating] = useState(false);
18536
+ const [createVals, setCreateVals] = useState({});
18537
+ const [createBusy, setCreateBusy] = useState(false);
18538
+ const boxRef = useRef(null);
18539
+ const seq = useRef(0);
18540
+ const allowCreate = !!field.allow_create && !!onEntityCreate;
18541
+ const createFields = useMemo(
18542
+ () => field.create_fields && field.create_fields.length ? field.create_fields : [{ name: "name", label: "Name", field_type: "text", required: true, placeholder: "" }],
18543
+ [field.create_fields]
18544
+ );
18545
+ const runSearch = useCallback(
18546
+ (q) => {
18547
+ if (!onEntitySearch || !source) return;
18548
+ const my = ++seq.current;
18549
+ setLoading(true);
18550
+ setErr(null);
18551
+ onEntitySearch(source, q).then((rows) => {
18552
+ if (my === seq.current) {
18553
+ setResults(rows || []);
18554
+ setHi(0);
18555
+ }
18556
+ }).catch(() => {
18557
+ if (my === seq.current) {
18558
+ setErr("Search failed \u2014 try again");
18559
+ setResults([]);
18560
+ }
18561
+ }).finally(() => {
18562
+ if (my === seq.current) setLoading(false);
18563
+ });
18564
+ },
18565
+ [onEntitySearch, source]
18566
+ );
18567
+ useEffect(() => {
18568
+ if (!open || creating) return;
18569
+ const id = setTimeout(() => runSearch(query), 200);
18570
+ return () => clearTimeout(id);
18571
+ }, [open, creating, query, runSearch]);
18572
+ useEffect(() => {
18573
+ if (!open) return;
18574
+ const onDoc = (e) => {
18575
+ if (boxRef.current && !boxRef.current.contains(e.target)) {
18576
+ setOpen(false);
18577
+ setCreating(false);
18578
+ }
18514
18579
  };
18515
- if (field.field_type === "multi_select" && Array.isArray(value)) return value.map(opt).join(", ");
18516
- if (field.field_type === "select") return opt(value);
18517
- if (field.field_type === "checkbox") return value ? "Yes" : "No";
18518
- if (field.field_type === "file_upload") {
18519
- const files = Array.isArray(value) ? value : [value];
18520
- return files.map((x) => x && typeof x === "object" ? x.filename || x.name || "file" : String(x)).join(", ");
18521
- }
18522
- return String(value);
18580
+ document.addEventListener("mousedown", onDoc);
18581
+ return () => document.removeEventListener("mousedown", onDoc);
18582
+ }, [open]);
18583
+ const openMenu = () => {
18584
+ if (disabled) return;
18585
+ setOpen(true);
18523
18586
  };
18524
- const decisionField = (b) => (b.fields || []).find((f) => f.field_type === "select") || (b.fields || [])[0];
18525
- const rows = useMemo(
18526
- () => blocks.map((b) => {
18527
- const df = decisionField(b);
18528
- const decision = df ? display(df, state.getValue(b.id, df.name)) : "";
18529
- const extras = (b.fields || []).filter((f) => f !== df).map((f) => ({ label: f.label, value: display(f, state.getValue(b.id, f.name)) })).filter((x) => x.value);
18530
- return { id: b.id, title: b.title, decision, extras };
18531
- }),
18532
- // eslint-disable-next-line react-hooks/exhaustive-deps
18533
- [blocks, state.values]
18534
- );
18535
- const counts = useMemo(() => {
18536
- const m = /* @__PURE__ */ new Map();
18537
- for (const r of rows) {
18538
- const k = r.decision || "\u2014";
18539
- m.set(k, (m.get(k) || 0) + 1);
18587
+ const select = useCallback((opt) => {
18588
+ onChange({ value: opt.value, label: opt.label });
18589
+ setSelectedLabel(opt.label);
18590
+ setQuery("");
18591
+ setOpen(false);
18592
+ setCreating(false);
18593
+ }, [onChange]);
18594
+ const nameField = createFields.find((f) => {
18595
+ var _a2;
18596
+ return ((_a2 = f.field_type) != null ? _a2 : "text") === "text";
18597
+ }) || createFields[0];
18598
+ const otherRequired = createFields.filter((f) => f !== nameField && f.required);
18599
+ const showCreateRow = allowCreate && !creating && query.trim().length > 0;
18600
+ const totalRows = results.length + (showCreateRow ? 1 : 0);
18601
+ const beginCreate = useCallback(() => {
18602
+ const init = {};
18603
+ if (nameField && query.trim()) init[nameField.name] = query.trim();
18604
+ setCreateVals(init);
18605
+ setErr(null);
18606
+ setCreating(true);
18607
+ }, [nameField, query]);
18608
+ const submitCreate = useCallback((vals) => {
18609
+ if (!onEntityCreate || !source) return;
18610
+ const payload = vals || createVals;
18611
+ for (const f of createFields) {
18612
+ if (f.required && (payload[f.name] == null || payload[f.name] === "")) {
18613
+ setErr(`${f.label} is required`);
18614
+ return;
18615
+ }
18540
18616
  }
18541
- return Array.from(m.entries());
18542
- }, [rows]);
18543
- const pill = (label) => {
18544
- const l = label.toLowerCase();
18545
- let fg = t.MUTED, bg = "#f2f2f2";
18546
- if (/accept|approve|confirm|keep|yes/.test(l)) {
18547
- fg = "#15803d";
18548
- bg = "#dcfce7";
18549
- } else if (/exclud|reject|remove|delete|deny|no\b/.test(l)) {
18550
- fg = "#dc2626";
18551
- bg = "#fef2f2";
18552
- } else if (/reclass|change|edit|modif|review|other/.test(l)) {
18553
- fg = t.SECONDARY;
18554
- bg = "#e8f0fe";
18617
+ setCreateBusy(true);
18618
+ setErr(null);
18619
+ onEntityCreate(source, payload).then((opt) => select(opt)).catch(() => setErr("Couldn't create \u2014 you may not have permission")).finally(() => setCreateBusy(false));
18620
+ }, [onEntityCreate, source, createFields, createVals, select]);
18621
+ const handleCreateRow = useCallback(() => {
18622
+ const q = query.trim();
18623
+ if (!q || !nameField) return;
18624
+ if (otherRequired.length === 0) {
18625
+ submitCreate({ [nameField.name]: q });
18626
+ } else {
18627
+ beginCreate();
18628
+ }
18629
+ }, [query, nameField, otherRequired, submitCreate, beginCreate]);
18630
+ const onKeyDown = (e) => {
18631
+ if (creating) return;
18632
+ if (!open) {
18633
+ if (e.key === "ArrowDown" || e.key === "Enter") {
18634
+ openMenu();
18635
+ e.preventDefault();
18636
+ }
18637
+ return;
18638
+ }
18639
+ if (e.key === "ArrowDown") {
18640
+ setHi((h) => Math.min(h + 1, Math.max(totalRows - 1, 0)));
18641
+ e.preventDefault();
18642
+ } else if (e.key === "ArrowUp") {
18643
+ setHi((h) => Math.max(h - 1, 0));
18644
+ e.preventDefault();
18645
+ } else if (e.key === "Enter") {
18646
+ e.preventDefault();
18647
+ if (hi < results.length) select(results[hi]);
18648
+ else if (showCreateRow) handleCreateRow();
18649
+ } else if (e.key === "Escape") {
18650
+ setOpen(false);
18555
18651
  }
18556
- return { fg, bg };
18557
18652
  };
18558
- const total = rows.length;
18559
- return /* @__PURE__ */ jsxs("div", { style: S3(t).card, children: [
18560
- /* @__PURE__ */ jsx("style", { children: "@keyframes agRecapFade{from{opacity:0;transform:translateY(3px)}to{opacity:1;transform:none}}" }),
18561
- /* @__PURE__ */ jsxs("div", { style: S3(t).header, children: [
18653
+ const selectedObj = value && typeof value === "object" ? value : null;
18654
+ const displayValue = selectedObj ? selectedObj.label || selectedObj.value : value ? selectedLabel != null ? selectedLabel : String(value) : "";
18655
+ const inputStyle = error ? __spreadValues(__spreadValues({}, base), INPUT_ERROR) : base;
18656
+ const rowStyle = (active) => ({
18657
+ display: "flex",
18658
+ flexDirection: "column",
18659
+ gap: "1px",
18660
+ padding: "8px 11px",
18661
+ cursor: "pointer",
18662
+ boxSizing: "border-box",
18663
+ background: active ? `${ACCENT2}0d` : "white",
18664
+ borderLeft: `2px solid ${active ? ACCENT2 : "transparent"}`
18665
+ });
18666
+ return /* @__PURE__ */ jsxs("div", { ref: boxRef, style: { position: "relative" }, children: [
18667
+ /* @__PURE__ */ jsx(
18668
+ "input",
18669
+ {
18670
+ type: "text",
18671
+ role: "combobox",
18672
+ "aria-expanded": open,
18673
+ "aria-autocomplete": "list",
18674
+ value: open ? query : displayValue,
18675
+ placeholder: field.placeholder || "Search\u2026",
18676
+ disabled,
18677
+ onFocus: openMenu,
18678
+ onChange: (e) => {
18679
+ setQuery(e.target.value);
18680
+ if (!open) setOpen(true);
18681
+ },
18682
+ onKeyDown,
18683
+ style: inputStyle
18684
+ }
18685
+ ),
18686
+ open && /* @__PURE__ */ jsx(
18687
+ "div",
18688
+ {
18689
+ role: "listbox",
18690
+ style: {
18691
+ position: "absolute",
18692
+ zIndex: 30,
18693
+ top: "calc(100% + 4px)",
18694
+ left: 0,
18695
+ right: 0,
18696
+ background: "white",
18697
+ border: `1px solid ${BORDER4}`,
18698
+ borderRadius: "0.625rem",
18699
+ boxShadow: "0 4px 16px rgba(0,0,0,0.10)",
18700
+ overflow: "hidden",
18701
+ maxHeight: "280px",
18702
+ overflowY: "auto"
18703
+ },
18704
+ children: creating ? /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "9px", padding: "12px" }, children: [
18705
+ /* @__PURE__ */ jsx("div", { style: { fontSize: "12px", fontWeight: 600, color: "var(--foreground)" }, children: "Create new" }),
18706
+ createFields.map((f) => {
18707
+ var _a2, _b, _c, _d, _e;
18708
+ return /* @__PURE__ */ jsxs("label", { style: { display: "flex", flexDirection: "column", gap: "3px" }, children: [
18709
+ /* @__PURE__ */ jsxs("span", { style: { fontSize: "11.5px", fontWeight: 600, color: "var(--foreground)" }, children: [
18710
+ f.label,
18711
+ f.required && /* @__PURE__ */ jsx("span", { style: { color: "#dc2626", marginLeft: "2px" }, children: "*" })
18712
+ ] }),
18713
+ ((_a2 = f.field_type) != null ? _a2 : "text") === "textarea" ? /* @__PURE__ */ jsx(
18714
+ "textarea",
18715
+ {
18716
+ value: (_b = createVals[f.name]) != null ? _b : "",
18717
+ placeholder: f.placeholder || "",
18718
+ onChange: (e) => setCreateVals((p) => __spreadProps(__spreadValues({}, p), { [f.name]: e.target.value })),
18719
+ rows: 3,
18720
+ style: __spreadProps(__spreadValues({}, base), { resize: "vertical" })
18721
+ }
18722
+ ) : /* @__PURE__ */ jsx(
18723
+ "input",
18724
+ {
18725
+ type: ((_c = f.field_type) != null ? _c : "text") === "number" ? "number" : ((_d = f.field_type) != null ? _d : "text") === "date" ? "date" : "text",
18726
+ value: (_e = createVals[f.name]) != null ? _e : "",
18727
+ placeholder: f.placeholder || "",
18728
+ onChange: (e) => setCreateVals((p) => __spreadProps(__spreadValues({}, p), { [f.name]: e.target.value })),
18729
+ style: base
18730
+ }
18731
+ )
18732
+ ] }, f.name);
18733
+ }),
18734
+ err && /* @__PURE__ */ jsx("div", { style: { fontSize: "11px", color: "#dc2626", fontWeight: 500 }, children: err }),
18735
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
18736
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => {
18737
+ setCreating(false);
18738
+ setErr(null);
18739
+ }, style: { font: "inherit", fontSize: "12px", fontWeight: 600, color: MUTED2, background: "transparent", border: `1px solid ${BORDER4}`, borderRadius: "9999px", padding: "5px 13px", cursor: "pointer" }, children: "Cancel" }),
18740
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => submitCreate(), disabled: createBusy, style: { font: "inherit", fontSize: "12px", fontWeight: 600, color: "white", background: ACCENT2, border: "none", borderRadius: "9999px", padding: "5px 15px", cursor: "pointer", opacity: createBusy ? 0.6 : 1 }, children: createBusy ? "Creating\u2026" : "Create" })
18741
+ ] })
18742
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
18743
+ loading && /* @__PURE__ */ jsxs("div", { style: { padding: "10px 11px", fontSize: "12px", color: MUTED2, display: "flex", alignItems: "center", gap: "8px" }, children: [
18744
+ /* @__PURE__ */ jsx("span", { style: { width: "13px", height: "13px", borderRadius: "50%", border: `2px solid ${ACCENT2}33`, borderTopColor: ACCENT2, animation: "genuiSpin 0.7s linear infinite" }, "aria-hidden": "true" }),
18745
+ "Searching\u2026"
18746
+ ] }),
18747
+ !loading && err && /* @__PURE__ */ jsx("div", { style: { padding: "10px 11px", fontSize: "12px", color: "#dc2626" }, children: err }),
18748
+ !loading && !err && results.length === 0 && !showCreateRow && /* @__PURE__ */ jsxs("div", { style: { padding: "10px 11px", fontSize: "12px", color: MUTED2 }, children: [
18749
+ "No matches",
18750
+ query ? ` for \u201C${query}\u201D` : "",
18751
+ "."
18752
+ ] }),
18753
+ !loading && results.map((opt, idx) => /* @__PURE__ */ jsxs(
18754
+ "div",
18755
+ {
18756
+ role: "option",
18757
+ "aria-selected": hi === idx,
18758
+ onMouseEnter: () => setHi(idx),
18759
+ onMouseDown: (e) => {
18760
+ e.preventDefault();
18761
+ select(opt);
18762
+ },
18763
+ style: rowStyle(hi === idx),
18764
+ children: [
18765
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "13px", color: "var(--foreground)" }, children: highlightMatch(opt.label, query, ACCENT2) }),
18766
+ (opt.description || opt.meta) && /* @__PURE__ */ jsx("span", { style: { fontSize: "11px", color: MUTED2, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: [opt.description, opt.meta].filter(Boolean).join(" \xB7 ") })
18767
+ ]
18768
+ },
18769
+ opt.value
18770
+ )),
18771
+ showCreateRow && /* @__PURE__ */ jsxs(
18772
+ "div",
18773
+ {
18774
+ role: "option",
18775
+ "aria-selected": hi === results.length,
18776
+ onMouseEnter: () => setHi(results.length),
18777
+ onMouseDown: (e) => {
18778
+ e.preventDefault();
18779
+ handleCreateRow();
18780
+ },
18781
+ style: __spreadProps(__spreadValues({}, rowStyle(hi === results.length)), { borderTop: results.length ? `1px solid ${BORDER4}` : "none", flexDirection: "row", alignItems: "center", gap: "7px", background: hi === results.length ? `${ACCENT2}0d` : PAPER2, opacity: createBusy ? 0.6 : 1, cursor: createBusy ? "default" : "pointer" }),
18782
+ children: [
18783
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "15px", lineHeight: 1, color: ACCENT2, fontWeight: 700 }, children: "\uFF0B" }),
18784
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "12.5px", fontWeight: 600, color: ACCENT2 }, children: createBusy ? `Creating \u201C${query.trim()}\u201D\u2026` : `Create \u201C${query.trim()}\u201D as a new ${source.replace(/s$/, "")}` })
18785
+ ]
18786
+ }
18787
+ )
18788
+ ] })
18789
+ }
18790
+ )
18791
+ ] });
18792
+ }
18793
+ var _FILEMAP_UNASSIGNED = "unassigned";
18794
+ var _CONF_COLOR = { HIGH: "#15803d", MEDIUM: "#92400e", LOW: "#777777" };
18795
+ function _fileExt(path, type) {
18796
+ if (type) return String(type).toLowerCase();
18797
+ const base = (path || "").split("/").pop() || "";
18798
+ return base.includes(".") ? (base.split(".").pop() || "").toLowerCase() : "";
18799
+ }
18800
+ function FileMapField({ field, value, onChange, disabled }) {
18801
+ const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, PAPER: PAPER2 } = useTheme();
18802
+ const cfg = field.file_map || null;
18803
+ const categories = useMemo(() => (cfg == null ? void 0 : cfg.categories) || [], [cfg]);
18804
+ const fileList = useMemo(() => (cfg == null ? void 0 : cfg.files) || [], [cfg]);
18805
+ const suggestions = (cfg == null ? void 0 : cfg.suggestions) || {};
18806
+ const confidence = (cfg == null ? void 0 : cfg.confidence) || {};
18807
+ const initial = useMemo(() => {
18808
+ const a = {};
18809
+ if (value && typeof value === "object" && !Array.isArray(value)) {
18810
+ for (const [grp, paths] of Object.entries(value))
18811
+ for (const p of paths || []) a[p] = grp;
18812
+ } else {
18813
+ for (const [cid, paths] of Object.entries(suggestions))
18814
+ for (const p of paths || []) a[p] = cid;
18815
+ }
18816
+ for (const f of fileList) if (!(f.path in a)) a[f.path] = _FILEMAP_UNASSIGNED;
18817
+ return a;
18818
+ }, []);
18819
+ const [assignment, setAssignment] = useState(initial);
18820
+ const [collapsed, setCollapsed] = useState({});
18821
+ const [menuFor, setMenuFor] = useState(null);
18822
+ const boardRef = useRef(null);
18823
+ const fileByPath = useMemo(
18824
+ () => Object.fromEntries(fileList.map((f) => [f.path, f])),
18825
+ [fileList]
18826
+ );
18827
+ const groupFrom = useCallback((a) => {
18828
+ const g = { [_FILEMAP_UNASSIGNED]: [] };
18829
+ for (const c of categories) g[c.id] = [];
18830
+ for (const f of fileList) {
18831
+ const grp = a[f.path] || _FILEMAP_UNASSIGNED;
18832
+ if (!g[grp]) g[grp] = [];
18833
+ g[grp].push(f.path);
18834
+ }
18835
+ return g;
18836
+ }, [categories, fileList]);
18837
+ const grouped = useMemo(() => groupFrom(assignment), [assignment, groupFrom]);
18838
+ const emit = useCallback((g) => onChange(g), [onChange]);
18839
+ const emittedRef = useRef(false);
18840
+ useEffect(() => {
18841
+ if (!emittedRef.current) {
18842
+ emittedRef.current = true;
18843
+ emit(grouped);
18844
+ }
18845
+ }, [grouped, emit]);
18846
+ useEffect(() => {
18847
+ if (!menuFor) return;
18848
+ const onDoc = (e) => {
18849
+ if (boardRef.current && !boardRef.current.contains(e.target)) setMenuFor(null);
18850
+ };
18851
+ document.addEventListener("mousedown", onDoc);
18852
+ return () => document.removeEventListener("mousedown", onDoc);
18853
+ }, [menuFor]);
18854
+ const move = useCallback((path, grp) => {
18855
+ setMenuFor(null);
18856
+ setAssignment((prev) => {
18857
+ const next = __spreadProps(__spreadValues({}, prev), { [path]: grp });
18858
+ emit(groupFrom(next));
18859
+ return next;
18860
+ });
18861
+ }, [emit, groupFrom]);
18862
+ const labelOf = (gid) => {
18863
+ var _a2;
18864
+ return gid === _FILEMAP_UNASSIGNED ? "Unassigned" : ((_a2 = categories.find((c) => c.id === gid)) == null ? void 0 : _a2.label) || gid;
18865
+ };
18866
+ const hintOf = (gid) => {
18867
+ var _a2;
18868
+ return gid === _FILEMAP_UNASSIGNED ? null : ((_a2 = categories.find((c) => c.id === gid)) == null ? void 0 : _a2.hint) || null;
18869
+ };
18870
+ const orderedGroups = [_FILEMAP_UNASSIGNED, ...categories.map((c) => c.id)];
18871
+ if (!cfg || categories.length === 0) {
18872
+ return /* @__PURE__ */ jsx("div", { style: { fontSize: "12px", color: MUTED2 }, children: "No file-map configuration." });
18873
+ }
18874
+ const total = fileList.length;
18875
+ const assigned = fileList.filter((f) => (assignment[f.path] || _FILEMAP_UNASSIGNED) !== _FILEMAP_UNASSIGNED).length;
18876
+ const pct = total ? Math.round(assigned / total * 100) : 0;
18877
+ const cards = () => orderedGroups.map((gid) => {
18878
+ const paths = grouped[gid] || [];
18879
+ if (gid === _FILEMAP_UNASSIGNED && paths.length === 0) return null;
18880
+ const isCollapsed = !!collapsed[gid];
18881
+ const hint = hintOf(gid);
18882
+ return /* @__PURE__ */ jsxs("div", { style: { border: `1px solid ${BORDER4}`, borderRadius: "0.75rem", overflow: "visible", background: "white" }, children: [
18883
+ /* @__PURE__ */ jsxs(
18884
+ "button",
18885
+ {
18886
+ type: "button",
18887
+ onClick: () => setCollapsed((c) => __spreadProps(__spreadValues({}, c), { [gid]: !c[gid] })),
18888
+ style: { width: "100%", display: "flex", alignItems: "center", gap: "8px", padding: "8px 11px", background: PAPER2, border: "none", borderBottom: isCollapsed ? "none" : `1px solid ${BORDER4}`, borderTopLeftRadius: "0.75rem", borderTopRightRadius: "0.75rem", cursor: "pointer", textAlign: "left", minWidth: 0 },
18889
+ children: [
18890
+ /* @__PURE__ */ jsx("span", { style: { transition: "transform 0.15s", transform: isCollapsed ? "rotate(-90deg)" : "none", color: MUTED2, fontSize: "10px", flexShrink: 0 }, children: "\u25BE" }),
18891
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "12px", fontWeight: 600, color: gid === _FILEMAP_UNASSIGNED ? MUTED2 : "var(--foreground)", flexShrink: 0 }, children: labelOf(gid) }),
18892
+ /* @__PURE__ */ jsxs("span", { style: { fontSize: "11px", color: MUTED2, fontVariantNumeric: "tabular-nums", flexShrink: 0 }, children: [
18893
+ "(",
18894
+ paths.length,
18895
+ ")"
18896
+ ] }),
18897
+ hint && !isCollapsed && /* @__PURE__ */ jsxs("span", { style: { fontSize: "11px", color: MUTED2, marginLeft: "2px", minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: [
18898
+ "\xB7 ",
18899
+ hint
18900
+ ] })
18901
+ ]
18902
+ }
18903
+ ),
18904
+ !isCollapsed && /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, children: paths.length === 0 ? /* @__PURE__ */ jsx("div", { style: { padding: "9px 12px", fontSize: "11px", color: MUTED2, fontStyle: "italic" }, children: "No files \u2014 use Move on a file to assign it here." }) : paths.map((p) => {
18905
+ const f = fileByPath[p] || { name: p };
18906
+ const ext = _fileExt(p, f.type);
18907
+ const conf = confidence[p];
18908
+ const open = menuFor === p;
18909
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "9px", padding: "8px 11px", borderTop: `1px solid ${BORDER4}`, animation: "agFmFade 0.15s ease", minWidth: 0 }, children: [
18910
+ ext && /* @__PURE__ */ jsx("span", { style: { fontSize: "9px", fontWeight: 700, letterSpacing: "0.04em", color: MUTED2, background: PAPER2, border: `1px solid ${BORDER4}`, borderRadius: "0.3rem", padding: "2px 5px", textTransform: "uppercase", flexShrink: 0 }, children: ext }),
18911
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "12.5px", color: "var(--foreground)", flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: f.name || p }),
18912
+ f.size && /* @__PURE__ */ jsx("span", { style: { fontSize: "11px", color: MUTED2, flexShrink: 0 }, children: f.size }),
18913
+ conf && /* @__PURE__ */ jsx("span", { title: `${conf} confidence`, "aria-label": `${conf} confidence`, style: { width: "8px", height: "8px", borderRadius: "50%", background: _CONF_COLOR[conf] || MUTED2, flexShrink: 0 } }),
18914
+ !disabled && /* @__PURE__ */ jsxs("div", { style: { position: "relative", flexShrink: 0 }, children: [
18915
+ /* @__PURE__ */ jsxs(
18916
+ "button",
18917
+ {
18918
+ type: "button",
18919
+ onMouseDown: (e) => {
18920
+ e.preventDefault();
18921
+ setMenuFor(open ? null : p);
18922
+ },
18923
+ style: { font: "inherit", fontSize: "11px", fontWeight: 600, color: ACCENT2, background: "transparent", border: `1px solid ${BORDER4}`, borderRadius: "9999px", padding: "3px 9px", cursor: "pointer" },
18924
+ children: [
18925
+ gid === _FILEMAP_UNASSIGNED ? "Assign" : "Move",
18926
+ " \u25BE"
18927
+ ]
18928
+ }
18929
+ ),
18930
+ open && /* @__PURE__ */ jsx("div", { role: "listbox", style: { position: "absolute", right: 0, top: "calc(100% + 4px)", zIndex: 30, minWidth: "180px", maxWidth: "min(240px, 80vw)", maxHeight: "240px", overflowY: "auto", background: "white", border: `1px solid ${BORDER4}`, borderRadius: "0.5rem", boxShadow: "0 4px 16px rgba(0,0,0,0.10)" }, children: orderedGroups.filter((t) => t !== gid).map((t) => /* @__PURE__ */ jsx(
18931
+ "button",
18932
+ {
18933
+ type: "button",
18934
+ onMouseDown: (e) => {
18935
+ e.preventDefault();
18936
+ move(p, t);
18937
+ },
18938
+ style: { display: "block", width: "100%", textAlign: "left", font: "inherit", fontSize: "12px", color: t === _FILEMAP_UNASSIGNED ? MUTED2 : "var(--foreground)", background: "white", border: "none", borderBottom: `1px solid ${BORDER4}`, padding: "7px 11px", cursor: "pointer" },
18939
+ children: labelOf(t)
18940
+ },
18941
+ t
18942
+ )) })
18943
+ ] })
18944
+ ] }, p);
18945
+ }) })
18946
+ ] }, gid);
18947
+ });
18948
+ const progressBar = /* @__PURE__ */ jsx("div", { style: { flex: 1, height: "4px", borderRadius: "9999px", background: PAPER2, overflow: "hidden", border: `1px solid ${BORDER4}`, minWidth: 0 }, children: /* @__PURE__ */ jsx("div", { style: { width: `${pct}%`, height: "100%", background: ACCENT2, borderRadius: "9999px", transition: "width 0.25s" } }) });
18949
+ const countLabel = /* @__PURE__ */ jsxs("span", { style: { fontSize: "11px", fontWeight: 600, color: MUTED2, textTransform: "uppercase", letterSpacing: "0.04em", whiteSpace: "nowrap", fontVariantNumeric: "tabular-nums" }, children: [
18950
+ assigned,
18951
+ " of ",
18952
+ total,
18953
+ " mapped"
18954
+ ] });
18955
+ return /* @__PURE__ */ jsxs("div", { ref: boardRef, style: { width: "100%", maxWidth: "100%", boxSizing: "border-box", display: "flex", flexDirection: "column", gap: "8px" }, children: [
18956
+ /* @__PURE__ */ jsx("style", { children: "@keyframes agFmFade{from{opacity:0;transform:translateY(2px)}to{opacity:1;transform:none}}" }),
18957
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
18958
+ countLabel,
18959
+ progressBar
18960
+ ] }),
18961
+ cards()
18962
+ ] });
18963
+ }
18964
+ var FIELD_REGISTRY = {
18965
+ text: TextField,
18966
+ textarea: TextAreaField,
18967
+ number: NumberField,
18968
+ select: SelectField,
18969
+ multi_select: MultiSelectField,
18970
+ date: DateField,
18971
+ checkbox: CheckboxField,
18972
+ file_upload: FileUploadField,
18973
+ entity_picker: EntityPickerField,
18974
+ file_map: FileMapField
18975
+ };
18976
+ function FieldRenderer({ field, value, onChange, disabled, error, onFileUpload, onEntitySearch, onEntityCreate, dense }) {
18977
+ const { MUTED: MUTED2 } = useTheme();
18978
+ const FieldComp = FIELD_REGISTRY[field.field_type] || FIELD_REGISTRY.text;
18979
+ const isEntity = field.field_type === "entity_picker";
18980
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "3px" }, children: [
18981
+ field.field_type !== "checkbox" && /* @__PURE__ */ jsxs("label", { style: { fontSize: "12px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "0.01em" }, children: [
18982
+ field.label,
18983
+ field.required && /* @__PURE__ */ jsx("span", { style: { color: "#dc2626", marginLeft: "2px" }, children: "*" })
18984
+ ] }),
18985
+ field.description && !dense && /* @__PURE__ */ jsx("div", { style: { fontSize: "11px", color: MUTED2, lineHeight: 1.4 }, children: field.description }),
18986
+ /* @__PURE__ */ jsx(
18987
+ FieldComp,
18988
+ {
18989
+ field,
18990
+ value,
18991
+ onChange,
18992
+ disabled,
18993
+ error,
18994
+ dense,
18995
+ onFileUpload: field.field_type === "file_upload" ? onFileUpload : void 0,
18996
+ onEntitySearch: isEntity ? onEntitySearch : void 0,
18997
+ onEntityCreate: isEntity ? onEntityCreate : void 0
18998
+ }
18999
+ ),
19000
+ error && /* @__PURE__ */ jsx("div", { style: { fontSize: "11px", color: "#dc2626", fontWeight: 500, marginTop: "1px" }, children: error })
19001
+ ] });
19002
+ }
19003
+ init_ThemeContext();
19004
+ var SlotErrorBoundary = class extends React41.Component {
19005
+ constructor(props) {
19006
+ super(props);
19007
+ this.state = { hasError: false };
19008
+ }
19009
+ static getDerivedStateFromError() {
19010
+ return { hasError: true };
19011
+ }
19012
+ render() {
19013
+ if (this.state.hasError) return this.props.fallback;
19014
+ return this.props.children;
19015
+ }
19016
+ };
19017
+ function ContextRender({ payload }) {
19018
+ return resolveUI(payload);
19019
+ }
19020
+ var _a;
19021
+ var _isDev = typeof process !== "undefined" && ((_a = process.env) == null ? void 0 : _a.NODE_ENV) !== "production";
19022
+ function ContextSlot({ payload }) {
19023
+ const { MUTED: MUTED2, BORDER: BORDER4, PAPER: PAPER2 } = useTheme();
19024
+ if (!payload || typeof payload.type !== "string") return null;
19025
+ const note = (msg) => /* @__PURE__ */ jsx("div", { style: __spreadProps(__spreadValues({}, S2.slot), { border: `1px solid ${BORDER4}`, background: PAPER2, padding: "8px 11px", fontSize: "12px", color: MUTED2 }), children: msg });
19026
+ const result = validatePayload(payload.type, payload);
19027
+ const safePayload = result.success ? result.data : payload;
19028
+ if (!result.success && _isDev) {
19029
+ console.warn(`[ContextSlot] invalid embedded "${payload.type}" payload:`, result.error);
19030
+ }
19031
+ const fallback = note(
19032
+ _isDev ? `Couldn't render embedded ${payload.type}: ${result.success ? "render error" : result.error}` : `Couldn't render embedded ${payload.type}.`
19033
+ );
19034
+ if (!result.success) return fallback;
19035
+ return /* @__PURE__ */ jsx("div", { style: S2.slot, children: /* @__PURE__ */ jsx(SlotErrorBoundary, { fallback, children: /* @__PURE__ */ jsx(ContextRender, { payload: safePayload }) }) });
19036
+ }
19037
+ var S2 = {
19038
+ slot: {
19039
+ marginBottom: "8px",
19040
+ borderRadius: "0.5rem",
19041
+ overflow: "hidden"
19042
+ }
19043
+ };
19044
+
19045
+ // src/builders/BuilderRecap.tsx
19046
+ init_ThemeContext();
19047
+ function BuilderRecap({ builder, state }) {
19048
+ const t = useTheme();
19049
+ const blocks = builder.blocks || [];
19050
+ const display = (field, value) => {
19051
+ if (value == null || value === "") return "";
19052
+ const opt = (v) => {
19053
+ var _a2, _b, _c;
19054
+ return (_c = (_b = (_a2 = field.options) == null ? void 0 : _a2.find((o) => o.value === v)) == null ? void 0 : _b.label) != null ? _c : String(v);
19055
+ };
19056
+ if (field.field_type === "multi_select" && Array.isArray(value)) return value.map(opt).join(", ");
19057
+ if (field.field_type === "select") return opt(value);
19058
+ if (field.field_type === "checkbox") return value ? "Yes" : "No";
19059
+ if (field.field_type === "entity_picker") {
19060
+ if (value && typeof value === "object") {
19061
+ const o = value;
19062
+ return o.label || o.value || "";
19063
+ }
19064
+ return String(value);
19065
+ }
19066
+ if (field.field_type === "file_upload") {
19067
+ const files = Array.isArray(value) ? value : [value];
19068
+ return files.map((x) => x && typeof x === "object" ? x.filename || x.name || "file" : String(x)).join(", ");
19069
+ }
19070
+ if (field.field_type === "file_map") {
19071
+ if (value && typeof value === "object" && !Array.isArray(value)) {
19072
+ let files = 0, roles = 0, unassigned = 0;
19073
+ for (const [g, paths] of Object.entries(value)) {
19074
+ const n = Array.isArray(paths) ? paths.length : 0;
19075
+ if (g === "unassigned") unassigned += n;
19076
+ else {
19077
+ files += n;
19078
+ if (n > 0) roles += 1;
19079
+ }
19080
+ }
19081
+ const tot = files + unassigned;
19082
+ return `${tot} file${tot !== 1 ? "s" : ""} \xB7 ${roles} role${roles !== 1 ? "s" : ""}${unassigned ? ` (${unassigned} unassigned)` : ""}`;
19083
+ }
19084
+ return String(value);
19085
+ }
19086
+ return String(value);
19087
+ };
19088
+ const decisionField = (b) => (b.fields || []).find((f) => f.field_type === "select") || (b.fields || [])[0];
19089
+ const rows = useMemo(
19090
+ () => blocks.map((b) => {
19091
+ const df = decisionField(b);
19092
+ const decision = df ? display(df, state.getValue(b.id, df.name)) : "";
19093
+ const extras = (b.fields || []).filter((f) => f !== df).map((f) => ({ label: f.label, value: display(f, state.getValue(b.id, f.name)) })).filter((x) => x.value);
19094
+ return { id: b.id, title: b.title, decision, extras };
19095
+ }),
19096
+ // eslint-disable-next-line react-hooks/exhaustive-deps
19097
+ [blocks, state.values]
19098
+ );
19099
+ const counts = useMemo(() => {
19100
+ const m = /* @__PURE__ */ new Map();
19101
+ for (const r of rows) {
19102
+ const k = r.decision || "\u2014";
19103
+ m.set(k, (m.get(k) || 0) + 1);
19104
+ }
19105
+ return Array.from(m.entries());
19106
+ }, [rows]);
19107
+ const pill = (label) => {
19108
+ const l = label.toLowerCase();
19109
+ let fg = t.MUTED, bg = "#f2f2f2";
19110
+ if (/accept|approve|confirm|keep|yes/.test(l)) {
19111
+ fg = "#15803d";
19112
+ bg = "#dcfce7";
19113
+ } else if (/exclud|reject|remove|delete|deny|no\b/.test(l)) {
19114
+ fg = "#dc2626";
19115
+ bg = "#fef2f2";
19116
+ } else if (/reclass|change|edit|modif|review|other/.test(l)) {
19117
+ fg = t.SECONDARY;
19118
+ bg = "#e8f0fe";
19119
+ }
19120
+ return { fg, bg };
19121
+ };
19122
+ const total = rows.length;
19123
+ return /* @__PURE__ */ jsxs("div", { style: S3(t).card, children: [
19124
+ /* @__PURE__ */ jsx("style", { children: "@keyframes agRecapFade{from{opacity:0;transform:translateY(3px)}to{opacity:1;transform:none}}" }),
19125
+ /* @__PURE__ */ jsxs("div", { style: S3(t).header, children: [
18562
19126
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "baseline", gap: "8px", flexWrap: "wrap" }, children: [
18563
19127
  /* @__PURE__ */ jsx("span", { style: S3(t).title, children: builder.title || "Submitted" }),
18564
19128
  /* @__PURE__ */ jsxs("span", { style: S3(t).reviewed, children: [
@@ -18655,21 +19219,173 @@ function S3(t) {
18655
19219
  }
18656
19220
  };
18657
19221
  }
18658
- function FormBuilder({ builder, state, onSubmit, onCancel, disabled, onFileUpload, dense, hideActions }) {
18659
- var _a;
19222
+ function fieldKey(blockId, name) {
19223
+ return `${blockId}\0${name}`;
19224
+ }
19225
+ function isRequiredMissing(fieldType, v) {
19226
+ if (fieldType === "checkbox") return v !== true;
19227
+ if (fieldType === "file_map") {
19228
+ if (!v || typeof v !== "object" || Array.isArray(v)) return true;
19229
+ return !Object.entries(v).some(
19230
+ ([g, paths]) => g !== "unassigned" && Array.isArray(paths) && paths.length > 0
19231
+ );
19232
+ }
19233
+ return v == null || v === "" || Array.isArray(v) && v.length === 0;
19234
+ }
19235
+ function useBuilderState(blocks) {
19236
+ const isMultiBlock = blocks.length > 1;
19237
+ const [values, setValues] = useState(() => {
19238
+ const init = {};
19239
+ for (const block of blocks) {
19240
+ for (const field of block.fields || []) {
19241
+ if (field.default_value != null) init[fieldKey(block.id, field.name)] = field.default_value;
19242
+ }
19243
+ }
19244
+ return init;
19245
+ });
19246
+ const [errors, setErrors] = useState({});
19247
+ const [currentBlock, setCurrentBlock] = useState(0);
19248
+ const getValue = useCallback(
19249
+ (blockId, name) => values[fieldKey(blockId, name)],
19250
+ [values]
19251
+ );
19252
+ const getError = useCallback(
19253
+ (blockId, name) => errors[fieldKey(blockId, name)],
19254
+ [errors]
19255
+ );
19256
+ const setFieldValue = useCallback((blockId, name, value) => {
19257
+ const k = fieldKey(blockId, name);
19258
+ setValues((prev) => __spreadProps(__spreadValues({}, prev), { [k]: value }));
19259
+ setErrors((prev) => {
19260
+ if (!prev[k]) return prev;
19261
+ const next = __spreadValues({}, prev);
19262
+ delete next[k];
19263
+ return next;
19264
+ });
19265
+ }, []);
19266
+ const validateBlock = useCallback(
19267
+ (blockIdx) => {
19268
+ const block = blocks[blockIdx];
19269
+ if (!block) return true;
19270
+ const newErrors = {};
19271
+ for (const field of block.fields || []) {
19272
+ const k = fieldKey(block.id, field.name);
19273
+ const v = values[k];
19274
+ if (field.required) {
19275
+ if (isRequiredMissing(field.field_type, v)) {
19276
+ newErrors[k] = "Required";
19277
+ continue;
19278
+ }
19279
+ }
19280
+ if (v == null || v === "") continue;
19281
+ const val = field.validation;
19282
+ if (!val) continue;
19283
+ if (val.min_length && typeof v === "string" && v.length < val.min_length) {
19284
+ newErrors[k] = `Min ${val.min_length} characters`;
19285
+ } else if (val.max_length && typeof v === "string" && v.length > val.max_length) {
19286
+ newErrors[k] = `Max ${val.max_length} characters`;
19287
+ } else if (val.min != null && typeof v === "number" && v < val.min) {
19288
+ newErrors[k] = `Min ${val.min}`;
19289
+ } else if (val.max != null && typeof v === "number" && v > val.max) {
19290
+ newErrors[k] = `Max ${val.max}`;
19291
+ } else if (val.pattern && typeof v === "string" && !new RegExp(val.pattern).test(v)) {
19292
+ newErrors[k] = "Invalid format";
19293
+ }
19294
+ }
19295
+ setErrors((prev) => __spreadValues(__spreadValues({}, prev), newErrors));
19296
+ return Object.keys(newErrors).length === 0;
19297
+ },
19298
+ [blocks, values]
19299
+ );
19300
+ const validateAllDetailed = useCallback(() => {
19301
+ let firstBlockIndex = -1;
19302
+ let firstKey = null;
19303
+ let firstBlockId = null;
19304
+ let firstName = null;
19305
+ const failingKeys = [];
19306
+ const allErrors = {};
19307
+ for (let i = 0; i < blocks.length; i++) {
19308
+ const block = blocks[i];
19309
+ for (const field of block.fields || []) {
19310
+ const k = fieldKey(block.id, field.name);
19311
+ const v = values[k];
19312
+ if (field.required && isRequiredMissing(field.field_type, v)) {
19313
+ allErrors[k] = "Required";
19314
+ failingKeys.push(k);
19315
+ if (firstBlockIndex < 0) {
19316
+ firstBlockIndex = i;
19317
+ firstKey = k;
19318
+ firstBlockId = block.id;
19319
+ firstName = field.name;
19320
+ }
19321
+ }
19322
+ }
19323
+ }
19324
+ setErrors(allErrors);
19325
+ if (firstBlockIndex >= 0) setCurrentBlock(firstBlockIndex);
19326
+ return { firstKey, firstBlockId, firstName, firstBlockIndex, failingKeys };
19327
+ }, [blocks, values]);
19328
+ const validateAll = useCallback(
19329
+ () => validateAllDetailed().failingKeys.length === 0,
19330
+ [validateAllDetailed]
19331
+ );
19332
+ return {
19333
+ values,
19334
+ errors,
19335
+ getValue,
19336
+ getError,
19337
+ setFieldValue,
19338
+ validateBlock,
19339
+ validateAll,
19340
+ validateAllDetailed,
19341
+ currentBlock,
19342
+ setCurrentBlock,
19343
+ isMultiBlock
19344
+ };
19345
+ }
19346
+ function BlockForm({
19347
+ builder,
19348
+ state,
19349
+ onSubmit,
19350
+ onCancel,
19351
+ disabled,
19352
+ onFileUpload,
19353
+ onEntitySearch,
19354
+ onEntityCreate,
19355
+ hideActions,
19356
+ dense,
19357
+ variant = "form"
19358
+ }) {
19359
+ var _a2;
18660
19360
  const t = useTheme();
18661
19361
  const S4 = useMemo(() => makeStyles(t), [t]);
18662
19362
  const block = builder.blocks[0];
19363
+ const isEscalation = variant === "escalation";
19364
+ const errorCount = ((block == null ? void 0 : block.fields) || []).reduce(
19365
+ (n, f) => state.getError(block.id, f.name) ? n + 1 : n,
19366
+ 0
19367
+ );
18663
19368
  if (!block) return null;
18664
19369
  if (disabled) return /* @__PURE__ */ jsx(BuilderRecap, { builder, state });
18665
- const containerStyle = dense ? { display: "flex", flexDirection: "column", gap: "12px" } : S4.card;
19370
+ const containerStyle = dense ? { display: "flex", flexDirection: "column", gap: isEscalation ? "10px" : "12px" } : isEscalation ? S4.escalationCard : S4.formCard;
18666
19371
  return /* @__PURE__ */ jsxs("div", { style: containerStyle, children: [
18667
- dense ? builder.description && /* @__PURE__ */ jsx("p", { style: { fontSize: "12px", color: t.MUTED, lineHeight: 1.45, margin: 0 }, children: builder.description }) : /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
19372
+ !isEscalation && !dense ? /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
18668
19373
  /* @__PURE__ */ jsx("p", { style: S4.title, children: builder.title }),
18669
19374
  builder.description && /* @__PURE__ */ jsx("p", { style: { fontSize: "12px", color: t.MUTED, lineHeight: 1.45, margin: 0 }, children: builder.description })
18670
- ] }),
18671
- ((_a = block.context) == null ? void 0 : _a.type) && /* @__PURE__ */ jsx(ContextSlot, { payload: block.context }),
18672
- /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: dense ? "8px" : "12px" }, children: (block.fields || []).map((field) => /* @__PURE__ */ jsx(
19375
+ ] }) : builder.description && /* @__PURE__ */ jsx(
19376
+ "p",
19377
+ {
19378
+ style: {
19379
+ fontSize: isEscalation && !dense ? "13px" : "12px",
19380
+ color: isEscalation && !dense ? "var(--foreground)" : t.MUTED,
19381
+ lineHeight: 1.45,
19382
+ margin: 0
19383
+ },
19384
+ children: builder.description
19385
+ }
19386
+ ),
19387
+ ((_a2 = block.context) == null ? void 0 : _a2.type) && /* @__PURE__ */ jsx(ContextSlot, { payload: block.context }),
19388
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: dense ? "8px" : isEscalation ? "10px" : "12px" }, children: (block.fields || []).map((field) => /* @__PURE__ */ jsx("div", { "data-field-key": fieldKey(block.id, field.name), children: /* @__PURE__ */ jsx(
18673
19389
  FieldRenderer,
18674
19390
  {
18675
19391
  field,
@@ -18678,20 +19394,45 @@ function FormBuilder({ builder, state, onSubmit, onCancel, disabled, onFileUploa
18678
19394
  disabled,
18679
19395
  error: state.getError(block.id, field.name),
18680
19396
  dense,
18681
- onFileUpload
18682
- },
18683
- `${block.id}:${field.name}`
18684
- )) }),
18685
- hideActions ? null : /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", paddingTop: "4px" }, children: [
18686
- /* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
18687
- onCancel && /* @__PURE__ */ jsx("button", { type: "button", onClick: onCancel, style: S4.cancelBtn, children: builder.cancel_label || "Cancel" }),
18688
- /* @__PURE__ */ jsx("button", { type: "button", onClick: onSubmit, style: S4.submitBtn, children: builder.submit_label || "Submit" })
19397
+ onFileUpload,
19398
+ onEntitySearch,
19399
+ onEntityCreate
19400
+ }
19401
+ ) }, `${block.id}:${field.name}`)) }),
19402
+ hideActions ? null : /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "6px", paddingTop: isEscalation ? "2px" : "4px" }, children: [
19403
+ errorCount > 0 ? /* @__PURE__ */ jsxs("div", { style: { fontSize: "11px", fontWeight: 600, color: "#dc2626" }, children: [
19404
+ errorCount,
19405
+ " required field",
19406
+ errorCount === 1 ? "" : "s",
19407
+ " need",
19408
+ errorCount === 1 ? "s" : "",
19409
+ " attention"
19410
+ ] }) : null,
19411
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
19412
+ /* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
19413
+ onCancel ? /* @__PURE__ */ jsx("button", { type: "button", onClick: onCancel, style: S4.cancelBtn, children: builder.cancel_label || "Cancel" }) : null,
19414
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: onSubmit, style: isEscalation ? S4.continueBtn : S4.submitBtn, children: builder.submit_label || (isEscalation ? "Continue" : "Submit") })
19415
+ ] })
18689
19416
  ] })
18690
19417
  ] });
18691
19418
  }
18692
19419
  function makeStyles(t) {
18693
19420
  return {
18694
- card: {
19421
+ // Escalation: accent left-rail card (attention).
19422
+ escalationCard: {
19423
+ display: "flex",
19424
+ flexDirection: "column",
19425
+ gap: "10px",
19426
+ padding: "12px 14px",
19427
+ borderRadius: "0.75rem",
19428
+ borderTop: `1px solid ${t.BORDER}`,
19429
+ borderRight: `1px solid ${t.BORDER}`,
19430
+ borderBottom: `1px solid ${t.BORDER}`,
19431
+ borderLeft: `2px solid ${t.ACCENT}`,
19432
+ background: "white"
19433
+ },
19434
+ // Form: standard bordered card with a soft shadow.
19435
+ formCard: {
18695
19436
  display: "flex",
18696
19437
  flexDirection: "column",
18697
19438
  gap: "14px",
@@ -18701,11 +19442,6 @@ function makeStyles(t) {
18701
19442
  background: "white",
18702
19443
  boxShadow: "0 1px 2px rgba(0,0,0,0.03), 0 4px 12px rgba(0,0,0,0.04)"
18703
19444
  },
18704
- inert: {
18705
- opacity: 0.55,
18706
- pointerEvents: "none",
18707
- userSelect: "none"
18708
- },
18709
19445
  title: {
18710
19446
  fontFamily: "var(--font-serif)",
18711
19447
  fontSize: "15px",
@@ -18714,6 +19450,23 @@ function makeStyles(t) {
18714
19450
  letterSpacing: "-0.01em",
18715
19451
  margin: 0
18716
19452
  },
19453
+ // Escalation CTA: outlined accent pill.
19454
+ continueBtn: {
19455
+ font: "inherit",
19456
+ fontSize: "12px",
19457
+ fontWeight: 600,
19458
+ color: t.ACCENT,
19459
+ background: "transparent",
19460
+ borderTop: `1px solid ${t.ACCENT}`,
19461
+ borderRight: `1px solid ${t.ACCENT}`,
19462
+ borderBottom: `1px solid ${t.ACCENT}`,
19463
+ borderLeft: `1px solid ${t.ACCENT}`,
19464
+ borderRadius: "9999px",
19465
+ padding: "6px 14px",
19466
+ cursor: "pointer",
19467
+ transition: "all 0.15s"
19468
+ },
19469
+ // Form CTA: filled accent pill.
18717
19470
  submitBtn: {
18718
19471
  font: "inherit",
18719
19472
  fontSize: "12px",
@@ -18743,8 +19496,8 @@ function makeStyles(t) {
18743
19496
 
18744
19497
  // src/builders/StepperBuilder.tsx
18745
19498
  init_ThemeContext();
18746
- function StepperBuilder({ builder, state, onSubmit, onCancel, disabled, onFileUpload, dense }) {
18747
- var _a;
19499
+ function StepperBuilder({ builder, state, onSubmit, onCancel, disabled, onFileUpload, onEntitySearch, onEntityCreate, dense }) {
19500
+ var _a2;
18748
19501
  const t = useTheme();
18749
19502
  const S4 = useMemo(() => makeStyles2(t), [t]);
18750
19503
  const { blocks } = builder;
@@ -18783,7 +19536,7 @@ function StepperBuilder({ builder, state, onSubmit, onCancel, disabled, onFileUp
18783
19536
  ] }),
18784
19537
  /* @__PURE__ */ jsx("div", { style: dense ? __spreadProps(__spreadValues({}, S4.body), { padding: "12px 0" }) : S4.body, children: block && /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "12px", animation: "agStepFade 0.22s ease" }, children: [
18785
19538
  block.description && /* @__PURE__ */ jsx("div", { style: S4.blockDesc, children: block.description }),
18786
- ((_a = block.context) == null ? void 0 : _a.type) && /* @__PURE__ */ jsx(ContextSlot, { payload: block.context }),
19539
+ ((_a2 = block.context) == null ? void 0 : _a2.type) && /* @__PURE__ */ jsx(ContextSlot, { payload: block.context }),
18787
19540
  /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: (block.fields || []).map((field) => /* @__PURE__ */ jsx(
18788
19541
  FieldRenderer,
18789
19542
  {
@@ -18793,7 +19546,9 @@ function StepperBuilder({ builder, state, onSubmit, onCancel, disabled, onFileUp
18793
19546
  disabled,
18794
19547
  error: state.getError(block.id, field.name),
18795
19548
  dense,
18796
- onFileUpload
19549
+ onFileUpload,
19550
+ onEntitySearch,
19551
+ onEntityCreate
18797
19552
  },
18798
19553
  `${block.id}:${field.name}`
18799
19554
  )) })
@@ -18919,168 +19674,19 @@ function makeStyles2(t) {
18919
19674
  }
18920
19675
  };
18921
19676
  }
18922
-
18923
- // src/builders/EscalationCard.tsx
18924
- init_ThemeContext();
18925
- function EscalationCard({ builder, state, onSubmit, disabled, onFileUpload, hideActions, dense }) {
18926
- var _a;
18927
- const t = useTheme();
18928
- const S4 = useMemo(() => makeStyles3(t), [t]);
18929
- const block = builder.blocks[0];
18930
- if (!block) return null;
18931
- if (disabled) return /* @__PURE__ */ jsx(BuilderRecap, { builder, state });
18932
- const containerStyle = dense ? { display: "flex", flexDirection: "column", gap: "10px" } : S4.card;
18933
- return /* @__PURE__ */ jsxs("div", { style: containerStyle, children: [
18934
- builder.description && /* @__PURE__ */ jsx("p", { style: { fontSize: dense ? "12px" : "13px", color: dense ? t.MUTED : "var(--foreground)", lineHeight: 1.45, margin: 0 }, children: builder.description }),
18935
- ((_a = block.context) == null ? void 0 : _a.type) && /* @__PURE__ */ jsx(ContextSlot, { payload: block.context }),
18936
- /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: dense ? "8px" : "10px" }, children: (block.fields || []).map((field) => /* @__PURE__ */ jsx(FieldRenderer, { field, value: state.getValue(block.id, field.name), onChange: (v) => state.setFieldValue(block.id, field.name, v), disabled, error: state.getError(block.id, field.name), onFileUpload, dense }, `${block.id}:${field.name}`)) }),
18937
- disabled ? /* @__PURE__ */ jsx("div", { style: { fontSize: "11px", fontWeight: 600, color: t.MUTED, textAlign: "center", padding: "2px 0" }, children: "Submitted" }) : hideActions ? null : /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", paddingTop: "2px" }, children: [
18938
- /* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
18939
- /* @__PURE__ */ jsx("button", { type: "button", onClick: onSubmit, style: S4.continueBtn, children: builder.submit_label || "Continue" })
18940
- ] })
18941
- ] });
18942
- }
18943
- function makeStyles3(t) {
18944
- return {
18945
- card: {
18946
- display: "flex",
18947
- flexDirection: "column",
18948
- gap: "10px",
18949
- padding: "12px 14px",
18950
- borderRadius: "0.75rem",
18951
- borderTop: `1px solid ${t.BORDER}`,
18952
- borderRight: `1px solid ${t.BORDER}`,
18953
- borderBottom: `1px solid ${t.BORDER}`,
18954
- borderLeft: `2px solid ${t.ACCENT}`,
18955
- background: "white"
18956
- },
18957
- inert: { opacity: 0.55, pointerEvents: "none", userSelect: "none" },
18958
- continueBtn: {
18959
- font: "inherit",
18960
- fontSize: "12px",
18961
- fontWeight: 600,
18962
- color: t.ACCENT,
18963
- background: "transparent",
18964
- borderTop: `1px solid ${t.ACCENT}`,
18965
- borderRight: `1px solid ${t.ACCENT}`,
18966
- borderBottom: `1px solid ${t.ACCENT}`,
18967
- borderLeft: `1px solid ${t.ACCENT}`,
18968
- borderRadius: "9999px",
18969
- padding: "6px 14px",
18970
- cursor: "pointer",
18971
- transition: "all 0.15s"
18972
- }
18973
- };
18974
- }
18975
- function fieldKey(blockId, name) {
18976
- return `${blockId}\0${name}`;
18977
- }
18978
- function useBuilderState(blocks) {
18979
- const isMultiBlock = blocks.length > 1;
18980
- const [values, setValues] = useState(() => {
18981
- const init = {};
18982
- for (const block of blocks) {
18983
- for (const field of block.fields || []) {
18984
- if (field.default_value != null) init[fieldKey(block.id, field.name)] = field.default_value;
18985
- }
18986
- }
18987
- return init;
18988
- });
18989
- const [errors, setErrors] = useState({});
18990
- const [currentBlock, setCurrentBlock] = useState(0);
18991
- const getValue = useCallback(
18992
- (blockId, name) => values[fieldKey(blockId, name)],
18993
- [values]
18994
- );
18995
- const getError = useCallback(
18996
- (blockId, name) => errors[fieldKey(blockId, name)],
18997
- [errors]
18998
- );
18999
- const setFieldValue = useCallback((blockId, name, value) => {
19000
- const k = fieldKey(blockId, name);
19001
- setValues((prev) => __spreadProps(__spreadValues({}, prev), { [k]: value }));
19002
- setErrors((prev) => {
19003
- if (!prev[k]) return prev;
19004
- const next = __spreadValues({}, prev);
19005
- delete next[k];
19006
- return next;
19007
- });
19008
- }, []);
19009
- const validateBlock = useCallback(
19010
- (blockIdx) => {
19011
- const block = blocks[blockIdx];
19012
- if (!block) return true;
19013
- const newErrors = {};
19014
- for (const field of block.fields || []) {
19015
- const k = fieldKey(block.id, field.name);
19016
- const v = values[k];
19017
- if (field.required) {
19018
- if (v == null || v === "" || Array.isArray(v) && v.length === 0) {
19019
- newErrors[k] = "Required";
19020
- continue;
19021
- }
19022
- }
19023
- if (v == null || v === "") continue;
19024
- const val = field.validation;
19025
- if (!val) continue;
19026
- if (val.min_length && typeof v === "string" && v.length < val.min_length) {
19027
- newErrors[k] = `Min ${val.min_length} characters`;
19028
- } else if (val.max_length && typeof v === "string" && v.length > val.max_length) {
19029
- newErrors[k] = `Max ${val.max_length} characters`;
19030
- } else if (val.min != null && typeof v === "number" && v < val.min) {
19031
- newErrors[k] = `Min ${val.min}`;
19032
- } else if (val.max != null && typeof v === "number" && v > val.max) {
19033
- newErrors[k] = `Max ${val.max}`;
19034
- } else if (val.pattern && typeof v === "string" && !new RegExp(val.pattern).test(v)) {
19035
- newErrors[k] = "Invalid format";
19036
- }
19037
- }
19038
- setErrors((prev) => __spreadValues(__spreadValues({}, prev), newErrors));
19039
- return Object.keys(newErrors).length === 0;
19040
- },
19041
- [blocks, values]
19042
- );
19043
- const validateAll = useCallback(() => {
19044
- let firstFailing = -1;
19045
- const allErrors = {};
19046
- for (let i = 0; i < blocks.length; i++) {
19047
- const block = blocks[i];
19048
- for (const field of block.fields || []) {
19049
- const k = fieldKey(block.id, field.name);
19050
- const v = values[k];
19051
- if (field.required && (v == null || v === "" || Array.isArray(v) && v.length === 0)) {
19052
- allErrors[k] = "Required";
19053
- if (firstFailing < 0) firstFailing = i;
19054
- }
19055
- }
19056
- }
19057
- setErrors(allErrors);
19058
- if (firstFailing >= 0) setCurrentBlock(firstFailing);
19059
- return Object.keys(allErrors).length === 0;
19060
- }, [blocks, values]);
19061
- return {
19062
- values,
19063
- errors,
19064
- getValue,
19065
- getError,
19066
- setFieldValue,
19067
- validateBlock,
19068
- validateAll,
19069
- currentBlock,
19070
- setCurrentBlock,
19071
- isMultiBlock
19072
- };
19073
- }
19074
19677
  function BuilderFormResolver({
19075
19678
  builder,
19076
19679
  onSubmit,
19077
19680
  onCancel,
19078
19681
  disabled,
19079
19682
  onFileUpload,
19683
+ onEntitySearch,
19684
+ onEntityCreate,
19080
19685
  onChange,
19081
19686
  submitRef,
19082
19687
  hideActions,
19083
- dense
19688
+ dense,
19689
+ onValidationError
19084
19690
  }) {
19085
19691
  const state = useBuilderState(builder.blocks);
19086
19692
  const kind = builder.builder_kind || "form";
@@ -19098,9 +19704,13 @@ function BuilderFormResolver({
19098
19704
  }, [builder, kind, state.getValue]);
19099
19705
  const handleSubmit = useCallback(() => {
19100
19706
  if (disabled) return;
19101
- if (!state.validateAll()) return;
19707
+ const failure = state.validateAllDetailed();
19708
+ if (failure.failingKeys.length > 0) {
19709
+ onValidationError == null ? void 0 : onValidationError(failure);
19710
+ return;
19711
+ }
19102
19712
  onSubmit(buildSubmission());
19103
- }, [disabled, state.validateAll, onSubmit, buildSubmission]);
19713
+ }, [disabled, state.validateAllDetailed, onSubmit, buildSubmission, onValidationError]);
19104
19714
  useEffect(() => {
19105
19715
  if (!onChange) return;
19106
19716
  onChange(buildSubmission());
@@ -19123,32 +19733,40 @@ function BuilderFormResolver({
19123
19733
  onCancel,
19124
19734
  disabled,
19125
19735
  onFileUpload,
19736
+ onEntitySearch,
19737
+ onEntityCreate,
19126
19738
  dense
19127
19739
  }
19128
19740
  );
19129
19741
  case "escalation":
19130
19742
  return /* @__PURE__ */ jsx(
19131
- EscalationCard,
19743
+ BlockForm,
19132
19744
  {
19745
+ variant: "escalation",
19133
19746
  builder,
19134
19747
  state,
19135
19748
  onSubmit: handleSubmit,
19136
19749
  disabled,
19137
19750
  onFileUpload,
19751
+ onEntitySearch,
19752
+ onEntityCreate,
19138
19753
  hideActions,
19139
19754
  dense
19140
19755
  }
19141
19756
  );
19142
19757
  default:
19143
19758
  return /* @__PURE__ */ jsx(
19144
- FormBuilder,
19759
+ BlockForm,
19145
19760
  {
19761
+ variant: "form",
19146
19762
  builder,
19147
19763
  state,
19148
19764
  onSubmit: handleSubmit,
19149
19765
  onCancel,
19150
19766
  disabled,
19151
19767
  onFileUpload,
19768
+ onEntitySearch,
19769
+ onEntityCreate,
19152
19770
  dense,
19153
19771
  hideActions
19154
19772
  }