@nivaro/react 0.3.65 → 0.3.66

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 (25) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +13 -4
  4. package/dist/shared/components/CollectionBrowserView.js +2509 -2668
  5. package/dist/shared/components/ItemEditForm.js +3910 -3771
  6. package/dist/shared/components/MyWorkView.js +124 -113
  7. package/dist/shared/components/ProfileView.js +483 -472
  8. package/dist/shared/components/ReportView.js +1100 -1094
  9. package/dist/shared/components/bulk/BulkCompareButton.js +62 -0
  10. package/dist/shared/components/bulk/MessageStakeholders.js +235 -0
  11. package/dist/shared/components/item-edit/CatalogPickerField.js +240 -238
  12. package/dist/shared/components/item-edit/GroupSection.js +555 -538
  13. package/dist/shared/components/item-edit/M2MCombobox.js +414 -349
  14. package/dist/shared/components/item-edit/MidairCollisionDialog.js +211 -187
  15. package/dist/shared/components/item-edit/RelationCombobox.js +327 -311
  16. package/dist/shared/components/item-edit/SummaryPanel.js +146 -144
  17. package/dist/shared/components/item-edit/UserChip.js +264 -229
  18. package/dist/shared/components/item-edit/cascade-clear-notice.js +23 -19
  19. package/dist/shared/components/item-edit/header-path-preview.js +52 -0
  20. package/dist/shared/components/item-edit/line-merge.js +73 -47
  21. package/dist/shared/components/item-edit/picker-search.js +25 -21
  22. package/dist/shared/components/queue/QueueWorklist.js +799 -772
  23. package/dist/shared/lib/obligation-reason-text.js +1 -1
  24. package/dist/shared/lib/quick-filter-cascade.js +29 -19
  25. package/package.json +1 -1
