@adoptai/genui-components 0.1.45 → 0.1.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/builders/BlockForm.d.ts +31 -0
  2. package/dist/builders/BlockForm.d.ts.map +1 -0
  3. package/dist/builders/BuilderForm.d.ts +10 -2
  4. package/dist/builders/BuilderForm.d.ts.map +1 -1
  5. package/dist/builders/BuilderRecap.d.ts.map +1 -1
  6. package/dist/builders/ContextSlot.d.ts +6 -0
  7. package/dist/builders/ContextSlot.d.ts.map +1 -1
  8. package/dist/builders/FieldRenderer.d.ts +5 -2
  9. package/dist/builders/FieldRenderer.d.ts.map +1 -1
  10. package/dist/builders/StepperBuilder.d.ts +4 -2
  11. package/dist/builders/StepperBuilder.d.ts.map +1 -1
  12. package/dist/builders/fields.d.ts +22 -1
  13. package/dist/builders/fields.d.ts.map +1 -1
  14. package/dist/builders/hooks.d.ts +17 -0
  15. package/dist/builders/hooks.d.ts.map +1 -1
  16. package/dist/builders/index.d.ts +5 -5
  17. package/dist/builders/index.d.ts.map +1 -1
  18. package/dist/builders/resolver.d.ts +4 -1
  19. package/dist/builders/resolver.d.ts.map +1 -1
  20. package/dist/builders/schemas.d.ts +196 -1
  21. package/dist/builders/schemas.d.ts.map +1 -1
  22. package/dist/composites/journal-entry/resolver.cjs +2 -2
  23. package/dist/composites/journal-entry/resolver.cjs.map +1 -1
  24. package/dist/composites/journal-entry/resolver.js +2 -2
  25. package/dist/composites/journal-entry/resolver.js.map +1 -1
  26. package/dist/composites/workflow-stepper/resolver.cjs +2 -0
  27. package/dist/composites/workflow-stepper/resolver.cjs.map +1 -1
  28. package/dist/composites/workflow-stepper/resolver.d.ts.map +1 -1
  29. package/dist/composites/workflow-stepper/resolver.js +2 -0
  30. package/dist/composites/workflow-stepper/resolver.js.map +1 -1
  31. package/dist/index.cjs +1398 -780
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.js +1398 -780
  34. package/dist/index.js.map +1 -1
  35. package/dist/renderer.cjs +7 -5
  36. package/dist/renderer.cjs.map +1 -1
  37. package/dist/renderer.js +7 -5
  38. package/dist/renderer.js.map +1 -1
  39. package/dist/resolver.cjs +7 -5
  40. package/dist/resolver.cjs.map +1 -1
  41. package/dist/resolver.js +7 -5
  42. package/dist/resolver.js.map +1 -1
  43. package/dist/schemas/index.cjs +3 -3
  44. package/dist/schemas/index.cjs.map +1 -1
  45. package/dist/schemas/index.d.ts +1 -0
  46. package/dist/schemas/index.d.ts.map +1 -1
  47. package/dist/schemas/index.js +3 -3
  48. package/dist/schemas/index.js.map +1 -1
  49. package/dist/schemas/workflow-stepper.d.ts +1 -0
  50. package/dist/schemas/workflow-stepper.d.ts.map +1 -1
  51. package/dist/tool-definitions.json +4 -3
  52. package/package.json +2 -2
  53. package/dist/builders/EscalationCard.d.ts +0 -17
  54. package/dist/builders/EscalationCard.d.ts.map +0 -1
  55. package/dist/builders/FormBuilder.d.ts +0 -19
  56. package/dist/builders/FormBuilder.d.ts.map +0 -1
package/dist/index.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));
@@ -6687,10 +6687,10 @@ var tooltipStyle3 = {
6687
6687
  color: "var(--foreground)"
6688
6688
  };
6689
6689
  function WaterfallChartResolver(p) {
6690
- var _a, _b, _c;
6690
+ var _a2, _b, _c;
6691
6691
  const { ACCENT: ACCENT2, BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
6692
6692
  const { isVisible, toggle } = useSeriesToggle(["Positive", "Negative", "Total"]);
6693
- const unit = (_a = p.unit) != null ? _a : "";
6693
+ const unit = (_a2 = p.unit) != null ? _a2 : "";
6694
6694
  const bars = (_b = p.bars) != null ? _b : [];
6695
6695
  let running = 0;
6696
6696
  const chartData = bars.map((bar) => {
@@ -6967,9 +6967,9 @@ function FlowCanvasRenderer({
6967
6967
  ] });
6968
6968
  }
6969
6969
  function FlowCanvasResolver(p) {
6970
- var _a;
6970
+ var _a2;
6971
6971
  const { ACCENT: ACCENT2, BORDER: BORDER4 } = useTheme();
6972
- return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a = p.title) != null ? _a : "flow-canvas", children: /* @__PURE__ */ jsxRuntime.jsx(
6972
+ return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a2 = p.title) != null ? _a2 : "flow-canvas", children: /* @__PURE__ */ jsxRuntime.jsx(
6973
6973
  FlowCanvasRenderer,
6974
6974
  {
6975
6975
  diagram: p.diagram,
@@ -6992,13 +6992,13 @@ var categoryLabels = {
6992
6992
  other: "Other"
6993
6993
  };
6994
6994
  function TrialBalanceResolver(p) {
6995
- var _a, _b, _c, _d;
6995
+ var _a2, _b, _c, _d;
6996
6996
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
6997
6997
  let totalDebit = 0;
6998
6998
  let totalCredit = 0;
6999
- ((_a = p.groups) != null ? _a : []).forEach((g) => {
7000
- var _a2;
7001
- return ((_a2 = g.accounts) != null ? _a2 : []).forEach((a) => {
6999
+ ((_a2 = p.groups) != null ? _a2 : []).forEach((g) => {
7000
+ var _a3;
7001
+ return ((_a3 = g.accounts) != null ? _a3 : []).forEach((a) => {
7002
7002
  totalDebit += a.debit;
7003
7003
  totalCredit += a.credit;
7004
7004
  });
@@ -7006,12 +7006,12 @@ function TrialBalanceResolver(p) {
7006
7006
  const balanced = Math.abs(totalDebit - totalCredit) < 5e-3;
7007
7007
  const csvCols = [{ key: "category", label: "Category" }, { key: "code", label: "Code" }, { key: "name", label: "Account" }, { key: "debit", label: "Debit" }, { key: "credit", label: "Credit" }];
7008
7008
  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 }));
7009
+ var _a3;
7010
+ return ((_a3 = g.accounts) != null ? _a3 : []).map((a) => ({ category: g.category, code: a.code, name: a.name, debit: a.debit, credit: a.credit }));
7011
7011
  });
7012
7012
  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");
7013
+ var _a3;
7014
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "trial-balance");
7015
7015
  }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
7016
7016
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
7017
7017
  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 +7044,9 @@ function TrialBalanceResolver(p) {
7044
7044
  }, children: h }, h)) }) }),
7045
7045
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
7046
7046
  ((_d = p.groups) != null ? _d : []).map((group) => {
7047
- var _a2, _b2, _c2;
7047
+ var _a3, _b2, _c2;
7048
7048
  let gDebit = 0, gCredit = 0;
7049
- ((_a2 = group.accounts) != null ? _a2 : []).forEach((a) => {
7049
+ ((_a3 = group.accounts) != null ? _a3 : []).forEach((a) => {
7050
7050
  gDebit += a.debit;
7051
7051
  gCredit += a.credit;
7052
7052
  });
@@ -7095,25 +7095,25 @@ var statusColors = {
7095
7095
  };
7096
7096
  var fmt2 = (v, currency) => new Intl.NumberFormat("en-US", { style: "currency", currency: currency || "USD", minimumFractionDigits: 2 }).format(v);
7097
7097
  function JournalEntryResolver(p) {
7098
- var _a, _b, _c;
7098
+ var _a2, _b, _c;
7099
7099
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2 } = useTheme();
7100
7100
  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 };
7101
+ const csvRows = ((_a2 = p.entries) != null ? _a2 : []).flatMap((e) => {
7102
+ var _a3;
7103
+ return ((_a3 = e.lines) != null ? _a3 : []).map((l) => {
7104
+ var _a4;
7105
+ 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
7106
  });
7107
7107
  });
7108
7108
  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");
7109
+ var _a3;
7110
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "journal-entry");
7111
7111
  }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "14px" }, children: [
7112
7112
  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
7113
  ((_c = p.entries) != null ? _c : []).map((entry) => {
7114
- var _a2, _b2;
7114
+ var _a3, _b2, _c2;
7115
7115
  let totalDebit = 0, totalCredit = 0;
7116
- ((_a2 = entry.lines) != null ? _a2 : []).forEach((l) => {
7116
+ ((_a3 = entry.lines) != null ? _a3 : []).forEach((l) => {
7117
7117
  totalDebit += l.debit;
7118
7118
  totalCredit += l.credit;
7119
7119
  });
@@ -7137,11 +7137,11 @@ function JournalEntryResolver(p) {
7137
7137
  letterSpacing: "0.02em"
7138
7138
  }, children: h }, h)) }) }),
7139
7139
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
7140
- entry.lines.map((line, li) => {
7141
- var _a3;
7140
+ ((_c2 = entry.lines) != null ? _c2 : []).map((line, li) => {
7141
+ var _a4;
7142
7142
  return /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: { background: li % 2 === 0 ? "white" : "#fafafa" }, children: [
7143
7143
  /* @__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" }),
7144
+ /* @__PURE__ */ jsxRuntime.jsx("td", { style: { padding: "6px 12px", fontSize: "12px", color: MUTED2 }, children: (_a4 = line.description) != null ? _a4 : "\u2014" }),
7145
7145
  /* @__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
7146
  /* @__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
7147
  ] }, li);
@@ -7172,17 +7172,17 @@ function agingHeat(index, total) {
7172
7172
  return `rgba(220, 38, 38, ${alpha})`;
7173
7173
  }
7174
7174
  function AgingReportResolver(p) {
7175
- var _a, _b, _c, _d;
7175
+ var _a2, _b, _c, _d;
7176
7176
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2 } = useTheme();
7177
- const buckets = (_a = p.buckets) != null ? _a : [];
7177
+ const buckets = (_a2 = p.buckets) != null ? _a2 : [];
7178
7178
  const entities = (_b = p.entities) != null ? _b : [];
7179
7179
  const currency = (_c = p.currency) != null ? _c : "USD";
7180
7180
  const bucketCount = buckets.length;
7181
7181
  const totals = new Array(bucketCount).fill(0);
7182
7182
  let grandTotal = 0;
7183
7183
  entities.forEach((e) => {
7184
- var _a2, _b2;
7185
- ((_a2 = e.amounts) != null ? _a2 : []).forEach((a, i) => {
7184
+ var _a3, _b2;
7185
+ ((_a3 = e.amounts) != null ? _a3 : []).forEach((a, i) => {
7186
7186
  if (i < bucketCount) totals[i] += a;
7187
7187
  });
7188
7188
  grandTotal += (_b2 = e.total) != null ? _b2 : 0;
@@ -7196,8 +7196,8 @@ function AgingReportResolver(p) {
7196
7196
  return row;
7197
7197
  });
7198
7198
  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");
7199
+ var _a3;
7200
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "aging-report");
7201
7201
  }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
7202
7202
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
7203
7203
  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 +7215,12 @@ function AgingReportResolver(p) {
7215
7215
  ] }) }),
7216
7216
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
7217
7217
  entities.map((entity, ri) => {
7218
- var _a2;
7218
+ var _a3;
7219
7219
  return /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: { background: ri % 2 === 0 ? "white" : "#fafafa" }, children: [
7220
7220
  /* @__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
7221
  buckets.map((_, bi) => {
7222
- var _a3, _b2;
7223
- const val = bi < ((_a3 = entity.amounts) != null ? _a3 : []).length ? ((_b2 = entity.amounts) != null ? _b2 : [])[bi] : 0;
7222
+ var _a4, _b2;
7223
+ const val = bi < ((_a4 = entity.amounts) != null ? _a4 : []).length ? ((_b2 = entity.amounts) != null ? _b2 : [])[bi] : 0;
7224
7224
  const isLast = bi === bucketCount - 1;
7225
7225
  return /* @__PURE__ */ jsxRuntime.jsx("td", { style: {
7226
7226
  padding: "6px 12px",
@@ -7233,7 +7233,7 @@ function AgingReportResolver(p) {
7233
7233
  fontWeight: isLast && val > 0 ? 600 : void 0
7234
7234
  }, children: val !== 0 ? fmt3(val, currency) : "\u2014" }, bi);
7235
7235
  }),
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) })
7236
+ /* @__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
7237
  ] }, ri);
7238
7238
  }),
7239
7239
  /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: { background: PAPER2 }, children: [
@@ -7251,14 +7251,14 @@ init_ThemeContext();
7251
7251
  var fmt4 = (v, currency) => new Intl.NumberFormat("en-US", { style: "currency", currency: currency || "USD", minimumFractionDigits: 2 }).format(v);
7252
7252
  var pctFmt = (v) => isFinite(v) ? `${v > 0 ? "+" : ""}${v.toFixed(1)}%` : "N/A";
7253
7253
  function VarianceAnalysisResolver(p) {
7254
- var _a, _b, _c, _d;
7254
+ var _a2, _b, _c, _d;
7255
7255
  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);
7256
+ const maxAbsVar = Math.max(...((_a2 = p.rows) != null ? _a2 : []).filter((r) => !r.isSubtotal).map((r) => Math.abs(r.actual - r.budget)), 1);
7257
7257
  const csvCols = [{ key: "lineItem", label: "Line Item" }, { key: "budget", label: "Budget" }, { key: "actual", label: "Actual" }, { key: "variance", label: "Variance $" }, { key: "variancePct", label: "Variance %" }];
7258
7258
  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
7259
  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");
7260
+ var _a3;
7261
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "variance-analysis");
7262
7262
  }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
7263
7263
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
7264
7264
  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 +7279,7 @@ function VarianceAnalysisResolver(p) {
7279
7279
  width: i === 5 ? "60px" : void 0
7280
7280
  }, children: h }, h || i)) }) }),
7281
7281
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: ((_d = p.rows) != null ? _d : []).map((row, ri) => {
7282
- var _a2;
7282
+ var _a3;
7283
7283
  const variance = row.actual - row.budget;
7284
7284
  const pct = row.budget !== 0 ? variance / Math.abs(row.budget) * 100 : NaN;
7285
7285
  const favorable = p.favorableDirection === "higher" ? variance >= 0 : variance <= 0;
@@ -7290,7 +7290,7 @@ function VarianceAnalysisResolver(p) {
7290
7290
  fontWeight: row.isSubtotal ? 700 : void 0,
7291
7291
  borderTop: row.isSubtotal ? `1px solid ${BORDER4}` : void 0
7292
7292
  }, 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 }),
7293
+ /* @__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
7294
  /* @__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
7295
  /* @__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
7296
  /* @__PURE__ */ jsxRuntime.jsxs("td", { style: { padding: "6px 10px", fontSize: "13px", textAlign: "right", fontVariantNumeric: "tabular-nums", borderBottom: `1px solid #f2f2f2`, color }, children: [
@@ -7324,16 +7324,16 @@ function abbreviate(v) {
7324
7324
  }
7325
7325
  var fmt5 = (v, currency) => new Intl.NumberFormat("en-US", { style: "currency", currency: currency || "USD", minimumFractionDigits: 2 }).format(v);
7326
7326
  function StackedBreakdownResolver(p) {
7327
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
7327
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
7328
7328
  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));
7329
+ const { isVisible, toggle } = useSeriesToggle(((_a2 = p.categories) != null ? _a2 : []).map((c) => c.name));
7330
7330
  const chartData = ((_b = p.periods) != null ? _b : []).map((period, pi) => {
7331
- var _a2;
7331
+ var _a3;
7332
7332
  const row = { period };
7333
7333
  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;
7334
+ ((_a3 = p.categories) != null ? _a3 : []).forEach((cat) => {
7335
+ var _a4, _b2;
7336
+ const v = pi < ((_a4 = cat.values) != null ? _a4 : []).length ? ((_b2 = cat.values) != null ? _b2 : [])[pi] : 0;
7337
7337
  row[cat.name] = v;
7338
7338
  total += v;
7339
7339
  });
@@ -7347,8 +7347,8 @@ function StackedBreakdownResolver(p) {
7347
7347
  {
7348
7348
  filename: (_e = p.title) != null ? _e : "stacked-breakdown",
7349
7349
  onDownloadCSV: () => {
7350
- var _a2;
7351
- return downloadCSV(csvCols, chartData, (_a2 = p.title) != null ? _a2 : "stacked-breakdown");
7350
+ var _a3;
7351
+ return downloadCSV(csvCols, chartData, (_a3 = p.title) != null ? _a3 : "stacked-breakdown");
7352
7352
  },
7353
7353
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "12px" }, children: [
7354
7354
  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 +7357,13 @@ function StackedBreakdownResolver(p) {
7357
7357
  /* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, { tick: { fontSize: 11, fill: MUTED2 }, axisLine: false, tickLine: false, width: 52, tickFormatter: abbreviate }),
7358
7358
  /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { contentStyle: tooltipStyle4, formatter: (value) => [fmt5(value, p.currency), ""], cursor: { fill: "#f2f2f2" } }),
7359
7359
  ((_f = p.categories) != null ? _f : []).map((cat, ci) => {
7360
- var _a2, _b2;
7360
+ var _a3, _b2;
7361
7361
  return /* @__PURE__ */ jsxRuntime.jsx(
7362
7362
  recharts.Bar,
7363
7363
  {
7364
7364
  dataKey: cat.name,
7365
7365
  stackId: "tax",
7366
- fill: (_a2 = cat.color) != null ? _a2 : PALETTE2[ci % PALETTE2.length],
7366
+ fill: (_a3 = cat.color) != null ? _a3 : PALETTE2[ci % PALETTE2.length],
7367
7367
  radius: ci === ((_b2 = p.categories) != null ? _b2 : []).length - 1 ? [3, 3, 0, 0] : void 0,
7368
7368
  hide: !isVisible(cat.name)
7369
7369
  },
@@ -7372,7 +7372,7 @@ function StackedBreakdownResolver(p) {
7372
7372
  })
7373
7373
  ] }) }),
7374
7374
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "14px" }, children: ((_g = p.categories) != null ? _g : []).map((cat, ci) => {
7375
- var _a2;
7375
+ var _a3;
7376
7376
  return /* @__PURE__ */ jsxRuntime.jsxs(
7377
7377
  "div",
7378
7378
  {
@@ -7396,7 +7396,7 @@ function StackedBreakdownResolver(p) {
7396
7396
  height: "10px",
7397
7397
  borderRadius: "2px",
7398
7398
  flexShrink: 0,
7399
- background: (_a2 = cat.color) != null ? _a2 : PALETTE2[ci % PALETTE2.length],
7399
+ background: (_a3 = cat.color) != null ? _a3 : PALETTE2[ci % PALETTE2.length],
7400
7400
  display: "inline-block",
7401
7401
  opacity: isVisible(cat.name) ? 1 : 0.3,
7402
7402
  transition: "opacity 0.15s"
@@ -7414,15 +7414,15 @@ function StackedBreakdownResolver(p) {
7414
7414
  ] }) }),
7415
7415
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
7416
7416
  ((_i = p.categories) != null ? _i : []).map((cat, ci) => {
7417
- var _a2, _b2;
7417
+ var _a3, _b2;
7418
7418
  return /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: { background: ci % 2 === 0 ? "white" : "#fafafa" }, children: [
7419
7419
  /* @__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" } }),
7420
+ /* @__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
7421
  cat.name
7422
7422
  ] }),
7423
7423
  ((_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;
7424
+ var _a4, _b3;
7425
+ const v = pi < ((_a4 = cat.values) != null ? _a4 : []).length ? ((_b3 = cat.values) != null ? _b3 : [])[pi] : 0;
7426
7426
  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
7427
  })
7428
7428
  ] }, cat.name);
@@ -7457,9 +7457,9 @@ var tooltipStyle5 = {
7457
7457
  color: "var(--foreground)"
7458
7458
  };
7459
7459
  function ComparativeBarChartResolver(p) {
7460
- var _a, _b, _c, _d;
7460
+ var _a2, _b, _c, _d;
7461
7461
  const { BORDER: BORDER4, MUTED: MUTED2, CHART_PALETTE: CHART_PALETTE2 } = useTheme();
7462
- const series = (_a = p.series) != null ? _a : [];
7462
+ const series = (_a2 = p.series) != null ? _a2 : [];
7463
7463
  const data = (_b = p.data) != null ? _b : [];
7464
7464
  const xKey = (_c = p.xKey) != null ? _c : "x";
7465
7465
  const horizontal = p.orientation === "horizontal";
@@ -7487,13 +7487,13 @@ function ComparativeBarChartResolver(p) {
7487
7487
  ),
7488
7488
  /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { contentStyle: tooltipStyle5, cursor: { fill: "#f2f2f2" } }),
7489
7489
  series.map((s, si) => {
7490
- var _a2;
7490
+ var _a3;
7491
7491
  return /* @__PURE__ */ jsxRuntime.jsx(
7492
7492
  recharts.Bar,
7493
7493
  {
7494
7494
  dataKey: s.dataKey,
7495
7495
  name: s.name,
7496
- fill: (_a2 = s.color) != null ? _a2 : PALETTE3[si % PALETTE3.length],
7496
+ fill: (_a3 = s.color) != null ? _a3 : PALETTE3[si % PALETTE3.length],
7497
7497
  stackId: stacked ? "stack" : void 0,
7498
7498
  radius: horizontal ? void 0 : [3, 3, 0, 0],
7499
7499
  hide: !isVisible(s.dataKey),
@@ -7504,7 +7504,7 @@ function ComparativeBarChartResolver(p) {
7504
7504
  })
7505
7505
  ] }) }),
7506
7506
  series.length > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "14px" }, children: series.map((s, si) => {
7507
- var _a2;
7507
+ var _a3;
7508
7508
  return /* @__PURE__ */ jsxRuntime.jsxs(
7509
7509
  "div",
7510
7510
  {
@@ -7525,7 +7525,7 @@ function ComparativeBarChartResolver(p) {
7525
7525
  width: "10px",
7526
7526
  height: "10px",
7527
7527
  borderRadius: "2px",
7528
- background: (_a2 = s.color) != null ? _a2 : PALETTE3[si % PALETTE3.length],
7528
+ background: (_a3 = s.color) != null ? _a3 : PALETTE3[si % PALETTE3.length],
7529
7529
  display: "inline-block",
7530
7530
  opacity: isVisible(s.dataKey) ? 1 : 0.3,
7531
7531
  transition: "opacity 0.15s"
@@ -7556,8 +7556,8 @@ var priorityConfig = {
7556
7556
  low: { color: exports.MUTED, bg: "#f2f2f2" }
7557
7557
  };
7558
7558
  function ItemRow({ item }) {
7559
- var _a, _b;
7560
- const sc = (_a = statusConfig[item.status]) != null ? _a : statusConfig["not-started"];
7559
+ var _a2, _b;
7560
+ const sc = (_a2 = statusConfig[item.status]) != null ? _a2 : statusConfig["not-started"];
7561
7561
  const pc = (_b = priorityConfig[item.priority]) != null ? _b : priorityConfig.medium;
7562
7562
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
7563
7563
  display: "flex",
@@ -7626,24 +7626,24 @@ function Section({ section }) {
7626
7626
  ] });
7627
7627
  }
7628
7628
  function ComplianceChecklistResolver(p) {
7629
- var _a, _b, _c, _d;
7629
+ var _a2, _b, _c, _d;
7630
7630
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
7631
- const allItems = ((_a = p.sections) != null ? _a : []).flatMap((s) => s.items);
7631
+ const allItems = ((_a2 = p.sections) != null ? _a2 : []).flatMap((s) => s.items);
7632
7632
  const total = allItems.length;
7633
7633
  const completed = allItems.filter((i) => i.status === "completed").length;
7634
7634
  const overdue = allItems.filter((i) => i.status === "overdue").length;
7635
7635
  const pct = total > 0 ? Math.round(completed / total * 100) : 0;
7636
7636
  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
7637
  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 : "" };
7638
+ var _a3;
7639
+ return ((_a3 = s.items) != null ? _a3 : []).map((i) => {
7640
+ var _a4, _b2;
7641
+ 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
7642
  });
7643
7643
  });
7644
7644
  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");
7645
+ var _a3;
7646
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "compliance-checklist");
7647
7647
  }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
