@adoptai/genui-components 0.1.45 → 0.1.55

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 (61) 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/waterfall-chart/resolver.cjs +21 -7
  27. package/dist/composites/waterfall-chart/resolver.cjs.map +1 -1
  28. package/dist/composites/waterfall-chart/resolver.d.ts.map +1 -1
  29. package/dist/composites/waterfall-chart/resolver.js +21 -7
  30. package/dist/composites/waterfall-chart/resolver.js.map +1 -1
  31. package/dist/composites/workflow-stepper/resolver.cjs +2 -0
  32. package/dist/composites/workflow-stepper/resolver.cjs.map +1 -1
  33. package/dist/composites/workflow-stepper/resolver.d.ts.map +1 -1
  34. package/dist/composites/workflow-stepper/resolver.js +2 -0
  35. package/dist/composites/workflow-stepper/resolver.js.map +1 -1
  36. package/dist/index.cjs +1415 -783
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.js +1415 -783
  39. package/dist/index.js.map +1 -1
  40. package/dist/renderer.cjs +28 -12
  41. package/dist/renderer.cjs.map +1 -1
  42. package/dist/renderer.js +28 -12
  43. package/dist/renderer.js.map +1 -1
  44. package/dist/resolver.cjs +28 -12
  45. package/dist/resolver.cjs.map +1 -1
  46. package/dist/resolver.js +28 -12
  47. package/dist/resolver.js.map +1 -1
  48. package/dist/schemas/index.cjs +3 -3
  49. package/dist/schemas/index.cjs.map +1 -1
  50. package/dist/schemas/index.d.ts +1 -0
  51. package/dist/schemas/index.d.ts.map +1 -1
  52. package/dist/schemas/index.js +3 -3
  53. package/dist/schemas/index.js.map +1 -1
  54. package/dist/schemas/workflow-stepper.d.ts +1 -0
  55. package/dist/schemas/workflow-stepper.d.ts.map +1 -1
  56. package/dist/tool-definitions.json +4 -3
  57. package/package.json +2 -2
  58. package/dist/builders/EscalationCard.d.ts +0 -17
  59. package/dist/builders/EscalationCard.d.ts.map +0 -1
  60. package/dist/builders/FormBuilder.d.ts +0 -19
  61. package/dist/builders/FormBuilder.d.ts.map +0 -1
package/dist/index.cjs CHANGED
@@ -254,7 +254,7 @@ function alignFromSeparator(cell) {
254
254
  return "left";
255
255
  }
256
256
  function MarkdownBlock({ content }) {
257
- var _a;
257
+ var _a2;
258
258
  const lines = content.split("\n");
259
259
  const elements = [];
260
260
  let key = 0;
@@ -274,7 +274,7 @@ function MarkdownBlock({ content }) {
274
274
  3: { size: "12px", weight: 600, serif: false, mt: "12px" },
275
275
  4: { size: "11px", weight: 600, serif: false, mt: "10px" }
276
276
  };
277
- const s = (_a = cfg[level]) != null ? _a : cfg[3];
277
+ const s = (_a2 = cfg[level]) != null ? _a2 : cfg[3];
278
278
  elements.push(
279
279
  /* @__PURE__ */ jsxRuntime.jsx(
280
280
  "div",
@@ -395,8 +395,8 @@ function MarkdownBlock({ content }) {
395
395
  i++;
396
396
  }
397
397
  const colAlign = (idx) => {
398
- var _a2;
399
- return (_a2 = aligns[idx]) != null ? _a2 : "left";
398
+ var _a3;
399
+ return (_a3 = aligns[idx]) != null ? _a3 : "left";
400
400
  };
401
401
  elements.push(
402
402
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { margin: "6px 0 10px 0", overflowX: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
@@ -429,7 +429,7 @@ function MarkdownBlock({ content }) {
429
429
  idx
430
430
  )) }) }),
431
431
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: rows.map((cells, rIdx) => /* @__PURE__ */ jsxRuntime.jsx("tr", { children: headers.map((_, cIdx) => {
432
- var _a2;
432
+ var _a3;
433
433
  return /* @__PURE__ */ jsxRuntime.jsx(
434
434
  "td",
435
435
  {
@@ -440,7 +440,7 @@ function MarkdownBlock({ content }) {
440
440
  color: "var(--foreground)",
441
441
  verticalAlign: "top"
442
442
  },
443
- children: renderInline((_a2 = cells[cIdx]) != null ? _a2 : "")
443
+ children: renderInline((_a3 = cells[cIdx]) != null ? _a3 : "")
444
444
  },
445
445
  cIdx
446
446
  );
@@ -515,7 +515,7 @@ function splitEdge(line) {
515
515
  return null;
516
516
  }
517
517
  function parseMermaidFlow(source) {
518
- var _a, _b, _c;
518
+ var _a2, _b, _c;
519
519
  const lines = source.split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("%%"));
520
520
  if (!lines.length) return null;
521
521
  const header = lines[0].toLowerCase();
@@ -527,7 +527,7 @@ function parseMermaidFlow(source) {
527
527
  rl: "RL",
528
528
  bt: "BT"
529
529
  };
530
- const dirToken = (_b = (_a = header.split(/\s+/)[1]) == null ? void 0 : _a.toLowerCase()) != null ? _b : "td";
530
+ const dirToken = (_b = (_a2 = header.split(/\s+/)[1]) == null ? void 0 : _a2.toLowerCase()) != null ? _b : "td";
531
531
  const direction = (_c = directionMap[dirToken]) != null ? _c : "TB";
532
532
  const nodeMap = /* @__PURE__ */ new Map();
533
533
  const edges = [];
@@ -770,51 +770,51 @@ function DoneBadge() {
770
770
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "gx-done-badge", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "9", height: "9", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "4", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 6 9 17l-5-5" }) }) });
771
771
  }
772
772
  function RectNode({ data }) {
773
- var _a;
773
+ var _a2;
774
774
  const s = data.status;
775
775
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: nodeClass(s), style: __spreadProps(__spreadValues({}, nodeBase), { borderRadius: "6px" }), children: [
776
776
  /* @__PURE__ */ jsxRuntime.jsx(Handles, { dir: data.direction }),
777
777
  s === "done" && /* @__PURE__ */ jsxRuntime.jsx(DoneBadge, {}),
778
- String((_a = data.label) != null ? _a : "")
778
+ String((_a2 = data.label) != null ? _a2 : "")
779
779
  ] });
780
780
  }
781
781
  function RoundedNode({ data }) {
782
- var _a;
782
+ var _a2;
783
783
  const s = data.status;
784
784
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: nodeClass(s), style: __spreadProps(__spreadValues({}, nodeBase), { borderRadius: "999px" }), children: [
785
785
  /* @__PURE__ */ jsxRuntime.jsx(Handles, { dir: data.direction }),
786
786
  s === "done" && /* @__PURE__ */ jsxRuntime.jsx(DoneBadge, {}),
787
- String((_a = data.label) != null ? _a : "")
787
+ String((_a2 = data.label) != null ? _a2 : "")
788
788
  ] });
789
789
  }
790
790
  function CircleNode({ data }) {
791
- var _a;
791
+ var _a2;
792
792
  const s = data.status;
793
793
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: nodeClass(s), style: __spreadProps(__spreadValues({}, nodeBase), { borderRadius: "50%", padding: "6px" }), children: [
794
794
  /* @__PURE__ */ jsxRuntime.jsx(Handles, { dir: data.direction }),
795
795
  s === "done" && /* @__PURE__ */ jsxRuntime.jsx(DoneBadge, {}),
796
- String((_a = data.label) != null ? _a : "")
796
+ String((_a2 = data.label) != null ? _a2 : "")
797
797
  ] });
798
798
  }
799
799
  function DiamondNode({ data }) {
800
- var _a;
800
+ var _a2;
801
801
  const s = data.status;
802
802
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: nodeClass(s), style: { position: "relative", width: "100%", height: "100%", display: "flex", alignItems: "center", justifyContent: "center", border: "none", background: "transparent" }, children: [
803
803
  /* @__PURE__ */ jsxRuntime.jsx(Handles, { dir: data.direction }),
804
804
  s === "done" && /* @__PURE__ */ jsxRuntime.jsx(DoneBadge, {}),
805
805
  /* @__PURE__ */ jsxRuntime.jsx("svg", { style: { position: "absolute", inset: 0, width: "100%", height: "100%", overflow: "visible" }, viewBox: "0 0 1 1", preserveAspectRatio: "none", children: /* @__PURE__ */ jsxRuntime.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" }) }),
806
- /* @__PURE__ */ jsxRuntime.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 : "") })
806
+ /* @__PURE__ */ jsxRuntime.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 : "") })
807
807
  ] });
808
808
  }
809
809
  function CylinderNode({ data }) {
810
- var _a;
810
+ var _a2;
811
811
  const a = 5;
812
812
  const s = data.status;
813
813
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: nodeClass(s), style: { position: "relative", width: "100%", height: "100%", border: "none", background: "transparent" }, children: [
814
814
  /* @__PURE__ */ jsxRuntime.jsx(Handles, { dir: data.direction }),
815
815
  s === "done" && /* @__PURE__ */ jsxRuntime.jsx(DoneBadge, {}),
816
816
  /* @__PURE__ */ jsxRuntime.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 } }),
817
- /* @__PURE__ */ jsxRuntime.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 : "") }),
817
+ /* @__PURE__ */ jsxRuntime.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 : "") }),
818
818
  /* @__PURE__ */ jsxRuntime.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 } })
819
819
  ] });
820
820
  }
@@ -952,31 +952,31 @@ function FullscreenModal({ nodes, edges, title, onClose }) {
952
952
  function usePrefersReducedMotion() {
953
953
  const [reduced, setReduced] = React41.useState(false);
954
954
  React41.useEffect(() => {
955
- var _a;
955
+ var _a2;
956
956
  if (typeof matchMedia === "undefined") return;
957
957
  const mq = matchMedia("(prefers-reduced-motion: reduce)");
958
958
  setReduced(mq.matches);
959
959
  const h = () => setReduced(mq.matches);
960
- (_a = mq.addEventListener) == null ? void 0 : _a.call(mq, "change", h);
960
+ (_a2 = mq.addEventListener) == null ? void 0 : _a2.call(mq, "change", h);
961
961
  return () => {
962
- var _a2;
963
- return (_a2 = mq.removeEventListener) == null ? void 0 : _a2.call(mq, "change", h);
962
+ var _a3;
963
+ return (_a3 = mq.removeEventListener) == null ? void 0 : _a3.call(mq, "change", h);
964
964
  };
965
965
  }, []);
966
966
  return reduced;
967
967
  }
968
968
  function topoOrder(nodeIds, edges) {
969
- var _a, _b, _c, _d;
969
+ var _a2, _b, _c, _d;
970
970
  const indeg = new Map(nodeIds.map((id) => [id, 0]));
971
971
  const adj = new Map(nodeIds.map((id) => [id, []]));
972
972
  for (const e of edges) {
973
973
  if (!indeg.has(e.target) || !adj.has(e.source)) continue;
974
- indeg.set(e.target, ((_a = indeg.get(e.target)) != null ? _a : 0) + 1);
974
+ indeg.set(e.target, ((_a2 = indeg.get(e.target)) != null ? _a2 : 0) + 1);
975
975
  adj.get(e.source).push(e.target);
976
976
  }
977
977
  const queue = nodeIds.filter((id) => {
978
- var _a2;
979
- return ((_a2 = indeg.get(id)) != null ? _a2 : 0) === 0;
978
+ var _a3;
979
+ return ((_a3 = indeg.get(id)) != null ? _a3 : 0) === 0;
980
980
  });
981
981
  const seen = /* @__PURE__ */ new Set();
982
982
  const order = [];
@@ -1029,11 +1029,11 @@ function useAutoplay(order, enabled) {
1029
1029
  }, [order, step]);
1030
1030
  }