@@ -1,30 +1,30 @@
1
- import { jsx as e, jsxs as x, Fragment as vt } from "react/jsx-runtime";
2
- import { useQuery as ce, useQueryClient as kt } from "@tanstack/react-query";
3
- import * as St from "lucide-react";
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 Se, useEffect as ne, memo as Ot } from "react";
6
- import { fieldDrilldownConfig as qt, useDrilldown as Bt, useOptionalNivaroClient as de, useNavigation as Lt } from "../../context.js";
7
- import { get as st, post as Ut } from "../../lib/commands.js";
8
- import { planFieldGrid as Mt, isEmptyValue as Tt, isFolded as Gt, readGroupStructure as It } from "../../lib/form-structure.js";
9
- import { reportSectionUse as lt } from "../../lib/form-usage-beacon.js";
10
- import { useRecordReader as at } from "../../lib/record-loader.js";
11
- import { choiceLabel as Pt, titleCase as ot, cn as E, toLocalDateString as De } from "../../lib/utils.js";
12
- import { DesignDropZone as Vt, designWrap as Ct } from "../layout-editor/DesignNode.js";
13
- import { useLayoutDesign as Jt, revealGroupKey as Rt } from "../layout-editor/design-context.js";
14
- import { GridGuides as ve } from "../layout-editor/grid-guides.js";
15
- import { UserAvatar as zt } from "../UserAvatar.js";
16
- import { DropdownMenu as Ht, DropdownMenuTrigger as Kt, DropdownMenuContent as Et, DropdownMenuItem as Ae } from "../ui/dropdown-menu.js";
17
- import { WidgetSlot as Ye } from "../WidgetSlot.js";
18
- import { FieldRow as ke } from "./FieldRow.js";
19
- import { useFormHelpVideos as Wt, FormHelpVideoButton as At } from "./FormHelpVideoButton.js";
20
- import { FoldArea as Yt, RowGroupCell as Qt, rowMemberField as Zt } from "./form-structure-ui.js";
21
- import { applyDisplayTemplate as Xt, useContainerWidth as en, resolveColSpan as Qe } from "./helpers.js";
22
- import { SectionIntro as tn } from "./LayoutContentBlock.js";
23
- import { invalidateM2MFor as nn } from "./m2m-invalidate.js";
24
- import { groupSectionPropsEqual as rn } from "./render-stability.js";
25
- import { UserChip as ct, OwnersInline as Ze, OwnersInlineCompact as sn } from "./UserChip.js";
26
- import { UserRosterCluster as Vn } from "./UserChip.js";
27
- function Xe(n) {
1
+ import { jsx as e, jsxs as y, Fragment as St } from "react/jsx-runtime";
2
+ import { useQuery as de, useQueryClient as Dt } from "@tanstack/react-query";
3
+ import * as $t from "lucide-react";
4
+ import { ChevronDown as Ft, Loader2 as jt, User as Ot, Mail as qt } from "lucide-react";
5
+ import st, { useContext as Bt, useState as Y, useRef as De, useEffect as ne, memo as Ut } from "react";
6
+ import { RelationPathDataContext as It, useDrilldown as lt, fieldDrilldownConfig as Mt, useOptionalNivaroClient as ue, useNavigation as Tt } from "../../context.js";
7
+ import { get as at, post as Lt } from "../../lib/commands.js";
8
+ import { planFieldGrid as Pt, isEmptyValue as Ct, isFolded as Gt, readGroupStructure as Vt } from "../../lib/form-structure.js";
9
+ import { reportSectionUse as ot } from "../../lib/form-usage-beacon.js";
10
+ import { useRecordReader as ct } from "../../lib/record-loader.js";
11
+ import { formatDate as ce, choiceLabel as Jt, titleCase as dt, cn as E, toLocalDateString as $e } from "../../lib/utils.js";
12
+ import { DesignDropZone as Rt, designWrap as zt } from "../layout-editor/DesignNode.js";
13
+ import { useLayoutDesign as Ht, revealGroupKey as Kt } from "../layout-editor/design-context.js";
14
+ import { GridGuides as ke } from "../layout-editor/grid-guides.js";
15
+ import { UserAvatar as Et } from "../UserAvatar.js";
16
+ import { DropdownMenu as Wt, DropdownMenuTrigger as At, DropdownMenuContent as Yt, DropdownMenuItem as Ye } from "../ui/dropdown-menu.js";
17
+ import { WidgetSlot as Qe } from "../WidgetSlot.js";
18
+ import { FieldRow as Se } from "./FieldRow.js";
19
+ import { useFormHelpVideos as Qt, FormHelpVideoButton as Zt } from "./FormHelpVideoButton.js";
20
+ import { FoldArea as Xt, RowGroupCell as en, rowMemberField as tn } from "./form-structure-ui.js";
21
+ import { applyDisplayTemplate as nn, useContainerWidth as rn, resolveColSpan as Ze } from "./helpers.js";
22
+ import { SectionIntro as sn } from "./LayoutContentBlock.js";
23
+ import { invalidateM2MFor as ln } from "./m2m-invalidate.js";
24
+ import { groupSectionPropsEqual as an } from "./render-stability.js";
25
+ import { UserChip as ut, OwnersInline as Xe, OwnersInlineCompact as on } from "./UserChip.js";
26
+ import { UserRosterCluster as Rn } from "./UserChip.js";
27
+ function et(n) {
28
28
  if (typeof n != "string") return n ?? [];
29
29
  try {
30
30
  return JSON.parse(n);
@@ -32,94 +32,94 @@ function Xe(n) {
32
32
  return [];
33
33
  }
34
34
  }
35
- function ln({
35
+ function cn({
36
36
  relCollection: n,
37
37
  relId: t,
38
38
  entries: i,
39
39
  separator: a
40
40
  }) {
41
- const l = de(), o = at(), r = String(t), p = i.some((f) => f.field.includes(".")) ? ["id", ...i.map((f) => f.field)].join(",") : null, { data: m } = ce({
42
- queryKey: ["inline-display", n, r, p],
43
- queryFn: () => o(n, r, p),
44
- enabled: !!l && !!r,
41
+ const s = ue(), o = ct(), r = String(t), m = i.some((x) => x.field.includes(".")) ? ["id", ...i.map((x) => x.field)].join(",") : null, { data: d } = de({
42
+ queryKey: ["inline-display", n, r, m],
43
+ queryFn: () => o(n, r, m),
44
+ enabled: !!s && !!r,
45
45
  staleTime: 6e4
46
46
  });
47
- if (!m) return null;
48
- const k = (f) => {
49
- let b = m;
50
- for (const y of f.split(".")) {
51
- if (b == null || typeof b != "object") return;
52
- b = b[y];
47
+ if (!d) return null;
48
+ const F = (x) => {
49
+ let h = d;
50
+ for (const v of x.split(".")) {
51
+ if (h == null || typeof h != "object") return;
52
+ h = h[v];
53
53
  }
54
- return b;
54
+ return h;
55
55
  };
56
56
  if (a != null) {
57
- const f = (F) => {
58
- const S = k(F.field);
59
- if (S == null || S === "") return null;
60
- const D = F.format ?? "text";
61
- if (D === "date" || D === "datetime")
57
+ const x = (c) => {
58
+ const g = F(c.field);
59
+ if (g == null || g === "") return null;
60
+ const S = c.format ?? "text";
61
+ if (S === "date" || S === "datetime")
62
62
  try {
63
- return De(S);
63
+ return $e(g);
64
64
  } catch {
65
- return String(S);
65
+ return String(g);
66
66
  }
67
- return D === "boolean" ? S ? "Yes" : "No" : String(S);
68
- }, b = [];
69
- let y = [];
70
- for (const F of i)
71
- F.line_break && y.length > 0 ? (b.push(y), y = [F]) : y.push(F);
72
- y.length > 0 && b.push(y);
73
- const q = b.map(
74
- (F) => F.map((S) => {
75
- const D = f(S);
76
- return D ? { label: S.label ?? null, display: D } : null;
67
+ return S === "boolean" ? g ? "Yes" : "No" : String(g);
68
+ }, h = [];
69
+ let v = [];
70
+ for (const c of i)
71
+ c.line_break && v.length > 0 ? (h.push(v), v = [c]) : v.push(c);
72
+ v.length > 0 && h.push(v);
73
+ const O = h.map(
74
+ (c) => c.map((g) => {
75
+ const S = x(g);
76
+ return S ? { label: g.label ?? null, display: S } : null;
77
77
  }).filter(Boolean)
78
- ).filter((F) => F.length > 0);
79
- return q.length === 0 ? null : /* @__PURE__ */ e("div", { className: "mt-1", children: q.map((F, S) => (
78
+ ).filter((c) => c.length > 0);
79
+ return O.length === 0 ? null : /* @__PURE__ */ e("div", { className: "mt-1", children: O.map((c, g) => (
80
80
  // biome-ignore lint/suspicious/noArrayIndexKey: stable line order
81
- /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: F.map((D, M) => (
81
+ /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: c.map((S, $) => (
82
82
  // biome-ignore lint/suspicious/noArrayIndexKey: stable token order
83
- /* @__PURE__ */ x(it.Fragment, { children: [
84
- M > 0 && a,
85
- D.label && /* @__PURE__ */ x("span", { className: "font-semibold text-slate-600 dark:text-slate-300", children: [
86
- D.label,
83
+ /* @__PURE__ */ y(st.Fragment, { children: [
84
+ $ > 0 && a,
85
+ S.label && /* @__PURE__ */ y("span", { className: "font-semibold text-slate-600 dark:text-slate-300", children: [
86
+ S.label,
87
87
  ":"
88
88
  ] }),
89
- D.label ? " " : "",
90
- D.display
91
- ] }, M)
92
- )) }, S)
89
+ S.label ? " " : "",
90
+ S.display
91
+ ] }, $)
92
+ )) }, g)
93
93
  )) });
94
94
  }
95
- const c = i.map((f) => {
96
- const b = k(f.field);
97
- if (b == null || b === "") return null;
98
- const y = f.format ?? "text";
99
- let q;
100
- if (y === "date" || y === "datetime")
95
+ const D = i.map((x) => {
96
+ const h = F(x.field);
97
+ if (h == null || h === "") return null;
98
+ const v = x.format ?? "text";
99
+ let O;
100
+ if (v === "date" || v === "datetime")
101
101
  try {
102
- q = De(b);
102
+ O = $e(h);
103
103
  } catch {
104
- q = String(b);
104
+ O = String(h);
105
105
  }
106
- else y === "boolean" ? q = b ? "Yes" : "No" : q = String(b);
107
- return { label: f.label, display: q };
106
+ else v === "boolean" ? O = h ? "Yes" : "No" : O = String(h);
107
+ return { label: x.label, display: O };
108
108
  }).filter(Boolean);
109
- 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((f, b) => (
109
+ return D.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: D.map((x, h) => (
110
110
  // biome-ignore lint/suspicious/noArrayIndexKey: stable order from config
111
- /* @__PURE__ */ x("div", { className: "flex items-baseline gap-2", children: [
112
- f.label && /* @__PURE__ */ e("span", { className: "shrink-0 min-w-[56px] text-[10px] font-medium text-slate-400", children: f.label }),
113
- /* @__PURE__ */ e("span", { className: "text-[12px] text-slate-700 dark:text-slate-300 truncate", children: f.display })
114
- ] }, b)
111
+ /* @__PURE__ */ y("div", { className: "flex items-baseline gap-2", children: [
112
+ x.label && /* @__PURE__ */ e("span", { className: "shrink-0 min-w-[56px] text-[10px] font-medium text-slate-400", children: x.label }),
113
+ /* @__PURE__ */ e("span", { className: "text-[12px] text-slate-700 dark:text-slate-300 truncate", children: x.display })
114
+ ] }, h)
115
115
  )) });
116
116
  }
117
- function an(n) {
117
+ function dn(n) {
118
118
  if (!n) return null;
119
- const t = n.replace(/(^|-)([a-z])/g, (a, l, o) => o.toUpperCase()), i = St[t];
119
+ const t = n.replace(/(^|-)([a-z])/g, (a, s, o) => o.toUpperCase()), i = $t[t];
120
120
  return i || null;
121
121
  }
122
- function et(n) {
122
+ function tt(n) {
123
123
  if (!n.options) return {};
124
124
  if (typeof n.options == "object") return n.options;
125
125
  try {
@@ -128,7 +128,7 @@ function et(n) {
128
128
  return {};
129
129
  }
130
130
  }
131
- function $e(n, t) {
131
+ function Fe(n, t) {
132
132
  if (n == null || n === "") return "—";
133
133
  if (typeof n == "boolean") return n ? "Yes" : "No";
134
134
  const i = (t == null ? void 0 : t.interface) ?? "", a = (() => {
@@ -146,12 +146,12 @@ function $e(n, t) {
146
146
  if (a === "percent" && Number.isFinite(r)) return `${(r * 100).toFixed(1)}%`;
147
147
  if (/^0\.0+$/.test(a) && Number.isFinite(r)) return r.toFixed(a.length - 2);
148
148
  if (a === "date" && typeof n == "string") {
149
- const s = n.length === 10 ? /* @__PURE__ */ new Date(`${n}T00:00:00`) : new Date(n);
150
- if (!Number.isNaN(s.getTime())) return s.toLocaleDateString();
149
+ const l = n.length === 10 ? /* @__PURE__ */ new Date(`${n}T00:00:00`) : new Date(n);
150
+ if (!Number.isNaN(l.getTime())) return ce(n);
151
151
  }
152
152
  if (a === "datetime" && typeof n == "string") {
153
- const s = new Date(n);
154
- if (!Number.isNaN(s.getTime())) return s.toLocaleString();
153
+ const l = new Date(n);
154
+ if (!Number.isNaN(l.getTime())) return l.toLocaleString();
155
155
  }
156
156
  }
157
157
  if (i === "duration" && Number.isFinite(Number(n))) {
@@ -163,7 +163,7 @@ function $e(n, t) {
163
163
  if (i === "checklist" && typeof n == "string")
164
164
  try {
165
165
  const r = JSON.parse(n);
166
- if (Array.isArray(r)) return `${r.filter((s) => s == null ? void 0 : s.done).length}/${r.length} done`;
166
+ if (Array.isArray(r)) return `${r.filter((l) => l == null ? void 0 : l.done).length}/${r.length} done`;
167
167
  } catch {
168
168
  }
169
169
  if (i === "address" && typeof n == "string" && n.trim().startsWith("{"))
@@ -182,43 +182,43 @@ function $e(n, t) {
182
182
  return String(n);
183
183
  }
184
184
  }
185
- const l = String(n);
186
- if (i === "datetime" || i === "date" || /^\d{4}-\d{2}-\d{2}T/.test(l) || /^\d{4}-\d{2}-\d{2}$/.test(l))
185
+ const s = String(n);
186
+ if (i === "datetime" || i === "date" || /^\d{4}-\d{2}-\d{2}T/.test(s) || /^\d{4}-\d{2}-\d{2}$/.test(s))
187
187
  try {
188
- let r = /^\d{4}-\d{2}-\d{2}$/.test(l) || i === "date";
188
+ let r = /^\d{4}-\d{2}-\d{2}$/.test(s) || i === "date";
189
189
  if (!r && (t != null && t.options))
190
190
  try {
191
- const p = typeof t.options == "string" ? JSON.parse(t.options) : t.options;
192
- p && p.date_mode === "date" && (r = !0);
191
+ const m = typeof t.options == "string" ? JSON.parse(t.options) : t.options;
192
+ m && m.date_mode === "date" && (r = !0);
193
193
  } catch {
194
194
  }
195
- const s = l.match(/^(\d{4})-(\d{2})-(\d{2})(?:T00:00:00(?:\.000)?Z)?$/);
196
- return s ? new Date(Number(s[1]), Number(s[2]) - 1, Number(s[3])).toLocaleDateString() : r ? new Date(l).toLocaleDateString() : new Date(l).toLocaleString();
195
+ const l = s.match(/^(\d{4})-(\d{2})-(\d{2})(?:T00:00:00(?:\.000)?Z)?$/);
196
+ return l ? ce(`${l[1]}-${l[2]}-${l[3]}`) : r ? ce(s) : new Date(s).toLocaleString();
197
197
  } catch {
198
198
  }
199
199
  if ((i === "select-dropdown" || i === "radio-buttons") && t) {
200
- const s = et(t).choices;
201
- if (Array.isArray(s)) {
202
- const p = s.find((m) => String(m.value) === l);
203
- if (p) return Pt(p.text);
200
+ const l = tt(t).choices;
201
+ if (Array.isArray(l)) {
202
+ const m = l.find((d) => String(d.value) === s);
203
+ if (m) return Jt(m.text);
204
204
  }
205
205
  }
206
- const o = Number(l);
207
- if (!Number.isNaN(o) && l !== "" && t) {
208
- const r = et(t), s = r.format, p = typeof r.unit == "string" ? r.unit.trim() : "";
209
- if (p && !s) {
210
- const m = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(o);
211
- if (p === "$")
206
+ const o = Number(s);
207
+ if (!Number.isNaN(o) && s !== "" && t) {
208
+ const r = tt(t), l = r.format, m = typeof r.unit == "string" ? r.unit.trim() : "";
209
+ if (m && !l) {
210
+ const d = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(o);
211
+ if (m === "$")
212
212
  try {
213
213
  return new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(
214
214
  o
215
215
  );
216
216
  } catch {
217
- return `$${m}`;
217
+ return `$${d}`;
218
218
  }
219
- return p === "%" ? `${m}%` : `${m} ${p}`;
219
+ return m === "%" ? `${d}%` : `${d} ${m}`;
220
220
  }
221
- if (s === "currency")
221
+ if (l === "currency")
222
222
  try {
223
223
  return new Intl.NumberFormat(void 0, {
224
224
  style: "currency",
@@ -226,60 +226,60 @@ function $e(n, t) {
226
226
  }).format(o);
227
227
  } catch {
228
228
  }
229
- if (s === "int")
229
+ if (l === "int")
230
230
  return new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(o);
231
- if (s === "decimal") {
232
- const m = typeof r.precision == "number" ? r.precision : 2;
231
+ if (l === "decimal") {
232
+ const d = typeof r.precision == "number" ? r.precision : 2;
233
233
  return new Intl.NumberFormat(void 0, {
234
- minimumFractionDigits: m,
235
- maximumFractionDigits: m
234
+ minimumFractionDigits: d,
235
+ maximumFractionDigits: d
236
236
  }).format(o);
237
237
  }
238
238
  }
239
- 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)) ? ot(l) : l;
239
+ return !s.includes(" ") && !s.includes("@") && !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(s) && !/^\d+$/.test(s) && (s.includes("_") || s.includes("-") || /^[a-z]/.test(s)) ? dt(s) : s;
240
240
  }
241
- function tt({ userId: n }) {
242
- const t = de(), { navigate: i, userUrl: a } = Lt(), l = a ? a(n) : `/users/${n}`, { data: o } = ce({
241
+ function nt({ userId: n }) {
242
+ const t = ue(), { navigate: i, userUrl: a } = Tt(), s = a ? a(n) : `/users/${n}`, { data: o } = de({
243
243
  queryKey: ["user-chip", n],
244
244
  queryFn: () => t.request(
245
- st(`/users/${n}`)
246
- ).then((p) => p.data ?? null),
245
+ at(`/users/${n}`)
246
+ ).then((m) => m.data ?? null),
247
247
  enabled: !!t && !!n,
248
248
  staleTime: 12e4
249
- }), r = o ? [o.first_name, o.last_name].filter(Boolean).join(" ") || o.email : n, s = r.split(" ").map((p) => p[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
250
- return /* @__PURE__ */ x(Ht, { children: [
251
- /* @__PURE__ */ e(Kt, { asChild: !0, children: /* @__PURE__ */ x("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: [
249
+ }), r = o ? [o.first_name, o.last_name].filter(Boolean).join(" ") || o.email : n, l = r.split(" ").map((m) => m[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
250
+ return /* @__PURE__ */ y(Wt, { children: [
251
+ /* @__PURE__ */ e(At, { asChild: !0, children: /* @__PURE__ */ y("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: [
252
252
  /* @__PURE__ */ e(
253
- zt,
253
+ Et,
254
254
  {
255
255
  userId: n,
256
256
  className: "h-4 w-4",
257
- 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: s })
257
+ 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: l })
258
258
  }
259
259
  ),
260
260
  /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-600", children: r })
261
261
  ] }) }),
262
- /* @__PURE__ */ x(Et, { align: "start", className: "text-[12px]", children: [
263
- l && /* @__PURE__ */ x(
264
- Ae,
262
+ /* @__PURE__ */ y(Yt, { align: "start", className: "text-[12px]", children: [
263
+ s && /* @__PURE__ */ y(
264
+ Ye,
265
265
  {
266
266
  className: "gap-2 text-[12px] cursor-pointer",
267
- onSelect: () => i(l),
267
+ onSelect: () => i(s),
268
268
  children: [
269
- /* @__PURE__ */ e(Ft, { className: "h-3.5 w-3.5" }),
269
+ /* @__PURE__ */ e(Ot, { className: "h-3.5 w-3.5" }),
270
270
  " View profile"
271
271
  ]
272
272
  }
273
273
  ),
274
- (o == null ? void 0 : o.email) && /* @__PURE__ */ x(
275
- Ae,
274
+ (o == null ? void 0 : o.email) && /* @__PURE__ */ y(
275
+ Ye,
276
276
  {
277
277
  className: "gap-2 text-[12px] cursor-pointer",
278
278
  onSelect: () => {
279
279
  window.location.href = `mailto:${o.email}`;
280
280
  },
281
281
  children: [
282
- /* @__PURE__ */ e(jt, { className: "h-3.5 w-3.5" }),
282
+ /* @__PURE__ */ e(qt, { className: "h-3.5 w-3.5" }),
283
283
  " Send email"
284
284
  ]
285
285
  }
@@ -287,42 +287,42 @@ function tt({ userId: n }) {
287
287
  ] })
288
288
  ] });
289
289
  }
290
- function on({
290
+ function un({
291
291
  collection: n,
292
292
  itemId: t,
293
293
  layoutId: i,
294
294
  attachField: a,
295
- filenameTemplate: l,
295
+ filenameTemplate: s,
296
296
  label: o
297
297
  }) {
298
- const r = de(), s = kt(), [p, m] = Y(!1), k = async () => {
299
- if (!(!r || p || !a)) {
300
- m(!0);
298
+ const r = ue(), l = Dt(), [m, d] = Y(!1), F = async () => {
299
+ if (!(!r || m || !a)) {
300
+ d(!0);
301
301
  try {
302
302
  await r.request(
303
- Ut(`/collection-layouts/${i}/generate-and-attach`, {
303
+ Lt(`/collection-layouts/${i}/generate-and-attach`, {
304
304
  collection: n,
305
305
  item_id: t,
306
306
  attach_field: a,
307
- filename_template: l ?? void 0
307
+ filename_template: s ?? void 0
308
308
  })
309
- ), nn(s, [t]), s.invalidateQueries({ queryKey: ["items", n, t] });
309
+ ), ln(l, [t]), l.invalidateQueries({ queryKey: ["items", n, t] });
310
310
  } catch {
311
311
  } finally {
312
- m(!1);
312
+ d(!1);
313
313
  }
314
314
  }
315
- }, c = !a;
316
- return /* @__PURE__ */ x(
315
+ }, D = !a;
316
+ return /* @__PURE__ */ y(
317
317
  "button",
318
318
  {
319
319
  type: "button",
320
- onClick: k,
321
- disabled: p || c,
322
- title: c ? "Configure PDF field in Data Model → Layouts" : void 0,
320
+ onClick: F,
321
+ disabled: m || D,
322
+ title: D ? "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",
324
324
  children: [
325
- /* @__PURE__ */ x(
325
+ /* @__PURE__ */ y(
326
326
  "svg",
327
327
  {
328
328
  xmlns: "http://www.w3.org/2000/svg",
@@ -339,7 +339,7 @@ function on({
339
339
  ]
340
340
  }
341
341
  ),
342
- p ? "Generating…" : o
342
+ m ? "Generating…" : o
343
343
  ]
344
344
  }
345
345
  );
@@ -349,38 +349,38 @@ function re({
349
349
  id: t,
350
350
  className: i
351
351
  }) {
352
- var b;
353
- const a = de(), l = at(), o = t != null && t !== "" ? String(t) : null, { data: r } = ce({
352
+ var h;
353
+ const a = ue(), s = ct(), o = t != null && t !== "" ? String(t) : null, { data: r } = de({
354
354
  queryKey: ["col-meta-dt", n],
355
355
  queryFn: () => a.request(
356
- st(`/collections/${n}`)
357
- ).then((y) => y.data).catch(() => ({})),
356
+ at(`/collections/${n}`)
357
+ ).then((v) => v.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: k } = ce({
361
- queryKey: ["rel-display", n, o, p],
362
- queryFn: () => l(n, o, p),
360
+ }), l = (((h = r == null ? void 0 : r.display_template) == null ? void 0 : h.match(/\{\{\s*[^}]+?\s*\}\}/g)) ?? []).map((v) => v.replace(/[{}\s]/g, "")).filter((v) => v.includes(".")), m = l.length ? ["id", ...l].join(",") : null, { data: d, isLoading: F } = de({
361
+ queryKey: ["rel-display", n, o, m],
362
+ queryFn: () => s(n, o, m),
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 (k || a && r === void 0)
367
+ if (F || 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
- const c = i ?? "text-[13px] text-slate-700";
370
- if (!m) return /* @__PURE__ */ e("span", { className: c, children: o });
371
- const f = r != null && r.display_template ? Xt(r.display_template, m) : String(m.name ?? m.title ?? m.label ?? m.display_name ?? o);
372
- return /* @__PURE__ */ e("span", { className: c, children: f });
369
+ const D = i ?? "text-[13px] text-slate-700";
370
+ if (!d) return /* @__PURE__ */ e("span", { className: D, children: o });
371
+ const x = r != null && r.display_template ? nn(r.display_template, d) : String(d.name ?? d.title ?? d.label ?? d.display_name ?? o);
372
+ return /* @__PURE__ */ e("span", { className: D, children: x });
373
373
  }
374
- function nt({ userId: n }) {
375
- return /* @__PURE__ */ e(ct, { userId: n, size: "compact" });
374
+ function rt({ userId: n }) {
375
+ return /* @__PURE__ */ e(ut, { userId: n, size: "compact" });
376
376
  }
377
- function rt({
377
+ function it({
378
378
  relCollection: n,
379
379
  id: t,
380
380
  drillConfig: i
381
381
  }) {
382
- const a = Bt(), l = /* @__PURE__ */ e(re, { relCollection: n, id: t });
383
- return !a || t == null || t === "" ? l : /* @__PURE__ */ e(
382
+ const a = lt(), s = /* @__PURE__ */ e(re, { relCollection: n, id: t });
383
+ return !a || t == null || t === "" ? s : /* @__PURE__ */ e(
384
384
  "button",
385
385
  {
386
386
  type: "button",
@@ -406,224 +406,241 @@ function rt({
406
406
  }
407
407
  );
408
408
  }
409
- function cn(n) {
410
- const [t, i] = Y(!1), a = Se(!0), l = Se(JSON.stringify(n ?? null));
409
+ function pn(n) {
410
+ const [t, i] = Y(!1), a = De(!0), s = De(JSON.stringify(n ?? null));
411
411
  return ne(() => {
412
412
  const o = JSON.stringify(n ?? null);
413
413
  if (a.current) {
414
- a.current = !1, l.current = o;
414
+ a.current = !1, s.current = o;
415
415
  return;
416
416
  }
417
- if (o === l.current) return;
418
- l.current = o, i(!1);
419
- const r = window.setTimeout(() => i(!0), 0), s = window.setTimeout(() => i(!1), 1200);
417
+ if (o === s.current) return;
418
+ s.current = o, i(!1);
419
+ const r = window.setTimeout(() => i(!0), 0), l = window.setTimeout(() => i(!1), 1200);
420
420
  return () => {
421
- window.clearTimeout(r), window.clearTimeout(s);
421
+ window.clearTimeout(r), window.clearTimeout(l);
422
422
  };
423
423
  }, [n]), t ? "nvr-value-pulse" : "";
424
424
  }
425
- function Tn({
425
+ function Cn({
426
426
  field: n,
427
427
  val: t,
428
428
  relations: i,
429
429
  collection: a,
430
- displayFormat: l,
430
+ displayFormat: s,
431
431
  textClassName: o
432
432
  }) {
433
- const r = cn(t), s = E(o ?? "text-[13px] text-slate-900 dark:text-slate-100", r), p = qt(n) ?? { enabled: !0, layout_id: null, width: null }, m = i.find(
433
+ var O;
434
+ const r = pn(t), l = (O = Bt(It)) == null ? void 0 : O[n.field], m = lt(), d = E(o ?? "text-[13px] text-slate-900 dark:text-slate-100", r), F = Mt(n) ?? { enabled: !0, layout_id: null, width: null }, D = i.find(
434
435
  (c) => c.one_collection === a && c.one_field === n.field && c.junction_field
435
436
  );
436
- if (m) {
437
+ if (D) {
437
438
  const c = i.find(
438
- (y) => y.many_collection === m.many_collection && y.many_field === m.junction_field
439
- ), f = c == null ? void 0 : c.one_collection, b = Array.isArray(t) ? t : t != null && t !== "" ? [t] : [];
440
- return !f || b.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : f === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: b.map((y) => /* @__PURE__ */ e(nt, { userId: String(y) }, String(y))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: b.map((y) => /* @__PURE__ */ e(
441
- rt,
439
+ ($) => $.many_collection === D.many_collection && $.many_field === D.junction_field
440
+ ), g = c == null ? void 0 : c.one_collection, S = Array.isArray(t) ? t : t != null && t !== "" ? [t] : [];
441
+ return !g || S.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : g === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: S.map(($) => /* @__PURE__ */ e(rt, { userId: String($) }, String($))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: S.map(($) => /* @__PURE__ */ e(
442
+ it,
442
443
  {
443
- relCollection: f,
444
- id: y,
445
- drillConfig: p
444
+ relCollection: g,
445
+ id: $,
446
+ drillConfig: F
446
447
  },
447
- String(y)
448
+ String($)
448
449
  )) });
449
450
  }
450
- const k = i.find(
451
+ const x = i.find(
451
452
  (c) => c.many_collection === a && c.many_field === n.field && !c.junction_field
452
453
  );
453
- if (k != null && k.one_collection) {
454
+ if (x != null && x.one_collection) {
454
455
  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: "—" }) : 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
- rt,
456
+ return c.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : x.one_collection === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: c.map((g) => /* @__PURE__ */ e(rt, { userId: String(g) }, String(g))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: c.map((g) => /* @__PURE__ */ e(
457
+ it,
457
458
  {
458
- relCollection: k.one_collection,
459
- id: f,
460
- drillConfig: p
459
+ relCollection: x.one_collection,
460
+ id: g,
461
+ drillConfig: F
461
462
  },
462
- String(f)
463
+ String(g)
463
464
  )) });
464
465
  }
465
466
  if (t == null || t === "")
466
467
  return /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" });
467
- if (l && l !== "text") {
468
+ if (s && s !== "text") {
468
469
  const c = Number(t);
469
- if (l === "currency" && !isNaN(c))
470
- return /* @__PURE__ */ e("span", { className: `font-semibold ${s}`, children: new Intl.NumberFormat(void 0, {
470
+ if (s === "currency" && !isNaN(c))
471
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${d}`, children: new Intl.NumberFormat(void 0, {
471
472
  style: "currency",
472
473
  currency: "USD",
473
474
  minimumFractionDigits: 2
474
475
  }).format(c) });
475
- if (l === "integer" && !isNaN(c))
476
- return /* @__PURE__ */ e("span", { className: `font-semibold ${s}`, children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(Math.round(c)) });
477
- if (l === "decimal" && !isNaN(c))
478
- return /* @__PURE__ */ e("span", { className: `font-semibold ${s}`, children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(c) });
479
- if (l === "percent" && !isNaN(c))
480
- return /* @__PURE__ */ e("span", { className: `font-semibold ${s}`, children: new Intl.NumberFormat(void 0, { style: "percent", maximumFractionDigits: 1 }).format(
476
+ if (s === "integer" && !isNaN(c))
477
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${d}`, children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(Math.round(c)) });
478
+ if (s === "decimal" && !isNaN(c))
479
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${d}`, children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(c) });
480
+ if (s === "percent" && !isNaN(c))
481
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${d}`, children: new Intl.NumberFormat(void 0, { style: "percent", maximumFractionDigits: 1 }).format(
481
482
  c / 100
482
483
  ) });
483
- if (l === "date")
484
+ if (s === "date")
484
485
  try {
485
- return /* @__PURE__ */ e("span", { className: `font-semibold ${s}`, children: De(t) });
486
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${d}`, children: ce(t) || $e(t) });
486
487
  } catch {
487
488
  }
488
- if (l === "datetime")
489
+ if (s === "datetime")
489
490
  try {
490
- return /* @__PURE__ */ e("span", { className: `font-semibold ${s}`, children: new Date(String(t)).toLocaleString() });
491
+ return /* @__PURE__ */ e("span", { className: `font-semibold ${d}`, children: new Date(String(t)).toLocaleString() });
491
492
  } catch {
492
493
  }
493
494
  }
494
- return /* @__PURE__ */ e("span", { className: `font-semibold ${s}`, children: $e(t, n) });
495
+ const h = /* @__PURE__ */ e("span", { className: `font-semibold ${d}`, children: Fe(t, n) }), v = l == null ? void 0 : l.target_collection;
496
+ if (m && v && (l == null ? void 0 : l.ids.length) === 1) {
497
+ const c = l.ids[0];
498
+ return /* @__PURE__ */ e(
499
+ "button",
500
+ {
501
+ type: "button",
502
+ "data-header-path-link": "",
503
+ onClick: (g) => {
504
+ g.stopPropagation(), m.open({ collection: v, itemId: String(c), layoutId: null, width: "85%" });
505
+ },
506
+ className: "cursor-pointer text-left underline decoration-slate-300 underline-offset-[3px] hover:text-[#0284c7] hover:decoration-[#0284c7] dark:decoration-slate-600 dark:hover:text-sky-400",
507
+ children: h
508
+ }
509
+ );
510
+ }
511
+ return h;
495
512
  }
496
- function dn({
513
+ function mn({
497
514
  summaryFields: n,
498
515
  fields: t,
499
516
  draft: i,
500
517
  relations: a,
501
- collection: l,
518
+ collection: s,
502
519
  itemId: o,
503
520
  ownersCollection: r,
504
- ownersItemId: s,
505
- ownersAssignment: p,
506
- m2mCounts: m,
507
- o2mCounts: k,
508
- o2mAggValues: c,
509
- summaryAggConfigs: f,
510
- o2mLoading: b,
511
- hideEmpty: y
521
+ ownersItemId: l,
522
+ ownersAssignment: m,
523
+ m2mCounts: d,
524
+ o2mCounts: F,
525
+ o2mAggValues: D,
526
+ summaryAggConfigs: x,
527
+ o2mLoading: h,
528
+ hideEmpty: v
512
529
  }) {
513
- const q = n.map((N) => typeof N == "string" ? N : N.field), F = y ? q.filter((N) => {
514
- if (N === "__owners__" || b != null && b.has(N) || c && N in c) return !0;
515
- if (m && N in m) return (m[N] ?? 0) > 0;
516
- if (k && N in k) return (k[N] ?? 0) > 0;
517
- const T = i[N];
530
+ const O = n.map((_) => typeof _ == "string" ? _ : _.field), c = v ? O.filter((_) => {
531
+ if (_ === "__owners__" || h != null && h.has(_) || D && _ in D) return !0;
532
+ if (d && _ in d) return (d[_] ?? 0) > 0;
533
+ if (F && _ in F) return (F[_] ?? 0) > 0;
534
+ const T = i[_];
518
535
  return T != null && T !== "" && !(Array.isArray(T) && T.length === 0);
519
- }) : q;
520
- if (F.length === 0) return null;
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
- if (N === "__owners__") {
523
- const d = (p == null ? void 0 : p.label_override) || "Owners";
524
- return /* @__PURE__ */ x("div", { className: "flex items-center gap-1.5", children: [
525
- /* @__PURE__ */ e("span", { className: S, children: d }),
536
+ }) : O;
537
+ if (c.length === 0) return null;
538
+ const g = "text-[9px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500 shrink-0", S = "text-[12px] font-semibold text-slate-700 dark:text-slate-300", $ = "text-[12px] text-slate-300 dark:text-slate-600", R = "flex items-baseline gap-1.5", pe = (_) => {
539
+ if (_ === "__owners__") {
540
+ const u = (m == null ? void 0 : m.label_override) || "Owners";
541
+ return /* @__PURE__ */ y("div", { className: "flex items-center gap-1.5", children: [
542
+ /* @__PURE__ */ e("span", { className: g, children: u }),
526
543
  /* @__PURE__ */ e(
527
- sn,
544
+ on,
528
545
  {
529
- collection: r ?? l,
530
- itemId: s ?? o
546
+ collection: r ?? s,
547
+ itemId: l ?? o
531
548
  }
532
549
  )
533
550
  ] });
534
551
  }
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
- if (b != null && b.has(N))
537
- return /* @__PURE__ */ x("div", { className: "flex items-center gap-1.5", children: [
538
- /* @__PURE__ */ e("span", { className: S, children: P }),
539
- /* @__PURE__ */ e($t, { className: "h-3 w-3 animate-spin text-slate-300" })
552
+ const T = n.find((u) => (typeof u == "string" ? u : u.field) === _), me = T && typeof T != "string" ? T.label : void 0, H = t.find((u) => u.field === _), C = me || (H == null ? void 0 : H.label) || _.replace(/_/g, " ").replace(/\b\w/g, (u) => u.toUpperCase());
553
+ if (h != null && h.has(_))
554
+ return /* @__PURE__ */ y("div", { className: "flex items-center gap-1.5", children: [
555
+ /* @__PURE__ */ e("span", { className: g, children: C }),
556
+ /* @__PURE__ */ e(jt, { className: "h-3 w-3 animate-spin text-slate-300" })
540
557
  ] });
541
- if (c && N in c) {
542
- const d = f == null ? void 0 : f[N], L = (d == null ? void 0 : d.label) || P, O = c[N];
543
- let U;
544
- if ((d == null ? void 0 : d.agg) === "count")
545
- U = String(O);
558
+ if (D && _ in D) {
559
+ const u = x == null ? void 0 : x[_], I = (u == null ? void 0 : u.label) || C, B = D[_];
560
+ let M;
561
+ if ((u == null ? void 0 : u.agg) === "count")
562
+ M = String(B);
546
563
  else {
547
- const W = d != null && d.field_options ? (() => {
564
+ const W = u != null && u.field_options ? (() => {
548
565
  try {
549
- return JSON.parse(d.field_options);
566
+ return JSON.parse(u.field_options);
550
567
  } catch {
551
568
  return {};
552
569
  }
553
570
  })() : {}, A = W.format;
554
571
  if (A === "currency")
555
572
  try {
556
- U = new Intl.NumberFormat(void 0, {
573
+ M = new Intl.NumberFormat(void 0, {
557
574
  style: "currency",
558
575
  currency: W.currency || "USD"
559
- }).format(O);
576
+ }).format(B);
560
577
  } catch {
561
- U = O.toLocaleString(void 0, { maximumFractionDigits: 2 });
578
+ M = B.toLocaleString(void 0, { maximumFractionDigits: 2 });
562
579
  }
563
580
  else if (A === "int")
564
- U = new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(O);
581
+ M = new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(B);
565
582
  else if (A === "decimal") {
566
583
  const Q = typeof W.precision == "number" ? W.precision : 2;
567
- U = new Intl.NumberFormat(void 0, {
584
+ M = new Intl.NumberFormat(void 0, {
568
585
  minimumFractionDigits: Q,
569
586
  maximumFractionDigits: Q
570
- }).format(O);
587
+ }).format(B);
571
588
  } else
572
- U = O.toLocaleString(void 0, { maximumFractionDigits: 2 });
589
+ M = B.toLocaleString(void 0, { maximumFractionDigits: 2 });
573
590
  }
574
- return /* @__PURE__ */ x("div", { className: R, children: [
575
- /* @__PURE__ */ e("span", { className: S, children: L }),
576
- /* @__PURE__ */ e("span", { className: D, children: U })
591
+ return /* @__PURE__ */ y("div", { className: R, children: [
592
+ /* @__PURE__ */ e("span", { className: g, children: I }),
593
+ /* @__PURE__ */ e("span", { className: S, children: M })
577
594
  ] });
578
595
  }
579
- if (m && N in m) {
580
- const d = m[N];
581
- return /* @__PURE__ */ x("div", { className: R, children: [
582
- /* @__PURE__ */ e("span", { className: S, children: P }),
583
- /* @__PURE__ */ x("span", { className: D, children: [
584
- d,
596
+ if (d && _ in d) {
597
+ const u = d[_];
598
+ return /* @__PURE__ */ y("div", { className: R, children: [
599
+ /* @__PURE__ */ e("span", { className: g, children: C }),
600
+ /* @__PURE__ */ y("span", { className: S, children: [
601
+ u,
585
602
  " item",
586
- d !== 1 ? "s" : ""
603
+ u !== 1 ? "s" : ""
587
604
  ] })
588
605
  ] });
589
606
  }
590
- if (k && N in k) {
591
- const d = k[N];
592
- return /* @__PURE__ */ x("div", { className: R, children: [
593
- /* @__PURE__ */ e("span", { className: S, children: P }),
594
- /* @__PURE__ */ x("span", { className: D, children: [
595
- d,
607
+ if (F && _ in F) {
608
+ const u = F[_];
609
+ return /* @__PURE__ */ y("div", { className: R, children: [
610
+ /* @__PURE__ */ e("span", { className: g, children: C }),
611
+ /* @__PURE__ */ y("span", { className: S, children: [
612
+ u,
596
613
  " row",
597
- d !== 1 ? "s" : ""
614
+ u !== 1 ? "s" : ""
598
615
  ] })
599
616
  ] });
600
617
  }
601
- const j = i[N], G = a.find(
602
- (d) => d.many_collection === l && d.many_field === N && !d.junction_field
618
+ const q = i[_], L = a.find(
619
+ (u) => u.many_collection === s && u.many_field === _ && !u.junction_field
603
620
  );
604
- if (G != null && G.one_collection) {
605
- const d = Array.isArray(j) ? j : j != null && j !== "" ? [j] : [];
606
- return /* @__PURE__ */ x("div", { className: R, children: [
607
- /* @__PURE__ */ e("span", { className: S, children: P }),
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))) })
621
+ if (L != null && L.one_collection) {
622
+ const u = Array.isArray(q) ? q : q != null && q !== "" ? [q] : [];
623
+ return /* @__PURE__ */ y("div", { className: R, children: [
624
+ /* @__PURE__ */ e("span", { className: g, children: C }),
625
+ u.length === 0 ? /* @__PURE__ */ e("span", { className: $, children: "—" }) : L.one_collection === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5 gap-y-0.5", children: u.map((I) => /* @__PURE__ */ e(nt, { userId: String(I) }, String(I))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: u.map((I) => /* @__PURE__ */ e(re, { relCollection: L.one_collection, id: I }, String(I))) })
609
626
  ] });
610
627
  }
611
- if (Array.isArray(j)) {
612
- const d = a.find((O) => O.many_field === N && O.junction_field), L = d == null ? void 0 : d.one_collection;
613
- return /* @__PURE__ */ x("div", { className: R, children: [
614
- /* @__PURE__ */ e("span", { className: S, children: P }),
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
- (O) => L === "nivaro_users" ? /* @__PURE__ */ e(tt, { userId: String(O) }, String(O)) : /* @__PURE__ */ e(re, { relCollection: L, id: O }, String(O))
617
- ) }) : /* @__PURE__ */ x("span", { className: D, children: [
618
- j.length,
628
+ if (Array.isArray(q)) {
629
+ const u = a.find((B) => B.many_field === _ && B.junction_field), I = u == null ? void 0 : u.one_collection;
630
+ return /* @__PURE__ */ y("div", { className: R, children: [
631
+ /* @__PURE__ */ e("span", { className: g, children: C }),
632
+ q.length === 0 ? /* @__PURE__ */ e("span", { className: $, children: "—" }) : I ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5 gap-y-0.5", children: q.map(
633
+ (B) => I === "nivaro_users" ? /* @__PURE__ */ e(nt, { userId: String(B) }, String(B)) : /* @__PURE__ */ e(re, { relCollection: I, id: B }, String(B))
634
+ ) }) : /* @__PURE__ */ y("span", { className: S, children: [
635
+ q.length,
619
636
  " item",
620
- j.length !== 1 ? "s" : ""
637
+ q.length !== 1 ? "s" : ""
621
638
  ] })
622
639
  ] });
623
640
  }
624
- return /* @__PURE__ */ x("div", { className: R, children: [
625
- /* @__PURE__ */ e("span", { className: S, children: P }),
626
- j == null || j === "" ? /* @__PURE__ */ e("span", { className: M, children: "—" }) : /* @__PURE__ */ e("span", { className: D, children: $e(j, H) })
641
+ return /* @__PURE__ */ y("div", { className: R, children: [
642
+ /* @__PURE__ */ e("span", { className: g, children: C }),
643
+ q == null || q === "" ? /* @__PURE__ */ e("span", { className: $, children: "—" }) : /* @__PURE__ */ e("span", { className: S, children: Fe(q, H) })
627
644
  ] });
628
645
  };
629
646
  return /* @__PURE__ */ e(
@@ -631,81 +648,81 @@ function dn({
631
648
  {
632
649
  "data-summary-strip": "",
633
650
  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))
651
+ children: c.map((_) => /* @__PURE__ */ e(st.Fragment, { children: pe(_) }, _))
635
652
  }
636
653
  );
637
654
  }
638
- const Gn = Ot(function({
655
+ const Gn = Ut(function({
639
656
  group: t,
640
657
  fields: i,
641
658
  draft: a,
642
- onChange: l,
659
+ onChange: s,
643
660
  relations: o,
644
661
  collection: r,
645
- itemId: s,
646
- errors: p,
647
- visibleFields: m,
648
- lockedFields: k,
649
- layoutAiEnabled: c,
650
- displayOnly: f,
651
- renderField: b,
652
- onCountChange: y,
653
- isNew: q,
654
- fieldValues: F,
655
- isOpen: S,
656
- onToggle: D,
657
- summaryFields: M,
662
+ itemId: l,
663
+ errors: m,
664
+ visibleFields: d,
665
+ lockedFields: F,
666
+ layoutAiEnabled: D,
667
+ displayOnly: x,
668
+ renderField: h,
669
+ onCountChange: v,
670
+ isNew: O,
671
+ fieldValues: c,
672
+ isOpen: g,
673
+ onToggle: S,
674
+ summaryFields: $,
658
675
  m2mCounts: R,
659
- o2mCounts: ue,
660
- o2mAggValues: N,
676
+ o2mCounts: pe,
677
+ o2mAggValues: _,
661
678
  summaryAggConfigs: T,
662
679
  o2mLoading: me,
663
680
  footerSlot: H,
664
- ownersCollection: P,
665
- ownersItemId: j,
666
- ownersAssignment: G,
667
- pdfAssignment: d,
668
- pdfAttachField: L,
669
- pdfFilenameTemplate: O,
670
- layoutId: U,
681
+ ownersCollection: C,
682
+ ownersItemId: q,
683
+ ownersAssignment: L,
684
+ pdfAssignment: u,
685
+ pdfAttachField: I,
686
+ pdfFilenameTemplate: B,
687
+ layoutId: M,
671
688
  hideEmptySummary: W,
672
689
  widgetAssignments: A,
673
690
  widgetApiBase: Q,
674
- fieldInlineDisplay: pe,
675
- swapConfig: V,
676
- swapped: Fe,
677
- onSwapToggle: je,
691
+ fieldInlineDisplay: fe,
692
+ swapConfig: G,
693
+ swapped: je,
694
+ onSwapToggle: Oe,
678
695
  alternateFields: Z,
679
- alternateWidths: fe,
696
+ alternateWidths: he,
680
697
  deferred: ie,
681
698
  onFirstOpen: se
682
699
  }) {
683
- var Pe;
684
- const [dt, ut] = Y(t.is_collapsed ?? !1), [mt, pt] = Y(!1), $ = Jt(), K = (h, _) => Ct($, h, _, { asChild: !0 }), le = (h) => ({ kind: "slot", field: h, group_key: t.key }), Oe = !!($ != null && $.showHidden), [qe, Be] = Y({}), { data: he } = Wt(r), X = ($ == null ? void 0 : $.fold) ?? null, ee = ($ == null ? void 0 : $.reveal) ?? null, [Le, be] = Y(null);
700
+ var Ge;
701
+ const [pt, mt] = Y(t.is_collapsed ?? !1), [ft, ht] = Y(!1), j = Ht(), K = (f, N) => zt(j, f, N, { asChild: !0 }), le = (f) => ({ kind: "slot", field: f, group_key: t.key }), qe = !!(j != null && j.showHidden), [Be, Ue] = Y({}), { data: be } = Qt(r), X = (j == null ? void 0 : j.fold) ?? null, ee = (j == null ? void 0 : j.reveal) ?? null, [Ie, ge] = Y(null);
685
702
  ne(() => {
686
- X && be(!X.open);
703
+ X && ge(!X.open);
687
704
  }, [X == null ? void 0 : X.seq]), ne(() => {
688
- ee && Rt(ee.target) === t.key && be(!1);
705
+ ee && Kt(ee.target) === t.key && ge(!1);
689
706
  }, [ee == null ? void 0 : ee.seq]);
690
- const Ue = D !== void 0, z = Le ?? (Ue ? !S : dt);
707
+ const Me = S !== void 0, z = Ie ?? (Me ? !g : pt);
691
708
  ne(() => {
692
709
  ie && !z && (se == null || se(t.key));
693
710
  }, [ie, z, se, t.key]);
694
- const ge = Le !== null ? () => be((h) => !h) : Ue ? D : () => ut((h) => !h), Me = !$ && U != null, xe = () => {
695
- Me && lt({ layoutId: Number(U), collection: r, kind: "opened", key: t.key });
696
- }, ft = () => {
697
- z && xe(), ge == null || ge();
698
- }, ht = !f && i.some((h) => p[h.field]), Te = $ ? "always" : t.visibility_mode ?? "always";
699
- if (Te === "new_only" && !q || Te === "existing_only" && q) return null;
700
- const te = A ?? [], bt = !q && te.some((h) => h.widget_id != null && qe[h.field] === void 0);
711
+ const xe = Ie !== null ? () => ge((f) => !f) : Me ? S : () => mt((f) => !f), Te = !j && M != null, ye = () => {
712
+ Te && ot({ layoutId: Number(M), collection: r, kind: "opened", key: t.key });
713
+ }, bt = () => {
714
+ z && ye(), xe == null || xe();
715
+ }, gt = !x && i.some((f) => m[f.field]), Le = j ? "always" : t.visibility_mode ?? "always";
716
+ if (Le === "new_only" && !O || Le === "existing_only" && O) return null;
717
+ const te = A ?? [], xt = !O && te.some((f) => f.widget_id != null && Be[f.field] === void 0);
701
718
  let ae = !1;
702
- if (t.hide_when_empty && F && !$ && (ae = F.every(
703
- (_) => _ == null || _ === "" || Array.isArray(_) && _.length === 0
704
- ) && !bt && te.every((_) => !qe[_.field])), ae && te.length === 0) return null;
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: [
706
- h,
719
+ if (t.hide_when_empty && c && !j && (ae = c.every(
720
+ (N) => N == null || N === "" || Array.isArray(N) && N.length === 0
721
+ ) && !xt && te.every((N) => !Be[N.field])), ae && te.length === 0) return null;
722
+ const _e = De(null), Ne = rn(_e), Pe = dn(t.icon), yt = qe ? i : i.filter((f) => !f.hidden), Ce = (Ge = be == null ? void 0 : be.sections) == null ? void 0 : Ge[t.key], _t = Array.isArray(Ce) && Ce.length > 0, Nt = (f) => _t ? /* @__PURE__ */ y("div", { className: "relative", children: [
723
+ f,
707
724
  /* @__PURE__ */ e("span", { className: "absolute right-[52px] top-1/2 flex -translate-y-1/2", children: /* @__PURE__ */ e(
708
- At,
725
+ Zt,
709
726
  {
710
727
  collection: r,
711
728
  kind: "section",
@@ -713,51 +730,51 @@ const Gn = Ot(function({
713
730
  label: t.label || t.key
714
731
  }
715
732
  ) })
716
- ] }) : h, _e = (h) => Oe && (h.hidden || !(m.has(h.field) || !m.size));
717
- return /* @__PURE__ */ x(
733
+ ] }) : f, we = (f) => qe && (f.hidden || !(d.has(f.field) || !d.size));
734
+ return /* @__PURE__ */ y(
718
735
  "div",
719
736
  {
720
737
  "data-loads-on-open": ie ? "" : void 0,
721
738
  "data-section-key": t.key,
722
739
  className: E(
723
740
  "nvr-section-enter rounded-xl border border-slate-200 bg-white dark:bg-card dark:border-border",
724
- f && "bg-slate-50/60 dark:bg-slate-900/20",
741
+ x && "bg-slate-50/60 dark:bg-slate-900/20",
725
742
  ae && "hidden"
726
743
  ),
727
- onPointerDownCapture: (h) => {
728
- var _, u;
729
- (u = (_ = h.target) == null ? void 0 : _.closest) != null && u.call(_, "[data-usage-header]") || xe();
744
+ onPointerDownCapture: (f) => {
745
+ var N, p;
746
+ (p = (N = f.target) == null ? void 0 : N.closest) != null && p.call(N, "[data-usage-header]") || ye();
730
747
  },
731
- onFocusCapture: (h) => {
732
- var _, u;
733
- (u = (_ = h.target) == null ? void 0 : _.closest) != null && u.call(_, "[data-usage-header]") || xe();
748
+ onFocusCapture: (f) => {
749
+ var N, p;
750
+ (p = (N = f.target) == null ? void 0 : N.closest) != null && p.call(N, "[data-usage-header]") || ye();
734
751
  },
735
752
  children: [
736
- Me && !ae && /* @__PURE__ */ e(un, { layoutId: Number(U), collection: r, sectionKey: t.key }),
737
- yt(
738
- /* @__PURE__ */ x(
753
+ Te && !ae && /* @__PURE__ */ e(fn, { layoutId: Number(M), collection: r, sectionKey: t.key }),
754
+ Nt(
755
+ /* @__PURE__ */ y(
739
756
  "button",
740
757
  {
741
758
  type: "button",
742
759
  "data-usage-header": "",
743
- onClick: ft,
744
- "data-design-group-header": $ ? "" : void 0,
760
+ onClick: bt,
761
+ "data-design-group-header": j ? "" : void 0,
745
762
  className: E(
746
763
  "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",
747
764
  // Round the bottom only when nothing renders below the header — an
748
765
  // expanded body (or collapsed summary strip) square-joins it, and a
749
766
  // rounded hover overlay would leave see-through notches at the seam.
750
- z && !(M && M.length > 0) && "rounded-b-xl"
767
+ z && !($ && $.length > 0) && "rounded-b-xl"
751
768
  ),
752
769
  children: [
753
- Ge && /* @__PURE__ */ e(Ge, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 dark:text-slate-500" }),
770
+ Pe && /* @__PURE__ */ e(Pe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 dark:text-slate-500" }),
754
771
  /* @__PURE__ */ e("span", { className: "font-medium text-[13px] shrink-0 text-slate-800 dark:text-slate-200", children: t.label }),
755
772
  /* @__PURE__ */ e("span", { className: "flex-1" }),
756
- ht && /* @__PURE__ */ e("span", { className: "nvr-pop h-2 w-2 rounded-full bg-destructive shrink-0" }),
773
+ gt && /* @__PURE__ */ e("span", { className: "nvr-pop h-2 w-2 rounded-full bg-destructive shrink-0" }),
757
774
  /* @__PURE__ */ e(
758
- Dt,
775
+ Ft,
759
776
  {
760
- "data-design-pass": $ ? "" : void 0,
777
+ "data-design-pass": j ? "" : void 0,
761
778
  className: E(
762
779
  "h-4 w-4 text-slate-400 dark:text-slate-500 transition-transform duration-200",
763
780
  z && "-rotate-90"
@@ -768,99 +785,99 @@ const Gn = Ot(function({
768
785
  }
769
786
  )
770
787
  ),
771
- z && M && M.length > 0 && /* @__PURE__ */ e(
772
- dn,
788
+ z && $ && $.length > 0 && /* @__PURE__ */ e(
789
+ mn,
773
790
  {
774
- summaryFields: M,
791
+ summaryFields: $,
775
792
  fields: i,
776
793
  draft: a,
777
794
  relations: o,
778
795
  collection: r,
779
- itemId: s,
780
- ownersCollection: P,
781
- ownersItemId: j,
782
- ownersAssignment: G,
796
+ itemId: l,
797
+ ownersCollection: C,
798
+ ownersItemId: q,
799
+ ownersAssignment: L,
783
800
  m2mCounts: R,
784
- o2mCounts: ue,
785
- o2mAggValues: N,
801
+ o2mCounts: pe,
802
+ o2mAggValues: _,
786
803
  summaryAggConfigs: T,
787
804
  o2mLoading: me,
788
805
  hideEmpty: !!t.summary_hide_empty || !!W
789
806
  }
790
807
  ),
791
- z && !ie && t.hide_when_empty && te.length > 0 && /* @__PURE__ */ e("div", { className: "hidden", children: te.filter((h) => h.widget_id != null).map((h) => /* @__PURE__ */ e(
792
- Ye,
808
+ z && !ie && t.hide_when_empty && te.length > 0 && /* @__PURE__ */ e("div", { className: "hidden", children: te.filter((f) => f.widget_id != null).map((f) => /* @__PURE__ */ e(
809
+ Qe,
793
810
  {
794
- widgetId: h.widget_id,
795
- inputBindings: Xe(h.input_bindings),
811
+ widgetId: f.widget_id,
812
+ inputBindings: et(f.input_bindings),
796
813
  itemDraft: a,
797
814
  frameless: !0,
798
815
  apiBase: Q,
799
- onContentChange: (_) => Be(
800
- (u) => u[h.field] === _ ? u : { ...u, [h.field]: _ }
816
+ onContentChange: (N) => Ue(
817
+ (p) => p[f.field] === N ? p : { ...p, [f.field]: N }
801
818
  )
802
819
  },
803
- h.field
820
+ f.field
804
821
  )) }),
805
- !z && /* @__PURE__ */ x(
822
+ !z && /* @__PURE__ */ y(
806
823
  "div",
807
824
  {
808
825
  "data-section-body": "",
809
826
  className: "nvr-expand-in border-t border-slate-100 px-5 py-4 dark:border-border/60",
810
827
  children: [
811
- !f && /* @__PURE__ */ e(tn, { group: t, className: "mb-3" }),
828
+ !x && /* @__PURE__ */ e(sn, { group: t, className: "mb-3" }),
812
829
  (() => {
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,
830
+ const f = Pt(yt, {
831
+ rows: x ? [] : Vt(t.swap_config).rows,
832
+ folded: (p) => !x && Gt(p._overrides),
833
+ keep: (p) => !!p.required,
834
+ filled: (p) => !Ct(a[p.field]) || !!m[p.field]
835
+ }), N = f.units.map(
836
+ (p) => p.kind === "row" ? {
837
+ _k: `row:${p.row.key}`,
838
+ sort: p.members[0].sort ?? 0,
822
839
  _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 }
840
+ row: p.row,
841
+ members: p.members
842
+ } : { _k: p.field.field, sort: p.field.sort ?? 0, _t: "field", f: p.field }
826
843
  );
827
- G && _.push({
844
+ L && N.push({
828
845
  _k: "__owners__",
829
- sort: G.sort,
846
+ sort: L.sort,
830
847
  _t: "owners",
831
- slot: G
832
- }), d && _.push({
848
+ slot: L
849
+ }), u && N.push({
833
850
  _k: "__pdf__",
834
- sort: d.sort,
851
+ sort: u.sort,
835
852
  _t: "pdf",
836
- slot: d
853
+ slot: u
837
854
  });
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(
855
+ for (const p of A ?? [])
856
+ N.push({ _k: p.field, sort: p.sort, _t: "widget", slot: p });
857
+ return N.sort((p, U) => p.sort - U.sort), j && N.length === 0 && f.folded.length === 0 ? /* @__PURE__ */ e(Rt, {}) : x ? /* @__PURE__ */ y(
841
858
  "div",
842
859
  {
843
- ref: ye,
860
+ ref: _e,
844
861
  "data-section-grid": "",
845
- className: E($ && "relative", "grid grid-cols-12 gap-x-6 gap-y-3"),
862
+ className: E(j && "relative", "grid grid-cols-12 gap-x-6 gap-y-3"),
846
863
  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;
864
+ /* @__PURE__ */ e(ke, { gapClass: "gap-x-6" }),
865
+ N.map((p) => {
866
+ if (p._t === "owners") {
867
+ const k = p.slot.col_span ?? 12;
851
868
  return K(
852
869
  le("__owners__"),
853
870
  /* @__PURE__ */ e(
854
871
  "div",
855
872
  {
856
873
  className: "min-w-0",
857
- style: { gridColumn: `span ${v}` },
874
+ style: { gridColumn: `span ${k}` },
858
875
  children: /* @__PURE__ */ e(
859
- Ze,
876
+ Xe,
860
877
  {
861
878
  collection: r,
862
- itemId: s,
863
- label: u.slot.label_override || "Owners"
879
+ itemId: l,
880
+ label: p.slot.label_override || "Owners"
864
881
  }
865
882
  )
866
883
  },
@@ -868,144 +885,144 @@ const Gn = Ot(function({
868
885
  )
869
886
  );
870
887
  }
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
888
+ if (p._t === "pdf" || p._t === "widget" || p._t === "row") return null;
889
+ const U = p.f, b = o.find(
890
+ (k) => k.many_collection === r && k.many_field === U.field && !k.junction_field
874
891
  );
875
892
  return K(
876
- { kind: "field", field: B.field, group_key: t.key },
877
- /* @__PURE__ */ x(
893
+ { kind: "field", field: U.field, group_key: t.key },
894
+ /* @__PURE__ */ y(
878
895
  "div",
879
896
  {
880
897
  className: "min-w-0",
881
- style: { gridColumn: `span ${Qe(B.options, Ne)}` },
898
+ style: { gridColumn: `span ${Ze(U.options, Ne)}` },
882
899
  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) }) })
900
+ /* @__PURE__ */ e("dt", { className: "text-[11px] font-medium text-slate-400 truncate", children: U.label || dt(U.field) }),
901
+ /* @__PURE__ */ e("dd", { className: "mt-0.5 break-words", children: (b == null ? void 0 : b.one_collection) === "nivaro_users" ? (() => {
902
+ const k = a[U.field], V = Array.isArray(k) ? k : k != null && k !== "" ? [k] : [];
903
+ return V.length === 0 ? /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-400", children: "—" }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: V.map((P) => /* @__PURE__ */ e(ut, { userId: String(P) }, String(P))) });
904
+ })() : b != null && b.one_collection ? /* @__PURE__ */ e(re, { relCollection: b.one_collection, id: a[U.field] }) : /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-700", children: Fe(a[U.field], U) }) })
888
905
  ]
889
906
  },
890
- B.field
907
+ U.field
891
908
  )
892
909
  );
893
910
  })
894
911
  ]
895
912
  }
896
913
  ) : (() => {
897
- const u = (g) => {
898
- var Ke, Ee;
899
- if (g._t === "row")
914
+ const p = (b) => {
915
+ var Ee, We;
916
+ if (b._t === "row")
900
917
  return /* @__PURE__ */ e(
901
- Qt,
918
+ en,
902
919
  {
903
- row: g.row,
904
- members: g.members,
920
+ row: b.row,
921
+ members: b.members,
905
922
  containerWidth: Ne,
906
- errors: p,
923
+ errors: m,
907
924
  renderMember: (w) => K(
908
925
  { kind: "field", field: w.field, group_key: t.key },
909
926
  /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
910
- ke,
927
+ Se,
911
928
  {
912
- field: Zt(w),
929
+ field: tn(w),
913
930
  draft: a,
914
- onChange: l,
931
+ onChange: s,
915
932
  relations: o,
916
933
  collection: r,
917
- itemId: s,
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
934
+ itemId: l,
935
+ error: m[w.field],
936
+ visible: d.has(w.field) || !d.size,
937
+ forceVisible: we(w) || void 0,
938
+ locked: F.has(w.field),
939
+ layoutAiEnabled: D,
940
+ renderField: h,
941
+ onCountChange: v
925
942
  }
926
943
  ) }, w.field)
927
944
  )
928
945
  },
929
- g._k
946
+ b._k
930
947
  );
931
- if (g._t === "owners") {
932
- const w = g.slot.col_span ?? 12;
948
+ if (b._t === "owners") {
949
+ const w = b.slot.col_span ?? 12;
933
950
  return K(
934
951
  le("__owners__"),
935
952
  /* @__PURE__ */ e("div", { style: { gridColumn: `span ${w}` }, children: /* @__PURE__ */ e(
936
- Ze,
953
+ Xe,
937
954
  {
938
955
  collection: r,
939
- itemId: s,
940
- label: g.slot.label_override || "Owners"
956
+ itemId: l,
957
+ label: b.slot.label_override || "Owners"
941
958
  }
942
959
  ) }, "__owners__")
943
960
  );
944
961
  }
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";
962
+ if (b._t === "pdf") {
963
+ if (!M) return null;
964
+ const w = b.slot.col_span ?? 12, J = ((Ee = b.slot.label_override) == null ? void 0 : Ee.trim()) || "Generate PDF";
948
965
  return K(
949
966
  le("__pdf__"),
950
967
  /* @__PURE__ */ e("div", { style: { gridColumn: `span ${w}` }, children: /* @__PURE__ */ e(
951
- on,
968
+ un,
952
969
  {
953
970
  collection: r,
954
- itemId: s,
955
- layoutId: U,
956
- attachField: L ?? null,
957
- filenameTemplate: O,
971
+ itemId: l,
972
+ layoutId: M,
973
+ attachField: I ?? null,
974
+ filenameTemplate: B,
958
975
  label: J
959
976
  }
960
977
  ) }, "__pdf__")
961
978
  );
962
979
  }
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);
980
+ if (b._t === "widget") {
981
+ if (!b.slot.widget_id) return null;
982
+ const w = b.slot.col_span ?? 12, J = et(b.slot.input_bindings);
966
983
  return K(
967
- le(g.slot.field),
984
+ le(b.slot.field),
968
985
  /* @__PURE__ */ e("div", { style: { gridColumn: `span ${w}` }, children: /* @__PURE__ */ e(
969
- Ye,
986
+ Qe,
970
987
  {
971
- widgetId: g.slot.widget_id,
988
+ widgetId: b.slot.widget_id,
972
989
  inputBindings: J,
973
990
  itemDraft: a,
974
- label: g.slot.label_override ?? void 0,
975
- defaultExpanded: g.slot.default_expanded ?? !0,
991
+ label: b.slot.label_override ?? void 0,
992
+ defaultExpanded: b.slot.default_expanded ?? !0,
976
993
  frameless: !0,
977
994
  apiBase: Q,
978
- onContentChange: (We) => Be(
979
- (we) => we[g.slot.field] === We ? we : { ...we, [g.slot.field]: We }
995
+ onContentChange: (Ae) => Ue(
996
+ (ve) => ve[b.slot.field] === Ae ? ve : { ...ve, [b.slot.field]: Ae }
980
997
  )
981
998
  }
982
- ) }, g.slot.field)
999
+ ) }, b.slot.field)
983
1000
  );
984
1001
  }
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) ?? ""];
1002
+ const k = b.f, V = fe == null ? void 0 : fe[k.field], P = V == null ? void 0 : V.entries, wt = (V == null ? void 0 : V.separator) ?? null, oe = a[k.field], Ve = oe != null && oe !== "", Je = P != null && P.length && Ve ? ((We = o.find(
1003
+ (w) => w.many_collection === r && w.many_field === k.field && !w.junction_field
1004
+ )) == null ? void 0 : We.one_collection) ?? null : null, Re = (G == null ? void 0 : G.enabled) && k.field === G.primary_field, ze = (() => {
1005
+ const w = a[(G == null ? void 0 : G.primary_field) ?? ""];
989
1006
  return w != null && w !== "";
990
- })(), ze = (Z ?? []).some((w) => {
1007
+ })(), He = (Z ?? []).some((w) => {
991
1008
  const J = a[w.field];
992
1009
  return J != null && J !== "";
993
- }), _t = Je && je ? /* @__PURE__ */ x("span", { className: "inline-flex items-center gap-1.5", children: [
1010
+ }), vt = Re && Oe ? /* @__PURE__ */ y("span", { className: "inline-flex items-center gap-1.5", children: [
994
1011
  /* @__PURE__ */ e(
995
1012
  "button",
996
1013
  {
997
1014
  type: "button",
998
- onClick: je,
1015
+ onClick: Oe,
999
1016
  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"
1017
+ children: je ? G.back_label ?? "Back" : G.toggle_label ?? "Enter manually"
1001
1018
  }
1002
1019
  ),
1003
- /* @__PURE__ */ x(
1020
+ /* @__PURE__ */ y(
1004
1021
  "span",
1005
1022
  {
1006
1023
  className: [
1007
1024
  "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"
1025
+ 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"
1009
1026
  ].join(" "),
1010
1027
  title: "Original field",
1011
1028
  children: [
@@ -1014,7 +1031,7 @@ const Gn = Ot(function({
1014
1031
  {
1015
1032
  className: [
1016
1033
  "h-1.5 w-1.5 rounded-full",
1017
- Re ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
1034
+ ze ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
1018
1035
  ].join(" ")
1019
1036
  }
1020
1037
  ),
@@ -1022,12 +1039,12 @@ const Gn = Ot(function({
1022
1039
  ]
1023
1040
  }
1024
1041
  ),
1025
- /* @__PURE__ */ x(
1042
+ /* @__PURE__ */ y(
1026
1043
  "span",
1027
1044
  {
1028
1045
  className: [
1029
1046
  "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"
1047
+ He ? "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
1048
  ].join(" "),
1032
1049
  title: "Manual fields",
1033
1050
  children: [
@@ -1036,7 +1053,7 @@ const Gn = Ot(function({
1036
1053
  {
1037
1054
  className: [
1038
1055
  "h-1.5 w-1.5 rounded-full",
1039
- ze ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
1056
+ He ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
1040
1057
  ].join(" ")
1041
1058
  }
1042
1059
  ),
@@ -1044,103 +1061,103 @@ const Gn = Ot(function({
1044
1061
  ]
1045
1062
  }
1046
1063
  )
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;
1064
+ ] }) : void 0, kt = Re && je && (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) => {
1065
+ const J = (he == null ? void 0 : he[w.field]) ?? 2;
1049
1066
  return /* @__PURE__ */ e("div", { style: { gridColumn: `span ${J}` }, children: /* @__PURE__ */ e(
1050
- ke,
1067
+ Se,
1051
1068
  {
1052
1069
  field: w,
1053
1070
  draft: a,
1054
- onChange: l,
1071
+ onChange: s,
1055
1072
  relations: o,
1056
1073
  collection: r,
1057
- itemId: s,
1058
- error: p[w.field],
1074
+ itemId: l,
1075
+ error: m[w.field],
1059
1076
  visible: !0,
1060
1077
  forceVisible: !0,
1061
- locked: k.has(w.field),
1062
- layoutAiEnabled: c,
1063
- renderField: b,
1064
- onCountChange: y
1078
+ locked: F.has(w.field),
1079
+ layoutAiEnabled: D,
1080
+ renderField: h,
1081
+ onCountChange: v
1065
1082
  }
1066
1083
  ) }, w.field);
1067
- }) }) }) : void 0, He = /* @__PURE__ */ e(
1068
- ke,
1084
+ }) }) }) : void 0, Ke = /* @__PURE__ */ e(
1085
+ Se,
1069
1086
  {
1070
- field: v,
1087
+ field: k,
1071
1088
  draft: a,
1072
- onChange: l,
1089
+ onChange: s,
1073
1090
  relations: o,
1074
1091
  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
1092
+ itemId: l,
1093
+ error: m[k.field],
1094
+ visible: d.has(k.field) || !d.size,
1095
+ forceVisible: we(k) || void 0,
1096
+ locked: F.has(k.field),
1097
+ layoutAiEnabled: D,
1098
+ renderField: h,
1099
+ onCountChange: v,
1100
+ swapButton: vt,
1101
+ swapContent: kt
1085
1102
  }
1086
1103
  );
1087
1104
  return K(
1088
- { kind: "field", field: v.field, group_key: t.key },
1089
- /* @__PURE__ */ x(
1105
+ { kind: "field", field: k.field, group_key: t.key },
1106
+ /* @__PURE__ */ y(
1090
1107
  "div",
1091
1108
  {
1092
- style: { gridColumn: `span ${Qe(v.options, Ne)}` },
1109
+ style: { gridColumn: `span ${Ze(k.options, Ne)}` },
1093
1110
  children: [
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,
1111
+ we(k) ? /* @__PURE__ */ e("div", { "data-design-hidden": "", className: "opacity-40", children: Ke }) : Ke,
1112
+ (P == null ? void 0 : P.length) && Ve && Je && /* @__PURE__ */ e(
1113
+ cn,
1097
1114
  {
1098
- relCollection: Ce,
1115
+ relCollection: Je,
1099
1116
  relId: oe,
1100
- entries: I,
1101
- separator: Nt
1117
+ entries: P,
1118
+ separator: wt
1102
1119
  }
1103
1120
  )
1104
1121
  ]
1105
1122
  },
1106
- v.field
1123
+ k.field
1107
1124
  )
1108
1125
  );
1109
- }, B = h.folded.map((g) => ({
1110
- _k: g.field,
1111
- sort: g.sort ?? 0,
1126
+ }, U = f.folded.map((b) => ({
1127
+ _k: b.field,
1128
+ sort: b.sort ?? 0,
1112
1129
  _t: "field",
1113
- f: g
1130
+ f: b
1114
1131
  }));
1115
- return /* @__PURE__ */ x(vt, { children: [
1116
- /* @__PURE__ */ x(
1132
+ return /* @__PURE__ */ y(St, { children: [
1133
+ /* @__PURE__ */ y(
1117
1134
  "div",
1118
1135
  {
1119
- ref: ye,
1136
+ ref: _e,
1120
1137
  "data-section-grid": "",
1121
- className: E($ && "relative", "grid grid-cols-12 gap-4 items-start"),
1138
+ className: E(j && "relative", "grid grid-cols-12 gap-4 items-start"),
1122
1139
  children: [
1123
- /* @__PURE__ */ e(ve, {}),
1124
- _.map(u)
1140
+ /* @__PURE__ */ e(ke, {}),
1141
+ N.map(p)
1125
1142
  ]
1126
1143
  }
1127
1144
  ),
1128
1145
  /* @__PURE__ */ e(
1129
- Yt,
1146
+ Xt,
1130
1147
  {
1131
- count: B.length,
1132
- open: mt,
1133
- forcedOpen: h.forcedOpen,
1134
- design: !!$,
1135
- onToggle: () => pt((g) => !g),
1136
- children: /* @__PURE__ */ x(
1148
+ count: U.length,
1149
+ open: ft,
1150
+ forcedOpen: f.forcedOpen,
1151
+ design: !!j,
1152
+ onToggle: () => ht((b) => !b),
1153
+ children: /* @__PURE__ */ y(
1137
1154
  "div",
1138
1155
  {
1139
1156
  "data-section-grid": "",
1140
- className: E($ && "relative", "grid grid-cols-12 gap-4 items-start"),
1157
+ className: E(j && "relative", "grid grid-cols-12 gap-4 items-start"),
1141
1158
  children: [
1142
- /* @__PURE__ */ e(ve, {}),
1143
- B.map(u)
1159
+ /* @__PURE__ */ e(ke, {}),
1160
+ U.map(p)
1144
1161
  ]
1145
1162
  }
1146
1163
  )
@@ -1156,25 +1173,25 @@ const Gn = Ot(function({
1156
1173
  ]
1157
1174
  }
1158
1175
  );
1159
- }, rn);
1160
- function un({
1176
+ }, an);
1177
+ function fn({
1161
1178
  layoutId: n,
1162
1179
  collection: t,
1163
1180
  sectionKey: i
1164
1181
  }) {
1165
1182
  return ne(() => {
1166
- lt({ layoutId: n, collection: t, kind: "shown", key: i });
1183
+ ot({ layoutId: n, collection: t, kind: "shown", key: i });
1167
1184
  }, [n, t, i]), null;
1168
1185
  }
1169
1186
  export {
1170
1187
  Gn as GroupSection,
1171
- ln as InlineDisplay,
1172
- Ze as OwnersInline,
1173
- sn as OwnersInlineCompact,
1188
+ cn as InlineDisplay,
1189
+ Xe as OwnersInline,
1190
+ on as OwnersInlineCompact,
1174
1191
  re as RelationCell,
1175
- Tn as StripFieldValue,
1176
- ct as UserChip,
1177
- Vn as UserRosterCluster,
1178
- $e as formatDisplayValue,
1179
- cn as useChangePulse
1192
+ Cn as StripFieldValue,
1193
+ ut as UserChip,
1194
+ Rn as UserRosterCluster,
1195
+ Fe as formatDisplayValue,
1196
+ pn as useChangePulse
1180
1197
  };