7648
7648
  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
7649
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
@@ -7705,9 +7705,9 @@ function DiffCell({ diff, currency }) {
7705
7705
  );
7706
7706
  }
7707
7707
  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;
7708
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
7709
7709
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2 } = useTheme();
7710
- const sourceA = (_a = p.sourceA) != null ? _a : { label: "Source A" };
7710
+ const sourceA = (_a2 = p.sourceA) != null ? _a2 : { label: "Source A" };
7711
7711
  const sourceB = (_b = p.sourceB) != null ? _b : { label: "Source B" };
7712
7712
  const [activeTab, setActiveTab] = React41.useState("matched");
7713
7713
  const balanceA = (_d = (_c = p.summary) == null ? void 0 : _c.balanceA) != null ? _d : 0;
@@ -7724,7 +7724,7 @@ function ReconciliationViewResolver(p) {
7724
7724
  ];
7725
7725
  const csvRows = [
7726
7726
  ...((_i = p.matched) != null ? _i : []).map((m) => {
7727
- var _a2;
7727
+ var _a3;
7728
7728
  return {
7729
7729
  type: "Matched",
7730
7730
  date: m.date,
@@ -7732,11 +7732,11 @@ function ReconciliationViewResolver(p) {
7732
7732
  amountA: m.amountA,
7733
7733
  amountB: m.amountB,
7734
7734
  diff: m.amountA - m.amountB,
7735
- reference: (_a2 = m.reference) != null ? _a2 : ""
7735
+ reference: (_a3 = m.reference) != null ? _a3 : ""
7736
7736
  };
7737
7737
  }),
7738
7738
  ...((_j = p.unmatchedA) != null ? _j : []).map((u) => {
7739
- var _a2;
7739
+ var _a3;
7740
7740
  return {
7741
7741
  type: `Unmatched ${sourceA.label}`,
7742
7742
  date: u.date,
@@ -7744,11 +7744,11 @@ function ReconciliationViewResolver(p) {
7744
7744
  amountA: u.amount,
7745
7745
  amountB: "",
7746
7746
  diff: "",
7747
- reference: (_a2 = u.reference) != null ? _a2 : ""
7747
+ reference: (_a3 = u.reference) != null ? _a3 : ""
7748
7748
  };
7749
7749
  }),
7750
7750
  ...((_k = p.unmatchedB) != null ? _k : []).map((u) => {
7751
- var _a2;
7751
+ var _a3;
7752
7752
  return {
7753
7753
  type: `Unmatched ${sourceB.label}`,
7754
7754
  date: u.date,
@@ -7756,7 +7756,7 @@ function ReconciliationViewResolver(p) {
7756
7756
  amountA: "",
7757
7757
  amountB: u.amount,
7758
7758
  diff: "",
7759
- reference: (_a2 = u.reference) != null ? _a2 : ""
7759
+ reference: (_a3 = u.reference) != null ? _a3 : ""
7760
7760
  };
7761
7761
  })
7762
7762
  ];
@@ -7772,8 +7772,8 @@ function ReconciliationViewResolver(p) {
7772
7772
  {
7773
7773
  filename: (_s = p.title) != null ? _s : "reconciliation-view",
7774
7774
  onDownloadCSV: () => {
7775
- var _a2;
7776
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "reconciliation-view");
7775
+ var _a3;
7776
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "reconciliation-view");
7777
7777
  },
7778
7778
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "0" }, children: [
7779
7779
  p.title && /* @__PURE__ */ jsxRuntime.jsx(
@@ -7944,7 +7944,7 @@ function ReconciliationViewResolver(p) {
7944
7944
  borderBottom: `1px solid ${BORDER4}`
7945
7945
  },
7946
7946
  children: tabs.map((tab, i) => {
7947
- var _a2;
7947
+ var _a3;
7948
7948
  const isActive = activeTab === tab.key;
7949
7949
  return /* @__PURE__ */ jsxRuntime.jsxs(
7950
7950
  "button",
@@ -7981,7 +7981,7 @@ function ReconciliationViewResolver(p) {
7981
7981
  left: "16px",
7982
7982
  right: "16px",
7983
7983
  height: "2px",
7984
- background: (_a2 = tab.accent) != null ? _a2 : ACCENT2,
7984
+ background: (_a3 = tab.accent) != null ? _a3 : ACCENT2,
7985
7985
  borderRadius: "2px 2px 0 0"
7986
7986
  }
7987
7987
  }
@@ -8047,7 +8047,7 @@ function ReconciliationViewResolver(p) {
8047
8047
  )
8048
8048
  ) }) }),
8049
8049
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: ((_u = p.matched) != null ? _u : []).map((m, ri) => {
8050
- var _a2;
8050
+ var _a3;
8051
8051
  const diff = m.amountA - m.amountB;
8052
8052
  const isZero = Math.abs(diff) < 5e-3;
8053
8053
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -8142,7 +8142,7 @@ function ReconciliationViewResolver(p) {
8142
8142
  borderBottom: `1px solid ${INNER_BORDER}`,
8143
8143
  letterSpacing: "0.02em"
8144
8144
  },
8145
- children: (_a2 = m.reference) != null ? _a2 : "\u2014"
8145
+ children: (_a3 = m.reference) != null ? _a3 : "\u2014"
8146
8146
  }
8147
8147
  )
8148
8148
  ]
@@ -8152,8 +8152,8 @@ function ReconciliationViewResolver(p) {
8152
8152
  }) })
8153
8153
  ] })),
8154
8154
  (activeTab === "unmatchedA" || activeTab === "unmatchedB") && (() => {
8155
- var _a2, _b2;
8156
- const items = activeTab === "unmatchedA" ? (_a2 = p.unmatchedA) != null ? _a2 : [] : (_b2 = p.unmatchedB) != null ? _b2 : [];
8155
+ var _a3, _b2;
8156
+ const items = activeTab === "unmatchedA" ? (_a3 = p.unmatchedA) != null ? _a3 : [] : (_b2 = p.unmatchedB) != null ? _b2 : [];
8157
8157
  const sourceLabel = activeTab === "unmatchedA" ? sourceA.label : sourceB.label;
8158
8158
  if (items.length === 0)
8159
8159
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -8185,7 +8185,7 @@ function ReconciliationViewResolver(p) {
8185
8185
  )
8186
8186
  ) }) }),
8187
8187
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: items.map((item, ri) => {
8188
- var _a3;
8188
+ var _a4;
8189
8189
  return /* @__PURE__ */ jsxRuntime.jsxs(
8190
8190
  "tr",
8191
8191
  {
@@ -8277,7 +8277,7 @@ function ReconciliationViewResolver(p) {
8277
8277
  borderBottom: `1px solid ${INNER_BORDER}`,
8278
8278
  letterSpacing: "0.02em"
8279
8279
  },
8280
- children: (_a3 = item.reference) != null ? _a3 : "\u2014"
8280
+ children: (_a4 = item.reference) != null ? _a4 : "\u2014"
8281
8281
  }
8282
8282
  )
8283
8283
  ]
@@ -8351,9 +8351,9 @@ function ChangesView({ changes }) {
8351
8351
  ] }, i)) });
8352
8352
  }
8353
8353
  function EventCard({ event }) {
8354
- var _a;
8354
+ var _a2;
8355
8355
  const [showChanges, setShowChanges] = React41.useState(false);
8356
- const ac = (_a = actionConfig[event.action]) != null ? _a : actionConfig.commented;
8356
+ const ac = (_a2 = actionConfig[event.action]) != null ? _a2 : actionConfig.commented;
8357
8357
  const hasChanges = event.changes && event.changes.length > 0;
8358
8358
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: "12px", position: "relative" }, children: [
8359
8359
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", flexShrink: 0 }, children: [
@@ -8397,9 +8397,9 @@ function EventCard({ event }) {
8397
8397
  ] });
8398
8398
  }
8399
8399
  function AuditTrailResolver(p) {
8400
- var _a, _b;
8400
+ var _a2, _b;
8401
8401
  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());
8402
+ const sorted = [...(_a2 = p.events) != null ? _a2 : []].sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
8403
8403
  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
8404
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
8405
8405
  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 +8419,12 @@ function useFullscreen(ref) {
8419
8419
  return () => document.removeEventListener("fullscreenchange", handler);
8420
8420
  }, []);
8421
8421
  const enter = React41.useCallback(() => {
8422
- var _a, _b;
8423
- (_b = (_a = ref.current) == null ? void 0 : _a.requestFullscreen) == null ? void 0 : _b.call(_a);
8422
+ var _a2, _b;
8423
+ (_b = (_a2 = ref.current) == null ? void 0 : _a2.requestFullscreen) == null ? void 0 : _b.call(_a2);
8424
8424
  }, [ref]);
8425
8425
  const exit = React41.useCallback(() => {
8426
- var _a;
8427
- if (document.fullscreenElement) (_a = document.exitFullscreen) == null ? void 0 : _a.call(document);
8426
+ var _a2;
8427
+ if (document.fullscreenElement) (_a2 = document.exitFullscreen) == null ? void 0 : _a2.call(document);
8428
8428
  }, []);
8429
8429
  const toggle = React41.useCallback(() => {
8430
8430
  if (isFullscreen) exit();
@@ -8449,8 +8449,8 @@ var highlightColors = {
8449
8449
  blue: { bg: "rgba(29,78,216,0.12)", border: "#1d4ed8" }
8450
8450
  };
8451
8451
  function sanitizeFilename(name) {
8452
- var _a;
8453
- return (_a = name.replace(/\.\.\//g, "").replace(/\.\.\\/g, "").split(/[/\\]/).pop()) != null ? _a : name;
8452
+ var _a2;
8453
+ return (_a2 = name.replace(/\.\.\//g, "").replace(/\.\.\\/g, "").split(/[/\\]/).pop()) != null ? _a2 : name;
8454
8454
  }
8455
8455
  function IconButton({ title, onClick, href, download, children }) {
8456
8456
  const style = {
@@ -8487,12 +8487,12 @@ function DownloadIcon() {
8487
8487
  ] });
8488
8488
  }
8489
8489
  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;
8490
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
8491
8491
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2 } = useTheme();
8492
8492
  const [currentPage, setCurrentPage] = React41.useState(0);
8493
8493
  const containerRef = React41.useRef(null);
8494
8494
  const { isFullscreen, toggle } = useFullscreen(containerRef);
8495
- const hasRealFile = !!(((_a = p.source) == null ? void 0 : _a.url) || ((_b = p.source) == null ? void 0 : _b.base64));
8495
+ const hasRealFile = !!(((_a2 = p.source) == null ? void 0 : _a2.url) || ((_b = p.source) == null ? void 0 : _b.base64));
8496
8496
  const isPdf = p.documentType === "pdf";
8497
8497
  const isExcel = p.documentType === "excel";
8498
8498
  const totalPages = ((_c = p.pages) != null ? _c : []).length;
@@ -8555,7 +8555,7 @@ function DocumentPreviewResolver(p) {
8555
8555
  href: (_k = (_j = p.source) == null ? void 0 : _j.url) != null ? _k : void 0,
8556
8556
  download: sanitizeFilename((_m = (_l = p.source) == null ? void 0 : _l.filename) != null ? _m : "file"),
8557
8557
  onClick: !((_n = p.source) == null ? void 0 : _n.url) && ((_o = p.source) == null ? void 0 : _o.base64) ? () => {
8558
- var _a2, _b2;
8558
+ var _a3, _b2;
8559
8559
  const mime = isPdf ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
8560
8560
  const binary = atob(p.source.base64);
8561
8561
  const bytes = new Uint8Array(binary.length);
@@ -8563,7 +8563,7 @@ function DocumentPreviewResolver(p) {
8563
8563
  const blob = new Blob([bytes], { type: mime });
8564
8564
  const a = document.createElement("a");
8565
8565
  a.href = URL.createObjectURL(blob);
8566
- a.download = sanitizeFilename((_b2 = (_a2 = p.source) == null ? void 0 : _a2.filename) != null ? _b2 : "file");
8566
+ a.download = sanitizeFilename((_b2 = (_a3 = p.source) == null ? void 0 : _a3.filename) != null ? _b2 : "file");
8567
8567
  a.click();
8568
8568
  URL.revokeObjectURL(a.href);
8569
8569
  } : void 0,
@@ -8618,8 +8618,8 @@ function DocumentPreviewResolver(p) {
8618
8618
  (_u = page == null ? void 0 : page.label) != null ? _u : "this page"
8619
8619
  ] }),
8620
8620
  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;
8621
+ var _a3;
8622
+ const hc = (_a3 = highlightColors[h.color]) != null ? _a3 : highlightColors.yellow;
8623
8623
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "6px 10px", borderRadius: "4px", background: hc.bg, borderLeft: `3px solid ${hc.border}`, fontSize: "12px" }, children: [
8624
8624
  /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: 600 }, children: h.text }),
8625
8625
  h.note && /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: MUTED2, marginLeft: "8px" }, children: [
@@ -8675,10 +8675,10 @@ function ConfidenceBar({ confidence, height = 6 }) {
8675
8675
  );
8676
8676
  }
8677
8677
  function StepCard({ step, isLast }) {
8678
- var _a;
8678
+ var _a2;
8679
8679
  const [expanded, setExpanded] = React41.useState(false);
8680
8680
  const cfg = stepTypeConfig[step.stepType];
8681
- const detail = (_a = step.detail) != null ? _a : "";
8681
+ const detail = (_a2 = step.detail) != null ? _a2 : "";
8682
8682
  const isLong = detail.length > 100;
8683
8683
  const displayDetail = isLong && !expanded ? detail.slice(0, 100) + "..." : detail;
8684
8684
  const metaEntries = step.metadata ? Object.entries(step.metadata) : [];
@@ -8809,9 +8809,9 @@ function statusColor(status) {
8809
8809
  }
8810
8810
  }
8811
8811
  function ProvenanceChainResolver(p) {
8812
- var _a, _b, _c, _d;
8812
+ var _a2, _b, _c, _d;
8813
8813
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
8814
- const steps = (_a = p.steps) != null ? _a : [];
8814
+ const steps = (_a2 = p.steps) != null ? _a2 : [];
8815
8815
  const stepsWithConf = steps.filter((s) => s.confidence != null && s.confidence > 0);
8816
8816
  const derivedConfidence = stepsWithConf.length > 0 ? stepsWithConf.reduce((sum, s) => sum + s.confidence, 0) / stepsWithConf.length : 0;
8817
8817
  const raw = (_b = p.conclusion) != null ? _b : { status: "not-qualified", value: "", confidence: 0 };
@@ -8962,8 +8962,8 @@ function highlightSnippet(snippet, highlights) {
8962
8962
  });
8963
8963
  }
8964
8964
  function ResultCard({ result, isLast }) {
8965
- var _a;
8966
- const badge = result.sourceType ? (_a = badgeColors[result.sourceType]) != null ? _a : badgeColors.other : null;
8965
+ var _a2;
8966
+ const badge = result.sourceType ? (_a2 = badgeColors[result.sourceType]) != null ? _a2 : badgeColors.other : null;
8967
8967
  const pct = Math.round(result.relevance * 100);
8968
8968
  const titleEl = /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "13px", fontWeight: 700, color: "var(--foreground)" }, children: result.title });
8969
8969
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -9054,9 +9054,9 @@ function ResultCard({ result, isLast }) {
9054
9054
  );
9055
9055
  }
9056
9056
  function SearchResultsResolver(p) {
9057
- var _a, _b, _c, _d, _e, _f;
9057
+ var _a2, _b, _c, _d, _e, _f;
9058
9058
  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: [
9059
+ 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
9060
  /* @__PURE__ */ jsxRuntime.jsx(
9061
9061
  "p",
9062
9062
  {
@@ -9092,8 +9092,8 @@ function SearchResultsResolver(p) {
9092
9092
  background: "white"
9093
9093
  },
9094
9094
  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);
9095
+ var _a3;
9096
+ return /* @__PURE__ */ jsxRuntime.jsx(ResultCard, { result, isLast: i === ((_a3 = p.results) != null ? _a3 : []).length - 1 }, i);
9097
9097
  })
9098
9098
  }
9099
9099
  )
@@ -9110,8 +9110,8 @@ var resultConfig = {
9110
9110
  na: { color: exports.MUTED, bg: "#f2f2f2", label: "N/A" }
9111
9111
  };
9112
9112
  function ResultBadge({ result, size = "normal" }) {
9113
- var _a;
9114
- const cfg = (_a = resultConfig[result]) != null ? _a : resultConfig.na;
9113
+ var _a2;
9114
+ const cfg = (_a2 = resultConfig[result]) != null ? _a2 : resultConfig.na;
9115
9115
  const isNormal = size === "normal";
9116
9116
  return /* @__PURE__ */ jsxRuntime.jsx(
9117
9117
  "span",
@@ -9243,9 +9243,9 @@ function PartSection({ part, defaultOpen }) {
9243
9243
  ] });
9244
9244
  }
