@nivaro/react 0.3.35 → 0.3.37

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 (106) hide show
  1. package/dist/components/slots/CommentsSlot.js +44 -36
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +13 -4
  5. package/dist/shared/components/AgentBadge.js +26 -0
  6. package/dist/shared/components/AgentQuestionsCard.js +198 -0
  7. package/dist/shared/components/ItemEditForm.js +3329 -3263
  8. package/dist/shared/components/McpConnectionScope.js +480 -0
  9. package/dist/shared/components/MyWorkView.js +223 -208
  10. package/dist/shared/components/RecordReadView.js +620 -572
  11. package/dist/shared/components/chat/ChatPanel.js +683 -671
  12. package/dist/shared/components/imports/DownloadSampleButton.js +69 -0
  13. package/dist/shared/components/imports/ImportConsole.js +106 -104
  14. package/dist/shared/components/imports/RunDetailSheet.js +11 -10
  15. package/dist/shared/components/item-edit/FieldAffordances.js +32 -32
  16. package/dist/shared/components/item-edit/FormTour.js +279 -0
  17. package/dist/shared/components/item-edit/GroupSection.js +377 -360
  18. package/dist/shared/components/item-edit/PersonalDefaultControl.js +80 -63
  19. package/dist/shared/components/item-edit/entry/EntryStrip.js +30 -26
  20. package/dist/shared/components/item-edit/form-density.js +36 -0
  21. package/dist/shared/components/item-edit/useFormUsageBeacon.js +59 -46
  22. package/dist/shared/components/item-edit/usePersonalDefaults.js +312 -296
  23. package/dist/shared/components/layout-editor/AddPanel.js +349 -192
  24. package/dist/shared/components/layout-editor/DesignNode.js +146 -131
  25. package/dist/shared/components/layout-editor/EditorCanvas.js +25 -17
  26. package/dist/shared/components/layout-editor/EditorTopBar.js +268 -206
  27. package/dist/shared/components/layout-editor/LayoutEditor.js +810 -731
  28. package/dist/shared/components/layout-editor/PlaceTools.js +334 -0
  29. package/dist/shared/components/layout-editor/SlashInsert.js +252 -0
  30. package/dist/shared/components/layout-editor/StructureMenu.js +285 -242
  31. package/dist/shared/components/layout-editor/add-target.js +54 -43
  32. package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +238 -155
  33. package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +1 -1
  34. package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +15 -12
  35. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +379 -185
  36. package/dist/shared/components/layout-editor/dnd/TrashZone.js +96 -0
  37. package/dist/shared/components/layout-editor/dnd/UndoChip.js +76 -0
  38. package/dist/shared/components/layout-editor/dnd/merge-drop.js +33 -0
  39. package/dist/shared/components/layout-editor/dnd/multi-drop.js +87 -0
  40. package/dist/shared/components/layout-editor/dnd/node.js +115 -105
  41. package/dist/shared/components/layout-editor/dnd/rail-drop.js +4 -4
  42. package/dist/shared/components/layout-editor/dnd/sensors.js +23 -0
  43. package/dist/shared/components/layout-editor/dnd/trash-drop.js +58 -0
  44. package/dist/shared/components/layout-editor/dnd/trash-links.js +97 -0
  45. package/dist/shared/components/layout-editor/even-row.js +86 -0
  46. package/dist/shared/components/layout-editor/field-list.js +99 -0
  47. package/dist/shared/components/layout-editor/format-painter.js +102 -0
  48. package/dist/shared/components/layout-editor/grid-guides.js +15 -13
  49. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +150 -132
  50. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +57 -53
  51. package/dist/shared/components/layout-editor/inspector/EvenRowAction.js +31 -0
  52. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +154 -141
  53. package/dist/shared/components/layout-editor/inspector/Inspector.js +209 -178
  54. package/dist/shared/components/layout-editor/inspector/LookTab.js +106 -98
  55. package/dist/shared/components/layout-editor/inspector/RulesTab.js +38 -37
  56. package/dist/shared/components/layout-editor/inspector/kit.js +280 -223
  57. package/dist/shared/components/layout-editor/keyboard-move.js +15 -15
  58. package/dist/shared/components/layout-editor/lint/LabelStyle.js +201 -0
  59. package/dist/shared/components/layout-editor/lint/LintPanel.js +132 -84
  60. package/dist/shared/components/layout-editor/lint/lint-api.js +65 -28
  61. package/dist/shared/components/layout-editor/nav/NavTools.js +14 -12
  62. package/dist/shared/components/layout-editor/nav/ZoomControls.js +145 -0
  63. package/dist/shared/components/layout-editor/nav/useEditorNav.js +34 -32
  64. package/dist/shared/components/layout-editor/nav/view-prefs.js +100 -15
  65. package/dist/shared/components/layout-editor/outputs/LayoutFile.js +89 -0
  66. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +272 -195
  67. package/dist/shared/components/layout-editor/outputs/layout-file-plan.js +176 -0
  68. package/dist/shared/components/layout-editor/outputs/output-api.js +71 -37
  69. package/dist/shared/components/layout-editor/overview/describe-conditions.js +16 -11
  70. package/dist/shared/components/layout-editor/overview/purpose.js +5 -5
  71. package/dist/shared/components/layout-editor/panel-frame.js +1 -1
  72. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  73. package/dist/shared/components/layout-editor/personal-default-marks.js +40 -0
  74. package/dist/shared/components/layout-editor/pin.js +37 -19
  75. package/dist/shared/components/layout-editor/place-clip.js +257 -0
  76. package/dist/shared/components/layout-editor/preview/PreviewModes.js +27 -26
  77. package/dist/shared/components/layout-editor/preview/PreviewPanes.js +149 -118
  78. package/dist/shared/components/layout-editor/preview/SampleRecord.js +113 -0
  79. package/dist/shared/components/layout-editor/preview/preview-model.js +79 -60
  80. package/dist/shared/components/layout-editor/preview/sample-record.js +105 -0
  81. package/dist/shared/components/layout-editor/removed-log.js +151 -0
  82. package/dist/shared/components/layout-editor/reuse/LibraryRows.js +109 -78
  83. package/dist/shared/components/layout-editor/reuse/linked-sections.js +373 -0
  84. package/dist/shared/components/layout-editor/revert-element.js +140 -0
  85. package/dist/shared/components/layout-editor/section-structure.js +193 -170
  86. package/dist/shared/components/layout-editor/settings/EntrySection.js +63 -45
  87. package/dist/shared/components/layout-editor/settings/LayoutSection.js +63 -32
  88. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +179 -137
  89. package/dist/shared/components/layout-editor/settings/WhoSection.js +18 -17
  90. package/dist/shared/components/layout-editor/settings/settings-registry.js +24 -0
  91. package/dist/shared/components/layout-editor/shortcuts.js +21 -16
  92. package/dist/shared/components/layout-editor/structure-ops.js +221 -195
  93. package/dist/shared/components/layout-editor/usage/UsagePanel.js +133 -85
  94. package/dist/shared/components/layout-editor/usage/refusal-lens.js +130 -0
  95. package/dist/shared/components/layout-editor/usage/usage-api.js +12 -11
  96. package/dist/shared/components/panels/CommentPanel.js +47 -45
  97. package/dist/shared/components/panels/RevisionsPanel.js +66 -64
  98. package/dist/shared/components/panels/TaskPanel.js +395 -332
  99. package/dist/shared/components/profile/AgentsPanel.js +196 -147
  100. package/dist/shared/components/profile/ConnectionRollback.js +329 -0
  101. package/dist/shared/components/profile/MyDefaultsCard.js +526 -520
  102. package/dist/shared/lib/entry-config.js +22 -22
  103. package/dist/shared/lib/form-usage-beacon.js +91 -55
  104. package/dist/shared/lib/layout-lint.js +530 -284
  105. package/dist/shared/lib/layout-resolve.js +58 -44
  106. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  import { jsx as e, jsxs as x, Fragment as vt } from "react/jsx-runtime";