1031
1031
  function resolveStates(nodes, nodeStates) {
1032
- var _a, _b;
1032
+ var _a2, _b;
1033
1033
  if (!nodeStates) return {};
1034
1034
  const m = {};
1035
1035
  for (const n of nodes) {
1036
- const label = (_a = n.data) == null ? void 0 : _a.label;
1036
+ const label = (_a2 = n.data) == null ? void 0 : _a2.label;
1037
1037
  const st = (_b = nodeStates[n.id]) != null ? _b : label ? nodeStates[label] : void 0;
1038
1038
  if (st) m[n.id] = st;
1039
1039
  }
@@ -1049,8 +1049,8 @@ function Inner({ diagram, title, autoplay, nodeStates }) {
1049
1049
  const layout = React41.useMemo(() => parsed ? computeLayout(parsed) : null, [parsed]);
1050
1050
  const themedEdges = React41.useMemo(
1051
1051
  () => {
1052
- var _a;
1053
- return ((_a = layout == null ? void 0 : layout.edges) != null ? _a : []).map((e) => __spreadProps(__spreadValues({}, e), {
1052
+ var _a2;
1053
+ return ((_a2 = layout == null ? void 0 : layout.edges) != null ? _a2 : []).map((e) => __spreadProps(__spreadValues({}, e), {
1054
1054
  style: __spreadProps(__spreadValues({}, e.style), { stroke: tokens.ACCENT, strokeWidth: 1.75 }),
1055
1055
  labelStyle: { fill: tokens.MUTED, fontSize: 10, fontFamily: "var(--font-sans, Figtree, system-ui, sans-serif)" },
1056
1056
  labelBgStyle: { fill: "#ffffff", fillOpacity: 0.92 },
@@ -1061,21 +1061,21 @@ function Inner({ diagram, title, autoplay, nodeStates }) {
1061
1061
  );
1062
1062
  const order = React41.useMemo(
1063
1063
  () => {
1064
- var _a, _b;
1065
- return topoOrder(((_a = layout == null ? void 0 : layout.nodes) != null ? _a : []).map((n) => n.id), (_b = layout == null ? void 0 : layout.edges) != null ? _b : []);
1064
+ var _a2, _b;
1065
+ return topoOrder(((_a2 = layout == null ? void 0 : layout.nodes) != null ? _a2 : []).map((n) => n.id), (_b = layout == null ? void 0 : layout.edges) != null ? _b : []);
1066
1066
  },
1067
1067
  [layout]
1068
1068
  );
1069
1069
  const autoStatus = useAutoplay(order, !!autoplay);
1070
1070
  const staticStatus = React41.useMemo(() => {
1071
- var _a;
1072
- return resolveStates((_a = layout == null ? void 0 : layout.nodes) != null ? _a : [], nodeStates);
1071
+ var _a2;
1072
+ return resolveStates((_a2 = layout == null ? void 0 : layout.nodes) != null ? _a2 : [], nodeStates);
1073
1073
  }, [layout, nodeStates]);
1074
1074
  const statusMap = autoplay ? autoStatus : staticStatus;
1075
1075
  const displayNodes = React41.useMemo(
1076
1076
  () => {
1077
- var _a;
1078
- return ((_a = layout == null ? void 0 : layout.nodes) != null ? _a : []).map((n) => __spreadProps(__spreadValues({}, n), { data: __spreadProps(__spreadValues({}, n.data), { status: statusMap[n.id] }) }));
1077
+ var _a2;
1078
+ return ((_a2 = layout == null ? void 0 : layout.nodes) != null ? _a2 : []).map((n) => __spreadProps(__spreadValues({}, n), { data: __spreadProps(__spreadValues({}, n.data), { status: statusMap[n.id] }) }));
1079
1079
  },
1080
1080
  [layout, statusMap]
1081
1081
  );
@@ -1291,8 +1291,8 @@ function PdfViewer({ url, base64, onLoadSuccess }) {
1291
1291
  React41.useEffect(() => {
1292
1292
  if (numPages <= 1) return;
1293
1293
  const handler = (e) => {
1294
- var _a;
1295
- const tag = (_a = e.target) == null ? void 0 : _a.tagName;
1294
+ var _a2;
1295
+ const tag = (_a2 = e.target) == null ? void 0 : _a2.tagName;
1296
1296
  if (tag === "INPUT" || tag === "TEXTAREA") return;
1297
1297
  if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
1298
1298
  e.preventDefault();
@@ -1451,8 +1451,8 @@ function ExcelViewer({ url, base64, onLoadSuccess }) {
1451
1451
  React41.useEffect(() => {
1452
1452
  if (sheetNames.length <= 1) return;
1453
1453
  const handler = (e) => {
1454
- var _a;
1455
- const tag = (_a = e.target) == null ? void 0 : _a.tagName;
1454
+ var _a2;
1455
+ const tag = (_a2 = e.target) == null ? void 0 : _a2.tagName;
1456
1456
  if (tag === "INPUT" || tag === "TEXTAREA") return;
1457
1457
  if (e.key === "ArrowLeft") {
1458
1458
  e.preventDefault();
@@ -1506,8 +1506,8 @@ function ExcelViewer({ url, base64, onLoadSuccess }) {
1506
1506
  name
1507
1507
  )) }),
1508
1508
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { overflow: "auto", maxHeight: "500px" }, children: /* @__PURE__ */ jsxRuntime.jsx("table", { style: { width: "100%", borderCollapse: "collapse", fontSize: "12px" }, children: /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: data.map((row, ri) => /* @__PURE__ */ jsxRuntime.jsx("tr", { children: row.map((cell, ci) => {
1509
- var _a, _b;
1510
- const isHeader = ri === 0 || ri === 2 && ((_a = data[0]) == null ? void 0 : _a[0]) && !((_b = data[1]) == null ? void 0 : _b[0]);
1509
+ var _a2, _b;
1510
+ const isHeader = ri === 0 || ri === 2 && ((_a2 = data[0]) == null ? void 0 : _a2[0]) && !((_b = data[1]) == null ? void 0 : _b[0]);
1511
1511
  const Tag = isHeader ? "th" : "td";
1512
1512
  return /* @__PURE__ */ jsxRuntime.jsx(
1513
1513
  Tag,
@@ -1654,8 +1654,8 @@ function CsvViewer({ url, base64, delimiter, maxRows }) {
1654
1654
  i
1655
1655
  )) }) }),
1656
1656
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: shown.map((row, ri) => /* @__PURE__ */ jsxRuntime.jsx("tr", { children: header.map((_, ci) => {
1657
- var _a;
1658
- const cell = (_a = row[ci]) != null ? _a : "";
1657
+ var _a2;
1658
+ const cell = (_a2 = row[ci]) != null ? _a2 : "";
1659
1659
  return /* @__PURE__ */ jsxRuntime.jsx(
1660
1660
  "td",
1661
1661
  {
@@ -1962,12 +1962,12 @@ var statusCardSchema = zod.z.object({
1962
1962
  zod.z.object({
1963
1963
  label: zod.z.string(),
1964
1964
  variant: zod.z.string().transform((v) => {
1965
- var _a;
1966
- return (_a = variantMap[v]) != null ? _a : "bordered";
1965
+ var _a2;
1966
+ return (_a2 = variantMap[v]) != null ? _a2 : "bordered";
1967
1967
  }).default("bordered"),
1968
1968
  color: zod.z.string().transform((v) => {
1969
- var _a;
1970
- return (_a = colorMap[v]) != null ? _a : "default";
1969
+ var _a2;
1970
+ return (_a2 = colorMap[v]) != null ? _a2 : "default";
1971
1971
  }).default("default")
1972
1972
  })
1973
1973
  ).max(3).optional()
@@ -2259,9 +2259,9 @@ var groupedTableSchema = zod.z.object({
2259
2259
  key: zod.z.string(),
2260
2260
  label: zod.z.string(),
2261
2261
  align: zod.z.string().transform((v) => {
2262
- var _a;
2262
+ var _a2;
2263
2263
  const map = { left: "start", right: "end", start: "start", center: "center", end: "end" };
2264
- return (_a = map[v]) != null ? _a : "start";
2264
+ return (_a2 = map[v]) != null ? _a2 : "start";
2265
2265
  }).default("start")
2266
2266
  })).min(1).max(10),
2267
2267
  groups: zod.z.array(groupSchema).min(1).max(20)
@@ -4753,8 +4753,8 @@ var comboChartSchema = zod.z.object({
4753
4753
  lines: zod.z.array(seriesRef).max(4).optional(),
4754
4754
  data: zod.z.array(zod.z.record(zod.z.string(), zod.z.union([zod.z.string(), zod.z.number()]))).min(2).max(500)
4755
4755
  }).refine((v) => {
4756
- var _a, _b, _c, _d;
4757
- 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;
4756
+ var _a2, _b, _c, _d;
4757
+ 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;
4758
4758
  }, {
4759
4759
  message: "combo-chart needs at least one bar or line series"
4760
4760
  });
@@ -5255,7 +5255,7 @@ var workflowStepperSchema = zod.z.object({
5255
5255
  n: zod.z.number().int().positive().optional(),
5256
5256
  title: zod.z.string(),
5257
5257
  sub: zod.z.string().optional(),
5258
- status: zod.z.enum(["done", "active", "review", "pending", "failed"]),
5258
+ status: zod.z.enum(["done", "active", "review", "pending", "blocked", "failed"]),
5259
5259
  assignees: zod.z.array(
5260
5260
  zod.z.object({
5261
5261
  name: zod.z.string(),
@@ -5270,7 +5270,7 @@ var workflowStepperSchema = zod.z.object({
5270
5270
  });
5271
5271
  var workflowStepperTool = {
5272
5272
  name: "render_workflow_stepper",
5273
- 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.",
5273
+ 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.",
5274
5274
  input_schema: {
5275
5275
  type: "object",
5276
5276
  properties: {
@@ -5291,7 +5291,7 @@ var workflowStepperTool = {
5291
5291
  n: { type: "number", description: "Step number; defaults to index + 1" },
5292
5292
  title: { type: "string" },
5293
5293
  sub: { type: "string", description: "Short status caption, e.g. '7 accounts \xB7 2 exceptions'" },
5294
- status: { type: "string", enum: ["done", "active", "review", "pending", "failed"] },
5294
+ status: { type: "string", enum: ["done", "active", "review", "pending", "blocked", "failed"] },
5295
5295
  assignees: {
5296
5296
  type: "array",
5297
5297
  maxItems: 6,
@@ -5331,12 +5331,12 @@ function buildRenderUITool(selectedSchemas) {
5331
5331
 
5332
5332
  // src/schemas/coercePayload.ts
5333
5333
  function coercePayload(data) {
5334
- var _a, _b, _c;
5334
+ var _a2, _b, _c;
5335
5335
  if (!data || typeof data !== "object" || Array.isArray(data)) return data;
5336
5336
  const obj = data;
5337
5337
  const type = obj.type;
5338
5338
  if (typeof type !== "string" || !(type in schemaRegistry)) return data;
5339
- const props = (_c = (_b = (_a = schemaRegistry[type]) == null ? void 0 : _a.tool) == null ? void 0 : _b.input_schema) == null ? void 0 : _c.properties;
5339
+ const props = (_c = (_b = (_a2 = schemaRegistry[type]) == null ? void 0 : _a2.tool) == null ? void 0 : _b.input_schema) == null ? void 0 : _c.properties;
5340
5340
  if (!props || typeof props !== "object") return data;
5341
5341
  let out = null;
5342
5342
  for (const [key, propSchema] of Object.entries(props)) {
@@ -5497,8 +5497,8 @@ function ComponentActions({ children, onDownloadCSV, columnConfig, filename = "c
5497
5497
  React41.useEffect(() => {
5498
5498
  if (!open) return;
5499
5499
  const handler = (e) => {
5500
- var _a, _b;
5501
- if ((_a = menuRef.current) == null ? void 0 : _a.contains(e.target)) return;
5500
+ var _a2, _b;
5501
+ if ((_a2 = menuRef.current) == null ? void 0 : _a2.contains(e.target)) return;
5502
5502
  if ((_b = btnRef.current) == null ? void 0 : _b.contains(e.target)) return;
5503
5503
  close();
5504
5504
  };
@@ -5697,9 +5697,9 @@ var td = (align, last) => ({
5697
5697
  whiteSpace: align === "end" || align === "center" ? "nowrap" : "normal"
5698
5698
  });
5699
5699
  function DataTableResolver(p) {
5700
- var _a, _b, _c;
5700
+ var _a2, _b, _c;
5701
5701
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
5702
- const columns = (_a = p.columns) != null ? _a : [];
5702
+ const columns = (_a2 = p.columns) != null ? _a2 : [];
5703
5703
  const rows = (_b = p.rows) != null ? _b : [];
5704
5704
  const { visibleColumns, hidden, toggle, showAll, hideAll, allColumns } = useColumnVisibility(columns);
5705
5705
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -5707,8 +5707,8 @@ function DataTableResolver(p) {
5707
5707
  {
5708
5708
  filename: (_c = p.title) != null ? _c : "data-table",
5709
5709
  onDownloadCSV: () => {
5710
- var _a2;
5711
- return downloadCSV(visibleColumns, rows, (_a2 = p.title) != null ? _a2 : "data-table");
5710
+ var _a3;
5711
+ return downloadCSV(visibleColumns, rows, (_a3 = p.title) != null ? _a3 : "data-table");
5712
5712
  },
5713
5713
  columnConfig: { columns: allColumns, hidden, onToggle: toggle, onShowAll: showAll, onHideAll: hideAll },
5714
5714
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
@@ -5716,8 +5716,8 @@ function DataTableResolver(p) {
5716
5716
  /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsxs("table", { style: { width: "100%", borderCollapse: "collapse" }, children: [
5717
5717
  /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsx("tr", { children: visibleColumns.map((col) => /* @__PURE__ */ jsxRuntime.jsx("th", { style: th(col.align), children: col.label }, col.key)) }) }),
5718
5718
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: rows.map((row, ri) => /* @__PURE__ */ jsxRuntime.jsx("tr", { style: { background: ri % 2 === 0 ? "white" : "#fafafa" }, children: visibleColumns.map((col) => {
5719
- var _a2;
5720
- return /* @__PURE__ */ jsxRuntime.jsx("td", { style: td(col.align, ri === rows.length - 1), children: String((_a2 = row[col.key]) != null ? _a2 : "\u2014") }, col.key);
5719
+ var _a3;
5720
+ return /* @__PURE__ */ jsxRuntime.jsx("td", { style: td(col.align, ri === rows.length - 1), children: String((_a3 = row[col.key]) != null ? _a3 : "\u2014") }, col.key);
5721
5721
  }) }, ri)) })
5722
5722
  ] }) })
5723
5723
  ] })
@@ -5768,9 +5768,9 @@ var S = {
5768
5768
  label: { fontSize: "12px", color: exports.MUTED, flexShrink: 0 }
5769
5769
  };
5770
5770
  function StatusCardResolver(p) {
5771
- var _a, _b, _c, _d, _e;
5771
+ var _a2, _b, _c, _d, _e;
5772
5772
  const { ACCENT: ACCENT2, MUTED: MUTED2 } = useTheme();
5773
- const status = (_a = p.status) != null ? _a : "default";
5773
+ const status = (_a2 = p.status) != null ? _a2 : "default";
5774
5774
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "status-card", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: S.card, children: [
5775
5775
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: S.header, children: [
5776
5776
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", flexWrap: "wrap" }, children: [
@@ -5793,8 +5793,8 @@ function StatusCardResolver(p) {
5793
5793
  p.subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { style: S.subtitle, children: /* @__PURE__ */ jsxRuntime.jsx(Markdown, { inline: true, content: p.subtitle }) })
5794
5794
  ] }),
5795
5795
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: S.content, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column" }, children: ((_c = p.fields) != null ? _c : []).map((field, i) => {
5796
- var _a2;
5797
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: __spreadValues(__spreadValues({}, S.fieldRow), i === ((_a2 = p.fields) != null ? _a2 : []).length - 1 ? { borderBottom: "none" } : {}), children: [
5796
+ var _a3;
5797
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: __spreadValues(__spreadValues({}, S.fieldRow), i === ((_a3 = p.fields) != null ? _a3 : []).length - 1 ? { borderBottom: "none" } : {}), children: [
5798
5798
  /* @__PURE__ */ jsxRuntime.jsx("span", { style: S.label, children: field.label }),
5799
5799
  /* @__PURE__ */ jsxRuntime.jsx("span", { style: {
5800
5800
  fontSize: "13px",
@@ -5847,8 +5847,8 @@ var statusStyles = {
5847
5847
  default: { border: "#dedede", bg: "#f6f6f6", icon: "\u2139" }
5848
5848
  };
5849
5849
  function AlertResolver(p) {
5850
- var _a, _b;
5851
- const status = toAlertStatus((_a = p.color) != null ? _a : "default");
5850
+ var _a2, _b;
5851
+ const status = toAlertStatus((_a2 = p.color) != null ? _a2 : "default");
5852
5852
  const s = statusStyles[status];
5853
5853
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "alert", children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
5854
5854
  "div",
@@ -5965,9 +5965,9 @@ var cardStyle = {
5965
5965
  overflow: "hidden"
5966
5966
  };
5967
5967
  function StatGridResolver(p) {
5968
- var _a;
5968
+ var _a2;
5969
5969
  const { MUTED: MUTED2 } = useTheme();
5970
- return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: "stat-grid", children: /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx("div", { style: cardStyle, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "4px", padding: "4px 0", minWidth: 0 }, children: [
5970
+ return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: "stat-grid", children: /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx("div", { style: cardStyle, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "4px", padding: "4px 0", minWidth: 0 }, children: [
5971
5971
  /* @__PURE__ */ jsxRuntime.jsx("p", { style: __spreadValues({ fontSize: "11.5px", color: MUTED2, letterSpacing: "0.02em", textTransform: "uppercase", margin: 0 }, TRUNCATE), children: stat.label }),
5972
5972
  /* @__PURE__ */ jsxRuntime.jsx(
5973
5973
  FitText,
@@ -5986,7 +5986,7 @@ function StatGridResolver(p) {
5986
5986
  init_Markdown();
5987
5987
  init_ThemeContext();
5988
5988
  function TabsPanelResolver(p) {
5989
- var _a;
5989
+ var _a2;
5990
5990
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2 } = useTheme();
5991
5991
  const [activeIdx, setActiveIdx] = React41.useState(0);
5992
5992
  const activeTab = p.tabs[activeIdx];
@@ -6005,8 +6005,8 @@ function TabsPanelResolver(p) {
6005
6005
  borderRight: `1px solid ${BORDER4}`,
6006
6006
  borderBottom: `1px solid ${BORDER4}`
6007
6007
  },
6008
- children: ((_a = p.tabs) != null ? _a : []).map((tab, i) => {
6009
- var _a2;
6008
+ children: ((_a2 = p.tabs) != null ? _a2 : []).map((tab, i) => {
6009
+ var _a3;
6010
6010
  const isActive = i === activeIdx;
6011
6011
  return /* @__PURE__ */ jsxRuntime.jsxs(
6012
6012
  "button",
@@ -6027,7 +6027,7 @@ function TabsPanelResolver(p) {
6027
6027
  color: isActive ? "var(--foreground)" : MUTED2,
6028
6028
  position: "relative",
6029
6029
  transition: "all 0.15s ease",
6030
- borderRadius: i === 0 ? "8px 0 0 0" : i === ((_a2 = p.tabs) != null ? _a2 : []).length - 1 ? "0 8px 0 0" : "0"
6030
+ borderRadius: i === 0 ? "8px 0 0 0" : i === ((_a3 = p.tabs) != null ? _a3 : []).length - 1 ? "0 8px 0 0" : "0"
6031
6031
  },
6032
6032
  children: [
6033
6033
  isActive && /* @__PURE__ */ jsxRuntime.jsx(
@@ -6101,16 +6101,16 @@ var thStyle = {
6101
6101
  whiteSpace: "nowrap"
6102
6102
  };
6103
6103
  function SparklineTableResolver(p) {
6104
- var _a, _b, _c;
6104
+ var _a2, _b, _c;
6105
6105
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
6106
- const { visibleColumns, hidden, toggle, showAll, hideAll, allColumns } = useColumnVisibility((_a = p.columns) != null ? _a : []);
6106
+ const { visibleColumns, hidden, toggle, showAll, hideAll, allColumns } = useColumnVisibility((_a2 = p.columns) != null ? _a2 : []);
6107
6107
  return /* @__PURE__ */ jsxRuntime.jsx(
6108
6108
  ComponentActions,
6109
6109
  {
6110
6110
  filename: (_b = p.title) != null ? _b : "sparkline-table",
6111
6111
  onDownloadCSV: () => {
6112
- var _a2;
6113
- return downloadCSV(visibleColumns, p.rows, (_a2 = p.title) != null ? _a2 : "sparkline-table");
6112
+ var _a3;
6113
+ return downloadCSV(visibleColumns, p.rows, (_a3 = p.title) != null ? _a3 : "sparkline-table");
6114
6114
  },
6115
6115
  columnConfig: { columns: allColumns, hidden, onToggle: toggle, onShowAll: showAll, onHideAll: hideAll },
6116
6116
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
@@ -6121,10 +6121,10 @@ function SparklineTableResolver(p) {
6121
6121
  /* @__PURE__ */ jsxRuntime.jsx("th", { style: __spreadProps(__spreadValues({}, thStyle), { textAlign: "center" }), children: p.sparklineLabel })
6122
6122
  ] }) }),
6123
6123
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: ((_c = p.rows) != null ? _c : []).map((row, ri) => {
6124
- var _a2;
6125
- return /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: { background: ri % 2 === 0 ? "white" : "#fafafa", borderBottom: ri < ((_a2 = p.rows) != null ? _a2 : []).length - 1 ? "1px solid #f2f2f2" : "none" }, children: [
6124
+ var _a3;
6125
+ return /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: { background: ri % 2 === 0 ? "white" : "#fafafa", borderBottom: ri < ((_a3 = p.rows) != null ? _a3 : []).length - 1 ? "1px solid #f2f2f2" : "none" }, children: [
6126
6126
  visibleColumns.map((col) => {
6127
- var _a3;
6127
+ var _a4;
6128
6128
  return /* @__PURE__ */ jsxRuntime.jsx("td", { style: {
6129
6129
  padding: "8px 10px",
6130
6130
  fontSize: "13px",
@@ -6132,7 +6132,7 @@ function SparklineTableResolver(p) {
6132
6132
  fontVariantNumeric: "tabular-nums",
6133
6133
  whiteSpace: col.align === "end" || col.align === "center" ? "nowrap" : "normal",
6134
6134
  textAlign: col.align === "end" ? "right" : col.align === "center" ? "center" : "left"
6135
- }, children: String((_a3 = row[col.key]) != null ? _a3 : "\u2014") }, col.key);
6135
+ }, children: String((_a4 = row[col.key]) != null ? _a4 : "\u2014") }, col.key);
6136
6136
  }),
6137
6137
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: { padding: "6px 12px", textAlign: "center", verticalAlign: "middle" }, children: /* @__PURE__ */ jsxRuntime.jsx(SparklinePath, { points: row.sparkline }) })
6138
6138
  ] }, ri);
@@ -6171,17 +6171,17 @@ var th2 = {
6171
6171
  background: exports.PAPER
6172
6172
  };
6173
6173
  function HeatmapTableResolver(p) {
6174
- var _a, _b, _c, _d, _e;
6174
+ var _a2, _b, _c, _d, _e;
6175
6175
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
6176
- const colDefs = ((_a = p.columns) != null ? _a : []).map((c) => ({ key: c.key, label: c.label }));
6176
+ const colDefs = ((_a2 = p.columns) != null ? _a2 : []).map((c) => ({ key: c.key, label: c.label }));
6177
6177
  const { visibleColumns, hidden, toggle, showAll, hideAll, allColumns } = useColumnVisibility(colDefs);
6178
6178
  const visibleKeys = new Set(visibleColumns.map((c) => c.key));
6179
6179
  const csvRows = ((_b = p.rows) != null ? _b : []).map((row) => {
6180
- var _a2;
6180
+ var _a3;
6181
6181
  const obj = { Asset: row.rowLabel };
6182
- ((_a2 = row.cells) != null ? _a2 : []).forEach((cell, ci) => {
6183
- var _a3;
6184
- if (ci < ((_a3 = p.columns) != null ? _a3 : []).length) obj[p.columns[ci].key] = cell.value;
6182
+ ((_a3 = row.cells) != null ? _a3 : []).forEach((cell, ci) => {
6183
+ var _a4;
6184
+ if (ci < ((_a4 = p.columns) != null ? _a4 : []).length) obj[p.columns[ci].key] = cell.value;
6185
6185
  });
6186
6186
  return obj;
6187
6187
  });
@@ -6190,8 +6190,8 @@ function HeatmapTableResolver(p) {
6190
6190
  {
6191
6191
  filename: (_c = p.title) != null ? _c : "heatmap-table",
6192
6192
  onDownloadCSV: () => {
6193
- var _a2;
6194
- return downloadCSV([{ key: "Asset", label: "Asset" }, ...visibleColumns], csvRows, (_a2 = p.title) != null ? _a2 : "heatmap-table");
6193
+ var _a3;
6194
+ return downloadCSV([{ key: "Asset", label: "Asset" }, ...visibleColumns], csvRows, (_a3 = p.title) != null ? _a3 : "heatmap-table");
6195
6195
  },
6196
6196
  columnConfig: { columns: allColumns, hidden, onToggle: toggle, onShowAll: showAll, onHideAll: hideAll },
6197
6197
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
@@ -6202,12 +6202,12 @@ function HeatmapTableResolver(p) {
6202
6202
  ((_d = p.columns) != null ? _d : []).map((col) => visibleKeys.has(col.key) ? /* @__PURE__ */ jsxRuntime.jsx("th", { style: th2, children: col.label }, col.key) : null)
6203
6203
  ] }) }),
6204
6204
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: ((_e = p.rows) != null ? _e : []).map((row, ri) => {
6205
- var _a2, _b2;
6206
- return /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: { borderBottom: ri < ((_a2 = p.rows) != null ? _a2 : []).length - 1 ? "1px solid #e5e5e5" : "none" }, children: [
6205
+ var _a3, _b2;
6206
+ return /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: { borderBottom: ri < ((_a3 = p.rows) != null ? _a3 : []).length - 1 ? "1px solid #e5e5e5" : "none" }, children: [
6207
6207
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: { padding: "8px 10px", fontWeight: 500, color: "var(--foreground)", fontSize: "12.5px", background: "white" }, children: row.rowLabel }),
6208
6208
  ((_b2 = row.cells) != null ? _b2 : []).map((cell, ci) => {
6209
- var _a3;
6210
- return ci < ((_a3 = p.columns) != null ? _a3 : []).length && visibleKeys.has(p.columns[ci].key) ? /* @__PURE__ */ jsxRuntime.jsx(
6209
+ var _a4;
6210
+ return ci < ((_a4 = p.columns) != null ? _a4 : []).length && visibleKeys.has(p.columns[ci].key) ? /* @__PURE__ */ jsxRuntime.jsx(
6211
6211
  "td",
6212
6212
  {
6213
6213
  style: {
@@ -6252,9 +6252,9 @@ var thStyle2 = {
6252
6252
  whiteSpace: "nowrap"
6253
6253
  };
6254
6254
  function ScreenerTableResolver(p) {
6255
- var _a, _b, _c, _d, _e, _f;
6255
+ var _a2, _b, _c, _d, _e, _f;
6256
6256
  const { ACCENT: ACCENT2, BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
6257
- const [activeFilters, setActiveFilters] = React41.useState(new Set((_a = p.activeFilters) != null ? _a : []));
6257
+ const [activeFilters, setActiveFilters] = React41.useState(new Set((_a2 = p.activeFilters) != null ? _a2 : []));
6258
6258
  const { visibleColumns, hidden, toggle, showAll, hideAll, allColumns } = useColumnVisibility((_b = p.columns) != null ? _b : []);
6259
6259
  const toggleFilter = (f) => setActiveFilters((prev) => {
6260
6260
  const next = new Set(prev);
@@ -6266,8 +6266,8 @@ function ScreenerTableResolver(p) {
6266
6266
  {
6267
6267
  filename: (_c = p.title) != null ? _c : "screener-table",
6268
6268
  onDownloadCSV: () => {
6269
- var _a2;
6270
- return downloadCSV(visibleColumns, p.rows, (_a2 = p.title) != null ? _a2 : "screener-table");
6269
+ var _a3;
6270
+ return downloadCSV(visibleColumns, p.rows, (_a3 = p.title) != null ? _a3 : "screener-table");
6271
6271
  },
6272
6272
  columnConfig: { columns: allColumns, hidden, onToggle: toggle, onShowAll: showAll, onHideAll: hideAll },
6273
6273
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
@@ -6291,9 +6291,9 @@ function ScreenerTableResolver(p) {
6291
6291
  /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsxs("table", { style: { width: "100%", borderCollapse: "collapse", minWidth: "420px" }, children: [
6292
6292
  /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsx("tr", { children: visibleColumns.map((col) => /* @__PURE__ */ jsxRuntime.jsx("th", { style: __spreadProps(__spreadValues({}, thStyle2), { textAlign: col.align === "end" ? "right" : col.align === "center" ? "center" : "left" }), children: col.label }, col.key)) }) }),
6293
6293
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: ((_f = p.rows) != null ? _f : []).map((row, ri) => {
6294
- var _a2;
6295
- return /* @__PURE__ */ jsxRuntime.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) => {
6296
- var _a3;
6294
+ var _a3;
6295
+ return /* @__PURE__ */ jsxRuntime.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) => {
6296
+ var _a4;
6297
6297
  const raw = row[col.key];
6298
6298
  return /* @__PURE__ */ jsxRuntime.jsx("td", { style: {
6299
6299
  padding: "8px 10px",
@@ -6302,7 +6302,7 @@ function ScreenerTableResolver(p) {
6302
6302
  fontVariantNumeric: "tabular-nums",
6303
6303
  whiteSpace: col.align === "end" || col.align === "center" || col.meterKey ? "nowrap" : "normal",
6304
6304
  textAlign: col.align === "end" ? "right" : col.align === "center" ? "center" : "left"
6305
- }, children: col.meterKey && typeof raw === "number" ? /* @__PURE__ */ jsxRuntime.jsx(MeterBar, { value: raw, max: (_a3 = col.meterMax) != null ? _a3 : 100 }) : String(raw != null ? raw : "\u2014") }, col.key);
6305
+ }, children: col.meterKey && typeof raw === "number" ? /* @__PURE__ */ jsxRuntime.jsx(MeterBar, { value: raw, max: (_a4 = col.meterMax) != null ? _a4 : 100 }) : String(raw != null ? raw : "\u2014") }, col.key);
6306
6306
  }) }, ri);
6307
6307
  }) })
6308
6308
  ] }) })
@@ -6323,7 +6323,7 @@ var th3 = {
6323
6323
  background: exports.PAPER
6324
6324
  };
6325
6325
  function GroupRows({ group, columns, depth }) {
6326
- var _a, _b;
6326
+ var _a2, _b;
6327
6327
  const [open, setOpen] = React41.useState(true);
6328
6328
  const indent = depth * 14;
6329
6329
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -6342,9 +6342,9 @@ function GroupRows({ group, columns, depth }) {
6342
6342
  }
6343
6343
  ),
6344
6344
  open && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6345
- (_a = group.subGroups) == null ? void 0 : _a.map((sub, si) => /* @__PURE__ */ jsxRuntime.jsx(GroupRows, { group: __spreadProps(__spreadValues({}, sub), { subGroups: void 0 }), columns, depth: depth + 1 }, si)),
6345
+ (_a2 = group.subGroups) == null ? void 0 : _a2.map((sub, si) => /* @__PURE__ */ jsxRuntime.jsx(GroupRows, { group: __spreadProps(__spreadValues({}, sub), { subGroups: void 0 }), columns, depth: depth + 1 }, si)),
6346
6346
  ((_b = group.rows) != null ? _b : []).map((row, ri) => /* @__PURE__ */ jsxRuntime.jsx("tr", { style: { borderBottom: "1px solid #f2f2f2" }, children: columns.map((col, ci) => {
6347
- var _a2;
6347
+ var _a3;
6348
6348
  return /* @__PURE__ */ jsxRuntime.jsx(
6349
6349
  "td",
6350
6350
  {
@@ -6356,7 +6356,7 @@ function GroupRows({ group, columns, depth }) {
6356
6356
  fontVariantNumeric: "tabular-nums",
6357
6357
  textAlign: col.align === "end" ? "right" : col.align === "center" ? "center" : "left"
6358
6358
  },
6359
- children: String((_a2 = row[col.key]) != null ? _a2 : "\u2014")
6359
+ children: String((_a3 = row[col.key]) != null ? _a3 : "\u2014")
6360
6360
  },
6361
6361
  col.key
6362
6362
  );
@@ -6365,14 +6365,14 @@ function GroupRows({ group, columns, depth }) {
6365
6365
  ] });
6366
6366
  }
6367
6367
  function GroupedTableResolver(p) {
6368
- var _a, _b, _c, _d;
6368
+ var _a2, _b, _c, _d;
6369
6369
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
6370
- const { visibleColumns, hidden, toggle, showAll, hideAll, allColumns } = useColumnVisibility((_a = p.columns) != null ? _a : []);
6370
+ const { visibleColumns, hidden, toggle, showAll, hideAll, allColumns } = useColumnVisibility((_a2 = p.columns) != null ? _a2 : []);
6371
6371
  const flatRows = [];
6372
6372
  const flatten = (groups) => {
6373
- var _a2;
6373
+ var _a3;
6374
6374
  for (const g of groups) {
6375
- for (const row of (_a2 = g.rows) != null ? _a2 : []) flatRows.push(row);
6375
+ for (const row of (_a3 = g.rows) != null ? _a3 : []) flatRows.push(row);
6376
6376
  if (g.subGroups) flatten(g.subGroups);
6377
6377
  }
6378
6378
  };
@@ -6382,8 +6382,8 @@ function GroupedTableResolver(p) {
6382
6382
  {
6383
6383
  filename: (_c = p.title) != null ? _c : "grouped-table",
6384
6384
  onDownloadCSV: () => {
6385
- var _a2;
6386
- return downloadCSV(visibleColumns, flatRows, (_a2 = p.title) != null ? _a2 : "grouped-table");
6385
+ var _a3;
6386
+ return downloadCSV(visibleColumns, flatRows, (_a3 = p.title) != null ? _a3 : "grouped-table");
6387
6387
  },
6388
6388
  columnConfig: { columns: allColumns, hidden, onToggle: toggle, onShowAll: showAll, onHideAll: hideAll },
6389
6389
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
@@ -6427,16 +6427,16 @@ var dotColor = {
6427
6427
  neutral: "#888888"
6428
6428
  };
6429
6429
  function NewsFeedResolver(p) {
6430
- var _a, _b;
6430
+ var _a2, _b;
6431
6431
  const { ACCENT: ACCENT2, MUTED: MUTED2 } = useTheme();
6432
6432
  const [filter, setFilter] = React41.useState(null);
6433
6433
  const sentiments = ["positive", "neutral", "negative"].filter(
6434
6434
  (s) => {
6435
- var _a2;
6436
- return ((_a2 = p.items) != null ? _a2 : []).some((i) => i.sentiment === s);
6435
+ var _a3;
6436
+ return ((_a3 = p.items) != null ? _a3 : []).some((i) => i.sentiment === s);
6437
6437
  }
6438
6438
  );
6439
- const visible = filter ? ((_a = p.items) != null ? _a : []).filter((i) => i.sentiment === filter) : p.items;
6439
+ const visible = filter ? ((_a2 = p.items) != null ? _a2 : []).filter((i) => i.sentiment === filter) : p.items;
6440
6440
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "news-feed", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
6441
6441
  p.title && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
6442
6442
  sentiments.length > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "6px" }, children: sentiments.map((s) => /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: () => setFilter(filter === s ? null : s), style: sentimentStyle(s, filter === s), children: s }, s)) }),
@@ -6497,9 +6497,9 @@ var tooltipStyle = {
6497
6497
  color: "var(--foreground)"
6498
6498
  };
6499
6499
  function AreaChartResolver(p) {
6500
- var _a, _b, _c, _d;
6500
+ var _a2, _b, _c, _d;
6501
6501
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
6502
- const series = (_a = p.series) != null ? _a : [];
6502
+ const series = (_a2 = p.series) != null ? _a2 : [];
6503
6503
  const data = (_b = p.data) != null ? _b : [];
6504
6504
  const xKey = (_c = p.xKey) != null ? _c : "x";
6505
6505
  const { isVisible, toggle } = useSeriesToggle(series.map((s) => s.dataKey));
@@ -6588,12 +6588,12 @@ var tooltipStyle2 = {
6588
6588
  };
6589
6589
  var tdStyle = { padding: "5px 10px 5px 0", fontSize: "12.5px", verticalAlign: "middle" };
6590
6590
  function AllocationDonutResolver(p) {
6591
- var _a, _b;
6591
+ var _a2, _b;
6592
6592
  const { BORDER: BORDER4, MUTED: MUTED2, CHART_PALETTE: CHART_PALETTE2 } = useTheme();
6593
- const slices = (_a = p.slices) != null ? _a : [];
6593
+ const slices = (_a2 = p.slices) != null ? _a2 : [];
6594
6594
  const allData = slices.map((s, i) => {
6595
- var _a2;
6596
- return __spreadProps(__spreadValues({}, s), { fill: (_a2 = s.color) != null ? _a2 : PALETTE[i % PALETTE.length] });
6595
+ var _a3;
6596
+ return __spreadProps(__spreadValues({}, s), { fill: (_a3 = s.color) != null ? _a3 : PALETTE[i % PALETTE.length] });
6597
6597
  });
6598
6598
  const { isVisible, toggle } = useSeriesToggle(allData.map((s) => s.label));
6599
6599
  const data = allData.filter((s) => isVisible(s.label));
@@ -6678,6 +6678,14 @@ init_ThemeContext();
6678
6678
  var TERRACOTTA = exports.ACCENT;
6679
6679
  var POS = "#15803d";
6680
6680
  var NEG = "#dc2626";
6681
+ var _CURRENCY = /* @__PURE__ */ new Set(["$", "\u20AC", "\xA3", "\xA5", "\u20B9"]);
6682
+ function _abbrev(n) {
6683
+ const a = Math.abs(n);
6684
+ if (a >= 1e9) return `${(a / 1e9).toFixed(1).replace(/\.0$/, "")}B`;
6685
+ if (a >= 1e6) return `${(a / 1e6).toFixed(1).replace(/\.0$/, "")}M`;
6686
+ if (a >= 1e3) return `${(a / 1e3).toFixed(1).replace(/\.0$/, "")}K`;
6687
+ return `${a}`;
6688
+ }
6681
6689
  var tooltipStyle3 = {
6682
6690
  fontSize: "12px",
6683
6691
  borderRadius: "8px",
@@ -6687,11 +6695,20 @@ var tooltipStyle3 = {
6687
6695
  color: "var(--foreground)"
6688
6696
  };
6689
6697
  function WaterfallChartResolver(p) {
6690
- var _a, _b, _c;
6698
+ var _a2, _b, _c;
6691
6699
  const { ACCENT: ACCENT2, BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
6692
6700
  const { isVisible, toggle } = useSeriesToggle(["Positive", "Negative", "Total"]);
6693
- const unit = (_a = p.unit) != null ? _a : "";
6701
+ const unit = (_a2 = p.unit) != null ? _a2 : "";
6694
6702
  const bars = (_b = p.bars) != null ? _b : [];
6703
+ const fmtVal = (v, withSign = false) => {
6704
+ const sign = v < 0 ? "-" : withSign && v > 0 ? "+" : "";
6705
+ const body = _CURRENCY.has(unit) ? `${unit}${_abbrev(v)}` : `${_abbrev(v)}${unit}`;
6706
+ return `${sign}${body}`;
6707
+ };
6708
+ const yAxisWidth = Math.min(
6709
+ 72,
6710
+ Math.max(40, ...bars.map((b) => fmtVal(b.value).length * 7 + 8))
6711
+ );
6695
6712
  let running = 0;
6696
6713
  const chartData = bars.map((bar) => {
6697
6714
  const base = bar.isTotal ? 0 : running;
@@ -6701,7 +6718,7 @@ function WaterfallChartResolver(p) {
6701
6718
  }).filter((d) => isVisible(d.category));
6702
6719
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_c = p.title) != null ? _c : "waterfall-chart", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "12px" }, children: [
6703
6720
  p.title && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
6704
- /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: 200, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.BarChart, { data: chartData, margin: { top: 4, right: 8, left: 0, bottom: 0 }, children: [
6721
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: 200, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.BarChart, { data: chartData, margin: { top: 4, right: 8, left: 4, bottom: 0 }, children: [
6705
6722
  /* @__PURE__ */ jsxRuntime.jsx(
6706
6723
  recharts.XAxis,
6707
6724
  {
@@ -6717,17 +6734,14 @@ function WaterfallChartResolver(p) {
6717
6734
  tick: { fontSize: 11, fill: MUTED2 },
6718
6735
  axisLine: false,
6719
6736
  tickLine: false,
6720
- width: 42,
6721
- tickFormatter: (v) => `${v}${unit}`
6737
+ width: yAxisWidth,
6738
+ tickFormatter: (v) => fmtVal(Number(v))
6722
6739
  }
6723
6740
  ),
6724
6741
  /* @__PURE__ */ jsxRuntime.jsx(
6725
6742
  recharts.Tooltip,
6726
6743
  {
6727
- formatter: (value) => {
6728
- const v = Number(value);
6729
- return [`${v > 0 ? "+" : ""}${v}${unit}`, ""];
6730
- },
6744
+ formatter: (value) => [fmtVal(Number(value), true), ""],
6731
6745
  contentStyle: tooltipStyle3,
6732
6746
  cursor: { fill: "#f2f2f2" }
6733
6747
  }
@@ -6967,9 +6981,9 @@ function FlowCanvasRenderer({
6967
6981
  ] });
6968
6982
  }
6969
6983
  function FlowCanvasResolver(p) {
6970
- var _a;
6984
+ var _a2;
6971
6985
  const { ACCENT: ACCENT2, BORDER: BORDER4 } = useTheme();
6972
- return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a = p.title) != null ? _a : "flow-canvas", children: /* @__PURE__ */ jsxRuntime.jsx(
6986
+ return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a2 = p.title) != null ? _a2 : "flow-canvas", children: /* @__PURE__ */ jsxRuntime.jsx(
6973
6987
  FlowCanvasRenderer,
6974
6988
  {
6975
6989
  diagram: p.diagram,
@@ -6992,13 +7006,13 @@ var categoryLabels = {
6992
7006
  other: "Other"
6993
7007
  };
6994
7008
  function TrialBalanceResolver(p) {
6995
- var _a, _b, _c, _d;
7009
+ var _a2, _b, _c, _d;
6996
7010
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
6997
7011
  let totalDebit = 0;
6998
7012
  let totalCredit = 0;
6999
- ((_a = p.groups) != null ? _a : []).forEach((g) => {
7000
- var _a2;
7001
- return ((_a2 = g.accounts) != null ? _a2 : []).forEach((a) => {
7013
+ ((_a2 = p.groups) != null ? _a2 : []).forEach((g) => {
7014
+ var _a3;
7015
+ return ((_a3 = g.accounts) != null ? _a3 : []).forEach((a) => {
7002
7016
  totalDebit += a.debit;
7003
7017
  totalCredit += a.credit;
7004
7018
  });
@@ -7006,12 +7020,12 @@ function TrialBalanceResolver(p) {
7006
7020
  const balanced = Math.abs(totalDebit - totalCredit) < 5e-3;
7007
7021
  const csvCols = [{ key: "category", label: "Category" }, { key: "code", label: "Code" }, { key: "name", label: "Account" }, { key: "debit", label: "Debit" }, { key: "credit", label: "Credit" }];
7008
7022
  const csvRows = ((_b = p.groups) != null ? _b : []).flatMap((g) => {
7009
- var _a2;
7010
- return ((_a2 = g.accounts) != null ? _a2 : []).map((a) => ({ category: g.category, code: a.code, name: a.name, debit: a.debit, credit: a.credit }));
7023
+ var _a3;
7024
+ return ((_a3 = g.accounts) != null ? _a3 : []).map((a) => ({ category: g.category, code: a.code, name: a.name, debit: a.debit, credit: a.credit }));
7011
7025
  });
7012
7026
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_c = p.title) != null ? _c : "trial-balance", onDownloadCSV: () => {
7013
- var _a2;
7014
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "trial-balance");
7027
+ var _a3;
7028
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "trial-balance");
7015
7029
  }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
7016
7030
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
7017
7031
  p.title && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
@@ -7044,9 +7058,9 @@ function TrialBalanceResolver(p) {
7044
7058
  }, children: h }, h)) }) }),
7045
7059
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
7046
7060
  ((_d = p.groups) != null ? _d : []).map((group) => {
7047
- var _a2, _b2, _c2;
7061
+ var _a3, _b2, _c2;
7048
7062
  let gDebit = 0, gCredit = 0;
7049
- ((_a2 = group.accounts) != null ? _a2 : []).forEach((a) => {
7063
+ ((_a3 = group.accounts) != null ? _a3 : []).forEach((a) => {
7050
7064
  gDebit += a.debit;
7051
7065
  gCredit += a.credit;
7052
7066
  });
@@ -7095,25 +7109,25 @@ var statusColors = {
7095
7109
  };
7096
7110
  var fmt2 = (v, currency) => new Intl.NumberFormat("en-US", { style: "currency", currency: currency || "USD", minimumFractionDigits: 2 }).format(v);
7097
7111
  function JournalEntryResolver(p) {
7098
- var _a, _b, _c;
7112
+ var _a2, _b, _c;
7099
7113
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2 } = useTheme();
7100
7114
  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" }];
7101
- const csvRows = ((_a = p.entries) != null ? _a : []).flatMap((e) => {
7102
- var _a2;
7103
- return ((_a2 = e.lines) != null ? _a2 : []).map((l) => {
7104
- var _a3;
7105
- 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 };
7115
+ const csvRows = ((_a2 = p.entries) != null ? _a2 : []).flatMap((e) => {
7116
+ var _a3;
7117
+ return ((_a3 = e.lines) != null ? _a3 : []).map((l) => {
7118
+ var _a4;
7119
+ 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 };
7106
7120
  });
7107
7121
  });
7108
7122
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "journal-entry", onDownloadCSV: () => {
7109
- var _a2;
7110
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "journal-entry");
7123
+ var _a3;
7124
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "journal-entry");
7111
7125
  }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "14px" }, children: [
7112
7126
  p.title && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
7113
7127
  ((_c = p.entries) != null ? _c : []).map((entry) => {
7114
- var _a2, _b2;
7128
+ var _a3, _b2, _c2;
7115
7129
  let totalDebit = 0, totalCredit = 0;
7116
- ((_a2 = entry.lines) != null ? _a2 : []).forEach((l) => {
7130
+ ((_a3 = entry.lines) != null ? _a3 : []).forEach((l) => {
7117
7131
  totalDebit += l.debit;
7118
7132
  totalCredit += l.credit;
7119
7133
  });
@@ -7137,11 +7151,11 @@ function JournalEntryResolver(p) {
7137
7151
  letterSpacing: "0.02em"
7138
7152
  }, children: h }, h)) }) }),
7139
7153
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
7140
- entry.lines.map((line, li) => {
7141
- var _a3;
7154
+ ((_c2 = entry.lines) != null ? _c2 : []).map((line, li) => {
7155
+ var _a4;
7142
7156
  return /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: { background: li % 2 === 0 ? "white" : "#fafafa" }, children: [
7143
7157
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: { padding: "6px 12px", fontSize: "13px" }, children: line.account }),
7144
- /* @__PURE__ */ jsxRuntime.jsx("td", { style: { padding: "6px 12px", fontSize: "12px", color: MUTED2 }, children: (_a3 = line.description) != null ? _a3 : "\u2014" }),
7158
+ /* @__PURE__ */ jsxRuntime.jsx("td", { style: { padding: "6px 12px", fontSize: "12px", color: MUTED2 }, children: (_a4 = line.description) != null ? _a4 : "\u2014" }),
7145
7159
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: { padding: "6px 12px", fontSize: "13px", textAlign: "right", fontVariantNumeric: "tabular-nums" }, children: line.debit > 0 ? fmt2(line.debit, p.currency) : "\u2014" }),
7146
7160
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: { padding: "6px 12px", fontSize: "13px", textAlign: "right", fontVariantNumeric: "tabular-nums" }, children: line.credit > 0 ? fmt2(line.credit, p.currency) : "\u2014" })
7147
7161
  ] }, li);
@@ -7172,17 +7186,17 @@ function agingHeat(index, total) {
7172
7186
  return `rgba(220, 38, 38, ${alpha})`;
7173
7187
  }
7174
7188
  function AgingReportResolver(p) {
7175
- var _a, _b, _c, _d;
7189
+ var _a2, _b, _c, _d;
7176
7190
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2 } = useTheme();
7177
- const buckets = (_a = p.buckets) != null ? _a : [];
7191
+ const buckets = (_a2 = p.buckets) != null ? _a2 : [];
7178
7192
  const entities = (_b = p.entities) != null ? _b : [];
7179
7193
  const currency = (_c = p.currency) != null ? _c : "USD";
7180
7194
  const bucketCount = buckets.length;
7181
7195
  const totals = new Array(bucketCount).fill(0);
7182
7196
  let grandTotal = 0;
7183
7197
  entities.forEach((e) => {
7184
- var _a2, _b2;
7185
- ((_a2 = e.amounts) != null ? _a2 : []).forEach((a, i) => {
7198
+ var _a3, _b2;
7199
+ ((_a3 = e.amounts) != null ? _a3 : []).forEach((a, i) => {
7186
7200
  if (i < bucketCount) totals[i] += a;
7187
7201
  });
7188
7202
  grandTotal += (_b2 = e.total) != null ? _b2 : 0;
@@ -7196,8 +7210,8 @@ function AgingReportResolver(p) {
7196
7210
  return row;
7197
7211
  });
7198
7212
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_d = p.title) != null ? _d : "aging-report", onDownloadCSV: () => {
7199
- var _a2;
7200
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "aging-report");
7213
+ var _a3;
7214
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "aging-report");
7201
7215
  }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
7202
7216
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
7203
7217
  p.title && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
@@ -7215,12 +7229,12 @@ function AgingReportResolver(p) {
7215
7229
  ] }) }),
7216
7230
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
7217
7231
  entities.map((entity, ri) => {
7218
- var _a2;
7232
+ var _a3;
7219
7233
  return /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: { background: ri % 2 === 0 ? "white" : "#fafafa" }, children: [
7220
7234
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: { padding: "6px 12px", fontSize: "13px", borderBottom: `1px solid #f2f2f2`, maxWidth: "200px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: entity.name }),
7221
7235
  buckets.map((_, bi) => {
7222
- var _a3, _b2;
7223
- const val = bi < ((_a3 = entity.amounts) != null ? _a3 : []).length ? ((_b2 = entity.amounts) != null ? _b2 : [])[bi] : 0;
7236
+ var _a4, _b2;
7237
+ const val = bi < ((_a4 = entity.amounts) != null ? _a4 : []).length ? ((_b2 = entity.amounts) != null ? _b2 : [])[bi] : 0;
7224
7238
  const isLast = bi === bucketCount - 1;
7225
7239
  return /* @__PURE__ */ jsxRuntime.jsx("td", { style: {
7226
7240
  padding: "6px 12px",
@@ -7233,7 +7247,7 @@ function AgingReportResolver(p) {
7233
7247
  fontWeight: isLast && val > 0 ? 600 : void 0
7234
7248
  }, children: val !== 0 ? fmt3(val, currency) : "\u2014" }, bi);
7235
7249
  }),
7236
- /* @__PURE__ */ jsxRuntime.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) })
7250
+ /* @__PURE__ */ jsxRuntime.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) })
7237
7251
  ] }, ri);
7238
7252
  }),
7239
7253
  /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: { background: PAPER2 }, children: [
@@ -7251,14 +7265,14 @@ init_ThemeContext();
7251
7265
  var fmt4 = (v, currency) => new Intl.NumberFormat("en-US", { style: "currency", currency: currency || "USD", minimumFractionDigits: 2 }).format(v);
7252
7266
  var pctFmt = (v) => isFinite(v) ? `${v > 0 ? "+" : ""}${v.toFixed(1)}%` : "N/A";
7253
7267
  function VarianceAnalysisResolver(p) {
7254
- var _a, _b, _c, _d;
7268
+ var _a2, _b, _c, _d;
7255
7269
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
7256
- const maxAbsVar = Math.max(...((_a = p.rows) != null ? _a : []).filter((r) => !r.isSubtotal).map((r) => Math.abs(r.actual - r.budget)), 1);
7270
+ const maxAbsVar = Math.max(...((_a2 = p.rows) != null ? _a2 : []).filter((r) => !r.isSubtotal).map((r) => Math.abs(r.actual - r.budget)), 1);
7257
7271
  const csvCols = [{ key: "lineItem", label: "Line Item" }, { key: "budget", label: "Budget" }, { key: "actual", label: "Actual" }, { key: "variance", label: "Variance $" }, { key: "variancePct", label: "Variance %" }];
7258
7272
  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" }));
7259
7273
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_c = p.title) != null ? _c : "variance-analysis", onDownloadCSV: () => {
7260
- var _a2;
7261
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "variance-analysis");
7274
+ var _a3;
7275
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "variance-analysis");
7262
7276
  }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
7263
7277
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
7264
7278
  p.title && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
@@ -7279,7 +7293,7 @@ function VarianceAnalysisResolver(p) {
7279
7293
  width: i === 5 ? "60px" : void 0
7280
7294
  }, children: h }, h || i)) }) }),
7281
7295
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: ((_d = p.rows) != null ? _d : []).map((row, ri) => {
7282
- var _a2;
7296
+ var _a3;
7283
7297
  const variance = row.actual - row.budget;
7284
7298
  const pct = row.budget !== 0 ? variance / Math.abs(row.budget) * 100 : NaN;
7285
7299
  const favorable = p.favorableDirection === "higher" ? variance >= 0 : variance <= 0;
@@ -7290,7 +7304,7 @@ function VarianceAnalysisResolver(p) {
7290
7304
  fontWeight: row.isSubtotal ? 700 : void 0,
7291
7305
  borderTop: row.isSubtotal ? `1px solid ${BORDER4}` : void 0
7292
7306
  }, children: [
7293
- /* @__PURE__ */ jsxRuntime.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 }),
7307
+ /* @__PURE__ */ jsxRuntime.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 }),
7294
7308
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: { padding: "6px 10px", fontSize: "13px", textAlign: "right", fontVariantNumeric: "tabular-nums", borderBottom: `1px solid #f2f2f2` }, children: fmt4(row.budget, p.currency) }),
7295
7309
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: { padding: "6px 10px", fontSize: "13px", textAlign: "right", fontVariantNumeric: "tabular-nums", borderBottom: `1px solid #f2f2f2` }, children: fmt4(row.actual, p.currency) }),
7296
7310
  /* @__PURE__ */ jsxRuntime.jsxs("td", { style: { padding: "6px 10px", fontSize: "13px", textAlign: "right", fontVariantNumeric: "tabular-nums", borderBottom: `1px solid #f2f2f2`, color }, children: [
@@ -7324,16 +7338,16 @@ function abbreviate(v) {
7324
7338
  }
7325
7339
  var fmt5 = (v, currency) => new Intl.NumberFormat("en-US", { style: "currency", currency: currency || "USD", minimumFractionDigits: 2 }).format(v);
7326
7340
  function StackedBreakdownResolver(p) {
7327
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
7341
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
7328
7342
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, CHART_PALETTE: CHART_PALETTE2 } = useTheme();
7329
- const { isVisible, toggle } = useSeriesToggle(((_a = p.categories) != null ? _a : []).map((c) => c.name));
7343
+ const { isVisible, toggle } = useSeriesToggle(((_a2 = p.categories) != null ? _a2 : []).map((c) => c.name));
7330
7344
  const chartData = ((_b = p.periods) != null ? _b : []).map((period, pi) => {
7331
- var _a2;
7345
+ var _a3;
7332
7346
  const row = { period };
7333
7347
  let total = 0;
7334
- ((_a2 = p.categories) != null ? _a2 : []).forEach((cat) => {
7335
- var _a3, _b2;
7336
- const v = pi < ((_a3 = cat.values) != null ? _a3 : []).length ? ((_b2 = cat.values) != null ? _b2 : [])[pi] : 0;
7348
+ ((_a3 = p.categories) != null ? _a3 : []).forEach((cat) => {
7349
+ var _a4, _b2;
7350
+ const v = pi < ((_a4 = cat.values) != null ? _a4 : []).length ? ((_b2 = cat.values) != null ? _b2 : [])[pi] : 0;
7337
7351
  row[cat.name] = v;
7338
7352
  total += v;
7339
7353
  });
@@ -7347,8 +7361,8 @@ function StackedBreakdownResolver(p) {
7347
7361
  {
7348
7362
  filename: (_e = p.title) != null ? _e : "stacked-breakdown",
7349
7363
  onDownloadCSV: () => {
7350
- var _a2;
7351
- return downloadCSV(csvCols, chartData, (_a2 = p.title) != null ? _a2 : "stacked-breakdown");
7364
+ var _a3;
7365
+ return downloadCSV(csvCols, chartData, (_a3 = p.title) != null ? _a3 : "stacked-breakdown");
7352
7366
  },
7353
7367
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "12px" }, children: [
7354
7368
  p.title && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
@@ -7357,13 +7371,13 @@ function StackedBreakdownResolver(p) {
7357
7371
  /* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, { tick: { fontSize: 11, fill: MUTED2 }, axisLine: false, tickLine: false, width: 52, tickFormatter: abbreviate }),
7358
7372
  /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { contentStyle: tooltipStyle4, formatter: (value) => [fmt5(value, p.currency), ""], cursor: { fill: "#f2f2f2" } }),
7359
7373
  ((_f = p.categories) != null ? _f : []).map((cat, ci) => {
7360
- var _a2, _b2;
7374
+ var _a3, _b2;
7361
7375
  return /* @__PURE__ */ jsxRuntime.jsx(
7362
7376
  recharts.Bar,
7363
7377
  {
7364
7378
  dataKey: cat.name,
7365
7379
  stackId: "tax",
7366
- fill: (_a2 = cat.color) != null ? _a2 : PALETTE2[ci % PALETTE2.length],
7380
+ fill: (_a3 = cat.color) != null ? _a3 : PALETTE2[ci % PALETTE2.length],
7367
7381
  radius: ci === ((_b2 = p.categories) != null ? _b2 : []).length - 1 ? [3, 3, 0, 0] : void 0,
7368
7382
  hide: !isVisible(cat.name)
7369
7383
  },
@@ -7372,7 +7386,7 @@ function StackedBreakdownResolver(p) {
7372
7386
  })
7373
7387
  ] }) }),
7374
7388
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "14px" }, children: ((_g = p.categories) != null ? _g : []).map((cat, ci) => {
7375
- var _a2;
7389
+ var _a3;
7376
7390
  return /* @__PURE__ */ jsxRuntime.jsxs(
7377
7391
  "div",
7378
7392
  {
@@ -7396,7 +7410,7 @@ function StackedBreakdownResolver(p) {
7396
7410
  height: "10px",
7397
7411
  borderRadius: "2px",
7398
7412
  flexShrink: 0,
7399
- background: (_a2 = cat.color) != null ? _a2 : PALETTE2[ci % PALETTE2.length],
7413
+ background: (_a3 = cat.color) != null ? _a3 : PALETTE2[ci % PALETTE2.length],
7400
7414
  display: "inline-block",
7401
7415
  opacity: isVisible(cat.name) ? 1 : 0.3,
7402
7416
  transition: "opacity 0.15s"
@@ -7414,15 +7428,15 @@ function StackedBreakdownResolver(p) {
7414
7428
  ] }) }),
7415
7429
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
7416
7430
  ((_i = p.categories) != null ? _i : []).map((cat, ci) => {
7417
- var _a2, _b2;
7431
+ var _a3, _b2;
7418
7432
  return /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: { background: ci % 2 === 0 ? "white" : "#fafafa" }, children: [
7419
7433
  /* @__PURE__ */ jsxRuntime.jsxs("td", { style: { padding: "6px 12px", fontSize: "13px", borderBottom: `1px solid #f2f2f2` }, children: [
7420
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "inline-block", width: "8px", height: "8px", borderRadius: "2px", background: (_a2 = cat.color) != null ? _a2 : PALETTE2[ci % PALETTE2.length], marginRight: "6px" } }),
7434
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "inline-block", width: "8px", height: "8px", borderRadius: "2px", background: (_a3 = cat.color) != null ? _a3 : PALETTE2[ci % PALETTE2.length], marginRight: "6px" } }),
7421
7435
  cat.name
7422
7436
  ] }),
7423
7437
  ((_b2 = p.periods) != null ? _b2 : []).map((_, pi) => {
7424
- var _a3, _b3;
7425
- const v = pi < ((_a3 = cat.values) != null ? _a3 : []).length ? ((_b3 = cat.values) != null ? _b3 : [])[pi] : 0;
7438
+ var _a4, _b3;
7439
+ const v = pi < ((_a4 = cat.values) != null ? _a4 : []).length ? ((_b3 = cat.values) != null ? _b3 : [])[pi] : 0;
7426
7440
  return /* @__PURE__ */ jsxRuntime.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);
7427
7441
  })
7428
7442
  ] }, cat.name);
@@ -7457,9 +7471,9 @@ var tooltipStyle5 = {
7457
7471
  color: "var(--foreground)"
7458
7472
  };
7459
7473
  function ComparativeBarChartResolver(p) {
7460
- var _a, _b, _c, _d;
7474
+ var _a2, _b, _c, _d;
7461
7475
  const { BORDER: BORDER4, MUTED: MUTED2, CHART_PALETTE: CHART_PALETTE2 } = useTheme();
7462
- const series = (_a = p.series) != null ? _a : [];
7476
+ const series = (_a2 = p.series) != null ? _a2 : [];
7463
7477
  const data = (_b = p.data) != null ? _b : [];
7464
7478
  const xKey = (_c = p.xKey) != null ? _c : "x";
7465
7479
  const horizontal = p.orientation === "horizontal";
@@ -7487,13 +7501,13 @@ function ComparativeBarChartResolver(p) {
7487
7501
  ),
7488
7502
  /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { contentStyle: tooltipStyle5, cursor: { fill: "#f2f2f2" } }),
7489
7503
  series.map((s, si) => {
7490
- var _a2;
7504
+ var _a3;
7491
7505
  return /* @__PURE__ */ jsxRuntime.jsx(
7492
7506
  recharts.Bar,
7493
7507
  {
7494
7508
  dataKey: s.dataKey,
7495
7509
  name: s.name,
7496
- fill: (_a2 = s.color) != null ? _a2 : PALETTE3[si % PALETTE3.length],
7510
+ fill: (_a3 = s.color) != null ? _a3 : PALETTE3[si % PALETTE3.length],
7497
7511
  stackId: stacked ? "stack" : void 0,
7498
7512
  radius: horizontal ? void 0 : [3, 3, 0, 0],
7499
7513
  hide: !isVisible(s.dataKey),
@@ -7504,7 +7518,7 @@ function ComparativeBarChartResolver(p) {
7504
7518
  })
7505
7519
  ] }) }),
7506
7520
  series.length > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "14px" }, children: series.map((s, si) => {
7507
- var _a2;
7521
+ var _a3;
7508
7522
  return /* @__PURE__ */ jsxRuntime.jsxs(
7509
7523
  "div",
7510
7524
  {
@@ -7525,7 +7539,7 @@ function ComparativeBarChartResolver(p) {
7525
7539
  width: "10px",
7526
7540
  height: "10px",
7527
7541
  borderRadius: "2px",
7528
- background: (_a2 = s.color) != null ? _a2 : PALETTE3[si % PALETTE3.length],
7542
+ background: (_a3 = s.color) != null ? _a3 : PALETTE3[si % PALETTE3.length],
7529
7543
  display: "inline-block",
7530
7544
  opacity: isVisible(s.dataKey) ? 1 : 0.3,
7531
7545
  transition: "opacity 0.15s"
@@ -7556,8 +7570,8 @@ var priorityConfig = {
7556
7570
  low: { color: exports.MUTED, bg: "#f2f2f2" }
7557
7571
  };
7558
7572
  function ItemRow({ item }) {
7559
- var _a, _b;
7560
- const sc = (_a = statusConfig[item.status]) != null ? _a : statusConfig["not-started"];
7573
+ var _a2, _b;
7574
+ const sc = (_a2 = statusConfig[item.status]) != null ? _a2 : statusConfig["not-started"];
7561
7575
  const pc = (_b = priorityConfig[item.priority]) != null ? _b : priorityConfig.medium;
7562
7576
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
7563
7577
  display: "flex",
@@ -7626,24 +7640,24 @@ function Section({ section }) {
7626
7640
  ] });
7627
7641
  }
7628
7642
  function ComplianceChecklistResolver(p) {
7629
- var _a, _b, _c, _d;
7643
+ var _a2, _b, _c, _d;
7630
7644
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
7631
- const allItems = ((_a = p.sections) != null ? _a : []).flatMap((s) => s.items);
7645
+ const allItems = ((_a2 = p.sections) != null ? _a2 : []).flatMap((s) => s.items);
7632
7646
  const total = allItems.length;
7633
7647
  const completed = allItems.filter((i) => i.status === "completed").length;
7634
7648
  const overdue = allItems.filter((i) => i.status === "overdue").length;
7635
7649
  const pct = total > 0 ? Math.round(completed / total * 100) : 0;
7636
7650
  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" }];
7637
7651
  const csvRows = ((_b = p.sections) != null ? _b : []).flatMap((s) => {
7638
- var _a2;
7639
- return ((_a2 = s.items) != null ? _a2 : []).map((i) => {
7640
- var _a3, _b2;
7641
- 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 : "" };
7652
+ var _a3;
7653
+ return ((_a3 = s.items) != null ? _a3 : []).map((i) => {
7654
+ var _a4, _b2;
7655
+ 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 : "" };
7642
7656
  });
7643
7657
  });
7644
7658
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_c = p.title) != null ? _c : "compliance-checklist", onDownloadCSV: () => {
7645
- var _a2;
7646
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "compliance-checklist");
7659
+ var _a3;
7660
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "compliance-checklist");
7647
7661
  }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
7648
7662
  p.title && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
7649
7663
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
@@ -7705,9 +7719,9 @@ function DiffCell({ diff, currency }) {
7705
7719
  );
7706
7720
  }
7707
7721
  function ReconciliationViewResolver(p) {
7708
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
7722
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
7709
7723
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2 } = useTheme();
7710
- const sourceA = (_a = p.sourceA) != null ? _a : { label: "Source A" };
7724
+ const sourceA = (_a2 = p.sourceA) != null ? _a2 : { label: "Source A" };
7711
7725
  const sourceB = (_b = p.sourceB) != null ? _b : { label: "Source B" };
7712
7726
  const [activeTab, setActiveTab] = React41.useState("matched");
7713
7727
  const balanceA = (_d = (_c = p.summary) == null ? void 0 : _c.balanceA) != null ? _d : 0;
@@ -7724,7 +7738,7 @@ function ReconciliationViewResolver(p) {
7724
7738
  ];
7725
7739
  const csvRows = [
7726
7740
  ...((_i = p.matched) != null ? _i : []).map((m) => {
7727
- var _a2;
7741
+ var _a3;
7728
7742
  return {
7729
7743
  type: "Matched",
7730
7744
  date: m.date,
@@ -7732,11 +7746,11 @@ function ReconciliationViewResolver(p) {
7732
7746
  amountA: m.amountA,
7733
7747
  amountB: m.amountB,
7734
7748
  diff: m.amountA - m.amountB,
7735
- reference: (_a2 = m.reference) != null ? _a2 : ""
7749
+ reference: (_a3 = m.reference) != null ? _a3 : ""
7736
7750
  };
7737
7751
  }),
7738
7752
  ...((_j = p.unmatchedA) != null ? _j : []).map((u) => {
7739
- var _a2;
7753
+ var _a3;
7740
7754
  return {
7741
7755
  type: `Unmatched ${sourceA.label}`,
7742
7756
  date: u.date,
@@ -7744,11 +7758,11 @@ function ReconciliationViewResolver(p) {
7744
7758
  amountA: u.amount,
7745
7759
  amountB: "",
7746
7760
  diff: "",
7747
- reference: (_a2 = u.reference) != null ? _a2 : ""
7761
+ reference: (_a3 = u.reference) != null ? _a3 : ""
7748
7762
  };
7749
7763
  }),
7750
7764
  ...((_k = p.unmatchedB) != null ? _k : []).map((u) => {
7751
- var _a2;
7765
+ var _a3;
7752
7766
  return {
7753
7767
  type: `Unmatched ${sourceB.label}`,
7754
7768
  date: u.date,
@@ -7756,7 +7770,7 @@ function ReconciliationViewResolver(p) {
7756
7770
  amountA: "",
7757
7771
  amountB: u.amount,
7758
7772
  diff: "",
7759
- reference: (_a2 = u.reference) != null ? _a2 : ""
7773
+ reference: (_a3 = u.reference) != null ? _a3 : ""
7760
7774
  };
7761
7775
  })
7762
7776
  ];
@@ -7772,8 +7786,8 @@ function ReconciliationViewResolver(p) {
7772
7786
  {
7773
7787
  filename: (_s = p.title) != null ? _s : "reconciliation-view",
7774
7788
  onDownloadCSV: () => {
7775
- var _a2;
7776
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "reconciliation-view");
7789
+ var _a3;
7790
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "reconciliation-view");
7777
7791
  },
7778
7792
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "0" }, children: [
7779
7793
  p.title && /* @__PURE__ */ jsxRuntime.jsx(
@@ -7944,7 +7958,7 @@ function ReconciliationViewResolver(p) {
7944
7958
  borderBottom: `1px solid ${BORDER4}`
7945
7959
  },
7946
7960
  children: tabs.map((tab, i) => {
7947
- var _a2;
7961
+ var _a3;
7948
7962
  const isActive = activeTab === tab.key;
7949
7963
  return /* @__PURE__ */ jsxRuntime.jsxs(
7950
7964
  "button",
@@ -7981,7 +7995,7 @@ function ReconciliationViewResolver(p) {
7981
7995
  left: "16px",
7982
7996
  right: "16px",
7983
7997
  height: "2px",
7984
- background: (_a2 = tab.accent) != null ? _a2 : ACCENT2,
7998
+ background: (_a3 = tab.accent) != null ? _a3 : ACCENT2,
7985
7999
  borderRadius: "2px 2px 0 0"
7986
8000
  }
7987
8001
  }
@@ -8047,7 +8061,7 @@ function ReconciliationViewResolver(p) {
8047
8061
  )
8048
8062
  ) }) }),
8049
8063
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: ((_u = p.matched) != null ? _u : []).map((m, ri) => {
8050
- var _a2;
8064
+ var _a3;
8051
8065
  const diff = m.amountA - m.amountB;
8052
8066
  const isZero = Math.abs(diff) < 5e-3;
8053
8067
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -8142,7 +8156,7 @@ function ReconciliationViewResolver(p) {
8142
8156
  borderBottom: `1px solid ${INNER_BORDER}`,
8143
8157
  letterSpacing: "0.02em"
8144
8158
  },
8145
- children: (_a2 = m.reference) != null ? _a2 : "\u2014"
8159
+ children: (_a3 = m.reference) != null ? _a3 : "\u2014"
8146
8160
  }
8147
8161
  )
8148
8162
  ]
@@ -8152,8 +8166,8 @@ function ReconciliationViewResolver(p) {
8152
8166
  }) })
8153
8167
  ] })),
8154
8168
  (activeTab === "unmatchedA" || activeTab === "unmatchedB") && (() => {
8155
- var _a2, _b2;
8156
- const items = activeTab === "unmatchedA" ? (_a2 = p.unmatchedA) != null ? _a2 : [] : (_b2 = p.unmatchedB) != null ? _b2 : [];
8169
+ var _a3, _b2;
8170
+ const items = activeTab === "unmatchedA" ? (_a3 = p.unmatchedA) != null ? _a3 : [] : (_b2 = p.unmatchedB) != null ? _b2 : [];
8157
8171
  const sourceLabel = activeTab === "unmatchedA" ? sourceA.label : sourceB.label;
8158
8172
  if (items.length === 0)
8159
8173
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -8185,7 +8199,7 @@ function ReconciliationViewResolver(p) {
8185
8199
  )
8186
8200
  ) }) }),
8187
8201
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: items.map((item, ri) => {
8188
- var _a3;
8202
+ var _a4;
8189
8203
  return /* @__PURE__ */ jsxRuntime.jsxs(
8190
8204
  "tr",
8191
8205
  {
@@ -8277,7 +8291,7 @@ function ReconciliationViewResolver(p) {
8277
8291
  borderBottom: `1px solid ${INNER_BORDER}`,
8278
8292
  letterSpacing: "0.02em"
8279
8293
  },
8280
- children: (_a3 = item.reference) != null ? _a3 : "\u2014"
8294
+ children: (_a4 = item.reference) != null ? _a4 : "\u2014"
8281
8295
  }
8282
8296
  )
8283
8297
  ]
@@ -8351,9 +8365,9 @@ function ChangesView({ changes }) {
8351
8365
  ] }, i)) });
8352
8366
  }
8353
8367
  function EventCard({ event }) {
8354
- var _a;
8368
+ var _a2;
8355
8369
  const [showChanges, setShowChanges] = React41.useState(false);
8356
- const ac = (_a = actionConfig[event.action]) != null ? _a : actionConfig.commented;
8370
+ const ac = (_a2 = actionConfig[event.action]) != null ? _a2 : actionConfig.commented;
8357
8371
  const hasChanges = event.changes && event.changes.length > 0;
8358
8372
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: "12px", position: "relative" }, children: [
8359
8373
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", flexShrink: 0 }, children: [
@@ -8397,9 +8411,9 @@ function EventCard({ event }) {
8397
8411
  ] });
8398
8412
  }
8399
8413
  function AuditTrailResolver(p) {
8400
- var _a, _b;
8414
+ var _a2, _b;
8401
8415
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
8402
- const sorted = [...(_a = p.events) != null ? _a : []].sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
8416
+ const sorted = [...(_a2 = p.events) != null ? _a2 : []].sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
8403
8417
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "audit-trail", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
8404
8418
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
8405
8419
  p.title && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
@@ -8419,12 +8433,12 @@ function useFullscreen(ref) {
8419
8433
  return () => document.removeEventListener("fullscreenchange", handler);
8420
8434
  }, []);
8421
8435
  const enter = React41.useCallback(() => {
8422
- var _a, _b;
8423
- (_b = (_a = ref.current) == null ? void 0 : _a.requestFullscreen) == null ? void 0 : _b.call(_a);
8436
+ var _a2, _b;
8437
+ (_b = (_a2 = ref.current) == null ? void 0 : _a2.requestFullscreen) == null ? void 0 : _b.call(_a2);
8424
8438
  }, [ref]);
8425
8439
  const exit = React41.useCallback(() => {
8426
- var _a;
8427
- if (document.fullscreenElement) (_a = document.exitFullscreen) == null ? void 0 : _a.call(document);
8440
+ var _a2;
8441
+ if (document.fullscreenElement) (_a2 = document.exitFullscreen) == null ? void 0 : _a2.call(document);
8428
8442
  }, []);
8429
8443
  const toggle = React41.useCallback(() => {
8430
8444
  if (isFullscreen) exit();
@@ -8449,8 +8463,8 @@ var highlightColors = {
8449
8463
  blue: { bg: "rgba(29,78,216,0.12)", border: "#1d4ed8" }
8450
8464
  };
8451
8465
  function sanitizeFilename(name) {
8452
- var _a;
8453
- return (_a = name.replace(/\.\.\//g, "").replace(/\.\.\\/g, "").split(/[/\\]/).pop()) != null ? _a : name;
8466
+ var _a2;
8467
+ return (_a2 = name.replace(/\.\.\//g, "").replace(/\.\.\\/g, "").split(/[/\\]/).pop()) != null ? _a2 : name;
8454
8468
  }
8455
8469
  function IconButton({ title, onClick, href, download, children }) {
8456
8470
  const style = {
@@ -8487,12 +8501,12 @@ function DownloadIcon() {
8487
8501
  ] });
8488
8502
  }
8489
8503
  function DocumentPreviewResolver(p) {
8490
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
8504
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
8491
8505
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2 } = useTheme();
8492
8506
  const [currentPage, setCurrentPage] = React41.useState(0);
8493
8507
  const containerRef = React41.useRef(null);
8494
8508
  const { isFullscreen, toggle } = useFullscreen(containerRef);
8495
- const hasRealFile = !!(((_a = p.source) == null ? void 0 : _a.url) || ((_b = p.source) == null ? void 0 : _b.base64));
8509
+ const hasRealFile = !!(((_a2 = p.source) == null ? void 0 : _a2.url) || ((_b = p.source) == null ? void 0 : _b.base64));
8496
8510
  const isPdf = p.documentType === "pdf";
8497
8511
  const isExcel = p.documentType === "excel";
8498
8512
  const totalPages = ((_c = p.pages) != null ? _c : []).length;
@@ -8555,7 +8569,7 @@ function DocumentPreviewResolver(p) {
8555
8569
  href: (_k = (_j = p.source) == null ? void 0 : _j.url) != null ? _k : void 0,
8556
8570
  download: sanitizeFilename((_m = (_l = p.source) == null ? void 0 : _l.filename) != null ? _m : "file"),
8557
8571
  onClick: !((_n = p.source) == null ? void 0 : _n.url) && ((_o = p.source) == null ? void 0 : _o.base64) ? () => {
8558
- var _a2, _b2;
8572
+ var _a3, _b2;
8559
8573
  const mime = isPdf ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
8560
8574
  const binary = atob(p.source.base64);
8561
8575
  const bytes = new Uint8Array(binary.length);
@@ -8563,7 +8577,7 @@ function DocumentPreviewResolver(p) {
8563
8577
  const blob = new Blob([bytes], { type: mime });
8564
8578
  const a = document.createElement("a");
8565
8579
  a.href = URL.createObjectURL(blob);
8566
- a.download = sanitizeFilename((_b2 = (_a2 = p.source) == null ? void 0 : _a2.filename) != null ? _b2 : "file");
8580
+ a.download = sanitizeFilename((_b2 = (_a3 = p.source) == null ? void 0 : _a3.filename) != null ? _b2 : "file");
8567
8581
  a.click();
8568
8582
  URL.revokeObjectURL(a.href);
8569
8583
  } : void 0,
@@ -8618,8 +8632,8 @@ function DocumentPreviewResolver(p) {
8618
8632
  (_u = page == null ? void 0 : page.label) != null ? _u : "this page"
8619
8633
  ] }),
8620
8634
  pageHighlights.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "0 20px 20px", display: "flex", flexDirection: "column", gap: "6px" }, children: pageHighlights.map((h, i) => {
8621
- var _a2;
8622
- const hc = (_a2 = highlightColors[h.color]) != null ? _a2 : highlightColors.yellow;
8635
+ var _a3;
8636
+ const hc = (_a3 = highlightColors[h.color]) != null ? _a3 : highlightColors.yellow;
8623
8637
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "6px 10px", borderRadius: "4px", background: hc.bg, borderLeft: `3px solid ${hc.border}`, fontSize: "12px" }, children: [
8624
8638
  /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: 600 }, children: h.text }),
8625
8639
  h.note && /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: MUTED2, marginLeft: "8px" }, children: [
@@ -8675,10 +8689,10 @@ function ConfidenceBar({ confidence, height = 6 }) {
8675
8689
  );
8676
8690
  }
8677
8691
  function StepCard({ step, isLast }) {
8678
- var _a;
8692
+ var _a2;
8679
8693
  const [expanded, setExpanded] = React41.useState(false);
8680
8694
  const cfg = stepTypeConfig[step.stepType];
8681
- const detail = (_a = step.detail) != null ? _a : "";
8695
+ const detail = (_a2 = step.detail) != null ? _a2 : "";
8682
8696
  const isLong = detail.length > 100;
8683
8697
  const displayDetail = isLong && !expanded ? detail.slice(0, 100) + "..." : detail;
8684
8698
  const metaEntries = step.metadata ? Object.entries(step.metadata) : [];
@@ -8809,9 +8823,9 @@ function statusColor(status) {
8809
8823
  }
8810
8824
  }
8811
8825
  function ProvenanceChainResolver(p) {
8812
- var _a, _b, _c, _d;
8826
+ var _a2, _b, _c, _d;
8813
8827
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
8814
- const steps = (_a = p.steps) != null ? _a : [];
8828
+ const steps = (_a2 = p.steps) != null ? _a2 : [];
8815
8829
  const stepsWithConf = steps.filter((s) => s.confidence != null && s.confidence > 0);
8816
8830
  const derivedConfidence = stepsWithConf.length > 0 ? stepsWithConf.reduce((sum, s) => sum + s.confidence, 0) / stepsWithConf.length : 0;
8817
8831
  const raw = (_b = p.conclusion) != null ? _b : { status: "not-qualified", value: "", confidence: 0 };
@@ -8962,8 +8976,8 @@ function highlightSnippet(snippet, highlights) {
8962
8976
  });
8963
8977
  }
8964
8978
  function ResultCard({ result, isLast }) {
8965
- var _a;
8966
- const badge = result.sourceType ? (_a = badgeColors[result.sourceType]) != null ? _a : badgeColors.other : null;
8979
+ var _a2;
8980
+ const badge = result.sourceType ? (_a2 = badgeColors[result.sourceType]) != null ? _a2 : badgeColors.other : null;
8967
8981
  const pct = Math.round(result.relevance * 100);
8968
8982
  const titleEl = /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "13px", fontWeight: 700, color: "var(--foreground)" }, children: result.title });
8969
8983
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -9054,9 +9068,9 @@ function ResultCard({ result, isLast }) {
9054
9068
  );
9055
9069
  }
9056
9070
  function SearchResultsResolver(p) {
9057
- var _a, _b, _c, _d, _e, _f;
9071
+ var _a2, _b, _c, _d, _e, _f;
9058
9072
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
9059
- return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a = p.title) != null ? _a : "search-results", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
9073
+ return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a2 = p.title) != null ? _a2 : "search-results", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
9060
9074
  /* @__PURE__ */ jsxRuntime.jsx(
9061
9075
  "p",
9062
9076
  {
@@ -9092,8 +9106,8 @@ function SearchResultsResolver(p) {
9092
9106
  background: "white"
9093
9107
  },
9094
9108
  children: ((_f = p.results) != null ? _f : []).map((result, i) => {
9095
- var _a2;
9096
- return /* @__PURE__ */ jsxRuntime.jsx(ResultCard, { result, isLast: i === ((_a2 = p.results) != null ? _a2 : []).length - 1 }, i);
9109
+ var _a3;
9110
+ return /* @__PURE__ */ jsxRuntime.jsx(ResultCard, { result, isLast: i === ((_a3 = p.results) != null ? _a3 : []).length - 1 }, i);
9097
9111
  })
9098
9112
  }
9099
9113
  )
@@ -9110,8 +9124,8 @@ var resultConfig = {
9110
9124
  na: { color: exports.MUTED, bg: "#f2f2f2", label: "N/A" }
9111
9125
  };
9112
9126
  function ResultBadge({ result, size = "normal" }) {
9113
- var _a;
9114
- const cfg = (_a = resultConfig[result]) != null ? _a : resultConfig.na;
9127
+ var _a2;
9128
+ const cfg = (_a2 = resultConfig[result]) != null ? _a2 : resultConfig.na;
9115
9129
  const isNormal = size === "normal";
9116
9130
  return /* @__PURE__ */ jsxRuntime.jsx(
9117
9131
  "span",
@@ -9243,9 +9257,9 @@ function PartSection({ part, defaultOpen }) {
9243
9257
  ] });
9244
9258
  }
9245
9259
  function LegalTestResultResolver(p) {
9246
- var _a, _b;
9260
+ var _a2, _b;
9247
9261
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, PAPER: PAPER2 } = useTheme();
9248
- return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a = p.title) != null ? _a : "legal-test-result", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
9262
+ return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a2 = p.title) != null ? _a2 : "legal-test-result", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
9249
9263
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px", flexWrap: "wrap" }, children: [
9250
9264
  p.title && /* @__PURE__ */ jsxRuntime.jsx(
9251
9265
  "span",
@@ -9305,9 +9319,9 @@ function lineColor(left, right) {
9305
9319
  return "#d6d3d1";
9306
9320
  }
9307
9321
  function EngagementPipelineResolver(p) {
9308
- var _a, _b, _c, _d, _e;
9322
+ var _a2, _b, _c, _d, _e;
9309
9323
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
9310
- const phases = (_a = p.phases) != null ? _a : [];
9324
+ const phases = (_a2 = p.phases) != null ? _a2 : [];
9311
9325
  const defaultActive = phases.findIndex(
9312
9326
  (ph) => ph.status === "in-progress" || ph.status === "blocked"
9313
9327
  );
@@ -9391,8 +9405,8 @@ function EngagementPipelineResolver(p) {
9391
9405
  overflow: "auto"
9392
9406
  },
9393
9407
  children: ((_d = p.phases) != null ? _d : []).map((phase, i) => {
9394
- var _a2;
9395
- const color = (_a2 = statusColor2[phase.status]) != null ? _a2 : "#d6d3d1";
9408
+ var _a3;
9409
+ const color = (_a3 = statusColor2[phase.status]) != null ? _a3 : "#d6d3d1";
9396
9410
  const isCurrent = i === activeIdx;
9397
9411
  const size = isCurrent ? 28 : 20;
9398
9412
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
@@ -9700,10 +9714,10 @@ function Avatar({ name, avatar, hovered }) {
9700
9714
  );
9701
9715
  }
9702
9716
  function EntityCardGridResolver(p) {
9703
- var _a, _b;
9717
+ var _a2, _b;
9704
9718
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
9705
9719
  const [hoveredId, setHoveredId] = React41.useState(null);
9706
- return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a = p.title) != null ? _a : "entity-card-grid", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
9720
+ return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a2 = p.title) != null ? _a2 : "entity-card-grid", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
9707
9721
  p.title && /* @__PURE__ */ jsxRuntime.jsx(
9708
9722
  "p",
9709
9723
  {
@@ -9783,8 +9797,8 @@ function EntityCardGridResolver(p) {
9783
9797
  ] })
9784
9798
  ] }),
9785
9799
  item.badges && item.badges.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: item.badges.map((badge, i) => {
9786
- var _a2, _b2;
9787
- const c = (_b2 = BADGE_COLORS[(_a2 = badge.color) != null ? _a2 : "gray"]) != null ? _b2 : BADGE_COLORS.gray;
9800
+ var _a3, _b2;
9801
+ const c = (_b2 = BADGE_COLORS[(_a3 = badge.color) != null ? _a3 : "gray"]) != null ? _b2 : BADGE_COLORS.gray;
9788
9802
  return /* @__PURE__ */ jsxRuntime.jsx(
9789
9803
  "span",
9790
9804
  {
@@ -9896,8 +9910,8 @@ function formatTime(ts) {
9896
9910
  }
9897
9911
  }
9898
9912
  function StepRow({ step }) {
9899
- var _a, _b, _c;
9900
- const color = (_a = stepStatusColors[step.status]) != null ? _a : exports.MUTED;
9913
+ var _a2, _b, _c;
9914
+ const color = (_a2 = stepStatusColors[step.status]) != null ? _a2 : exports.MUTED;
9901
9915
  return /* @__PURE__ */ jsxRuntime.jsxs(
9902
9916
  "div",
9903
9917
  {
@@ -9956,10 +9970,10 @@ function StepRow({ step }) {
9956
9970
  );
9957
9971
  }
9958
9972
  function JobTrackerResolver(p) {
9959
- var _a, _b, _c, _d, _e, _f, _g;
9973
+ var _a2, _b, _c, _d, _e, _f, _g;
9960
9974
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, PAPER: PAPER2 } = useTheme();
9961
9975
  const [stepsOpen, setStepsOpen] = React41.useState(true);
9962
- const barColor = (_a = statusColors2[p.status]) != null ? _a : MUTED2;
9976
+ const barColor = (_a2 = statusColors2[p.status]) != null ? _a2 : MUTED2;
9963
9977
  const badge = (_b = statusBadgeConfig[p.status]) != null ? _b : statusBadgeConfig.queued;
9964
9978
  const progress = (_c = p.progress) != null ? _c : p.status === "completed" ? 100 : 0;
9965
9979
  return /* @__PURE__ */ jsxRuntime.jsxs(ComponentActions, { filename: (_d = p.title) != null ? _d : "job-tracker", children: [
@@ -10227,8 +10241,8 @@ var sourceTypeColors = {
10227
10241
  workpaper: { bg: "#fff7ed", color: "#f59e0b" }
10228
10242
  };
10229
10243
  function getSourceTypeBadgeStyle(sourceType) {
10230
- var _a;
10231
- const entry = (_a = sourceTypeColors[sourceType]) != null ? _a : { bg: "#f2f2f2", color: exports.MUTED };
10244
+ var _a2;
10245
+ const entry = (_a2 = sourceTypeColors[sourceType]) != null ? _a2 : { bg: "#f2f2f2", color: exports.MUTED };
10232
10246
  return {
10233
10247
  display: "inline-block",
10234
10248
  fontSize: "9px",
@@ -10450,7 +10464,7 @@ function CitationMarker({
10450
10464
  );
10451
10465
  }
10452
10466
  function CitedAnswerResolver(p) {
10453
- var _a, _b, _c, _d, _e;
10467
+ var _a2, _b, _c, _d, _e;
10454
10468
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, SECONDARY: SECONDARY2 } = useTheme();
10455
10469
  const [expandedIds, setExpandedIds] = React41.useState(/* @__PURE__ */ new Set());
10456
10470
  const toggleCitation = (id) => {
@@ -10465,7 +10479,7 @@ function CitedAnswerResolver(p) {
10465
10479
  });
10466
10480
  };
10467
10481
  const parts = parseAnswer(p.answer, p.citations);
10468
- return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a = p.title) != null ? _a : "cited-answer", children: /* @__PURE__ */ jsxRuntime.jsxs(
10482
+ return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a2 = p.title) != null ? _a2 : "cited-answer", children: /* @__PURE__ */ jsxRuntime.jsxs(
10469
10483
  "div",
10470
10484
  {
10471
10485
  style: {
@@ -10583,8 +10597,8 @@ var CURRENCY_SYMBOLS = {
10583
10597
  BRL: "R$"
10584
10598
  };
10585
10599
  function getCurrencySymbol(currency) {
10586
- var _a;
10587
- return (_a = CURRENCY_SYMBOLS[currency.toUpperCase()]) != null ? _a : currency + " ";
10600
+ var _a2;
10601
+ return (_a2 = CURRENCY_SYMBOLS[currency.toUpperCase()]) != null ? _a2 : currency + " ";
10588
10602
  }
10589
10603
  function formatAmount(amount, currency) {
10590
10604
  const sym = getCurrencySymbol(currency);
@@ -10753,9 +10767,9 @@ function formatSummaryAmount(amount, currency) {
10753
10767
  return `${sym}${formatted}`;
10754
10768
  }
10755
10769
  function TransactionFeedResolver(p) {
10756
- var _a, _b, _c, _d, _e;
10770
+ var _a2, _b, _c, _d, _e;
10757
10771
  const { BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
10758
- const currency = (_a = p.currency) != null ? _a : "USD";
10772
+ const currency = (_a2 = p.currency) != null ? _a2 : "USD";
10759
10773
  const [hoveredIndex, setHoveredIndex] = React41.useState(null);
10760
10774
  const hasBalance = ((_b = p.transactions) != null ? _b : []).some((tx) => tx.balance != null);
10761
10775
  const totalInflows = p.transactions.filter((tx) => tx.amount > 0 && tx.status !== "reversed").reduce((sum, tx) => sum + tx.amount, 0);
@@ -10770,11 +10784,11 @@ function TransactionFeedResolver(p) {
10770
10784
  { key: "balance", label: "Balance" }
10771
10785
  ];
10772
10786
  const csvRows = ((_c = p.transactions) != null ? _c : []).map((tx) => {
10773
- var _a2, _b2, _c2;
10787
+ var _a3, _b2, _c2;
10774
10788
  return {
10775
10789
  date: tx.date,
10776
10790
  description: tx.description,
10777
- counterparty: (_a2 = tx.counterparty) != null ? _a2 : "",
10791
+ counterparty: (_a3 = tx.counterparty) != null ? _a3 : "",
10778
10792
  category: (_b2 = tx.category) != null ? _b2 : "",
10779
10793
  amount: tx.amount,
10780
10794
  balance: (_c2 = tx.balance) != null ? _c2 : ""
@@ -10792,8 +10806,8 @@ function TransactionFeedResolver(p) {
10792
10806
  {
10793
10807
  filename: (_d = p.title) != null ? _d : "transaction-feed",
10794
10808
  onDownloadCSV: () => {
10795
- var _a2;
10796
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "transaction-feed");
10809
+ var _a3;
10810
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "transaction-feed");
10797
10811
  },
10798
10812
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
10799
10813
  p.title && /* @__PURE__ */ jsxRuntime.jsx(
@@ -10831,7 +10845,7 @@ function TransactionFeedResolver(p) {
10831
10845
  }
10832
10846
  ),
10833
10847
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column" }, children: ((_e = p.transactions) != null ? _e : []).map((tx, i) => {
10834
- var _a2;
10848
+ var _a3;
10835
10849
  return /* @__PURE__ */ jsxRuntime.jsx(
10836
10850
  TransactionRow,
10837
10851
  {
@@ -10841,7 +10855,7 @@ function TransactionFeedResolver(p) {
10841
10855
  onMouseEnter: () => setHoveredIndex(i),
10842
10856
  onMouseLeave: () => setHoveredIndex(null)
10843
10857
  },
10844
- (_a2 = tx.id) != null ? _a2 : i
10858
+ (_a3 = tx.id) != null ? _a3 : i
10845
10859
  );
10846
10860
  }) }),
10847
10861
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -10898,10 +10912,10 @@ var docTypeConfig = {
10898
10912
  csv: { label: "CSV", color: "#7c3aed", bg: "#f5f3ff" }
10899
10913
  };
10900
10914
  function getDocConfig(docType) {
10901
- var _a;
10915
+ var _a2;
10902
10916
  if (!docType) return { label: "FILE", color: exports.MUTED, bg: "#f2f2f2" };
10903
10917
  const key = docType.toLowerCase().replace(/^\./, "");
10904
- return (_a = docTypeConfig[key]) != null ? _a : { label: key.toUpperCase().slice(0, 4), color: exports.MUTED, bg: "#f2f2f2" };
10918
+ return (_a2 = docTypeConfig[key]) != null ? _a2 : { label: key.toUpperCase().slice(0, 4), color: exports.MUTED, bg: "#f2f2f2" };
10905
10919
  }
10906
10920
  function formatDate2(dateStr) {
10907
10921
  if (!dateStr) return "";
@@ -10912,7 +10926,7 @@ function formatDate2(dateStr) {
10912
10926
  }
10913
10927
  }
10914
10928
  function FileRow({ item }) {
10915
- var _a;
10929
+ var _a2;
10916
10930
  const [hovered, setHovered] = React41.useState(false);
10917
10931
  const cfg = getDocConfig(item.docType);
10918
10932
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -10983,7 +10997,7 @@ function FileRow({ item }) {
10983
10997
  ] }),
10984
10998
  item.author && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "11px", color: exports.MUTED, flexShrink: 0, maxWidth: "100px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: item.author }),
10985
10999
  item.size && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "11px", color: exports.MUTED, flexShrink: 0, minWidth: "50px", textAlign: "right" }, children: item.size }),
10986
- (item.modifiedAt || item.createdAt) && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "11px", color: exports.MUTED, flexShrink: 0, minWidth: "80px", textAlign: "right" }, children: formatDate2((_a = item.modifiedAt) != null ? _a : item.createdAt) })
11000
+ (item.modifiedAt || item.createdAt) && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "11px", color: exports.MUTED, flexShrink: 0, minWidth: "80px", textAlign: "right" }, children: formatDate2((_a2 = item.modifiedAt) != null ? _a2 : item.createdAt) })
10987
11001
  ]
10988
11002
  }
10989
11003
  );
@@ -11029,15 +11043,15 @@ function GroupSection({ groupName, items }) {
11029
11043
  }
11030
11044
  ),
11031
11045
  open && items.map((item, i) => {
11032
- var _a;
11033
- return /* @__PURE__ */ jsxRuntime.jsx(FileRow, { item }, (_a = item.id) != null ? _a : i);
11046
+ var _a2;
11047
+ return /* @__PURE__ */ jsxRuntime.jsx(FileRow, { item }, (_a2 = item.id) != null ? _a2 : i);
11034
11048
  })
11035
11049
  ] });
11036
11050
  }
11037
11051
  function FileBrowserResolver(p) {
11038
- var _a, _b, _c, _d;
11052
+ var _a2, _b, _c, _d;
11039
11053
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, PAPER: PAPER2 } = useTheme();
11040
- const items = (_a = p.items) != null ? _a : [];
11054
+ const items = (_a2 = p.items) != null ? _a2 : [];
11041
11055
  const hasGroups = items.some((item) => item.group);
11042
11056
  const groups = /* @__PURE__ */ new Map();
11043
11057
  if (hasGroups) {
@@ -11090,8 +11104,8 @@ function FileBrowserResolver(p) {
11090
11104
  fontSize: "13px",
11091
11105
  color: MUTED2
11092
11106
  }, children: "No files" }) : hasGroups ? Array.from(groups.entries()).map(([groupName, items2]) => /* @__PURE__ */ jsxRuntime.jsx(GroupSection, { groupName, items: items2 }, groupName)) : items.map((item, i) => {
11093
- var _a2;
11094
- return /* @__PURE__ */ jsxRuntime.jsx(FileRow, { item }, (_a2 = item.id) != null ? _a2 : i);
11107
+ var _a3;
11108
+ return /* @__PURE__ */ jsxRuntime.jsx(FileRow, { item }, (_a3 = item.id) != null ? _a3 : i);
11095
11109
  })
11096
11110
  ] })
11097
11111
  ] }) });