9245
9245
  function LegalTestResultResolver(p) {
9246
- var _a, _b;
9246
+ var _a2, _b;
9247
9247
  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: [
9248
+ 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
9249
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px", flexWrap: "wrap" }, children: [
9250
9250
  p.title && /* @__PURE__ */ jsxRuntime.jsx(
9251
9251
  "span",
@@ -9305,9 +9305,9 @@ function lineColor(left, right) {
9305
9305
  return "#d6d3d1";
9306
9306
  }
9307
9307
  function EngagementPipelineResolver(p) {
9308
- var _a, _b, _c, _d, _e;
9308
+ var _a2, _b, _c, _d, _e;
9309
9309
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
9310
- const phases = (_a = p.phases) != null ? _a : [];
9310
+ const phases = (_a2 = p.phases) != null ? _a2 : [];
9311
9311
  const defaultActive = phases.findIndex(
9312
9312
  (ph) => ph.status === "in-progress" || ph.status === "blocked"
9313
9313
  );
@@ -9391,8 +9391,8 @@ function EngagementPipelineResolver(p) {
9391
9391
  overflow: "auto"
9392
9392
  },
9393
9393
  children: ((_d = p.phases) != null ? _d : []).map((phase, i) => {
9394
- var _a2;
9395
- const color = (_a2 = statusColor2[phase.status]) != null ? _a2 : "#d6d3d1";
9394
+ var _a3;
9395
+ const color = (_a3 = statusColor2[phase.status]) != null ? _a3 : "#d6d3d1";
9396
9396
  const isCurrent = i === activeIdx;
9397
9397
  const size = isCurrent ? 28 : 20;
9398
9398
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
@@ -9700,10 +9700,10 @@ function Avatar({ name, avatar, hovered }) {
9700
9700
  );
9701
9701
  }
9702
9702
  function EntityCardGridResolver(p) {
9703
- var _a, _b;
9703
+ var _a2, _b;
9704
9704
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
9705
9705
  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: [
9706
+ 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
9707
  p.title && /* @__PURE__ */ jsxRuntime.jsx(
9708
9708
  "p",
9709
9709
  {
@@ -9783,8 +9783,8 @@ function EntityCardGridResolver(p) {
9783
9783
  ] })
9784
9784
  ] }),
9785
9785
  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;
9786
+ var _a3, _b2;
9787
+ const c = (_b2 = BADGE_COLORS[(_a3 = badge.color) != null ? _a3 : "gray"]) != null ? _b2 : BADGE_COLORS.gray;
9788
9788
  return /* @__PURE__ */ jsxRuntime.jsx(
9789
9789
  "span",
9790
9790
  {
@@ -9896,8 +9896,8 @@ function formatTime(ts) {
9896
9896
  }
9897
9897
  }
9898
9898
  function StepRow({ step }) {
9899
- var _a, _b, _c;
9900
- const color = (_a = stepStatusColors[step.status]) != null ? _a : exports.MUTED;
9899
+ var _a2, _b, _c;
9900
+ const color = (_a2 = stepStatusColors[step.status]) != null ? _a2 : exports.MUTED;
9901
9901
  return /* @__PURE__ */ jsxRuntime.jsxs(
9902
9902
  "div",
9903
9903
  {
@@ -9956,10 +9956,10 @@ function StepRow({ step }) {
9956
9956
  );
9957
9957
  }
9958
9958
  function JobTrackerResolver(p) {
9959
- var _a, _b, _c, _d, _e, _f, _g;
9959
+ var _a2, _b, _c, _d, _e, _f, _g;
9960
9960
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, PAPER: PAPER2 } = useTheme();
9961
9961
  const [stepsOpen, setStepsOpen] = React41.useState(true);
9962
- const barColor = (_a = statusColors2[p.status]) != null ? _a : MUTED2;
9962
+ const barColor = (_a2 = statusColors2[p.status]) != null ? _a2 : MUTED2;
9963
9963
  const badge = (_b = statusBadgeConfig[p.status]) != null ? _b : statusBadgeConfig.queued;
9964
9964
  const progress = (_c = p.progress) != null ? _c : p.status === "completed" ? 100 : 0;
9965
9965
  return /* @__PURE__ */ jsxRuntime.jsxs(ComponentActions, { filename: (_d = p.title) != null ? _d : "job-tracker", children: [
@@ -10227,8 +10227,8 @@ var sourceTypeColors = {
10227
10227
  workpaper: { bg: "#fff7ed", color: "#f59e0b" }
10228
10228
  };
10229
10229
  function getSourceTypeBadgeStyle(sourceType) {
10230
- var _a;
10231
- const entry = (_a = sourceTypeColors[sourceType]) != null ? _a : { bg: "#f2f2f2", color: exports.MUTED };
10230
+ var _a2;
10231
+ const entry = (_a2 = sourceTypeColors[sourceType]) != null ? _a2 : { bg: "#f2f2f2", color: exports.MUTED };
10232
10232
  return {
10233
10233
  display: "inline-block",
10234
10234
  fontSize: "9px",
@@ -10450,7 +10450,7 @@ function CitationMarker({
10450
10450
  );
10451
10451
  }
10452
10452
  function CitedAnswerResolver(p) {
10453
- var _a, _b, _c, _d, _e;
10453
+ var _a2, _b, _c, _d, _e;
10454
10454
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, SECONDARY: SECONDARY2 } = useTheme();
10455
10455
  const [expandedIds, setExpandedIds] = React41.useState(/* @__PURE__ */ new Set());
10456
10456
  const toggleCitation = (id) => {
@@ -10465,7 +10465,7 @@ function CitedAnswerResolver(p) {
10465
10465
  });
10466
10466
  };
10467
10467
  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(
10468
+ return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a2 = p.title) != null ? _a2 : "cited-answer", children: /* @__PURE__ */ jsxRuntime.jsxs(
10469
10469
  "div",
10470
10470
  {
10471
10471
  style: {
@@ -10583,8 +10583,8 @@ var CURRENCY_SYMBOLS = {
10583
10583
  BRL: "R$"
10584
10584
  };
10585
10585
  function getCurrencySymbol(currency) {
10586
- var _a;
10587
- return (_a = CURRENCY_SYMBOLS[currency.toUpperCase()]) != null ? _a : currency + " ";
10586
+ var _a2;
10587
+ return (_a2 = CURRENCY_SYMBOLS[currency.toUpperCase()]) != null ? _a2 : currency + " ";
10588
10588
  }
10589
10589
  function formatAmount(amount, currency) {
10590
10590
  const sym = getCurrencySymbol(currency);
@@ -10753,9 +10753,9 @@ function formatSummaryAmount(amount, currency) {
10753
10753
  return `${sym}${formatted}`;
10754
10754
  }
10755
10755
  function TransactionFeedResolver(p) {
10756
- var _a, _b, _c, _d, _e;
10756
+ var _a2, _b, _c, _d, _e;
10757
10757
  const { BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
10758
- const currency = (_a = p.currency) != null ? _a : "USD";
10758
+ const currency = (_a2 = p.currency) != null ? _a2 : "USD";
10759
10759
  const [hoveredIndex, setHoveredIndex] = React41.useState(null);
10760
10760
  const hasBalance = ((_b = p.transactions) != null ? _b : []).some((tx) => tx.balance != null);
10761
10761
  const totalInflows = p.transactions.filter((tx) => tx.amount > 0 && tx.status !== "reversed").reduce((sum, tx) => sum + tx.amount, 0);
@@ -10770,11 +10770,11 @@ function TransactionFeedResolver(p) {
10770
10770
  { key: "balance", label: "Balance" }
10771
10771
  ];
10772
10772
  const csvRows = ((_c = p.transactions) != null ? _c : []).map((tx) => {
10773
- var _a2, _b2, _c2;
10773
+ var _a3, _b2, _c2;
10774
10774
  return {
10775
10775
  date: tx.date,
10776
10776
  description: tx.description,
10777
- counterparty: (_a2 = tx.counterparty) != null ? _a2 : "",
10777
+ counterparty: (_a3 = tx.counterparty) != null ? _a3 : "",
10778
10778
  category: (_b2 = tx.category) != null ? _b2 : "",
10779
10779
  amount: tx.amount,
10780
10780
  balance: (_c2 = tx.balance) != null ? _c2 : ""
@@ -10792,8 +10792,8 @@ function TransactionFeedResolver(p) {
10792
10792
  {
10793
10793
  filename: (_d = p.title) != null ? _d : "transaction-feed",
10794
10794
  onDownloadCSV: () => {
10795
- var _a2;
10796
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "transaction-feed");
10795
+ var _a3;
10796
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "transaction-feed");
10797
10797
  },
10798
10798
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
10799
10799
  p.title && /* @__PURE__ */ jsxRuntime.jsx(
@@ -10831,7 +10831,7 @@ function TransactionFeedResolver(p) {
10831
10831
  }
10832
10832
  ),
10833
10833
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column" }, children: ((_e = p.transactions) != null ? _e : []).map((tx, i) => {
10834
- var _a2;
10834
+ var _a3;
10835
10835
  return /* @__PURE__ */ jsxRuntime.jsx(
10836
10836
  TransactionRow,
10837
10837
  {
@@ -10841,7 +10841,7 @@ function TransactionFeedResolver(p) {
10841
10841
  onMouseEnter: () => setHoveredIndex(i),
10842
10842
  onMouseLeave: () => setHoveredIndex(null)
10843
10843
  },
10844
- (_a2 = tx.id) != null ? _a2 : i
10844
+ (_a3 = tx.id) != null ? _a3 : i
10845
10845
  );
10846
10846
  }) }),
10847
10847
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -10898,10 +10898,10 @@ var docTypeConfig = {
10898
10898
  csv: { label: "CSV", color: "#7c3aed", bg: "#f5f3ff" }
10899
10899
  };
10900
10900
  function getDocConfig(docType) {
10901
- var _a;
10901
+ var _a2;
10902
10902
  if (!docType) return { label: "FILE", color: exports.MUTED, bg: "#f2f2f2" };
10903
10903
  const key = docType.toLowerCase().replace(/^\./, "");
10904
- return (_a = docTypeConfig[key]) != null ? _a : { label: key.toUpperCase().slice(0, 4), color: exports.MUTED, bg: "#f2f2f2" };
10904
+ return (_a2 = docTypeConfig[key]) != null ? _a2 : { label: key.toUpperCase().slice(0, 4), color: exports.MUTED, bg: "#f2f2f2" };
10905
10905
  }
10906
10906
  function formatDate2(dateStr) {
10907
10907
  if (!dateStr) return "";
@@ -10912,7 +10912,7 @@ function formatDate2(dateStr) {
10912
10912
  }
10913
10913
  }
10914
10914
  function FileRow({ item }) {
10915
- var _a;
10915
+ var _a2;
10916
10916
  const [hovered, setHovered] = React41.useState(false);
10917
10917
  const cfg = getDocConfig(item.docType);
10918
10918
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -10983,7 +10983,7 @@ function FileRow({ item }) {
10983
10983
  ] }),
10984
10984
  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
10985
  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) })
10986
+ (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
10987
  ]
10988
10988
  }
10989
10989
  );
@@ -11029,15 +11029,15 @@ function GroupSection({ groupName, items }) {
11029
11029
  }
11030
11030
  ),
11031
11031
  open && items.map((item, i) => {
11032
- var _a;
11033
- return /* @__PURE__ */ jsxRuntime.jsx(FileRow, { item }, (_a = item.id) != null ? _a : i);
11032
+ var _a2;
11033
+ return /* @__PURE__ */ jsxRuntime.jsx(FileRow, { item }, (_a2 = item.id) != null ? _a2 : i);
11034
11034
  })
11035
11035
  ] });
11036
11036
  }
11037
11037
  function FileBrowserResolver(p) {
11038
- var _a, _b, _c, _d;
11038
+ var _a2, _b, _c, _d;
11039
11039
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, PAPER: PAPER2 } = useTheme();
11040
- const items = (_a = p.items) != null ? _a : [];
11040
+ const items = (_a2 = p.items) != null ? _a2 : [];
11041
11041
  const hasGroups = items.some((item) => item.group);
11042
11042
  const groups = /* @__PURE__ */ new Map();
11043
11043
  if (hasGroups) {
@@ -11090,8 +11090,8 @@ function FileBrowserResolver(p) {
11090
11090
  fontSize: "13px",
11091
11091
  color: MUTED2
11092
11092
  }, 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);
11093
+ var _a3;
11094
+ return /* @__PURE__ */ jsxRuntime.jsx(FileRow, { item }, (_a3 = item.id) != null ? _a3 : i);
11095
11095
  })
11096
11096
  ] })
11097
11097
  ] }) });
@@ -11135,7 +11135,7 @@ var PREVIEW_EXTS = {
11135
11135
  docx: "docx"
11136
11136
  };
11137
11137
  function extOf(fileType, filename) {
11138
- var _a;
11138
+ var _a2;
11139
11139
  if (fileType && fileType.includes("/")) {
11140
11140
  const mime = fileType.toLowerCase();
11141
11141
  if (mime.includes("pdf")) return "pdf";
@@ -11148,11 +11148,11 @@ function extOf(fileType, filename) {
11148
11148
  const t = fileType.toLowerCase().replace(/[^a-z0-9]/g, "");
11149
11149
  if (t) return t;
11150
11150
  }
11151
- return ((_a = (filename || "").split(".").pop()) == null ? void 0 : _a.toLowerCase().replace(/[^a-z0-9]/g, "")) || "";
11151
+ return ((_a2 = (filename || "").split(".").pop()) == null ? void 0 : _a2.toLowerCase().replace(/[^a-z0-9]/g, "")) || "";
11152
11152
  }
11153
11153
  function previewKindFor(fileType, filename) {
11154
- var _a;
11155
- return (_a = PREVIEW_EXTS[extOf(fileType, filename)]) != null ? _a : null;
11154
+ var _a2;
11155
+ return (_a2 = PREVIEW_EXTS[extOf(fileType, filename)]) != null ? _a2 : null;
11156
11156
  }
11157
11157
  function isPreviewable(fileType, filename) {
11158
11158
  return previewKindFor(fileType, filename) !== null;
@@ -11730,8 +11730,8 @@ function Chevron({ open }) {
11730
11730
  );
11731
11731
  }
11732
11732
  function DownloadCardResolver(p) {
11733
- var _a, _b;
11734
- const files = (_a = p.files) != null ? _a : [];
11733
+ var _a2, _b;
11734
+ const files = (_a2 = p.files) != null ? _a2 : [];
11735
11735
  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
11736
  p.title && /* @__PURE__ */ jsxRuntime.jsx(
11737
11737
  "p",
@@ -11903,10 +11903,10 @@ function ServiceCard({ item, isHovered, onHover, onLeave: onLeave2 }) {
11903
11903
  );
11904
11904
  }
11905
11905
  function OpsDashboardResolver(p) {
11906
- var _a, _b, _c;
11906
+ var _a2, _b, _c;
11907
11907
  const { BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
11908
11908
  const [hoveredId, setHoveredId] = React41.useState(null);
11909
- const hasRunning = ((_a = p.items) != null ? _a : []).some((item) => item.state === "running");
11909
+ const hasRunning = ((_a2 = p.items) != null ? _a2 : []).some((item) => item.state === "running");
11910
11910
  return /* @__PURE__ */ jsxRuntime.jsxs(ComponentActions, { filename: (_b = p.title) != null ? _b : "ops-dashboard", children: [
11911
11911
  hasRunning && /* @__PURE__ */ jsxRuntime.jsx("style", { children: PULSE_KEYFRAMES }),
11912
11912
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
@@ -11990,8 +11990,8 @@ function CopyButton({ value, rowHovered }) {
11990
11990
  );
11991
11991
  }
11992
11992
  function ValueCell({ item }) {
11993
- var _a, _b;
11994
- const t = (_a = item.type) != null ? _a : "text";
11993
+ var _a2, _b;
11994
+ const t = (_a2 = item.type) != null ? _a2 : "text";
11995
11995
  switch (t) {
11996
11996
  case "url":
11997
11997
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -12098,9 +12098,9 @@ function ItemsList({ items, isLastGroup, indexOffset }) {
12098
12098
  )) });
12099
12099
  }
12100
12100
  function KeyValueListResolver(p) {
12101
- var _a, _b, _c;
12101
+ var _a2, _b, _c;
12102
12102
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, SECONDARY: SECONDARY2 } = useTheme();
12103
- const groups = (_a = p.groups) != null ? _a : [];
12103
+ const groups = (_a2 = p.groups) != null ? _a2 : [];
12104
12104
  const items = (_b = p.items) != null ? _b : [];
12105
12105
  const hasGroups = groups.length > 0;
12106
12106
  const hasItems = items.length > 0;
@@ -12129,12 +12129,12 @@ function KeyValueListResolver(p) {
12129
12129
  },
12130
12130
  children: [
12131
12131
  hasGroups && groups.map((group, gi) => {
12132
- var _a2;
12133
- const groupItems = (_a2 = group.items) != null ? _a2 : [];
12132
+ var _a3;
12133
+ const groupItems = (_a3 = group.items) != null ? _a3 : [];
12134
12134
  const isLastGroup = gi === groups.length - 1 && !hasItems;
12135
12135
  const prevItemCount = groups.slice(0, gi).reduce((sum, g) => {
12136
- var _a3;
12137
- return sum + ((_a3 = g.items) != null ? _a3 : []).length;
12136
+ var _a4;
12137
+ return sum + ((_a4 = g.items) != null ? _a4 : []).length;
12138
12138
  }, 0);
12139
12139
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
12140
12140
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -12169,8 +12169,8 @@ function KeyValueListResolver(p) {
12169
12169
  ] }, gi);
12170
12170
  }),
12171
12171
  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;
12172
+ var _a3;
12173
+ return sum + ((_a3 = g.items) != null ? _a3 : []).length;
12174
12174
  }, 0) : 0 })
12175
12175
  ]
12176
12176
  }
@@ -12188,24 +12188,24 @@ var categoryLabels2 = {
12188
12188
  function computeSectionTotal(section) {
12189
12189
  if (section.total) return section.total;
12190
12190
  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));
12191
+ var _a2, _b, _c;
12192
+ 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
12193
  }, 0);
12194
12194
  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);
12195
+ var _a2, _b, _c;
12196
+ return sum + ((_c = (_a2 = sub.subtotal) == null ? void 0 : _a2.priorPeriod) != null ? _c : ((_b = sub.items) != null ? _b : []).reduce((s, i) => {
12197
+ var _a3;
12198
+ return s + ((_a3 = i.priorPeriod) != null ? _a3 : 0);
12199
12199
  }, 0));
12200
12200
  }, 0);
12201
12201
  return { currentPeriod, priorPeriod: priorPeriod || void 0 };
12202
12202
  }
12203
12203
  function BalanceSheetResolver(p) {
12204
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
12204
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
12205
12205
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
12206
12206
  const hasPrior = !!p.priorPeriodLabel;
12207
12207
  const colSpan = hasPrior ? 3 : 2;
12208
- const sectionTotals = new Map(((_a = p.sections) != null ? _a : []).map((s) => [s.category, computeSectionTotal(s)]));
12208
+ const sectionTotals = new Map(((_a2 = p.sections) != null ? _a2 : []).map((s) => [s.category, computeSectionTotal(s)]));
12209
12209
  const assetsTotal = (_c = (_b = sectionTotals.get("assets")) == null ? void 0 : _b.currentPeriod) != null ? _c : 0;
12210
12210
  let leTotal;
12211
12211
  if (p.totalLiabilitiesAndEquity) {
@@ -12224,22 +12224,22 @@ function BalanceSheetResolver(p) {
12224
12224
  const csvRows = ((_j = p.sections) != null ? _j : []).flatMap(
12225
12225
  (section) => section.subsections.flatMap(
12226
12226
  (sub) => {
12227
- var _a2;
12228
- return ((_a2 = sub.items) != null ? _a2 : []).map((item) => {
12229
- var _a3;
12227
+ var _a3;
12228
+ return ((_a3 = sub.items) != null ? _a3 : []).map((item) => {
12229
+ var _a4;
12230
12230
  return __spreadValues({
12231
12231
  category: section.category,
12232
12232
  subsection: sub.label,
12233
12233
  name: item.name,
12234
12234
  currentPeriod: item.currentPeriod
12235
- }, hasPrior ? { priorPeriod: (_a3 = item.priorPeriod) != null ? _a3 : "" } : {});
12235
+ }, hasPrior ? { priorPeriod: (_a4 = item.priorPeriod) != null ? _a4 : "" } : {});
12236
12236
  });
12237
12237
  }
12238
12238
  )
12239
12239
  );
12240
12240
  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");
12241
+ var _a3;
12242
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "balance-sheet");
12243
12243
  }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
12244
12244
  p.metadata && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "2px", position: "relative" }, children: [
12245
12245
  p.metadata.status && /* @__PURE__ */ jsxRuntime.jsx("span", { style: {
@@ -12313,7 +12313,7 @@ function BalanceSheetResolver(p) {
12313
12313
  ] }) }),
12314
12314
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
12315
12315
  ((_p = p.sections) != null ? _p : []).map((section) => {
12316
- var _a2;
12316
+ var _a3;
12317
12317
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
12318
12318
  /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan, style: {
12319
12319
  padding: "8px 12px",
@@ -12324,9 +12324,9 @@ function BalanceSheetResolver(p) {
12324
12324
  borderBottom: `1px solid ${BORDER4}`,
12325
12325
  textTransform: "uppercase",
12326
12326
  letterSpacing: "0.04em"
12327
- }, children: (_a2 = categoryLabels2[section.category]) != null ? _a2 : section.category }) }),
12327
+ }, children: (_a3 = categoryLabels2[section.category]) != null ? _a3 : section.category }) }),
12328
12328
  section.subsections.map((sub, si) => {
12329
- var _a3;
12329
+ var _a4;
12330
12330
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
12331
12331
  /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan, style: {
12332
12332
  padding: "6px 10px 6px 24px",
@@ -12335,7 +12335,7 @@ function BalanceSheetResolver(p) {
12335
12335
  color: "var(--foreground)",
12336
12336
  borderBottom: `1px solid #f2f2f2`
12337
12337
  }, children: sub.label }) }),
