@nivaro/react 0.3.51 → 0.3.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 (34) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +47 -3
  4. package/dist/shared/components/ItemEditForm.js +3885 -3847
  5. package/dist/shared/components/NotificationBell.js +163 -150
  6. package/dist/shared/components/PageRenderer.js +600 -549
  7. package/dist/shared/components/ProfileView.js +36 -34
  8. package/dist/shared/components/QueryStatStrip.js +96 -89
  9. package/dist/shared/components/QueryTable.js +214 -215
  10. package/dist/shared/components/ReportView.js +548 -529
  11. package/dist/shared/components/alerts/AlertManagerView.js +346 -320
  12. package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
  13. package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
  14. package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
  15. package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
  16. package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
  17. package/dist/shared/components/item-edit/PlanGrid.js +718 -705
  18. package/dist/shared/components/item-edit/SummaryPanel.js +351 -337
  19. package/dist/shared/components/item-edit/line-qty.js +115 -53
  20. package/dist/shared/components/item-edit/save-refusal.js +18 -18
  21. package/dist/shared/components/item-edit/usePersonalDefaults.js +210 -207
  22. package/dist/shared/components/panels/CommentPanel.js +204 -197
  23. package/dist/shared/components/panels/ItemLockBanner.js +318 -291
  24. package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
  25. package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
  26. package/dist/shared/components/panels/RevisionsPanel.js +101 -106
  27. package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
  28. package/dist/shared/components/panels/requirement-side-effects.js +46 -29
  29. package/dist/shared/components/queue/QueueItemSheet.js +219 -146
  30. package/dist/shared/components/queue/QueueWorklist.js +738 -730
  31. package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
  32. package/dist/shared/lib/activity-sentence.js +236 -227
  33. package/dist/shared/lib/record-ref.js +43 -34
  34. package/package.json +1 -1
@@ -1,354 +1,368 @@
1
- import { jsx as l, jsxs as p } from "react/jsx-runtime";
2
- import { useQuery as E } from "@tanstack/react-query";
1
+ import { jsx as r, jsxs as x } from "react/jsx-runtime";
2
+ import { useQuery as C } from "@tanstack/react-query";
3
3
  import { Check as ue, Copy as fe, ChevronRight as ye, Loader2 as pe } from "lucide-react";
4
- import { useState as Q, useRef as he, createContext as xe, useContext as be } from "react";
4
+ import { useState as z, useRef as he, createContext as xe, useContext as be } from "react";
5
5
  import { useNivaroClient as U } from "../../context.js";
6
- import { get as K } from "../../lib/commands.js";
7
- import { useRecordReader as ge } from "../../lib/record-loader.js";
8
- import { cn as M, titleCase as z, toLocalDateString as _e, choiceLabel as ke } from "../../lib/utils.js";
6
+ import { get as A } from "../../lib/commands.js";
7
+ import { useRecordReader as _e } from "../../lib/record-loader.js";
8
+ import { cn as D, titleCase as Z, toLocalDateString as ge, choiceLabel as ke } from "../../lib/utils.js";
9
9
  import { useChangePulse as Ne } from "./GroupSection.js";
10
- import { SYSTEM_FIELDS as Se, SENTINEL_FIELDS as we, applyDisplayTemplate as ne, parseJson as le, richTextToPlain as Z } from "./helpers.js";
11
- import { RelatedItemLabel as ae } from "./RelationCombobox.js";
12
- const re = xe({});
10
+ import { SYSTEM_FIELDS as Se, SENTINEL_FIELDS as we, applyDisplayTemplate as le, parseJson as ae, richTextToPlain as ee } from "./helpers.js";
11
+ import { RelatedItemLabel as re } from "./RelationCombobox.js";
12
+ const ie = xe({});
13
13
  function qe(e, t) {
14
14
  return t ? Object.entries(t).every(
15
- ([n, a]) => a !== null && typeof a == "object" || String(e[n] ?? "") === String(a ?? "")
15
+ ([l, a]) => a !== null && typeof a == "object" || String(e[l] ?? "") === String(a ?? "")
16
16
  ) : !0;
17
17
  }