@@ -11135,7 +11149,7 @@ var PREVIEW_EXTS = {
11135
11149
  docx: "docx"
11136
11150
  };
11137
11151
  function extOf(fileType, filename) {
11138
- var _a;
11152
+ var _a2;
11139
11153
  if (fileType && fileType.includes("/")) {
11140
11154
  const mime = fileType.toLowerCase();
11141
11155
  if (mime.includes("pdf")) return "pdf";
@@ -11148,11 +11162,11 @@ function extOf(fileType, filename) {
11148
11162
  const t = fileType.toLowerCase().replace(/[^a-z0-9]/g, "");
11149
11163
  if (t) return t;
11150
11164
  }
11151
- return ((_a = (filename || "").split(".").pop()) == null ? void 0 : _a.toLowerCase().replace(/[^a-z0-9]/g, "")) || "";
11165
+ return ((_a2 = (filename || "").split(".").pop()) == null ? void 0 : _a2.toLowerCase().replace(/[^a-z0-9]/g, "")) || "";
11152
11166
  }
11153
11167
  function previewKindFor(fileType, filename) {
11154
- var _a;
11155
- return (_a = PREVIEW_EXTS[extOf(fileType, filename)]) != null ? _a : null;
11168
+ var _a2;
11169
+ return (_a2 = PREVIEW_EXTS[extOf(fileType, filename)]) != null ? _a2 : null;
11156
11170
  }
11157
11171
  function isPreviewable(fileType, filename) {
11158
11172
  return previewKindFor(fileType, filename) !== null;
@@ -11730,8 +11744,8 @@ function Chevron({ open }) {
11730
11744
  );
11731
11745
  }
11732
11746
  function DownloadCardResolver(p) {
11733
- var _a, _b;
11734
- const files = (_a = p.files) != null ? _a : [];
11747
+ var _a2, _b;
11748
+ const files = (_a2 = p.files) != null ? _a2 : [];
11735
11749
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "download-card", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
11736
11750
  p.title && /* @__PURE__ */ jsxRuntime.jsx(
11737
11751
  "p",
@@ -11903,10 +11917,10 @@ function ServiceCard({ item, isHovered, onHover, onLeave: onLeave2 }) {
11903
11917
  );
11904
11918
  }
11905
11919
  function OpsDashboardResolver(p) {
11906
- var _a, _b, _c;
11920
+ var _a2, _b, _c;
11907
11921
  const { BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
11908
11922
  const [hoveredId, setHoveredId] = React41.useState(null);
11909
- const hasRunning = ((_a = p.items) != null ? _a : []).some((item) => item.state === "running");
11923
+ const hasRunning = ((_a2 = p.items) != null ? _a2 : []).some((item) => item.state === "running");
11910
11924
  return /* @__PURE__ */ jsxRuntime.jsxs(ComponentActions, { filename: (_b = p.title) != null ? _b : "ops-dashboard", children: [
11911
11925
  hasRunning && /* @__PURE__ */ jsxRuntime.jsx("style", { children: PULSE_KEYFRAMES }),
11912
11926
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
@@ -11990,8 +12004,8 @@ function CopyButton({ value, rowHovered }) {
11990
12004
  );
11991
12005
  }
11992
12006
  function ValueCell({ item }) {
11993
- var _a, _b;
11994
- const t = (_a = item.type) != null ? _a : "text";
12007
+ var _a2, _b;
12008
+ const t = (_a2 = item.type) != null ? _a2 : "text";
11995
12009
  switch (t) {
11996
12010
  case "url":
11997
12011
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -12098,9 +12112,9 @@ function ItemsList({ items, isLastGroup, indexOffset }) {
12098
12112
  )) });
12099
12113
  }
12100
12114
  function KeyValueListResolver(p) {
12101
- var _a, _b, _c;
12115
+ var _a2, _b, _c;
12102
12116
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, SECONDARY: SECONDARY2 } = useTheme();
12103
- const groups = (_a = p.groups) != null ? _a : [];
12117
+ const groups = (_a2 = p.groups) != null ? _a2 : [];
12104
12118
  const items = (_b = p.items) != null ? _b : [];
12105
12119
  const hasGroups = groups.length > 0;
12106
12120
  const hasItems = items.length > 0;
@@ -12129,12 +12143,12 @@ function KeyValueListResolver(p) {
12129
12143
  },
12130
12144
  children: [
12131
12145
  hasGroups && groups.map((group, gi) => {
12132
- var _a2;
12133
- const groupItems = (_a2 = group.items) != null ? _a2 : [];
12146
+ var _a3;
12147
+ const groupItems = (_a3 = group.items) != null ? _a3 : [];
12134
12148
  const isLastGroup = gi === groups.length - 1 && !hasItems;
12135
12149
  const prevItemCount = groups.slice(0, gi).reduce((sum, g) => {
12136
- var _a3;
12137
- return sum + ((_a3 = g.items) != null ? _a3 : []).length;
12150
+ var _a4;
12151
+ return sum + ((_a4 = g.items) != null ? _a4 : []).length;
12138
12152
  }, 0);
12139
12153
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
12140
12154
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -12169,8 +12183,8 @@ function KeyValueListResolver(p) {
12169
12183
  ] }, gi);
12170
12184
  }),
12171
12185
  hasItems && /* @__PURE__ */ jsxRuntime.jsx(ItemsList, { items, isLastGroup: true, indexOffset: hasGroups ? groups.reduce((sum, g) => {
12172
- var _a2;
12173
- return sum + ((_a2 = g.items) != null ? _a2 : []).length;
12186
+ var _a3;
12187
+ return sum + ((_a3 = g.items) != null ? _a3 : []).length;
12174
12188
  }, 0) : 0 })
12175
12189
  ]
12176
12190
  }
@@ -12188,24 +12202,24 @@ var categoryLabels2 = {
12188
12202
  function computeSectionTotal(section) {
12189
12203
  if (section.total) return section.total;
12190
12204
  const currentPeriod = section.subsections.reduce((sum, sub) => {
12191
- var _a, _b, _c;
12192
- 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));
12205
+ var _a2, _b, _c;
12206
+ 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));
12193
12207
  }, 0);
