@nivaro/react 0.2.51 → 0.2.53

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 (117) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +207 -6
  4. package/dist/index.js +442 -439
  5. package/dist/layout-editor.d.ts +80 -0
  6. package/dist/layout-editor.js +11 -0
  7. package/dist/shared/components/ItemEditForm.js +4015 -3835
  8. package/dist/shared/components/RecordDrilldownSheet.js +114 -97
  9. package/dist/shared/components/RecordReadView.js +637 -570
  10. package/dist/shared/components/ai/ExplainButton.js +1 -1
  11. package/dist/shared/components/item-edit/GroupSection.js +489 -466
  12. package/dist/shared/components/item-edit/HeaderBand.js +47 -44
  13. package/dist/shared/components/item-edit/M2MStagingContext.js +3 -3
  14. package/dist/shared/components/item-edit/O2MStagingContext.js +1 -1
  15. package/dist/shared/components/item-edit/RecordGrantTools.js +206 -0
  16. package/dist/shared/components/item-edit/StepsBar.js +49 -43
  17. package/dist/shared/components/item-edit/SummaryPanel.js +1 -1
  18. package/dist/shared/components/item-edit/config-update.js +6 -0
  19. package/dist/shared/components/item-edit/layout-editing-quiet.js +25 -0
  20. package/dist/shared/components/layout-editor/AddPanel.js +301 -0
  21. package/dist/shared/components/layout-editor/DesignNode.js +173 -0
  22. package/dist/shared/components/layout-editor/EditorCanvas.js +52 -0
  23. package/dist/shared/components/layout-editor/EditorTopBar.js +241 -0
  24. package/dist/shared/components/layout-editor/HistoryPanel.js +179 -0
  25. package/dist/shared/components/layout-editor/LayoutEditor.js +393 -0
  26. package/dist/shared/components/layout-editor/LayoutsRail.js +89 -0
  27. package/dist/shared/components/layout-editor/add-target.js +103 -0
  28. package/dist/shared/components/layout-editor/bundle-to-active.js +86 -0
  29. package/dist/shared/components/layout-editor/canvases/PdfCanvas.js +90 -0
  30. package/dist/shared/components/layout-editor/canvases/TableColumnsCanvas.js +246 -0
  31. package/dist/shared/components/layout-editor/collection-meta.js +22 -0
  32. package/dist/shared/components/layout-editor/design-canvas.js +81 -0
  33. package/dist/shared/components/layout-editor/design-context.js +21 -0
  34. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +225 -0
  35. package/dist/shared/components/layout-editor/dnd/collision.js +107 -0
  36. package/dist/shared/components/layout-editor/dnd/node.js +164 -0
  37. package/dist/shared/components/layout-editor/dnd/order.js +122 -0
  38. package/dist/shared/components/layout-editor/editors/DefaultValuesEditor.js +223 -0
  39. package/dist/shared/components/layout-editor/editors/QuickPickerStepsEditor.js +129 -0
  40. package/dist/shared/components/layout-editor/editors/ReadPresentationEditor.js +134 -0
  41. package/dist/shared/components/layout-editor/editors/RecordConditionsEditor.js +249 -0
  42. package/dist/shared/components/layout-editor/editors/RolesPicker.js +77 -0
  43. package/dist/shared/components/layout-editor/editors/cascade-filters.js +556 -0
  44. package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +150 -0
  45. package/dist/shared/components/layout-editor/editors/controls.js +73 -0
  46. package/dist/shared/components/layout-editor/editors/editor-api.js +21 -0
  47. package/dist/shared/components/layout-editor/editors/editor-queries.js +25 -0
  48. package/dist/shared/components/layout-editor/editors/field-default-value.js +131 -0
  49. package/dist/shared/components/layout-editor/editors/grid-presets.js +310 -0
  50. package/dist/shared/components/layout-editor/editors/inline-display.js +157 -0
  51. package/dist/shared/components/layout-editor/editors/layout-picker.js +80 -0
  52. package/dist/shared/components/layout-editor/editors/layout-rows.js +55 -0
  53. package/dist/shared/components/layout-editor/editors/lock-conditions.js +109 -0
  54. package/dist/shared/components/layout-editor/editors/o2m-agg-field.js +25 -0
  55. package/dist/shared/components/layout-editor/editors/pdf-field-config.js +107 -0
  56. package/dist/shared/components/layout-editor/editors/report-widget-config.js +94 -0
  57. package/dist/shared/components/layout-editor/editors/row-rule-check.js +225 -0
  58. package/dist/shared/components/layout-editor/editors/row-rule-row.js +1353 -0
  59. package/dist/shared/components/layout-editor/editors/swap-config.js +245 -0
  60. package/dist/shared/components/layout-editor/focus-buffer.js +32 -0
  61. package/dist/shared/components/layout-editor/host.js +15 -0
  62. package/dist/shared/components/layout-editor/inspector/AdvancedTab.js +296 -0
  63. package/dist/shared/components/layout-editor/inspector/GridTab.js +767 -0
  64. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +456 -0
  65. package/dist/shared/components/layout-editor/inspector/HeaderItemInspector.js +268 -0
  66. package/dist/shared/components/layout-editor/inspector/Inspector.js +332 -0
  67. package/dist/shared/components/layout-editor/inspector/LookTab.js +310 -0
  68. package/dist/shared/components/layout-editor/inspector/PickerTab.js +333 -0
  69. package/dist/shared/components/layout-editor/inspector/RulesTab.js +323 -0
  70. package/dist/shared/components/layout-editor/inspector/SlotInspector.js +179 -0
  71. package/dist/shared/components/layout-editor/inspector/SubtitleInspector.js +154 -0
  72. package/dist/shared/components/layout-editor/inspector/WidgetInspector.js +262 -0
  73. package/dist/shared/components/layout-editor/inspector/applies.js +27 -0
  74. package/dist/shared/components/layout-editor/inspector/field-context.js +134 -0
  75. package/dist/shared/components/layout-editor/inspector/interfaces.js +126 -0
  76. package/dist/shared/components/layout-editor/inspector/kit.js +595 -0
  77. package/dist/shared/components/layout-editor/inspector/model.js +307 -0
  78. package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -0
  79. package/dist/shared/components/layout-editor/overview/describe-conditions.js +121 -0
  80. package/dist/shared/components/layout-editor/overview/overview-api.js +141 -0
  81. package/dist/shared/components/layout-editor/overview/purpose.js +62 -0
  82. package/dist/shared/components/layout-editor/overview/record-count.js +65 -0
  83. package/dist/shared/components/layout-editor/panel-frame.js +99 -0
  84. package/dist/shared/components/layout-editor/panel-style.js +19 -0
  85. package/dist/shared/components/layout-editor/pickers/field-picker.js +230 -0
  86. package/dist/shared/components/layout-editor/pickers/icon-picker.js +233 -0
  87. package/dist/shared/components/layout-editor/pickers/relation-label.js +34 -0
  88. package/dist/shared/components/layout-editor/pickers/relation-picker.js +136 -0
  89. package/dist/shared/components/layout-editor/record-queries.js +15 -0
  90. package/dist/shared/components/layout-editor/settings/AddendumSection.js +52 -0
  91. package/dist/shared/components/layout-editor/settings/ButtonsSection.js +45 -0
  92. package/dist/shared/components/layout-editor/settings/DefaultsSection.js +67 -0
  93. package/dist/shared/components/layout-editor/settings/FormSettings.js +146 -0
  94. package/dist/shared/components/layout-editor/settings/InheritanceSection.js +37 -0
  95. package/dist/shared/components/layout-editor/settings/LayoutSection.js +70 -0
  96. package/dist/shared/components/layout-editor/settings/PdfSection.js +176 -0
  97. package/dist/shared/components/layout-editor/settings/ReadSection.js +79 -0
  98. package/dist/shared/components/layout-editor/settings/TextSetting.js +55 -0
  99. package/dist/shared/components/layout-editor/settings/ToggleSetting.js +33 -0
  100. package/dist/shared/components/layout-editor/settings/ToolsSection.js +179 -0
  101. package/dist/shared/components/layout-editor/settings/WhoSection.js +213 -0
  102. package/dist/shared/components/layout-editor/settings/controls.js +214 -0
  103. package/dist/shared/components/layout-editor/settings/section-props.js +17 -0
  104. package/dist/shared/components/layout-editor/settings/settings-api.js +151 -0
  105. package/dist/shared/components/layout-editor/settings/settings-registry.js +445 -0
  106. package/dist/shared/components/layout-editor/slot-names.js +20 -0
  107. package/dist/shared/components/layout-editor/summary-pref.js +21 -0
  108. package/dist/shared/components/layout-editor/useLayoutDraft.js +474 -0
  109. package/dist/shared/components/pipeline/relations.js +28 -23
  110. package/dist/shared/components/ui/popover.js +17 -17
  111. package/dist/shared/components/ui/scroll-area.js +38 -0
  112. package/dist/shared/hooks/useRelationOptions.js +60 -0
  113. package/dist/shared/lib/layout-grants.js +9 -0
  114. package/dist/shared/lib/layout-ops.js +348 -0
  115. package/dist/shared/lib/layout-slots.js +11 -7
  116. package/dist/shared/lib/request-gate.js +1 -1
  117. package/package.json +5 -1