12338
- ((_a3 = sub.items) != null ? _a3 : []).map((item, ii) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: { background: "white" }, children: [
12338
+ ((_a4 = sub.items) != null ? _a4 : []).map((item, ii) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: { background: "white" }, children: [
12339
12339
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: { padding: "6px 10px 6px 40px", fontSize: "13px", color: "var(--foreground)", borderBottom: `1px solid #f2f2f2` }, children: item.name }),
12340
12340
  /* @__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
12341
  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 +12351,12 @@ function BalanceSheetResolver(p) {
12351
12351
  ] }, si);
12352
12352
  }),
12353
12353
  (() => {
12354
- var _a3;
12354
+ var _a4;
12355
12355
  const total = sectionTotals.get(section.category);
12356
12356
  return /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: { background: PAPER2 }, children: [
12357
12357
  /* @__PURE__ */ jsxRuntime.jsxs("td", { style: { padding: "8px 10px", fontSize: "12px", fontWeight: 600, borderTop: `1px solid ${BORDER4}`, borderBottom: `1px solid ${BORDER4}` }, children: [
12358
12358
  "Total ",
12359
- (_a3 = categoryLabels2[section.category]) != null ? _a3 : section.category
12359
+ (_a4 = categoryLabels2[section.category]) != null ? _a4 : section.category
12360
12360
  ] }),
12361
12361
  /* @__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
12362
  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 +12386,23 @@ var pctFmt2 = (amount, revenue) => {
12386
12386
  return `${(amount / revenue * 100).toFixed(1)}%`;
12387
12387
  };
12388
12388
  function IncomeStatementResolver(p) {
12389
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
12389
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
12390
12390
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
12391
- const currency = (_a = p.currency) != null ? _a : "USD";
12391
+ const currency = (_a2 = p.currency) != null ? _a2 : "USD";
12392
12392
  const periods = (_b = p.periods) != null ? _b : [];
12393
12393
  const sections = (_c = p.sections) != null ? _c : [];
12394
12394
  const calculatedTotals = (_d = p.calculatedTotals) != null ? _d : {};
12395
12395
  const showPct = (_e = p.showPercentOfRevenue) != null ? _e : false;
12396
12396
  const isTotalRow = (li) => {
12397
- var _a2;
12398
- return li.isSubtotal === true || /^\s*(total|subtotal)\b/i.test((_a2 = li.name) != null ? _a2 : "");
12397
+ var _a3;
12398
+ return li.isSubtotal === true || /^\s*(total|subtotal)\b/i.test((_a3 = li.name) != null ? _a3 : "");
12399
12399
  };
12400
12400
  const revenueTotals = periods.map(
12401
12401
  (_, 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);
12402
+ var _a3, _b2, _c2;
12403
+ return (_c2 = ((_b2 = (_a3 = sections[0]) == null ? void 0 : _a3.lineItems) != null ? _b2 : []).filter((li) => !isTotalRow(li)).reduce((sum, li) => {
12404
+ var _a4, _b3;
12405
+ return sum + ((_b3 = ((_a4 = li.amounts) != null ? _a4 : [])[pi]) != null ? _b3 : 0);
12406
12406
  }, 0)) != null ? _c2 : 0;
12407
12407
  }
12408
12408
  );
@@ -12416,8 +12416,8 @@ function IncomeStatementResolver(p) {
12416
12416
  for (const li of (_f = section.lineItems) != null ? _f : []) {
12417
12417
  const row = { section: section.label, name: li.name };
12418
12418
  periods.forEach((period, pi) => {
12419
- var _a2, _b2;
12420
- row[period] = (_b2 = ((_a2 = li.amounts) != null ? _a2 : [])[pi]) != null ? _b2 : 0;
12419
+ var _a3, _b2;
12420
+ row[period] = (_b2 = ((_a3 = li.amounts) != null ? _a3 : [])[pi]) != null ? _b2 : 0;
12421
12421
  });
12422
12422
  csvRows.push(row);
12423
12423
  }
@@ -12426,13 +12426,13 @@ function IncomeStatementResolver(p) {
12426
12426
  const operatingIncome = calculatedTotals.operatingIncome;
12427
12427
  const rawNetIncome = calculatedTotals.netIncome;
12428
12428
  const netIncome = rawNetIncome && rawNetIncome.length > 0 ? rawNetIncome : periods.map((_, pi) => {
12429
- var _a2;
12429
+ var _a3;
12430
12430
  let total = 0;
12431
12431
  for (const section of sections) {
12432
- const sectionSum = ((_a2 = section.lineItems) != null ? _a2 : []).reduce(
12432
+ const sectionSum = ((_a3 = section.lineItems) != null ? _a3 : []).reduce(
12433
12433
  (s, li) => {
12434
- var _a3, _b2;
12435
- return s + ((_b2 = ((_a3 = li.amounts) != null ? _a3 : [])[pi]) != null ? _b2 : 0);
12434
+ var _a4, _b2;
12435
+ return s + ((_b2 = ((_a4 = li.amounts) != null ? _a4 : [])[pi]) != null ? _b2 : 0);
12436
12436
  },
12437
12437
  0
12438
12438
  );
@@ -12443,31 +12443,31 @@ function IncomeStatementResolver(p) {
12443
12443
  if (grossProfit) {
12444
12444
  const row = { section: "", name: "GROSS PROFIT" };
12445
12445
  periods.forEach((period, pi) => {
12446
- var _a2;
12447
- row[period] = (_a2 = grossProfit[pi]) != null ? _a2 : 0;
12446
+ var _a3;
12447
+ row[period] = (_a3 = grossProfit[pi]) != null ? _a3 : 0;
12448
12448
  });
12449
12449
  csvRows.push(row);
12450
12450
  }
12451
12451
  if (operatingIncome) {
12452
12452
  const row = { section: "", name: "OPERATING INCOME" };
12453
12453
  periods.forEach((period, pi) => {
12454
- var _a2;
12455
- row[period] = (_a2 = operatingIncome[pi]) != null ? _a2 : 0;
12454
+ var _a3;
12455
+ row[period] = (_a3 = operatingIncome[pi]) != null ? _a3 : 0;
12456
12456
  });
12457
12457
  csvRows.push(row);
12458
12458
  }
12459
12459
  {
12460
12460
  const row = { section: "", name: "NET INCOME" };
12461
12461
  periods.forEach((period, pi) => {
12462
- var _a2;
12463
- row[period] = (_a2 = netIncome[pi]) != null ? _a2 : 0;
12462
+ var _a3;
12463
+ row[period] = (_a3 = netIncome[pi]) != null ? _a3 : 0;
12464
12464
  });
12465
12465
  csvRows.push(row);
12466
12466
  }
12467
12467
  const colCount = showPct ? 1 + periods.length * 2 : 1 + periods.length;
12468
12468
  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");
12469
+ var _a3;
12470
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "income-statement");
12471
12471
  }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
12472
12472
  p.metadata && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "2px", position: "relative" }, children: [
12473
12473
  p.metadata.status && /* @__PURE__ */ jsxRuntime.jsx("span", { style: {
@@ -12532,7 +12532,7 @@ function IncomeStatementResolver(p) {
12532
12532
  ] }) }),
12533
12533
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
12534
12534
  sections.map((section, si) => {
12535
- var _a2;
12535
+ var _a3;
12536
12536
  const isSubtotal = section.sectionType === "subtotal";
12537
12537
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
12538
12538
  /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan: colCount, style: {
@@ -12545,9 +12545,9 @@ function IncomeStatementResolver(p) {
12545
12545
  textTransform: "uppercase",
12546
12546
  letterSpacing: "0.04em"
12547
12547
  }, 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;
12548
+ ((_a3 = section.lineItems) != null ? _a3 : []).map((li, li_i) => {
12549
+ var _a4, _b2;
12550
+ const indent = (_a4 = li.indent) != null ? _a4 : 0;
12551
12551
  const amounts = (_b2 = li.amounts) != null ? _b2 : [];
12552
12552
  return /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: {
12553
12553
  background: isSubtotal ? PAPER2 : "white",
@@ -12562,8 +12562,8 @@ function IncomeStatementResolver(p) {
12562
12562
  borderBottom: `1px solid #f2f2f2`
12563
12563
  }, children: li.name }),
12564
12564
  periods.map((_, pi) => {
12565
- var _a4;
12566
- const val = (_a4 = amounts[pi]) != null ? _a4 : 0;
12565
+ var _a5;
12566
+ const val = (_a5 = amounts[pi]) != null ? _a5 : 0;
12567
12567
  const isNeg = val < 0;
12568
12568
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
12569
12569
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: {
@@ -12597,8 +12597,8 @@ function IncomeStatementResolver(p) {
12597
12597
  borderBottom: `1px solid ${BORDER4}`
12598
12598
  }, children: "GROSS PROFIT" }),
12599
12599
  periods.map((_, pi) => {
12600
- var _a2;
12601
- const val = (_a2 = grossProfit[pi]) != null ? _a2 : 0;
12600
+ var _a3;
12601
+ const val = (_a3 = grossProfit[pi]) != null ? _a3 : 0;
12602
12602
  const isNeg = val < 0;
12603
12603
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
12604
12604
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: {
@@ -12632,8 +12632,8 @@ function IncomeStatementResolver(p) {
12632
12632
  borderBottom: `1px solid ${BORDER4}`
12633
12633
  }, children: "OPERATING INCOME" }),
12634
12634
  periods.map((_, pi) => {
12635
- var _a2;
12636
- const val = (_a2 = operatingIncome[pi]) != null ? _a2 : 0;
12635
+ var _a3;
12636
+ const val = (_a3 = operatingIncome[pi]) != null ? _a3 : 0;
12637
12637
  const isNeg = val < 0;
12638
12638
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
12639
12639
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: {
@@ -12666,8 +12666,8 @@ function IncomeStatementResolver(p) {
12666
12666
  borderTop: `2px solid ${BORDER4}`
12667
12667
  }, children: "NET INCOME" }),
12668
12668
  periods.map((_, pi) => {
12669
- var _a2;
12670
- const val = (_a2 = netIncome[pi]) != null ? _a2 : 0;
12669
+ var _a3;
12670
+ const val = (_a3 = netIncome[pi]) != null ? _a3 : 0;
12671
12671
  const isNeg = val < 0;
12672
12672
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
12673
12673
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: {
@@ -12712,17 +12712,17 @@ var fmt9 = (v, currency) => {
12712
12712
  return v < 0 ? `(${formatted})` : formatted;
12713
12713
  };
12714
12714
  function deriveNetCash(a) {
12715
- var _a;
12715
+ var _a2;
12716
12716
  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);
12717
+ return ((_a2 = a.lineItems) != null ? _a2 : []).filter((li) => !li.isSubtotal).reduce((sum, li) => sum + li.amount, 0);
12718
12718
  }
12719
12719
  function CashFlowStatementResolver(p) {
12720
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
12720
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
12721
12721
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
12722
- const activities = ((_a = p.activities) != null ? _a : []).map((a) => {
12723
- var _a2;
12722
+ const activities = ((_a2 = p.activities) != null ? _a2 : []).map((a) => {
12723
+ var _a3;
12724
12724
  return __spreadProps(__spreadValues({}, a), {
12725
- lineItems: (_a2 = a.lineItems) != null ? _a2 : [],
12725
+ lineItems: (_a3 = a.lineItems) != null ? _a3 : [],
12726
12726
  netCash: deriveNetCash(a)
12727
12727
  });
12728
12728
  });
@@ -12741,19 +12741,19 @@ function CashFlowStatementResolver(p) {
12741
12741
  ...hasPrior ? [{ key: "priorAmount", label: priorLabel }] : []
12742
12742
  ];
12743
12743
  const csvRows = activities.flatMap((a) => {
12744
- var _a2, _b2, _c2, _d2;
12744
+ var _a3, _b2, _c2, _d2;
12745
12745
  return [
12746
12746
  ...a.lineItems.map((li) => {
12747
- var _a3, _b3;
12747
+ var _a4, _b3;
12748
12748
  return {
12749
- activity: (_a3 = activityLabels[a.activityType]) != null ? _a3 : a.activityType,
12749
+ activity: (_a4 = activityLabels[a.activityType]) != null ? _a4 : a.activityType,
12750
12750
  name: li.name,
12751
12751
  amount: li.amount,
12752
12752
  priorAmount: (_b3 = li.priorAmount) != null ? _b3 : ""
12753
12753
  };
12754
12754
  }),
12755
12755
  {
12756
- activity: (_a2 = activityLabels[a.activityType]) != null ? _a2 : a.activityType,
12756
+ activity: (_a3 = activityLabels[a.activityType]) != null ? _a3 : a.activityType,
12757
12757
  name: `Net Cash from ${(_c2 = (_b2 = activityLabels[a.activityType]) == null ? void 0 : _b2.replace("Cash Flows from ", "")) != null ? _c2 : a.activityType}`,
12758
12758
  amount: a.netCash,
12759
12759
  priorAmount: (_d2 = a.priorNetCash) != null ? _d2 : ""
@@ -12766,8 +12766,8 @@ function CashFlowStatementResolver(p) {
12766
12766
  {
12767
12767
  filename: (_e = p.title) != null ? _e : "cash-flow-statement",
12768
12768
  onDownloadCSV: () => {
12769
- var _a2;
12770
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "cash-flow-statement");
12769
+ var _a3;
12770
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "cash-flow-statement");
12771
12771
  },
12772
12772
  children: /* @__PURE__ */ jsxRuntime.jsxs(
12773
12773
  "div",
@@ -12888,7 +12888,7 @@ function CashFlowStatementResolver(p) {
12888
12888
  ] }) }),
12889
12889
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
12890
12890
  activities.map((activity, ai) => {
12891
- var _a2, _b2, _c2;
12891
+ var _a3, _b2, _c2;
12892
12892
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
12893
12893
  ai > 0 && /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx(
12894
12894
  "td",
@@ -12911,12 +12911,12 @@ function CashFlowStatementResolver(p) {
12911
12911
  textTransform: "uppercase",
12912
12912
  letterSpacing: "0.04em"
12913
12913
  },
12914
- children: (_a2 = activityLabels[activity.activityType]) != null ? _a2 : activity.activityType
12914
+ children: (_a3 = activityLabels[activity.activityType]) != null ? _a3 : activity.activityType
12915
12915
  }
12916
12916
  ) }),
12917
12917
  activity.lineItems.map((li, li_i) => {
12918
- var _a3, _b3;
12919
- const indent = (_a3 = li.indent) != null ? _a3 : 0;
12918
+ var _a4, _b3;
12919
+ const indent = (_a4 = li.indent) != null ? _a4 : 0;
12920
12920
  const isSub = (_b3 = li.isSubtotal) != null ? _b3 : false;
12921
12921
  return /* @__PURE__ */ jsxRuntime.jsxs(
12922
12922
  "tr",
@@ -13185,7 +13185,7 @@ var formatDate4 = (iso) => {
13185
13185
  };
13186
13186
  var accountTypeBadge = ACCOUNT_TYPE_COLORS;
13187
13187
  function GeneralLedgerResolver(p) {
13188
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
13188
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
13189
13189
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
13190
13190
  const csvCols = [
13191
13191
  { key: "date", label: "Date" },
@@ -13195,11 +13195,11 @@ function GeneralLedgerResolver(p) {
13195
13195
  { key: "credit", label: "Credit" },
13196
13196
  { key: "runningBalance", label: "Balance" }
13197
13197
  ];
13198
- const csvRows = ((_a = p.transactions) != null ? _a : []).map((t) => {
13199
- var _a2;
13198
+ const csvRows = ((_a2 = p.transactions) != null ? _a2 : []).map((t) => {
13199
+ var _a3;
13200
13200
  return {
13201
13201
  date: t.date,
13202
- reference: (_a2 = t.reference) != null ? _a2 : "",
13202
+ reference: (_a3 = t.reference) != null ? _a3 : "",
13203
13203
  description: t.description,
13204
13204
  debit: t.debit,
13205
13205
  credit: t.credit,
@@ -13212,8 +13212,8 @@ function GeneralLedgerResolver(p) {
13212
13212
  {
13213
13213
  filename: (_d = p.title) != null ? _d : "general-ledger",
13214
13214
  onDownloadCSV: () => {
13215
- var _a2;
13216
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "general-ledger");
13215
+ var _a3;
13216
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "general-ledger");
13217
13217
  },
13218
13218
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
13219
13219
  p.title && /* @__PURE__ */ jsxRuntime.jsx(
@@ -13471,14 +13471,14 @@ var fmt11 = (v, currency) => {
13471
13471
  return v < 0 ? `(${s})` : s;
13472
13472
  };
13473
13473
  function ChartOfAccountsResolver(p) {
13474
- var _a, _b, _c, _d, _e, _f, _g;
13474
+ var _a2, _b, _c, _d, _e, _f, _g;
13475
13475
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
13476
- const hasSubType = ((_a = p.accounts) != null ? _a : []).some((a) => a.subType);
13476
+ const hasSubType = ((_a2 = p.accounts) != null ? _a2 : []).some((a) => a.subType);
13477
13477
  const showBalances = (_b = p.showBalances) != null ? _b : false;
13478
13478
  const currency = (_c = p.currency) != null ? _c : "USD";
13479
13479
  const activeCount = ((_d = p.accounts) != null ? _d : []).filter((a) => {
13480
- var _a2;
13481
- return !a.isHeader && ((_a2 = a.status) != null ? _a2 : "active") === "active";
13480
+ var _a3;
13481
+ return !a.isHeader && ((_a3 = a.status) != null ? _a3 : "active") === "active";
13482
13482
  }).length;
13483
13483
  const inactiveCount = ((_e = p.accounts) != null ? _e : []).filter((a) => !a.isHeader && a.status === "inactive").length;
13484
13484
  const csvCols = [
@@ -13490,12 +13490,12 @@ function ChartOfAccountsResolver(p) {
13490
13490
  ...showBalances ? [{ key: "balance", label: "Balance" }] : []
13491
13491
  ];
13492
13492
  const csvRows = p.accounts.filter((a) => !a.isHeader).map((a) => {
13493
- var _a2, _b2, _c2;
13493
+ var _a3, _b2, _c2;
13494
13494
  return {
13495
13495
  code: a.code,
13496
13496
  name: a.name,
13497
13497
  accountType: a.accountType,
13498
- subType: (_a2 = a.subType) != null ? _a2 : "",
13498
+ subType: (_a3 = a.subType) != null ? _a3 : "",
13499
13499
  status: ((_b2 = a.status) != null ? _b2 : "active").charAt(0).toUpperCase() + ((_c2 = a.status) != null ? _c2 : "active").slice(1),
13500
13500
  balance: a.balance != null ? a.balance : ""
13501
13501
  };
@@ -13505,8 +13505,8 @@ function ChartOfAccountsResolver(p) {
13505
13505
  {
13506
13506
  filename: (_f = p.title) != null ? _f : "chart-of-accounts",
13507
13507
  onDownloadCSV: () => {
13508
- var _a2;
13509
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "chart-of-accounts");
13508
+ var _a3;
13509
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "chart-of-accounts");
13510
13510
  },
13511
13511
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
13512
13512
  p.title && /* @__PURE__ */ jsxRuntime.jsx(
@@ -13638,9 +13638,9 @@ function ChartOfAccountsResolver(p) {
13638
13638
  )
13639
13639
  ] }) }),
13640
13640
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: ((_g = p.accounts) != null ? _g : []).map((account, ri) => {
13641
- var _a2, _b2, _c2;
13641
+ var _a3, _b2, _c2;
13642
13642
  const isInactive = account.status === "inactive";
13643
- const indent = (_a2 = account.indent) != null ? _a2 : 0;
13643
+ const indent = (_a3 = account.indent) != null ? _a3 : 0;
13644
13644
  if (account.isHeader) {
13645
13645
  const colSpan = 3 + (hasSubType ? 1 : 0) + 1 + (showBalances ? 1 : 0);
13646
13646
  return /* @__PURE__ */ jsxRuntime.jsx("tr", { style: { background: PAPER2 }, children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -13829,9 +13829,9 @@ var formatDate5 = (d) => {
13829
13829
  }
13830
13830
  };
13831
13831
  function InvoiceDetailResolver(p) {
13832
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
13832
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
13833
13833
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
13834
- const statusStyle = (_a = STATUS_COLORS2[p.status]) != null ? _a : STATUS_COLORS2.void;
13834
+ const statusStyle = (_a2 = STATUS_COLORS2[p.status]) != null ? _a2 : STATUS_COLORS2.void;
13835
13835
  const isOverdue = p.status === "overdue";
13836
13836
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: `invoice-${p.invoiceNumber}`, children: /* @__PURE__ */ jsxRuntime.jsxs(
13837
13837
  "div",
@@ -14310,7 +14310,7 @@ function InvoiceDetailResolver(p) {
14310
14310
  h
14311
14311
  )) }) }),
14312
14312
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: ((_q = p.payments) != null ? _q : []).map((pmt, i) => {
14313
- var _a2;
14313
+ var _a3;
14314
14314
  return /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
14315
14315
  /* @__PURE__ */ jsxRuntime.jsx(
14316
14316
  "td",
@@ -14358,7 +14358,7 @@ function InvoiceDetailResolver(p) {
14358
14358
  color: MUTED2,
14359
14359
  borderBottom: `1px solid #f2f2f2`
14360
14360
  },
14361
- children: (_a2 = pmt.reference) != null ? _a2 : "\u2014"
14361
+ children: (_a3 = pmt.reference) != null ? _a3 : "\u2014"
14362
14362
  }
14363
14363
  )
14364
14364
  ] }, i);
@@ -14446,14 +14446,14 @@ var tdStyle2 = (align = "left", last = false) => ({
14446
14446
  whiteSpace: "nowrap"
14447
14447
  });
14448
14448
  function AmortizationTableResolver(p) {
14449
- var _a, _b, _c, _d, _e, _f, _g;
14449
+ var _a2, _b, _c, _d, _e, _f, _g;
14450
14450
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
14451
- const currency = (_a = p.currency) != null ? _a : "USD";
14451
+ const currency = (_a2 = p.currency) != null ? _a2 : "USD";
14452
14452
  const payments = (_b = p.payments) != null ? _b : [];
14453
14453
  const hasDate = payments.some((r) => r.paymentDate);
14454
14454
  const hasExtra = payments.some((r) => {
14455
- var _a2;
14456
- return ((_a2 = r.extra) != null ? _a2 : 0) > 0;
14455
+ var _a3;
14456
+ return ((_a3 = r.extra) != null ? _a3 : 0) > 0;
14457
14457
  });
14458
14458
  const derivedMonthly = payments.length > 0 ? payments[0].payment : 0;
14459
14459
  const derivedTotalInterest = payments.reduce((s, r) => s + r.interest, 0);
@@ -14474,10 +14474,10 @@ function AmortizationTableResolver(p) {
14474
14474
  { key: "balance", label: "Balance" }
14475
14475
  ];
14476
14476
  const csvRows = payments.map((r) => {
14477
- var _a2, _b2;
14477
+ var _a3, _b2;
14478
14478
  return {
14479
14479
  period: r.period,
14480
- paymentDate: (_a2 = r.paymentDate) != null ? _a2 : "",
14480
+ paymentDate: (_a3 = r.paymentDate) != null ? _a3 : "",
14481
14481
  payment: r.payment,
14482
14482
  principal: r.principal,
14483
14483
  interest: r.interest,
@@ -14490,8 +14490,8 @@ function AmortizationTableResolver(p) {
14490
14490
  {
14491
14491
  filename: (_g = p.title) != null ? _g : "amortization-table",
14492
14492
  onDownloadCSV: () => {
14493
- var _a2;
14494
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "amortization-table");
14493
+ var _a3;
14494
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "amortization-table");
14495
14495
  },
14496
14496
  children: /* @__PURE__ */ jsxRuntime.jsxs(
14497
14497
  "div",
@@ -14733,7 +14733,7 @@ function AmortizationTableResolver(p) {
14733
14733
  /* @__PURE__ */ jsxRuntime.jsx("th", { style: thStyle3("right"), children: "Balance" })
14734
14734
  ] }) }),
14735
14735
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: payments.map((row, ri) => {
14736
- var _a2, _b2, _c2, _d2;
14736
+ var _a3, _b2, _c2, _d2;
14737
14737
  const isLast = ri === payments.length - 1;
14738
14738
  const principalPct = row.payment > 0 ? Math.min(row.principal / row.payment * 100, 100) : 0;
14739
14739
  const balanceIsZero = originalAmount > 0 && row.balance < originalAmount * 0.01;
@@ -14783,7 +14783,7 @@ function AmortizationTableResolver(p) {
14783
14783
  }
14784
14784
  )
14785
14785
  ] }),
14786
- hasDate && /* @__PURE__ */ jsxRuntime.jsx("td", { style: tdStyle2("left", isLast), children: (_a2 = row.paymentDate) != null ? _a2 : "\u2014" }),
14786
+ hasDate && /* @__PURE__ */ jsxRuntime.jsx("td", { style: tdStyle2("left", isLast), children: (_a3 = row.paymentDate) != null ? _a3 : "\u2014" }),
14787
14787
  /* @__PURE__ */ jsxRuntime.jsx("td", { style: tdStyle2("right", isLast), children: fmt13(row.payment, currency) }),
14788
14788
  /* @__PURE__ */ jsxRuntime.jsx(
14789
14789
  "td",
@@ -14862,9 +14862,9 @@ var TH_STYLE = {
14862
14862
  };
14863
14863
  var TH_RIGHT = __spreadProps(__spreadValues({}, TH_STYLE), { textAlign: "right" });
14864
14864
  function DepreciationScheduleResolver(p) {
14865
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
14865
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
14866
14866
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
14867
- const currency = (_a = p.currency) != null ? _a : "USD";
14867
+ const currency = (_a2 = p.currency) != null ? _a2 : "USD";
14868
14868
  const fmt18 = (v) => {
14869
14869
  if (v === 0) return "\u2014";
14870
14870
  return new Intl.NumberFormat("en-US", {
@@ -14907,11 +14907,11 @@ function DepreciationScheduleResolver(p) {
14907
14907
  { key: "bookValue", label: "Book Value" }
14908
14908
  ];
14909
14909
  const csvRows = ((_g = p.assets) != null ? _g : []).map((a) => {
14910
- var _a2, _b2, _c2, _d2;
14910
+ var _a3, _b2, _c2, _d2;
14911
14911
  return {
14912
14912
  id: a.id,
14913
14913
  name: a.name,
14914
- category: (_a2 = a.category) != null ? _a2 : "",
14914
+ category: (_a3 = a.category) != null ? _a3 : "",
14915
14915
  acquiredDate: a.acquiredDate,
14916
14916
  cost: a.cost,
14917
14917
  usefulLife: (_b2 = a.usefulLife) != null ? _b2 : "",
@@ -14926,8 +14926,8 @@ function DepreciationScheduleResolver(p) {
14926
14926
  {
14927
14927
  filename: (_h = p.title) != null ? _h : "depreciation-schedule",
14928
14928
  onDownloadCSV: () => {
14929
- var _a2;
14930
- return downloadCSV(csvCols, csvRows, (_a2 = p.title) != null ? _a2 : "depreciation-schedule");
14929
+ var _a3;
14930
+ return downloadCSV(csvCols, csvRows, (_a3 = p.title) != null ? _a3 : "depreciation-schedule");
14931
14931
  },
14932
14932
  children: /* @__PURE__ */ jsxRuntime.jsxs(
14933
14933
  "div",
@@ -15007,7 +15007,7 @@ function DepreciationScheduleResolver(p) {
15007
15007
  ] }) }),
15008
15008
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
15009
15009
  ((_i = p.assets) != null ? _i : []).map((asset, ri) => {
15010
- var _a2, _b2, _c2;
15010
+ var _a3, _b2, _c2;
15011
15011
  const catColor = asset.category && CATEGORY_COLORS[asset.category] || DEFAULT_CATEGORY_COLOR;
15012
15012
  const bvRatio = asset.cost > 0 ? asset.bookValue / asset.cost : 0;
15013
15013
  const barColor = bvRatio > 0.5 ? "#15803d" : bvRatio > 0.2 ? "#f59e0b" : "#dc2626";
@@ -15091,7 +15091,7 @@ function DepreciationScheduleResolver(p) {
15091
15091
  borderBottom: "1px solid #f2f2f2",
15092
15092
  whiteSpace: "nowrap"
15093
15093
  },
15094
- children: (_a2 = asset.usefulLife) != null ? _a2 : "\u2014"
15094
+ children: (_a3 = asset.usefulLife) != null ? _a3 : "\u2014"
15095
15095
  }
15096
15096
  ),
15097
15097
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -15300,12 +15300,12 @@ var PRIORITY_STYLES = {
15300
15300
  low: { color: "#777777", bg: "#f2f2f2", label: "LOW" }
15301
15301
  };
15302
15302
  function EscalationCardResolver(p) {
15303
- var _a, _b, _c, _d;
15303
+ var _a2, _b, _c, _d;
15304
15304
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
15305
15305
  const [cardHovered, setCardHovered] = React41.useState(false);
15306
15306
  const [btnHovered, setBtnHovered] = React41.useState(false);
15307
15307
  const priorityStyle = p.priority ? PRIORITY_STYLES[p.priority] : null;
15308
- const railColor = (_a = priorityStyle == null ? void 0 : priorityStyle.color) != null ? _a : ACCENT2;
15308
+ const railColor = (_a2 = priorityStyle == null ? void 0 : priorityStyle.color) != null ? _a2 : ACCENT2;
15309
15309
  const iconBg = (_b = priorityStyle == null ? void 0 : priorityStyle.bg) != null ? _b : "#fff2ec";
15310
15310
  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
15311
  "div",
@@ -15437,9 +15437,9 @@ function fmt14(v, unit) {
15437
15437
  return /^[$€£¥]/.test(unit) ? `${unit}${n}` : `${n}${unit === "%" ? "%" : ` ${unit}`}`;
15438
15438
  }
15439
15439
  function LineChartResolver(p) {
15440
- var _a, _b, _c, _d;
15440
+ var _a2, _b, _c, _d;
15441
15441
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
15442
- const series = (_a = p.series) != null ? _a : [];
15442
+ const series = (_a2 = p.series) != null ? _a2 : [];
15443
15443
  const data = (_b = p.data) != null ? _b : [];
15444
15444
  const xKey = (_c = p.xKey) != null ? _c : "x";
15445
15445
  const { isVisible, toggle } = useSeriesToggle(series.map((s) => s.dataKey));
@@ -15467,14 +15467,14 @@ function LineChartResolver(p) {
15467
15467
  }
15468
15468
  ),
15469
15469
  series.map((s, i) => {
15470
- var _a2;
15470
+ var _a3;
15471
15471
  return /* @__PURE__ */ jsxRuntime.jsx(
15472
15472
  recharts.Line,
15473
15473
  {
15474
15474
  type: p.smooth ? "monotone" : "linear",
15475
15475
  dataKey: s.dataKey,
15476
15476
  name: s.name,
15477
- stroke: (_a2 = s.color) != null ? _a2 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length],
15477
+ stroke: (_a3 = s.color) != null ? _a3 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length],
15478
15478
  strokeWidth: 2,
15479
15479
  dot: false,
15480
15480
  activeDot: { r: 4, strokeWidth: 2, stroke: "white" },
@@ -15486,7 +15486,7 @@ function LineChartResolver(p) {
15486
15486
  })
15487
15487
  ] }) }),
15488
15488
  series.length > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "14px" }, children: series.map((s, i) => {
15489
- var _a2;
15489
+ var _a3;
15490
15490
  return /* @__PURE__ */ jsxRuntime.jsxs(
15491
15491
  "div",
15492
15492
  {
@@ -15507,7 +15507,7 @@ function LineChartResolver(p) {
15507
15507
  width: "16px",
15508
15508
  height: "2px",
15509
15509
  borderRadius: "9999px",
15510
- background: (_a2 = s.color) != null ? _a2 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length],
15510
+ background: (_a3 = s.color) != null ? _a3 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length],
15511
15511
  display: "inline-block",
15512
15512
  opacity: isVisible(s.dataKey) ? 1 : 0.3,
15513
15513
  transition: "opacity 0.15s"
@@ -15536,15 +15536,15 @@ function fmt15(v, unit) {
15536
15536
  return /^[$€£¥]/.test(unit) ? `${unit}${n}` : `${n}${unit === "%" ? "%" : ` ${unit}`}`;
15537
15537
  }
15538
15538
  function ComboChartResolver(p) {
15539
- var _a, _b, _c, _d, _e;
15539
+ var _a2, _b, _c, _d, _e;
15540
15540
  const { BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
15541
- const bars = (_a = p.bars) != null ? _a : [];
15541
+ const bars = (_a2 = p.bars) != null ? _a2 : [];
15542
15542
  const lines = (_b = p.lines) != null ? _b : [];
15543
15543
  const data = (_c = p.data) != null ? _c : [];
15544
15544
  const xKey = (_d = p.xKey) != null ? _d : "x";
15545
15545
  const hasRight = bars.some((b) => b.axis === "right") || lines.some((l) => {
15546
- var _a2;
15547
- return ((_a2 = l.axis) != null ? _a2 : "right") === "right";
15546
+ var _a3;
15547
+ return ((_a3 = l.axis) != null ? _a3 : "right") === "right";
15548
15548
  });
15549
15549
  const all = [
15550
15550
  ...bars.map((b) => __spreadProps(__spreadValues({}, b), { kind: "bar" })),
@@ -15552,9 +15552,9 @@ function ComboChartResolver(p) {
15552
15552
  ];
15553
15553
  const { isVisible, toggle } = useSeriesToggle(all.map((s) => s.dataKey));
15554
15554
  const colorOf = (dataKey, fallbackIdx) => {
15555
- var _a2;
15555
+ var _a3;
15556
15556
  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];
15557
+ return (_a3 = s == null ? void 0 : s.color) != null ? _a3 : exports.CHART_PALETTE[fallbackIdx % exports.CHART_PALETTE.length];
15558
15558
  };
15559
15559
  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
15560
  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 +15586,11 @@ function ComboChartResolver(p) {
15586
15586
  ),
15587
15587
  /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { contentStyle: tooltipStyle7, cursor: { fill: "rgba(0,0,0,0.03)" } }),
15588
15588
  bars.map((b, i) => {
15589
- var _a2;
15589
+ var _a3;
15590
15590
  return /* @__PURE__ */ jsxRuntime.jsx(
15591
15591
  recharts.Bar,
15592
15592
  {
15593
- yAxisId: (_a2 = b.axis) != null ? _a2 : "left",
15593
+ yAxisId: (_a3 = b.axis) != null ? _a3 : "left",
15594
15594
  dataKey: b.dataKey,
15595
15595
  name: b.name,
15596
15596
  fill: colorOf(b.dataKey, i),
@@ -15603,11 +15603,11 @@ function ComboChartResolver(p) {
15603
15603
  );
15604
15604
  }),
15605
15605
  lines.map((l, i) => {
15606
- var _a2;
15606
+ var _a3;
15607
15607
  return /* @__PURE__ */ jsxRuntime.jsx(
15608
15608
  recharts.Line,
15609
15609
  {
15610
- yAxisId: (_a2 = l.axis) != null ? _a2 : "right",
15610
+ yAxisId: (_a3 = l.axis) != null ? _a3 : "right",
15611
15611
  type: "monotone",
15612
15612
  dataKey: l.dataKey,
15613
15613
  name: l.name,
@@ -15667,9 +15667,9 @@ function fmt16(v, unit) {
15667
15667
  return /^[$€£¥]/.test(unit) ? `${unit}${n}` : `${n}${unit === "%" ? "%" : ` ${unit}`}`;
15668
15668
  }
15669
15669
  function GaugeChartResolver(p) {
15670
- var _a, _b;
15670
+ var _a2, _b;
15671
15671
  const { MUTED: MUTED2, ACCENT: ACCENT2, PAPER: PAPER2 } = useTheme();
15672
- const items = (_a = p.items) != null ? _a : [];
15672
+ const items = (_a2 = p.items) != null ? _a2 : [];
15673
15673
  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
15674
  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
15675
  /* @__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 +15748,24 @@ function makeCellContent(total, currency) {
15748
15748
  };
15749
15749
  }
15750
15750
  function TreemapChartResolver(p) {
15751
- var _a, _b;
15751
+ var _a2, _b;
15752
15752
  useTheme();
15753
- const nodes = (_a = p.nodes) != null ? _a : [];
15753
+ const nodes = (_a2 = p.nodes) != null ? _a2 : [];
15754
15754
  const total = nodes.reduce((s, n) => s + (n.value || 0), 0);
15755
15755
  const data = nodes.map((n, i) => {
15756
- var _a2;
15756
+ var _a3;
15757
15757
  return {
15758
15758
  name: n.name,
15759
15759
  value: n.value,
15760
- fill: (_a2 = n.color) != null ? _a2 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length]
15760
+ fill: (_a3 = n.color) != null ? _a3 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length]
15761
15761
  };
15762
15762
  });
15763
15763
  const csv = () => {
15764
- var _a2;
15764
+ var _a3;
15765
15765
  return downloadCSV(
15766
15766
  [{ key: "name", label: "Name" }, { key: "value", label: "Value" }],
15767
15767
  nodes.map((n) => ({ name: n.name, value: n.value })),
15768
- (_a2 = p.title) != null ? _a2 : "treemap-chart"
15768
+ (_a3 = p.title) != null ? _a3 : "treemap-chart"
15769
15769
  );
15770
15770
  };
15771
15771
  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 +15800,9 @@ var tooltipStyle9 = {
15800
15800
  color: "var(--foreground)"
15801
15801
  };
15802
15802
  function RadarChartResolver(p) {
15803
- var _a, _b, _c;
15803
+ var _a2, _b, _c;
15804
15804
  const { BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
15805
- const series = (_a = p.series) != null ? _a : [];
15805
+ const series = (_a2 = p.series) != null ? _a2 : [];
15806
15806
  const data = (_b = p.data) != null ? _b : [];
15807
15807
  const { isVisible, toggle } = useSeriesToggle(series.map((s) => s.dataKey));
15808
15808
  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 +15813,8 @@ function RadarChartResolver(p) {
15813
15813
  /* @__PURE__ */ jsxRuntime.jsx(recharts.PolarRadiusAxis, { tick: { fontSize: 10, fill: MUTED2 }, axisLine: false }),
15814
15814
  /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { contentStyle: tooltipStyle9, formatter: (value) => p.unit ? `${Number(value)}${p.unit}` : `${Number(value)}` }),
15815
15815
  series.map((s, i) => {
15816
- var _a2;
15817
- const c = (_a2 = s.color) != null ? _a2 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length];
15816
+ var _a3;
15817
+ const c = (_a3 = s.color) != null ? _a3 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length];
15818
15818
  return /* @__PURE__ */ jsxRuntime.jsx(
15819
15819
  recharts.Radar,
15820
15820
  {
@@ -15832,8 +15832,8 @@ function RadarChartResolver(p) {
15832
15832
  })
15833
15833
  ] }) }),
15834
15834
  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];
15835
+ var _a3;
15836
+ const c = (_a3 = s.color) != null ? _a3 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length];
15837
15837
  return /* @__PURE__ */ jsxRuntime.jsxs(
15838
15838
  "div",
15839
15839
  {
@@ -15882,24 +15882,24 @@ function money2(v, currency) {
15882
15882
  return currency ? `${currency}${n}` : n;
15883
15883
  }
15884
15884
  function FunnelChartResolver(p) {
15885
- var _a, _b, _c, _d;
15885
+ var _a2, _b, _c, _d;
15886
15886
  const { MUTED: MUTED2 } = useTheme();
15887
- const stages = (_a = p.stages) != null ? _a : [];
15887
+ const stages = (_a2 = p.stages) != null ? _a2 : [];
15888
15888
  const data = stages.map((s, i) => {
15889
- var _a2;
15889
+ var _a3;
15890
15890
  return {
15891
15891
  name: s.label,
15892
15892
  value: s.value,
15893
- fill: (_a2 = s.color) != null ? _a2 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length]
15893
+ fill: (_a3 = s.color) != null ? _a3 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length]
15894
15894
  };
15895
15895
  });
15896
15896
  const first = (_c = (_b = stages[0]) == null ? void 0 : _b.value) != null ? _c : 0;
15897
15897
  const csv = () => {
15898
- var _a2;
15898
+ var _a3;
15899
15899
  return downloadCSV(
15900
15900
  [{ key: "label", label: "Stage" }, { key: "value", label: "Value" }],
15901
15901
  stages.map((s) => ({ label: s.label, value: s.value })),
15902
- (_a2 = p.title) != null ? _a2 : "funnel-chart"
15902
+ (_a3 = p.title) != null ? _a3 : "funnel-chart"
15903
15903
  );
15904
15904
  };
15905
15905
  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 +15912,13 @@ function FunnelChartResolver(p) {
15912
15912
  ] })
15913
15913
  ] }) }),
15914
15914
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: stages.map((s, i) => {
15915
- var _a2;
15915
+ var _a3;
15916
15916
  const prior = i === 0 ? null : stages[i - 1].value;
15917
15917
  const stepPct = prior && prior > 0 ? Math.round(s.value / prior * 100) : null;
15918
15918
  const ofTop = first > 0 ? Math.round(s.value / first * 100) : null;
15919
15919
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", fontSize: "12px" }, children: [
15920
15920
  /* @__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] } }),
15921
+ /* @__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
15922
  s.label
15923
15923
  ] }),
15924
15924
  /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: MUTED2, fontVariantNumeric: "tabular-nums" }, children: [
@@ -15941,22 +15941,22 @@ function fmt17(v, unit) {
15941
15941
  return /^[$€£¥]/.test(unit) ? `${unit}${n}` : `${n}${unit === "%" ? "%" : ` ${unit}`}`;
15942
15942
  }
15943
15943
  function BulletChartResolver(p) {
15944
- var _a, _b;
15944
+ var _a2, _b;
15945
15945
  const { MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
15946
- const items = (_a = p.items) != null ? _a : [];
15946
+ const items = (_a2 = p.items) != null ? _a2 : [];
15947
15947
  const csv = () => {
15948
- var _a2;
15948
+ var _a3;
15949
15949
  return downloadCSV(
15950
15950
  [{ key: "label", label: "KPI" }, { key: "value", label: "Actual" }, { key: "target", label: "Target" }],
15951
15951
  items.map((it) => ({ label: it.label, value: it.value, target: it.target })),
15952
- (_a2 = p.title) != null ? _a2 : "bullet-chart"
15952
+ (_a3 = p.title) != null ? _a3 : "bullet-chart"
15953
15953
  );
15954
15954
  };
15955
15955
  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
15956
  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
15957
  /* @__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;
15958
+ var _a3;
15959
+ const max = (_a3 = it.max) != null ? _a3 : Math.max(it.value, it.target) * 1.25 || 1;
15960
15960
  const valPct = Math.max(0, Math.min(100, it.value / max * 100));
15961
15961
  const tgtPct = Math.max(0, Math.min(100, it.target / max * 100));
15962
15962
  const ratio = it.target > 0 ? it.value / it.target : 1;
@@ -15986,20 +15986,20 @@ function axisFmt(v, unit) {
15986
15986
  return /^[$€£¥]/.test(unit) ? `${unit}${n}` : `${n}${unit === "%" ? "%" : ` ${unit}`}`;
15987
15987
  }
15988
15988
  function ScatterChartResolver(p) {
15989
- var _a, _b;
15989
+ var _a2, _b;
15990
15990
  const { BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
15991
- const series = (_a = p.series) != null ? _a : [];
15991
+ const series = (_a2 = p.series) != null ? _a2 : [];
15992
15992
  const hasZ = series.some((s) => s.points.some((pt) => pt.z != null));
15993
15993
  const { isVisible, toggle } = useSeriesToggle(series.map((s) => s.name));
15994
15994
  const tooltipContent = (props) => {
15995
- var _a2, _b2;
15995
+ var _a3, _b2;
15996
15996
  const { active, payload } = props;
15997
15997
  if (!active || !payload || !payload.length) return null;
15998
15998
  const d = payload[0].payload;
15999
15999
  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
16000
  d.label && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontWeight: 600, marginBottom: "2px" }, children: d.label }),
16001
16001
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { color: MUTED2 }, children: [
16002
- (_a2 = p.xLabel) != null ? _a2 : "x",
16002
+ (_a3 = p.xLabel) != null ? _a3 : "x",
16003
16003
  ": ",
16004
16004
  axisFmt(d.x, p.xUnit)
16005
16005
  ] }),
@@ -16047,13 +16047,13 @@ function ScatterChartResolver(p) {
16047
16047
  hasZ && /* @__PURE__ */ jsxRuntime.jsx(recharts.ZAxis, { type: "number", dataKey: "z", range: [60, 420] }),
16048
16048
  /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { content: tooltipContent, cursor: { strokeDasharray: "3 3" } }),
16049
16049
  series.map((s, i) => {
16050
- var _a2;
16050
+ var _a3;
16051
16051
  return /* @__PURE__ */ jsxRuntime.jsx(
16052
16052
  recharts.Scatter,
16053
16053
  {
16054
16054
  name: s.name,
16055
16055
  data: s.points,
16056
- fill: (_a2 = s.color) != null ? _a2 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length],
16056
+ fill: (_a3 = s.color) != null ? _a3 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length],
16057
16057
  fillOpacity: 0.7,
16058
16058
  hide: !isVisible(s.name),
16059
16059
  isAnimationActive: false
@@ -16063,8 +16063,8 @@ function ScatterChartResolver(p) {
16063
16063
  })
16064
16064
  ] }) }),
16065
16065
  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];
16066
+ var _a3;
16067
+ const c = (_a3 = s.color) != null ? _a3 : exports.CHART_PALETTE[i % exports.CHART_PALETTE.length];
16068
16068
  return /* @__PURE__ */ jsxRuntime.jsxs(
16069
16069
  "div",
16070
16070
  {
@@ -16148,7 +16148,7 @@ function brandIconUrl(name) {
16148
16148
  }
16149
16149
  var CONNECTED_GREEN = "#15803d";
16150
16150
  function ConnectIntegrationResolver(p) {
16151
- var _a;
16151
+ var _a2;
16152
16152
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
16153
16153
  const [cardHovered, setCardHovered] = React41.useState(false);
16154
16154
  const [btnHovered, setBtnHovered] = React41.useState(false);
@@ -16158,7 +16158,7 @@ function ConnectIntegrationResolver(p) {
16158
16158
  const iconSrc = p.iconUrl || brandIconUrl(name);
16159
16159
  const showImg = Boolean(iconSrc) && !imgFailed;
16160
16160
  const connected = p.status === "connected";
16161
- const label = (_a = p.ctaLabel) != null ? _a : connected ? "Open" : "Connect";
16161
+ const label = (_a2 = p.ctaLabel) != null ? _a2 : connected ? "Open" : "Connect";
16162
16162
  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
16163
  "div",
16164
16164
  {
@@ -16311,14 +16311,14 @@ init_ThemeContext();
16311
16311
  var CONNECTED_GREEN2 = "#15803d";
16312
16312
  var CONNECTED_BG = "#eaf6ee";
16313
16313
  function IntegrationsListResolver(p) {
16314
- var _a, _b;
16314
+ var _a2, _b;
16315
16315
  const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
16316
16316
  const integrations = Array.isArray(p.integrations) ? p.integrations : [];
16317
16317
  const [rowHover, setRowHover] = React41.useState(null);
16318
16318
  const [btnHover, setBtnHover] = React41.useState(null);
16319
16319
  const [failed, setFailed] = React41.useState({});
16320
16320
  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: [
16321
+ 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
16322
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
16323
16323
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "baseline", justifyContent: "space-between", gap: "12px" }, children: [
16324
16324
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -16592,11 +16592,11 @@ function layoutGraph(steps, startX = 0, startY = 0, keyPrefix = "") {
16592
16592
  let prevId = null;
16593
16593
  let totalW = NODE_W;
16594
16594
  steps.forEach((step, idx) => {
16595
- var _a, _b, _c, _d;
16595
+ var _a2, _b, _c, _d;
16596
16596
  const op = step.operation;
16597
16597
  const isBranch = op === "BRANCH" || op === "CONDITION";
16598
16598
  const isFanOut = op === "FAN_OUT";
16599
- const baseId = `${keyPrefix}${(_a = step.id) != null ? _a : `s${idx}`}`;
16599
+ const baseId = `${keyPrefix}${(_a2 = step.id) != null ? _a2 : `s${idx}`}`;
16600
16600
  if (isFanOut && ((_b = step.subSteps) == null ? void 0 : _b.length)) {
16601
16601
  const foNodeId = baseId;
16602
16602
  const res = layoutGraph(step.subSteps, 0, 0, `${baseId}/`);
@@ -16638,10 +16638,10 @@ function layoutGraph(steps, startX = 0, startY = 0, keyPrefix = "") {
16638
16638
  if (prevId) edges.push({ from: prevId, to: bNodeId });
16639
16639
  y += BRANCH_NODE_H + GAP_Y;
16640
16640
  const branchResults = step.branches.map((br, bi) => {
16641
- var _a2;
16641
+ var _a3;
16642
16642
  return __spreadValues({
16643
16643
  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}/`));
16644
+ }, layoutGraph((_a3 = br.steps) != null ? _a3 : [], 0, 0, `${bNodeId}/b${bi}/`));
16645
16645
  });
16646
16646
  let bTotalW = branchResults.reduce((sum, r) => sum + r.totalW + GAP_X, 0) - GAP_X;
16647
16647
  if (!Number.isFinite(bTotalW) || bTotalW <= 0) bTotalW = NODE_W;
@@ -16797,10 +16797,10 @@ var ellipsis = {
16797
16797
  display: "block"
16798
16798
  };
16799
16799
  function PipelinePreviewResolver(p) {
16800
- var _a, _b, _c, _d, _e, _f, _g;
16800
+ var _a2, _b, _c, _d, _e, _f, _g;
16801
16801
  const { MUTED: MUTED2, PAPER: PAPER2, BORDER: BORDER4, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
16802
16802
  const [btnHovered, setBtnHovered] = React41.useState(false);
16803
- const stateCfg = STATE_CONFIG[(_a = p.state) != null ? _a : "draft"];
16803
+ const stateCfg = STATE_CONFIG[(_a2 = p.state) != null ? _a2 : "draft"];
16804
16804
  const destinations = (_b = p.destinations) != null ? _b : [];
16805
16805
  const steps = (_c = p.steps) != null ? _c : [];
16806
16806
  const workstreams = (_d = p.workstreams) != null ? _d : [];
@@ -17205,6 +17205,7 @@ var STATUS_COLORS3 = {
17205
17205
  // filled from theme ACCENT at render time
17206
17206
  review: "#f59e0b",
17207
17207
  pending: "#9ca3af",
17208
+ blocked: "#b45309",
17208
17209
  failed: "#dc2626"
17209
17210
  };
17210
17211
  var STATUS_LABELS = {
@@ -17212,6 +17213,7 @@ var STATUS_LABELS = {
17212
17213
  active: "In progress",
17213
17214
  review: "In review",
17214
17215
  pending: "Pending",
17216
+ blocked: "Blocked",
17215
17217
  failed: "Failed"
17216
17218
  };
17217
17219
  var HUMAN_PALETTE = ["#2563eb", "#0f766e", "#7c3aed", "#b45309", "#be185d", "#4d7c0f"];
@@ -17221,10 +17223,10 @@ function hashColor(name) {
17221
17223
  return HUMAN_PALETTE[Math.abs(h) % HUMAN_PALETTE.length];
17222
17224
  }
17223
17225
  function initialsOf(a) {
17224
- var _a, _b, _c, _d;
17226
+ var _a2, _b, _c, _d;
17225
17227
  if (a.initials) return a.initials.slice(0, 2).toUpperCase();
17226
17228
  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() || "?";
17229
+ 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
17230
  }
17229
17231
  function SparkMark({ size, color }) {
17230
17232
  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 +17294,8 @@ function AvatarStack({ assignees, accent }) {
17292
17294
  ] });
17293
17295
  }
17294
17296
  function IndexDot({ step, index, accent }) {
17295
- var _a;
17296
- const n = (_a = step.n) != null ? _a : index + 1;
17297
+ var _a2;
17298
+ const n = (_a2 = step.n) != null ? _a2 : index + 1;
17297
17299
  const base = {
17298
17300
  width: 18,
17299
17301
  height: 18,
@@ -17329,8 +17331,8 @@ function useContainerWidth(ref) {
17329
17331
  const el = ref.current;
17330
17332
  if (!el || typeof ResizeObserver === "undefined") return;
17331
17333
  const ro = new ResizeObserver((entries) => {
17332
- var _a;
17333
- const cr = (_a = entries[0]) == null ? void 0 : _a.contentRect;
17334
+ var _a2;
17335
+ const cr = (_a2 = entries[0]) == null ? void 0 : _a2.contentRect;
17334
17336
  if (cr) setW(cr.width);
17335
17337
  });
17336
17338
  ro.observe(el);
@@ -17419,9 +17421,9 @@ function WorkflowStepperRenderer({
17419
17421
  loadingSteps = 6,
17420
17422
  showProgress = true
17421
17423
  }) {
17422
- var _a, _b, _c, _d, _e, _f;
17424
+ var _a2, _b, _c, _d, _e, _f;
17423
17425
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
17424
- const steps = (_a = data.steps) != null ? _a : [];
17426
+ const steps = (_a2 = data.steps) != null ? _a2 : [];
17425
17427
  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
17428
  const interactive = typeof onSelectStep === "function";
17427
17429
  const statusColor3 = (s) => s === "active" ? ACCENT2 : STATUS_COLORS3[s];
@@ -17649,13 +17651,13 @@ function WorkflowStepperRenderer({
17649
17651
  .wfs-scroller:hover::-webkit-scrollbar-thumb{background:#aab2c2;background-clip:padding-box}
17650
17652
  ` }),
17651
17653
  steps.map((step, i) => {
17652
- var _a2;
17654
+ var _a3;
17653
17655
  const isSelected = selectedStep === step.id;
17654
17656
  const isActive = step.status === "active";
17655
17657
  const reached = step.status !== "pending";
17656
17658
  const clickable = interactive && reached;
17657
17659
  const color = statusColor3(step.status);
17658
- const humans = ((_a2 = step.assignees) != null ? _a2 : []).filter((a) => a.kind === "human");
17660
+ const humans = ((_a3 = step.assignees) != null ? _a3 : []).filter((a) => a.kind === "human");
17659
17661
  const roleCaption = humans.map((h) => h.role).filter(Boolean).slice(0, 2).join(" \xB7 ");
17660
17662
  return /* @__PURE__ */ jsxRuntime.jsxs(React41__default.default.Fragment, { children: [
17661
17663
  i > 0 && /* @__PURE__ */ jsxRuntime.jsx(
@@ -17852,9 +17854,9 @@ function WorkflowStepperRenderer({
17852
17854
  ] });
17853
17855
  }
17854
17856
  function WorkflowStepperResolver(p) {
17855
- var _a;
17857
+ var _a2;
17856
17858
  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: [
17859
+ 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
17860
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap" }, children: [
17859
17861
  /* @__PURE__ */ jsxRuntime.jsx(
17860
17862
  "p",
@@ -18089,12 +18091,57 @@ var BUILDER_FIELD_TYPES = [
18089
18091
  "multi_select",
18090
18092
  "date",
18091
18093
  "checkbox",
18092
- "file_upload"
18094
+ "file_upload",
18095
+ // Server-backed search-as-you-type combobox. Unlike `select` (static
18096
+ // `options`), it queries an allowlisted `source` via host-injected callbacks
18097
+ // (onEntitySearch/onEntityCreate) and can create a new record inline.
18098
+ "entity_picker",
18099
+ // Assign a set of files to role categories (grouped cards + inline Move).
18100
+ // Self-contained: candidate files + AI suggestions ride the `file_map` config
18101
+ // in the payload (no host callback). Submitted value = {category_id:[path]}.
18102
+ "file_map"
18093
18103
  ];
18094
18104
  var builderFieldOptionSchema = zod.z.object({
18095
18105
  value: zod.z.string(),
18096
18106
  label: zod.z.string()
18097
18107
  });
18108
+ zod.z.object({
18109
+ value: zod.z.string(),
18110
+ label: zod.z.string(),
18111
+ description: zod.z.string().optional().nullable(),
18112
+ meta: zod.z.string().optional().nullable()
18113
+ });
18114
+ var entityCreateFieldSchema = zod.z.object({
18115
+ name: zod.z.string(),
18116
+ label: zod.z.string(),
18117
+ field_type: zod.z.enum(["text", "textarea", "number", "date", "checkbox", "select"]).optional().default("text"),
18118
+ required: zod.z.boolean().optional().default(false),
18119
+ placeholder: zod.z.string().optional().default(""),
18120
+ options: zod.z.array(builderFieldOptionSchema).optional().nullable()
18121
+ });
18122
+ var fileMapCategorySchema = zod.z.object({
18123
+ id: zod.z.string(),
18124
+ label: zod.z.string(),
18125
+ hint: zod.z.string().optional().nullable()
18126
+ });
18127
+ var fileMapFileSchema = zod.z.object({
18128
+ path: zod.z.string(),
18129
+ name: zod.z.string().optional().nullable(),
18130
+ type: zod.z.string().optional().nullable(),
18131
+ // ext, e.g. "csv"
18132
+ size: zod.z.string().optional().nullable()
18133
+ // pre-formatted, e.g. "600 B"
18134
+ });
18135
+ var fileMapConfigSchema = zod.z.object({
18136
+ categories: zod.z.array(fileMapCategorySchema).min(1),
18137
+ files: zod.z.array(fileMapFileSchema),
18138
+ /** AI seed: {category_id: [file_path]}. */
18139
+ suggestions: zod.z.record(zod.z.string(), zod.z.array(zod.z.string())).optional().nullable(),
18140
+ /** {file_path: HIGH|MEDIUM|LOW} for the suggested rows. */
18141
+ confidence: zod.z.record(zod.z.string(), zod.z.enum(["HIGH", "MEDIUM", "LOW"])).optional().nullable(),
18142
+ /** Allow files to stay unassigned (default true). */
18143
+ allow_unassigned: zod.z.boolean().optional().default(true)
18144
+ });
18098
18145
  var builderFieldValidationSchema = zod.z.object({
18099
18146
  min: zod.z.number().optional(),
18100
18147
  max: zod.z.number().optional(),
@@ -18111,7 +18158,17 @@ var builderFieldSchema = zod.z.object({
18111
18158
  description: zod.z.string().optional().default(""),
18112
18159
  options: zod.z.array(builderFieldOptionSchema).optional().nullable(),
18113
18160
  default_value: zod.z.any().optional().nullable(),
18114
- validation: builderFieldValidationSchema.nullable()
18161
+ validation: builderFieldValidationSchema.nullable(),
18162
+ // --- entity_picker config (ignored by other field types) ---
18163
+ /** Allowlisted entity source the host knows how to search/create, e.g.
18164
+ * "workstreams". NOT a raw URL — the host maps it to a real endpoint. */
18165
+ source: zod.z.string().optional().nullable(),
18166
+ /** Show the inline "Create new …" affordance (host still enforces perms). */
18167
+ allow_create: zod.z.boolean().optional().default(false),
18168
+ /** Fields for the inline create sub-form (defaults to a single `name`). */
18169
+ create_fields: zod.z.array(entityCreateFieldSchema).optional().nullable(),
18170
+ // --- file_map config (ignored by other field types) ---
18171
+ file_map: fileMapConfigSchema.optional().nullable()
18115
18172
  });
18116
18173
  var builderBlockSchema = zod.z.object({
18117
18174
  id: zod.z.string(),
@@ -18142,7 +18199,7 @@ function validateBuilderPayload(data) {
18142
18199
  };
18143
18200
  }
18144
18201
 
18145
- // src/builders/FormBuilder.tsx
18202
+ // src/builders/BlockForm.tsx
18146
18203
  init_ThemeContext();
18147
18204
 
18148
18205
  // src/builders/FieldRenderer.tsx
@@ -18197,7 +18254,7 @@ function TextAreaField({ field, value, onChange, disabled, error }) {
18197
18254
  );
18198
18255
  }
18199
18256
  function NumberField({ field, value, onChange, disabled, error }) {
18200
- var _a, _b;
18257
+ var _a2, _b;
18201
18258
  const base = useInputBase();
18202
18259
  return /* @__PURE__ */ jsxRuntime.jsx(
18203
18260
  "input",
@@ -18210,7 +18267,7 @@ function NumberField({ field, value, onChange, disabled, error }) {
18210
18267
  },
18211
18268
  placeholder: field.placeholder || "",
18212
18269
  disabled,
18213
- min: (_a = field.validation) == null ? void 0 : _a.min,
18270
+ min: (_a2 = field.validation) == null ? void 0 : _a2.min,
18214
18271
  max: (_b = field.validation) == null ? void 0 : _b.max,
18215
18272
  style: error ? __spreadValues(__spreadValues({}, base), INPUT_ERROR) : base
18216
18273
  }
@@ -18356,9 +18413,9 @@ function FileUploadField({ field, value, onChange, disabled, onFileUpload, error
18356
18413
  const [entries, setEntries] = React41.useState(() => {
18357
18414
  const arr = Array.isArray(value) ? value : value && typeof value === "object" ? [value] : [];
18358
18415
  return arr.map((item) => {
18359
- var _a, _b;
18416
+ var _a2, _b;
18360
18417
  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 };
18418
+ 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
18419
  });
18363
18420
  });
18364
18421
  const entriesRef = React41__default.default.useRef(entries);
@@ -18392,19 +18449,19 @@ function FileUploadField({ field, value, onChange, disabled, onFileUpload, error
18392
18449
  });
18393
18450
  };
18394
18451
  const handleInput = (e) => {
18395
- var _a;
18396
- addFiles(Array.from((_a = e.target.files) != null ? _a : []));
18452
+ var _a2;
18453
+ addFiles(Array.from((_a2 = e.target.files) != null ? _a2 : []));
18397
18454
  if (inputRef.current) inputRef.current.value = "";
18398
18455
  };
18399
18456
  const handleDrop = (e) => {
18400
- var _a;
18457
+ var _a2;
18401
18458
  e.preventDefault();
18402
18459
  setDragOver(false);
18403
- addFiles(Array.from((_a = e.dataTransfer.files) != null ? _a : []));
18460
+ addFiles(Array.from((_a2 = e.dataTransfer.files) != null ? _a2 : []));
18404
18461
  };
18405
18462
  const openPicker = () => {
18406
- var _a;
18407
- if (interactive) (_a = inputRef.current) == null ? void 0 : _a.click();
18463
+ var _a2;
18464
+ if (interactive) (_a2 = inputRef.current) == null ? void 0 : _a2.click();
18408
18465
  };
18409
18466
  const removeEntry = (key) => commit(entriesRef.current.filter((e) => e.key !== key));
18410
18467
  const borderColor = dragOver ? ACCENT2 : error ? "#dc2626" : BORDER4;
@@ -18481,112 +18538,619 @@ function FileUploadField({ field, value, onChange, disabled, onFileUpload, error
18481
18538
  })
18482
18539
  ] });
18483
18540
  }
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 })
18541
+ function highlightMatch(label, q, accent) {
18542
+ const query = q.trim();
18543
+ if (!query) return label;
18544
+ const i = label.toLowerCase().indexOf(query.toLowerCase());
18545
+ if (i < 0) return label;
18546
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
18547
+ label.slice(0, i),
18548
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: 700, color: accent }, children: label.slice(i, i + query.length) }),
18549
+ label.slice(i + query.length)
18505
18550
  ] });
18506
18551
  }
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);
18552
+ function EntityPickerField({ field, value, onChange, disabled, error, onEntitySearch, onEntityCreate }) {
18553
+ const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, PAPER: PAPER2 } = useTheme();
18554
+ const base = useInputBase();
18555
+ const source = field.source || "";
18556
+ const [open, setOpen] = React41.useState(false);
18557
+ const [query, setQuery] = React41.useState("");
18558
+ const [results, setResults] = React41.useState([]);
18559
+ const [loading, setLoading] = React41.useState(false);
18560
+ const [err, setErr] = React41.useState(null);
18561
+ const [hi, setHi] = React41.useState(0);
18562
+ const [selectedLabel, setSelectedLabel] = React41.useState(null);
18563
+ const [creating, setCreating] = React41.useState(false);
18564
+ const [createVals, setCreateVals] = React41.useState({});
18565
+ const [createBusy, setCreateBusy] = React41.useState(false);
18566
+ const boxRef = React41.useRef(null);
18567
+ const seq = React41.useRef(0);
18568
+ const allowCreate = !!field.allow_create && !!onEntityCreate;
18569
+ const createFields = React41.useMemo(
18570
+ () => field.create_fields && field.create_fields.length ? field.create_fields : [{ name: "name", label: "Name", field_type: "text", required: true, placeholder: "" }],
18571
+ [field.create_fields]
18572
+ );
18573
+ const runSearch = React41.useCallback(
18574
+ (q) => {
18575
+ if (!onEntitySearch || !source) return;
18576
+ const my = ++seq.current;
18577
+ setLoading(true);
18578
+ setErr(null);
18579
+ onEntitySearch(source, q).then((rows) => {
18580
+ if (my === seq.current) {
18581
+ setResults(rows || []);
18582
+ setHi(0);
18583
+ }
18584
+ }).catch(() => {
18585
+ if (my === seq.current) {
18586
+ setErr("Search failed \u2014 try again");
18587
+ setResults([]);
18588
+ }
18589
+ }).finally(() => {
18590
+ if (my === seq.current) setLoading(false);
18591
+ });
18592
+ },
18593
+ [onEntitySearch, source]
18594
+ );
18595
+ React41.useEffect(() => {
18596
+ if (!open || creating) return;
18597
+ const id = setTimeout(() => runSearch(query), 200);
18598
+ return () => clearTimeout(id);
18599
+ }, [open, creating, query, runSearch]);
18600
+ React41.useEffect(() => {
18601
+ if (!open) return;
18602
+ const onDoc = (e) => {
18603
+ if (boxRef.current && !boxRef.current.contains(e.target)) {
18604
+ setOpen(false);
18605
+ setCreating(false);
18606
+ }
18542
18607
  };
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);
18608
+ document.addEventListener("mousedown", onDoc);
18609
+ return () => document.removeEventListener("mousedown", onDoc);
18610
+ }, [open]);
18611
+ const openMenu = () => {
18612
+ if (disabled) return;
18613
+ setOpen(true);
18551
18614
  };
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);
18615
+ const select = React41.useCallback((opt) => {
18616
+ onChange({ value: opt.value, label: opt.label });
18617
+ setSelectedLabel(opt.label);
18618
+ setQuery("");
18619
+ setOpen(false);
18620
+ setCreating(false);
18621
+ }, [onChange]);
18622
+ const nameField = createFields.find((f) => {
18623
+ var _a2;
18624
+ return ((_a2 = f.field_type) != null ? _a2 : "text") === "text";
18625
+ }) || createFields[0];
18626
+ const otherRequired = createFields.filter((f) => f !== nameField && f.required);
18627
+ const showCreateRow = allowCreate && !creating && query.trim().length > 0;
18628
+ const totalRows = results.length + (showCreateRow ? 1 : 0);
18629
+ const beginCreate = React41.useCallback(() => {
18630
+ const init = {};
18631
+ if (nameField && query.trim()) init[nameField.name] = query.trim();
18632
+ setCreateVals(init);
18633
+ setErr(null);
18634
+ setCreating(true);
18635
+ }, [nameField, query]);
18636
+ const submitCreate = React41.useCallback((vals) => {
18637
+ if (!onEntityCreate || !source) return;
18638
+ const payload = vals || createVals;
18639
+ for (const f of createFields) {
18640
+ if (f.required && (payload[f.name] == null || payload[f.name] === "")) {
18641
+ setErr(`${f.label} is required`);
18642
+ return;
18643
+ }
18568
18644
  }
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";
18645
+ setCreateBusy(true);
18646
+ setErr(null);
18647
+ onEntityCreate(source, payload).then((opt) => select(opt)).catch(() => setErr("Couldn't create \u2014 you may not have permission")).finally(() => setCreateBusy(false));
18648
+ }, [onEntityCreate, source, createFields, createVals, select]);
18649
+ const handleCreateRow = React41.useCallback(() => {
18650
+ const q = query.trim();
18651
+ if (!q || !nameField) return;
18652
+ if (otherRequired.length === 0) {
18653
+ submitCreate({ [nameField.name]: q });
18654
+ } else {
18655
+ beginCreate();
18656
+ }
18657
+ }, [query, nameField, otherRequired, submitCreate, beginCreate]);
18658
+ const onKeyDown = (e) => {
18659
+ if (creating) return;
18660
+ if (!open) {
18661
+ if (e.key === "ArrowDown" || e.key === "Enter") {
18662
+ openMenu();
18663
+ e.preventDefault();
18664
+ }
18665
+ return;
18666
+ }
18667
+ if (e.key === "ArrowDown") {
18668
+ setHi((h) => Math.min(h + 1, Math.max(totalRows - 1, 0)));
18669
+ e.preventDefault();
18670
+ } else if (e.key === "ArrowUp") {
18671
+ setHi((h) => Math.max(h - 1, 0));
18672
+ e.preventDefault();
18673
+ } else if (e.key === "Enter") {
18674
+ e.preventDefault();
18675
+ if (hi < results.length) select(results[hi]);
18676
+ else if (showCreateRow) handleCreateRow();
18677
+ } else if (e.key === "Escape") {
18678
+ setOpen(false);
18583
18679
  }
18584
- return { fg, bg };
18585
18680
  };
18586
- const total = rows.length;
18587
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: S3(t).card, children: [
18588
- /* @__PURE__ */ jsxRuntime.jsx("style", { children: "@keyframes agRecapFade{from{opacity:0;transform:translateY(3px)}to{opacity:1;transform:none}}" }),
18589
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: S3(t).header, children: [
18681
+ const selectedObj = value && typeof value === "object" ? value : null;
18682
+ const displayValue = selectedObj ? selectedObj.label || selectedObj.value : value ? selectedLabel != null ? selectedLabel : String(value) : "";
18683
+ const inputStyle = error ? __spreadValues(__spreadValues({}, base), INPUT_ERROR) : base;
18684
+ const rowStyle = (active) => ({
18685
+ display: "flex",
18686
+ flexDirection: "column",
18687
+ gap: "1px",
18688
+ padding: "8px 11px",
18689
+ cursor: "pointer",
18690
+ boxSizing: "border-box",
18691
+ background: active ? `${ACCENT2}0d` : "white",
18692
+ borderLeft: `2px solid ${active ? ACCENT2 : "transparent"}`
18693
+ });
18694
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: boxRef, style: { position: "relative" }, children: [
18695
+ /* @__PURE__ */ jsxRuntime.jsx(
18696
+ "input",
18697
+ {
18698
+ type: "text",
18699
+ role: "combobox",
18700
+ "aria-expanded": open,
18701
+ "aria-autocomplete": "list",
18702
+ value: open ? query : displayValue,
18703
+ placeholder: field.placeholder || "Search\u2026",
18704
+ disabled,
18705
+ onFocus: openMenu,
18706
+ onChange: (e) => {
18707
+ setQuery(e.target.value);
18708
+ if (!open) setOpen(true);
18709
+ },
18710
+ onKeyDown,
18711
+ style: inputStyle
18712
+ }
18713
+ ),
18714
+ open && /* @__PURE__ */ jsxRuntime.jsx(
18715
+ "div",
18716
+ {
18717
+ role: "listbox",
18718
+ style: {
18719
+ position: "absolute",
18720
+ zIndex: 30,
18721
+ top: "calc(100% + 4px)",
18722
+ left: 0,
18723
+ right: 0,
18724
+ background: "white",
18725
+ border: `1px solid ${BORDER4}`,
18726
+ borderRadius: "0.625rem",
18727
+ boxShadow: "0 4px 16px rgba(0,0,0,0.10)",
18728
+ overflow: "hidden",
18729
+ maxHeight: "280px",
18730
+ overflowY: "auto"
18731
+ },
18732
+ children: creating ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "9px", padding: "12px" }, children: [
18733
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "12px", fontWeight: 600, color: "var(--foreground)" }, children: "Create new" }),
18734
+ createFields.map((f) => {
18735
+ var _a2, _b, _c, _d, _e;
18736
+ return /* @__PURE__ */ jsxRuntime.jsxs("label", { style: { display: "flex", flexDirection: "column", gap: "3px" }, children: [
18737
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "11.5px", fontWeight: 600, color: "var(--foreground)" }, children: [
18738
+ f.label,
18739
+ f.required && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#dc2626", marginLeft: "2px" }, children: "*" })
18740
+ ] }),
18741
+ ((_a2 = f.field_type) != null ? _a2 : "text") === "textarea" ? /* @__PURE__ */ jsxRuntime.jsx(
18742
+ "textarea",
18743
+ {
18744
+ value: (_b = createVals[f.name]) != null ? _b : "",
18745
+ placeholder: f.placeholder || "",
18746
+ onChange: (e) => setCreateVals((p) => __spreadProps(__spreadValues({}, p), { [f.name]: e.target.value })),
18747
+ rows: 3,
18748
+ style: __spreadProps(__spreadValues({}, base), { resize: "vertical" })
18749
+ }
18750
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
18751
+ "input",
18752
+ {
18753
+ type: ((_c = f.field_type) != null ? _c : "text") === "number" ? "number" : ((_d = f.field_type) != null ? _d : "text") === "date" ? "date" : "text",
18754
+ value: (_e = createVals[f.name]) != null ? _e : "",
18755
+ placeholder: f.placeholder || "",
18756
+ onChange: (e) => setCreateVals((p) => __spreadProps(__spreadValues({}, p), { [f.name]: e.target.value })),
18757
+ style: base
18758
+ }
18759
+ )
18760
+ ] }, f.name);
18761
+ }),
18762
+ err && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "11px", color: "#dc2626", fontWeight: 500 }, children: err }),
18763
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
18764
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: () => {
18765
+ setCreating(false);
18766
+ setErr(null);
18767
+ }, style: { font: "inherit", fontSize: "12px", fontWeight: 600, color: MUTED2, background: "transparent", border: `1px solid ${BORDER4}`, borderRadius: "9999px", padding: "5px 13px", cursor: "pointer" }, children: "Cancel" }),
18768
+ /* @__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" })
18769
+ ] })
18770
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
18771
+ loading && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "10px 11px", fontSize: "12px", color: MUTED2, display: "flex", alignItems: "center", gap: "8px" }, children: [
18772
+ /* @__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" }),
18773
+ "Searching\u2026"
18774
+ ] }),
18775
+ !loading && err && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "10px 11px", fontSize: "12px", color: "#dc2626" }, children: err }),
18776
+ !loading && !err && results.length === 0 && !showCreateRow && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "10px 11px", fontSize: "12px", color: MUTED2 }, children: [
18777
+ "No matches",
18778
+ query ? ` for \u201C${query}\u201D` : "",
18779
+ "."
18780
+ ] }),
18781
+ !loading && results.map((opt, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
18782
+ "div",
18783
+ {
18784
+ role: "option",
18785
+ "aria-selected": hi === idx,
18786
+ onMouseEnter: () => setHi(idx),
18787
+ onMouseDown: (e) => {
18788
+ e.preventDefault();
18789
+ select(opt);
18790
+ },
18791
+ style: rowStyle(hi === idx),
18792
+ children: [
18793
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "13px", color: "var(--foreground)" }, children: highlightMatch(opt.label, query, ACCENT2) }),
18794
+ (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 ") })
18795
+ ]
18796
+ },
18797
+ opt.value
18798
+ )),
18799
+ showCreateRow && /* @__PURE__ */ jsxRuntime.jsxs(
18800
+ "div",
18801
+ {
18802
+ role: "option",
18803
+ "aria-selected": hi === results.length,
18804
+ onMouseEnter: () => setHi(results.length),
18805
+ onMouseDown: (e) => {
18806
+ e.preventDefault();
18807
+ handleCreateRow();
18808
+ },
18809
+ 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" }),
18810
+ children: [
18811
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "15px", lineHeight: 1, color: ACCENT2, fontWeight: 700 }, children: "\uFF0B" }),
18812
+ /* @__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$/, "")}` })
18813
+ ]
18814
+ }
18815
+ )
18816
+ ] })
18817
+ }
18818
+ )
18819
+ ] });
18820
+ }
18821
+ var _FILEMAP_UNASSIGNED = "unassigned";
18822
+ var _CONF_COLOR = { HIGH: "#15803d", MEDIUM: "#92400e", LOW: "#777777" };
18823
+ function _fileExt(path, type) {
18824
+ if (type) return String(type).toLowerCase();
18825
+ const base = (path || "").split("/").pop() || "";
18826
+ return base.includes(".") ? (base.split(".").pop() || "").toLowerCase() : "";
18827
+ }
18828
+ function FileMapField({ field, value, onChange, disabled }) {
18829
+ const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, PAPER: PAPER2 } = useTheme();
18830
+ const cfg = field.file_map || null;
18831
+ const categories = React41.useMemo(() => (cfg == null ? void 0 : cfg.categories) || [], [cfg]);
18832
+ const fileList = React41.useMemo(() => (cfg == null ? void 0 : cfg.files) || [], [cfg]);
18833
+ const suggestions = (cfg == null ? void 0 : cfg.suggestions) || {};
18834
+ const confidence = (cfg == null ? void 0 : cfg.confidence) || {};
18835
+ const initial = React41.useMemo(() => {
18836
+ const a = {};
18837
+ if (value && typeof value === "object" && !Array.isArray(value)) {
18838
+ for (const [grp, paths] of Object.entries(value))
18839
+ for (const p of paths || []) a[p] = grp;
18840
+ } else {
18841
+ for (const [cid, paths] of Object.entries(suggestions))
18842
+ for (const p of paths || []) a[p] = cid;
18843
+ }
18844
+ for (const f of fileList) if (!(f.path in a)) a[f.path] = _FILEMAP_UNASSIGNED;
18845
+ return a;
18846
+ }, []);
18847
+ const [assignment, setAssignment] = React41.useState(initial);
18848
+ const [collapsed, setCollapsed] = React41.useState({});
18849
+ const [menuFor, setMenuFor] = React41.useState(null);
18850
+ const boardRef = React41.useRef(null);
18851
+ const fileByPath = React41.useMemo(
18852
+ () => Object.fromEntries(fileList.map((f) => [f.path, f])),
18853
+ [fileList]
18854
+ );
18855
+ const groupFrom = React41.useCallback((a) => {
18856
+ const g = { [_FILEMAP_UNASSIGNED]: [] };
18857
+ for (const c of categories) g[c.id] = [];
18858
+ for (const f of fileList) {
18859
+ const grp = a[f.path] || _FILEMAP_UNASSIGNED;
18860
+ if (!g[grp]) g[grp] = [];
18861
+ g[grp].push(f.path);
18862
+ }
18863
+ return g;
18864
+ }, [categories, fileList]);
18865
+ const grouped = React41.useMemo(() => groupFrom(assignment), [assignment, groupFrom]);
18866
+ const emit = React41.useCallback((g) => onChange(g), [onChange]);
18867
+ const emittedRef = React41.useRef(false);
18868
+ React41.useEffect(() => {
18869
+ if (!emittedRef.current) {
18870
+ emittedRef.current = true;
18871
+ emit(grouped);
18872
+ }
18873
+ }, [grouped, emit]);
18874
+ React41.useEffect(() => {
18875
+ if (!menuFor) return;
18876
+ const onDoc = (e) => {
18877
+ if (boardRef.current && !boardRef.current.contains(e.target)) setMenuFor(null);
18878
+ };
18879
+ document.addEventListener("mousedown", onDoc);
18880
+ return () => document.removeEventListener("mousedown", onDoc);
18881
+ }, [menuFor]);
18882
+ const move = React41.useCallback((path, grp) => {
18883
+ setMenuFor(null);
18884
+ setAssignment((prev) => {
18885
+ const next = __spreadProps(__spreadValues({}, prev), { [path]: grp });
18886
+ emit(groupFrom(next));
18887
+ return next;
18888
+ });
18889
+ }, [emit, groupFrom]);
18890
+ const labelOf = (gid) => {
18891
+ var _a2;
18892
+ return gid === _FILEMAP_UNASSIGNED ? "Unassigned" : ((_a2 = categories.find((c) => c.id === gid)) == null ? void 0 : _a2.label) || gid;
18893
+ };
18894
+ const hintOf = (gid) => {
18895
+ var _a2;
18896
+ return gid === _FILEMAP_UNASSIGNED ? null : ((_a2 = categories.find((c) => c.id === gid)) == null ? void 0 : _a2.hint) || null;
18897
+ };
18898
+ const orderedGroups = [_FILEMAP_UNASSIGNED, ...categories.map((c) => c.id)];
18899
+ if (!cfg || categories.length === 0) {
18900
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "12px", color: MUTED2 }, children: "No file-map configuration." });
18901
+ }
18902
+ const total = fileList.length;
18903
+ const assigned = fileList.filter((f) => (assignment[f.path] || _FILEMAP_UNASSIGNED) !== _FILEMAP_UNASSIGNED).length;
18904
+ const pct = total ? Math.round(assigned / total * 100) : 0;
18905
+ const cards = () => orderedGroups.map((gid) => {
18906
+ const paths = grouped[gid] || [];
18907
+ if (gid === _FILEMAP_UNASSIGNED && paths.length === 0) return null;
18908
+ const isCollapsed = !!collapsed[gid];
18909
+ const hint = hintOf(gid);
18910
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { border: `1px solid ${BORDER4}`, borderRadius: "0.75rem", overflow: "visible", background: "white" }, children: [
18911
+ /* @__PURE__ */ jsxRuntime.jsxs(
18912
+ "button",
18913
+ {
18914
+ type: "button",
18915
+ onClick: () => setCollapsed((c) => __spreadProps(__spreadValues({}, c), { [gid]: !c[gid] })),
18916
+ 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 },
18917
+ children: [
18918
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { transition: "transform 0.15s", transform: isCollapsed ? "rotate(-90deg)" : "none", color: MUTED2, fontSize: "10px", flexShrink: 0 }, children: "\u25BE" }),
18919
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "12px", fontWeight: 600, color: gid === _FILEMAP_UNASSIGNED ? MUTED2 : "var(--foreground)", flexShrink: 0 }, children: labelOf(gid) }),
18920
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "11px", color: MUTED2, fontVariantNumeric: "tabular-nums", flexShrink: 0 }, children: [
18921
+ "(",
18922
+ paths.length,
18923
+ ")"
18924
+ ] }),
18925
+ hint && !isCollapsed && /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "11px", color: MUTED2, marginLeft: "2px", minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: [
18926
+ "\xB7 ",
18927
+ hint
18928
+ ] })
18929
+ ]
18930
+ }
18931
+ ),
18932
+ !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) => {
18933
+ const f = fileByPath[p] || { name: p };
18934
+ const ext = _fileExt(p, f.type);
18935
+ const conf = confidence[p];
18936
+ const open = menuFor === p;
18937
+ 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: [
18938
+ 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 }),
18939
+ /* @__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 }),
18940
+ f.size && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "11px", color: MUTED2, flexShrink: 0 }, children: f.size }),
18941
+ 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 } }),
18942
+ !disabled && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative", flexShrink: 0 }, children: [
18943
+ /* @__PURE__ */ jsxRuntime.jsxs(
18944
+ "button",
18945
+ {
18946
+ type: "button",
18947
+ onMouseDown: (e) => {
18948
+ e.preventDefault();
18949
+ setMenuFor(open ? null : p);
18950
+ },
18951
+ style: { font: "inherit", fontSize: "11px", fontWeight: 600, color: ACCENT2, background: "transparent", border: `1px solid ${BORDER4}`, borderRadius: "9999px", padding: "3px 9px", cursor: "pointer" },
18952
+ children: [
18953
+ gid === _FILEMAP_UNASSIGNED ? "Assign" : "Move",
18954
+ " \u25BE"
18955
+ ]
18956
+ }
18957
+ ),
18958
+ 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(
18959
+ "button",
18960
+ {
18961
+ type: "button",
18962
+ onMouseDown: (e) => {
18963
+ e.preventDefault();
18964
+ move(p, t);
18965
+ },
18966
+ 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" },
18967
+ children: labelOf(t)
18968
+ },
18969
+ t
18970
+ )) })
18971
+ ] })
18972
+ ] }, p);
18973
+ }) })
18974
+ ] }, gid);
18975
+ });
18976
+ 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" } }) });
18977
+ const countLabel = /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "11px", fontWeight: 600, color: MUTED2, textTransform: "uppercase", letterSpacing: "0.04em", whiteSpace: "nowrap", fontVariantNumeric: "tabular-nums" }, children: [
18978
+ assigned,
18979
+ " of ",
18980
+ total,
18981
+ " mapped"
18982
+ ] });
18983
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: boardRef, style: { width: "100%", maxWidth: "100%", boxSizing: "border-box", display: "flex", flexDirection: "column", gap: "8px" }, children: [
18984
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: "@keyframes agFmFade{from{opacity:0;transform:translateY(2px)}to{opacity:1;transform:none}}" }),
18985
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
18986
+ countLabel,
18987
+ progressBar
18988
+ ] }),
18989
+ cards()
18990
+ ] });
18991
+ }
18992
+ var FIELD_REGISTRY = {
18993
+ text: TextField,
18994
+ textarea: TextAreaField,
18995
+ number: NumberField,
18996
+ select: SelectField,
18997
+ multi_select: MultiSelectField,
18998
+ date: DateField,
18999
+ checkbox: CheckboxField,
19000
+ file_upload: FileUploadField,
19001
+ entity_picker: EntityPickerField,
19002
+ file_map: FileMapField
19003
+ };
19004
+ function FieldRenderer({ field, value, onChange, disabled, error, onFileUpload, onEntitySearch, onEntityCreate, dense }) {
19005
+ const { MUTED: MUTED2 } = useTheme();
19006
+ const FieldComp = FIELD_REGISTRY[field.field_type] || FIELD_REGISTRY.text;
19007
+ const isEntity = field.field_type === "entity_picker";
19008
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "3px" }, children: [
19009
+ field.field_type !== "checkbox" && /* @__PURE__ */ jsxRuntime.jsxs("label", { style: { fontSize: "12px", fontWeight: 600, color: "var(--foreground)", letterSpacing: "0.01em" }, children: [
19010
+ field.label,
19011
+ field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#dc2626", marginLeft: "2px" }, children: "*" })
19012
+ ] }),
19013
+ field.description && !dense && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "11px", color: MUTED2, lineHeight: 1.4 }, children: field.description }),
19014
+ /* @__PURE__ */ jsxRuntime.jsx(
19015
+ FieldComp,
19016
+ {
19017
+ field,
19018
+ value,
19019
+ onChange,
19020
+ disabled,
19021
+ error,
19022
+ dense,
19023
+ onFileUpload: field.field_type === "file_upload" ? onFileUpload : void 0,
19024
+ onEntitySearch: isEntity ? onEntitySearch : void 0,
19025
+ onEntityCreate: isEntity ? onEntityCreate : void 0
19026
+ }
19027
+ ),
19028
+ error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "11px", color: "#dc2626", fontWeight: 500, marginTop: "1px" }, children: error })
19029
+ ] });
19030
+ }
19031
+ init_ThemeContext();
19032
+ var SlotErrorBoundary = class extends React41__default.default.Component {
19033
+ constructor(props) {
19034
+ super(props);
19035
+ this.state = { hasError: false };
19036
+ }
19037
+ static getDerivedStateFromError() {
19038
+ return { hasError: true };
19039
+ }
19040
+ render() {
19041
+ if (this.state.hasError) return this.props.fallback;
19042
+ return this.props.children;
19043
+ }
19044
+ };
19045
+ function ContextRender({ payload }) {
19046
+ return resolveUI(payload);
19047
+ }
19048
+ var _a;
19049
+ var _isDev = typeof process !== "undefined" && ((_a = process.env) == null ? void 0 : _a.NODE_ENV) !== "production";
19050
+ function ContextSlot({ payload }) {
19051
+ const { MUTED: MUTED2, BORDER: BORDER4, PAPER: PAPER2 } = useTheme();
19052
+ if (!payload || typeof payload.type !== "string") return null;
19053
+ 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 });
19054
+ const result = validatePayload(payload.type, payload);
19055
+ const safePayload = result.success ? result.data : payload;
19056
+ if (!result.success && _isDev) {
19057
+ console.warn(`[ContextSlot] invalid embedded "${payload.type}" payload:`, result.error);
19058
+ }
19059
+ const fallback = note(
19060
+ _isDev ? `Couldn't render embedded ${payload.type}: ${result.success ? "render error" : result.error}` : `Couldn't render embedded ${payload.type}.`
19061
+ );
19062
+ if (!result.success) return fallback;
19063
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: S2.slot, children: /* @__PURE__ */ jsxRuntime.jsx(SlotErrorBoundary, { fallback, children: /* @__PURE__ */ jsxRuntime.jsx(ContextRender, { payload: safePayload }) }) });
19064
+ }
19065
+ var S2 = {
19066
+ slot: {
19067
+ marginBottom: "8px",
19068
+ borderRadius: "0.5rem",
19069
+ overflow: "hidden"
19070
+ }
19071
+ };
19072
+
19073
+ // src/builders/BuilderRecap.tsx
19074
+ init_ThemeContext();
19075
+ function BuilderRecap({ builder, state }) {
19076
+ const t = useTheme();
19077
+ const blocks = builder.blocks || [];
19078
+ const display = (field, value) => {
19079
+ if (value == null || value === "") return "";
19080
+ const opt = (v) => {
19081
+ var _a2, _b, _c;
19082
+ return (_c = (_b = (_a2 = field.options) == null ? void 0 : _a2.find((o) => o.value === v)) == null ? void 0 : _b.label) != null ? _c : String(v);
19083
+ };
19084
+ if (field.field_type === "multi_select" && Array.isArray(value)) return value.map(opt).join(", ");
19085
+ if (field.field_type === "select") return opt(value);
19086
+ if (field.field_type === "checkbox") return value ? "Yes" : "No";
19087
+ if (field.field_type === "entity_picker") {
19088
+ if (value && typeof value === "object") {
19089
+ const o = value;
19090
+ return o.label || o.value || "";
19091
+ }
19092
+ return String(value);
19093
+ }
19094
+ if (field.field_type === "file_upload") {
19095
+ const files = Array.isArray(value) ? value : [value];
19096
+ return files.map((x) => x && typeof x === "object" ? x.filename || x.name || "file" : String(x)).join(", ");
19097
+ }
19098
+ if (field.field_type === "file_map") {
19099
+ if (value && typeof value === "object" && !Array.isArray(value)) {
19100
+ let files = 0, roles = 0, unassigned = 0;
19101
+ for (const [g, paths] of Object.entries(value)) {
19102
+ const n = Array.isArray(paths) ? paths.length : 0;
19103
+ if (g === "unassigned") unassigned += n;
19104
+ else {
19105
+ files += n;
19106
+ if (n > 0) roles += 1;
19107
+ }
19108
+ }
19109
+ const tot = files + unassigned;
19110
+ return `${tot} file${tot !== 1 ? "s" : ""} \xB7 ${roles} role${roles !== 1 ? "s" : ""}${unassigned ? ` (${unassigned} unassigned)` : ""}`;
19111
+ }
19112
+ return String(value);
19113
+ }
19114
+ return String(value);
19115
+ };
19116
+ const decisionField = (b) => (b.fields || []).find((f) => f.field_type === "select") || (b.fields || [])[0];
19117
+ const rows = React41.useMemo(
19118
+ () => blocks.map((b) => {
19119
+ const df = decisionField(b);
19120
+ const decision = df ? display(df, state.getValue(b.id, df.name)) : "";
19121
+ 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);
19122
+ return { id: b.id, title: b.title, decision, extras };
19123
+ }),
19124
+ // eslint-disable-next-line react-hooks/exhaustive-deps
19125
+ [blocks, state.values]
19126
+ );
19127
+ const counts = React41.useMemo(() => {
19128
+ const m = /* @__PURE__ */ new Map();
19129
+ for (const r of rows) {
19130
+ const k = r.decision || "\u2014";
19131
+ m.set(k, (m.get(k) || 0) + 1);
19132
+ }
19133
+ return Array.from(m.entries());
19134
+ }, [rows]);
19135
+ const pill = (label) => {
19136
+ const l = label.toLowerCase();
19137
+ let fg = t.MUTED, bg = "#f2f2f2";
19138
+ if (/accept|approve|confirm|keep|yes/.test(l)) {
19139
+ fg = "#15803d";
19140
+ bg = "#dcfce7";
19141
+ } else if (/exclud|reject|remove|delete|deny|no\b/.test(l)) {
19142
+ fg = "#dc2626";
19143
+ bg = "#fef2f2";
19144
+ } else if (/reclass|change|edit|modif|review|other/.test(l)) {
19145
+ fg = t.SECONDARY;
19146
+ bg = "#e8f0fe";
19147
+ }
19148
+ return { fg, bg };
19149
+ };
19150
+ const total = rows.length;
19151
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: S3(t).card, children: [
19152
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: "@keyframes agRecapFade{from{opacity:0;transform:translateY(3px)}to{opacity:1;transform:none}}" }),
19153
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: S3(t).header, children: [
18590
19154
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "baseline", gap: "8px", flexWrap: "wrap" }, children: [
18591
19155
  /* @__PURE__ */ jsxRuntime.jsx("span", { style: S3(t).title, children: builder.title || "Submitted" }),
18592
19156
  /* @__PURE__ */ jsxRuntime.jsxs("span", { style: S3(t).reviewed, children: [
@@ -18683,21 +19247,173 @@ function S3(t) {
18683
19247
  }
18684
19248
  };
18685
19249
  }
18686
- function FormBuilder({ builder, state, onSubmit, onCancel, disabled, onFileUpload, dense, hideActions }) {
18687
- var _a;
19250
+ function fieldKey(blockId, name) {
19251
+ return `${blockId}\0${name}`;
19252
+ }
19253
+ function isRequiredMissing(fieldType, v) {
19254
+ if (fieldType === "checkbox") return v !== true;
19255
+ if (fieldType === "file_map") {
19256
+ if (!v || typeof v !== "object" || Array.isArray(v)) return true;
19257
+ return !Object.entries(v).some(
19258
+ ([g, paths]) => g !== "unassigned" && Array.isArray(paths) && paths.length > 0
19259
+ );
19260
+ }
19261
+ return v == null || v === "" || Array.isArray(v) && v.length === 0;
19262
+ }
19263
+ function useBuilderState(blocks) {
19264
+ const isMultiBlock = blocks.length > 1;
19265
+ const [values, setValues] = React41.useState(() => {
19266
+ const init = {};
19267
+ for (const block of blocks) {
19268
+ for (const field of block.fields || []) {
19269
+ if (field.default_value != null) init[fieldKey(block.id, field.name)] = field.default_value;
19270
+ }
19271
+ }
19272
+ return init;
19273
+ });
19274
+ const [errors, setErrors] = React41.useState({});
19275
+ const [currentBlock, setCurrentBlock] = React41.useState(0);
19276
+ const getValue = React41.useCallback(
19277
+ (blockId, name) => values[fieldKey(blockId, name)],
19278
+ [values]
19279
+ );
19280
+ const getError = React41.useCallback(
19281
+ (blockId, name) => errors[fieldKey(blockId, name)],
19282
+ [errors]
19283
+ );
19284
+ const setFieldValue = React41.useCallback((blockId, name, value) => {
19285
+ const k = fieldKey(blockId, name);
19286
+ setValues((prev) => __spreadProps(__spreadValues({}, prev), { [k]: value }));
19287
+ setErrors((prev) => {
19288
+ if (!prev[k]) return prev;
19289
+ const next = __spreadValues({}, prev);
19290
+ delete next[k];
19291
+ return next;
19292
+ });
19293
+ }, []);
19294
+ const validateBlock = React41.useCallback(
19295
+ (blockIdx) => {
19296
+ const block = blocks[blockIdx];
19297
+ if (!block) return true;
19298
+ const newErrors = {};
19299
+ for (const field of block.fields || []) {
19300
+ const k = fieldKey(block.id, field.name);
19301
+ const v = values[k];
19302
+ if (field.required) {
19303
+ if (isRequiredMissing(field.field_type, v)) {
19304
+ newErrors[k] = "Required";
19305
+ continue;
19306
+ }
19307
+ }
19308
+ if (v == null || v === "") continue;
19309
+ const val = field.validation;
19310
+ if (!val) continue;
19311
+ if (val.min_length && typeof v === "string" && v.length < val.min_length) {
19312
+ newErrors[k] = `Min ${val.min_length} characters`;
19313
+ } else if (val.max_length && typeof v === "string" && v.length > val.max_length) {
19314
+ newErrors[k] = `Max ${val.max_length} characters`;
19315
+ } else if (val.min != null && typeof v === "number" && v < val.min) {
19316
+ newErrors[k] = `Min ${val.min}`;
19317
+ } else if (val.max != null && typeof v === "number" && v > val.max) {
19318
+ newErrors[k] = `Max ${val.max}`;
19319
+ } else if (val.pattern && typeof v === "string" && !new RegExp(val.pattern).test(v)) {
19320
+ newErrors[k] = "Invalid format";
19321
+ }
19322
+ }
19323
+ setErrors((prev) => __spreadValues(__spreadValues({}, prev), newErrors));
19324
+ return Object.keys(newErrors).length === 0;
19325
+ },
19326
+ [blocks, values]
19327
+ );
19328
+ const validateAllDetailed = React41.useCallback(() => {
19329
+ let firstBlockIndex = -1;
19330
+ let firstKey = null;
19331
+ let firstBlockId = null;
19332
+ let firstName = null;
19333
+ const failingKeys = [];
19334
+ const allErrors = {};
19335
+ for (let i = 0; i < blocks.length; i++) {
19336
+ const block = blocks[i];
19337
+ for (const field of block.fields || []) {
19338
+ const k = fieldKey(block.id, field.name);
19339
+ const v = values[k];
19340
+ if (field.required && isRequiredMissing(field.field_type, v)) {
19341
+ allErrors[k] = "Required";
19342
+ failingKeys.push(k);
19343
+ if (firstBlockIndex < 0) {
19344
+ firstBlockIndex = i;
19345
+ firstKey = k;
19346
+ firstBlockId = block.id;
19347
+ firstName = field.name;
19348
+ }
19349
+ }
19350
+ }
19351
+ }
19352
+ setErrors(allErrors);
19353
+ if (firstBlockIndex >= 0) setCurrentBlock(firstBlockIndex);
19354
+ return { firstKey, firstBlockId, firstName, firstBlockIndex, failingKeys };
19355
+ }, [blocks, values]);
19356
+ const validateAll = React41.useCallback(
19357
+ () => validateAllDetailed().failingKeys.length === 0,
19358
+ [validateAllDetailed]
19359
+ );
19360
+ return {
19361
+ values,
19362
+ errors,
19363
+ getValue,
19364
+ getError,
19365
+ setFieldValue,
19366
+ validateBlock,
19367
+ validateAll,
19368
+ validateAllDetailed,
19369
+ currentBlock,
19370
+ setCurrentBlock,
19371
+ isMultiBlock
19372
+ };
19373
+ }
19374
+ function BlockForm({
19375
+ builder,
19376
+ state,
19377
+ onSubmit,
19378
+ onCancel,
19379
+ disabled,
19380
+ onFileUpload,
19381
+ onEntitySearch,
19382
+ onEntityCreate,
19383
+ hideActions,
19384
+ dense,
19385
+ variant = "form"
19386
+ }) {
19387
+ var _a2;
18688
19388
  const t = useTheme();
18689
19389
  const S4 = React41.useMemo(() => makeStyles(t), [t]);
18690
19390
  const block = builder.blocks[0];
19391
+ const isEscalation = variant === "escalation";
19392
+ const errorCount = ((block == null ? void 0 : block.fields) || []).reduce(
19393
+ (n, f) => state.getError(block.id, f.name) ? n + 1 : n,
19394
+ 0
19395
+ );
18691
19396
  if (!block) return null;
18692
19397
  if (disabled) return /* @__PURE__ */ jsxRuntime.jsx(BuilderRecap, { builder, state });
18693
- const containerStyle = dense ? { display: "flex", flexDirection: "column", gap: "12px" } : S4.card;
19398
+ const containerStyle = dense ? { display: "flex", flexDirection: "column", gap: isEscalation ? "10px" : "12px" } : isEscalation ? S4.escalationCard : S4.formCard;
18694
19399
  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: [
19400
+ !isEscalation && !dense ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
18696
19401
  /* @__PURE__ */ jsxRuntime.jsx("p", { style: S4.title, children: builder.title }),
18697
19402
  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(
19403
+ ] }) : builder.description && /* @__PURE__ */ jsxRuntime.jsx(
19404
+ "p",
19405
+ {
19406
+ style: {
19407
+ fontSize: isEscalation && !dense ? "13px" : "12px",
19408
+ color: isEscalation && !dense ? "var(--foreground)" : t.MUTED,
19409
+ lineHeight: 1.45,
19410
+ margin: 0
19411
+ },
19412
+ children: builder.description
19413
+ }
19414
+ ),
19415
+ ((_a2 = block.context) == null ? void 0 : _a2.type) && /* @__PURE__ */ jsxRuntime.jsx(ContextSlot, { payload: block.context }),
19416
+ /* @__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
19417
  FieldRenderer,
18702
19418
  {
18703
19419
  field,
@@ -18706,20 +19422,45 @@ function FormBuilder({ builder, state, onSubmit, onCancel, disabled, onFileUploa
18706
19422
  disabled,
18707
19423
  error: state.getError(block.id, field.name),
18708
19424
  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" })
19425
+ onFileUpload,
19426
+ onEntitySearch,
19427
+ onEntityCreate
19428
+ }
19429
+ ) }, `${block.id}:${field.name}`)) }),
19430
+ hideActions ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "6px", paddingTop: isEscalation ? "2px" : "4px" }, children: [
19431
+ errorCount > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { fontSize: "11px", fontWeight: 600, color: "#dc2626" }, children: [
19432
+ errorCount,
19433
+ " required field",
19434
+ errorCount === 1 ? "" : "s",
19435
+ " need",
19436
+ errorCount === 1 ? "s" : "",
19437
+ " attention"
19438
+ ] }) : null,
19439
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
19440
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1 } }),
19441
+ onCancel ? /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onCancel, style: S4.cancelBtn, children: builder.cancel_label || "Cancel" }) : null,
19442
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onSubmit, style: isEscalation ? S4.continueBtn : S4.submitBtn, children: builder.submit_label || (isEscalation ? "Continue" : "Submit") })
19443
+ ] })
18717
19444
  ] })
18718
19445
  ] });
18719
19446
  }
18720
19447
  function makeStyles(t) {
18721
19448
  return {
18722
- card: {
19449
+ // Escalation: accent left-rail card (attention).
19450
+ escalationCard: {
19451
+ display: "flex",
19452
+ flexDirection: "column",
19453
+ gap: "10px",
19454
+ padding: "12px 14px",
19455
+ borderRadius: "0.75rem",
19456
+ borderTop: `1px solid ${t.BORDER}`,
19457
+ borderRight: `1px solid ${t.BORDER}`,
19458
+ borderBottom: `1px solid ${t.BORDER}`,
19459
+ borderLeft: `2px solid ${t.ACCENT}`,
19460
+ background: "white"
19461
+ },
19462
+ // Form: standard bordered card with a soft shadow.
19463
+ formCard: {
18723
19464
  display: "flex",
18724
19465
  flexDirection: "column",
18725
19466
  gap: "14px",
@@ -18729,11 +19470,6 @@ function makeStyles(t) {
18729
19470
  background: "white",
18730
19471
  boxShadow: "0 1px 2px rgba(0,0,0,0.03), 0 4px 12px rgba(0,0,0,0.04)"
18731
19472
  },
18732
- inert: {
18733
- opacity: 0.55,
18734
- pointerEvents: "none",
18735
- userSelect: "none"
18736
- },
18737
19473
  title: {
18738
19474
  fontFamily: "var(--font-serif)",
18739
19475
  fontSize: "15px",
@@ -18742,6 +19478,23 @@ function makeStyles(t) {
18742
19478
  letterSpacing: "-0.01em",
18743
19479
  margin: 0
18744
19480
  },
19481
+ // Escalation CTA: outlined accent pill.
19482
+ continueBtn: {
19483
+ font: "inherit",
19484
+ fontSize: "12px",
19485
+ fontWeight: 600,
19486
+ color: t.ACCENT,
19487
+ background: "transparent",
19488
+ borderTop: `1px solid ${t.ACCENT}`,
19489
+ borderRight: `1px solid ${t.ACCENT}`,
19490
+ borderBottom: `1px solid ${t.ACCENT}`,
19491
+ borderLeft: `1px solid ${t.ACCENT}`,
19492
+ borderRadius: "9999px",
19493
+ padding: "6px 14px",
19494
+ cursor: "pointer",
19495
+ transition: "all 0.15s"
19496
+ },
19497
+ // Form CTA: filled accent pill.
18745
19498
  submitBtn: {
18746
19499
  font: "inherit",
18747
19500
  fontSize: "12px",
@@ -18771,8 +19524,8 @@ function makeStyles(t) {
18771
19524
 
18772
19525
  // src/builders/StepperBuilder.tsx
18773
19526
  init_ThemeContext();
18774
- function StepperBuilder({ builder, state, onSubmit, onCancel, disabled, onFileUpload, dense }) {
18775
- var _a;
19527
+ function StepperBuilder({ builder, state, onSubmit, onCancel, disabled, onFileUpload, onEntitySearch, onEntityCreate, dense }) {
19528
+ var _a2;
18776
19529
  const t = useTheme();
18777
19530
  const S4 = React41.useMemo(() => makeStyles2(t), [t]);
18778
19531
  const { blocks } = builder;
@@ -18811,7 +19564,7 @@ function StepperBuilder({ builder, state, onSubmit, onCancel, disabled, onFileUp
18811
19564
  ] }),
18812
19565
  /* @__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
19566
  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 }),
19567
+ ((_a2 = block.context) == null ? void 0 : _a2.type) && /* @__PURE__ */ jsxRuntime.jsx(ContextSlot, { payload: block.context }),
18815
19568
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: (block.fields || []).map((field) => /* @__PURE__ */ jsxRuntime.jsx(
18816
19569
  FieldRenderer,
18817
19570
  {
@@ -18821,7 +19574,9 @@ function StepperBuilder({ builder, state, onSubmit, onCancel, disabled, onFileUp
18821
19574
  disabled,
18822
19575
  error: state.getError(block.id, field.name),
18823
19576
  dense,
18824
- onFileUpload
19577
+ onFileUpload,
19578
+ onEntitySearch,
19579
+ onEntityCreate
18825
19580
  },
18826
19581
  `${block.id}:${field.name}`
18827
19582
  )) })
@@ -18947,168 +19702,19 @@ function makeStyles2(t) {
18947
19702
  }
18948
19703
  };
18949
19704
  }
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
19705
  function BuilderFormResolver({
19103
19706
  builder,
19104
19707
  onSubmit,
19105
19708
  onCancel,
19106
19709
  disabled,
19107
19710
  onFileUpload,
19711
+ onEntitySearch,
19712
+ onEntityCreate,
19108
19713
  onChange,
19109
19714
  submitRef,
19110
19715
  hideActions,
19111
- dense
19716
+ dense,
19717
+ onValidationError
19112
19718
  }) {
19113
19719
  const state = useBuilderState(builder.blocks);
19114
19720
  const kind = builder.builder_kind || "form";
@@ -19126,9 +19732,13 @@ function BuilderFormResolver({
19126
19732
  }, [builder, kind, state.getValue]);
19127
19733
  const handleSubmit = React41.useCallback(() => {
19128
19734
  if (disabled) return;
19129
- if (!state.validateAll()) return;
19735
+ const failure = state.validateAllDetailed();
19736
+ if (failure.failingKeys.length > 0) {
19737
+ onValidationError == null ? void 0 : onValidationError(failure);
19738
+ return;
19739
+ }
19130
19740
  onSubmit(buildSubmission());
19131
- }, [disabled, state.validateAll, onSubmit, buildSubmission]);
19741
+ }, [disabled, state.validateAllDetailed, onSubmit, buildSubmission, onValidationError]);
19132
19742
  React41.useEffect(() => {
19133
19743
  if (!onChange) return;
19134
19744
  onChange(buildSubmission());
@@ -19151,32 +19761,40 @@ function BuilderFormResolver({
19151
19761
  onCancel,
19152
19762
  disabled,
19153
19763
  onFileUpload,
19764
+ onEntitySearch,
19765
+ onEntityCreate,
19154
19766
  dense
19155
19767
  }
19156
19768
  );
19157
19769
  case "escalation":
19158
19770
  return /* @__PURE__ */ jsxRuntime.jsx(
19159
- EscalationCard,
19771
+ BlockForm,
19160
19772
  {
19773
+ variant: "escalation",
19161
19774
  builder,
19162
19775
  state,
19163
19776
  onSubmit: handleSubmit,
19164
19777
  disabled,
19165
19778
  onFileUpload,
19779
+ onEntitySearch,
19780
+ onEntityCreate,
19166
19781
  hideActions,
19167
19782
  dense
19168
19783
  }
19169
19784
  );
19170
19785
  default:
19171
19786
  return /* @__PURE__ */ jsxRuntime.jsx(
19172
- FormBuilder,
19787
+ BlockForm,
19173
19788
  {
19789
+ variant: "form",
19174
19790
  builder,
19175
19791
  state,
19176
19792
  onSubmit: handleSubmit,
19177
19793
  onCancel,
19178
19794
  disabled,
19179
19795
  onFileUpload,
19796
+ onEntitySearch,
19797
+ onEntityCreate,
19180
19798
  dense,
19181
19799
  hideActions
19182
19800
  }