12194
12208
  const priorPeriod = section.subsections.reduce((sum, sub) => {
12195
- var _a, _b, _c;
12196
- return sum + ((_c = (_a = sub.subtotal) == null ? void 0 : _a.priorPeriod) != null ? _c : ((_b = sub.items) != null ? _b : []).reduce((s, i) => {
12197
- var _a2;
12198
- return s + ((_a2 = i.priorPeriod) != null ? _a2 : 0);
12209
+ var _a2, _b, _c;
12210
+ return sum + ((_c = (_a2 = sub.subtotal) == null ? void 0 : _a2.priorPeriod) != null ? _c : ((_b = sub.items) != null ? _b : []).reduce((s, i) => {
12211
+ var _a3;
12212
+ return s + ((_a3 = i.priorPeriod) != null ? _a3 : 0);
12199
12213
  }, 0));
12200
12214
  }, 0);
12201
12215
  return { currentPeriod, priorPeriod: priorPeriod || void 0 };
12202
12216
  }
12203
12217
  function BalanceSheetResolver(p) {
12204
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
12218
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
12205
12219
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
12206
12220
  const hasPrior = !!p.priorPeriodLabel;
12207
12221
  const colSpan = hasPrior ? 3 : 2;
12208
- const sectionTotals = new Map(((_a = p.sections) != null ? _a : []).map((s) => [s.category, computeSectionTotal(s)]));
12222
+ const sectionTotals = new Map(((_a2 = p.sections) != null ? _a2 : []).map((s) => [s.category, computeSectionTotal(s)]));
12209
12223
  const assetsTotal = (_c = (_b = sectionTotals.get("assets")) == null ? void 0 : _b.currentPeriod) != null ? _c : 0;
12210
12224
  let leTotal;
12211
12225
  if (p.totalLiabilitiesAndEquity) {
@@ -12224,22 +12238,22 @@ function BalanceSheetResolver(p) {
12224
12238
  const csvRows = ((_j = p.sections) != null ? _j : []).flatMap(
12225
12239
  (section) => section.subsections.flatMap(
12226
12240
  (sub) => {
12227
- var _a2;
12228
- return ((_a2 = sub.items) != null ? _a2 : []).map((item) => {
12229
- var _a3;
12241
+ var _a3;
12242
+ return ((_a3 = sub.items) != null ? _a3 : []).map((item) => {
12243
+ var _a4;
12230
12244
  return __spreadValues({
12231
12245
  category: section.category,
12232
12246
  subsection: sub.label,
12233
12247
  name: item.name,
12234
12248
  currentPeriod: item.currentPeriod
12235
- }, hasPrior ? { priorPeriod: (_a3 = item.priorPeriod) != null ? _a3 : "" } : {});
12249
+ }, hasPrior ? { priorPeriod: (_a4 = item.priorPeriod) != null ? _a4 : "" } : {});
12236
12250
  });
12237
12251
  }
12238
12252
  )
12239
12253
  );
12240
12254
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_k = p.title) != null ? _k : "balance-sheet", onDownloadCSV: () => {
12241
- var _a2;
12242
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "balance-sheet");
12255
+ var _a3;
12256
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "balance-sheet");
12243
12257
  }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
12244
12258
  p.metadata && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "2px", position: "relative" }, children: [
12245
12259
  p.metadata.status && /* @__PURE__ */ jsxRuntime.jsx("span", { style: {
@@ -12313,7 +12327,7 @@ function BalanceSheetResolver(p) {
12313
12327
  ] }) }),
12314
12328
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
12315
12329
  ((_p = p.sections) != null ? _p : []).map((section) => {
12316
- var _a2;
12330
+ var _a3;
12317
12331
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
12318
12332
  /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan, style: {
12319
12333
  padding: "8px 12px",
@@ -12324,9 +12338,9 @@ function BalanceSheetResolver(p) {
12324
12338
  borderBottom: `1px solid ${BORDER4}`,
12325
12339
  textTransform: "uppercase",
12326
12340
  letterSpacing: "0.04em"
12327
- }, children: (_a2 = categoryLabels2[section.category]) != null ? _a2 : section.category }) }),
12341
+ }, children: (_a3 = categoryLabels2[section.category]) != null ? _a3 : section.category }) }),
12328
12342
  section.subsections.map((sub, si) => {
12329
- var _a3;
12343
+ var _a4;
12330
12344
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
12331
12345
  /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan, style: {
12332
12346
  padding: "6px 10px 6px 24px",
@@ -12335,7 +12349,7 @@ function BalanceSheetResolver(p) {
12335
12349
  color: "var(--foreground)",
12336
12350
  borderBottom: `1px solid #f2f2f2`
12337
12351
  }, children: sub.label }) }),
12338
- ((_a3 = sub.items) != null ? _a3 : []).map((item, ii) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: { background: "white" }, children: [
12352
+ ((_a4 = sub.items) != null ? _a4 : []).map((item, ii) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: { background: "white" }, children: [
12339
12353
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: { padding: "6px 10px 6px 40px", fontSize: "13px", color: "var(--foreground)", borderBottom: `1px solid #f2f2f2` }, children: item.name }),
12340
12354
  /* @__PURE__ */ jsxRuntime.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" }),
12341
12355
  hasPrior && /* @__PURE__ */ jsxRuntime.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" })
@@ -12351,12 +12365,12 @@ function BalanceSheetResolver(p) {
12351
12365
  ] }, si);
12352
12366
  }),
12353
12367
  (() => {
12354
- var _a3;
12368
+ var _a4;
12355
12369
  const total = sectionTotals.get(section.category);
12356
12370
  return /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: { background: PAPER2 }, children: [
12357
12371
  /* @__PURE__ */ jsxRuntime.jsxs("td", { style: { padding: "8px 10px", fontSize: "12px", fontWeight: 600, borderTop: `1px solid ${BORDER4}`, borderBottom: `1px solid ${BORDER4}` }, children: [
12358
12372
  "Total ",
12359
- (_a3 = categoryLabels2[section.category]) != null ? _a3 : section.category
12373
+ (_a4 = categoryLabels2[section.category]) != null ? _a4 : section.category
12360
12374
  ] }),
12361
12375
  /* @__PURE__ */ jsxRuntime.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) }),
12362
12376
  hasPrior && /* @__PURE__ */ jsxRuntime.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" })
@@ -12386,23 +12400,23 @@ var pctFmt2 = (amount, revenue) => {
12386
12400
  return `${(amount / revenue * 100).toFixed(1)}%`;
12387
12401
  };