2
- import { useQuery as ce, useQueryClient as St } from "@tanstack/react-query";
3
- import * as kt from "lucide-react";
2
+ import { useQuery as ce, useQueryClient as kt } from "@tanstack/react-query";
3
+ import * as St from "lucide-react";
4
4
  import { ChevronDown as Dt, Loader2 as $t, User as Ft, Mail as jt } from "lucide-react";
5
- import it, { useState as Y, useRef as ke, useEffect as ne, memo as Ot } from "react";
5
+ import it, { useState as Y, useRef as Se, useEffect as ne, memo as Ot } from "react";
6
6
  import { fieldDrilldownConfig as qt, useDrilldown as Bt, useOptionalNivaroClient as de, useNavigation as Lt } from "../../context.js";
7
7
  import { get as st, post as Ut } from "../../lib/commands.js";
8
8
  import { planFieldGrid as Mt, isEmptyValue as Tt, isFolded as Gt, readGroupStructure as It } from "../../lib/form-structure.js";
@@ -15,7 +15,7 @@ import { GridGuides as ve } from "../layout-editor/grid-guides.js";
15
15
  import { UserAvatar as zt } from "../UserAvatar.js";
16
16
  import { DropdownMenu as Ht, DropdownMenuTrigger as Kt, DropdownMenuContent as Et, DropdownMenuItem as Ae } from "../ui/dropdown-menu.js";
17
17
  import { WidgetSlot as Ye } from "../WidgetSlot.js";
18
- import { FieldRow as Se } from "./FieldRow.js";
18
+ import { FieldRow as ke } from "./FieldRow.js";
19
19
  import { useFormHelpVideos as Wt, FormHelpVideoButton as At } from "./FormHelpVideoButton.js";
20
20
  import { FoldArea as Yt, RowGroupCell as Qt, rowMemberField as Zt } from "./form-structure-ui.js";
21
21
  import { applyDisplayTemplate as Xt, useContainerWidth as en, resolveColSpan as Qe } from "./helpers.js";
@@ -45,7 +45,7 @@ function ln({
45
45
  staleTime: 6e4
46
46
  });
47
47
  if (!m) return null;