18
18
  function Te({
19
19
  relation: e,
20
20
  parentId: t,
21
- allRelations: n,
21
+ allRelations: l,
22
22
  staging: a,
23
- maxValues: h
23
+ maxValues: f
24
24
  }) {
25
- var b, w, J;
26
- const y = U(), c = e.many_field ?? "", u = e.junction_field ?? (() => {
27
- const r = n.find(
28
- ($) => $.many_collection === e.many_collection && $.id !== e.id
25
+ var E, m, h;
26
+ const c = U(), d = e.many_field ?? "", y = e.junction_field ?? (() => {
27
+ const n = l.find(
28
+ (v) => v.many_collection === e.many_collection && v.id !== e.id
29
29
  );
30
- return (r == null ? void 0 : r.many_field) ?? "";
31
- })(), x = e.one_field ?? `${e.many_collection}.${u}`, _ = ((b = n.find(
32
- (r) => r.many_collection === e.many_collection && r.many_field === u && r.id !== e.id
33
- )) == null ? void 0 : b.one_collection) ?? null, { data: k } = E({
30
+ return (n == null ? void 0 : n.many_field) ?? "";
31
+ })(), b = e.one_field ?? `${e.many_collection}.${y}`, g = ((E = l.find(
32
+ (n) => n.many_collection === e.many_collection && n.many_field === y && n.id !== e.id
33
+ )) == null ? void 0 : E.one_collection) ?? null, { data: k } = C({
34
34
  queryKey: ["summary-junction-relations", e.many_collection],
35
- queryFn: () => y.request(
36
- K(`/data-model/relations/for/${e.many_collection}`)
37
- ).then((r) => r.data ?? []).catch(() => []),
38
- enabled: !_ && !!e.many_collection && !!u,
35
+ queryFn: () => c.request(
36
+ A(`/data-model/relations/for/${e.many_collection}`)
37
+ ).then((n) => n.data ?? []).catch(() => []),
38
+ enabled: !g && !!e.many_collection && !!y,
39
39
  staleTime: 10 * 6e4
40
- }), s = _ ?? ((w = k == null ? void 0 : k.find(
41
- (r) => r.many_collection === e.many_collection && r.many_field === u && !!r.one_collection
42
- )) == null ? void 0 : w.one_collection) ?? null, { data: o = [] } = E({
43
- queryKey: ["m2m-items", e.many_collection, c, t],
44
- queryFn: () => y.request(
45
- K(`/items/${e.many_collection}`, {
46
- filter: JSON.stringify({ [c]: { _eq: t } }),
40
+ }), i = g ?? ((m = k == null ? void 0 : k.find(
41
+ (n) => n.many_collection === e.many_collection && n.many_field === y && !!n.one_collection
42
+ )) == null ? void 0 : m.one_collection) ?? null, { data: s = [] } = C({
43
+ queryKey: ["m2m-items", e.many_collection, d, t],
44
+ queryFn: () => c.request(
45
+ A(`/items/${e.many_collection}`, {
46
+ filter: JSON.stringify({ [d]: { _eq: t } }),
47
47
  limit: 200,
48
- fields: `id,${u}`
48
+ fields: `id,${y}`
49
49
  })
50
- ).then((r) => r.data ?? []),
50
+ ).then((n) => n.data ?? []),
51
51
  staleTime: 3e4,
52
52
  enabled: !!t && t !== "new"
53
- }), d = s ? null : ((J = [...n, ...k ?? []].find(
54
- (r) => r.many_collection === e.many_collection && r.many_field === u && !!r.one_collection_field
55
- )) == null ? void 0 : J.one_collection_field) ?? null, { data: g = [] } = E({
56
- queryKey: ["summary-m2a-items", e.many_collection, c, t, d],
57
- queryFn: () => y.request(
58
- K(`/items/${e.many_collection}`, {
59
- filter: JSON.stringify({ [c]: { _eq: t } }),
53
+ }), u = i ? null : ((h = [...l, ...k ?? []].find(
54
+ (n) => n.many_collection === e.many_collection && n.many_field === y && !!n.one_collection_field
55
+ )) == null ? void 0 : h.one_collection_field) ?? null, { data: S = [] } = C({
56
+ queryKey: ["summary-m2a-items", e.many_collection, d, t, u],
57
+ queryFn: () => c.request(
58
+ A(`/items/${e.many_collection}`, {
59
+ filter: JSON.stringify({ [d]: { _eq: t } }),
60
60
  limit: 200,
61
- fields: `id,${u},${d}`
61
+ fields: `id,${y},${u}`
62
62
  })
63
- ).then((r) => r.data ?? []),
63
+ ).then((n) => n.data ?? []),
64
64
  staleTime: 3e4,
65
- enabled: !!d && !!t && t !== "new"
66
- }), D = s === "nivaro_files" || s === "directus_files", { data: N } = E({
67
- queryKey: ["col-meta", s],
68
- queryFn: () => y.request(K(`/collections/${s}`)).then((r) => r.data),
69
- enabled: !!s && !D,
65
+ enabled: !!u && !!t && t !== "new"
66
+ }), F = i === "nivaro_files" || i === "directus_files", { data: _ } = C({
67
+ queryKey: ["col-meta", i],
68
+ queryFn: () => c.request(A(`/collections/${i}`)).then((n) => n.data),
69
+ enabled: !!i && !F,
70
70
  staleTime: 3e5
71
- }), C = (a == null ? void 0 : a.getStagedLinks(x)) ?? [], L = (a == null ? void 0 : a.getStagedUnlinks(x)) ?? /* @__PURE__ */ new Set(), R = o.filter((r) => !L.has(r.id)), S = [
72
- ...C,
73
- ...R.map((r) => r[u]).filter((r) => r != null)
71
+ }), O = (a == null ? void 0 : a.getStagedLinks(b)) ?? [], N = (a == null ? void 0 : a.getStagedUnlinks(b)) ?? /* @__PURE__ */ new Set(), $ = s.filter((n) => !N.has(n.id)), w = [
72
+ ...O,
73
+ ...$.map((n) => n[y]).filter((n) => n != null)
74
74
  ];
75
- if (S.length === 0)
76
- return /* @__PURE__ */ l("span", { className: "text-slate-400 dark:text-slate-500", children: "—" });
77
- if (s) {
78
- const $ = S.slice(0, 5), j = S.length - 5;
79
- return /* @__PURE__ */ p("span", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: [
80
- $.map((i, v) => /* @__PURE__ */ p("span", { children: [
81
- v > 0 && ", ",
82
- /* @__PURE__ */ l(
83
- ae,
75
+ if (w.length === 0)
76
+ return /* @__PURE__ */ r("span", { className: "text-slate-400 dark:text-slate-500", children: "—" });
77
+ if (i) {
78
+ const v = w.slice(0, 5), j = w.length - 5;
79
+ return /* @__PURE__ */ x("span", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: [
80
+ v.map((o, L) => /* @__PURE__ */ x("span", { children: [
81
+ L > 0 && ", ",
82
+ /* @__PURE__ */ r(
83
+ re,
84
84
  {
85
- collection: s,
86
- id: i,
87
- displayTemplate: N == null ? void 0 : N.display_template
85
+ collection: i,
86
+ id: o,
87
+ displayTemplate: _ == null ? void 0 : _.display_template
88
88
  }
89
89
  )
90
- ] }, String(i))),
91
- j > 0 && /* @__PURE__ */ p("span", { className: "text-slate-400 dark:text-slate-500", children: [
90
+ ] }, String(o))),
91
+ j > 0 && /* @__PURE__ */ x("span", { className: "text-slate-400 dark:text-slate-500", children: [
92
92
  " +",
93
93
  j,
94
94
  " more"
95
95
  ] })
96
96
  ] });
97
97
  }
98
- const m = d ? g.filter((r) => !L.has(r.id) && r[u] != null && r[d]).slice(0, 5) : [];
99
- if (m.length > 0 && C.length === 0) {
100
- const r = S.length - m.length;
101
- return /* @__PURE__ */ p("span", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: [
102
- m.map(($, j) => /* @__PURE__ */ p("span", { children: [
98
+ const M = u ? S.filter((n) => !N.has(n.id) && n[y] != null && n[u]).slice(0, 5) : [];
99
+ if (M.length > 0 && O.length === 0) {
100
+ const n = w.length - M.length;
101
+ return /* @__PURE__ */ x("span", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: [
102
+ M.map((v, j) => /* @__PURE__ */ x("span", { children: [
103
103
  j > 0 && ", ",
104
- /* @__PURE__ */ l(
105
- ie,
104
+ /* @__PURE__ */ r(
105
+ Y,
106
106
  {
107
- collection: $e(String($[d])),
108
- id: $[u]
107
+ collection: ve(String(v[u])),
108
+ id: v[y]
109
109
  }
110
110
  )
111
- ] }, String($.id))),
112
- r > 0 && /* @__PURE__ */ p("span", { className: "text-slate-400 dark:text-slate-500", children: [
111
+ ] }, String(v.id))),
112
+ n > 0 && /* @__PURE__ */ x("span", { className: "text-slate-400 dark:text-slate-500", children: [
113
113
  " +",
114
- r,
114
+ n,
115
115
  " more"
116
116
  ] })
117
117
  ] });
118
118
  }
119
- return /* @__PURE__ */ p("span", { className: "text-slate-700 dark:text-slate-200", children: [
120
- S.length,
119
+ return /* @__PURE__ */ x("span", { className: "text-slate-700 dark:text-slate-200", children: [
120
+ w.length,
121
121
  " item",
122
- S.length !== 1 ? "s" : ""
122
+ w.length !== 1 ? "s" : ""
123
123
  ] });
124
124
  }
125
- function $e(e) {
125
+ function ve(e) {
126
126
  return e === "directus_users" ? "nivaro_users" : e;
127
127
  }
128
- function se(e) {
128
+ function oe(e) {
129
129
  const t = U();
130
- return E({
130
+ return C({
131
131
  queryKey: ["summary-display-template", e],
132
- queryFn: () => t.request(K(`/collections/${e}`)).then((n) => {
132
+ queryFn: () => t.request(A(`/collections/${e}`)).then((l) => {
133
133
  var a;
134
- return ((a = n.data) == null ? void 0 : a.display_template) ?? null;
134
+ return ((a = l.data) == null ? void 0 : a.display_template) ?? null;
135
135
  }).catch(() => null),
136
136
  enabled: !!e,
137
137
  staleTime: 10 * 6e4
138
138
  }).data;
139
139
  }
140
- function ie({ collection: e, id: t }) {
141
- const n = se(e);
142
- return /* @__PURE__ */ l(ae, { collection: e, id: t, displayTemplate: n ?? void 0 });
140
+ function Y({ collection: e, id: t }) {
141
+ const l = oe(e);
142
+ return /* @__PURE__ */ r(re, { collection: e, id: t, displayTemplate: l ?? void 0 });
143
143
  }
144
- const ve = ["name", "title", "label", "subject", "description", "line_number"], Ce = ["amount", "total", "cost", "price", "quantity"], V = 4, X = 200;
144
+ const Le = ["name", "title", "label", "subject", "description", "line_number"], $e = ["amount", "total", "cost", "price", "quantity"], V = 4, X = 200;
145
145
  function je(e, t) {
146
146
  if (t) {
147
- const n = ne(t, e).replace(/\s*[·|\-–—/]\s*(?=[·|\-–—/]|$)/g, "").replace(/^\s*[·|\-–—/]\s*/, "").trim();
148
- if (n !== "") return n;
147
+ const l = le(t, e).replace(/\s*[·|\-–—/]\s*(?=[·|\-–—/]|$)/g, "").replace(/^\s*[·|\-–—/]\s*/, "").trim();
148
+ if (l !== "") return l;
149
149
  }
150
- for (const n of ve) {
151
- const a = e[n];
150
+ for (const l of Le) {
151
+ const a = e[l];
152
152
  if (a != null && String(a).trim() !== "") return String(a).trim();
153
153
  }
154
- return `#${String(e.id ?? "")}`;
154
+ return null;
155
155
  }
156
- function oe({
156
+ const Ce = ["cifa", "item", "catalog_item", "product", "part", "material"], Oe = /* @__PURE__ */ new Set(["nivaro_users", "directus_users"]);
157
+ function Me(e, t, l) {
158
+ const a = e.filter(
159
+ (c) => c.many_collection === t && !!c.many_field && c.many_field !== l && !c.junction_field && !!c.one_collection && !Oe.has(c.one_collection)
160
+ ), f = Ce.map((c) => a.find((d) => d.many_field === c)).find(Boolean) ?? a[0];
161
+ return f != null && f.many_field && f.one_collection ? { field: f.many_field, collection: f.one_collection } : null;
162
+ }
163
+ function se({
157
164
  relatedCollection: e,
158
165
  manyField: t,
159
- parentId: n,
166
+ parentId: l,
160
167
  rowFilter: a,
161
- expanded: h
168
+ expanded: f
162
169
  }) {
163
- var R, S;
164
- const y = U(), c = be(re), u = a && Object.keys(a).length > 0 ? {
170
+ var M, E;
171
+ const c = U(), d = be(ie), y = a && Object.keys(a).length > 0 ? {
165
172
  _and: [
166
- { [t]: { _eq: n } },
173
+ { [t]: { _eq: l } },
167
174
  Object.fromEntries(
168
- Object.entries(a).map(([m, b]) => [
175
+ Object.entries(a).map(([m, h]) => [
169
176
  m,
170
- b !== null && typeof b == "object" ? b : { _eq: b }
177
+ h !== null && typeof h == "object" ? h : { _eq: h }
171
178
  ])
172
179
  )
173
180
  ]
174
- } : { [t]: { _eq: n } }, { data: x, isLoading: _ } = E({
181
+ } : { [t]: { _eq: l } }, { data: b, isLoading: g } = C({
175
182
  queryKey: [
176
183
  "o2m-rows",
177
184
  e,
178
185
  t,
179
- n,
186
+ l,
180
187
  a ? JSON.stringify(a) : ""
181
188
  ],
182
- queryFn: () => y.request(
183
- K(`/items/${e}`, {
184
- filter: JSON.stringify(u),
189
+ queryFn: () => c.request(
190
+ A(`/items/${e}`, {
191
+ filter: JSON.stringify(y),
185
192
  limit: X
186
193
  })
187
194
  ).then((m) => m.data ?? []),
188
- enabled: !!n && n !== "new",
195
+ enabled: !!l && l !== "new",
189
196
  staleTime: 3e4
190
- }), k = se(e), s = `${e}.${t}`, o = (R = c.deletes) == null ? void 0 : R.get(s), d = (((S = c.rows) == null ? void 0 : S.get(s)) ?? []).filter(
197
+ }), k = oe(e), { data: i = [] } = C({
198
+ queryKey: ["collection-relations", e],
199
+ queryFn: () => c.request(A(`/collections/${e}`)).then((m) => {
200
+ var h;
201
+ return ((h = m.data) == null ? void 0 : h.relations) ?? [];
202
+ }),
203
+ staleTime: 10 * 6e4
204
+ }), s = Me(i, e, t), u = `${e}.${t}`, S = (M = d.deletes) == null ? void 0 : M.get(u), F = (((E = d.rows) == null ? void 0 : E.get(u)) ?? []).filter(
191
205
  (m) => qe(m, a)
192
- ), g = [
193
- ...(x ?? []).filter((m) => !(o != null && o.has(String(m.id)))),
194
- ...d
206
+ ), _ = [
207
+ ...(b ?? []).filter((m) => !(S != null && S.has(String(m.id)))),
208
+ ...F
195
209
  ];
196
- if (_ && d.length === 0)
197
- return /* @__PURE__ */ l(pe, { className: "h-3 w-3 animate-spin text-slate-400 dark:text-slate-500" });
198
- if (g.length === 0)
199
- return /* @__PURE__ */ l("span", { className: "italic text-[11px] text-slate-400 dark:text-slate-500", children: "None yet" });
200
- const D = ((x == null ? void 0 : x.length) ?? 0) >= X, N = Ce.find(
201
- (m) => g.some(
202
- (b) => typeof b[m] == "number" || typeof b[m] == "string" && b[m] !== "" && !Number.isNaN(Number(b[m]))
210
+ if (g && F.length === 0)
211
+ return /* @__PURE__ */ r(pe, { className: "h-3 w-3 animate-spin text-slate-400 dark:text-slate-500" });
212
+ if (_.length === 0)
213
+ return /* @__PURE__ */ r("span", { className: "italic text-[11px] text-slate-400 dark:text-slate-500", children: "None yet" });
214
+ const O = ((b == null ? void 0 : b.length) ?? 0) >= X, N = $e.find(
215
+ (m) => _.some(
216
+ (h) => typeof h[m] == "number" || typeof h[m] == "string" && h[m] !== "" && !Number.isNaN(Number(h[m]))
203
217
  )
204
- ), C = N && !D ? g.reduce((m, b) => {
205
- const w = Number(b[N]);
206
- return m + (Number.isFinite(w) ? w : 0);
207
- }, 0) : null, L = N ? N !== "quantity" : !1;
208
- return /* @__PURE__ */ p("span", { className: "block", children: [
209
- /* @__PURE__ */ p("span", { className: "flex items-baseline gap-2", children: [
210
- /* @__PURE__ */ p("span", { className: "text-slate-700 dark:text-slate-200", children: [
211
- D ? `${X}+` : g.length,
218
+ ), $ = N && !O ? _.reduce((m, h) => {
219
+ const n = Number(h[N]);
220
+ return m + (Number.isFinite(n) ? n : 0);
221
+ }, 0) : null, w = N ? N !== "quantity" : !1;
222
+ return /* @__PURE__ */ x("span", { className: "block", children: [
223
+ /* @__PURE__ */ x("span", { className: "flex items-baseline gap-2", children: [
224
+ /* @__PURE__ */ x("span", { className: "text-slate-700 dark:text-slate-200", children: [
225
+ O ? `${X}+` : _.length,
212
226
  " row",
213
- g.length !== 1 ? "s" : ""
227
+ _.length !== 1 ? "s" : ""
214
228
  ] }),
215
- C !== null && /* @__PURE__ */ l("span", { className: "tabular-nums text-[11px] text-slate-500 dark:text-slate-400", children: L ? C.toLocaleString(void 0, {
229
+ $ !== null && /* @__PURE__ */ r("span", { className: "tabular-nums text-[11px] text-slate-500 dark:text-slate-400", children: w ? $.toLocaleString(void 0, {
216
230
  style: "currency",
217
231
  currency: "USD",
218
- maximumFractionDigits: C % 1 === 0 ? 0 : 2
219
- }) : C.toLocaleString() })
232
+ maximumFractionDigits: $ % 1 === 0 ? 0 : 2
233
+ }) : $.toLocaleString() })
220
234
  ] }),
221
- /* @__PURE__ */ p("span", { className: "mt-1 block space-y-0.5", children: [
222
- (h ? g : g.slice(0, V)).map((m, b) => /* @__PURE__ */ p(
235
+ /* @__PURE__ */ x("span", { className: "mt-1 block space-y-0.5", children: [
236
+ (f ? _ : _.slice(0, V)).map((m, h) => /* @__PURE__ */ x(
223
237
  "span",
224
238
  {
225
239
  className: "flex items-baseline justify-between gap-2 text-[11px] text-slate-500 dark:text-slate-400",
226
240
  children: [
227
- /* @__PURE__ */ l("span", { className: "truncate", children: je(m, k ?? null) }),
228
- N && m[N] !== null && m[N] !== void 0 && /* @__PURE__ */ l("span", { className: "shrink-0 tabular-nums", children: (() => {
229
- const w = Number(m[N]);
230
- return Number.isFinite(w) ? L ? w.toLocaleString(void 0, {
241
+ /* @__PURE__ */ r("span", { className: "truncate", children: je(m, k ?? null) ?? (s && m[s.field] != null && m[s.field] !== "" ? /* @__PURE__ */ r(Y, { collection: s.collection, id: m[s.field] }) : `Row ${h + 1}`) }),
242
+ N && m[N] !== null && m[N] !== void 0 && /* @__PURE__ */ r("span", { className: "shrink-0 tabular-nums", children: (() => {
243
+ const n = Number(m[N]);
244
+ return Number.isFinite(n) ? w ? n.toLocaleString(void 0, {
231
245
  style: "currency",
232
246
  currency: "USD",
233
- maximumFractionDigits: w % 1 === 0 ? 0 : 2
234
- }) : w.toLocaleString() : String(m[N]);
247
+ maximumFractionDigits: n % 1 === 0 ? 0 : 2
248
+ }) : n.toLocaleString() : String(m[N]);
235
249
  })() })
236
250
  ]
237
251
  },
238
- String(m.id ?? b)
252
+ String(m.id ?? h)
239
253
  )),
240
- !h && g.length > V && /* @__PURE__ */ p("span", { className: "block text-[11px] italic text-slate-400 dark:text-slate-500", children: [
254
+ !f && _.length > V && /* @__PURE__ */ x("span", { className: "block text-[11px] italic text-slate-400 dark:text-slate-500", children: [
241
255
  "+",
242
- D ? `${g.length - V}+` : g.length - V,
256
+ O ? `${_.length - V}+` : _.length - V,
243
257
  " more"
244
258
  ] })
245
259
  ] })
246
260
  ] });
247
261
  }
248
- function Le(e) {
262
+ function Ee(e) {
249
263
  const t = Ne(e.val);
250
- return /* @__PURE__ */ l("span", { className: M("inline-block max-w-full rounded-sm", t && "nvr-value-pulse-bg"), children: /* @__PURE__ */ l(Oe, { ...e }) });
264
+ return /* @__PURE__ */ r("span", { className: D("inline-block max-w-full rounded-sm", t && "nvr-value-pulse-bg"), children: /* @__PURE__ */ r(Re, { ...e }) });
251
265
  }
252
- function Oe({
266
+ function Re({
253
267
  field: e,
254
268
  val: t,
255
- relations: n,
269
+ relations: l,
256
270
  collection: a,
257
- itemId: h,
258
- staging: y
271
+ itemId: f,
272
+ staging: c
259
273
  }) {
260
- const c = e.interface ?? "", u = /* @__PURE__ */ new Set(["select-multiple-m2m", "files-m2m", "files", "relation-grouped"]);
261
- if (!u.has(c) && h) {
262
- const s = n.find(
263
- (o) => !o.junction_field && (o.one_field === e.field || o.many_collection === e.field) && (o.one_collection === a || o.one_collection == null)
274
+ const d = e.interface ?? "", y = /* @__PURE__ */ new Set(["select-multiple-m2m", "files-m2m", "files", "relation-grouped"]);
275
+ if (!y.has(d) && f) {
276
+ const i = l.find(
277
+ (s) => !s.junction_field && (s.one_field === e.field || s.many_collection === e.field) && (s.one_collection === a || s.one_collection == null)
264
278
  );
265
- if (s != null && s.many_collection && s.many_field) {
266
- const o = (() => {
279
+ if (i != null && i.many_collection && i.many_field) {
280
+ const s = (() => {
267
281
  try {
268
282
  return typeof e.options == "string" ? JSON.parse(e.options) : e.options ?? {};
269
283
  } catch {
270
284
  return {};
271
285
  }
272
286
  })();
273
- return /* @__PURE__ */ l(
274
- oe,
287
+ return /* @__PURE__ */ r(
288
+ se,
275
289
  {
276
- relatedCollection: s.many_collection,
277
- manyField: s.many_field,
278
- parentId: h,
279
- rowFilter: o.row_filter && typeof o.row_filter == "object" ? o.row_filter : void 0
290
+ relatedCollection: i.many_collection,
291
+ manyField: i.many_field,
292
+ parentId: f,
293
+ rowFilter: s.row_filter && typeof s.row_filter == "object" ? s.row_filter : void 0
280
294
  }
281
295
  );
282
296
  }
283
297
  }
284
- if (u.has(c) && h) {
285
- const s = n.find(
286
- (d) => d.one_collection === a && (d.one_field === e.field || d.junction_field != null && d.many_collection === e.field)
287
- ), o = s ? s.junction_field ? s : (() => {
288
- const d = n.find(
289
- (g) => g.many_collection === s.many_collection && g.id !== s.id
298
+ if (y.has(d) && f) {
299
+ const i = l.find(
300
+ (u) => u.one_collection === a && (u.one_field === e.field || u.junction_field != null && u.many_collection === e.field)
301
+ ), s = i ? i.junction_field ? i : (() => {
302
+ const u = l.find(
303
+ (S) => S.many_collection === i.many_collection && S.id !== i.id
290
304
  );
291
- return d ? { ...s, junction_field: d.many_field } : null;
305
+ return u ? { ...i, junction_field: u.many_field } : null;
292
306
  })() : null;
293
- if (o) {
294
- const d = le(e.options);
295
- return /* @__PURE__ */ l(
307
+ if (s) {
308
+ const u = ae(e.options);
309
+ return /* @__PURE__ */ r(
296
310
  Te,
297
311
  {
298
- relation: o,
299
- parentId: h,
300
- allRelations: n,
301
- staging: y,
302
- maxValues: d == null ? void 0 : d.max_values
312
+ relation: s,
313
+ parentId: f,
314
+ allRelations: l,
315
+ staging: c,
316
+ maxValues: u == null ? void 0 : u.max_values
303
317
  }
304
318
  );
305
319
  }
306
320
  }
307
- const x = t == null || t === "";
308
- if (x && e.type === "boolean")
309
- return /* @__PURE__ */ l("span", { className: "text-slate-700 dark:text-slate-200", children: "No" });
310
- if (x) return /* @__PURE__ */ l("span", { className: "text-slate-400 dark:text-slate-500", children: "—" });
311
- if (c === "extension-editorjs" || c === "input-rich-text-html" || c === "rich_text" || c === "wysiwyg" || typeof t == "string") {
312
- const s = De(t, c);
313
- if (s !== null)
314
- return /* @__PURE__ */ l("span", { className: "truncate text-slate-700 dark:text-slate-200", title: s, children: s || "—" });
321
+ const b = t == null || t === "";
322
+ if (b && e.type === "boolean")
323
+ return /* @__PURE__ */ r("span", { className: "text-slate-700 dark:text-slate-200", children: "No" });
324
+ if (b) return /* @__PURE__ */ r("span", { className: "text-slate-400 dark:text-slate-500", children: "—" });
325
+ if (d === "extension-editorjs" || d === "input-rich-text-html" || d === "rich_text" || d === "wysiwyg" || typeof t == "string") {
326
+ const i = Ke(t, d);
327
+ if (i !== null)
328
+ return /* @__PURE__ */ r("span", { className: "truncate text-slate-700 dark:text-slate-200", title: i, children: i || "—" });
315
329
  }
316
330
  if (typeof t == "boolean")
317
- return /* @__PURE__ */ l("span", { className: "text-slate-700 dark:text-slate-200", children: t ? "Yes" : "No" });
318
- const _ = n.find(
319
- (s) => s.many_collection === a && s.many_field === e.field && !s.junction_field
331
+ return /* @__PURE__ */ r("span", { className: "text-slate-700 dark:text-slate-200", children: t ? "Yes" : "No" });
332
+ const g = l.find(
333
+ (i) => i.many_collection === a && i.many_field === e.field && !i.junction_field
320
334
  );
321
- if (_ != null && _.one_collection)
322
- return /* @__PURE__ */ l(ie, { collection: _.one_collection, id: t });
335
+ if (g != null && g.one_collection)
336
+ return /* @__PURE__ */ r(Y, { collection: g.one_collection, id: t });
323
337
  if (e.type === "datetime" || e.type === "date")
324
338
  try {
325
- return /* @__PURE__ */ l("span", { className: "text-slate-700 dark:text-slate-200", children: _e(t) });
339
+ return /* @__PURE__ */ r("span", { className: "text-slate-700 dark:text-slate-200", children: ge(t) });
326
340
  } catch {
327
341
  }
328
- const k = Me(e.options, t);
329
- return /* @__PURE__ */ l("span", { className: "truncate text-slate-700 dark:text-slate-200", children: k ?? String(t) });
342
+ const k = De(e.options, t);
343
+ return /* @__PURE__ */ r("span", { className: "truncate text-slate-700 dark:text-slate-200", children: k ?? String(t) });
330
344
  }
331
- function Me(e, t) {
332
- var h;
345
+ function De(e, t) {
346
+ var f;
333
347
  if (t == null || typeof t == "object") return null;
334
- const n = le(
348
+ const l = ae(
335
349
  e
336
- ), a = (h = n == null ? void 0 : n.choices) == null ? void 0 : h.find((y) => y && String(y.value) === String(t));
350
+ ), a = (f = l == null ? void 0 : l.choices) == null ? void 0 : f.find((c) => c && String(c.value) === String(t));
337
351
  return (a == null ? void 0 : a.text) != null ? ke(a.text) : null;
338
352
  }
339
- const Ee = /* @__PURE__ */ new Set([
353
+ const Ae = /* @__PURE__ */ new Set([
340
354
  "extension-editorjs",
341
355
  "input-rich-text-html",
342
356
  "rich_text",
343
357
  "wysiwyg"
344
358
  ]);
345
- function De(e, t) {
359
+ function Ke(e, t) {
346
360
  if (typeof e != "string") return null;
347
- if (Ee.has(t)) return Z(e);
348
- const n = e.trim();
349
- return n.startsWith("{") && /"blocks"\s*:/.test(n) ? Z(e) : null;
361
+ if (Ae.has(t)) return ee(e);
362
+ const l = e.trim();
363
+ return l.startsWith("{") && /"blocks"\s*:/.test(l) ? ee(e) : null;
350
364
  }
351
- function Re(e) {
365
+ function Fe(e) {
352
366
  if (e == null || e === "") return "—";
353
367
  if (typeof e == "boolean") return e ? "Yes" : "No";
354
368
  const t = String(e);
@@ -359,53 +373,51 @@ function Re(e) {
359
373
  }
360
374
  return t;
361
375
  }
362
- const ee = (e) => {
376
+ const te = (e) => {
363
377
  if (e == null || e === "") return "empty";
364
378
  if (typeof e == "boolean") return e ? "Yes" : "No";
365
- if (typeof e == "object") {
366
- const n = e.id;
367
- return n != null ? `#${String(n)}` : Array.isArray(e) ? `${e.length} items` : "a value";
368
- }
379
+ if (typeof e == "object")
380
+ return e.id != null ? "a linked record" : Array.isArray(e) ? `${e.length} items` : "a value";
369
381
  const t = String(e).replace(/<[^>]+>/g, "").trim();
370
382
  return t.length > 48 ? `${t.slice(0, 48)}…` : t;
371
383
  };
372
- function te(e, t) {
373
- const n = U(), a = ge(), h = !!e && t != null && t !== "", { data: y } = E({
384
+ function ne(e, t) {
385
+ const l = U(), a = _e(), f = !!e && t != null && t !== "", { data: c } = C({
374
386
  queryKey: ["cbv-collection-meta", e],
375
- queryFn: () => n.request(K(`/collections/${e}`)).then((x) => x.data),
376
- enabled: h,
387
+ queryFn: () => l.request(A(`/collections/${e}`)).then((b) => b.data),
388
+ enabled: f,
377
389
  staleTime: 10 * 6e4,
378
390
  retry: !1
379
- }), { data: c } = E({
391
+ }), { data: d } = C({
380
392
  queryKey: ["rrv-related", e, String(t)],
381
393
  queryFn: () => a(e, t).catch(() => null),
382
- enabled: h && !!y,
394
+ enabled: f && !!c,
383
395
  staleTime: 6e4,
384
396
  retry: !1
385
397
  });
386
- if (!h) return null;
387
- if (!c) return `#${String(t)}`;
388
- const u = ne(y == null ? void 0 : y.display_template, c).trim();
389
- if (u) return u;
390
- for (const x of ["name", "title", "label", "number", "email"]) if (c[x]) return String(c[x]);
391
- return `#${String(t)}`;
398
+ if (!f) return null;
399
+ if (!d) return "a linked record";
400
+ const y = le(c == null ? void 0 : c.display_template, d).trim();
401
+ if (y) return y;
402
+ for (const b of ["name", "title", "label", "number", "email"]) if (d[b]) return String(d[b]);
403
+ return "a linked record";
392
404
  }
393
- function Ae({
405
+ function Pe({
394
406
  field: e,
395
407
  from: t,
396
- to: n,
408
+ to: l,
397
409
  detail: a,
398
- relations: h,
399
- collection: y,
400
- onRevert: c
410
+ relations: f,
411
+ collection: c,
412
+ onRevert: d
401
413
  }) {
402
- var s;
403
- const u = ((s = h.find(
404
- (o) => o.many_collection === y && o.many_field === e.field && !!o.one_collection
405
- )) == null ? void 0 : s.one_collection) ?? null, x = te(u, t), _ = te(u, n), k = a ? `Unsaved — ${a}` : `Unsaved — was ${x ?? ee(t)} → now ${_ ?? ee(n)}`;
406
- return c ? (
414
+ var i;
415
+ const y = ((i = f.find(
416
+ (s) => s.many_collection === c && s.many_field === e.field && !!s.one_collection
417
+ )) == null ? void 0 : i.one_collection) ?? null, b = ne(y, t), g = ne(y, l), k = a ? `Unsaved — ${a}` : `Unsaved — was ${b ?? te(t)} → now ${g ?? te(l)}`;
418
+ return d ? (
407
419
  // biome-ignore lint/a11y/useSemanticElements: nested inside the row's <button> — a real <button> is invalid there
408
- /* @__PURE__ */ l(
420
+ /* @__PURE__ */ r(
409
421
  "span",
410
422
  {
411
423
  role: "button",
@@ -413,17 +425,17 @@ function Ae({
413
425
  "data-summary-changed": !0,
414
426
  "data-tip": `${k} · click to revert`,
415
427
  "aria-label": "Revert this change",
416
- onClick: (o) => {
417
- o.stopPropagation(), c();
428
+ onClick: (s) => {
429
+ s.stopPropagation(), d();
418
430
  },
419
- onKeyDown: (o) => {
420
- (o.key === "Enter" || o.key === " ") && (o.preventDefault(), o.stopPropagation(), c());
431
+ onKeyDown: (s) => {
432
+ (s.key === "Enter" || s.key === " ") && (s.preventDefault(), s.stopPropagation(), d());
421
433
  },
422
434
  className: "group/dot inline-flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded-full hover:bg-amber-100 dark:hover:bg-amber-500/20",
423
- children: /* @__PURE__ */ l("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 ring-2 ring-amber-100 group-hover/dot:ring-amber-200 dark:ring-amber-500/30" })
435
+ children: /* @__PURE__ */ r("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 ring-2 ring-amber-100 group-hover/dot:ring-amber-200 dark:ring-amber-500/30" })
424
436
  }
425
437
  )
426
- ) : /* @__PURE__ */ l(
438
+ ) : /* @__PURE__ */ r(
427
439
  "span",
428
440
  {
429
441
  "data-summary-changed": !0,
@@ -432,93 +444,93 @@ function Ae({
432
444
  }
433
445
  );
434
446
  }
435
- function Ge({
447
+ function ze({
436
448
  allSteps: e,
437
449
  groupedMap: t,
438
- ungroupedFields: n,
450
+ ungroupedFields: l,
439
451
  sectionGroups: a,
440
- draft: h,
441
- relations: y,
442
- collection: c,
443
- itemId: u,
444
- staging: x,
445
- errors: _,
452
+ draft: f,
453
+ relations: c,
454
+ collection: d,
455
+ itemId: y,
456
+ staging: b,
457
+ errors: g,
446
458
  staleFields: k,
447
- aliasEmptiness: s,
448
- layoutFields: o,
449
- changedFields: d,
450
- onRevertChange: g,
451
- onFieldClick: D,
452
- stagedO2MRows: N,
453
- stagedO2MDeletes: C
459
+ aliasEmptiness: i,
460
+ layoutFields: s,
461
+ changedFields: u,
462
+ onRevertChange: S,
463
+ onFieldClick: F,
464
+ stagedO2MRows: _,
465
+ stagedO2MDeletes: O
454
466
  }) {
455
- const [L, R] = Q(null), [S, m] = Q(null), b = he(/* @__PURE__ */ new Map()), r = [
456
- ...!e.some((i) => i.key === "__general__") && n.length > 0 ? [{ key: "__general__", label: "General" }] : [],
467
+ const [N, $] = z(null), [w, M] = z(null), E = he(/* @__PURE__ */ new Map()), n = [
468
+ ...!e.some((o) => o.key === "__general__") && l.length > 0 ? [{ key: "__general__", label: "General" }] : [],
457
469
  ...e
458
- ].map((i) => {
459
- const v = (i.key === "__general__" ? [...n, ...a.flatMap((q) => t[q.key] ?? [])] : t[i.key] ?? []).filter((q) => !q.hidden && !Se.has(q.field) && !we.has(q.field));
460
- return { step: i, fields: v };
461
- }).filter((i) => i.fields.length > 0), $ = new Set(r.flatMap((i) => i.fields.map((v) => v.field))), j = u && u !== "new" ? y.filter(
462
- (i) => !i.junction_field && i.many_field && i.many_collection && (i.one_collection === c || i.one_collection == null) && i.one_field != null && !$.has(i.one_field) && // Off-layout aliases stay out — the sidebar summarizes THIS layout.
463
- (!o || o.has(i.one_field))
470
+ ].map((o) => {
471
+ const L = (o.key === "__general__" ? [...l, ...a.flatMap((q) => t[q.key] ?? [])] : t[o.key] ?? []).filter((q) => !q.hidden && !Se.has(q.field) && !we.has(q.field));
472
+ return { step: o, fields: L };
473
+ }).filter((o) => o.fields.length > 0), v = new Set(n.flatMap((o) => o.fields.map((L) => L.field))), j = y && y !== "new" ? c.filter(
474
+ (o) => !o.junction_field && o.many_field && o.many_collection && (o.one_collection === d || o.one_collection == null) && o.one_field != null && !v.has(o.one_field) && // Off-layout aliases stay out — the sidebar summarizes THIS layout.
475
+ (!s || s.has(o.one_field))
464
476
  ) : [];
465
- return r.length === 0 && j.length === 0 ? null : /* @__PURE__ */ l(re.Provider, { value: { rows: N, deletes: C }, children: /* @__PURE__ */ p("div", { className: "overflow-hidden bg-white dark:bg-card", children: [
466
- /* @__PURE__ */ l("div", { className: "bg-slate-200 border-b border-slate-300 px-4 py-2.5 dark:bg-white/[0.1] dark:border-border", children: /* @__PURE__ */ l("span", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "Summary" }) }),
467
- r.map(({ step: i, fields: v }, q) => /* @__PURE__ */ p("div", { children: [
468
- /* @__PURE__ */ l(
477
+ return n.length === 0 && j.length === 0 ? null : /* @__PURE__ */ r(ie.Provider, { value: { rows: _, deletes: O }, children: /* @__PURE__ */ x("div", { className: "overflow-hidden bg-white dark:bg-card", children: [
478
+ /* @__PURE__ */ r("div", { className: "bg-slate-200 border-b border-slate-300 px-4 py-2.5 dark:bg-white/[0.1] dark:border-border", children: /* @__PURE__ */ r("span", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "Summary" }) }),
479
+ n.map(({ step: o, fields: L }, q) => /* @__PURE__ */ x("div", { children: [
480
+ /* @__PURE__ */ r(
469
481
  "div",
470
482
  {
471
- className: M(
483
+ className: D(
472
484
  "bg-slate-100 px-4 py-2 border-b border-slate-200 dark:bg-white/[0.06] dark:border-border/80",
473
485
  q > 0 && "border-t border-slate-200 dark:border-border/80"
474
486
  ),
475
- children: /* @__PURE__ */ l("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: i.label })
487
+ children: /* @__PURE__ */ r("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: o.label })
476
488
  }
477
489
  ),
478
- v.map((f, P) => {
479
- const T = h[f.field], O = f.label ?? z(f.field), A = !!(_ != null && _[f.field]), F = s == null ? void 0 : s[f.field], ce = F !== void 0 ? F === !0 : T == null || typeof T == "string" && T.trim() === "" || Array.isArray(T) && T.length === 0, de = F === null, H = !!f.required && ce && !A && !de, I = (k == null ? void 0 : k.has(f.field)) ?? !1;
480
- return /* @__PURE__ */ p(
490
+ L.map((p, I) => {
491
+ const T = f[p.field], R = p.label ?? Z(p.field), K = !!(g != null && g[p.field]), P = i == null ? void 0 : i[p.field], ce = P !== void 0 ? P === !0 : T == null || typeof T == "string" && T.trim() === "" || Array.isArray(T) && T.length === 0, de = P === null, J = !!p.required && ce && !K && !de, H = (k == null ? void 0 : k.has(p.field)) ?? !1;
492
+ return /* @__PURE__ */ x(
481
493
  "div",
482
494
  {
483
- className: M(
495
+ className: D(
484
496
  "group/row flex items-stretch",
485
- P < v.length - 1 && "border-b border-slate-100 dark:border-border/60",
486
- A ? "bg-red-50 dark:bg-red-900/10" : H || I ? "bg-amber-50/70 dark:bg-amber-900/10" : ""
497
+ I < L.length - 1 && "border-b border-slate-100 dark:border-border/60",
498
+ K ? "bg-red-50 dark:bg-red-900/10" : J || H ? "bg-amber-50/70 dark:bg-amber-900/10" : ""
487
499
  ),
488
500
  children: [
489
- /* @__PURE__ */ p(
501
+ /* @__PURE__ */ x(
490
502
  "button",
491
503
  {
492
504
  type: "button",
493
- onClick: () => D(i.key, f.field),
494
- className: M(
505
+ onClick: () => F(o.key, p.field),
506
+ className: D(
495
507
  "flex flex-1 flex-col px-4 py-2 text-left transition-colors duration-150 min-w-0",
496
- A ? "hover:bg-red-50 dark:hover:bg-red-900/15" : "hover:bg-slate-50 dark:hover:bg-white/[0.03]"
508
+ K ? "hover:bg-red-50 dark:hover:bg-red-900/15" : "hover:bg-slate-50 dark:hover:bg-white/[0.03]"
497
509
  ),
498
510
  children: [
499
- /* @__PURE__ */ p(
511
+ /* @__PURE__ */ x(
500
512
  "span",
501
513
  {
502
- className: M(
514
+ className: D(
503
515
  "flex items-center gap-1 text-[10px] font-medium truncate",
504
- A ? "text-red-500 dark:text-red-400" : H || I ? "text-amber-700 dark:text-amber-400" : "text-slate-400 dark:text-slate-500"
516
+ K ? "text-red-500 dark:text-red-400" : J || H ? "text-amber-700 dark:text-amber-400" : "text-slate-400 dark:text-slate-500"
505
517
  ),
506
518
  children: [
507
- /* @__PURE__ */ l("span", { className: "truncate", children: O }),
508
- (d == null ? void 0 : d[f.field]) && /* @__PURE__ */ l(
509
- Ae,
519
+ /* @__PURE__ */ r("span", { className: "truncate", children: R }),
520
+ (u == null ? void 0 : u[p.field]) && /* @__PURE__ */ r(
521
+ Pe,
510
522
  {
511
- field: f,
512
- from: d[f.field].from,
513
- detail: d[f.field].detail,
523
+ field: p,
524
+ from: u[p.field].from,
525
+ detail: u[p.field].detail,
514
526
  to: T,
515
- relations: y,
516
- collection: c,
517
- onRevert: g ? () => g(f.field) : void 0
527
+ relations: c,
528
+ collection: d,
529
+ onRevert: S ? () => S(p.field) : void 0
518
530
  }
519
531
  ),
520
- H && /* @__PURE__ */ l("span", { className: "shrink-0 rounded bg-amber-100 px-1 text-[9px] font-semibold uppercase tracking-wide text-amber-700 dark:bg-amber-900/30 dark:text-amber-400", children: "required" }),
521
- I && /* @__PURE__ */ l(
532
+ J && /* @__PURE__ */ r("span", { className: "shrink-0 rounded bg-amber-100 px-1 text-[9px] font-semibold uppercase tracking-wide text-amber-700 dark:bg-amber-900/30 dark:text-amber-400", children: "required" }),
533
+ H && /* @__PURE__ */ r(
522
534
  "span",
523
535
  {
524
536
  title: "This value is no longer one of the available options",
@@ -529,22 +541,22 @@ function Ge({
529
541
  ]
530
542
  }
531
543
  ),
532
- /* @__PURE__ */ l(
544
+ /* @__PURE__ */ r(
533
545
  "span",
534
546
  {
535
547
  ref: (W) => {
536
- b.current.set(f.field, W);
548
+ E.current.set(p.field, W);
537
549
  },
538
550
  className: "mt-0.5 w-full text-[12px] min-w-0 overflow-hidden",
539
- children: /* @__PURE__ */ l(
540
- Le,
551
+ children: /* @__PURE__ */ r(
552
+ Ee,
541
553
  {
542
- field: f,
554
+ field: p,
543
555
  val: T,
544
- relations: y,
545
- collection: c,
546
- itemId: u,
547
- staging: x
556
+ relations: c,
557
+ collection: d,
558
+ itemId: y,
559
+ staging: b
548
560
  }
549
561
  )
550
562
  }
@@ -552,58 +564,58 @@ function Ge({
552
564
  ]
553
565
  }
554
566
  ),
555
- /* @__PURE__ */ l(
567
+ /* @__PURE__ */ r(
556
568
  "button",
557
569
  {
558
570
  type: "button",
559
571
  title: "Copy value",
560
572
  onClick: (W) => {
561
- var Y, G;
573
+ var B, G;
562
574
  W.stopPropagation();
563
- const me = ((G = (Y = b.current.get(f.field)) == null ? void 0 : Y.textContent) == null ? void 0 : G.trim()) ?? Re(T);
575
+ const me = ((G = (B = E.current.get(p.field)) == null ? void 0 : B.textContent) == null ? void 0 : G.trim()) ?? Fe(T);
564
576
  navigator.clipboard.writeText(me).catch(() => {
565
- }), R(f.field), setTimeout(
566
- () => R((B) => B === f.field ? null : B),
577
+ }), $(p.field), setTimeout(
578
+ () => $((Q) => Q === p.field ? null : Q),
567
579
  1500
568
580
  );
569
581
  },
570
- className: M(
582
+ className: D(
571
583
  "flex items-center px-2 opacity-0 group-hover/row:opacity-100 transition-all duration-150",
572
- L === f.field ? "text-emerald-500" : "text-slate-400 hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300"
584
+ N === p.field ? "text-emerald-500" : "text-slate-400 hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300"
573
585
  ),
574
- children: L === f.field ? /* @__PURE__ */ l(ue, { className: "h-3 w-3" }) : /* @__PURE__ */ l(fe, { className: "h-3 w-3" })
586
+ children: N === p.field ? /* @__PURE__ */ r(ue, { className: "h-3 w-3" }) : /* @__PURE__ */ r(fe, { className: "h-3 w-3" })
575
587
  }
576
588
  )
577
589
  ]
578
590
  },
579
- f.field
591
+ p.field
580
592
  );
581
593
  })
582
- ] }, i.key)),
583
- j.length > 0 && /* @__PURE__ */ p("div", { children: [
584
- /* @__PURE__ */ l("div", { className: "bg-slate-100 px-4 py-2 border-y border-slate-200 dark:bg-white/[0.06] dark:border-border/80", children: /* @__PURE__ */ l("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Related" }) }),
585
- j.map((i, v) => {
586
- const q = i.one_field ?? i.many_collection ?? "", f = S === q;
587
- return /* @__PURE__ */ l(
594
+ ] }, o.key)),
595
+ j.length > 0 && /* @__PURE__ */ x("div", { children: [
596
+ /* @__PURE__ */ r("div", { className: "bg-slate-100 px-4 py-2 border-y border-slate-200 dark:bg-white/[0.06] dark:border-border/80", children: /* @__PURE__ */ r("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Related" }) }),
597
+ j.map((o, L) => {
598
+ const q = o.one_field ?? o.many_collection ?? "", p = w === q;
599
+ return /* @__PURE__ */ r(
588
600
  "div",
589
601
  {
590
- className: M(
602
+ className: D(
591
603
  "flex items-stretch",
592
- v < j.length - 1 && "border-b border-slate-100 dark:border-border/60"
604
+ L < j.length - 1 && "border-b border-slate-100 dark:border-border/60"
593
605
  ),
594
- children: /* @__PURE__ */ p(
606
+ children: /* @__PURE__ */ x(
595
607
  "button",
596
608
  {
597
609
  type: "button",
598
610
  onClick: () => {
599
- var A;
600
- const P = i.many_collection ?? "", T = /(^|_)(notes?|comments?)$/i.test(P), O = document.querySelector(`[data-o2m-collection="${P}"]`) ?? (T ? document.querySelector('[data-panel="notes"]') : null);
601
- if (!O) {
602
- m((F) => F === q ? null : q);
611
+ var K;
612
+ const I = o.many_collection ?? "", T = /(^|_)(notes?|comments?)$/i.test(I), R = document.querySelector(`[data-o2m-collection="${I}"]`) ?? (T ? document.querySelector('[data-panel="notes"]') : null);
613
+ if (!R) {
614
+ M((P) => P === q ? null : q);
603
615
  return;
604
616
  }
605
- O.getAttribute("data-panel-expanded") === "false" && ((A = O.querySelector("[data-panel-toggle]")) == null || A.click()), O.scrollIntoView({ behavior: "smooth", block: "center" }), O.classList.add("ring-2", "ring-nvr-cyan", "ring-offset-2", "rounded-md"), setTimeout(
606
- () => O.classList.remove(
617
+ R.getAttribute("data-panel-expanded") === "false" && ((K = R.querySelector("[data-panel-toggle]")) == null || K.click()), R.scrollIntoView({ behavior: "smooth", block: "center" }), R.classList.add("ring-2", "ring-nvr-cyan", "ring-offset-2", "rounded-md"), setTimeout(
618
+ () => R.classList.remove(
607
619
  "ring-2",
608
620
  "ring-nvr-cyan",
609
621
  "ring-offset-2",
@@ -614,41 +626,43 @@ function Ge({
614
626
  },
615
627
  className: "flex flex-1 flex-col px-4 py-2 min-w-0 text-left transition-colors hover:bg-nvr-cyan/5",
616
628
  children: [
617
- /* @__PURE__ */ p("span", { className: "flex items-center gap-1 text-[10px] font-medium truncate text-slate-400 dark:text-slate-500", children: [
618
- /* @__PURE__ */ l(
629
+ /* @__PURE__ */ x("span", { className: "flex items-center gap-1 text-[10px] font-medium truncate text-slate-400 dark:text-slate-500", children: [
630
+ /* @__PURE__ */ r(
619
631
  ye,
620
632
  {
621
- className: M(
633
+ className: D(
622
634
  "h-3 w-3 shrink-0 transition-transform",
623
- f && "rotate-90"
635
+ p && "rotate-90"
624
636
  )
625
637
  }
626
638
  ),
627
- z(i.one_field ?? i.many_collection ?? "")
639
+ Z(o.one_field ?? o.many_collection ?? "")
628
640
  ] }),
629
- /* @__PURE__ */ l("span", { className: "mt-0.5 text-[12px]", children: /* @__PURE__ */ l(
630
- oe,
641
+ /* @__PURE__ */ r("span", { className: "mt-0.5 text-[12px]", children: /* @__PURE__ */ r(
642
+ se,
631
643
  {
632
- relatedCollection: i.many_collection ?? "",
633
- manyField: i.many_field,
634
- parentId: u,
635
- expanded: f
644
+ relatedCollection: o.many_collection ?? "",
645
+ manyField: o.many_field,
646
+ parentId: y,
647
+ expanded: p
636
648
  }
637
649
  ) })
638
650
  ]
639
651
  }
640
652
  )
641
653
  },
642
- i.id ?? `${i.many_collection}.${i.many_field}`
654
+ o.id ?? `${o.many_collection}.${o.many_field}`
643
655
  );
644
656
  })
645
657
  ] })
646
658
  ] }) });
647
659
  }
648
660
  export {
649
- ie as M2OSummaryValue,
650
- Le as SummaryFieldValue,
651
- Ge as SummaryPanel,
652
- Me as summaryChoiceLabel,
653
- De as summaryPlainText
661
+ Y as M2OSummaryValue,
662
+ Ee as SummaryFieldValue,
663
+ ze as SummaryPanel,
664
+ Me as o2mItemRelation,
665
+ je as o2mRowLabel,
666
+ De as summaryChoiceLabel,
667
+ Ke as summaryPlainText
654
668
  };