12388
12402
  function IncomeStatementResolver(p) {
12389
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
12403
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
12390
12404
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
12391
- const currency = (_a = p.currency) != null ? _a : "USD";
12405
+ const currency = (_a2 = p.currency) != null ? _a2 : "USD";
12392
12406
  const periods = (_b = p.periods) != null ? _b : [];
12393
12407
  const sections = (_c = p.sections) != null ? _c : [];
12394
12408
  const calculatedTotals = (_d = p.calculatedTotals) != null ? _d : {};
12395
12409
  const showPct = (_e = p.showPercentOfRevenue) != null ? _e : false;
12396
12410
  const isTotalRow = (li) => {
12397
- var _a2;
12398
- return li.isSubtotal === true || /^\s*(total|subtotal)\b/i.test((_a2 = li.name) != null ? _a2 : "");
12411
+ var _a3;
12412
+ return li.isSubtotal === true || /^\s*(total|subtotal)\b/i.test((_a3 = li.name) != null ? _a3 : "");
12399
12413
  };
12400
12414
  const revenueTotals = periods.map(
12401
12415
  (_, pi) => {
12402
- var _a2, _b2, _c2;
12403
- return (_c2 = ((_b2 = (_a2 = sections[0]) == null ? void 0 : _a2.lineItems) != null ? _b2 : []).filter((li) => !isTotalRow(li)).reduce((sum, li) => {
12404
- var _a3, _b3;
12405
- return sum + ((_b3 = ((_a3 = li.amounts) != null ? _a3 : [])[pi]) != null ? _b3 : 0);
12416
+ var _a3, _b2, _c2;
12417
+ return (_c2 = ((_b2 = (_a3 = sections[0]) == null ? void 0 : _a3.lineItems) != null ? _b2 : []).filter((li) => !isTotalRow(li)).reduce((sum, li) => {
12418
+ var _a4, _b3;
12419
+ return sum + ((_b3 = ((_a4 = li.amounts) != null ? _a4 : [])[pi]) != null ? _b3 : 0);
12406
12420
  }, 0)) != null ? _c2 : 0;
12407
12421
  }
12408
12422
  );
@@ -12416,8 +12430,8 @@ function IncomeStatementResolver(p) {
12416
12430
  for (const li of (_f = section.lineItems) != null ? _f : []) {
12417
12431
  const row = { section: section.label, name: li.name };
12418
12432
  periods.forEach((period, pi) => {
12419
- var _a2, _b2;
12420
- row[period] = (_b2 = ((_a2 = li.amounts) != null ? _a2 : [])[pi]) != null ? _b2 : 0;
12433
+ var _a3, _b2;
12434
+ row[period] = (_b2 = ((_a3 = li.amounts) != null ? _a3 : [])[pi]) != null ? _b2 : 0;
12421
12435
  });
12422
12436
  csvRows.push(row);
12423
12437
  }
@@ -12426,13 +12440,13 @@ function IncomeStatementResolver(p) {
12426
12440
  const operatingIncome = calculatedTotals.operatingIncome;
12427
12441
  const rawNetIncome = calculatedTotals.netIncome;
12428
12442
  const netIncome = rawNetIncome && rawNetIncome.length > 0 ? rawNetIncome : periods.map((_, pi) => {
12429
- var _a2;
12443
+ var _a3;
12430
12444
  let total = 0;
12431
12445
  for (const section of sections) {
12432
- const sectionSum = ((_a2 = section.lineItems) != null ? _a2 : []).reduce(
12446
+ const sectionSum = ((_a3 = section.lineItems) != null ? _a3 : []).reduce(
12433
12447
  (s, li) => {
12434
- var _a3, _b2;
12435
- return s + ((_b2 = ((_a3 = li.amounts) != null ? _a3 : [])[pi]) != null ? _b2 : 0);
12448
+ var _a4, _b2;
12449
+ return s + ((_b2 = ((_a4 = li.amounts) != null ? _a4 : [])[pi]) != null ? _b2 : 0);
12436
12450
  },
12437
12451
  0
12438
12452
  );
@@ -12443,31 +12457,31 @@ function IncomeStatementResolver(p) {
12443
12457
  if (grossProfit) {
12444
12458
  const row = { section: "", name: "GROSS PROFIT" };
12445
12459
  periods.forEach((period, pi) => {
12446
- var _a2;
12447
- row[period] = (_a2 = grossProfit[pi]) != null ? _a2 : 0;
12460
+ var _a3;
12461
+ row[period] = (_a3 = grossProfit[pi]) != null ? _a3 : 0;
12448
12462
  });
12449
12463
  csvRows.push(row);
12450
12464
  }
12451
12465
  if (operatingIncome) {
12452
12466
  const row = { section: "", name: "OPERATING INCOME" };
12453
12467
  periods.forEach((period, pi) => {
12454
- var _a2;
12455
- row[period] = (_a2 = operatingIncome[pi]) != null ? _a2 : 0;
12468
+ var _a3;
12469
+ row[period] = (_a3 = operatingIncome[pi]) != null ? _a3 : 0;
12456
12470
  });
12457
12471
  csvRows.push(row);
12458
12472
  }
12459
12473
  {
12460
12474
  const row = { section: "", name: "NET INCOME" };
12461
12475
  periods.forEach((period, pi) => {
12462
- var _a2;
12463
- row[period] = (_a2 = netIncome[pi]) != null ? _a2 : 0;
12476
+ var _a3;
12477
+ row[period] = (_a3 = netIncome[pi]) != null ? _a3 : 0;
12464
12478
  });
12465
12479
  csvRows.push(row);
12466
12480
  }
12467
12481
  const colCount = showPct ? 1 + periods.length * 2 : 1 + periods.length;
12468
12482
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_g = p.title) != null ? _g : "income-statement", onDownloadCSV: () => {
12469
- var _a2;
12470
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "income-statement");
12483
+ var _a3;
12484
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "income-statement");
12471
12485
  }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
12472
12486
  p.metadata && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "2px", position: "relative" }, children: [
12473
12487
  p.metadata.status && /* @__PURE__ */ jsxRuntime.jsx("span", { style: {
@@ -12532,7 +12546,7 @@ function IncomeStatementResolver(p) {
12532
12546
  ] }) }),
12533
12547
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
12534
12548
  sections.map((section, si) => {
12535
- var _a2;
12549
+ var _a3;
12536
12550
  const isSubtotal = section.sectionType === "subtotal";
12537
12551
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
12538
12552
  /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan: colCount, style: {
@@ -12545,9 +12559,9 @@ function IncomeStatementResolver(p) {
12545
12559
  textTransform: "uppercase",
12546
12560
  letterSpacing: "0.04em"
12547
12561
  }, children: section.label }) }),
12548
- ((_a2 = section.lineItems) != null ? _a2 : []).map((li, li_i) => {
12549
- var _a3, _b2;
12550
- const indent = (_a3 = li.indent) != null ? _a3 : 0;
12562
+ ((_a3 = section.lineItems) != null ? _a3 : []).map((li, li_i) => {
12563
+ var _a4, _b2;
12564
+ const indent = (_a4 = li.indent) != null ? _a4 : 0;
12551
12565
  const amounts = (_b2 = li.amounts) != null ? _b2 : [];
12552
12566
  return /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: {
12553
12567
  background: isSubtotal ? PAPER2 : "white",
@@ -12562,8 +12576,8 @@ function IncomeStatementResolver(p) {
12562
12576
  borderBottom: `1px solid #f2f2f2`
12563
12577
  }, children: li.name }),
12564
12578
  periods.map((_, pi) => {
12565
- var _a4;
12566
- const val = (_a4 = amounts[pi]) != null ? _a4 : 0;
12579
+ var _a5;
12580
+ const val = (_a5 = amounts[pi]) != null ? _a5 : 0;
12567
12581
  const isNeg = val < 0;
12568
12582
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
12569
12583
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: {
@@ -12597,8 +12611,8 @@ function IncomeStatementResolver(p) {
12597
12611
  borderBottom: `1px solid ${BORDER4}`
12598
12612
  }, children: "GROSS PROFIT" }),
12599
12613
  periods.map((_, pi) => {
12600
- var _a2;
12601
- const val = (_a2 = grossProfit[pi]) != null ? _a2 : 0;
12614
+ var _a3;
12615
+ const val = (_a3 = grossProfit[pi]) != null ? _a3 : 0;
12602
12616
  const isNeg = val < 0;
12603
12617
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
12604
12618
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: {
@@ -12632,8 +12646,8 @@ function IncomeStatementResolver(p) {
12632
12646
  borderBottom: `1px solid ${BORDER4}`
12633
12647
  }, children: "OPERATING INCOME" }),
12634
12648
  periods.map((_, pi) => {
12635
- var _a2;
12636
- const val = (_a2 = operatingIncome[pi]) != null ? _a2 : 0;
12649
+ var _a3;
12650
+ const val = (_a3 = operatingIncome[pi]) != null ? _a3 : 0;
12637
12651
  const isNeg = val < 0;
12638
12652
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
12639
12653
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: {
@@ -12666,8 +12680,8 @@ function IncomeStatementResolver(p) {
12666
12680
  borderTop: `2px solid ${BORDER4}`
12667
12681
  }, children: "NET INCOME" }),
12668
12682
  periods.map((_, pi) => {
12669
- var _a2;
12670
- const val = (_a2 = netIncome[pi]) != null ? _a2 : 0;
12683
+ var _a3;
12684
+ const val = (_a3 = netIncome[pi]) != null ? _a3 : 0;
12671
12685
  const isNeg = val < 0;
12672
12686
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
12673
12687
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: {
@@ -12712,17 +12726,17 @@ var fmt9 = (v, currency) => {
12712
12726
  return v < 0 ? `(${formatted})` : formatted;
12713
12727
  };
12714
12728
  function deriveNetCash(a) {
12715
- var _a;
12729
+ var _a2;
12716
12730
  if (a.netCash != null && a.netCash !== 0) return a.netCash;
12717
- return ((_a = a.lineItems) != null ? _a : []).filter((li) => !li.isSubtotal).reduce((sum, li) => sum + li.amount, 0);
12731
+ return ((_a2 = a.lineItems) != null ? _a2 : []).filter((li) => !li.isSubtotal).reduce((sum, li) => sum + li.amount, 0);
12718
12732
  }
12719
12733
  function CashFlowStatementResolver(p) {
12720
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
12734
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
12721
12735
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
12722
- const activities = ((_a = p.activities) != null ? _a : []).map((a) => {
12723
- var _a2;
12736
+ const activities = ((_a2 = p.activities) != null ? _a2 : []).map((a) => {
12737
+ var _a3;
12724
12738
  return __spreadProps(__spreadValues({}, a), {
12725
- lineItems: (_a2 = a.lineItems) != null ? _a2 : [],
12739
+ lineItems: (_a3 = a.lineItems) != null ? _a3 : [],
12726
12740
  netCash: deriveNetCash(a)
12727
12741
  });
12728
12742
  });
@@ -12741,19 +12755,19 @@ function CashFlowStatementResolver(p) {
12741
12755
  ...hasPrior ? [{ key: "priorAmount", label: priorLabel }] : []
12742
12756
  ];
12743
12757
  const csvRows = activities.flatMap((a) => {
12744
- var _a2, _b2, _c2, _d2;
12758
+ var _a3, _b2, _c2, _d2;
12745
12759
  return [
12746
12760
  ...a.lineItems.map((li) => {
12747
- var _a3, _b3;
12761
+ var _a4, _b3;
12748
12762
  return {
12749
- activity: (_a3 = activityLabels[a.activityType]) != null ? _a3 : a.activityType,
12763
+ activity: (_a4 = activityLabels[a.activityType]) != null ? _a4 : a.activityType,
12750
12764
  name: li.name,
12751
12765
  amount: li.amount,
12752
12766
  priorAmount: (_b3 = li.priorAmount) != null ? _b3 : ""
12753
12767
  };
12754
12768
  }),
12755
12769
  {
12756
- activity: (_a2 = activityLabels[a.activityType]) != null ? _a2 : a.activityType,
12770
+ activity: (_a3 = activityLabels[a.activityType]) != null ? _a3 : a.activityType,
12757
12771
  name: `Net Cash from ${(_c2 = (_b2 = activityLabels[a.activityType]) == null ? void 0 : _b2.replace("Cash Flows from ", "")) != null ? _c2 : a.activityType}`,
12758
12772
  amount: a.netCash,
12759
12773
  priorAmount: (_d2 = a.priorNetCash) != null ? _d2 : ""
@@ -12766,8 +12780,8 @@ function CashFlowStatementResolver(p) {
12766
12780
  {
12767
12781
  filename: (_e = p.title) != null ? _e : "cash-flow-statement",
12768
12782
  onDownloadCSV: () => {
12769
- var _a2;
12770
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "cash-flow-statement");
12783
+ var _a3;
12784
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "cash-flow-statement");
12771
12785
  },
12772
12786
  children: /* @__PURE__ */ jsxRuntime.jsxs(
12773
12787
  "div",
@@ -12888,7 +12902,7 @@ function CashFlowStatementResolver(p) {
12888
12902
  ] }) }),
12889
12903
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
12890
12904
  activities.map((activity, ai) => {
12891
- var _a2, _b2, _c2;
12905
+ var _a3, _b2, _c2;
12892
12906
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
12893
12907
  ai > 0 && /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx(
12894
12908
  "td",
@@ -12911,12 +12925,12 @@ function CashFlowStatementResolver(p) {
12911
12925
  textTransform: "uppercase",
12912
12926
  letterSpacing: "0.04em"
12913
12927
  },
12914
- children: (_a2 = activityLabels[activity.activityType]) != null ? _a2 : activity.activityType
12928
+ children: (_a3 = activityLabels[activity.activityType]) != null ? _a3 : activity.activityType
12915
12929
  }
12916
12930
  ) }),
12917
12931
  activity.lineItems.map((li, li_i) => {
12918
- var _a3, _b3;
12919
- const indent = (_a3 = li.indent) != null ? _a3 : 0;
12932
+ var _a4, _b3;
12933
+ const indent = (_a4 = li.indent) != null ? _a4 : 0;
12920
12934
  const isSub = (_b3 = li.isSubtotal) != null ? _b3 : false;
12921
12935
  return /* @__PURE__ */ jsxRuntime.jsxs(
12922
12936
  "tr",
@@ -13185,7 +13199,7 @@ var formatDate4 = (iso) => {
13185
13199
  };
13186
13200
  var accountTypeBadge = ACCOUNT_TYPE_COLORS;
13187
13201
  function GeneralLedgerResolver(p) {
13188
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
13202
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
13189
13203
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
13190
13204
  const csvCols = [
13191
13205
  { key: "date", label: "Date" },
@@ -13195,11 +13209,11 @@ function GeneralLedgerResolver(p) {
13195
13209
  { key: "credit", label: "Credit" },
13196
13210
  { key: "runningBalance", label: "Balance" }
13197
13211
  ];
13198
- const csvRows = ((_a = p.transactions) != null ? _a : []).map((t) => {
13199
- var _a2;
13212
+ const csvRows = ((_a2 = p.transactions) != null ? _a2 : []).map((t) => {
13213
+ var _a3;
13200
13214
  return {
13201
13215
  date: t.date,
13202
- reference: (_a2 = t.reference) != null ? _a2 : "",
13216
+ reference: (_a3 = t.reference) != null ? _a3 : "",
13203
13217
  description: t.description,
13204
13218
  debit: t.debit,
13205
13219
  credit: t.credit,
@@ -13212,8 +13226,8 @@ function GeneralLedgerResolver(p) {
13212
13226
  {
13213
13227
  filename: (_d = p.title) != null ? _d : "general-ledger",
13214
13228
  onDownloadCSV: () => {
13215
- var _a2;
13216
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "general-ledger");
13229
+ var _a3;
13230
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "general-ledger");
13217
13231
  },
13218
13232
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
13219
13233
  p.title && /* @__PURE__ */ jsxRuntime.jsx(
@@ -13471,14 +13485,14 @@ var fmt11 = (v, currency) => {
13471
13485
  return v < 0 ? `(${s})` : s;
13472
13486
  };
13473
13487
  function ChartOfAccountsResolver(p) {
13474
- var _a, _b, _c, _d, _e, _f, _g;
13488
+ var _a2, _b, _c, _d, _e, _f, _g;
13475
13489
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
13476
- const hasSubType = ((_a = p.accounts) != null ? _a : []).some((a) => a.subType);
13490
+ const hasSubType = ((_a2 = p.accounts) != null ? _a2 : []).some((a) => a.subType);
13477
13491
  const showBalances = (_b = p.showBalances) != null ? _b : false;
13478
13492
  const currency = (_c = p.currency) != null ? _c : "USD";
13479
13493
  const activeCount = ((_d = p.accounts) != null ? _d : []).filter((a) => {
13480
- var _a2;
13481
- return !a.isHeader && ((_a2 = a.status) != null ? _a2 : "active") === "active";
13494
+ var _a3;
13495
+ return !a.isHeader && ((_a3 = a.status) != null ? _a3 : "active") === "active";
13482
13496
  }).length;
13483
13497
  const inactiveCount = ((_e = p.accounts) != null ? _e : []).filter((a) => !a.isHeader && a.status === "inactive").length;
13484
13498
  const csvCols = [
@@ -13490,12 +13504,12 @@ function ChartOfAccountsResolver(p) {
13490
13504
  ...showBalances ? [{ key: "balance", label: "Balance" }] : []
13491
13505
  ];
13492
13506
  const csvRows = p.accounts.filter((a) => !a.isHeader).map((a) => {
13493
- var _a2, _b2, _c2;
13507
+ var _a3, _b2, _c2;
13494
13508
  return {
13495
13509
  code: a.code,
13496
13510
  name: a.name,
13497
13511
  accountType: a.accountType,
13498
- subType: (_a2 = a.subType) != null ? _a2 : "",
13512
+ subType: (_a3 = a.subType) != null ? _a3 : "",
13499
13513
  status: ((_b2 = a.status) != null ? _b2 : "active").charAt(0).toUpperCase() + ((_c2 = a.status) != null ? _c2 : "active").slice(1),
13500
13514
  balance: a.balance != null ? a.balance : ""
13501
13515
  };
@@ -13505,8 +13519,8 @@ function ChartOfAccountsResolver(p) {
13505
13519
  {
13506
13520
  filename: (_f = p.title) != null ? _f : "chart-of-accounts",
13507
13521
  onDownloadCSV: () => {
13508
- var _a2;
13509
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "chart-of-accounts");
13522
+ var _a3;
13523
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "chart-of-accounts");
13510
13524
  },
13511
13525
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
13512
13526
  p.title && /* @__PURE__ */ jsxRuntime.jsx(
@@ -13638,9 +13652,9 @@ function ChartOfAccountsResolver(p) {
13638
13652
  )
13639
13653
  ] }) }),
13640
13654
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: ((_g = p.accounts) != null ? _g : []).map((account, ri) => {
13641
- var _a2, _b2, _c2;
13655
+ var _a3, _b2, _c2;
13642
13656
  const isInactive = account.status === "inactive";
13643
- const indent = (_a2 = account.indent) != null ? _a2 : 0;
13657
+ const indent = (_a3 = account.indent) != null ? _a3 : 0;
13644
13658
  if (account.isHeader) {
13645
13659
  const colSpan = 3 + (hasSubType ? 1 : 0) + 1 + (showBalances ? 1 : 0);
13646
13660
  return /* @__PURE__ */ jsxRuntime.jsx("tr", { style: { background: PAPER2 }, children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -13829,9 +13843,9 @@ var formatDate5 = (d) => {
13829
13843
  }
13830
13844
  };
13831
13845
  function InvoiceDetailResolver(p) {
13832
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
13846
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
13833
13847
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
13834
- const statusStyle = (_a = STATUS_COLORS2[p.status]) != null ? _a : STATUS_COLORS2.void;
13848
+ const statusStyle = (_a2 = STATUS_COLORS2[p.status]) != null ? _a2 : STATUS_COLORS2.void;
13835
13849
  const isOverdue = p.status === "overdue";
13836
13850
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: `invoice-${p.invoiceNumber}`, children: /* @__PURE__ */ jsxRuntime.jsxs(
13837
13851
  "div",
@@ -14310,7 +14324,7 @@ function InvoiceDetailResolver(p) {
14310
14324
  h
14311
14325
  )) }) }),
14312
14326
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: ((_q = p.payments) != null ? _q : []).map((pmt, i) => {
14313
- var _a2;
14327
+ var _a3;
14314
14328
  return /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
14315
14329
  /* @__PURE__ */ jsxRuntime.jsx(
14316
14330
  "td",
@@ -14358,7 +14372,7 @@ function InvoiceDetailResolver(p) {
14358
14372
  color: MUTED2,
14359
14373
  borderBottom: `1px solid #f2f2f2`
14360
14374
  },
14361
- children: (_a2 = pmt.reference) != null ? _a2 : "\u2014"
14375
+ children: (_a3 = pmt.reference) != null ? _a3 : "\u2014"
14362
14376
  }
14363
14377
  )
14364
14378
  ] }, i);
@@ -14446,14 +14460,14 @@ var tdStyle2 = (align = "left", last = false) => ({
14446
14460
  whiteSpace: "nowrap"
14447
14461
  });
14448
14462
  function AmortizationTableResolver(p) {
14449
- var _a, _b, _c, _d, _e, _f, _g;
14463
+ var _a2, _b, _c, _d, _e, _f, _g;
14450
14464
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
14451
- const currency = (_a = p.currency) != null ? _a : "USD";
14465
+ const currency = (_a2 = p.currency) != null ? _a2 : "USD";
14452
14466
  const payments = (_b = p.payments) != null ? _b : [];
14453
14467
  const hasDate = payments.some((r) => r.paymentDate);
14454
14468
  const hasExtra = payments.some((r) => {
14455
- var _a2;
14456
- return ((_a2 = r.extra) != null ? _a2 : 0) > 0;
14469
+ var _a3;
14470
+ return ((_a3 = r.extra) != null ? _a3 : 0) > 0;
14457
14471
  });
14458
14472
  const derivedMonthly = payments.length > 0 ? payments[0].payment : 0;
14459
14473
  const derivedTotalInterest = payments.reduce((s, r) => s + r.interest, 0);
@@ -14474,10 +14488,10 @@ function AmortizationTableResolver(p) {
14474
14488
  { key: "balance", label: "Balance" }
14475
14489
  ];
14476
14490
  const csvRows = payments.map((r) => {
14477
- var _a2, _b2;
14491
+ var _a3, _b2;
14478
14492
  return {
14479
14493
  period: r.period,
14480
- paymentDate: (_a2 = r.paymentDate) != null ? _a2 : "",
14494
+ paymentDate: (_a3 = r.paymentDate) != null ? _a3 : "",
14481
14495
  payment: r.payment,
14482
14496
  principal: r.principal,
14483
14497
  interest: r.interest,
@@ -14490,8 +14504,8 @@ function AmortizationTableResolver(p) {
14490
14504
  {
14491
14505
  filename: (_g = p.title) != null ? _g : "amortization-table",
14492
14506
  onDownloadCSV: () => {
14493
- var _a2;
14494
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "amortization-table");
14507
+ var _a3;
14508
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "amortization-table");
14495
14509
  },
14496
14510
  children: /* @__PURE__ */ jsxRuntime.jsxs(
14497
14511
  "div",
@@ -14733,7 +14747,7 @@ function AmortizationTableResolver(p) {
14733
14747
  /* @__PURE__ */ jsxRuntime.jsx("th", { style: thStyle3("right"), children: "Balance" })
14734
14748
  ] }) }),
14735
14749
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: payments.map((row, ri) => {
14736
- var _a2, _b2, _c2, _d2;
14750
+ var _a3, _b2, _c2, _d2;
14737
14751
  const isLast = ri === payments.length - 1;
14738
14752
  const principalPct = row.payment > 0 ? Math.min(row.principal / row.payment * 100, 100) : 0;
14739
14753
  const balanceIsZero = originalAmount > 0 && row.balance < originalAmount * 0.01;
@@ -14783,7 +14797,7 @@ function AmortizationTableResolver(p) {
14783
14797
  }
14784
14798
  )
14785
14799
  ] }),
14786
- hasDate && /* @__PURE__ */ jsxRuntime.jsx("td", { style: tdStyle2("left", isLast), children: (_a2 = row.paymentDate) != null ? _a2 : "\u2014" }),
14800
+ hasDate && /* @__PURE__ */ jsxRuntime.jsx("td", { style: tdStyle2("left", isLast), children: (_a3 = row.paymentDate) != null ? _a3 : "\u2014" }),
14787
14801
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: tdStyle2("right", isLast), children: fmt13(row.payment, currency) }),
14788
14802
  /* @__PURE__ */ jsxRuntime.jsx(
14789
14803
  "td",
@@ -14862,9 +14876,9 @@ var TH_STYLE = {
14862
14876
  };
14863
14877
  var TH_RIGHT = __spreadProps(__spreadValues({}, TH_STYLE), { textAlign: "right" });
14864
14878
  function DepreciationScheduleResolver(p) {
14865
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
14879
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
14866
14880
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
14867
- const currency = (_a = p.currency) != null ? _a : "USD";
14881
+ const currency = (_a2 = p.currency) != null ? _a2 : "USD";
14868
14882
  const fmt18 = (v) => {
14869
14883
  if (v === 0) return "\u2014";
14870
14884
  return new Intl.NumberFormat("en-US", {
@@ -14907,11 +14921,11 @@ function DepreciationScheduleResolver(p) {
14907
14921
  { key: "bookValue", label: "Book Value" }
14908
14922
  ];
14909
14923
  const csvRows = ((_g = p.assets) != null ? _g : []).map((a) => {
14910
- var _a2, _b2, _c2, _d2;
14924
+ var _a3, _b2, _c2, _d2;
14911
14925
  return {
14912
14926
  id: a.id,
14913
14927
  name: a.name,
14914
- category: (_a2 = a.category) != null ? _a2 : "",
14928
+ category: (_a3 = a.category) != null ? _a3 : "",
14915
14929
  acquiredDate: a.acquiredDate,
14916
14930
  cost: a.cost,
14917
14931
  usefulLife: (_b2 = a.usefulLife) != null ? _b2 : "",
@@ -14926,8 +14940,8 @@ function DepreciationScheduleResolver(p) {
14926
14940
  {
14927
14941
  filename: (_h = p.title) != null ? _h : "depreciation-schedule",
14928
14942
  onDownloadCSV: () => {
14929
- var _a2;
14930
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "depreciation-schedule");
14943
+ var _a3;
14944
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "depreciation-schedule");
14931
14945
  },
14932
14946
  children: /* @__PURE__ */ jsxRuntime.jsxs(
14933
14947
  "div",
@@ -15007,7 +15021,7 @@ function DepreciationScheduleResolver(p) {
15007
15021
  ] }) }),
15008
15022
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
15009
15023
  ((_i = p.assets) != null ? _i : []).map((asset, ri) => {
15010
- var _a2, _b2, _c2;
15024
+ var _a3, _b2, _c2;
15011
15025
  const catColor = asset.category && CATEGORY_COLORS[asset.category] || DEFAULT_CATEGORY_COLOR;
15012
15026
  const bvRatio = asset.cost > 0 ? asset.bookValue / asset.cost : 0;
15013
15027
  const barColor = bvRatio > 0.5 ? "#15803d" : bvRatio > 0.2 ? "#f59e0b" : "#dc2626";
@@ -15091,7 +15105,7 @@ function DepreciationScheduleResolver(p) {
15091
15105
  borderBottom: "1px solid #f2f2f2",
15092
15106
  whiteSpace: "nowrap"
15093
15107
  },
15094
- children: (_a2 = asset.usefulLife) != null ? _a2 : "\u2014"
15108
+ children: (_a3 = asset.usefulLife) != null ? _a3 : "\u2014"
15095
15109
  }
15096
15110
  ),
15097
15111
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -15300,12 +15314,12 @@ var PRIORITY_STYLES = {
15300
15314
  low: { color: "#777777", bg: "#f2f2f2", label: "LOW" }
15301
15315
  };
15302
15316
  function EscalationCardResolver(p) {
15303
- var _a, _b, _c, _d;
15317
+ var _a2, _b, _c, _d;
15304
15318
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
15305
15319
  const [cardHovered, setCardHovered] = React41.useState(false);
15306
15320
  const [btnHovered, setBtnHovered] = React41.useState(false);
15307
15321
  const priorityStyle = p.priority ? PRIORITY_STYLES[p.priority] : null;
15308
- const railColor = (_a = priorityStyle == null ? void 0 : priorityStyle.color) != null ? _a : ACCENT2;
15322
+ const railColor = (_a2 = priorityStyle == null ? void 0 : priorityStyle.color) != null ? _a2 : ACCENT2;
15309
15323
  const iconBg = (_b = priorityStyle == null ? void 0 : priorityStyle.bg) != null ? _b : "#fff2ec";
15310
15324
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_c = p.title) != null ? _c : "escalation", children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
15311
15325
  "div",
@@ -15437,9 +15451,9 @@ function fmt14(v, unit) {
15437
15451
  return /^[$€£¥]/.test(unit) ? `${unit}${n}` : `${n}${unit === "%" ? "%" : ` ${unit}`}`;
15438
15452
  }
15439
15453
  function LineChartResolver(p) {
15440
- var _a, _b, _c, _d;
15454
+ var _a2, _b, _c, _d;
15441
15455
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
15442
- const series = (_a = p.series) != null ? _a : [];
15456
+ const series = (_a2 = p.series) != null ? _a2 : [];
15443
15457
  const data = (_b = p.data) != null ? _b : [];
15444
15458
  const xKey = (_c = p.xKey) != null ? _c : "x";
15445
15459
  const { isVisible, toggle } = useSeriesToggle(series.map((s) => s.dataKey));
@@ -15467,14 +15481,14 @@ function LineChartResolver(p) {
15467
15481
  }
15468
15482
  ),
15469
15483
  series.map((s, i) => {
15470
- var _a2;
15484
+ var _a3;
15471
15485
  return /* @__PURE__ */ jsxRuntime.jsx(
15472
15486
  recharts.Line,
15473
15487
  {
15474
15488
  type: p.smooth ? "monotone" : "linear",
15475
15489
  dataKey: s.dataKey,
15476
15490
  name: s.name,
15477
- stroke: (_a2 = s.color) != null ? _a2 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length],
15491
+ stroke: (_a3 = s.color) != null ? _a3 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length],
15478
15492
  strokeWidth: 2,
15479
15493
  dot: false,
15480
15494
  activeDot: { r: 4, strokeWidth: 2, stroke: "white" },
@@ -15486,7 +15500,7 @@ function LineChartResolver(p) {
15486
15500
  })
15487
15501
  ] }) }),
15488
15502
  series.length > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "14px" }, children: series.map((s, i) => {
15489
- var _a2;
15503
+ var _a3;
15490
15504
  return /* @__PURE__ */ jsxRuntime.jsxs(
15491
15505
  "div",
15492
15506
  {
@@ -15507,7 +15521,7 @@ function LineChartResolver(p) {
15507
15521
  width: "16px",
15508
15522
  height: "2px",
15509
15523
  borderRadius: "9999px",
15510
- background: (_a2 = s.color) != null ? _a2 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length],
15524
+ background: (_a3 = s.color) != null ? _a3 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length],
15511
15525
  display: "inline-block",
15512
15526
  opacity: isVisible(s.dataKey) ? 1 : 0.3,
15513
15527
  transition: "opacity 0.15s"
@@ -15536,15 +15550,15 @@ function fmt15(v, unit) {
15536
15550
  return /^[$€£¥]/.test(unit) ? `${unit}${n}` : `${n}${unit === "%" ? "%" : ` ${unit}`}`;
15537
15551
  }
15538
15552
  function ComboChartResolver(p) {
15539
- var _a, _b, _c, _d, _e;
15553
+ var _a2, _b, _c, _d, _e;
15540
15554
  const { BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
15541
- const bars = (_a = p.bars) != null ? _a : [];
15555
+ const bars = (_a2 = p.bars) != null ? _a2 : [];
15542
15556
  const lines = (_b = p.lines) != null ? _b : [];
15543
15557
  const data = (_c = p.data) != null ? _c : [];
15544
15558
  const xKey = (_d = p.xKey) != null ? _d : "x";
15545
15559
  const hasRight = bars.some((b) => b.axis === "right") || lines.some((l) => {
15546
- var _a2;
15547
- return ((_a2 = l.axis) != null ? _a2 : "right") === "right";
15560
+ var _a3;
15561
+ return ((_a3 = l.axis) != null ? _a3 : "right") === "right";
15548
15562
  });
15549
15563
  const all = [
15550
15564
  ...bars.map((b) => __spreadProps(__spreadValues({}, b), { kind: "bar" })),
@@ -15552,9 +15566,9 @@ function ComboChartResolver(p) {
15552
15566
  ];
15553
15567
  const { isVisible, toggle } = useSeriesToggle(all.map((s) => s.dataKey));
15554
15568
  const colorOf = (dataKey, fallbackIdx) => {
15555
- var _a2;
15569
+ var _a3;
15556
15570
  const s = all.find((x) => x.dataKey === dataKey);
15557
- return (_a2 = s == null ? void 0 : s.color) != null ? _a2 : exports.CHART_PALETTE[fallbackIdx % exports.CHART_PALETTE.length];
15571
+ return (_a3 = s == null ? void 0 : s.color) != null ? _a3 : exports.CHART_PALETTE[fallbackIdx % exports.CHART_PALETTE.length];
15558
15572
  };
15559
15573
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_e = p.title) != null ? _e : "combo-chart", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "12px" }, children: [
15560
15574
  p.title && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
@@ -15586,11 +15600,11 @@ function ComboChartResolver(p) {
15586
15600
  ),
15587
15601
  /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { contentStyle: tooltipStyle7, cursor: { fill: "rgba(0,0,0,0.03)" } }),
15588
15602
  bars.map((b, i) => {
15589
- var _a2;
15603
+ var _a3;
15590
15604
  return /* @__PURE__ */ jsxRuntime.jsx(
15591
15605
  recharts.Bar,
15592
15606
  {
15593
- yAxisId: (_a2 = b.axis) != null ? _a2 : "left",
15607
+ yAxisId: (_a3 = b.axis) != null ? _a3 : "left",
15594
15608
  dataKey: b.dataKey,
15595
15609
  name: b.name,
15596
15610
  fill: colorOf(b.dataKey, i),
@@ -15603,11 +15617,11 @@ function ComboChartResolver(p) {
15603
15617
  );
15604
15618
  }),
15605
15619
  lines.map((l, i) => {
15606
- var _a2;
15620
+ var _a3;
15607
15621
  return /* @__PURE__ */ jsxRuntime.jsx(
15608
15622
  recharts.Line,
15609
15623
  {
15610
- yAxisId: (_a2 = l.axis) != null ? _a2 : "right",
15624
+ yAxisId: (_a3 = l.axis) != null ? _a3 : "right",
15611
15625
  type: "monotone",
15612
15626
  dataKey: l.dataKey,
15613
15627
  name: l.name,
@@ -15667,9 +15681,9 @@ function fmt16(v, unit) {
15667
15681
  return /^[$€£¥]/.test(unit) ? `${unit}${n}` : `${n}${unit === "%" ? "%" : ` ${unit}`}`;
15668
15682
  }
15669
15683
  function GaugeChartResolver(p) {
15670
- var _a, _b;
15684
+ var _a2, _b;
15671
15685
  const { MUTED: MUTED2, ACCENT: ACCENT2, PAPER: PAPER2 } = useTheme();
15672
- const items = (_a = p.items) != null ? _a : [];
15686
+ const items = (_a2 = p.items) != null ? _a2 : [];
15673
15687
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "gauge-chart", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "12px" }, children: [
15674
15688
  p.title && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
15675
15689
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px", justifyContent: items.length === 1 ? "center" : "space-around" }, children: items.map((it, i) => {
@@ -15748,24 +15762,24 @@ function makeCellContent(total, currency) {
15748
15762
  };
15749
15763
  }
15750
15764
  function TreemapChartResolver(p) {
15751
- var _a, _b;
15765
+ var _a2, _b;
15752
15766
  useTheme();
15753
- const nodes = (_a = p.nodes) != null ? _a : [];
15767
+ const nodes = (_a2 = p.nodes) != null ? _a2 : [];
15754
15768
  const total = nodes.reduce((s, n) => s + (n.value || 0), 0);
15755
15769
  const data = nodes.map((n, i) => {
15756
- var _a2;
15770
+ var _a3;
15757
15771
  return {
15758
15772
  name: n.name,
15759
15773
  value: n.value,
15760
- fill: (_a2 = n.color) != null ? _a2 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length]
15774
+ fill: (_a3 = n.color) != null ? _a3 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length]
15761
15775
  };
15762
15776
  });
15763
15777
  const csv = () => {
15764
- var _a2;
15778
+ var _a3;
15765
15779
  return downloadCSV(
15766
15780
  [{ key: "name", label: "Name" }, { key: "value", label: "Value" }],
15767
15781
  nodes.map((n) => ({ name: n.name, value: n.value })),
15768
- (_a2 = p.title) != null ? _a2 : "treemap-chart"
15782
+ (_a3 = p.title) != null ? _a3 : "treemap-chart"
15769
15783
  );
15770
15784
  };
15771
15785
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "treemap-chart", onDownloadCSV: csv, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "12px" }, children: [
@@ -15800,9 +15814,9 @@ var tooltipStyle9 = {
15800
15814
  color: "var(--foreground)"
15801
15815
  };
15802
15816
  function RadarChartResolver(p) {
15803
- var _a, _b, _c;
15817
+ var _a2, _b, _c;
15804
15818
  const { BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
15805
- const series = (_a = p.series) != null ? _a : [];
15819
+ const series = (_a2 = p.series) != null ? _a2 : [];
15806
15820
  const data = (_b = p.data) != null ? _b : [];
15807
15821
  const { isVisible, toggle } = useSeriesToggle(series.map((s) => s.dataKey));
15808
15822
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_c = p.title) != null ? _c : "radar-chart", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "12px" }, children: [
@@ -15813,8 +15827,8 @@ function RadarChartResolver(p) {
15813
15827
  /* @__PURE__ */ jsxRuntime.jsx(recharts.PolarRadiusAxis, { tick: { fontSize: 10, fill: MUTED2 }, axisLine: false }),
15814
15828
  /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { contentStyle: tooltipStyle9, formatter: (value) => p.unit ? `${Number(value)}${p.unit}` : `${Number(value)}` }),
15815
15829
  series.map((s, i) => {
15816
- var _a2;
15817
- const c = (_a2 = s.color) != null ? _a2 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length];
15830
+ var _a3;
15831
+ const c = (_a3 = s.color) != null ? _a3 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length];
15818
15832
  return /* @__PURE__ */ jsxRuntime.jsx(
15819
15833
  recharts.Radar,
15820
15834
  {
@@ -15832,8 +15846,8 @@ function RadarChartResolver(p) {
15832
15846
  })
15833
15847
  ] }) }),
15834
15848
  series.length > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "14px", justifyContent: "center" }, children: series.map((s, i) => {
15835
- var _a2;
15836
- const c = (_a2 = s.color) != null ? _a2 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length];
15849
+ var _a3;
15850
+ const c = (_a3 = s.color) != null ? _a3 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length];
15837
15851
  return /* @__PURE__ */ jsxRuntime.jsxs(
15838
15852
  "div",
15839
15853
  {
@@ -15882,24 +15896,24 @@ function money2(v, currency) {
15882
15896
  return currency ? `${currency}${n}` : n;
15883
15897
  }
15884
15898
  function FunnelChartResolver(p) {
15885
- var _a, _b, _c, _d;
15899
+ var _a2, _b, _c, _d;
15886
15900
  const { MUTED: MUTED2 } = useTheme();
15887
- const stages = (_a = p.stages) != null ? _a : [];
15901
+ const stages = (_a2 = p.stages) != null ? _a2 : [];
15888
15902
  const data = stages.map((s, i) => {
15889
- var _a2;
15903
+ var _a3;
15890
15904
  return {
15891
15905
  name: s.label,
15892
15906
  value: s.value,
15893
- fill: (_a2 = s.color) != null ? _a2 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length]
15907
+ fill: (_a3 = s.color) != null ? _a3 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length]
15894
15908
  };
15895
15909
  });
15896
15910
  const first = (_c = (_b = stages[0]) == null ? void 0 : _b.value) != null ? _c : 0;
15897
15911
  const csv = () => {
15898
- var _a2;
15912
+ var _a3;
15899
15913
  return downloadCSV(
15900
15914
  [{ key: "label", label: "Stage" }, { key: "value", label: "Value" }],
15901
15915
  stages.map((s) => ({ label: s.label, value: s.value })),
15902
- (_a2 = p.title) != null ? _a2 : "funnel-chart"
15916
+ (_a3 = p.title) != null ? _a3 : "funnel-chart"
15903
15917
  );
15904
15918
  };
15905
15919
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_d = p.title) != null ? _d : "funnel-chart", onDownloadCSV: csv, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "12px" }, children: [
@@ -15912,13 +15926,13 @@ function FunnelChartResolver(p) {
15912
15926
  ] })
15913
15927
  ] }) }),
15914
15928
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: stages.map((s, i) => {
15915
- var _a2;
15929
+ var _a3;
15916
15930
  const prior = i === 0 ? null : stages[i - 1].value;
15917
15931
  const stepPct = prior && prior > 0 ? Math.round(s.value / prior * 100) : null;
15918
15932
  const ofTop = first > 0 ? Math.round(s.value / first * 100) : null;
15919
15933
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", fontSize: "12px" }, children: [
15920
15934
  /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "flex", alignItems: "center", gap: "8px", color: "var(--foreground)" }, children: [
15921
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { width: "10px", height: "10px", borderRadius: "3px", background: (_a2 = s.color) != null ? _a2 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length] } }),
15935
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { width: "10px", height: "10px", borderRadius: "3px", background: (_a3 = s.color) != null ? _a3 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length] } }),
15922
15936
  s.label
15923
15937
  ] }),
15924
15938
  /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: MUTED2, fontVariantNumeric: "tabular-nums" }, children: [
@@ -15941,22 +15955,22 @@ function fmt17(v, unit) {
15941
15955
  return /^[$€£¥]/.test(unit) ? `${unit}${n}` : `${n}${unit === "%" ? "%" : ` ${unit}`}`;
15942
15956
  }
15943
15957
  function BulletChartResolver(p) {
15944
- var _a, _b;
15958
+ var _a2, _b;
15945
15959
  const { MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
15946
- const items = (_a = p.items) != null ? _a : [];
15960
+ const items = (_a2 = p.items) != null ? _a2 : [];
15947
15961
  const csv = () => {
15948
- var _a2;
15962
+ var _a3;
15949
15963
  return downloadCSV(
15950
15964
  [{ key: "label", label: "KPI" }, { key: "value", label: "Actual" }, { key: "target", label: "Target" }],
15951
15965
  items.map((it) => ({ label: it.label, value: it.value, target: it.target })),
15952
- (_a2 = p.title) != null ? _a2 : "bullet-chart"
15966
+ (_a3 = p.title) != null ? _a3 : "bullet-chart"
15953
15967
  );
15954
15968
  };
15955
15969
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "bullet-chart", onDownloadCSV: csv, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "12px" }, children: [
15956
15970
  p.title && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontFamily: "var(--font-serif)", fontSize: "15px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "-0.005em" }, children: p.title }),
15957
15971
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: items.map((it, i) => {
15958
- var _a2;
15959
- const max = (_a2 = it.max) != null ? _a2 : Math.max(it.value, it.target) * 1.25 || 1;
15972
+ var _a3;
15973
+ const max = (_a3 = it.max) != null ? _a3 : Math.max(it.value, it.target) * 1.25 || 1;
15960
15974
  const valPct = Math.max(0, Math.min(100, it.value / max * 100));
15961
15975
  const tgtPct = Math.max(0, Math.min(100, it.target / max * 100));
15962
15976
  const ratio = it.target > 0 ? it.value / it.target : 1;
@@ -15986,20 +16000,20 @@ function axisFmt(v, unit) {
15986
16000
  return /^[$€£¥]/.test(unit) ? `${unit}${n}` : `${n}${unit === "%" ? "%" : ` ${unit}`}`;
15987
16001
  }
15988
16002
  function ScatterChartResolver(p) {
15989
- var _a, _b;
16003
+ var _a2, _b;
15990
16004
  const { BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
15991
- const series = (_a = p.series) != null ? _a : [];
16005
+ const series = (_a2 = p.series) != null ? _a2 : [];
15992
16006
  const hasZ = series.some((s) => s.points.some((pt) => pt.z != null));
15993
16007
  const { isVisible, toggle } = useSeriesToggle(series.map((s) => s.name));
15994
16008
  const tooltipContent = (props) => {
15995
- var _a2, _b2;
16009
+ var _a3, _b2;
15996
16010
  const { active, payload } = props;
15997
16011
  if (!active || !payload || !payload.length) return null;
15998
16012
  const d = payload[0].payload;
15999
16013
  return /* @__PURE__ */ jsxRuntime.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: [
16000
16014
  d.label && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontWeight: 600, marginBottom: "2px" }, children: d.label }),
16001
16015
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { color: MUTED2 }, children: [
16002
- (_a2 = p.xLabel) != null ? _a2 : "x",
16016
+ (_a3 = p.xLabel) != null ? _a3 : "x",
16003
16017
  ": ",
16004
16018
  axisFmt(d.x, p.xUnit)
16005
16019
  ] }),
@@ -16047,13 +16061,13 @@ function ScatterChartResolver(p) {
16047
16061
  hasZ && /* @__PURE__ */ jsxRuntime.jsx(recharts.ZAxis, { type: "number", dataKey: "z", range: [60, 420] }),
16048
16062
  /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { content: tooltipContent, cursor: { strokeDasharray: "3 3" } }),
16049
16063
  series.map((s, i) => {
16050
- var _a2;
16064
+ var _a3;
16051
16065
  return /* @__PURE__ */ jsxRuntime.jsx(
16052
16066
  recharts.Scatter,
16053
16067
  {
16054
16068
  name: s.name,
16055
16069
  data: s.points,
16056
- fill: (_a2 = s.color) != null ? _a2 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length],
16070
+ fill: (_a3 = s.color) != null ? _a3 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length],
16057
16071
  fillOpacity: 0.7,
16058
16072
  hide: !isVisible(s.name),
16059
16073
  isAnimationActive: false
@@ -16063,8 +16077,8 @@ function ScatterChartResolver(p) {
16063
16077
  })
16064
16078
  ] }) }),
16065
16079
  series.length > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "14px" }, children: series.map((s, i) => {
16066
- var _a2;
16067
- const c = (_a2 = s.color) != null ? _a2 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length];
16080
+ var _a3;
16081
+ const c = (_a3 = s.color) != null ? _a3 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length];
16068
16082
  return /* @__PURE__ */ jsxRuntime.jsxs(
16069
16083
  "div",
16070
16084
  {
@@ -16148,7 +16162,7 @@ function brandIconUrl(name) {
16148
16162
  }
16149
16163
  var CONNECTED_GREEN = "#15803d";
16150
16164
  function ConnectIntegrationResolver(p) {
16151
- var _a;
16165
+ var _a2;
16152
16166
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
16153
16167
  const [cardHovered, setCardHovered] = React41.useState(false);
16154
16168
  const [btnHovered, setBtnHovered] = React41.useState(false);
@@ -16158,7 +16172,7 @@ function ConnectIntegrationResolver(p) {
16158
16172
  const iconSrc = p.iconUrl || brandIconUrl(name);
16159
16173
  const showImg = Boolean(iconSrc) && !imgFailed;
16160
16174
  const connected = p.status === "connected";
16161
- const label = (_a = p.ctaLabel) != null ? _a : connected ? "Open" : "Connect";
16175
+ const label = (_a2 = p.ctaLabel) != null ? _a2 : connected ? "Open" : "Connect";
16162
16176
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: name, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
16163
16177
  "div",
16164
16178
  {
@@ -16311,14 +16325,14 @@ init_ThemeContext();
16311
16325
  var CONNECTED_GREEN2 = "#15803d";
16312
16326
  var CONNECTED_BG = "#eaf6ee";
16313
16327
  function IntegrationsListResolver(p) {
16314
- var _a, _b;
16328
+ var _a2, _b;
16315
16329
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
16316
16330
  const integrations = Array.isArray(p.integrations) ? p.integrations : [];
16317
16331
  const [rowHover, setRowHover] = React41.useState(null);
16318
16332
  const [btnHover, setBtnHover] = React41.useState(null);
16319
16333
  const [failed, setFailed] = React41.useState({});
16320
16334
  const connectedCount = integrations.filter((i) => i.status === "connected").length;
16321
- return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a = p.title) != null ? _a : "integrations", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "11px" }, children: [
16335
+ return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a2 = p.title) != null ? _a2 : "integrations", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "11px" }, children: [
16322
16336
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
16323
16337
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "baseline", justifyContent: "space-between", gap: "12px" }, children: [
16324
16338
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -16592,11 +16606,11 @@ function layoutGraph(steps, startX = 0, startY = 0, keyPrefix = "") {
16592
16606
  let prevId = null;
16593
16607
  let totalW = NODE_W;
16594
16608
  steps.forEach((step, idx) => {
16595
- var _a, _b, _c, _d;
16609
+ var _a2, _b, _c, _d;
16596
16610
  const op = step.operation;
16597
16611
  const isBranch = op === "BRANCH" || op === "CONDITION";
16598
16612
  const isFanOut = op === "FAN_OUT";
16599
- const baseId = `${keyPrefix}${(_a = step.id) != null ? _a : `s${idx}`}`;
16613
+ const baseId = `${keyPrefix}${(_a2 = step.id) != null ? _a2 : `s${idx}`}`;
16600
16614
  if (isFanOut && ((_b = step.subSteps) == null ? void 0 : _b.length)) {
16601
16615
  const foNodeId = baseId;
16602
16616
  const res = layoutGraph(step.subSteps, 0, 0, `${baseId}/`);
@@ -16638,10 +16652,10 @@ function layoutGraph(steps, startX = 0, startY = 0, keyPrefix = "") {
16638
16652
  if (prevId) edges.push({ from: prevId, to: bNodeId });
16639
16653
  y += BRANCH_NODE_H + GAP_Y;
16640
16654
  const branchResults = step.branches.map((br, bi) => {
16641
- var _a2;
16655
+ var _a3;
16642
16656
  return __spreadValues({
16643
16657
  branch: __spreadProps(__spreadValues({}, br), { color: BRANCH_COLORS[bi % BRANCH_COLORS.length], _gid: `${bNodeId}-b${bi}` })
16644
- }, layoutGraph((_a2 = br.steps) != null ? _a2 : [], 0, 0, `${bNodeId}/b${bi}/`));
16658
+ }, layoutGraph((_a3 = br.steps) != null ? _a3 : [], 0, 0, `${bNodeId}/b${bi}/`));
16645
16659
  });
16646
16660
  let bTotalW = branchResults.reduce((sum, r) => sum + r.totalW + GAP_X, 0) - GAP_X;
16647
16661
  if (!Number.isFinite(bTotalW) || bTotalW <= 0) bTotalW = NODE_W;
@@ -16797,10 +16811,10 @@ var ellipsis = {
16797
16811
  display: "block"
16798
16812
  };
16799
16813
  function PipelinePreviewResolver(p) {
16800
- var _a, _b, _c, _d, _e, _f, _g;
16814
+ var _a2, _b, _c, _d, _e, _f, _g;
16801
16815
  const { MUTED: MUTED2, PAPER: PAPER2, BORDER: BORDER4, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
16802
16816
  const [btnHovered, setBtnHovered] = React41.useState(false);
16803
- const stateCfg = STATE_CONFIG[(_a = p.state) != null ? _a : "draft"];
16817
+ const stateCfg = STATE_CONFIG[(_a2 = p.state) != null ? _a2 : "draft"];
16804
16818
  const destinations = (_b = p.destinations) != null ? _b : [];
16805
16819
  const steps = (_c = p.steps) != null ? _c : [];
16806
16820
  const workstreams = (_d = p.workstreams) != null ? _d : [];
@@ -17205,6 +17219,7 @@ var STATUS_COLORS3 = {
17205
17219
  // filled from theme ACCENT at render time
17206
17220
  review: "#f59e0b",
17207
17221
  pending: "#9ca3af",
17222
+ blocked: "#b45309",
17208
17223
  failed: "#dc2626"
17209
17224
  };
17210
17225
  var STATUS_LABELS = {
@@ -17212,6 +17227,7 @@ var STATUS_LABELS = {
17212
17227
  active: "In progress",
17213
17228
  review: "In review",
17214
17229
  pending: "Pending",
17230
+ blocked: "Blocked",
17215
17231
  failed: "Failed"
17216
17232
  };
17217
17233
  var HUMAN_PALETTE = ["#2563eb", "#0f766e", "#7c3aed", "#b45309", "#be185d", "#4d7c0f"];
@@ -17221,10 +17237,10 @@ function hashColor(name) {
17221
17237
  return HUMAN_PALETTE[Math.abs(h) % HUMAN_PALETTE.length];
17222
17238
  }
17223
17239
  function initialsOf(a) {
17224
- var _a, _b, _c, _d;
17240
+ var _a2, _b, _c, _d;
17225
17241
  if (a.initials) return a.initials.slice(0, 2).toUpperCase();
17226
17242
  const parts = a.name.trim().split(/\s+/);
17227
- return (((_b = (_a = parts[0]) == null ? void 0 : _a[0]) != null ? _b : "") + ((_d = (_c = parts[1]) == null ? void 0 : _c[0]) != null ? _d : "")).toUpperCase() || "?";
17243
+ return (((_b = (_a2 = parts[0]) == null ? void 0 : _a2[0]) != null ? _b : "") + ((_d = (_c = parts[1]) == null ? void 0 : _c[0]) != null ? _d : "")).toUpperCase() || "?";
17228
17244
  }
17229
17245
  function SparkMark({ size, color }) {
17230
17246
  return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -17292,8 +17308,8 @@ function AvatarStack({ assignees, accent }) {
17292
17308
  ] });
17293
17309
  }
17294
17310
  function IndexDot({ step, index, accent }) {
17295
- var _a;
17296
- const n = (_a = step.n) != null ? _a : index + 1;
17311
+ var _a2;
17312
+ const n = (_a2 = step.n) != null ? _a2 : index + 1;
17297
17313
  const base = {
17298
17314
  width: 18,
17299
17315
  height: 18,
@@ -17329,8 +17345,8 @@ function useContainerWidth(ref) {
17329
17345
  const el = ref.current;
17330
17346
  if (!el || typeof ResizeObserver === "undefined") return;
17331
17347
  const ro = new ResizeObserver((entries) => {
17332
- var _a;
17333
- const cr = (_a = entries[0]) == null ? void 0 : _a.contentRect;
17348
+ var _a2;
17349
+ const cr = (_a2 = entries[0]) == null ? void 0 : _a2.contentRect;
17334
17350
  if (cr) setW(cr.width);
17335
17351
  });
17336
17352
  ro.observe(el);
@@ -17419,9 +17435,9 @@ function WorkflowStepperRenderer({
17419
17435
  loadingSteps = 6,
17420
17436
  showProgress = true
17421
17437
  }) {
17422
- var _a, _b, _c, _d, _e, _f;
17438
+ var _a2, _b, _c, _d, _e, _f;
17423
17439
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
17424
- const steps = (_a = data.steps) != null ? _a : [];
17440
+ const steps = (_a2 = data.steps) != null ? _a2 : [];
17425
17441
  const activeStepId = (_d = (_c = data.active_step) != null ? _c : (_b = steps.find((s) => s.status === "active")) == null ? void 0 : _b.id) != null ? _d : null;
17426
17442
  const interactive = typeof onSelectStep === "function";
17427
17443
  const statusColor3 = (s) => s === "active" ? ACCENT2 : STATUS_COLORS3[s];
@@ -17649,13 +17665,13 @@ function WorkflowStepperRenderer({
17649
17665
  .wfs-scroller:hover::-webkit-scrollbar-thumb{background:#aab2c2;background-clip:padding-box}
17650
17666
  ` }),
17651
17667
  steps.map((step, i) => {
17652
- var _a2;
17668
+ var _a3;
17653
17669
  const isSelected = selectedStep === step.id;
17654
17670
  const isActive = step.status === "active";
17655
17671
  const reached = step.status !== "pending";
17656
17672
  const clickable = interactive && reached;
17657
17673
  const color = statusColor3(step.status);
17658
- const humans = ((_a2 = step.assignees) != null ? _a2 : []).filter((a) => a.kind === "human");
17674
+ const humans = ((_a3 = step.assignees) != null ? _a3 : []).filter((a) => a.kind === "human");
17659
17675
  const roleCaption = humans.map((h) => h.role).filter(Boolean).slice(0, 2).join(" \xB7 ");
17660
17676
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
17661
17677
  i > 0 && /* @__PURE__ */ jsxRuntime.jsx(
@@ -17852,9 +17868,9 @@ function WorkflowStepperRenderer({
17852
17868
  ] });
17853
17869
  }
17854
17870
  function WorkflowStepperResolver(p) {
17855
- var _a;
17871
+ var _a2;
17856
17872
  const { selectedStepId, onStepSelect } = useGenUIInteraction();
17857
- return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a = p.title) != null ? _a : "workflow-stepper", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: 10 }, children: [
17873
+ return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a2 = p.title) != null ? _a2 : "workflow-stepper", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: 10 }, children: [
17858
17874
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap" }, children: [
17859
17875
  /* @__PURE__ */ jsxRuntime.jsx(
17860
17876
  "p",
@@ -18089,12 +18105,57 @@ var BUILDER_FIELD_TYPES = [
18089
18105
  "multi_select",
18090
18106
  "date",
18091
18107
  "checkbox",
18092
- "file_upload"
18108
+ "file_upload",
18109
+ // Server-backed search-as-you-type combobox. Unlike `select` (static
18110
+ // `options`), it queries an allowlisted `source` via host-injected callbacks
18111
+ // (onEntitySearch/onEntityCreate) and can create a new record inline.
18112
+ "entity_picker",
18113
+ // Assign a set of files to role categories (grouped cards + inline Move).
18114
+ // Self-contained: candidate files + AI suggestions ride the `file_map` config
18115
+ // in the payload (no host callback). Submitted value = {category_id:[path]}.
18116
+ "file_map"
18093
18117
  ];
18094
18118
  var builderFieldOptionSchema = zod.z.object({
18095
18119
  value: zod.z.string(),
18096
18120
  label: zod.z.string()
18097
18121
  });
18122
+ zod.z.object({
18123
+ value: zod.z.string(),
18124
+ label: zod.z.string(),
18125
+ description: zod.z.string().optional().nullable(),
18126
+ meta: zod.z.string().optional().nullable()
18127
+ });
18128
+ var entityCreateFieldSchema = zod.z.object({
18129
+ name: zod.z.string(),
18130
+ label: zod.z.string(),
18131
+ field_type: zod.z.enum(["text", "textarea", "number", "date", "checkbox", "select"]).optional().default("text"),
18132
+ required: zod.z.boolean().optional().default(false),
18133
+ placeholder: zod.z.string().optional().default(""),
18134
+ options: zod.z.array(builderFieldOptionSchema).optional().nullable()
18135
+ });
18136
+ var fileMapCategorySchema = zod.z.object({
18137
+ id: zod.z.string(),
18138
+ label: zod.z.string(),
18139
+ hint: zod.z.string().optional().nullable()
18140
+ });
18141
+ var fileMapFileSchema = zod.z.object({
18142
+ path: zod.z.string(),
18143
+ name: zod.z.string().optional().nullable(),
18144
+ type: zod.z.string().optional().nullable(),
18145
+ // ext, e.g. "csv"
18146
+ size: zod.z.string().optional().nullable()
18147
+ // pre-formatted, e.g. "600 B"
18148
+ });
18149
+ var fileMapConfigSchema = zod.z.object({
18150
+ categories: zod.z.array(fileMapCategorySchema).min(1),
18151
+ files: zod.z.array(fileMapFileSchema),
18152
+ /** AI seed: {category_id: [file_path]}. */
18153
+ suggestions: zod.z.record(zod.z.string(), zod.z.array(zod.z.string())).optional().nullable(),
18154
+ /** {file_path: HIGH|MEDIUM|LOW} for the suggested rows. */
18155
+ confidence: zod.z.record(zod.z.string(), zod.z.enum(["HIGH", "MEDIUM", "LOW"])).optional().nullable(),
18156
+ /** Allow files to stay unassigned (default true). */
18157
+ allow_unassigned: zod.z.boolean().optional().default(true)
18158
+ });
18098
18159
  var builderFieldValidationSchema = zod.z.object({
18099
18160
  min: zod.z.number().optional(),
18100
18161
  max: zod.z.number().optional(),
@@ -18111,7 +18172,17 @@ var builderFieldSchema = zod.z.object({
18111
18172
  description: zod.z.string().optional().default(""),
18112
18173
  options: zod.z.array(builderFieldOptionSchema).optional().nullable(),
18113
18174
  default_value: zod.z.any().optional().nullable(),
18114
- validation: builderFieldValidationSchema.nullable()
18175
+ validation: builderFieldValidationSchema.nullable(),
18176
+ // --- entity_picker config (ignored by other field types) ---
18177
+ /** Allowlisted entity source the host knows how to search/create, e.g.
18178
+ * "workstreams". NOT a raw URL — the host maps it to a real endpoint. */
18179
+ source: zod.z.string().optional().nullable(),
18180
+ /** Show the inline "Create new …" affordance (host still enforces perms). */
18181
+ allow_create: zod.z.boolean().optional().default(false),
18182
+ /** Fields for the inline create sub-form (defaults to a single `name`). */
18183
+ create_fields: zod.z.array(entityCreateFieldSchema).optional().nullable(),
18184
+ // --- file_map config (ignored by other field types) ---
18185
+ file_map: fileMapConfigSchema.optional().nullable()
18115
18186
  });
18116
18187
  var builderBlockSchema = zod.z.object({
18117
18188
  id: zod.z.string(),
@@ -18142,7 +18213,7 @@ function validateBuilderPayload(data) {
18142
18213
  };
18143
18214
  }
18144
18215
 
18145
- // src/builders/FormBuilder.tsx
18216
+ // src/builders/BlockForm.tsx
18146
18217
  init_ThemeContext();
18147
18218
 
18148
18219
  // src/builders/FieldRenderer.tsx
@@ -18197,7 +18268,7 @@ function TextAreaField({ field, value, onChange, disabled, error }) {
18197
18268
  );
18198
18269
  }
18199
18270
  function NumberField({ field, value, onChange, disabled, error }) {
18200
- var _a, _b;
18271
+ var _a2, _b;
18201
18272
  const base = useInputBase();
18202
18273
  return /* @__PURE__ */ jsxRuntime.jsx(
18203
18274
  "input",
@@ -18210,7 +18281,7 @@ function NumberField({ field, value, onChange, disabled, error }) {
18210
18281
  },
18211
18282
  placeholder: field.placeholder || "",
18212
18283
  disabled,
18213
- min: (_a = field.validation) == null ? void 0 : _a.min,
18284
+ min: (_a2 = field.validation) == null ? void 0 : _a2.min,
18214
18285
  max: (_b = field.validation) == null ? void 0 : _b.max,
18215
18286
  style: error ? __spreadValues(__spreadValues({}, base), INPUT_ERROR) : base
18216
18287
  }
@@ -18356,9 +18427,9 @@ function FileUploadField({ field, value, onChange, disabled, onFileUpload, error
18356
18427
  const [entries, setEntries] = React41.useState(() => {
18357
18428
  const arr = Array.isArray(value) ? value : value && typeof value === "object" ? [value] : [];
18358
18429
  return arr.map((item) => {
18359
- var _a, _b;
18430
+ var _a2, _b;
18360
18431
  const r = item;
18361
- return { key: keyRef.current += 1, name: (_b = (_a = r.filename) != null ? _a : r.name) != null ? _b : "file", size: r.size, status: "done", result: r };
18432
+ return { key: keyRef.current += 1, name: (_b = (_a2 = r.filename) != null ? _a2 : r.name) != null ? _b : "file", size: r.size, status: "done", result: r };
18362
18433
  });
18363
18434
  });
18364
18435
  const entriesRef = React41__default.default.useRef(entries);
@@ -18392,19 +18463,19 @@ function FileUploadField({ field, value, onChange, disabled, onFileUpload, error
18392
18463
  });
18393
18464
  };
18394
18465
  const handleInput = (e) => {
18395
- var _a;
18396
- addFiles(Array.from((_a = e.target.files) != null ? _a : []));
18466
+ var _a2;
18467
+ addFiles(Array.from((_a2 = e.target.files) != null ? _a2 : []));
18397
18468
  if (inputRef.current) inputRef.current.value = "";
18398
18469
  };
18399
18470
  const handleDrop = (e) => {
18400
- var _a;
18471
+ var _a2;
18401
18472
  e.preventDefault();
18402
18473
  setDragOver(false);
18403
- addFiles(Array.from((_a = e.dataTransfer.files) != null ? _a : []));
18474
+ addFiles(Array.from((_a2 = e.dataTransfer.files) != null ? _a2 : []));
18404
18475
  };
18405
18476
  const openPicker = () => {
18406
- var _a;
18407
- if (interactive) (_a = inputRef.current) == null ? void 0 : _a.click();
18477
+ var _a2;
18478
+ if (interactive) (_a2 = inputRef.current) == null ? void 0 : _a2.click();
18408
18479
  };
18409
18480
  const removeEntry = (key) => commit(entriesRef.current.filter((e) => e.key !== key));
18410
18481
  const borderColor = dragOver ? ACCENT2 : error ? "#dc2626" : BORDER4;
@@ -18481,107 +18552,614 @@ function FileUploadField({ field, value, onChange, disabled, onFileUpload, error
18481
18552
  })
18482
18553
  ] });
18483
18554
  }
18484
- var FIELD_REGISTRY = {
18485
- text: TextField,
18486
- textarea: TextAreaField,
18487
- number: NumberField,
18488
- select: SelectField,
18489
- multi_select: MultiSelectField,
18490
- date: DateField,
18491
- checkbox: CheckboxField,
18492
- file_upload: FileUploadField
18493
- };
18494
- function FieldRenderer({ field, value, onChange, disabled, error, onFileUpload, dense }) {
18495
- const { MUTED: MUTED2 } = useTheme();
18496
- const FieldComp = FIELD_REGISTRY[field.field_type] || FIELD_REGISTRY.text;
18497
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "3px" }, children: [
18498
- field.field_type !== "checkbox" && /* @__PURE__ */ jsxRuntime.jsxs("label", { style: { fontSize: "12px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "0.01em" }, children: [
18499
- field.label,
18500
- field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#dc2626", marginLeft: "2px" }, children: "*" })
18501
- ] }),
18502
- field.description && !dense && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "11px", color: MUTED2, lineHeight: 1.4 }, children: field.description }),
18503
- /* @__PURE__ */ jsxRuntime.jsx(FieldComp, { field, value, onChange, disabled, error, dense, onFileUpload: field.field_type === "file_upload" ? onFileUpload : void 0 }),
18504
- error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "11px", color: "#dc2626", fontWeight: 500, marginTop: "1px" }, children: error })
18555
+ function highlightMatch(label, q, accent) {
18556
+ const query = q.trim();
18557
+ if (!query) return label;
18558
+ const i = label.toLowerCase().indexOf(query.toLowerCase());
18559
+ if (i < 0) return label;
18560
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
18561
+ label.slice(0, i),
18562
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: 700, color: accent }, children: label.slice(i, i + query.length) }),
18563
+ label.slice(i + query.length)
18505
18564
  ] });
18506
18565
  }
18507
- var SlotErrorBoundary = class extends React41__default.default.Component {
18508
- constructor(props) {
18509
- super(props);
18510
- this.state = { hasError: false };
18511
- }
18512
- static getDerivedStateFromError() {
18513
- return { hasError: true };
18514
- }
18515
- render() {
18516
- if (this.state.hasError) return null;
18517
- return this.props.children;
18518
- }
18519
- };
18520
- function ContextSlot({ payload }) {
18521
- if (!payload || typeof payload.type !== "string") return null;
18522
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style: S2.slot, children: /* @__PURE__ */ jsxRuntime.jsx(SlotErrorBoundary, { children: resolveUI(payload) }) });
18523
- }
18524
- var S2 = {
18525
- slot: {
18526
- marginBottom: "8px",
18527
- borderRadius: "0.5rem",
18528
- overflow: "hidden"
18529
- }
18530
- };
18531
-
18532
- // src/builders/BuilderRecap.tsx
18533
- init_ThemeContext();
18534
- function BuilderRecap({ builder, state }) {
18535
- const t = useTheme();
18536
- const blocks = builder.blocks || [];
18537
- const display = (field, value) => {
18538
- if (value == null || value === "") return "";
18539
- const opt = (v) => {
18540
- var _a, _b, _c;
18541
- return (_c = (_b = (_a = field.options) == null ? void 0 : _a.find((o) => o.value === v)) == null ? void 0 : _b.label) != null ? _c : String(v);
18566
+ function EntityPickerField({ field, value, onChange, disabled, error, onEntitySearch, onEntityCreate }) {
18567
+ const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, PAPER: PAPER2 } = useTheme();
18568
+ const base = useInputBase();
18569
+ const source = field.source || "";
18570
+ const [open, setOpen] = React41.useState(false);
18571
+ const [query, setQuery] = React41.useState("");
18572
+ const [results, setResults] = React41.useState([]);
18573
+ const [loading, setLoading] = React41.useState(false);
18574
+ const [err, setErr] = React41.useState(null);
18575
+ const [hi, setHi] = React41.useState(0);
18576
+ const [selectedLabel, setSelectedLabel] = React41.useState(null);
18577
+ const [creating, setCreating] = React41.useState(false);
18578
+ const [createVals, setCreateVals] = React41.useState({});
18579
+ const [createBusy, setCreateBusy] = React41.useState(false);
18580
+ const boxRef = React41.useRef(null);
18581
+ const seq = React41.useRef(0);
18582
+ const allowCreate = !!field.allow_create && !!onEntityCreate;
18583
+ const createFields = React41.useMemo(
18584
+ () => field.create_fields && field.create_fields.length ? field.create_fields : [{ name: "name", label: "Name", field_type: "text", required: true, placeholder: "" }],
18585
+ [field.create_fields]
18586
+ );
18587
+ const runSearch = React41.useCallback(
18588
+ (q) => {
18589
+ if (!onEntitySearch || !source) return;
18590
+ const my = ++seq.current;
18591
+ setLoading(true);
18592
+ setErr(null);
18593
+ onEntitySearch(source, q).then((rows) => {
18594
+ if (my === seq.current) {
18595
+ setResults(rows || []);
18596
+ setHi(0);
18597
+ }
18598
+ }).catch(() => {
18599
+ if (my === seq.current) {
18600
+ setErr("Search failed \u2014 try again");
18601
+ setResults([]);
18602
+ }
18603
+ }).finally(() => {
18604
+ if (my === seq.current) setLoading(false);
18605
+ });
18606
+ },
18607
+ [onEntitySearch, source]
18608
+ );
18609
+ React41.useEffect(() => {
18610
+ if (!open || creating) return;
18611
+ const id = setTimeout(() => runSearch(query), 200);
18612
+ return () => clearTimeout(id);
18613
+ }, [open, creating, query, runSearch]);
18614
+ React41.useEffect(() => {
18615
+ if (!open) return;
18616
+ const onDoc = (e) => {
18617
+ if (boxRef.current && !boxRef.current.contains(e.target)) {
18618
+ setOpen(false);
18619
+ setCreating(false);
18620
+ }
18542
18621
  };
18543
- if (field.field_type === "multi_select" && Array.isArray(value)) return value.map(opt).join(", ");
18544
- if (field.field_type === "select") return opt(value);
18545
- if (field.field_type === "checkbox") return value ? "Yes" : "No";
18546
- if (field.field_type === "file_upload") {
18547
- const files = Array.isArray(value) ? value : [value];
18548
- return files.map((x) => x && typeof x === "object" ? x.filename || x.name || "file" : String(x)).join(", ");
18549
- }
18550
- return String(value);
18622
+ document.addEventListener("mousedown", onDoc);
18623
+ return () => document.removeEventListener("mousedown", onDoc);
18624
+ }, [open]);
18625
+ const openMenu = () => {
18626
+ if (disabled) return;
18627
+ setOpen(true);
18551
18628
  };
18552
- const decisionField = (b) => (b.fields || []).find((f) => f.field_type === "select") || (b.fields || [])[0];
18553
- const rows = React41.useMemo(
18554
- () => blocks.map((b) => {
18555
- const df = decisionField(b);
18556
- const decision = df ? display(df, state.getValue(b.id, df.name)) : "";
18557
- 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);
18558
- return { id: b.id, title: b.title, decision, extras };
18559
- }),
18560
- // eslint-disable-next-line react-hooks/exhaustive-deps
18561
- [blocks, state.values]
18562
- );
18563
- const counts = React41.useMemo(() => {
18564
- const m = /* @__PURE__ */ new Map();
18565
- for (const r of rows) {
18566
- const k = r.decision || "\u2014";
18567
- m.set(k, (m.get(k) || 0) + 1);
18629
+ const select = React41.useCallback((opt) => {
18630
+ onChange({ value: opt.value, label: opt.label });
18631
+ setSelectedLabel(opt.label);
18632
+ setQuery("");
18633
+ setOpen(false);
18634
+ setCreating(false);
18635
+ }, [onChange]);
18636
+ const nameField = createFields.find((f) => {
18637
+ var _a2;
18638
+ return ((_a2 = f.field_type) != null ? _a2 : "text") === "text";
18639
+ }) || createFields[0];
18640
+ const otherRequired = createFields.filter((f) => f !== nameField && f.required);
18641
+ const showCreateRow = allowCreate && !creating && query.trim().length > 0;
18642
+ const totalRows = results.length + (showCreateRow ? 1 : 0);
18643
+ const beginCreate = React41.useCallback(() => {
18644
+ const init = {};
18645
+ if (nameField && query.trim()) init[nameField.name] = query.trim();
18646
+ setCreateVals(init);
18647
+ setErr(null);
18648
+ setCreating(true);
18649
+ }, [nameField, query]);
18650
+ const submitCreate = React41.useCallback((vals) => {
18651
+ if (!onEntityCreate || !source) return;
18652
+ const payload = vals || createVals;
18653
+ for (const f of createFields) {
18654
+ if (f.required && (payload[f.name] == null || payload[f.name] === "")) {
18655
+ setErr(`${f.label} is required`);
18656
+ return;
18657
+ }
18568
18658
  }
18569
- return Array.from(m.entries());
18570
- }, [rows]);
18571
- const pill = (label) => {
18572
- const l = label.toLowerCase();
18573
- let fg = t.MUTED, bg = "#f2f2f2";
18574
- if (/accept|approve|confirm|keep|yes/.test(l)) {
18575
- fg = "#15803d";
18576
- bg = "#dcfce7";
18577
- } else if (/exclud|reject|remove|delete|deny|no\b/.test(l)) {
18578
- fg = "#dc2626";
18579
- bg = "#fef2f2";
18580
- } else if (/reclass|change|edit|modif|review|other/.test(l)) {
18581
- fg = t.SECONDARY;
18582
- bg = "#e8f0fe";
18659
+ setCreateBusy(true);
18660
+ setErr(null);
18661
+ onEntityCreate(source, payload).then((opt) => select(opt)).catch(() => setErr("Couldn't create \u2014 you may not have permission")).finally(() => setCreateBusy(false));
18662
+ }, [onEntityCreate, source, createFields, createVals, select]);
18663
+ const handleCreateRow = React41.useCallback(() => {
18664
+ const q = query.trim();
18665
+ if (!q || !nameField) return;
18666
+ if (otherRequired.length === 0) {
18667
+ submitCreate({ [nameField.name]: q });
18668
+ } else {
18669
+ beginCreate();
18670
+ }
18671
+ }, [query, nameField, otherRequired, submitCreate, beginCreate]);
18672
+ const onKeyDown = (e) => {
18673
+ if (creating) return;
18674
+ if (!open) {
18675
+ if (e.key === "ArrowDown" || e.key === "Enter") {
18676
+ openMenu();
18677
+ e.preventDefault();
18678
+ }
18679
+ return;
18680
+ }
18681
+ if (e.key === "ArrowDown") {
18682
+ setHi((h) => Math.min(h + 1, Math.max(totalRows - 1, 0)));
18683
+ e.preventDefault();
18684
+ } else if (e.key === "ArrowUp") {
18685
+ setHi((h) => Math.max(h - 1, 0));
18686
+ e.preventDefault();
18687
+ } else if (e.key === "Enter") {
18688
+ e.preventDefault();
18689
+ if (hi < results.length) select(results[hi]);
18690
+ else if (showCreateRow) handleCreateRow();
18691
+ } else if (e.key === "Escape") {
18692
+ setOpen(false);
18583
18693
  }
18584
- return { fg, bg };
18694
+ };
18695
+ const selectedObj = value && typeof value === "object" ? value : null;
18696
+ const displayValue = selectedObj ? selectedObj.label || selectedObj.value : value ? selectedLabel != null ? selectedLabel : String(value) : "";
18697
+ const inputStyle = error ? __spreadValues(__spreadValues({}, base), INPUT_ERROR) : base;
18698
+ const rowStyle = (active) => ({
18699
+ display: "flex",
18700
+ flexDirection: "column",
18701
+ gap: "1px",
18702
+ padding: "8px 11px",
18703
+ cursor: "pointer",
18704
+ boxSizing: "border-box",
18705
+ background: active ? `${ACCENT2}0d` : "white",
18706
+ borderLeft: `2px solid ${active ? ACCENT2 : "transparent"}`
18707
+ });
18708
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: boxRef, style: { position: "relative" }, children: [
18709
+ /* @__PURE__ */ jsxRuntime.jsx(
18710
+ "input",
18711
+ {
18712
+ type: "text",
18713
+ role: "combobox",
18714
+ "aria-expanded": open,
18715
+ "aria-autocomplete": "list",
18716
+ value: open ? query : displayValue,
18717
+ placeholder: field.placeholder || "Search\u2026",
18718
+ disabled,
18719
+ onFocus: openMenu,
18720
+ onChange: (e) => {
18721
+ setQuery(e.target.value);
18722
+ if (!open) setOpen(true);
18723
+ },
18724
+ onKeyDown,
18725
+ style: inputStyle
18726
+ }
18727
+ ),
18728
+ open && /* @__PURE__ */ jsxRuntime.jsx(
18729
+ "div",
18730
+ {
18731
+ role: "listbox",
18732
+ style: {
18733
+ position: "absolute",
18734
+ zIndex: 30,
18735
+ top: "calc(100% + 4px)",
18736
+ left: 0,
18737
+ right: 0,
18738
+ background: "white",
18739
+ border: `1px solid ${BORDER4}`,
18740
+ borderRadius: "0.625rem",
18741
+ boxShadow: "0 4px 16px rgba(0,0,0,0.10)",
18742
+ overflow: "hidden",
18743
+ maxHeight: "280px",
18744
+ overflowY: "auto"
18745
+ },
18746
+ children: creating ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "9px", padding: "12px" }, children: [
18747
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "12px", fontWeight: 600, color: "var(--foreground)" }, children: "Create new" }),
18748
+ createFields.map((f) => {
18749
+ var _a2, _b, _c, _d, _e;
18750
+ return /* @__PURE__ */ jsxRuntime.jsxs("label", { style: { display: "flex", flexDirection: "column", gap: "3px" }, children: [
18751
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "11.5px", fontWeight: 600, color: "var(--foreground)" }, children: [
18752
+ f.label,
18753
+ f.required && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#dc2626", marginLeft: "2px" }, children: "*" })
18754
+ ] }),
18755
+ ((_a2 = f.field_type) != null ? _a2 : "text") === "textarea" ? /* @__PURE__ */ jsxRuntime.jsx(
18756
+ "textarea",
18757
+ {
18758
+ value: (_b = createVals[f.name]) != null ? _b : "",
18759
+ placeholder: f.placeholder || "",
18760
+ onChange: (e) => setCreateVals((p) => __spreadProps(__spreadValues({}, p), { [f.name]: e.target.value })),
18761
+ rows: 3,
18762
+ style: __spreadProps(__spreadValues({}, base), { resize: "vertical" })
18763
+ }
18764
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
18765
+ "input",
18766
+ {
18767
+ type: ((_c = f.field_type) != null ? _c : "text") === "number" ? "number" : ((_d = f.field_type) != null ? _d : "text") === "date" ? "date" : "text",
18768
+ value: (_e = createVals[f.name]) != null ? _e : "",
18769
+ placeholder: f.placeholder || "",
18770
+ onChange: (e) => setCreateVals((p) => __spreadProps(__spreadValues({}, p), { [f.name]: e.target.value })),
18771
+ style: base
18772
+ }
18773
+ )
18774
+ ] }, f.name);
18775
+ }),
18776
+ err && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "11px", color: "#dc2626", fontWeight: 500 }, children: err }),
18777
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
18778
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: () => {
18779
+ setCreating(false);
18780
+ setErr(null);
18781
+ }, style: { font: "inherit", fontSize: "12px", fontWeight: 600, color: MUTED2, background: "transparent", border: `1px solid ${BORDER4}`, borderRadius: "9999px", padding: "5px 13px", cursor: "pointer" }, children: "Cancel" }),
18782
+ /* @__PURE__ */ jsxRuntime.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" })
18783
+ ] })
18784
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
18785
+ loading && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "10px 11px", fontSize: "12px", color: MUTED2, display: "flex", alignItems: "center", gap: "8px" }, children: [
18786
+ /* @__PURE__ */ jsxRuntime.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" }),
18787
+ "Searching\u2026"
18788
+ ] }),
18789
+ !loading && err && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "10px 11px", fontSize: "12px", color: "#dc2626" }, children: err }),
18790
+ !loading && !err && results.length === 0 && !showCreateRow && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "10px 11px", fontSize: "12px", color: MUTED2 }, children: [
18791
+ "No matches",
18792
+ query ? ` for \u201C${query}\u201D` : "",
18793
+ "."
18794
+ ] }),
18795
+ !loading && results.map((opt, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
18796
+ "div",
18797
+ {
18798
+ role: "option",
18799
+ "aria-selected": hi === idx,
18800
+ onMouseEnter: () => setHi(idx),
18801
+ onMouseDown: (e) => {
18802
+ e.preventDefault();
18803
+ select(opt);
18804
+ },
18805
+ style: rowStyle(hi === idx),
18806
+ children: [
18807
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "13px", color: "var(--foreground)" }, children: highlightMatch(opt.label, query, ACCENT2) }),
18808
+ (opt.description || opt.meta) && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "11px", color: MUTED2, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: [opt.description, opt.meta].filter(Boolean).join(" \xB7 ") })
18809
+ ]
18810
+ },
18811
+ opt.value
18812
+ )),
18813
+ showCreateRow && /* @__PURE__ */ jsxRuntime.jsxs(
18814
+ "div",
18815
+ {
18816
+ role: "option",
18817
+ "aria-selected": hi === results.length,
18818
+ onMouseEnter: () => setHi(results.length),
18819
+ onMouseDown: (e) => {
18820
+ e.preventDefault();
18821
+ handleCreateRow();
18822
+ },
18823
+ 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" }),
18824
+ children: [
18825
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "15px", lineHeight: 1, color: ACCENT2, fontWeight: 700 }, children: "\uFF0B" }),
18826
+ /* @__PURE__ */ jsxRuntime.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$/, "")}` })
18827
+ ]
18828
+ }
18829
+ )
18830
+ ] })
18831
+ }
18832
+ )
18833
+ ] });
18834
+ }
18835
+ var _FILEMAP_UNASSIGNED = "unassigned";
18836
+ var _CONF_COLOR = { HIGH: "#15803d", MEDIUM: "#92400e", LOW: "#777777" };
18837
+ function _fileExt(path, type) {
18838
+ if (type) return String(type).toLowerCase();
18839
+ const base = (path || "").split("/").pop() || "";
18840
+ return base.includes(".") ? (base.split(".").pop() || "").toLowerCase() : "";
18841
+ }
18842
+ function FileMapField({ field, value, onChange, disabled }) {
18843
+ const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, PAPER: PAPER2 } = useTheme();
18844
+ const cfg = field.file_map || null;
18845
+ const categories = React41.useMemo(() => (cfg == null ? void 0 : cfg.categories) || [], [cfg]);
18846
+ const fileList = React41.useMemo(() => (cfg == null ? void 0 : cfg.files) || [], [cfg]);
18847
+ const suggestions = (cfg == null ? void 0 : cfg.suggestions) || {};
18848
+ const confidence = (cfg == null ? void 0 : cfg.confidence) || {};
18849
+ const initial = React41.useMemo(() => {
18850
+ const a = {};
18851
+ if (value && typeof value === "object" && !Array.isArray(value)) {
18852
+ for (const [grp, paths] of Object.entries(value))
18853
+ for (const p of paths || []) a[p] = grp;
18854
+ } else {
18855
+ for (const [cid, paths] of Object.entries(suggestions))
18856
+ for (const p of paths || []) a[p] = cid;
18857
+ }
18858
+ for (const f of fileList) if (!(f.path in a)) a[f.path] = _FILEMAP_UNASSIGNED;
18859
+ return a;
18860
+ }, []);
18861
+ const [assignment, setAssignment] = React41.useState(initial);
18862
+ const [collapsed, setCollapsed] = React41.useState({});
18863
+ const [menuFor, setMenuFor] = React41.useState(null);
18864
+ const boardRef = React41.useRef(null);
18865
+ const fileByPath = React41.useMemo(
18866
+ () => Object.fromEntries(fileList.map((f) => [f.path, f])),
18867
+ [fileList]
18868
+ );
18869
+ const groupFrom = React41.useCallback((a) => {
18870
+ const g = { [_FILEMAP_UNASSIGNED]: [] };
18871
+ for (const c of categories) g[c.id] = [];
18872
+ for (const f of fileList) {
18873
+ const grp = a[f.path] || _FILEMAP_UNASSIGNED;
18874
+ if (!g[grp]) g[grp] = [];
18875
+ g[grp].push(f.path);
18876
+ }
18877
+ return g;
18878
+ }, [categories, fileList]);
18879
+ const grouped = React41.useMemo(() => groupFrom(assignment), [assignment, groupFrom]);
18880
+ const emit = React41.useCallback((g) => onChange(g), [onChange]);
18881
+ const emittedRef = React41.useRef(false);
18882
+ React41.useEffect(() => {
18883
+ if (!emittedRef.current) {
18884
+ emittedRef.current = true;
18885
+ emit(grouped);
18886
+ }
18887
+ }, [grouped, emit]);
18888
+ React41.useEffect(() => {
18889
+ if (!menuFor) return;
18890
+ const onDoc = (e) => {
18891
+ if (boardRef.current && !boardRef.current.contains(e.target)) setMenuFor(null);
18892
+ };
18893
+ document.addEventListener("mousedown", onDoc);
18894
+ return () => document.removeEventListener("mousedown", onDoc);
18895
+ }, [menuFor]);
18896
+ const move = React41.useCallback((path, grp) => {
18897
+ setMenuFor(null);
18898
+ setAssignment((prev) => {
18899
+ const next = __spreadProps(__spreadValues({}, prev), { [path]: grp });
18900
+ emit(groupFrom(next));
18901
+ return next;
18902
+ });
18903
+ }, [emit, groupFrom]);
18904
+ const labelOf = (gid) => {
18905
+ var _a2;
18906
+ return gid === _FILEMAP_UNASSIGNED ? "Unassigned" : ((_a2 = categories.find((c) => c.id === gid)) == null ? void 0 : _a2.label) || gid;
18907
+ };
18908
+ const hintOf = (gid) => {
18909
+ var _a2;
18910
+ return gid === _FILEMAP_UNASSIGNED ? null : ((_a2 = categories.find((c) => c.id === gid)) == null ? void 0 : _a2.hint) || null;
18911
+ };
18912
+ const orderedGroups = [_FILEMAP_UNASSIGNED, ...categories.map((c) => c.id)];
18913
+ if (!cfg || categories.length === 0) {
18914
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "12px", color: MUTED2 }, children: "No file-map configuration." });
18915
+ }
18916
+ const total = fileList.length;
18917
+ const assigned = fileList.filter((f) => (assignment[f.path] || _FILEMAP_UNASSIGNED) !== _FILEMAP_UNASSIGNED).length;
18918
+ const pct = total ? Math.round(assigned / total * 100) : 0;
18919
+ const cards = () => orderedGroups.map((gid) => {
18920
+ const paths = grouped[gid] || [];
18921
+ if (gid === _FILEMAP_UNASSIGNED && paths.length === 0) return null;
18922
+ const isCollapsed = !!collapsed[gid];
18923
+ const hint = hintOf(gid);
18924
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { border: `1px solid ${BORDER4}`, borderRadius: "0.75rem", overflow: "visible", background: "white" }, children: [
18925
+ /* @__PURE__ */ jsxRuntime.jsxs(
18926
+ "button",
18927
+ {
18928
+ type: "button",
18929
+ onClick: () => setCollapsed((c) => __spreadProps(__spreadValues({}, c), { [gid]: !c[gid] })),
18930
+ 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 },
18931
+ children: [
18932
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { transition: "transform 0.15s", transform: isCollapsed ? "rotate(-90deg)" : "none", color: MUTED2, fontSize: "10px", flexShrink: 0 }, children: "\u25BE" }),
18933
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "12px", fontWeight: 600, color: gid === _FILEMAP_UNASSIGNED ? MUTED2 : "var(--foreground)", flexShrink: 0 }, children: labelOf(gid) }),
18934
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "11px", color: MUTED2, fontVariantNumeric: "tabular-nums", flexShrink: 0 }, children: [
18935
+ "(",
18936
+ paths.length,
18937
+ ")"
18938
+ ] }),
18939
+ hint && !isCollapsed && /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "11px", color: MUTED2, marginLeft: "2px", minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: [
18940
+ "\xB7 ",
18941
+ hint
18942
+ ] })
18943
+ ]
18944
+ }
18945
+ ),
18946
+ !isCollapsed && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column" }, children: paths.length === 0 ? /* @__PURE__ */ jsxRuntime.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) => {
18947
+ const f = fileByPath[p] || { name: p };
18948
+ const ext = _fileExt(p, f.type);
18949
+ const conf = confidence[p];
18950
+ const open = menuFor === p;
18951
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "9px", padding: "8px 11px", borderTop: `1px solid ${BORDER4}`, animation: "agFmFade 0.15s ease", minWidth: 0 }, children: [
18952
+ ext && /* @__PURE__ */ jsxRuntime.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 }),
18953
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "12.5px", color: "var(--foreground)", flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: f.name || p }),
18954
+ f.size && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "11px", color: MUTED2, flexShrink: 0 }, children: f.size }),
18955
+ conf && /* @__PURE__ */ jsxRuntime.jsx("span", { title: `${conf} confidence`, "aria-label": `${conf} confidence`, style: { width: "8px", height: "8px", borderRadius: "50%", background: _CONF_COLOR[conf] || MUTED2, flexShrink: 0 } }),
18956
+ !disabled && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative", flexShrink: 0 }, children: [
18957
+ /* @__PURE__ */ jsxRuntime.jsxs(
18958
+ "button",
18959
+ {
18960
+ type: "button",
18961
+ onMouseDown: (e) => {
18962
+ e.preventDefault();
18963
+ setMenuFor(open ? null : p);
18964
+ },
18965
+ style: { font: "inherit", fontSize: "11px", fontWeight: 600, color: ACCENT2, background: "transparent", border: `1px solid ${BORDER4}`, borderRadius: "9999px", padding: "3px 9px", cursor: "pointer" },
18966
+ children: [
18967
+ gid === _FILEMAP_UNASSIGNED ? "Assign" : "Move",
18968
+ " \u25BE"
18969
+ ]
18970
+ }
18971
+ ),
18972
+ open && /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(
18973
+ "button",
18974
+ {
18975
+ type: "button",
18976
+ onMouseDown: (e) => {
18977
+ e.preventDefault();
18978
+ move(p, t);
18979
+ },
18980
+ 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" },
18981
+ children: labelOf(t)
18982
+ },
18983
+ t
18984
+ )) })
18985
+ ] })
18986
+ ] }, p);
18987
+ }) })
18988
+ ] }, gid);
18989
+ });
18990
+ const progressBar = /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, height: "4px", borderRadius: "9999px", background: PAPER2, overflow: "hidden", border: `1px solid ${BORDER4}`, minWidth: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: `${pct}%`, height: "100%", background: ACCENT2, borderRadius: "9999px", transition: "width 0.25s" } }) });
18991
+ const countLabel = /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "11px", fontWeight: 600, color: MUTED2, textTransform: "uppercase", letterSpacing: "0.04em", whiteSpace: "nowrap", fontVariantNumeric: "tabular-nums" }, children: [
18992
+ assigned,
18993
+ " of ",
18994
+ total,
18995
+ " mapped"
18996
+ ] });
18997
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: boardRef, style: { width: "100%", maxWidth: "100%", boxSizing: "border-box", display: "flex", flexDirection: "column", gap: "8px" }, children: [
18998
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: "@keyframes agFmFade{from{opacity:0;transform:translateY(2px)}to{opacity:1;transform:none}}" }),
18999
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
19000
+ countLabel,
19001
+ progressBar
19002
+ ] }),
19003
+ cards()
19004
+ ] });
19005
+ }
19006
+ var FIELD_REGISTRY = {
19007
+ text: TextField,
19008
+ textarea: TextAreaField,
19009
+ number: NumberField,
19010
+ select: SelectField,
19011
+ multi_select: MultiSelectField,
19012
+ date: DateField,
19013
+ checkbox: CheckboxField,
19014
+ file_upload: FileUploadField,
19015
+ entity_picker: EntityPickerField,
19016
+ file_map: FileMapField
19017
+ };
19018
+ function FieldRenderer({ field, value, onChange, disabled, error, onFileUpload, onEntitySearch, onEntityCreate, dense }) {
19019
+ const { MUTED: MUTED2 } = useTheme();
19020
+ const FieldComp = FIELD_REGISTRY[field.field_type] || FIELD_REGISTRY.text;
19021
+ const isEntity = field.field_type === "entity_picker";
19022
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "3px" }, children: [
19023
+ field.field_type !== "checkbox" && /* @__PURE__ */ jsxRuntime.jsxs("label", { style: { fontSize: "12px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "0.01em" }, children: [
19024
+ field.label,
19025
+ field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#dc2626", marginLeft: "2px" }, children: "*" })
19026
+ ] }),
19027
+ field.description && !dense && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "11px", color: MUTED2, lineHeight: 1.4 }, children: field.description }),
19028
+ /* @__PURE__ */ jsxRuntime.jsx(
19029
+ FieldComp,
19030
+ {
19031
+ field,
19032
+ value,
19033
+ onChange,
19034
+ disabled,
19035
+ error,
19036
+ dense,
19037
+ onFileUpload: field.field_type === "file_upload" ? onFileUpload : void 0,
19038
+ onEntitySearch: isEntity ? onEntitySearch : void 0,
19039
+ onEntityCreate: isEntity ? onEntityCreate : void 0
19040
+ }
19041
+ ),
19042
+ error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "11px", color: "#dc2626", fontWeight: 500, marginTop: "1px" }, children: error })
19043
+ ] });
19044
+ }
19045
+ init_ThemeContext();
19046
+ var SlotErrorBoundary = class extends React41__default.default.Component {
19047
+ constructor(props) {
19048
+ super(props);
19049
+ this.state = { hasError: false };
19050
+ }
19051
+ static getDerivedStateFromError() {
19052
+ return { hasError: true };
19053
+ }
19054
+ render() {
19055
+ if (this.state.hasError) return this.props.fallback;
19056
+ return this.props.children;
19057
+ }
19058
+ };
19059
+ function ContextRender({ payload }) {
19060
+ return resolveUI(payload);
19061
+ }
19062
+ var _a;
19063
+ var _isDev = typeof process !== "undefined" && ((_a = process.env) == null ? void 0 : _a.NODE_ENV) !== "production";
19064
+ function ContextSlot({ payload }) {
19065
+ const { MUTED: MUTED2, BORDER: BORDER4, PAPER: PAPER2 } = useTheme();
19066
+ if (!payload || typeof payload.type !== "string") return null;
19067
+ const note = (msg) => /* @__PURE__ */ jsxRuntime.jsx("div", { style: __spreadProps(__spreadValues({}, S2.slot), { border: `1px solid ${BORDER4}`, background: PAPER2, padding: "8px 11px", fontSize: "12px", color: MUTED2 }), children: msg });
19068
+ const result = validatePayload(payload.type, payload);
19069
+ const safePayload = result.success ? result.data : payload;
19070
+ if (!result.success && _isDev) {
19071
+ console.warn(`[ContextSlot] invalid embedded "${payload.type}" payload:`, result.error);
19072
+ }
19073
+ const fallback = note(
19074
+ _isDev ? `Couldn't render embedded ${payload.type}: ${result.success ? "render error" : result.error}` : `Couldn't render embedded ${payload.type}.`
19075
+ );
19076
+ if (!result.success) return fallback;
19077
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: S2.slot, children: /* @__PURE__ */ jsxRuntime.jsx(SlotErrorBoundary, { fallback, children: /* @__PURE__ */ jsxRuntime.jsx(ContextRender, { payload: safePayload }) }) });
19078
+ }
19079
+ var S2 = {
19080
+ slot: {
19081
+ marginBottom: "8px",
19082
+ borderRadius: "0.5rem",
19083
+ overflow: "hidden"
19084
+ }
19085
+ };
19086
+
19087
+ // src/builders/BuilderRecap.tsx
19088
+ init_ThemeContext();
19089
+ function BuilderRecap({ builder, state }) {
19090
+ const t = useTheme();
19091
+ const blocks = builder.blocks || [];
19092
+ const display = (field, value) => {
19093
+ if (value == null || value === "") return "";
19094
+ const opt = (v) => {
19095
+ var _a2, _b, _c;
19096
+ return (_c = (_b = (_a2 = field.options) == null ? void 0 : _a2.find((o) => o.value === v)) == null ? void 0 : _b.label) != null ? _c : String(v);
19097
+ };
19098
+ if (field.field_type === "multi_select" && Array.isArray(value)) return value.map(opt).join(", ");
19099
+ if (field.field_type === "select") return opt(value);
19100
+ if (field.field_type === "checkbox") return value ? "Yes" : "No";
19101
+ if (field.field_type === "entity_picker") {
19102
+ if (value && typeof value === "object") {
19103
+ const o = value;
19104
+ return o.label || o.value || "";
19105
+ }
19106
+ return String(value);
19107
+ }
19108
+ if (field.field_type === "file_upload") {
19109
+ const files = Array.isArray(value) ? value : [value];
19110
+ return files.map((x) => x && typeof x === "object" ? x.filename || x.name || "file" : String(x)).join(", ");
19111
+ }
19112
+ if (field.field_type === "file_map") {
19113
+ if (value && typeof value === "object" && !Array.isArray(value)) {
19114
+ let files = 0, roles = 0, unassigned = 0;
19115
+ for (const [g, paths] of Object.entries(value)) {
19116
+ const n = Array.isArray(paths) ? paths.length : 0;
19117
+ if (g === "unassigned") unassigned += n;
19118
+ else {
19119
+ files += n;
19120
+ if (n > 0) roles += 1;
19121
+ }
19122
+ }
19123
+ const tot = files + unassigned;
19124
+ return `${tot} file${tot !== 1 ? "s" : ""} \xB7 ${roles} role${roles !== 1 ? "s" : ""}${unassigned ? ` (${unassigned} unassigned)` : ""}`;
19125
+ }
19126
+ return String(value);
19127
+ }
19128
+ return String(value);
19129
+ };
19130
+ const decisionField = (b) => (b.fields || []).find((f) => f.field_type === "select") || (b.fields || [])[0];
19131
+ const rows = React41.useMemo(
19132
+ () => blocks.map((b) => {
19133
+ const df = decisionField(b);
19134
+ const decision = df ? display(df, state.getValue(b.id, df.name)) : "";
19135
+ 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);
19136
+ return { id: b.id, title: b.title, decision, extras };
19137
+ }),
19138
+ // eslint-disable-next-line react-hooks/exhaustive-deps
19139
+ [blocks, state.values]
19140
+ );
19141
+ const counts = React41.useMemo(() => {
19142
+ const m = /* @__PURE__ */ new Map();
19143
+ for (const r of rows) {
19144
+ const k = r.decision || "\u2014";
19145
+ m.set(k, (m.get(k) || 0) + 1);
19146
+ }
19147
+ return Array.from(m.entries());
19148
+ }, [rows]);
19149
+ const pill = (label) => {
19150
+ const l = label.toLowerCase();
19151
+ let fg = t.MUTED, bg = "#f2f2f2";
19152
+ if (/accept|approve|confirm|keep|yes/.test(l)) {
19153
+ fg = "#15803d";
19154
+ bg = "#dcfce7";
19155
+ } else if (/exclud|reject|remove|delete|deny|no\b/.test(l)) {
19156
+ fg = "#dc2626";
19157
+ bg = "#fef2f2";
19158
+ } else if (/reclass|change|edit|modif|review|other/.test(l)) {
19159
+ fg = t.SECONDARY;
19160
+ bg = "#e8f0fe";
19161
+ }
19162
+ return { fg, bg };
18585
19163
  };