48
- const S = (f) => {
48
+ const k = (f) => {
49
49
  let b = m;
50
50
  for (const y of f.split(".")) {
51
51
  if (b == null || typeof b != "object") return;
@@ -55,28 +55,28 @@ function ln({
55
55
  };
56
56
  if (a != null) {
57
57
  const f = (F) => {
58
- const k = S(F.field);
59
- if (k == null || k === "") return null;
58
+ const S = k(F.field);
59
+ if (S == null || S === "") return null;
60
60
  const D = F.format ?? "text";
61
61
  if (D === "date" || D === "datetime")
62
62
  try {
63
- return De(k);
63
+ return De(S);
64
64
  } catch {
65
- return String(k);
65
+ return String(S);
66
66
  }
67
- return D === "boolean" ? k ? "Yes" : "No" : String(k);
67
+ return D === "boolean" ? S ? "Yes" : "No" : String(S);
68
68
  }, b = [];
69
69
  let y = [];
70
70
  for (const F of i)
71
71
  F.line_break && y.length > 0 ? (b.push(y), y = [F]) : y.push(F);
72
72
  y.length > 0 && b.push(y);
73
73
  const q = b.map(
74
- (F) => F.map((k) => {
75
- const D = f(k);
76
- return D ? { label: k.label ?? null, display: D } : null;
74
+ (F) => F.map((S) => {
75
+ const D = f(S);
76
+ return D ? { label: S.label ?? null, display: D } : null;
77
77
  }).filter(Boolean)
78
78
  ).filter((F) => F.length > 0);
79
- return q.length === 0 ? null : /* @__PURE__ */ e("div", { className: "mt-1", children: q.map((F, k) => (
79
+ return q.length === 0 ? null : /* @__PURE__ */ e("div", { className: "mt-1", children: q.map((F, S) => (
80
80
  // biome-ignore lint/suspicious/noArrayIndexKey: stable line order
81
81
  /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: F.map((D, M) => (
82
82
  // biome-ignore lint/suspicious/noArrayIndexKey: stable token order
@@ -89,11 +89,11 @@ function ln({
89
89
  D.label ? " " : "",
90
90
  D.display
91
91
  ] }, M)
92
- )) }, k)
92
+ )) }, S)
93
93
  )) });
94
94
  }
95
95
  const c = i.map((f) => {
96
- const b = S(f.field);
96
+ const b = k(f.field);
97
97
  if (b == null || b === "") return null;
98
98
  const y = f.format ?? "text";
99
99
  let q;
@@ -116,7 +116,7 @@ function ln({
116
116
  }
117
117
  function an(n) {
118
118
  if (!n) return null;
119
- const t = n.replace(/(^|-)([a-z])/g, (a, l, o) => o.toUpperCase()), i = kt[t];
119
+ const t = n.replace(/(^|-)([a-z])/g, (a, l, o) => o.toUpperCase()), i = St[t];
120
120
  return i || null;
121
121
  }
122
122
  function et(n) {
@@ -295,7 +295,7 @@ function on({
295
295
  filenameTemplate: l,
296
296
  label: o
297
297
  }) {
298
- const r = de(), s = St(), [p, m] = Y(!1), S = async () => {
298
+ const r = de(), s = kt(), [p, m] = Y(!1), k = async () => {
299
299
  if (!(!r || p || !a)) {
300
300
  m(!0);
301
301
  try {
@@ -317,7 +317,7 @@ function on({
317
317
  "button",
318
318
  {
319
319
  type: "button",
320
- onClick: S,
320
+ onClick: k,
321
321
  disabled: p || c,
322
322
  title: c ? "Configure PDF field in Data Model → Layouts" : void 0,
323
323
  className: "inline-flex items-center gap-1.5 rounded-md border border-nvr-cyan/40 bg-nvr-cyan/10 px-3 py-1.5 text-[12px] font-medium text-nvr-navy hover:bg-nvr-cyan/20 disabled:cursor-not-allowed disabled:opacity-40 dark:text-nvr-cyan",
@@ -357,14 +357,14 @@ function re({
357
357
  ).then((y) => y.data).catch(() => ({})),
358
358
  enabled: !!a && !!o,
359
359
  staleTime: 3e5
360
- }), s = (((b = r == null ? void 0 : r.display_template) == null ? void 0 : b.match(/\{\{\s*[^}]+?\s*\}\}/g)) ?? []).map((y) => y.replace(/[{}\s]/g, "")).filter((y) => y.includes(".")), p = s.length ? ["id", ...s].join(",") : null, { data: m, isLoading: S } = ce({
360
+ }), s = (((b = r == null ? void 0 : r.display_template) == null ? void 0 : b.match(/\{\{\s*[^}]+?\s*\}\}/g)) ?? []).map((y) => y.replace(/[{}\s]/g, "")).filter((y) => y.includes(".")), p = s.length ? ["id", ...s].join(",") : null, { data: m, isLoading: k } = ce({
361
361
  queryKey: ["rel-display", n, o, p],
362
362
  queryFn: () => l(n, o, p),
363
363
  enabled: !!a && !!o && r !== void 0,
364
364
  staleTime: 6e4
365
365
  });
366
366
  if (!o) return /* @__PURE__ */ e("span", { children: "—" });
367
- if (S || a && r === void 0)
367
+ if (k || a && r === void 0)
368
368
  return /* @__PURE__ */ e("span", { className: "animate-pulse h-3 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] inline-block" });
369
369
  const c = i ?? "text-[13px] text-slate-700";
370
370
  if (!m) return /* @__PURE__ */ e("span", { className: c, children: o });
@@ -407,7 +407,7 @@ function rt({
407
407
  );
408
408
  }
409
409
  function cn(n) {
410
- const [t, i] = Y(!1), a = ke(!0), l = ke(JSON.stringify(n ?? null));
410
+ const [t, i] = Y(!1), a = Se(!0), l = Se(JSON.stringify(n ?? null));
411
411
  return ne(() => {
412
412
  const o = JSON.stringify(n ?? null);
413
413
  if (a.current) {
@@ -447,15 +447,15 @@ function Tn({
447
447
  String(y)
448
448
  )) });
449
449
  }
450
- const S = i.find(
450
+ const k = i.find(
451
451
  (c) => c.many_collection === a && c.many_field === n.field && !c.junction_field
452
452
  );
453
- if (S != null && S.one_collection) {
453
+ if (k != null && k.one_collection) {
454
454
  const c = Array.isArray(t) ? t : t != null && t !== "" ? [t] : [];
455
- return c.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : S.one_collection === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: c.map((f) => /* @__PURE__ */ e(nt, { userId: String(f) }, String(f))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: c.map((f) => /* @__PURE__ */ e(
455
+ return c.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : k.one_collection === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: c.map((f) => /* @__PURE__ */ e(nt, { userId: String(f) }, String(f))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: c.map((f) => /* @__PURE__ */ e(
456
456
  rt,
457
457
  {
458
- relCollection: S.one_collection,
458
+ relCollection: k.one_collection,
459
459
  id: f,
460
460
  drillConfig: p
461
461
  },
@@ -504,7 +504,7 @@ function dn({
504
504
  ownersItemId: s,
505
505
  ownersAssignment: p,
506
506
  m2mCounts: m,
507
- o2mCounts: S,
507
+ o2mCounts: k,
508
508
  o2mAggValues: c,
509
509
  summaryAggConfigs: f,
510
510
  o2mLoading: b,
@@ -513,16 +513,16 @@ function dn({
513
513
  const q = n.map((N) => typeof N == "string" ? N : N.field), F = y ? q.filter((N) => {
514
514
  if (N === "__owners__" || b != null && b.has(N) || c && N in c) return !0;
515
515
  if (m && N in m) return (m[N] ?? 0) > 0;
516
- if (S && N in S) return (S[N] ?? 0) > 0;
516
+ if (k && N in k) return (k[N] ?? 0) > 0;
517
517
  const T = i[N];
518
518
  return T != null && T !== "" && !(Array.isArray(T) && T.length === 0);
519
519
  }) : q;
520
520
  if (F.length === 0) return null;
521
- const k = "text-[9px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500 shrink-0", D = "text-[12px] font-semibold text-slate-700 dark:text-slate-300", M = "text-[12px] text-slate-300 dark:text-slate-600", R = "flex items-baseline gap-1.5", ue = (N) => {
521
+ const S = "text-[9px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500 shrink-0", D = "text-[12px] font-semibold text-slate-700 dark:text-slate-300", M = "text-[12px] text-slate-300 dark:text-slate-600", R = "flex items-baseline gap-1.5", ue = (N) => {
522
522
  if (N === "__owners__") {
523
523
  const d = (p == null ? void 0 : p.label_override) || "Owners";
524
524
  return /* @__PURE__ */ x("div", { className: "flex items-center gap-1.5", children: [
525
- /* @__PURE__ */ e("span", { className: k, children: d }),
525
+ /* @__PURE__ */ e("span", { className: S, children: d }),
526
526
  /* @__PURE__ */ e(
527
527
  sn,
528
528
  {
@@ -535,7 +535,7 @@ function dn({
535
535
  const T = n.find((d) => (typeof d == "string" ? d : d.field) === N), me = T && typeof T != "string" ? T.label : void 0, H = t.find((d) => d.field === N), P = me || (H == null ? void 0 : H.label) || N.replace(/_/g, " ").replace(/\b\w/g, (d) => d.toUpperCase());
536
536
  if (b != null && b.has(N))
537
537
  return /* @__PURE__ */ x("div", { className: "flex items-center gap-1.5", children: [
538
- /* @__PURE__ */ e("span", { className: k, children: P }),
538
+ /* @__PURE__ */ e("span", { className: S, children: P }),
539
539
  /* @__PURE__ */ e($t, { className: "h-3 w-3 animate-spin text-slate-300" })
540
540
  ] });
541
541
  if (c && N in c) {
@@ -572,14 +572,14 @@ function dn({
572
572
  U = O.toLocaleString(void 0, { maximumFractionDigits: 2 });
573
573
  }
574
574
  return /* @__PURE__ */ x("div", { className: R, children: [
575
- /* @__PURE__ */ e("span", { className: k, children: L }),
575
+ /* @__PURE__ */ e("span", { className: S, children: L }),
576
576
  /* @__PURE__ */ e("span", { className: D, children: U })
577
577
  ] });
578
578
  }
579
579
  if (m && N in m) {
580
580
  const d = m[N];
581
581
  return /* @__PURE__ */ x("div", { className: R, children: [
582
- /* @__PURE__ */ e("span", { className: k, children: P }),
582
+ /* @__PURE__ */ e("span", { className: S, children: P }),
583
583
  /* @__PURE__ */ x("span", { className: D, children: [
584
584
  d,
585
585
  " item",
@@ -587,10 +587,10 @@ function dn({
587
587
  ] })
588
588
  ] });
589
589
  }
590
- if (S && N in S) {
591
- const d = S[N];
590
+ if (k && N in k) {
591
+ const d = k[N];
592
592
  return /* @__PURE__ */ x("div", { className: R, children: [
593
- /* @__PURE__ */ e("span", { className: k, children: P }),
593
+ /* @__PURE__ */ e("span", { className: S, children: P }),
594
594
  /* @__PURE__ */ x("span", { className: D, children: [
595
595
  d,
596
596
  " row",
@@ -604,14 +604,14 @@ function dn({
604
604
  if (G != null && G.one_collection) {
605
605
  const d = Array.isArray(j) ? j : j != null && j !== "" ? [j] : [];
606
606
  return /* @__PURE__ */ x("div", { className: R, children: [
607
- /* @__PURE__ */ e("span", { className: k, children: P }),
607
+ /* @__PURE__ */ e("span", { className: S, children: P }),
608
608
  d.length === 0 ? /* @__PURE__ */ e("span", { className: M, children: "—" }) : G.one_collection === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5 gap-y-0.5", children: d.map((L) => /* @__PURE__ */ e(tt, { userId: String(L) }, String(L))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: d.map((L) => /* @__PURE__ */ e(re, { relCollection: G.one_collection, id: L }, String(L))) })
609
609
  ] });
610
610
  }
611
611
  if (Array.isArray(j)) {
612
612
  const d = a.find((O) => O.many_field === N && O.junction_field), L = d == null ? void 0 : d.one_collection;
613
613
  return /* @__PURE__ */ x("div", { className: R, children: [
614
- /* @__PURE__ */ e("span", { className: k, children: P }),
614
+ /* @__PURE__ */ e("span", { className: S, children: P }),
615
615
  j.length === 0 ? /* @__PURE__ */ e("span", { className: M, children: "—" }) : L ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5 gap-y-0.5", children: j.map(
616
616
  (O) => L === "nivaro_users" ? /* @__PURE__ */ e(tt, { userId: String(O) }, String(O)) : /* @__PURE__ */ e(re, { relCollection: L, id: O }, String(O))
617
617
  ) }) : /* @__PURE__ */ x("span", { className: D, children: [
@@ -622,11 +622,18 @@ function dn({
622
622
  ] });
623
623
  }
624
624
  return /* @__PURE__ */ x("div", { className: R, children: [
625
- /* @__PURE__ */ e("span", { className: k, children: P }),
625
+ /* @__PURE__ */ e("span", { className: S, children: P }),
626
626
  j == null || j === "" ? /* @__PURE__ */ e("span", { className: M, children: "—" }) : /* @__PURE__ */ e("span", { className: D, children: $e(j, H) })
627
627
  ] });
628
628
  };
629
- return /* @__PURE__ */ e("div", { className: "flex flex-wrap items-baseline gap-x-5 gap-y-1.5 border-t border-slate-100 dark:border-border/60 bg-slate-50/50 dark:bg-white/[0.015] px-5 py-2.5", children: F.map((N) => /* @__PURE__ */ e(it.Fragment, { children: ue(N) }, N)) });
629
+ return /* @__PURE__ */ e(
630
+ "div",
631
+ {
632
+ "data-summary-strip": "",
633
+ className: "flex flex-wrap items-baseline gap-x-5 gap-y-1.5 border-t border-slate-100 dark:border-border/60 bg-slate-50/50 dark:bg-white/[0.015] px-5 py-2.5",
634
+ children: F.map((N) => /* @__PURE__ */ e(it.Fragment, { children: ue(N) }, N))
635
+ }
636
+ );
630
637
  }
631
638
  const Gn = Ot(function({
632
639
  group: t,
@@ -638,14 +645,14 @@ const Gn = Ot(function({
638
645
  itemId: s,
639
646
  errors: p,
640
647
  visibleFields: m,
641
- lockedFields: S,
648
+ lockedFields: k,
642
649
  layoutAiEnabled: c,
643
650
  displayOnly: f,
644
651
  renderField: b,
645
652
  onCountChange: y,
646
653
  isNew: q,
647
654
  fieldValues: F,
648
- isOpen: k,
655
+ isOpen: S,
649
656
  onToggle: D,
650
657
  summaryFields: M,
651
658
  m2mCounts: R,
@@ -680,7 +687,7 @@ const Gn = Ot(function({
680
687
  }, [X == null ? void 0 : X.seq]), ne(() => {
681
688
  ee && Rt(ee.target) === t.key && be(!1);
682
689
  }, [ee == null ? void 0 : ee.seq]);
683
- const Ue = D !== void 0, z = Le ?? (Ue ? !k : dt);
690
+ const Ue = D !== void 0, z = Le ?? (Ue ? !S : dt);
684
691
  ne(() => {
685
692
  ie && !z && (se == null || se(t.key));
686
693
  }, [ie, z, se, t.key]);
@@ -695,7 +702,7 @@ const Gn = Ot(function({
695
702
  if (t.hide_when_empty && F && !$ && (ae = F.every(
696
703
  (_) => _ == null || _ === "" || Array.isArray(_) && _.length === 0
697
704
  ) && !bt && te.every((_) => !qe[_.field])), ae && te.length === 0) return null;
698
- const ye = ke(null), Ne = en(ye), Ge = an(t.icon), gt = Oe ? i : i.filter((h) => !h.hidden), Ie = (Pe = he == null ? void 0 : he.sections) == null ? void 0 : Pe[t.key], xt = Array.isArray(Ie) && Ie.length > 0, yt = (h) => xt ? /* @__PURE__ */ x("div", { className: "relative", children: [
705
+ const ye = Se(null), Ne = en(ye), Ge = an(t.icon), gt = Oe ? i : i.filter((h) => !h.hidden), Ie = (Pe = he == null ? void 0 : he.sections) == null ? void 0 : Pe[t.key], xt = Array.isArray(Ie) && Ie.length > 0, yt = (h) => xt ? /* @__PURE__ */ x("div", { className: "relative", children: [
699
706
  h,
700
707
  /* @__PURE__ */ e("span", { className: "absolute right-[52px] top-1/2 flex -translate-y-1/2", children: /* @__PURE__ */ e(
701
708
  At,
@@ -795,347 +802,357 @@ const Gn = Ot(function({
795
802
  },
796
803
  h.field
797
804
  )) }),
798
- !z && /* @__PURE__ */ x("div", { className: "nvr-expand-in border-t border-slate-100 px-5 py-4", children: [
799
- !f && /* @__PURE__ */ e(tn, { group: t, className: "mb-3" }),
800
- (() => {
801
- const h = Mt(gt, {
802
- rows: f ? [] : It(t.swap_config).rows,
803
- folded: (u) => !f && Gt(u._overrides),
804
- keep: (u) => !!u.required,
805
- filled: (u) => !Tt(a[u.field]) || !!p[u.field]
806
- }), _ = h.units.map(
807
- (u) => u.kind === "row" ? {
808
- _k: `row:${u.row.key}`,
809
- sort: u.members[0].sort ?? 0,
810
- _t: "row",
811
- row: u.row,
812
- members: u.members
813
- } : { _k: u.field.field, sort: u.field.sort ?? 0, _t: "field", f: u.field }
814
- );
815
- G && _.push({
816
- _k: "__owners__",
817
- sort: G.sort,
818
- _t: "owners",
819
- slot: G
820
- }), d && _.push({
821
- _k: "__pdf__",
822
- sort: d.sort,
823
- _t: "pdf",
824
- slot: d
825
- });
826
- for (const u of A ?? [])
827
- _.push({ _k: u.field, sort: u.sort, _t: "widget", slot: u });
828
- return _.sort((u, B) => u.sort - B.sort), $ && _.length === 0 && h.folded.length === 0 ? /* @__PURE__ */ e(Vt, {}) : f ? /* @__PURE__ */ x(
829
- "div",
830
- {
831
- ref: ye,
832
- className: E($ && "relative", "grid grid-cols-12 gap-x-6 gap-y-3"),
833
- children: [
834
- /* @__PURE__ */ e(ve, { gapClass: "gap-x-6" }),
835
- _.map((u) => {
836
- if (u._t === "owners") {
837
- const v = u.slot.col_span ?? 12;
838
- return K(
839
- le("__owners__"),
840
- /* @__PURE__ */ e(
841
- "div",
842
- {
843
- className: "min-w-0",
844
- style: { gridColumn: `span ${v}` },
845
- children: /* @__PURE__ */ e(
846
- Ze,
805
+ !z && /* @__PURE__ */ x(
806
+ "div",
807
+ {
808
+ "data-section-body": "",
809
+ className: "nvr-expand-in border-t border-slate-100 px-5 py-4 dark:border-border/60",
810
+ children: [
811
+ !f && /* @__PURE__ */ e(tn, { group: t, className: "mb-3" }),
812
+ (() => {
813
+ const h = Mt(gt, {
814
+ rows: f ? [] : It(t.swap_config).rows,
815
+ folded: (u) => !f && Gt(u._overrides),
816
+ keep: (u) => !!u.required,
817
+ filled: (u) => !Tt(a[u.field]) || !!p[u.field]
818
+ }), _ = h.units.map(
819
+ (u) => u.kind === "row" ? {
820
+ _k: `row:${u.row.key}`,
821
+ sort: u.members[0].sort ?? 0,
822
+ _t: "row",
823
+ row: u.row,
824
+ members: u.members
825
+ } : { _k: u.field.field, sort: u.field.sort ?? 0, _t: "field", f: u.field }
826
+ );
827
+ G && _.push({
828
+ _k: "__owners__",
829
+ sort: G.sort,
830
+ _t: "owners",
831
+ slot: G
832
+ }), d && _.push({
833
+ _k: "__pdf__",
834
+ sort: d.sort,
835
+ _t: "pdf",
836
+ slot: d
837
+ });
838
+ for (const u of A ?? [])
839
+ _.push({ _k: u.field, sort: u.sort, _t: "widget", slot: u });
840
+ return _.sort((u, B) => u.sort - B.sort), $ && _.length === 0 && h.folded.length === 0 ? /* @__PURE__ */ e(Vt, {}) : f ? /* @__PURE__ */ x(
841
+ "div",
842
+ {
843
+ ref: ye,
844
+ "data-section-grid": "",
845
+ className: E($ && "relative", "grid grid-cols-12 gap-x-6 gap-y-3"),
846
+ children: [
847
+ /* @__PURE__ */ e(ve, { gapClass: "gap-x-6" }),
848
+ _.map((u) => {
849
+ if (u._t === "owners") {
850
+ const v = u.slot.col_span ?? 12;
851
+ return K(
852
+ le("__owners__"),
853
+ /* @__PURE__ */ e(
854
+ "div",
847
855
  {
856
+ className: "min-w-0",
857
+ style: { gridColumn: `span ${v}` },
858
+ children: /* @__PURE__ */ e(
859
+ Ze,
860
+ {
861
+ collection: r,
862
+ itemId: s,
863
+ label: u.slot.label_override || "Owners"
864
+ }
865
+ )
866
+ },
867
+ "__owners__"
868
+ )
869
+ );
870
+ }
871
+ if (u._t === "pdf" || u._t === "widget" || u._t === "row") return null;
872
+ const B = u.f, g = o.find(
873
+ (v) => v.many_collection === r && v.many_field === B.field && !v.junction_field
874
+ );
875
+ return K(
876
+ { kind: "field", field: B.field, group_key: t.key },
877
+ /* @__PURE__ */ x(
878
+ "div",
879
+ {
880
+ className: "min-w-0",
881
+ style: { gridColumn: `span ${Qe(B.options, Ne)}` },
882
+ children: [
883
+ /* @__PURE__ */ e("dt", { className: "text-[11px] font-medium text-slate-400 truncate", children: B.label || ot(B.field) }),
884
+ /* @__PURE__ */ e("dd", { className: "mt-0.5 break-words", children: (g == null ? void 0 : g.one_collection) === "nivaro_users" ? (() => {
885
+ const v = a[B.field], C = Array.isArray(v) ? v : v != null && v !== "" ? [v] : [];
886
+ return C.length === 0 ? /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-400", children: "—" }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: C.map((I) => /* @__PURE__ */ e(ct, { userId: String(I) }, String(I))) });
887
+ })() : g != null && g.one_collection ? /* @__PURE__ */ e(re, { relCollection: g.one_collection, id: a[B.field] }) : /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-700", children: $e(a[B.field], B) }) })
888
+ ]
889
+ },
890
+ B.field
891
+ )
892
+ );
893
+ })
894
+ ]
895
+ }
896
+ ) : (() => {
897
+ const u = (g) => {
898
+ var Ke, Ee;
899
+ if (g._t === "row")
900
+ return /* @__PURE__ */ e(
901
+ Qt,
902
+ {
903
+ row: g.row,
904
+ members: g.members,
905
+ containerWidth: Ne,
906
+ errors: p,
907
+ renderMember: (w) => K(
908
+ { kind: "field", field: w.field, group_key: t.key },
909
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
910
+ ke,
911
+ {
912
+ field: Zt(w),
913
+ draft: a,
914
+ onChange: l,
915
+ relations: o,
848
916
  collection: r,
849
917
  itemId: s,
850
- label: u.slot.label_override || "Owners"
918
+ error: p[w.field],
919
+ visible: m.has(w.field) || !m.size,
920
+ forceVisible: _e(w) || void 0,
921
+ locked: k.has(w.field),
922
+ layoutAiEnabled: c,
923
+ renderField: b,
924
+ onCountChange: y
851
925
  }
926
+ ) }, w.field)
927
+ )
928
+ },
929
+ g._k
930
+ );
931
+ if (g._t === "owners") {
932
+ const w = g.slot.col_span ?? 12;
933
+ return K(
934
+ le("__owners__"),
935
+ /* @__PURE__ */ e("div", { style: { gridColumn: `span ${w}` }, children: /* @__PURE__ */ e(
936
+ Ze,
937
+ {
938
+ collection: r,
939
+ itemId: s,
940
+ label: g.slot.label_override || "Owners"
941
+ }
942
+ ) }, "__owners__")
943
+ );
944
+ }
945
+ if (g._t === "pdf") {
946
+ if (!U) return null;
947
+ const w = g.slot.col_span ?? 12, J = ((Ke = g.slot.label_override) == null ? void 0 : Ke.trim()) || "Generate PDF";
948
+ return K(
949
+ le("__pdf__"),
950
+ /* @__PURE__ */ e("div", { style: { gridColumn: `span ${w}` }, children: /* @__PURE__ */ e(
951
+ on,
952
+ {
953
+ collection: r,
954
+ itemId: s,
955
+ layoutId: U,
956
+ attachField: L ?? null,
957
+ filenameTemplate: O,
958
+ label: J
959
+ }
960
+ ) }, "__pdf__")
961
+ );
962
+ }
963
+ if (g._t === "widget") {
964
+ if (!g.slot.widget_id) return null;
965
+ const w = g.slot.col_span ?? 12, J = Xe(g.slot.input_bindings);
966
+ return K(
967
+ le(g.slot.field),
968
+ /* @__PURE__ */ e("div", { style: { gridColumn: `span ${w}` }, children: /* @__PURE__ */ e(
969
+ Ye,
970
+ {
971
+ widgetId: g.slot.widget_id,
972
+ inputBindings: J,
973
+ itemDraft: a,
974
+ label: g.slot.label_override ?? void 0,
975
+ defaultExpanded: g.slot.default_expanded ?? !0,
976
+ frameless: !0,
977
+ apiBase: Q,
978
+ onContentChange: (We) => Be(
979
+ (we) => we[g.slot.field] === We ? we : { ...we, [g.slot.field]: We }
852
980
  )
853
- },
854
- "__owners__"
855
- )
981
+ }
982
+ ) }, g.slot.field)
856
983
  );
857
984
  }
858
- if (u._t === "pdf" || u._t === "widget" || u._t === "row") return null;
859
- const B = u.f, g = o.find(
860
- (v) => v.many_collection === r && v.many_field === B.field && !v.junction_field
985
+ const v = g.f, C = pe == null ? void 0 : pe[v.field], I = C == null ? void 0 : C.entries, Nt = (C == null ? void 0 : C.separator) ?? null, oe = a[v.field], Ve = oe != null && oe !== "", Ce = I != null && I.length && Ve ? ((Ee = o.find(
986
+ (w) => w.many_collection === r && w.many_field === v.field && !w.junction_field
987
+ )) == null ? void 0 : Ee.one_collection) ?? null : null, Je = (V == null ? void 0 : V.enabled) && v.field === V.primary_field, Re = (() => {
988
+ const w = a[(V == null ? void 0 : V.primary_field) ?? ""];
989
+ return w != null && w !== "";
990
+ })(), ze = (Z ?? []).some((w) => {
991
+ const J = a[w.field];
992
+ return J != null && J !== "";
993
+ }), _t = Je && je ? /* @__PURE__ */ x("span", { className: "inline-flex items-center gap-1.5", children: [
994
+ /* @__PURE__ */ e(
995
+ "button",
996
+ {
997
+ type: "button",
998
+ onClick: je,
999
+ className: "inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium text-nvr-cyan hover:bg-nvr-cyan/10 transition-colors",
1000
+ children: Fe ? V.back_label ?? "Back" : V.toggle_label ?? "Enter manually"
1001
+ }
1002
+ ),
1003
+ /* @__PURE__ */ x(
1004
+ "span",
1005
+ {
1006
+ className: [
1007
+ "inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[9px] font-medium",
1008
+ Re ? "bg-emerald-50 text-emerald-600 dark:bg-emerald-900/30 dark:text-emerald-400" : "bg-slate-100 text-slate-400 dark:bg-slate-800 dark:text-slate-500"
1009
+ ].join(" "),
1010
+ title: "Original field",
1011
+ children: [
1012
+ /* @__PURE__ */ e(
1013
+ "span",
1014
+ {
1015
+ className: [
1016
+ "h-1.5 w-1.5 rounded-full",
1017
+ Re ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
1018
+ ].join(" ")
1019
+ }
1020
+ ),
1021
+ "Original"
1022
+ ]
1023
+ }
1024
+ ),
1025
+ /* @__PURE__ */ x(
1026
+ "span",
1027
+ {
1028
+ className: [
1029
+ "inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[9px] font-medium",
1030
+ ze ? "bg-emerald-50 text-emerald-600 dark:bg-emerald-900/30 dark:text-emerald-400" : "bg-slate-100 text-slate-400 dark:bg-slate-800 dark:text-slate-500"
1031
+ ].join(" "),
1032
+ title: "Manual fields",
1033
+ children: [
1034
+ /* @__PURE__ */ e(
1035
+ "span",
1036
+ {
1037
+ className: [
1038
+ "h-1.5 w-1.5 rounded-full",
1039
+ ze ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
1040
+ ].join(" ")
1041
+ }
1042
+ ),
1043
+ "Manual"
1044
+ ]
1045
+ }
1046
+ )
1047
+ ] }) : void 0, wt = Je && Fe && (Z != null && Z.length) ? /* @__PURE__ */ e("div", { className: "mt-2 rounded-lg border border-slate-200 bg-slate-50 dark:border-border dark:bg-slate-900/40 p-3", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-3", children: Z.map((w) => {
1048
+ const J = (fe == null ? void 0 : fe[w.field]) ?? 2;
1049
+ return /* @__PURE__ */ e("div", { style: { gridColumn: `span ${J}` }, children: /* @__PURE__ */ e(
1050
+ ke,
1051
+ {
1052
+ field: w,
1053
+ draft: a,
1054
+ onChange: l,
1055
+ relations: o,
1056
+ collection: r,
1057
+ itemId: s,
1058
+ error: p[w.field],
1059
+ visible: !0,
1060
+ forceVisible: !0,
1061
+ locked: k.has(w.field),
1062
+ layoutAiEnabled: c,
1063
+ renderField: b,
1064
+ onCountChange: y
1065
+ }
1066
+ ) }, w.field);
1067
+ }) }) }) : void 0, He = /* @__PURE__ */ e(
1068
+ ke,
1069
+ {
1070
+ field: v,
1071
+ draft: a,
1072
+ onChange: l,
1073
+ relations: o,
1074
+ collection: r,
1075
+ itemId: s,
1076
+ error: p[v.field],
1077
+ visible: m.has(v.field) || !m.size,
1078
+ forceVisible: _e(v) || void 0,
1079
+ locked: k.has(v.field),
1080
+ layoutAiEnabled: c,
1081
+ renderField: b,
1082
+ onCountChange: y,
1083
+ swapButton: _t,
1084
+ swapContent: wt
1085
+ }
861
1086
  );
862
1087
  return K(
863
- { kind: "field", field: B.field, group_key: t.key },
1088
+ { kind: "field", field: v.field, group_key: t.key },
864
1089
  /* @__PURE__ */ x(
865
1090
  "div",
866
1091
  {
867
- className: "min-w-0",
868
- style: { gridColumn: `span ${Qe(B.options, Ne)}` },
1092
+ style: { gridColumn: `span ${Qe(v.options, Ne)}` },
869
1093
  children: [
870
- /* @__PURE__ */ e("dt", { className: "text-[11px] font-medium text-slate-400 truncate", children: B.label || ot(B.field) }),
871
- /* @__PURE__ */ e("dd", { className: "mt-0.5 break-words", children: (g == null ? void 0 : g.one_collection) === "nivaro_users" ? (() => {
872
- const v = a[B.field], C = Array.isArray(v) ? v : v != null && v !== "" ? [v] : [];
873
- return C.length === 0 ? /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-400", children: "—" }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: C.map((I) => /* @__PURE__ */ e(ct, { userId: String(I) }, String(I))) });
874
- })() : g != null && g.one_collection ? /* @__PURE__ */ e(re, { relCollection: g.one_collection, id: a[B.field] }) : /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-700", children: $e(a[B.field], B) }) })
1094
+ _e(v) ? /* @__PURE__ */ e("div", { "data-design-hidden": "", className: "opacity-40", children: He }) : He,
1095
+ (I == null ? void 0 : I.length) && Ve && Ce && /* @__PURE__ */ e(
1096
+ ln,
1097
+ {
1098
+ relCollection: Ce,
1099
+ relId: oe,
1100
+ entries: I,
1101
+ separator: Nt
1102
+ }
1103
+ )
875
1104
  ]
876
1105
  },
877
- B.field
1106
+ v.field
878
1107
  )
879
1108
  );
880
- })
881
- ]
882
- }
883
- ) : (() => {
884
- const u = (g) => {
885
- var Ke, Ee;
886
- if (g._t === "row")
887
- return /* @__PURE__ */ e(
888
- Qt,
889
- {
890
- row: g.row,
891
- members: g.members,
892
- containerWidth: Ne,
893
- errors: p,
894
- renderMember: (w) => K(
895
- { kind: "field", field: w.field, group_key: t.key },
896
- /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
897
- Se,
898
- {
899
- field: Zt(w),
900
- draft: a,
901
- onChange: l,
902
- relations: o,
903
- collection: r,
904
- itemId: s,
905
- error: p[w.field],
906
- visible: m.has(w.field) || !m.size,
907
- forceVisible: _e(w) || void 0,
908
- locked: S.has(w.field),
909
- layoutAiEnabled: c,
910
- renderField: b,
911
- onCountChange: y
912
- }
913
- ) }, w.field)
914
- )
915
- },
916
- g._k
917
- );
918
- if (g._t === "owners") {
919
- const w = g.slot.col_span ?? 12;
920
- return K(
921
- le("__owners__"),
922
- /* @__PURE__ */ e("div", { style: { gridColumn: `span ${w}` }, children: /* @__PURE__ */ e(
923
- Ze,
924
- {
925
- collection: r,
926
- itemId: s,
927
- label: g.slot.label_override || "Owners"
928
- }
929
- ) }, "__owners__")
930
- );
931
- }
932
- if (g._t === "pdf") {
933
- if (!U) return null;
934
- const w = g.slot.col_span ?? 12, J = ((Ke = g.slot.label_override) == null ? void 0 : Ke.trim()) || "Generate PDF";
935
- return K(
936
- le("__pdf__"),
937
- /* @__PURE__ */ e("div", { style: { gridColumn: `span ${w}` }, children: /* @__PURE__ */ e(
938
- on,
939
- {
940
- collection: r,
941
- itemId: s,
942
- layoutId: U,
943
- attachField: L ?? null,
944
- filenameTemplate: O,
945
- label: J
946
- }
947
- ) }, "__pdf__")
948
- );
949
- }
950
- if (g._t === "widget") {
951
- if (!g.slot.widget_id) return null;
952
- const w = g.slot.col_span ?? 12, J = Xe(g.slot.input_bindings);
953
- return K(
954
- le(g.slot.field),
955
- /* @__PURE__ */ e("div", { style: { gridColumn: `span ${w}` }, children: /* @__PURE__ */ e(
956
- Ye,
957
- {
958
- widgetId: g.slot.widget_id,
959
- inputBindings: J,
960
- itemDraft: a,
961
- label: g.slot.label_override ?? void 0,
962
- defaultExpanded: g.slot.default_expanded ?? !0,
963
- frameless: !0,
964
- apiBase: Q,
965
- onContentChange: (We) => Be(
966
- (we) => we[g.slot.field] === We ? we : { ...we, [g.slot.field]: We }
967
- )
968
- }
969
- ) }, g.slot.field)
970
- );
971
- }
972
- const v = g.f, C = pe == null ? void 0 : pe[v.field], I = C == null ? void 0 : C.entries, Nt = (C == null ? void 0 : C.separator) ?? null, oe = a[v.field], Ve = oe != null && oe !== "", Ce = I != null && I.length && Ve ? ((Ee = o.find(
973
- (w) => w.many_collection === r && w.many_field === v.field && !w.junction_field
974
- )) == null ? void 0 : Ee.one_collection) ?? null : null, Je = (V == null ? void 0 : V.enabled) && v.field === V.primary_field, Re = (() => {
975
- const w = a[(V == null ? void 0 : V.primary_field) ?? ""];
976
- return w != null && w !== "";
977
- })(), ze = (Z ?? []).some((w) => {
978
- const J = a[w.field];
979
- return J != null && J !== "";
980
- }), _t = Je && je ? /* @__PURE__ */ x("span", { className: "inline-flex items-center gap-1.5", children: [
981
- /* @__PURE__ */ e(
982
- "button",
983
- {
984
- type: "button",
985
- onClick: je,
986
- className: "inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium text-nvr-cyan hover:bg-nvr-cyan/10 transition-colors",
987
- children: Fe ? V.back_label ?? "Back" : V.toggle_label ?? "Enter manually"
988
- }
989
- ),
990
- /* @__PURE__ */ x(
991
- "span",
992
- {
993
- className: [
994
- "inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[9px] font-medium",
995
- Re ? "bg-emerald-50 text-emerald-600 dark:bg-emerald-900/30 dark:text-emerald-400" : "bg-slate-100 text-slate-400 dark:bg-slate-800 dark:text-slate-500"
996
- ].join(" "),
997
- title: "Original field",
998
- children: [
999
- /* @__PURE__ */ e(
1000
- "span",
1001
- {
1002
- className: [
1003
- "h-1.5 w-1.5 rounded-full",
1004
- Re ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
1005
- ].join(" ")
1006
- }
1007
- ),
1008
- "Original"
1009
- ]
1010
- }
1011
- ),
1012
- /* @__PURE__ */ x(
1013
- "span",
1014
- {
1015
- className: [
1016
- "inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[9px] font-medium",
1017
- ze ? "bg-emerald-50 text-emerald-600 dark:bg-emerald-900/30 dark:text-emerald-400" : "bg-slate-100 text-slate-400 dark:bg-slate-800 dark:text-slate-500"
1018
- ].join(" "),
1019
- title: "Manual fields",
1020
- children: [
1021
- /* @__PURE__ */ e(
1022
- "span",
1023
- {
1024
- className: [
1025
- "h-1.5 w-1.5 rounded-full",
1026
- ze ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
1027
- ].join(" ")
1028
- }
1029
- ),
1030
- "Manual"
1031
- ]
1032
- }
1033
- )
1034
- ] }) : void 0, wt = Je && Fe && (Z != null && Z.length) ? /* @__PURE__ */ e("div", { className: "mt-2 rounded-lg border border-slate-200 bg-slate-50 dark:border-border dark:bg-slate-900/40 p-3", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-3", children: Z.map((w) => {
1035
- const J = (fe == null ? void 0 : fe[w.field]) ?? 2;
1036
- return /* @__PURE__ */ e("div", { style: { gridColumn: `span ${J}` }, children: /* @__PURE__ */ e(
1037
- Se,
1038
- {
1039
- field: w,
1040
- draft: a,
1041
- onChange: l,
1042
- relations: o,
1043
- collection: r,
1044
- itemId: s,
1045
- error: p[w.field],
1046
- visible: !0,
1047
- forceVisible: !0,
1048
- locked: S.has(w.field),
1049
- layoutAiEnabled: c,
1050
- renderField: b,
1051
- onCountChange: y
1052
- }
1053
- ) }, w.field);
1054
- }) }) }) : void 0, He = /* @__PURE__ */ e(
1055
- Se,
1056
- {
1057
- field: v,
1058
- draft: a,
1059
- onChange: l,
1060
- relations: o,
1061
- collection: r,
1062
- itemId: s,
1063
- error: p[v.field],
1064
- visible: m.has(v.field) || !m.size,
1065
- forceVisible: _e(v) || void 0,
1066
- locked: S.has(v.field),
1067
- layoutAiEnabled: c,
1068
- renderField: b,
1069
- onCountChange: y,
1070
- swapButton: _t,
1071
- swapContent: wt
1072
- }
1073
- );
1074
- return K(
1075
- { kind: "field", field: v.field, group_key: t.key },
1076
- /* @__PURE__ */ x(
1077
- "div",
1078
- {
1079
- style: { gridColumn: `span ${Qe(v.options, Ne)}` },
1080
- children: [
1081
- _e(v) ? /* @__PURE__ */ e("div", { "data-design-hidden": "", className: "opacity-40", children: He }) : He,
1082
- (I == null ? void 0 : I.length) && Ve && Ce && /* @__PURE__ */ e(
1083
- ln,
1084
- {
1085
- relCollection: Ce,
1086
- relId: oe,
1087
- entries: I,
1088
- separator: Nt
1089
- }
1090
- )
1091
- ]
1092
- },
1093
- v.field
1094
- )
1095
- );
1096
- }, B = h.folded.map((g) => ({
1097
- _k: g.field,
1098
- sort: g.sort ?? 0,
1099
- _t: "field",
1100
- f: g
1101
- }));
1102
- return /* @__PURE__ */ x(vt, { children: [
1103
- /* @__PURE__ */ x(
1104
- "div",
1105
- {
1106
- ref: ye,
1107
- className: E($ && "relative", "grid grid-cols-12 gap-4 items-start"),
1108
- children: [
1109
- /* @__PURE__ */ e(ve, {}),
1110
- _.map(u)
1111
- ]
1112
- }
1113
- ),
1114
- /* @__PURE__ */ e(
1115
- Yt,
1116
- {
1117
- count: B.length,
1118
- open: mt,
1119
- forcedOpen: h.forcedOpen,
1120
- design: !!$,
1121
- onToggle: () => pt((g) => !g),
1122
- children: /* @__PURE__ */ x(
1109
+ }, B = h.folded.map((g) => ({
1110
+ _k: g.field,
1111
+ sort: g.sort ?? 0,
1112
+ _t: "field",
1113
+ f: g
1114
+ }));
1115
+ return /* @__PURE__ */ x(vt, { children: [
1116
+ /* @__PURE__ */ x(
1123
1117
  "div",
1124
1118
  {
1119
+ ref: ye,
1120
+ "data-section-grid": "",
1125
1121
  className: E($ && "relative", "grid grid-cols-12 gap-4 items-start"),
1126
1122
  children: [
1127
1123
  /* @__PURE__ */ e(ve, {}),
1128
- B.map(u)
1124
+ _.map(u)
1129
1125
  ]
1130
1126
  }
1127
+ ),
1128
+ /* @__PURE__ */ e(
1129
+ Yt,
1130
+ {
1131
+ count: B.length,
1132
+ open: mt,
1133
+ forcedOpen: h.forcedOpen,
1134
+ design: !!$,
1135
+ onToggle: () => pt((g) => !g),
1136
+ children: /* @__PURE__ */ x(
1137
+ "div",
1138
+ {
1139
+ "data-section-grid": "",
1140
+ className: E($ && "relative", "grid grid-cols-12 gap-4 items-start"),
1141
+ children: [
1142
+ /* @__PURE__ */ e(ve, {}),
1143
+ B.map(u)
1144
+ ]
1145
+ }
1146
+ )
1147
+ }
1131
1148
  )
1132
- }
1133
- )
1134
- ] });
1135
- })();
1136
- })(),
1137
- H && /* @__PURE__ */ e("div", { className: "mt-4", children: H })
1138
- ] })
1149
+ ] });
1150
+ })();
1151
+ })(),
1152
+ H && /* @__PURE__ */ e("div", { className: "mt-4", children: H })
1153
+ ]
1154
+ }
1155
+ )
1139
1156
  ]
1140
1157
  }
1141
1158
  );