@@ -1,20 +1,22 @@
1
- import { jsx as e, jsxs as g } from "react/jsx-runtime";
2
- import { useQuery as Z, useQueryClient as We } from "@tanstack/react-query";
3
- import * as Ye from "lucide-react";
4
- import { ChevronDown as Qe, Loader2 as He, User as Ae, Mail as Ze } from "lucide-react";
5
- import Te, { useState as X, useRef as se, useEffect as Xe } from "react";
6
- import { fieldDrilldownConfig as et, useDrilldown as tt, useOptionalNivaroClient as ee, useNavigation as nt } from "../../context.js";
7
- import { get as qe, post as rt } from "../../lib/commands.js";
8
- import { useRecordReader as Ie } from "../../lib/record-loader.js";
9
- import { choiceLabel as it, titleCase as Me, cn as A } from "../../lib/utils.js";
10
- import { UserAvatar as lt } from "../UserAvatar.js";
11
- import { DropdownMenu as st, DropdownMenuTrigger as at, DropdownMenuContent as ot, DropdownMenuItem as Se } from "../ui/dropdown-menu.js";
12
- import { WidgetSlot as De } from "../WidgetSlot.js";
13
- import { FieldRow as ke } from "./FieldRow.js";
14
- import { applyDisplayTemplate as ct, useContainerWidth as dt, resolveColSpan as $e } from "./helpers.js";
15
- import { UserChip as Je, OwnersInline as Fe, OwnersInlineCompact as ut } from "./UserChip.js";
16
- import { UserRosterCluster as qt } from "./UserChip.js";
17
- function je(t) {
1
+ import { jsx as e, jsxs as N } from "react/jsx-runtime";
2
+ import { useQuery as te, useQueryClient as Xe } from "@tanstack/react-query";
3
+ import * as et from "lucide-react";
4
+ import { ChevronDown as tt, Loader2 as nt, User as rt, Mail as it } from "lucide-react";
5
+ import Ce, { useState as ne, useRef as ce, useEffect as lt } from "react";
6
+ import { fieldDrilldownConfig as st, useDrilldown as at, useOptionalNivaroClient as re, useNavigation as ot } from "../../context.js";
7
+ import { get as Re, post as ct } from "../../lib/commands.js";
8
+ import { useRecordReader as ze } from "../../lib/record-loader.js";
9
+ import { choiceLabel as dt, titleCase as Ke, cn as ee } from "../../lib/utils.js";
10
+ import { DesignDropZone as ut, designWrap as pt } from "../layout-editor/DesignNode.js";
11
+ import { useLayoutDesign as mt } from "../layout-editor/design-context.js";
12
+ import { UserAvatar as ft } from "../UserAvatar.js";
13
+ import { DropdownMenu as ht, DropdownMenuTrigger as gt, DropdownMenuContent as bt, DropdownMenuItem as Oe } from "../ui/dropdown-menu.js";
14
+ import { WidgetSlot as Le } from "../WidgetSlot.js";
15
+ import { FieldRow as Be } from "./FieldRow.js";
16
+ import { applyDisplayTemplate as xt, useContainerWidth as yt, resolveColSpan as Ue } from "./helpers.js";
17
+ import { UserChip as Ge, OwnersInline as Ie, OwnersInlineCompact as Nt } from "./UserChip.js";
18
+ import { UserRosterCluster as Wt } from "./UserChip.js";
19
+ function Te(t) {
18
20
  if (typeof t != "string") return t ?? [];
19
21
  try {
20
22
  return JSON.parse(t);
@@ -22,94 +24,94 @@ function je(t) {
22
24
  return [];
23
25
  }
24
26
  }
25
- function pt({
27
+ function _t({
26
28
  relCollection: t,
27
29
  relId: r,
28
30
  entries: i,
29
31
  separator: u
30
32
  }) {
31
- const l = ee(), s = Ie(), n = String(r), f = i.some((h) => h.field.includes(".")) ? ["id", ...i.map((h) => h.field)].join(",") : null, { data: m } = Z({
32
- queryKey: ["inline-display", t, n, f],
33
- queryFn: () => s(t, n, f),
33
+ const l = re(), a = ze(), n = String(r), p = i.some((h) => h.field.includes(".")) ? ["id", ...i.map((h) => h.field)].join(",") : null, { data: f } = te({
34
+ queryKey: ["inline-display", t, n, p],
35
+ queryFn: () => a(t, n, p),
34
36
  enabled: !!l && !!n,
35
37
  staleTime: 6e4
36
38
  });
37
- if (!m) return null;
39
+ if (!f) return null;
38
40
  const v = (h) => {
39
- let p = m;
40
- for (const b of h.split(".")) {
41
- if (p == null || typeof p != "object") return;
42
- p = p[b];
41
+ let m = f;
42
+ for (const g of h.split(".")) {
43
+ if (m == null || typeof m != "object") return;
44
+ m = m[g];
43
45
  }
44
- return p;
46
+ return m;
45
47
  };
46
48
  if (u != null) {
47
49
  const h = ($) => {
48
- const N = v($.field);
49
- if (N == null || N === "") return null;
50
+ const _ = v($.field);
51
+ if (_ == null || _ === "") return null;
50
52
  const w = $.format ?? "text";
51
53
  if (w === "date" || w === "datetime")
52
54
  try {
53
- return new Date(String(N)).toLocaleDateString();
55
+ return new Date(String(_)).toLocaleDateString();
54
56
  } catch {
55
- return String(N);
57
+ return String(_);
56
58
  }
57
- return w === "boolean" ? N ? "Yes" : "No" : String(N);
58
- }, p = [];
59
- let b = [];
59
+ return w === "boolean" ? _ ? "Yes" : "No" : String(_);
60
+ }, m = [];
61
+ let g = [];
60
62
  for (const $ of i)
61
- $.line_break && b.length > 0 ? (p.push(b), b = [$]) : b.push($);
62
- b.length > 0 && p.push(b);
63
- const j = p.map(
64
- ($) => $.map((N) => {
65
- const w = h(N);
66
- return w ? { label: N.label ?? null, display: w } : null;
63
+ $.line_break && g.length > 0 ? (m.push(g), g = [$]) : g.push($);
64
+ g.length > 0 && m.push(g);
65
+ const j = m.map(
66
+ ($) => $.map((_) => {
67
+ const w = h(_);
68
+ return w ? { label: _.label ?? null, display: w } : null;
67
69
  }).filter(Boolean)
68
70
  ).filter(($) => $.length > 0);
69
- return j.length === 0 ? null : /* @__PURE__ */ e("div", { className: "mt-1", children: j.map(($, N) => (
71
+ return j.length === 0 ? null : /* @__PURE__ */ e("div", { className: "mt-1", children: j.map(($, _) => (
70
72
  // biome-ignore lint/suspicious/noArrayIndexKey: stable line order
71
- /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: $.map((w, J) => (
73
+ /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: $.map((w, P) => (
72
74
  // biome-ignore lint/suspicious/noArrayIndexKey: stable token order
73
- /* @__PURE__ */ g(Te.Fragment, { children: [
74
- J > 0 && u,
75
- w.label && /* @__PURE__ */ g("span", { className: "font-semibold text-slate-600 dark:text-slate-300", children: [
75
+ /* @__PURE__ */ N(Ce.Fragment, { children: [
76
+ P > 0 && u,
77
+ w.label && /* @__PURE__ */ N("span", { className: "font-semibold text-slate-600 dark:text-slate-300", children: [
76
78
  w.label,
77
79
  ":"
78
80
  ] }),
79
81
  w.label ? " " : "",
80
82
  w.display
81
- ] }, J)
82
- )) }, N)
83
+ ] }, P)
84
+ )) }, _)
83
85
  )) });
84
86
  }
85
87
  const c = i.map((h) => {
86
- const p = v(h.field);
87
- if (p == null || p === "") return null;
88
- const b = h.format ?? "text";
88
+ const m = v(h.field);
89
+ if (m == null || m === "") return null;
90
+ const g = h.format ?? "text";
89
91
  let j;
90
- if (b === "date" || b === "datetime")
92
+ if (g === "date" || g === "datetime")
91
93
  try {
92
- j = new Date(String(p)).toLocaleDateString();
94
+ j = new Date(String(m)).toLocaleDateString();
93
95
  } catch {
94
- j = String(p);
96
+ j = String(m);
95
97
  }
96
- else b === "boolean" ? j = p ? "Yes" : "No" : j = String(p);
98
+ else g === "boolean" ? j = m ? "Yes" : "No" : j = String(m);
97
99
  return { label: h.label, display: j };
98
100
  }).filter(Boolean);
99
- return c.length === 0 ? null : /* @__PURE__ */ e("div", { className: "mt-1 rounded border border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800/50 px-3 py-1.5 space-y-0.5", children: c.map((h, p) => (
101
+ return c.length === 0 ? null : /* @__PURE__ */ e("div", { className: "mt-1 rounded border border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800/50 px-3 py-1.5 space-y-0.5", children: c.map((h, m) => (
100
102
  // biome-ignore lint/suspicious/noArrayIndexKey: stable order from config
101
- /* @__PURE__ */ g("div", { className: "flex items-baseline gap-2", children: [
103
+ /* @__PURE__ */ N("div", { className: "flex items-baseline gap-2", children: [
102
104
  h.label && /* @__PURE__ */ e("span", { className: "shrink-0 min-w-[56px] text-[10px] font-medium text-slate-400", children: h.label }),
103
105
  /* @__PURE__ */ e("span", { className: "text-[12px] text-slate-700 dark:text-slate-300 truncate", children: h.display })
104
- ] }, p)
106
+ ] }, m)
105
107
  )) });
106
108
  }
107
- function mt(t) {
109
+ function wt(t) {
108
110
  if (!t) return null;
109
- const r = t.replace(/(^|-)([a-z])/g, (u, l, s) => s.toUpperCase()), i = Ye[r];
111
+ const r = t.replace(/(^|-)([a-z])/g, (u, l, a) => a.toUpperCase()), i = et[r];
110
112
  return i || null;
111
113
  }
112
- function Oe(t) {
114
+ function qe(t) {
113
115
  if (!t.options) return {};
114
116
  if (typeof t.options == "object") return t.options;
115
117
  try {
@@ -118,7 +120,7 @@ function Oe(t) {
118
120
  return {};
119
121
  }
120
122
  }
121
- function ae(t, r) {
123
+ function de(t, r) {
122
124
  if (t == null || t === "") return "—";
123
125
  if (typeof t == "boolean") return t ? "Yes" : "No";
124
126
  const i = (r == null ? void 0 : r.interface) ?? "", u = (() => {
@@ -136,12 +138,12 @@ function ae(t, r) {
136
138
  if (u === "percent" && Number.isFinite(n)) return `${(n * 100).toFixed(1)}%`;
137
139
  if (/^0\.0+$/.test(u) && Number.isFinite(n)) return n.toFixed(u.length - 2);
138
140
  if (u === "date" && typeof t == "string") {
139
- const a = t.length === 10 ? /* @__PURE__ */ new Date(`${t}T00:00:00`) : new Date(t);
140
- if (!Number.isNaN(a.getTime())) return a.toLocaleDateString();
141
+ const o = t.length === 10 ? /* @__PURE__ */ new Date(`${t}T00:00:00`) : new Date(t);
142
+ if (!Number.isNaN(o.getTime())) return o.toLocaleDateString();
141
143
  }
142
144
  if (u === "datetime" && typeof t == "string") {
143
- const a = new Date(t);
144
- if (!Number.isNaN(a.getTime())) return a.toLocaleString();
145
+ const o = new Date(t);
146
+ if (!Number.isNaN(o.getTime())) return o.toLocaleString();
145
147
  }
146
148
  }
147
149
  if (i === "duration" && Number.isFinite(Number(t))) {
@@ -153,7 +155,7 @@ function ae(t, r) {
153
155
  if (i === "checklist" && typeof t == "string")
154
156
  try {
155
157
  const n = JSON.parse(t);
156
- if (Array.isArray(n)) return `${n.filter((a) => a == null ? void 0 : a.done).length}/${n.length} done`;
158
+ if (Array.isArray(n)) return `${n.filter((o) => o == null ? void 0 : o.done).length}/${n.length} done`;
157
159
  } catch {
158
160
  }
159
161
  if (i === "address" && typeof t == "string" && t.trim().startsWith("{"))
@@ -178,98 +180,98 @@ function ae(t, r) {
178
180
  let n = /^\d{4}-\d{2}-\d{2}$/.test(l) || i === "date";
179
181
  if (!n && (r != null && r.options))
180
182
  try {
181
- const f = typeof r.options == "string" ? JSON.parse(r.options) : r.options;
182
- f && f.date_mode === "date" && (n = !0);
183
+ const p = typeof r.options == "string" ? JSON.parse(r.options) : r.options;
184
+ p && p.date_mode === "date" && (n = !0);
183
185
  } catch {
184
186
  }
185
- const a = l.match(/^(\d{4})-(\d{2})-(\d{2})(?:T00:00:00(?:\.000)?Z)?$/);
186
- return a ? new Date(Number(a[1]), Number(a[2]) - 1, Number(a[3])).toLocaleDateString() : n ? new Date(l).toLocaleDateString() : new Date(l).toLocaleString();
187
+ const o = l.match(/^(\d{4})-(\d{2})-(\d{2})(?:T00:00:00(?:\.000)?Z)?$/);
188
+ return o ? new Date(Number(o[1]), Number(o[2]) - 1, Number(o[3])).toLocaleDateString() : n ? new Date(l).toLocaleDateString() : new Date(l).toLocaleString();
187
189
  } catch {
188
190
  }
189
191
  if ((i === "select-dropdown" || i === "radio-buttons") && r) {
190
- const a = Oe(r).choices;
191
- if (Array.isArray(a)) {
192
- const f = a.find((m) => String(m.value) === l);
193
- if (f) return it(f.text);
192
+ const o = qe(r).choices;
193
+ if (Array.isArray(o)) {
194
+ const p = o.find((f) => String(f.value) === l);
195
+ if (p) return dt(p.text);
194
196
  }
195
197
  }
196
- const s = Number(l);
197
- if (!Number.isNaN(s) && l !== "" && r) {
198
- const n = Oe(r), a = n.format, f = typeof n.unit == "string" ? n.unit.trim() : "";
199
- if (f && !a) {
200
- const m = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(s);
201
- if (f === "$")
198
+ const a = Number(l);
199
+ if (!Number.isNaN(a) && l !== "" && r) {
200
+ const n = qe(r), o = n.format, p = typeof n.unit == "string" ? n.unit.trim() : "";
201
+ if (p && !o) {
202
+ const f = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(a);
203
+ if (p === "$")
202
204
  try {
203
205
  return new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(
204
- s
206
+ a
205
207
  );
206
208
  } catch {
207
- return `$${m}`;
209
+ return `$${f}`;
208
210
  }
209
- return f === "%" ? `${m}%` : `${m} ${f}`;
211
+ return p === "%" ? `${f}%` : `${f} ${p}`;
210
212
  }
211
- if (a === "currency")
213
+ if (o === "currency")
212
214
  try {
213
215
  return new Intl.NumberFormat(void 0, {
214
216
  style: "currency",
215
217
  currency: n.currency || "USD"
216
- }).format(s);
218
+ }).format(a);
217
219
  } catch {
218
220
  }
219
- if (a === "int")
220
- return new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(s);
221
- if (a === "decimal") {
222
- const m = typeof n.precision == "number" ? n.precision : 2;
221
+ if (o === "int")
222
+ return new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(a);
223
+ if (o === "decimal") {
224
+ const f = typeof n.precision == "number" ? n.precision : 2;
223
225
  return new Intl.NumberFormat(void 0, {
224
- minimumFractionDigits: m,
225
- maximumFractionDigits: m
226
- }).format(s);
226
+ minimumFractionDigits: f,
227
+ maximumFractionDigits: f
228
+ }).format(a);
227
229
  }
228
230
  }
229
- return !l.includes(" ") && !l.includes("@") && !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(l) && !/^\d+$/.test(l) && (l.includes("_") || l.includes("-") || /^[a-z]/.test(l)) ? Me(l) : l;
231
+ return !l.includes(" ") && !l.includes("@") && !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(l) && !/^\d+$/.test(l) && (l.includes("_") || l.includes("-") || /^[a-z]/.test(l)) ? Ke(l) : l;
230
232
  }
231
- function Le({ userId: t }) {
232
- const r = ee(), { navigate: i, userUrl: u } = nt(), l = u ? u(t) : `/users/${t}`, { data: s } = Z({
233
+ function Me({ userId: t }) {
234
+ const r = re(), { navigate: i, userUrl: u } = ot(), l = u ? u(t) : `/users/${t}`, { data: a } = te({
233
235
  queryKey: ["user-chip", t],
234
236
  queryFn: () => r.request(
235
- qe(`/users/${t}`)
236
- ).then((f) => f.data ?? null),
237
+ Re(`/users/${t}`)
238
+ ).then((p) => p.data ?? null),
237
239
  enabled: !!r && !!t,
238
240
  staleTime: 12e4
239
- }), n = s ? [s.first_name, s.last_name].filter(Boolean).join(" ") || s.email : t, a = n.split(" ").map((f) => f[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
240
- return /* @__PURE__ */ g(st, { children: [
241
- /* @__PURE__ */ e(at, { asChild: !0, children: /* @__PURE__ */ g("span", { className: "inline-flex cursor-pointer items-center gap-1 rounded-full bg-slate-100 py-px pl-0.5 pr-2 hover:bg-slate-200 transition-colors", children: [
241
+ }), n = a ? [a.first_name, a.last_name].filter(Boolean).join(" ") || a.email : t, o = n.split(" ").map((p) => p[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
242
+ return /* @__PURE__ */ N(ht, { children: [
243
+ /* @__PURE__ */ e(gt, { asChild: !0, children: /* @__PURE__ */ N("span", { className: "inline-flex cursor-pointer items-center gap-1 rounded-full bg-slate-100 py-px pl-0.5 pr-2 hover:bg-slate-200 transition-colors", children: [
242
244
  /* @__PURE__ */ e(
243
- lt,
245
+ ft,
244
246
  {
245
247
  userId: t,
246
248
  className: "h-4 w-4",
247
- fallback: /* @__PURE__ */ e("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[9px] font-bold text-nvr-navy dark:text-nvr-cyan", children: a })
249
+ fallback: /* @__PURE__ */ e("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[9px] font-bold text-nvr-navy dark:text-nvr-cyan", children: o })
248
250
  }
249
251
  ),
250
252
  /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-600", children: n })
251
253
  ] }) }),
252
- /* @__PURE__ */ g(ot, { align: "start", className: "text-[12px]", children: [
253
- l && /* @__PURE__ */ g(
254
- Se,
254
+ /* @__PURE__ */ N(bt, { align: "start", className: "text-[12px]", children: [
255
+ l && /* @__PURE__ */ N(
256
+ Oe,
255
257
  {
256
258
  className: "gap-2 text-[12px] cursor-pointer",
257
259
  onSelect: () => i(l),
258
260
  children: [
259
- /* @__PURE__ */ e(Ae, { className: "h-3.5 w-3.5" }),
261
+ /* @__PURE__ */ e(rt, { className: "h-3.5 w-3.5" }),
260
262
  " View profile"
261
263
  ]
262
264
  }
263
265
  ),
264
- (s == null ? void 0 : s.email) && /* @__PURE__ */ g(
265
- Se,
266
+ (a == null ? void 0 : a.email) && /* @__PURE__ */ N(
267
+ Oe,
266
268
  {
267
269
  className: "gap-2 text-[12px] cursor-pointer",
268
270
  onSelect: () => {
269
- window.location.href = `mailto:${s.email}`;
271
+ window.location.href = `mailto:${a.email}`;
270
272
  },
271
273
  children: [
272
- /* @__PURE__ */ e(Ze, { className: "h-3.5 w-3.5" }),
274
+ /* @__PURE__ */ e(it, { className: "h-3.5 w-3.5" }),
273
275
  " Send email"
274
276
  ]
275
277
  }
@@ -277,42 +279,42 @@ function Le({ userId: t }) {
277
279
  ] })
278
280
  ] });
279
281
  }
280
- function ft({
282
+ function vt({
281
283
  collection: t,
282
284
  itemId: r,
283
285
  layoutId: i,
284
286
  attachField: u,
285
287
  filenameTemplate: l,
286
- label: s
288
+ label: a
287
289
  }) {
288
- const n = ee(), a = We(), [f, m] = X(!1), v = async () => {
289
- if (!(!n || f || !u)) {
290
- m(!0);
290
+ const n = re(), o = Xe(), [p, f] = ne(!1), v = async () => {
291
+ if (!(!n || p || !u)) {
292
+ f(!0);
291
293
  try {
292
294
  await n.request(
293
- rt(`/collection-layouts/${i}/generate-and-attach`, {
295
+ ct(`/collection-layouts/${i}/generate-and-attach`, {
294
296
  collection: t,
295
297
  item_id: r,
296
298
  attach_field: u,
297
299
  filename_template: l ?? void 0
298
300
  })
299
- ), a.invalidateQueries({ queryKey: ["m2m-items"] }), a.invalidateQueries({ queryKey: ["items", t, r] });
301
+ ), o.invalidateQueries({ queryKey: ["m2m-items"] }), o.invalidateQueries({ queryKey: ["items", t, r] });
300
302
  } catch {
301
303
  } finally {
302
- m(!1);
304
+ f(!1);
303
305
  }
304
306
  }
305
307
  }, c = !u;
306
- return /* @__PURE__ */ g(
308
+ return /* @__PURE__ */ N(
307
309
  "button",
308
310
  {
309
311
  type: "button",
310
312
  onClick: v,
311
- disabled: f || c,
313
+ disabled: p || c,
312
314
  title: c ? "Configure PDF field in Data Model → Layouts" : void 0,
313
315
  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",
314
316
  children: [
315
- /* @__PURE__ */ g(
317
+ /* @__PURE__ */ N(
316
318
  "svg",
317
319
  {
318
320
  xmlns: "http://www.w3.org/2000/svg",
@@ -329,47 +331,47 @@ function ft({
329
331
  ]
330
332
  }
331
333
  ),
332
- f ? "Generating…" : s
334
+ p ? "Generating…" : a
333
335
  ]
334
336
  }
335
337
  );
336
338
  }
337
- function Y({
339
+ function Q({
338
340
  relCollection: t,
339
341
  id: r,
340
342
  className: i
341
343
  }) {
342
- var p;
343
- const u = ee(), l = Ie(), s = r != null && r !== "" ? String(r) : null, { data: n } = Z({
344
+ var m;
345
+ const u = re(), l = ze(), a = r != null && r !== "" ? String(r) : null, { data: n } = te({
344
346
  queryKey: ["col-meta-dt", t],
345
347
  queryFn: () => u.request(
346
- qe(`/collections/${t}`)
347
- ).then((b) => b.data).catch(() => ({})),
348
- enabled: !!u && !!s,
348
+ Re(`/collections/${t}`)
349
+ ).then((g) => g.data).catch(() => ({})),
350
+ enabled: !!u && !!a,
349
351
  staleTime: 3e5
350
- }), a = (((p = n == null ? void 0 : n.display_template) == null ? void 0 : p.match(/\{\{\s*[^}]+?\s*\}\}/g)) ?? []).map((b) => b.replace(/[{}\s]/g, "")).filter((b) => b.includes(".")), f = a.length ? ["id", ...a].join(",") : null, { data: m, isLoading: v } = Z({
351
- queryKey: ["rel-display", t, s, f],
352
- queryFn: () => l(t, s, f),
353
- enabled: !!u && !!s && n !== void 0,
352
+ }), o = (((m = n == null ? void 0 : n.display_template) == null ? void 0 : m.match(/\{\{\s*[^}]+?\s*\}\}/g)) ?? []).map((g) => g.replace(/[{}\s]/g, "")).filter((g) => g.includes(".")), p = o.length ? ["id", ...o].join(",") : null, { data: f, isLoading: v } = te({
353
+ queryKey: ["rel-display", t, a, p],
354
+ queryFn: () => l(t, a, p),
355
+ enabled: !!u && !!a && n !== void 0,
354
356
  staleTime: 6e4
355
357
  });
356
- if (!s) return /* @__PURE__ */ e("span", { children: "—" });
358
+ if (!a) return /* @__PURE__ */ e("span", { children: "—" });
357
359
  if (v || u && n === void 0)
358
360
  return /* @__PURE__ */ e("span", { className: "animate-pulse h-3 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] inline-block" });
359
361
  const c = i ?? "text-[13px] text-slate-700";
360
- if (!m) return /* @__PURE__ */ e("span", { className: c, children: s });
361
- const h = n != null && n.display_template ? ct(n.display_template, m) : String(m.name ?? m.title ?? m.label ?? m.display_name ?? s);
362
+ if (!f) return /* @__PURE__ */ e("span", { className: c, children: a });
363
+ const h = n != null && n.display_template ? xt(n.display_template, f) : String(f.name ?? f.title ?? f.label ?? f.display_name ?? a);
362
364
  return /* @__PURE__ */ e("span", { className: c, children: h });
363
365
  }
364
- function Be({ userId: t }) {
365
- return /* @__PURE__ */ e(Je, { userId: t, size: "compact" });
366
+ function Je({ userId: t }) {
367
+ return /* @__PURE__ */ e(Ge, { userId: t, size: "compact" });
366
368
  }
367
- function Ue({
369
+ function Pe({
368
370
  relCollection: t,
369
371
  id: r,
370
372
  drillConfig: i
371
373
  }) {
372
- const u = tt(), l = /* @__PURE__ */ e(Y, { relCollection: t, id: r });
374
+ const u = at(), l = /* @__PURE__ */ e(Q, { relCollection: t, id: r });
373
375
  return !u || r == null || r === "" ? l : /* @__PURE__ */ e(
374
376
  "button",
375
377
  {
@@ -386,7 +388,7 @@ function Ue({
386
388
  },
387
389
  className: "group/drill cursor-pointer text-left transition-colors",
388
390
  children: /* @__PURE__ */ e(
389
- Y,
391
+ Q,
390
392
  {
391
393
  relCollection: t,
392
394
  id: r,
@@ -396,45 +398,45 @@ function Ue({
396
398
  }
397
399
  );
398
400
  }
399
- function ht(t) {
400
- const [r, i] = X(!1), u = se(!0), l = se(JSON.stringify(t ?? null));
401
- return Xe(() => {
402
- const s = JSON.stringify(t ?? null);
401
+ function St(t) {
402
+ const [r, i] = ne(!1), u = ce(!0), l = ce(JSON.stringify(t ?? null));
403
+ return lt(() => {
404
+ const a = JSON.stringify(t ?? null);
403
405
  if (u.current) {
404
- u.current = !1, l.current = s;
406
+ u.current = !1, l.current = a;
405
407
  return;
406
408
  }
407
- if (s === l.current) return;
408
- l.current = s, i(!1);
409
- const n = window.setTimeout(() => i(!0), 0), a = window.setTimeout(() => i(!1), 1200);
409
+ if (a === l.current) return;
410
+ l.current = a, i(!1);
411
+ const n = window.setTimeout(() => i(!0), 0), o = window.setTimeout(() => i(!1), 1200);
410
412
  return () => {
411
- window.clearTimeout(n), window.clearTimeout(a);
413
+ window.clearTimeout(n), window.clearTimeout(o);
412
414
  };
413
415
  }, [t]), r ? "nvr-value-pulse" : "";
414
416
  }
415
- function Lt({
417
+ function zt({
416
418
  field: t,
417
419
  val: r,
418
420
  relations: i,
419
421
  collection: u,
420
422
  displayFormat: l,
421
- textClassName: s
423
+ textClassName: a
422
424
  }) {
423
- const n = ht(r), a = A(s ?? "text-[13px] text-slate-900 dark:text-slate-100", n), f = et(t) ?? { enabled: !0, layout_id: null, width: null }, m = i.find(
425
+ const n = St(r), o = ee(a ?? "text-[13px] text-slate-900 dark:text-slate-100", n), p = st(t) ?? { enabled: !0, layout_id: null, width: null }, f = i.find(
424
426
  (c) => c.one_collection === u && c.one_field === t.field && c.junction_field
425
427
  );
426
- if (m) {
428
+ if (f) {
427
429
  const c = i.find(
428
- (b) => b.many_collection === m.many_collection && b.many_field === m.junction_field
429
- ), h = c == null ? void 0 : c.one_collection, p = Array.isArray(r) ? r : r != null && r !== "" ? [r] : [];
430
- return !h || p.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : h === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: p.map((b) => /* @__PURE__ */ e(Be, { userId: String(b) }, String(b))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: p.map((b) => /* @__PURE__ */ e(
431
- Ue,
430
+ (g) => g.many_collection === f.many_collection && g.many_field === f.junction_field
431
+ ), h = c == null ? void 0 : c.one_collection, m = Array.isArray(r) ? r : r != null && r !== "" ? [r] : [];
432
+ return !h || m.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : h === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: m.map((g) => /* @__PURE__ */ e(Je, { userId: String(g) }, String(g))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: m.map((g) => /* @__PURE__ */ e(
433
+ Pe,
432
434
  {
433
435
  relCollection: h,
434
- id: b,
435
- drillConfig: f
436
+ id: g,
437
+ drillConfig: p
436
438
  },
437
- String(b)
439
+ String(g)
438
440
  )) });
439
441
  }
440
442
  const v = i.find(
@@ -442,12 +444,12 @@ function Lt({
442
444
  );
443
445
  if (v != null && v.one_collection) {
444
446
  const c = Array.isArray(r) ? r : r != null && r !== "" ? [r] : [];
445
- return c.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : v.one_collection === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: c.map((h) => /* @__PURE__ */ e(Be, { userId: String(h) }, String(h))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: c.map((h) => /* @__PURE__ */ e(
446
- Ue,
447
+ return c.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : v.one_collection === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: c.map((h) => /* @__PURE__ */ e(Je, { userId: String(h) }, String(h))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: c.map((h) => /* @__PURE__ */ e(
448
+ Pe,
447
449
  {
448
450
  relCollection: v.one_collection,
449
451
  id: h,
450
- drillConfig: f
452
+ drillConfig: p
451
453
  },
452
454
  String(h)
453
455
  )) });
@@ -457,421 +459,438 @@ function Lt({
457
459
  if (l && l !== "text") {
458
460
  const c = Number(r);
459
461
  if (l === "currency" && !isNaN(c))
460
- return /* @__PURE__ */ e("span", { className: `font-semibold ${a}`, children: new Intl.NumberFormat(void 0, {
462
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: new Intl.NumberFormat(void 0, {
461
463
  style: "currency",
462
464
  currency: "USD",
463
465
  minimumFractionDigits: 2
464
466
  }).format(c) });
465
467
  if (l === "integer" && !isNaN(c))
466
- return /* @__PURE__ */ e("span", { className: `font-semibold ${a}`, children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(Math.round(c)) });
468
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(Math.round(c)) });
467
469
  if (l === "decimal" && !isNaN(c))
468
- return /* @__PURE__ */ e("span", { className: `font-semibold ${a}`, children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(c) });
470
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(c) });
469
471
  if (l === "percent" && !isNaN(c))
470
- return /* @__PURE__ */ e("span", { className: `font-semibold ${a}`, children: new Intl.NumberFormat(void 0, { style: "percent", maximumFractionDigits: 1 }).format(
472
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: new Intl.NumberFormat(void 0, { style: "percent", maximumFractionDigits: 1 }).format(
471
473
  c / 100
472
474
  ) });
473
475
  if (l === "date")
474
476
  try {
475
- return /* @__PURE__ */ e("span", { className: `font-semibold ${a}`, children: new Date(String(r)).toLocaleDateString() });
477
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: new Date(String(r)).toLocaleDateString() });
476
478
  } catch {
477
479
  }
478
480
  if (l === "datetime")
479
481
  try {
480
- return /* @__PURE__ */ e("span", { className: `font-semibold ${a}`, children: new Date(String(r)).toLocaleString() });
482
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: new Date(String(r)).toLocaleString() });
481
483
  } catch {
482
484
  }
483
485
  }
484
- return /* @__PURE__ */ e("span", { className: `font-semibold ${a}`, children: ae(r, t) });
486
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: de(r, t) });
485
487
  }
486
- function bt({
488
+ function kt({
487
489
  summaryFields: t,
488
490
  fields: r,
489
491
  draft: i,
490
492
  relations: u,
491
493
  collection: l,
492
- itemId: s,
494
+ itemId: a,
493
495
  ownersCollection: n,
494
- ownersItemId: a,
495
- ownersAssignment: f,
496
- m2mCounts: m,
496
+ ownersItemId: o,
497
+ ownersAssignment: p,
498
+ m2mCounts: f,
497
499
  o2mCounts: v,
498
500
  o2mAggValues: c,
499
501
  summaryAggConfigs: h,
500
- o2mLoading: p,
501
- hideEmpty: b
502
+ o2mLoading: m,
503
+ hideEmpty: g
502
504
  }) {
503
- const j = t.map((x) => typeof x == "string" ? x : x.field), $ = b ? j.filter((x) => {
504
- if (x === "__owners__" || p != null && p.has(x) || c && x in c) return !0;
505
- if (m && x in m) return (m[x] ?? 0) > 0;
506
- if (v && x in v) return (v[x] ?? 0) > 0;
507
- const B = i[x];
505
+ const j = t.map((b) => typeof b == "string" ? b : b.field), $ = g ? j.filter((b) => {
506
+ if (b === "__owners__" || m != null && m.has(b) || c && b in c) return !0;
507
+ if (f && b in f) return (f[b] ?? 0) > 0;
508
+ if (v && b in v) return (v[b] ?? 0) > 0;
509
+ const B = i[b];
508
510
  return B != null && B !== "" && !(Array.isArray(B) && B.length === 0);
509
511
  }) : j;
510
512
  if ($.length === 0) return null;
511
- const N = "text-[9px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500 shrink-0", w = "text-[12px] font-semibold text-slate-700 dark:text-slate-300", J = "text-[12px] text-slate-300 dark:text-slate-600", P = "flex items-baseline gap-1.5", te = (x) => {
512
- if (x === "__owners__") {
513
- const d = (f == null ? void 0 : f.label_override) || "Owners";
514
- return /* @__PURE__ */ g("div", { className: "flex items-center gap-1.5", children: [
515
- /* @__PURE__ */ e("span", { className: N, children: d }),
513
+ const _ = "text-[9px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500 shrink-0", w = "text-[12px] font-semibold text-slate-700 dark:text-slate-300", P = "text-[12px] text-slate-300 dark:text-slate-600", C = "flex items-baseline gap-1.5", ie = (b) => {
514
+ if (b === "__owners__") {
515
+ const d = (p == null ? void 0 : p.label_override) || "Owners";
516
+ return /* @__PURE__ */ N("div", { className: "flex items-center gap-1.5", children: [
517
+ /* @__PURE__ */ e("span", { className: _, children: d }),
516
518
  /* @__PURE__ */ e(
517
- ut,
519
+ Nt,
518
520
  {
519
521
  collection: n ?? l,
520
- itemId: a ?? s
522
+ itemId: o ?? a
521
523
  }
522
524
  )
523
525
  ] });
524
526
  }
525
- const B = t.find((d) => (typeof d == "string" ? d : d.field) === x), Q = B && typeof B != "string" ? B.label : void 0, K = r.find((d) => d.field === x), U = Q || (K == null ? void 0 : K.label) || x.replace(/_/g, " ").replace(/\b\w/g, (d) => d.toUpperCase());
526
- if (p != null && p.has(x))
527
- return /* @__PURE__ */ g("div", { className: "flex items-center gap-1.5", children: [
528
- /* @__PURE__ */ e("span", { className: N, children: U }),
529
- /* @__PURE__ */ e(He, { className: "h-3 w-3 animate-spin text-slate-300" })
527
+ const B = t.find((d) => (typeof d == "string" ? d : d.field) === b), A = B && typeof B != "string" ? B.label : void 0, K = r.find((d) => d.field === b), U = A || (K == null ? void 0 : K.label) || b.replace(/_/g, " ").replace(/\b\w/g, (d) => d.toUpperCase());
528
+ if (m != null && m.has(b))
529
+ return /* @__PURE__ */ N("div", { className: "flex items-center gap-1.5", children: [
530
+ /* @__PURE__ */ e("span", { className: _, children: U }),
531
+ /* @__PURE__ */ e(nt, { className: "h-3 w-3 animate-spin text-slate-300" })
530
532
  ] });
531
- if (c && x in c) {
532
- const d = h == null ? void 0 : h[x], L = (d == null ? void 0 : d.label) || U, F = c[x];
533
- let q;
533
+ if (c && b in c) {
534
+ const d = h == null ? void 0 : h[b], L = (d == null ? void 0 : d.label) || U, F = c[b];
535
+ let T;
534
536
  if ((d == null ? void 0 : d.agg) === "count")
535
- q = String(F);
537
+ T = String(F);
536
538
  else {
537
- const C = d != null && d.field_options ? (() => {
539
+ const R = d != null && d.field_options ? (() => {
538
540
  try {
539
541
  return JSON.parse(d.field_options);
540
542
  } catch {
541
543
  return {};
542
544
  }
543
- })() : {}, z = C.format;
544
- if (z === "currency")
545
+ })() : {}, G = R.format;
546
+ if (G === "currency")
545
547
  try {
546
- q = new Intl.NumberFormat(void 0, {
548
+ T = new Intl.NumberFormat(void 0, {
547
549
  style: "currency",
548
- currency: C.currency || "USD"
550
+ currency: R.currency || "USD"
549
551
  }).format(F);
550
552
  } catch {
551
- q = F.toLocaleString(void 0, { maximumFractionDigits: 2 });
553
+ T = F.toLocaleString(void 0, { maximumFractionDigits: 2 });
552
554
  }
553
- else if (z === "int")
554
- q = new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(F);
555
- else if (z === "decimal") {
556
- const G = typeof C.precision == "number" ? C.precision : 2;
557
- q = new Intl.NumberFormat(void 0, {
558
- minimumFractionDigits: G,
559
- maximumFractionDigits: G
555
+ else if (G === "int")
556
+ T = new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(F);
557
+ else if (G === "decimal") {
558
+ const V = typeof R.precision == "number" ? R.precision : 2;
559
+ T = new Intl.NumberFormat(void 0, {
560
+ minimumFractionDigits: V,
561
+ maximumFractionDigits: V
560
562
  }).format(F);
561
563
  } else
562
- q = F.toLocaleString(void 0, { maximumFractionDigits: 2 });
564
+ T = F.toLocaleString(void 0, { maximumFractionDigits: 2 });
563
565
  }
564
- return /* @__PURE__ */ g("div", { className: P, children: [
565
- /* @__PURE__ */ e("span", { className: N, children: L }),
566
- /* @__PURE__ */ e("span", { className: w, children: q })
566
+ return /* @__PURE__ */ N("div", { className: C, children: [
567
+ /* @__PURE__ */ e("span", { className: _, children: L }),
568
+ /* @__PURE__ */ e("span", { className: w, children: T })
567
569
  ] });
568
570
  }
569
- if (m && x in m) {
570
- const d = m[x];
571
- return /* @__PURE__ */ g("div", { className: P, children: [
572
- /* @__PURE__ */ e("span", { className: N, children: U }),
573
- /* @__PURE__ */ g("span", { className: w, children: [
571
+ if (f && b in f) {
572
+ const d = f[b];
573
+ return /* @__PURE__ */ N("div", { className: C, children: [
574
+ /* @__PURE__ */ e("span", { className: _, children: U }),
575
+ /* @__PURE__ */ N("span", { className: w, children: [
574
576
  d,
575
577
  " item",
576
578
  d !== 1 ? "s" : ""
577
579
  ] })
578
580
  ] });
579
581
  }
580
- if (v && x in v) {
581
- const d = v[x];
582
- return /* @__PURE__ */ g("div", { className: P, children: [
583
- /* @__PURE__ */ e("span", { className: N, children: U }),
584
- /* @__PURE__ */ g("span", { className: w, children: [
582
+ if (v && b in v) {
583
+ const d = v[b];
584
+ return /* @__PURE__ */ N("div", { className: C, children: [
585
+ /* @__PURE__ */ e("span", { className: _, children: U }),
586
+ /* @__PURE__ */ N("span", { className: w, children: [
585
587
  d,
586
588
  " row",
587
589
  d !== 1 ? "s" : ""
588
590
  ] })
589
591
  ] });
590
592
  }
591
- const D = i[x], T = u.find(
592
- (d) => d.many_collection === l && d.many_field === x && !d.junction_field
593
+ const k = i[b], I = u.find(
594
+ (d) => d.many_collection === l && d.many_field === b && !d.junction_field
593
595
  );
594
- if (T != null && T.one_collection) {
595
- const d = Array.isArray(D) ? D : D != null && D !== "" ? [D] : [];
596
- return /* @__PURE__ */ g("div", { className: P, children: [
597
- /* @__PURE__ */ e("span", { className: N, children: U }),
598
- d.length === 0 ? /* @__PURE__ */ e("span", { className: J, children: "—" }) : T.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(Le, { userId: String(L) }, String(L))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: d.map((L) => /* @__PURE__ */ e(Y, { relCollection: T.one_collection, id: L }, String(L))) })
596
+ if (I != null && I.one_collection) {
597
+ const d = Array.isArray(k) ? k : k != null && k !== "" ? [k] : [];
598
+ return /* @__PURE__ */ N("div", { className: C, children: [
599
+ /* @__PURE__ */ e("span", { className: _, children: U }),
600
+ d.length === 0 ? /* @__PURE__ */ e("span", { className: P, children: "—" }) : I.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(Me, { userId: String(L) }, String(L))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: d.map((L) => /* @__PURE__ */ e(Q, { relCollection: I.one_collection, id: L }, String(L))) })
599
601
  ] });
600
602
  }
601
- if (Array.isArray(D)) {
602
- const d = u.find((F) => F.many_field === x && F.junction_field), L = d == null ? void 0 : d.one_collection;
603
- return /* @__PURE__ */ g("div", { className: P, children: [
604
- /* @__PURE__ */ e("span", { className: N, children: U }),
605
- D.length === 0 ? /* @__PURE__ */ e("span", { className: J, children: "—" }) : L ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5 gap-y-0.5", children: D.map(
606
- (F) => L === "nivaro_users" ? /* @__PURE__ */ e(Le, { userId: String(F) }, String(F)) : /* @__PURE__ */ e(Y, { relCollection: L, id: F }, String(F))
607
- ) }) : /* @__PURE__ */ g("span", { className: w, children: [
608
- D.length,
603
+ if (Array.isArray(k)) {
604
+ const d = u.find((F) => F.many_field === b && F.junction_field), L = d == null ? void 0 : d.one_collection;
605
+ return /* @__PURE__ */ N("div", { className: C, children: [
606
+ /* @__PURE__ */ e("span", { className: _, children: U }),
607
+ k.length === 0 ? /* @__PURE__ */ e("span", { className: P, children: "—" }) : L ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5 gap-y-0.5", children: k.map(
608
+ (F) => L === "nivaro_users" ? /* @__PURE__ */ e(Me, { userId: String(F) }, String(F)) : /* @__PURE__ */ e(Q, { relCollection: L, id: F }, String(F))
609
+ ) }) : /* @__PURE__ */ N("span", { className: w, children: [
610
+ k.length,
609
611
  " item",
610
- D.length !== 1 ? "s" : ""
612
+ k.length !== 1 ? "s" : ""
611
613
  ] })
612
614
  ] });
613
615
  }
614
- return /* @__PURE__ */ g("div", { className: P, children: [
615
- /* @__PURE__ */ e("span", { className: N, children: U }),
616
- D == null || D === "" ? /* @__PURE__ */ e("span", { className: J, children: "—" }) : /* @__PURE__ */ e("span", { className: w, children: ae(D, K) })
616
+ return /* @__PURE__ */ N("div", { className: C, children: [
617
+ /* @__PURE__ */ e("span", { className: _, children: U }),
618
+ k == null || k === "" ? /* @__PURE__ */ e("span", { className: P, children: "—" }) : /* @__PURE__ */ e("span", { className: w, children: de(k, K) })
617
619
  ] });
618
620
  };
619
- 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: $.map((x) => /* @__PURE__ */ e(Te.Fragment, { children: te(x) }, x)) });
621
+ 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: $.map((b) => /* @__PURE__ */ e(Ce.Fragment, { children: ie(b) }, b)) });
620
622
  }
621
- function Bt({
623
+ function Kt({
622
624
  group: t,
623
625
  fields: r,
624
626
  draft: i,
625
627
  onChange: u,
626
628
  relations: l,
627
- collection: s,
629
+ collection: a,
628
630
  itemId: n,
629
- errors: a,
630
- visibleFields: f,
631
- lockedFields: m,
631
+ errors: o,
632
+ visibleFields: p,
633
+ lockedFields: f,
632
634
  layoutAiEnabled: v,
633
635
  displayOnly: c,
634
636
  renderField: h,
635
- onCountChange: p,
636
- isNew: b,
637
+ onCountChange: m,
638
+ isNew: g,
637
639
  fieldValues: j,
638
640
  isOpen: $,
639
- onToggle: N,
641
+ onToggle: _,
640
642
  summaryFields: w,
641
- m2mCounts: J,
642
- o2mCounts: P,
643
- o2mAggValues: te,
644
- summaryAggConfigs: x,
643
+ m2mCounts: P,
644
+ o2mCounts: C,
645
+ o2mAggValues: ie,
646
+ summaryAggConfigs: b,
645
647
  o2mLoading: B,
646
- footerSlot: Q,
648
+ footerSlot: A,
647
649
  ownersCollection: K,
648
650
  ownersItemId: U,
649
- ownersAssignment: D,
650
- pdfAssignment: T,
651
+ ownersAssignment: k,
652
+ pdfAssignment: I,
651
653
  pdfAttachField: d,
652
654
  pdfFilenameTemplate: L,
653
655
  layoutId: F,
654
- hideEmptySummary: q,
655
- widgetAssignments: C,
656
- widgetApiBase: z,
657
- fieldInlineDisplay: G,
658
- swapConfig: I,
659
- swapped: oe,
660
- onSwapToggle: ce,
656
+ hideEmptySummary: T,
657
+ widgetAssignments: R,
658
+ widgetApiBase: G,
659
+ fieldInlineDisplay: V,
660
+ swapConfig: q,
661
+ swapped: ue,
662
+ onSwapToggle: pe,
661
663
  alternateFields: E,
662
- alternateWidths: ne
664
+ alternateWidths: le
663
665
  }) {
664
- const [Pe, Ce] = X(t.is_collapsed ?? !1), [de, ue] = X({}), pe = N !== void 0, V = pe ? !$ : Pe, Re = pe ? N : () => Ce((_) => !_), Ke = !c && r.some((_) => a[_.field]), me = t.visibility_mode ?? "always";
665
- if (me === "new_only" && !b || me === "existing_only" && b) return null;
666
- const W = C ?? [], ze = !b && W.some((_) => _.widget_id != null && de[_.field] === void 0);
667
- let re = !1;
668
- if (t.hide_when_empty && j && (re = j.every(
669
- (o) => o == null || o === "" || Array.isArray(o) && o.length === 0
670
- ) && !ze && W.every((o) => !de[o.field])), re && W.length === 0) return null;
671
- const ie = se(null), fe = dt(ie), he = mt(t.icon), Ge = r.filter((_) => !_.hidden);
672
- return /* @__PURE__ */ g(
666
+ const [Ve, We] = ne(t.is_collapsed ?? !1), M = mt(), W = (x, s) => pt(M, x, s, { asChild: !0 }), Z = (x) => ({ kind: "slot", field: x, group_key: t.key }), me = !!(M != null && M.showHidden), [fe, he] = ne({}), ge = _ !== void 0, H = ge ? !$ : Ve, Ee = ge ? _ : () => We((x) => !x), He = !c && r.some((x) => o[x.field]), be = M ? "always" : t.visibility_mode ?? "always";
667
+ if (be === "new_only" && !g || be === "existing_only" && g) return null;
668
+ const Y = R ?? [], Ye = !g && Y.some((x) => x.widget_id != null && fe[x.field] === void 0);
669
+ let se = !1;
670
+ if (t.hide_when_empty && j && !M && (se = j.every(
671
+ (s) => s == null || s === "" || Array.isArray(s) && s.length === 0
672
+ ) && !Ye && Y.every((s) => !fe[s.field])), se && Y.length === 0) return null;
673
+ const ae = ce(null), xe = yt(ae), ye = wt(t.icon), Qe = me ? r : r.filter((x) => !x.hidden), Ne = (x) => me && (x.hidden || !(p.has(x.field) || !p.size));
674
+ return /* @__PURE__ */ N(
673
675
  "div",
674
676
  {
675
- className: A(
677
+ className: ee(
676
678
  "nvr-section-enter rounded-xl border border-slate-200 bg-white dark:bg-card dark:border-border",
677
679
  c && "bg-slate-50/60 dark:bg-slate-900/20",
678
- re && "hidden"
680
+ se && "hidden"
679
681
  ),
680
682
  children: [
681
- /* @__PURE__ */ g(
683
+ /* @__PURE__ */ N(
682
684
  "button",
683
685
  {
684
686
  type: "button",
685
- onClick: Re,
686
- className: A(
687
+ onClick: Ee,
688
+ "data-design-group-header": M ? "" : void 0,
689
+ className: ee(
687
690
  "flex w-full items-center gap-2 px-5 py-3 text-left hover:bg-slate-50/50 dark:hover:bg-white/[0.02] rounded-t-xl",
688
691
  // Round the bottom only when nothing renders below the header — an
689
692
  // expanded body (or collapsed summary strip) square-joins it, and a
690
693
  // rounded hover overlay would leave see-through notches at the seam.
691
- V && !(w && w.length > 0) && "rounded-b-xl"
694
+ H && !(w && w.length > 0) && "rounded-b-xl"
692
695
  ),
693
696
  children: [
694
- he && /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 dark:text-slate-500" }),
697
+ ye && /* @__PURE__ */ e(ye, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 dark:text-slate-500" }),
695
698
  /* @__PURE__ */ e("span", { className: "font-medium text-[13px] shrink-0 text-slate-800 dark:text-slate-200", children: t.label }),
696
699
  /* @__PURE__ */ e("span", { className: "flex-1" }),
697
- Ke && /* @__PURE__ */ e("span", { className: "nvr-pop h-2 w-2 rounded-full bg-destructive shrink-0" }),
700
+ He && /* @__PURE__ */ e("span", { className: "nvr-pop h-2 w-2 rounded-full bg-destructive shrink-0" }),
698
701
  /* @__PURE__ */ e(
699
- Qe,
702
+ tt,
700
703
  {
701
- className: A(
704
+ "data-design-pass": M ? "" : void 0,
705
+ className: ee(
702
706
  "h-4 w-4 text-slate-400 dark:text-slate-500 transition-transform duration-200",
703
- V && "-rotate-90"
707
+ H && "-rotate-90"
704
708
  )
705
709
  }
706
710
  )
707
711
  ]
708
712
  }
709
713
  ),
710
- V && w && w.length > 0 && /* @__PURE__ */ e(
711
- bt,
714
+ H && w && w.length > 0 && /* @__PURE__ */ e(
715
+ kt,
712
716
  {
713
717
  summaryFields: w,
714
718
  fields: r,
715
719
  draft: i,
716
720
  relations: l,
717
- collection: s,
721
+ collection: a,
718
722
  itemId: n,
719
723
  ownersCollection: K,
720
724
  ownersItemId: U,
721
- ownersAssignment: D,
722
- m2mCounts: J,
723
- o2mCounts: P,
724
- o2mAggValues: te,
725
- summaryAggConfigs: x,
725
+ ownersAssignment: k,
726
+ m2mCounts: P,
727
+ o2mCounts: C,
728
+ o2mAggValues: ie,
729
+ summaryAggConfigs: b,
726
730
  o2mLoading: B,
727
- hideEmpty: !!t.summary_hide_empty || !!q
731
+ hideEmpty: !!t.summary_hide_empty || !!T
728
732
  }
729
733
  ),
730
- V && t.hide_when_empty && W.length > 0 && /* @__PURE__ */ e("div", { className: "hidden", children: W.filter((_) => _.widget_id != null).map((_) => /* @__PURE__ */ e(
731
- De,
734
+ H && t.hide_when_empty && Y.length > 0 && /* @__PURE__ */ e("div", { className: "hidden", children: Y.filter((x) => x.widget_id != null).map((x) => /* @__PURE__ */ e(
735
+ Le,
732
736
  {
733
- widgetId: _.widget_id,
734
- inputBindings: je(_.input_bindings),
737
+ widgetId: x.widget_id,
738
+ inputBindings: Te(x.input_bindings),
735
739
  itemDraft: i,
736
740
  frameless: !0,
737
- apiBase: z,
738
- onContentChange: (o) => ue(
739
- (y) => y[_.field] === o ? y : { ...y, [_.field]: o }
741
+ apiBase: G,
742
+ onContentChange: (s) => he(
743
+ (y) => y[x.field] === s ? y : { ...y, [x.field]: s }
740
744
  )
741
745
  },
742
- _.field
746
+ x.field
743
747
  )) }),
744
- !V && /* @__PURE__ */ g("div", { className: "nvr-expand-in border-t border-slate-100 px-5 py-4", children: [
748
+ !H && /* @__PURE__ */ N("div", { className: "nvr-expand-in border-t border-slate-100 px-5 py-4", children: [
745
749
  (() => {
746
- const _ = Ge.map((o) => ({
747
- _k: o.field,
748
- sort: o.sort ?? 0,
750
+ const x = Qe.map((s) => ({
751
+ _k: s.field,
752
+ sort: s.sort ?? 0,
749
753
  _t: "field",
750
- f: o
754
+ f: s
751
755
  }));
752
- D && _.push({
756
+ k && x.push({
753
757
  _k: "__owners__",
754
- sort: D.sort,
758
+ sort: k.sort,
755
759
  _t: "owners",
756
- slot: D
757
- }), T && _.push({
760
+ slot: k
761
+ }), I && x.push({
758
762
  _k: "__pdf__",
759
- sort: T.sort,
763
+ sort: I.sort,
760
764
  _t: "pdf",
761
- slot: T
765
+ slot: I
762
766
  });
763
- for (const o of C ?? [])
764
- _.push({ _k: o.field, sort: o.sort, _t: "widget", slot: o });
765
- return _.sort((o, y) => o.sort - y.sort), c ? /* @__PURE__ */ e("div", { ref: ie, className: "grid grid-cols-12 gap-x-6 gap-y-3", children: _.map((o) => {
766
- if (o._t === "owners") {
767
- const k = o.slot.col_span ?? 12;
768
- return /* @__PURE__ */ e(
767
+ for (const s of R ?? [])
768
+ x.push({ _k: s.field, sort: s.sort, _t: "widget", slot: s });
769
+ return x.sort((s, y) => s.sort - y.sort), M && x.length === 0 ? /* @__PURE__ */ e(ut, {}) : c ? /* @__PURE__ */ e("div", { ref: ae, className: "grid grid-cols-12 gap-x-6 gap-y-3", children: x.map((s) => {
770
+ if (s._t === "owners") {
771
+ const D = s.slot.col_span ?? 12;
772
+ return W(
773
+ Z("__owners__"),
774
+ /* @__PURE__ */ e(
775
+ "div",
776
+ {
777
+ className: "min-w-0",
778
+ style: { gridColumn: `span ${D}` },
779
+ children: /* @__PURE__ */ e(
780
+ Ie,
781
+ {
782
+ collection: a,
783
+ itemId: n,
784
+ label: s.slot.label_override || "Owners"
785
+ }
786
+ )
787
+ },
788
+ "__owners__"
789
+ )
790
+ );
791
+ }
792
+ if (s._t === "pdf" || s._t === "widget") return null;
793
+ const y = s.f, O = l.find(
794
+ (D) => D.many_collection === a && D.many_field === y.field && !D.junction_field
795
+ );
796
+ return W(
797
+ { kind: "field", field: y.field, group_key: t.key },
798
+ /* @__PURE__ */ N(
769
799
  "div",
770
800
  {
771
801
  className: "min-w-0",
772
- style: { gridColumn: `span ${k}` },
773
- children: /* @__PURE__ */ e(
774
- Fe,
775
- {
776
- collection: s,
777
- itemId: n,
778
- label: o.slot.label_override || "Owners"
779
- }
780
- )
802
+ style: { gridColumn: `span ${Ue(y.options, xe)}` },
803
+ children: [
804
+ /* @__PURE__ */ e("dt", { className: "text-[11px] font-medium text-slate-400 truncate", children: y.label || Ke(y.field) }),
805
+ /* @__PURE__ */ e("dd", { className: "mt-0.5 break-words", children: (O == null ? void 0 : O.one_collection) === "nivaro_users" ? (() => {
806
+ const D = i[y.field], X = Array.isArray(D) ? D : D != null && D !== "" ? [D] : [];
807
+ return X.length === 0 ? /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-400", children: "—" }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: X.map((z) => /* @__PURE__ */ e(Ge, { userId: String(z) }, String(z))) });
808
+ })() : O != null && O.one_collection ? /* @__PURE__ */ e(Q, { relCollection: O.one_collection, id: i[y.field] }) : /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-700", children: de(i[y.field], y) }) })
809
+ ]
781
810
  },
782
- "__owners__"
783
- );
784
- }
785
- if (o._t === "pdf" || o._t === "widget") return null;
786
- const y = o.f, O = l.find(
787
- (k) => k.many_collection === s && k.many_field === y.field && !k.junction_field
788
- );
789
- return /* @__PURE__ */ g(
790
- "div",
791
- {
792
- className: "min-w-0",
793
- style: { gridColumn: `span ${$e(y.options, fe)}` },
794
- children: [
795
- /* @__PURE__ */ e("dt", { className: "text-[11px] font-medium text-slate-400 truncate", children: y.label || Me(y.field) }),
796
- /* @__PURE__ */ e("dd", { className: "mt-0.5 break-words", children: (O == null ? void 0 : O.one_collection) === "nivaro_users" ? (() => {
797
- const k = i[y.field], H = Array.isArray(k) ? k : k != null && k !== "" ? [k] : [];
798
- return H.length === 0 ? /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-400", children: "—" }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: H.map((R) => /* @__PURE__ */ e(Je, { userId: String(R) }, String(R))) });
799
- })() : O != null && O.one_collection ? /* @__PURE__ */ e(Y, { relCollection: O.one_collection, id: i[y.field] }) : /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-700", children: ae(i[y.field], y) }) })
800
- ]
801
- },
802
- y.field
811
+ y.field
812
+ )
803
813
  );
804
- }) }) : /* @__PURE__ */ e("div", { ref: ie, className: "grid grid-cols-12 gap-4 items-start", children: _.map((o) => {
805
- var _e, we;
806
- if (o._t === "owners") {
807
- const S = o.slot.col_span ?? 12;
808
- return /* @__PURE__ */ e("div", { style: { gridColumn: `span ${S}` }, children: /* @__PURE__ */ e(
809
- Fe,
810
- {
811
- collection: s,
812
- itemId: n,
813
- label: o.slot.label_override || "Owners"
814
- }
815
- ) }, "__owners__");
814
+ }) }) : /* @__PURE__ */ e("div", { ref: ae, className: "grid grid-cols-12 gap-4 items-start", children: x.map((s) => {
815
+ var $e, Fe;
816
+ if (s._t === "owners") {
817
+ const S = s.slot.col_span ?? 12;
818
+ return W(
819
+ Z("__owners__"),
820
+ /* @__PURE__ */ e("div", { style: { gridColumn: `span ${S}` }, children: /* @__PURE__ */ e(
821
+ Ie,
822
+ {
823
+ collection: a,
824
+ itemId: n,
825
+ label: s.slot.label_override || "Owners"
826
+ }
827
+ ) }, "__owners__")
828
+ );
816
829
  }
817
- if (o._t === "pdf") {
830
+ if (s._t === "pdf") {
818
831
  if (!F) return null;
819
- const S = o.slot.col_span ?? 12, M = ((_e = o.slot.label_override) == null ? void 0 : _e.trim()) || "Generate PDF";
820
- return /* @__PURE__ */ e("div", { style: { gridColumn: `span ${S}` }, children: /* @__PURE__ */ e(
821
- ft,
822
- {
823
- collection: s,
824
- itemId: n,
825
- layoutId: F,
826
- attachField: d ?? null,
827
- filenameTemplate: L,
828
- label: M
829
- }
830
- ) }, "__pdf__");
832
+ const S = s.slot.col_span ?? 12, J = (($e = s.slot.label_override) == null ? void 0 : $e.trim()) || "Generate PDF";
833
+ return W(
834
+ Z("__pdf__"),
835
+ /* @__PURE__ */ e("div", { style: { gridColumn: `span ${S}` }, children: /* @__PURE__ */ e(
836
+ vt,
837
+ {
838
+ collection: a,
839
+ itemId: n,
840
+ layoutId: F,
841
+ attachField: d ?? null,
842
+ filenameTemplate: L,
843
+ label: J
844
+ }
845
+ ) }, "__pdf__")
846
+ );
831
847
  }
832
- if (o._t === "widget") {
833
- if (!o.slot.widget_id) return null;
834
- const S = o.slot.col_span ?? 12, M = je(o.slot.input_bindings);
835
- return /* @__PURE__ */ e("div", { style: { gridColumn: `span ${S}` }, children: /* @__PURE__ */ e(
836
- De,
837
- {
838
- widgetId: o.slot.widget_id,
839
- inputBindings: M,
840
- itemDraft: i,
841
- label: o.slot.label_override ?? void 0,
842
- defaultExpanded: o.slot.default_expanded ?? !0,
843
- frameless: !0,
844
- apiBase: z,
845
- onContentChange: (ve) => ue(
846
- (le) => le[o.slot.field] === ve ? le : { ...le, [o.slot.field]: ve }
847
- )
848
- }
849
- ) }, o.slot.field);
848
+ if (s._t === "widget") {
849
+ if (!s.slot.widget_id) return null;
850
+ const S = s.slot.col_span ?? 12, J = Te(s.slot.input_bindings);
851
+ return W(
852
+ Z(s.slot.field),
853
+ /* @__PURE__ */ e("div", { style: { gridColumn: `span ${S}` }, children: /* @__PURE__ */ e(
854
+ Le,
855
+ {
856
+ widgetId: s.slot.widget_id,
857
+ inputBindings: J,
858
+ itemDraft: i,
859
+ label: s.slot.label_override ?? void 0,
860
+ defaultExpanded: s.slot.default_expanded ?? !0,
861
+ frameless: !0,
862
+ apiBase: G,
863
+ onContentChange: (je) => he(
864
+ (oe) => oe[s.slot.field] === je ? oe : { ...oe, [s.slot.field]: je }
865
+ )
866
+ }
867
+ ) }, s.slot.field)
868
+ );
850
869
  }
851
- const y = o.f, O = G == null ? void 0 : G[y.field], k = O == null ? void 0 : O.entries, H = (O == null ? void 0 : O.separator) ?? null, R = i[y.field], be = R != null && R !== "", xe = k != null && k.length && be ? ((we = l.find(
852
- (S) => S.many_collection === s && S.many_field === y.field && !S.junction_field
853
- )) == null ? void 0 : we.one_collection) ?? null : null, ge = (I == null ? void 0 : I.enabled) && y.field === I.primary_field, ye = (() => {
854
- const S = i[(I == null ? void 0 : I.primary_field) ?? ""];
870
+ const y = s.f, O = V == null ? void 0 : V[y.field], D = O == null ? void 0 : O.entries, X = (O == null ? void 0 : O.separator) ?? null, z = i[y.field], _e = z != null && z !== "", we = D != null && D.length && _e ? ((Fe = l.find(
871
+ (S) => S.many_collection === a && S.many_field === y.field && !S.junction_field
872
+ )) == null ? void 0 : Fe.one_collection) ?? null : null, ve = (q == null ? void 0 : q.enabled) && y.field === q.primary_field, Se = (() => {
873
+ const S = i[(q == null ? void 0 : q.primary_field) ?? ""];
855
874
  return S != null && S !== "";
856
- })(), Ne = (E ?? []).some((S) => {
857
- const M = i[S.field];
858
- return M != null && M !== "";
859
- }), Ee = ge && ce ? /* @__PURE__ */ g("span", { className: "inline-flex items-center gap-1.5", children: [
875
+ })(), ke = (E ?? []).some((S) => {
876
+ const J = i[S.field];
877
+ return J != null && J !== "";
878
+ }), Ae = ve && pe ? /* @__PURE__ */ N("span", { className: "inline-flex items-center gap-1.5", children: [
860
879
  /* @__PURE__ */ e(
861
880
  "button",
862
881
  {
863
882
  type: "button",
864
- onClick: ce,
883
+ onClick: pe,
865
884
  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",
866
- children: oe ? I.back_label ?? "Back" : I.toggle_label ?? "Enter manually"
885
+ children: ue ? q.back_label ?? "Back" : q.toggle_label ?? "Enter manually"
867
886
  }
868
887
  ),
869
- /* @__PURE__ */ g(
888
+ /* @__PURE__ */ N(
870
889
  "span",
871
890
  {
872
891
  className: [
873
892
  "inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[9px] font-medium",
874
- ye ? "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"
893
+ Se ? "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"
875
894
  ].join(" "),
876
895
  title: "Original field",
877
896
  children: [
@@ -880,7 +899,7 @@ function Bt({
880
899
  {
881
900
  className: [
882
901
  "h-1.5 w-1.5 rounded-full",
883
- ye ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
902
+ Se ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
884
903
  ].join(" ")
885
904
  }
886
905
  ),
@@ -888,12 +907,12 @@ function Bt({
888
907
  ]
889
908
  }
890
909
  ),
891
- /* @__PURE__ */ g(
910
+ /* @__PURE__ */ N(
892
911
  "span",
893
912
  {
894
913
  className: [
895
914
  "inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[9px] font-medium",
896
- Ne ? "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"
915
+ ke ? "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"
897
916
  ].join(" "),
898
917
  title: "Manual fields",
899
918
  children: [
@@ -902,7 +921,7 @@ function Bt({
902
921
  {
903
922
  className: [
904
923
  "h-1.5 w-1.5 rounded-full",
905
- Ne ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
924
+ ke ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
906
925
  ].join(" ")
907
926
  }
908
927
  ),
@@ -910,81 +929,85 @@ function Bt({
910
929
  ]
911
930
  }
912
931
  )
913
- ] }) : void 0, Ve = ge && oe && (E != null && E.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: E.map((S) => {
914
- const M = (ne == null ? void 0 : ne[S.field]) ?? 2;
915
- return /* @__PURE__ */ e("div", { style: { gridColumn: `span ${M}` }, children: /* @__PURE__ */ e(
916
- ke,
932
+ ] }) : void 0, Ze = ve && ue && (E != null && E.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: E.map((S) => {
933
+ const J = (le == null ? void 0 : le[S.field]) ?? 2;
934
+ return /* @__PURE__ */ e("div", { style: { gridColumn: `span ${J}` }, children: /* @__PURE__ */ e(
935
+ Be,
917
936
  {
918
937
  field: S,
919
938
  draft: i,
920
939
  onChange: u,
921
940
  relations: l,
922
- collection: s,
941
+ collection: a,
923
942
  itemId: n,
924
- error: a[S.field],
943
+ error: o[S.field],
925
944
  visible: !0,
926
945
  forceVisible: !0,
927
- locked: m.has(S.field),
946
+ locked: f.has(S.field),
928
947
  layoutAiEnabled: v,
929
948
  renderField: h,
930
- onCountChange: p
949
+ onCountChange: m
931
950
  }
932
951
  ) }, S.field);
933
- }) }) }) : void 0;
934
- return /* @__PURE__ */ g(
935
- "div",
952
+ }) }) }) : void 0, De = /* @__PURE__ */ e(
953
+ Be,
936
954
  {
937
- style: { gridColumn: `span ${$e(y.options, fe)}` },
938
- children: [
939
- /* @__PURE__ */ e(
940
- ke,
941
- {
942
- field: y,
943
- draft: i,
944
- onChange: u,
945
- relations: l,
946
- collection: s,
947
- itemId: n,
948
- error: a[y.field],
949
- visible: f.has(y.field) || !f.size,
950
- locked: m.has(y.field),
951
- layoutAiEnabled: v,
952
- renderField: h,
953
- onCountChange: p,
954
- swapButton: Ee,
955
- swapContent: Ve
956
- }
957
- ),
958
- (k == null ? void 0 : k.length) && be && xe && /* @__PURE__ */ e(
959
- pt,
960
- {
961
- relCollection: xe,
962
- relId: R,
963
- entries: k,
964
- separator: H
965
- }
966
- )
967
- ]
968
- },
969
- y.field
955
+ field: y,
956
+ draft: i,
957
+ onChange: u,
958
+ relations: l,
959
+ collection: a,
960
+ itemId: n,
961
+ error: o[y.field],
962
+ visible: p.has(y.field) || !p.size,
963
+ forceVisible: Ne(y) || void 0,
964
+ locked: f.has(y.field),
965
+ layoutAiEnabled: v,
966
+ renderField: h,
967
+ onCountChange: m,
968
+ swapButton: Ae,
969
+ swapContent: Ze
970
+ }
971
+ );
972
+ return W(
973
+ { kind: "field", field: y.field, group_key: t.key },
974
+ /* @__PURE__ */ N(
975
+ "div",
976
+ {
977
+ style: { gridColumn: `span ${Ue(y.options, xe)}` },
978
+ children: [
979
+ Ne(y) ? /* @__PURE__ */ e("div", { "data-design-hidden": "", className: "opacity-40", children: De }) : De,
980
+ (D == null ? void 0 : D.length) && _e && we && /* @__PURE__ */ e(
981
+ _t,
982
+ {
983
+ relCollection: we,
984
+ relId: z,
985
+ entries: D,
986
+ separator: X
987
+ }
988
+ )
989
+ ]
990
+ },
991
+ y.field
992
+ )
970
993
  );
971
994
  }) });
972
995
  })(),
973
- Q && /* @__PURE__ */ e("div", { className: "mt-4", children: Q })
996
+ A && /* @__PURE__ */ e("div", { className: "mt-4", children: A })
974
997
  ] })
975
998
  ]
976
999
  }
977
1000
  );
978
1001
  }
979
1002
  export {
980
- Bt as GroupSection,
981
- pt as InlineDisplay,
982
- Fe as OwnersInline,
983
- ut as OwnersInlineCompact,
984
- Y as RelationCell,
985
- Lt as StripFieldValue,
986
- Je as UserChip,
987
- qt as UserRosterCluster,
988
- ae as formatDisplayValue,
989
- ht as useChangePulse
1003
+ Kt as GroupSection,
1004
+ _t as InlineDisplay,
1005
+ Ie as OwnersInline,
1006
+ Nt as OwnersInlineCompact,
1007
+ Q as RelationCell,
1008
+ zt as StripFieldValue,
1009
+ Ge as UserChip,
1010
+ Wt as UserRosterCluster,
1011
+ de as formatDisplayValue,
1012
+ St as useChangePulse
990
1013
  };