18586
19164
  const total = rows.length;
18587
19165
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: S3(t).card, children: [
@@ -18683,21 +19261,173 @@ function S3(t) {
18683
19261
  }
18684
19262
  };
18685
19263
  }
18686
- function FormBuilder({ builder, state, onSubmit, onCancel, disabled, onFileUpload, dense, hideActions }) {
18687
- var _a;
19264
+ function fieldKey(blockId, name) {
19265
+ return `${blockId}\0${name}`;
19266
+ }
19267
+ function isRequiredMissing(fieldType, v) {
19268
+ if (fieldType === "checkbox") return v !== true;
19269
+ if (fieldType === "file_map") {
19270
+ if (!v || typeof v !== "object" || Array.isArray(v)) return true;
19271
+ return !Object.entries(v).some(
19272
+ ([g, paths]) => g !== "unassigned" && Array.isArray(paths) && paths.length > 0
19273
+ );
19274
+ }
19275
+ return v == null || v === "" || Array.isArray(v) && v.length === 0;
19276
+ }
19277
+ function useBuilderState(blocks) {
19278
+ const isMultiBlock = blocks.length > 1;
19279
+ const [values, setValues] = React41.useState(() => {
19280
+ const init = {};
19281
+ for (const block of blocks) {
19282
+ for (const field of block.fields || []) {
19283
+ if (field.default_value != null) init[fieldKey(block.id, field.name)] = field.default_value;
19284
+ }
19285
+ }
19286
+ return init;
19287
+ });
19288
+ const [errors, setErrors] = React41.useState({});
19289
+ const [currentBlock, setCurrentBlock] = React41.useState(0);
19290
+ const getValue = React41.useCallback(
19291
+ (blockId, name) => values[fieldKey(blockId, name)],
19292
+ [values]
19293
+ );
19294
+ const getError = React41.useCallback(
19295
+ (blockId, name) => errors[fieldKey(blockId, name)],
19296
+ [errors]
19297
+ );
19298
+ const setFieldValue = React41.useCallback((blockId, name, value) => {
19299
+ const k = fieldKey(blockId, name);
19300
+ setValues((prev) => __spreadProps(__spreadValues({}, prev), { [k]: value }));
19301
+ setErrors((prev) => {
19302
+ if (!prev[k]) return prev;
19303
+ const next = __spreadValues({}, prev);
19304
+ delete next[k];
19305
+ return next;
19306
+ });
19307
+ }, []);
19308
+ const validateBlock = React41.useCallback(
19309
+ (blockIdx) => {
19310
+ const block = blocks[blockIdx];
19311
+ if (!block) return true;
19312
+ const newErrors = {};
19313
+ for (const field of block.fields || []) {
19314
+ const k = fieldKey(block.id, field.name);
19315
+ const v = values[k];
19316
+ if (field.required) {
19317
+ if (isRequiredMissing(field.field_type, v)) {
19318
+ newErrors[k] = "Required";
19319
+ continue;
19320
+ }
19321
+ }
19322
+ if (v == null || v === "") continue;
19323
+ const val = field.validation;
19324
+ if (!val) continue;
19325
+ if (val.min_length && typeof v === "string" && v.length < val.min_length) {
19326
+ newErrors[k] = `Min ${val.min_length} characters`;
19327
+ } else if (val.max_length && typeof v === "string" && v.length > val.max_length) {
19328
+ newErrors[k] = `Max ${val.max_length} characters`;
19329
+ } else if (val.min != null && typeof v === "number" && v < val.min) {
19330
+ newErrors[k] = `Min ${val.min}`;
19331
+ } else if (val.max != null && typeof v === "number" && v > val.max) {
19332
+ newErrors[k] = `Max ${val.max}`;
19333
+ } else if (val.pattern && typeof v === "string" && !new RegExp(val.pattern).test(v)) {
19334
+ newErrors[k] = "Invalid format";
19335
+ }
19336
+ }
19337
+ setErrors((prev) => __spreadValues(__spreadValues({}, prev), newErrors));
19338
+ return Object.keys(newErrors).length === 0;
19339
+ },
19340
+ [blocks, values]
19341
+ );
19342
+ const validateAllDetailed = React41.useCallback(() => {
19343
+ let firstBlockIndex = -1;
19344
+ let firstKey = null;
19345
+ let firstBlockId = null;
19346
+ let firstName = null;
19347
+ const failingKeys = [];
19348
+ const allErrors = {};
19349
+ for (let i = 0; i < blocks.length; i++) {
19350
+ const block = blocks[i];
19351
+ for (const field of block.fields || []) {
19352
+ const k = fieldKey(block.id, field.name);
19353
+ const v = values[k];
19354
+ if (field.required && isRequiredMissing(field.field_type, v)) {
19355
+ allErrors[k] = "Required";
19356
+ failingKeys.push(k);
19357
+ if (firstBlockIndex < 0) {
19358
+ firstBlockIndex = i;
19359
+ firstKey = k;
19360
+ firstBlockId = block.id;
19361
+ firstName = field.name;
19362
+ }
19363
+ }
19364
+ }
19365
+ }
19366
+ setErrors(allErrors);
19367
+ if (firstBlockIndex >= 0) setCurrentBlock(firstBlockIndex);
19368
+ return { firstKey, firstBlockId, firstName, firstBlockIndex, failingKeys };
19369
+ }, [blocks, values]);
19370
+ const validateAll = React41.useCallback(
19371
+ () => validateAllDetailed().failingKeys.length === 0,
19372
+ [validateAllDetailed]
19373
+ );
19374
+ return {
19375
+ values,
19376
+ errors,
19377
+ getValue,
19378
+ getError,
19379
+ setFieldValue,
19380
+ validateBlock,
19381
+ validateAll,
19382
+ validateAllDetailed,
19383
+ currentBlock,
19384
+ setCurrentBlock,
19385
+ isMultiBlock
19386
+ };
19387
+ }
19388
+ function BlockForm({
19389
+ builder,
19390
+ state,
19391
+ onSubmit,
19392
+ onCancel,
19393
+ disabled,
19394
+ onFileUpload,
19395
+ onEntitySearch,
19396
+ onEntityCreate,
19397
+ hideActions,
19398
+ dense,
19399
+ variant = "form"
19400
+ }) {
19401
+ var _a2;
18688
19402
  const t = useTheme();
18689
19403
  const S4 = React41.useMemo(() => makeStyles(t), [t]);
18690
19404
  const block = builder.blocks[0];
19405
+ const isEscalation = variant === "escalation";
19406
+ const errorCount = ((block == null ? void 0 : block.fields) || []).reduce(
19407
+ (n, f) => state.getError(block.id, f.name) ? n + 1 : n,
19408
+ 0
19409
+ );
18691
19410
  if (!block) return null;
18692
19411
  if (disabled) return /* @__PURE__ */ jsxRuntime.jsx(BuilderRecap, { builder, state });
18693
- const containerStyle = dense ? { display: "flex", flexDirection: "column", gap: "12px" } : S4.card;
19412
+ const containerStyle = dense ? { display: "flex", flexDirection: "column", gap: isEscalation ? "10px" : "12px" } : isEscalation ? S4.escalationCard : S4.formCard;
18694
19413
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: containerStyle, children: [
18695
- dense ? builder.description && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontSize: "12px", color: t.MUTED, lineHeight: 1.45, margin: 0 }, children: builder.description }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
19414
+ !isEscalation && !dense ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
18696
19415
  /* @__PURE__ */ jsxRuntime.jsx("p", { style: S4.title, children: builder.title }),
18697
19416
  builder.description && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontSize: "12px", color: t.MUTED, lineHeight: 1.45, margin: 0 }, children: builder.description })
18698
- ] }),
18699
- ((_a = block.context) == null ? void 0 : _a.type) && /* @__PURE__ */ jsxRuntime.jsx(ContextSlot, { payload: block.context }),
18700
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: dense ? "8px" : "12px" }, children: (block.fields || []).map((field) => /* @__PURE__ */ jsxRuntime.jsx(
19417
+ ] }) : builder.description && /* @__PURE__ */ jsxRuntime.jsx(
19418
+ "p",
19419
+ {
19420
+ style: {
19421
+ fontSize: isEscalation && !dense ? "13px" : "12px",
19422
+ color: isEscalation && !dense ? "var(--foreground)" : t.MUTED,
19423
+ lineHeight: 1.45,
19424
+ margin: 0
19425
+ },
19426
+ children: builder.description
19427
+ }
19428
+ ),
19429
+ ((_a2 = block.context) == null ? void 0 : _a2.type) && /* @__PURE__ */ jsxRuntime.jsx(ContextSlot, { payload: block.context }),
19430
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: dense ? "8px" : isEscalation ? "10px" : "12px" }, children: (block.fields || []).map((field) => /* @__PURE__ */ jsxRuntime.jsx("div", { "data-field-key": fieldKey(block.id, field.name), children: /* @__PURE__ */ jsxRuntime.jsx(
18701
19431
  FieldRenderer,
18702
19432
  {
18703
19433
  field,
@@ -18706,20 +19436,45 @@ function FormBuilder({ builder, state, onSubmit, onCancel, disabled, onFileUploa
18706
19436
  disabled,
18707
19437
  error: state.getError(block.id, field.name),
18708
19438
  dense,
18709
- onFileUpload
18710
- },
18711
- `${block.id}:${field.name}`
18712
- )) }),
18713
- hideActions ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", paddingTop: "4px" }, children: [
18714
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1 } }),
18715
- onCancel && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onCancel, style: S4.cancelBtn, children: builder.cancel_label || "Cancel" }),
18716
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onSubmit, style: S4.submitBtn, children: builder.submit_label || "Submit" })
19439
+ onFileUpload,
19440
+ onEntitySearch,
19441
+ onEntityCreate
19442
+ }
19443
+ ) }, `${block.id}:${field.name}`)) }),
19444
+ hideActions ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "6px", paddingTop: isEscalation ? "2px" : "4px" }, children: [
19445
+ errorCount > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { fontSize: "11px", fontWeight: 600, color: "#dc2626" }, children: [
19446
+ errorCount,
19447
+ " required field",
19448
+ errorCount === 1 ? "" : "s",
19449
+ " need",
19450
+ errorCount === 1 ? "s" : "",
19451
+ " attention"
19452
+ ] }) : null,
19453
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
19454
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1 } }),
19455
+ onCancel ? /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onCancel, style: S4.cancelBtn, children: builder.cancel_label || "Cancel" }) : null,
19456
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onSubmit, style: isEscalation ? S4.continueBtn : S4.submitBtn, children: builder.submit_label || (isEscalation ? "Continue" : "Submit") })
19457
+ ] })
18717
19458
  ] })
18718
19459
  ] });
18719
19460
  }
18720
19461
  function makeStyles(t) {
18721
19462
  return {
18722
- card: {
19463
+ // Escalation: accent left-rail card (attention).
19464
+ escalationCard: {
19465
+ display: "flex",
19466
+ flexDirection: "column",
19467
+ gap: "10px",
19468
+ padding: "12px 14px",
19469
+ borderRadius: "0.75rem",
19470
+ borderTop: `1px solid ${t.BORDER}`,
19471
+ borderRight: `1px solid ${t.BORDER}`,
19472
+ borderBottom: `1px solid ${t.BORDER}`,
19473
+ borderLeft: `2px solid ${t.ACCENT}`,
19474
+ background: "white"
19475
+ },
19476
+ // Form: standard bordered card with a soft shadow.
19477
+ formCard: {
18723
19478
  display: "flex",
18724
19479
  flexDirection: "column",
18725
19480
  gap: "14px",
@@ -18729,11 +19484,6 @@ function makeStyles(t) {
18729
19484
  background: "white",
18730
19485
  boxShadow: "0 1px 2px rgba(0,0,0,0.03), 0 4px 12px rgba(0,0,0,0.04)"
18731
19486
  },
18732
- inert: {
18733
- opacity: 0.55,
18734
- pointerEvents: "none",
18735
- userSelect: "none"
18736
- },
18737
19487
  title: {
18738
19488
  fontFamily: "var(--font-serif)",
18739
19489
  fontSize: "15px",
@@ -18742,6 +19492,23 @@ function makeStyles(t) {
18742
19492
  letterSpacing: "-0.01em",
18743
19493
  margin: 0
18744
19494
  },
19495
+ // Escalation CTA: outlined accent pill.
19496
+ continueBtn: {
19497
+ font: "inherit",
19498
+ fontSize: "12px",
19499
+ fontWeight: 600,
19500
+ color: t.ACCENT,
19501
+ background: "transparent",
19502
+ borderTop: `1px solid ${t.ACCENT}`,
19503
+ borderRight: `1px solid ${t.ACCENT}`,
19504
+ borderBottom: `1px solid ${t.ACCENT}`,
19505
+ borderLeft: `1px solid ${t.ACCENT}`,
19506
+ borderRadius: "9999px",
19507
+ padding: "6px 14px",
19508
+ cursor: "pointer",
19509
+ transition: "all 0.15s"
19510
+ },
19511
+ // Form CTA: filled accent pill.
18745
19512
  submitBtn: {
18746
19513
  font: "inherit",
18747
19514
  fontSize: "12px",
@@ -18771,8 +19538,8 @@ function makeStyles(t) {
18771
19538
 
18772
19539
  // src/builders/StepperBuilder.tsx
18773
19540
  init_ThemeContext();
18774
- function StepperBuilder({ builder, state, onSubmit, onCancel, disabled, onFileUpload, dense }) {
18775
- var _a;
19541
+ function StepperBuilder({ builder, state, onSubmit, onCancel, disabled, onFileUpload, onEntitySearch, onEntityCreate, dense }) {
19542
+ var _a2;
18776
19543
  const t = useTheme();
18777
19544
  const S4 = React41.useMemo(() => makeStyles2(t), [t]);
18778
19545
  const { blocks } = builder;
@@ -18811,7 +19578,7 @@ function StepperBuilder({ builder, state, onSubmit, onCancel, disabled, onFileUp
18811
19578
  ] }),
18812
19579
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: dense ? __spreadProps(__spreadValues({}, S4.body), { padding: "12px 0" }) : S4.body, children: block && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "12px", animation: "agStepFade 0.22s ease" }, children: [
18813
19580
  block.description && /* @__PURE__ */ jsxRuntime.jsx("div", { style: S4.blockDesc, children: block.description }),
18814
- ((_a = block.context) == null ? void 0 : _a.type) && /* @__PURE__ */ jsxRuntime.jsx(ContextSlot, { payload: block.context }),
19581
+ ((_a2 = block.context) == null ? void 0 : _a2.type) && /* @__PURE__ */ jsxRuntime.jsx(ContextSlot, { payload: block.context }),
18815
19582
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: (block.fields || []).map((field) => /* @__PURE__ */ jsxRuntime.jsx(
18816
19583
  FieldRenderer,
18817
19584
  {
@@ -18821,7 +19588,9 @@ function StepperBuilder({ builder, state, onSubmit, onCancel, disabled, onFileUp
18821
19588
  disabled,
18822
19589
  error: state.getError(block.id, field.name),
18823
19590
  dense,
18824
- onFileUpload
19591
+ onFileUpload,
19592
+ onEntitySearch,
19593
+ onEntityCreate
18825
19594
  },
18826
19595
  `${block.id}:${field.name}`
18827
19596
  )) })
@@ -18947,168 +19716,19 @@ function makeStyles2(t) {
18947
19716
  }
18948
19717
  };
18949
19718
  }
18950
-
18951
- // src/builders/EscalationCard.tsx
18952
- init_ThemeContext();
18953
- function EscalationCard({ builder, state, onSubmit, disabled, onFileUpload, hideActions, dense }) {
18954
- var _a;
18955
- const t = useTheme();
18956
- const S4 = React41.useMemo(() => makeStyles3(t), [t]);
18957
- const block = builder.blocks[0];
18958
- if (!block) return null;
18959
- if (disabled) return /* @__PURE__ */ jsxRuntime.jsx(BuilderRecap, { builder, state });
18960
- const containerStyle = dense ? { display: "flex", flexDirection: "column", gap: "10px" } : S4.card;
18961
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: containerStyle, children: [
18962
- builder.description && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontSize: dense ? "12px" : "13px", color: dense ? t.MUTED : "var(--foreground)", lineHeight: 1.45, margin: 0 }, children: builder.description }),
18963
- ((_a = block.context) == null ? void 0 : _a.type) && /* @__PURE__ */ jsxRuntime.jsx(ContextSlot, { payload: block.context }),
18964
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: dense ? "8px" : "10px" }, children: (block.fields || []).map((field) => /* @__PURE__ */ jsxRuntime.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}`)) }),
18965
- disabled ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "11px", fontWeight: 600, color: t.MUTED, textAlign: "center", padding: "2px 0" }, children: "Submitted" }) : hideActions ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", paddingTop: "2px" }, children: [
18966
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1 } }),
18967
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onSubmit, style: S4.continueBtn, children: builder.submit_label || "Continue" })
18968
- ] })
18969
- ] });
18970
- }
18971
- function makeStyles3(t) {
18972
- return {
18973
- card: {
18974
- display: "flex",
18975
- flexDirection: "column",
18976
- gap: "10px",
18977
- padding: "12px 14px",
18978
- borderRadius: "0.75rem",
18979
- borderTop: `1px solid ${t.BORDER}`,
18980
- borderRight: `1px solid ${t.BORDER}`,
18981
- borderBottom: `1px solid ${t.BORDER}`,
18982
- borderLeft: `2px solid ${t.ACCENT}`,
18983
- background: "white"
18984
- },
18985
- inert: { opacity: 0.55, pointerEvents: "none", userSelect: "none" },
18986
- continueBtn: {
18987
- font: "inherit",
18988
- fontSize: "12px",
18989
- fontWeight: 600,
18990
- color: t.ACCENT,
18991
- background: "transparent",
18992
- borderTop: `1px solid ${t.ACCENT}`,
18993
- borderRight: `1px solid ${t.ACCENT}`,
18994
- borderBottom: `1px solid ${t.ACCENT}`,
18995
- borderLeft: `1px solid ${t.ACCENT}`,
18996
- borderRadius: "9999px",
18997
- padding: "6px 14px",
18998
- cursor: "pointer",
18999
- transition: "all 0.15s"
19000
- }
19001
- };
19002
- }
19003
- function fieldKey(blockId, name) {
19004
- return `${blockId}\0${name}`;
19005
- }
19006
- function useBuilderState(blocks) {
19007
- const isMultiBlock = blocks.length > 1;
19008
- const [values, setValues] = React41.useState(() => {
19009
- const init = {};
19010
- for (const block of blocks) {
19011
- for (const field of block.fields || []) {
19012
- if (field.default_value != null) init[fieldKey(block.id, field.name)] = field.default_value;
19013
- }
19014
- }
19015
- return init;
19016
- });
19017
- const [errors, setErrors] = React41.useState({});
19018
- const [currentBlock, setCurrentBlock] = React41.useState(0);
19019
- const getValue = React41.useCallback(
19020
- (blockId, name) => values[fieldKey(blockId, name)],
19021
- [values]
19022
- );
19023
- const getError = React41.useCallback(
19024
- (blockId, name) => errors[fieldKey(blockId, name)],
19025
- [errors]
19026
- );
19027
- const setFieldValue = React41.useCallback((blockId, name, value) => {
19028
- const k = fieldKey(blockId, name);
19029
- setValues((prev) => __spreadProps(__spreadValues({}, prev), { [k]: value }));
19030
- setErrors((prev) => {
19031
- if (!prev[k]) return prev;
19032
- const next = __spreadValues({}, prev);
19033
- delete next[k];
19034
- return next;
19035
- });
19036
- }, []);
19037
- const validateBlock = React41.useCallback(
19038
- (blockIdx) => {
19039
- const block = blocks[blockIdx];
19040
- if (!block) return true;
19041
- const newErrors = {};
19042
- for (const field of block.fields || []) {
19043
- const k = fieldKey(block.id, field.name);
19044
- const v = values[k];
19045
- if (field.required) {
19046
- if (v == null || v === "" || Array.isArray(v) && v.length === 0) {
19047
- newErrors[k] = "Required";
19048
- continue;
19049
- }
19050
- }
19051
- if (v == null || v === "") continue;
19052
- const val = field.validation;
19053
- if (!val) continue;
19054
- if (val.min_length && typeof v === "string" && v.length < val.min_length) {
19055
- newErrors[k] = `Min ${val.min_length} characters`;
19056
- } else if (val.max_length && typeof v === "string" && v.length > val.max_length) {
19057
- newErrors[k] = `Max ${val.max_length} characters`;
19058
- } else if (val.min != null && typeof v === "number" && v < val.min) {
19059
- newErrors[k] = `Min ${val.min}`;
19060
- } else if (val.max != null && typeof v === "number" && v > val.max) {
19061
- newErrors[k] = `Max ${val.max}`;
19062
- } else if (val.pattern && typeof v === "string" && !new RegExp(val.pattern).test(v)) {
19063
- newErrors[k] = "Invalid format";
19064
- }
19065
- }
19066
- setErrors((prev) => __spreadValues(__spreadValues({}, prev), newErrors));
19067
- return Object.keys(newErrors).length === 0;
19068
- },
19069
- [blocks, values]
19070
- );
19071
- const validateAll = React41.useCallback(() => {
19072
- let firstFailing = -1;
19073
- const allErrors = {};
19074
- for (let i = 0; i < blocks.length; i++) {
19075
- const block = blocks[i];
19076
- for (const field of block.fields || []) {
19077
- const k = fieldKey(block.id, field.name);
19078
- const v = values[k];
19079
- if (field.required && (v == null || v === "" || Array.isArray(v) && v.length === 0)) {
19080
- allErrors[k] = "Required";
19081
- if (firstFailing < 0) firstFailing = i;
19082
- }
19083
- }
19084
- }
19085
- setErrors(allErrors);
19086
- if (firstFailing >= 0) setCurrentBlock(firstFailing);
19087
- return Object.keys(allErrors).length === 0;
19088
- }, [blocks, values]);
19089
- return {
19090
- values,
19091
- errors,
19092
- getValue,
19093
- getError,
19094
- setFieldValue,
19095
- validateBlock,
19096
- validateAll,
19097
- currentBlock,
19098
- setCurrentBlock,
19099
- isMultiBlock
19100
- };
19101
- }
19102
19719
  function BuilderFormResolver({
19103
19720
  builder,
19104
19721
  onSubmit,
19105
19722
  onCancel,
19106
19723
  disabled,
19107
19724
  onFileUpload,
19725
+ onEntitySearch,
19726
+ onEntityCreate,
19108
19727
  onChange,
19109
19728
  submitRef,
19110
19729
  hideActions,
19111
- dense
19730
+ dense,
19731
+ onValidationError
19112
19732
  }) {
19113
19733
  const state = useBuilderState(builder.blocks);
19114
19734
  const kind = builder.builder_kind || "form";
@@ -19126,9 +19746,13 @@ function BuilderFormResolver({
19126
19746
  }, [builder, kind, state.getValue]);
19127
19747
  const handleSubmit = React41.useCallback(() => {
19128
19748
  if (disabled) return;
19129
- if (!state.validateAll()) return;
19749
+ const failure = state.validateAllDetailed();
19750
+ if (failure.failingKeys.length > 0) {
19751
+ onValidationError == null ? void 0 : onValidationError(failure);
19752
+ return;
19753
+ }
19130
19754
  onSubmit(buildSubmission());
19131
- }, [disabled, state.validateAll, onSubmit, buildSubmission]);
19755
+ }, [disabled, state.validateAllDetailed, onSubmit, buildSubmission, onValidationError]);
19132
19756
  React41.useEffect(() => {
19133
19757
  if (!onChange) return;
19134
19758
  onChange(buildSubmission());
@@ -19151,32 +19775,40 @@ function BuilderFormResolver({
19151
19775
  onCancel,
19152
19776
  disabled,
19153
19777
  onFileUpload,
19778
+ onEntitySearch,
19779
+ onEntityCreate,
19154
19780
  dense
19155
19781
  }
19156
19782
  );
19157
19783
  case "escalation":
19158
19784
  return /* @__PURE__ */ jsxRuntime.jsx(
19159
- EscalationCard,
19785
+ BlockForm,
19160
19786
  {
19787
+ variant: "escalation",
19161
19788
  builder,
19162
19789
  state,
19163
19790
  onSubmit: handleSubmit,
19164
19791
  disabled,
19165
19792
  onFileUpload,
19793
+ onEntitySearch,
19794
+ onEntityCreate,
19166
19795
  hideActions,
19167
19796
  dense
19168
19797
  }
19169
19798
  );
19170
19799
  default:
19171
19800
  return /* @__PURE__ */ jsxRuntime.jsx(
19172
- FormBuilder,
19801
+ BlockForm,
19173
19802
  {
19803
+ variant: "form",
19174
19804
  builder,
19175
19805
  state,
19176
19806
  onSubmit: handleSubmit,
19177
19807
  onCancel,
19178
19808
  disabled,
19179
19809
  onFileUpload,
19810
+ onEntitySearch,
19811
+ onEntityCreate,
19180
19812
  dense,
19181
19813
  hideActions
19182
19814
  }