@nivaro/react 0.3.15 → 0.3.17

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 (37) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +127 -6
  4. package/dist/index.js +736 -734
  5. package/dist/shared/components/CollectionBrowserView.js +2344 -2309
  6. package/dist/shared/components/ItemEditForm.js +3773 -3604
  7. package/dist/shared/components/RecordGridEditor.js +319 -282
  8. package/dist/shared/components/RecordReadView.js +202 -200
  9. package/dist/shared/components/cbv/unknown-fields.js +18 -8
  10. package/dist/shared/components/chat/ChatAnalyticsView.js +2 -2
  11. package/dist/shared/components/import/DocumentAutofillButton.js +148 -142
  12. package/dist/shared/components/item-edit/CatalogPickerField.js +264 -276
  13. package/dist/shared/components/item-edit/FieldRenderer.js +136 -133
  14. package/dist/shared/components/item-edit/FieldRow.js +198 -184
  15. package/dist/shared/components/item-edit/HeaderTools.js +107 -99
  16. package/dist/shared/components/item-edit/InlineTableField.js +138 -136
  17. package/dist/shared/components/item-edit/RecordLiveSync.js +1 -0
  18. package/dist/shared/components/item-edit/RelationCombobox.js +30 -23
  19. package/dist/shared/components/item-edit/SummaryPanel.js +334 -294
  20. package/dist/shared/components/item-edit/column-length.js +12 -0
  21. package/dist/shared/components/panels/AccessDeniedPanel.js +47 -37
  22. package/dist/shared/components/panels/ItemLockBanner.js +307 -285
  23. package/dist/shared/components/panels/PipelinePanel.js +486 -465
  24. package/dist/shared/components/panels/RevisionsPanel.js +210 -204
  25. package/dist/shared/components/pipeline/PipelineEditorView.js +1672 -1568
  26. package/dist/shared/components/profile/DelegationCard.js +178 -121
  27. package/dist/shared/components/profile/PersonActivity.js +152 -139
  28. package/dist/shared/components/queue/QueueWorklist.js +668 -659
  29. package/dist/shared/components/queue/transition-note.js +90 -0
  30. package/dist/shared/components/support/SupportRequestDialog.js +100 -89
  31. package/dist/shared/components/support/TicketDetailSheet.js +104 -91
  32. package/dist/shared/lib/autofill-runs.js +33 -26
  33. package/dist/shared/lib/draft-store.js +40 -24
  34. package/dist/shared/lib/live-queries.js +10 -9
  35. package/dist/shared/lib/request-gate.js +140 -127
  36. package/dist/shared/lib/restore-skipped.js +10 -0
  37. package/package.json +1 -1
@@ -1,28 +1,28 @@
1
1
  import { jsx as r, jsxs as u, Fragment as he } from "react/jsx-runtime";
2
2
  import { useQuery as V, useQueryClient as qt } from "@tanstack/react-query";
3
3
  import { Pencil as Tt, ChevronDown as Ct } from "lucide-react";
4
- import { useMemo as ge, useRef as Ot, useState as Z, useEffect as be, useCallback as st, Fragment as At } from "react";
5
- import { DrilldownContext as Rt, useNivaroClient as Ce, useApiFetchConfig as Dt, useDrilldown as ct } from "../context.js";
4
+ import { useMemo as ge, useRef as Ot, useState as Z, useEffect as be, useCallback as dt, Fragment as At } from "react";
5
+ import { DrilldownContext as Rt, useNivaroClient as Ce, useApiFetchConfig as Dt, useDrilldown as ut } from "../context.js";
6
6
  import { useDebounced as Lt } from "../hooks/useDebounced.js";
7
7
  import { parseAllowedCollections as Pt } from "../lib/allowed-collections.js";
8
8
  import { get as G } from "../lib/commands.js";
9
- import { readGroupStructure as Kt, isFolded as jt, isEmptyValue as Be, planFieldGrid as Et } from "../lib/form-structure.js";
9
+ import { readGroupStructure as Kt, isFolded as jt, isEmptyValue as Ge, planFieldGrid as Et } from "../lib/form-structure.js";
10
10
  import { useLiveRecord as It } from "../lib/live.js";
11
11
  import { isDisplayFormulaField as qe, resolvePlacementText as Wt, displayFormulaOf as Mt, formatDisplayValue as Ut } from "../lib/placement-behaviour.js";
12
12
  import { useRecordReader as Vt } from "../lib/record-loader.js";
13
13
  import { sanitizeHtml as Bt } from "../lib/sanitize-html.js";
14
- import { titleCase as Ge, formatRelative as Te } from "../lib/utils.js";
14
+ import { titleCase as Je, formatRelative as Te } from "../lib/utils.js";
15
15
  import { InboundRequestPopover as Gt } from "./integrations/InboundRequest.js";
16
16
  import { FileM2MField as Jt } from "./item-edit/FilePickerField.js";
17
17
  import { useFieldTouches as Ht } from "./item-edit/HeaderFreshness.js";
18
18
  import { richTextToPlain as Qt } from "./item-edit/helpers.js";
19
19
  import { usePlacementTextContext as zt, evaluateDisplayFormula as Yt } from "./item-edit/placement-behaviour.js";
20
- import { UserChip as ut } from "./item-edit/UserChip.js";
20
+ import { UserChip as mt } from "./item-edit/UserChip.js";
21
21
  import { DesignNode as Xt } from "./layout-editor/DesignNode.js";
22
22
  import { DesignCanvas as Zt } from "./layout-editor/design-canvas.js";
23
23
  import { revealGroupKey as el } from "./layout-editor/design-context.js";
24
24
  import { useRecordIntegrity as tl, integrityByField as ll } from "./panels/RecordIntegrityBanner.js";
25
- import { SimpleSelectXs as dt } from "./ui/SimpleSelect.js";
25
+ import { SimpleSelectXs as ot } from "./ui/SimpleSelect.js";
26
26
  import { WidgetSlot as rl } from "./WidgetSlot.js";
27
27
  const pe = (n) => {
28
28
  if (!n) return {};
@@ -32,12 +32,12 @@ const pe = (n) => {
32
32
  } catch {
33
33
  return {};
34
34
  }
35
- }, mt = (n) => {
35
+ }, ft = (n) => {
36
36
  const m = String(n).match(/^(\d{4})-(\d{2})-(\d{2})(?:[T ]00:00:00(?:\.0+)?(?:Z|[+-]00:?00)?)?$/);
37
37
  if (m) return `${m[2]}/${m[3]}/${m[1]}`;
38
38
  const y = new Date(String(n));
39
39
  return Number.isNaN(y.getTime()) ? String(n) : `${String(y.getMonth() + 1).padStart(2, "0")}/${String(y.getDate()).padStart(2, "0")}/${y.getFullYear()}`;
40
- }, Je = (n) => {
40
+ }, He = (n) => {
41
41
  const m = Number(n);
42
42
  return Number.isNaN(m) ? String(n) : `$${m.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
43
43
  }, Ie = (n) => {
@@ -58,7 +58,7 @@ const pe = (n) => {
58
58
  }
59
59
  @media (min-width:1536px){[data-read-dl="full"]{grid-template-columns:repeat(6,minmax(0,1fr))}}
60
60
  `;
61
- function ft({
61
+ function We({
62
62
  value: n,
63
63
  trueTone: m = "positive"
64
64
  }) {
@@ -72,7 +72,7 @@ function ft({
72
72
  );
73
73
  }
74
74
  function al({ collection: n, id: m }) {
75
- const y = Ce(), c = Vt(), P = ct(), { data: w } = V({
75
+ const y = Ce(), c = Vt(), P = ut(), { data: w } = V({
76
76
  queryKey: ["cbv-collection-meta", n],
77
77
  queryFn: () => y.request(
78
78
  G(`/collections/${n}`)
@@ -149,7 +149,7 @@ function il({ id: n }) {
149
149
  }
150
150
  );
151
151
  }
152
- const He = ({ collection: n, id: m }) => n === "nivaro_files" ? /* @__PURE__ */ r(il, { id: m }) : /* @__PURE__ */ r(al, { collection: n, id: m });
152
+ const Qe = ({ collection: n, id: m }) => n === "nivaro_files" ? /* @__PURE__ */ r(il, { id: m }) : /* @__PURE__ */ r(al, { collection: n, id: m });
153
153
  function sl({
154
154
  junction: n,
155
155
  parentFk: m,
@@ -167,7 +167,7 @@ function sl({
167
167
  retry: !1
168
168
  }), h = ((_ == null ? void 0 : _.relations) ?? []).find(
169
169
  (v) => v.many_collection === n && v.many_field === y
170
- ), q = Pt(h == null ? void 0 : h.one_allowed_collections), K = !!h && !h.one_collection && (q.length > 0 || !!h.one_collection_field), M = (h == null ? void 0 : h.one_collection_field) ?? "collection", S = (v) => v ? v === "directus_users" ? "nivaro_users" : v : null, x = (h == null ? void 0 : h.one_collection) ?? (K ? q.some((v) => v === "directus_users" || v === "nivaro_users") ? "nivaro_users" : S(q[0]) : null), { data: g } = V({
170
+ ), q = Pt(h == null ? void 0 : h.one_allowed_collections), K = !!h && !h.one_collection && (q.length > 0 || !!h.one_collection_field), M = (h == null ? void 0 : h.one_collection_field) ?? "collection", S = (v) => v ? v === "directus_users" ? "nivaro_users" : v : null, x = (h == null ? void 0 : h.one_collection) ?? (K ? q.some((v) => v === "directus_users" || v === "nivaro_users") ? "nivaro_users" : S(q[0]) : null), { data: b } = V({
171
171
  queryKey: ["rrv-m2m", n, m, c, y, K ? M : ""],
172
172
  queryFn: () => W.request(
173
173
  G(`/items/${n}`, {
@@ -188,12 +188,12 @@ function sl({
188
188
  enabled: !!_,
189
189
  staleTime: 3e4,
190
190
  retry: !1
191
- }), C = g == null ? void 0 : g.map((v) => v.id), k = x ?? (K ? ((j = g == null ? void 0 : g.find((v) => v.collection)) == null ? void 0 : j.collection) ?? null : null), O = C == null ? void 0 : C.length;
191
+ }), C = b == null ? void 0 : b.map((v) => v.id), k = x ?? (K ? ((j = b == null ? void 0 : b.find((v) => v.collection)) == null ? void 0 : j.collection) ?? null : null), O = C == null ? void 0 : C.length;
192
192
  return be(() => {
193
193
  O !== void 0 && (P == null || P(O));
194
194
  }, [O, P]), be(() => {
195
195
  k && (w == null || w(k));
196
- }, [k, w]), _ && !k && (!K || g) ? /* @__PURE__ */ r(ee, {}) : !C || !k ? /* @__PURE__ */ r("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) : C.length === 0 ? /* @__PURE__ */ r(ee, {}) : k === "nivaro_files" && $ ? /* @__PURE__ */ r("div", { className: "mt-1", children: /* @__PURE__ */ r(
196
+ }, [k, w]), _ && !k && (!K || b) ? /* @__PURE__ */ r(ee, {}) : !C || !k ? /* @__PURE__ */ r("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) : C.length === 0 ? /* @__PURE__ */ r(ee, {}) : k === "nivaro_files" && $ ? /* @__PURE__ */ r("div", { className: "mt-1", children: /* @__PURE__ */ r(
197
197
  Jt,
198
198
  {
199
199
  relation: $,
@@ -201,12 +201,12 @@ function sl({
201
201
  allRelations: [],
202
202
  disabled: !0
203
203
  }
204
- ) }) : /* @__PURE__ */ r("span", { className: "flex flex-wrap gap-x-1.5 gap-y-0.5", children: (g ?? []).map(({ id: v, collection: N }, F) => /* @__PURE__ */ u(
204
+ ) }) : /* @__PURE__ */ r("span", { className: "flex flex-wrap gap-x-1.5 gap-y-0.5", children: (b ?? []).map(({ id: v, collection: N }, F) => /* @__PURE__ */ u(
205
205
  "span",
206
206
  {
207
207
  className: "inline-flex items-center whitespace-nowrap",
208
208
  children: [
209
- /* @__PURE__ */ r(He, { collection: N ?? k, id: v }),
209
+ /* @__PURE__ */ r(Qe, { collection: N ?? k, id: v }),
210
210
  F < C.length - 1 && /* @__PURE__ */ r("span", { className: "text-slate-300 dark:text-slate-600", children: "," })
211
211
  ]
212
212
  },
@@ -222,10 +222,10 @@ function dl({
222
222
  defaultPreset: w,
223
223
  onCount: $
224
224
  }) {
225
- const W = Ce(), _ = ct(), h = (P ?? []).filter((t) => t && Array.isArray(t.columns)), [q, K] = Z(
225
+ const W = Ce(), _ = ut(), h = (P ?? []).filter((t) => t && Array.isArray(t.columns)), [q, K] = Z(
226
226
  () => {
227
227
  var t;
228
- return h.length >= 2 ? ((t = h.find((i) => i.name === w)) == null ? void 0 : t.name) ?? h[0].name : "__all__";
228
+ return h.length >= 2 ? ((t = h.find((a) => a.name === w)) == null ? void 0 : t.name) ?? h[0].name : "__all__";
229
229
  }
230
230
  ), { data: M } = V({
231
231
  queryKey: ["cbv-collection-meta", n],
@@ -233,19 +233,19 @@ function dl({
233
233
  staleTime: 10 * 6e4,
234
234
  retry: !1
235
235
  }), S = (t) => {
236
- var i;
237
- return ((i = ((M == null ? void 0 : M.relations) ?? []).find(
238
- (o) => o.many_collection === n && o.many_field === t && o.one_collection
239
- )) == null ? void 0 : i.one_collection) ?? null;
236
+ var a;
237
+ return ((a = ((M == null ? void 0 : M.relations) ?? []).find(
238
+ (d) => d.many_collection === n && d.many_field === t && d.one_collection
239
+ )) == null ? void 0 : a.one_collection) ?? null;
240
240
  }, { data: x } = V({
241
241
  queryKey: ["rrv-cols", n, c ?? null],
242
242
  queryFn: () => W.request(
243
243
  G(`/field-config/${n}`, c ? { layout_id: c } : {})
244
244
  ).then((t) => ({
245
245
  // Lines carry their own number — sort by it and show it first.
246
- lineNo: (t.data ?? []).some((i) => i.field === "line_number"),
246
+ lineNo: (t.data ?? []).some((a) => a.field === "line_number"),
247
247
  cols: (t.data ?? []).filter(
248
- (i) => !i.hidden && !i.field.startsWith("__") && (!i.field.includes(".") || i.interface === "relation-path") && i.field !== m && ((c ? i.layout_assigned : !0) ?? !0) && (i.interface === "relation-path" || [
248
+ (a) => !a.hidden && !a.field.startsWith("__") && (!a.field.includes(".") || a.interface === "relation-path") && a.field !== m && ((c ? a.layout_assigned : !0) ?? !0) && (a.interface === "relation-path" || [
249
249
  "string",
250
250
  "text",
251
251
  "integer",
@@ -256,23 +256,23 @@ function dl({
256
256
  "datetime",
257
257
  "timestamp",
258
258
  "uuid"
259
- ].includes(i.type ?? ""))
260
- ).filter((i, o, f) => f.findIndex((T) => T.field === i.field) === o)
259
+ ].includes(a.type ?? ""))
260
+ ).filter((a, d, f) => f.findIndex((T) => T.field === a.field) === d)
261
261
  })),
262
262
  staleTime: 5 * 6e4,
263
263
  retry: !1
264
- }), g = (x == null ? void 0 : x.cols) ?? [], C = !!(x != null && x.lineNo), k = q !== "__all__" ? h.find((t) => t.name === q) : null, O = ge(() => {
265
- if (!k) return g;
266
- const t = new Set(k.columns), i = g.filter((o) => t.has(o.field));
267
- return i.length > 0 ? i : g;
268
- }, [g, k]), [j, v] = Z(""), [N, F] = Z(1), [ne, J] = Z({}), Y = Lt(ne, 350), Oe = ge(() => {
264
+ }), b = (x == null ? void 0 : x.cols) ?? [], C = !!(x != null && x.lineNo), k = q !== "__all__" ? h.find((t) => t.name === q) : null, O = ge(() => {
265
+ if (!k) return b;
266
+ const t = new Set(k.columns), a = b.filter((d) => t.has(d.field));
267
+ return a.length > 0 ? a : b;
268
+ }, [b, k]), [j, v] = Z(""), [N, F] = Z(1), [ne, J] = Z({}), Y = Lt(ne, 350), Oe = ge(() => {
269
269
  const t = [
270
270
  { path: [m], op: "_eq", value: y }
271
271
  ];
272
- for (const [i, o] of Object.entries(Y)) {
273
- if (!(o != null && o.value.trim())) continue;
274
- const f = o.value.trim(), T = Number(f), D = o.op === "_contains" ? f : f === "true" || f === "false" ? f === "true" : Number.isNaN(T) ? f : T;
275
- t.push({ path: [i], op: o.op, value: D });
272
+ for (const [a, d] of Object.entries(Y)) {
273
+ if (!(d != null && d.value.trim())) continue;
274
+ const f = d.value.trim(), T = Number(f), D = d.op === "_contains" ? f : f === "true" || f === "false" ? f === "true" : Number.isNaN(T) ? f : T;
275
+ t.push({ path: [a], op: d.op, value: D });
276
276
  }
277
277
  return JSON.stringify(t);
278
278
  }, [Y, m, y]), p = 25, {
@@ -311,13 +311,13 @@ function dl({
311
311
  ).then((t) => t.data ?? { rows: {}, targets: {} }).catch(() => ({ rows: {}, targets: {} })),
312
312
  enabled: ce.length > 0 && ue.length > 0,
313
313
  staleTime: 3e4
314
- }), R = C && A.some((t) => t.line_number != null), ye = Math.max(1, Math.ceil(X / p)), ae = (t, i, o) => {
314
+ }), R = C && A.some((t) => t.line_number != null), ye = Math.max(1, Math.ceil(X / p)), ae = (t, a, d) => {
315
315
  F(1), J((f) => {
316
316
  const T = { ...f };
317
- return o ? T[t] = { op: i, value: o } : delete T[t], T;
317
+ return d ? T[t] = { op: a, value: d } : delete T[t], T;
318
318
  });
319
- }, We = (t) => {
320
- F(1), v((i) => i === t ? `-${t}` : i === `-${t}` ? "" : t);
319
+ }, Me = (t) => {
320
+ F(1), v((a) => a === t ? `-${t}` : a === `-${t}` ? "" : t);
321
321
  };
322
322
  if (oe)
323
323
  return /* @__PURE__ */ r("div", { className: "space-y-1.5 py-2", children: [0, 1, 2].map((t) => /* @__PURE__ */ r(
@@ -329,14 +329,14 @@ function dl({
329
329
  )) });
330
330
  if (A.length === 0 && Object.keys(Y).length === 0)
331
331
  return /* @__PURE__ */ r("p", { className: "py-3 text-[12px] text-slate-400", children: "No records" });
332
- const Me = (t, i) => {
332
+ const Ue = (t, a) => {
333
333
  var D, te;
334
- if (i.field.includes(".")) {
335
- const le = (D = Q == null ? void 0 : Q.rows[String(t.id)]) == null ? void 0 : D[i.field];
334
+ if (a.field.includes(".")) {
335
+ const le = (D = Q == null ? void 0 : Q.rows[String(t.id)]) == null ? void 0 : D[a.field];
336
336
  if (!Q)
337
337
  return /* @__PURE__ */ r("span", { className: "inline-block h-3 w-14 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" });
338
338
  if (!le || le.value === "") return /* @__PURE__ */ r(ee, {});
339
- const Pe = Q.targets[i.field], me = (te = le.ids) == null ? void 0 : te[0];
339
+ const Pe = Q.targets[a.field], me = (te = le.ids) == null ? void 0 : te[0];
340
340
  return _ && Pe && me ? /* @__PURE__ */ r(
341
341
  "button",
342
342
  {
@@ -349,39 +349,40 @@ function dl({
349
349
  }
350
350
  ) : le.value;
351
351
  }
352
- const o = t[i.field];
353
- if (o == null || o === "") return /* @__PURE__ */ r(ee, {});
354
- const f = S(i.field);
352
+ const d = t[a.field];
353
+ if (a.type === "boolean" && d == null) return /* @__PURE__ */ r(We, { value: !1 });
354
+ if (d == null || d === "") return /* @__PURE__ */ r(ee, {});
355
+ const f = S(a.field);
355
356
  if (f === "nivaro_users")
356
- return /* @__PURE__ */ r("span", { className: "inline-block", children: /* @__PURE__ */ r(ut, { userId: String(o), size: "compact" }) });
357
- if (f) return /* @__PURE__ */ r(He, { collection: f, id: o });
358
- if (i.type === "boolean") return /* @__PURE__ */ r(ft, { value: o });
359
- if (i.type === "decimal" || i.type === "float") return Je(o);
360
- if (i.type === "integer") return Ie(o);
361
- if (i.type === "date" || i.type === "datetime" || i.type === "timestamp") return mt(o);
362
- const T = String(o);
357
+ return /* @__PURE__ */ r("span", { className: "inline-block", children: /* @__PURE__ */ r(mt, { userId: String(d), size: "compact" }) });
358
+ if (f) return /* @__PURE__ */ r(Qe, { collection: f, id: d });
359
+ if (a.type === "boolean") return /* @__PURE__ */ r(We, { value: d });
360
+ if (a.type === "decimal" || a.type === "float") return He(d);
361
+ if (a.type === "integer") return Ie(d);
362
+ if (a.type === "date" || a.type === "datetime" || a.type === "timestamp") return ft(d);
363
+ const T = String(d);
363
364
  return T.length > 48 ? `${T.slice(0, 48)}…` : T;
364
365
  }, ie = (t) => ["decimal", "float", "integer"].includes(t.type ?? "") && !S(t.field) && !t.field.includes("."), Re = (t) => {
365
- const i = t.options;
366
- if (!i) return {};
367
- if (typeof i == "string")
366
+ const a = t.options;
367
+ if (!a) return {};
368
+ if (typeof a == "string")
368
369
  try {
369
- return JSON.parse(i);
370
+ return JSON.parse(a);
370
371
  } catch {
371
372
  return {};
372
373
  }
373
- return i;
374
+ return a;
374
375
  }, xe = (t) => {
375
- const i = Re(t).aggregate;
376
- return typeof i == "string" && ["sum", "avg", "min", "max", "count"].includes(i) ? i : null;
376
+ const a = Re(t).aggregate;
377
+ return typeof a == "string" && ["sum", "avg", "min", "max", "count"].includes(a) ? a : null;
377
378
  }, De = O.some((t) => xe(t)), ve = (t) => {
378
- const i = xe(t);
379
- if (!i) return null;
380
- const o = A.map((D) => Number(D[t.field])).filter((D) => !Number.isNaN(D));
379
+ const a = xe(t);
380
+ if (!a) return null;
381
+ const d = A.map((D) => Number(D[t.field])).filter((D) => !Number.isNaN(D));
381
382
  let f = null;
382
- if (i === "count" ? f = A.length : o.length > 0 && (i === "sum" ? f = o.reduce((D, te) => D + te, 0) : i === "avg" ? f = o.reduce((D, te) => D + te, 0) / o.length : i === "min" ? f = Math.min(...o) : i === "max" && (f = Math.max(...o))), f === null) return "—";
383
+ if (a === "count" ? f = A.length : d.length > 0 && (a === "sum" ? f = d.reduce((D, te) => D + te, 0) : a === "avg" ? f = d.reduce((D, te) => D + te, 0) / d.length : a === "min" ? f = Math.min(...d) : a === "max" && (f = Math.max(...d))), f === null) return "—";
383
384
  const T = Re(t).format;
384
- return i === "count" || T === "int" ? Ie(Math.round(f)) : T === "currency" || t.type === "decimal" || t.type === "float" ? Je(f) : i === "avg" ? f.toFixed(2) : Ie(f);
385
+ return a === "count" || T === "int" ? Ie(Math.round(f)) : T === "currency" || t.type === "decimal" || t.type === "float" ? He(f) : a === "avg" ? f.toFixed(2) : Ie(f);
385
386
  }, _e = (t) => !S(t.field) && !t.field.includes("."), Le = (t) => S(t.field) || t.field.includes(".") ? null : t.type === "boolean" ? "bool" : ["integer", "decimal", "float"].includes(t.type ?? "") ? "num" : ["string", "text"].includes(t.type ?? "") ? "text" : null, ke = O.some((t) => Le(t) != null);
386
387
  return /* @__PURE__ */ u("div", { children: [
387
388
  h.length >= 2 && /* @__PURE__ */ r("div", { className: "mb-1.5 flex flex-wrap items-center gap-1", "data-read-presets": !0, children: [
@@ -407,15 +408,15 @@ function dl({
407
408
  /* @__PURE__ */ u("tr", { className: "border-b border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800", children: [
408
409
  R && /* @__PURE__ */ r("th", { className: "h-7 w-8 px-2 text-right text-[9.5px] font-bold uppercase tracking-wider text-slate-400", children: "#" }),
409
410
  O.map((t) => {
410
- const i = j === t.field || j === `-${t.field}`;
411
+ const a = j === t.field || j === `-${t.field}`;
411
412
  return /* @__PURE__ */ u(
412
413
  "th",
413
414
  {
414
- onClick: () => _e(t) && We(t.field),
415
+ onClick: () => _e(t) && Me(t.field),
415
416
  className: `h-7 select-none whitespace-nowrap px-2.5 text-[9.5px] font-bold uppercase tracking-wider text-slate-500 dark:text-slate-400 ${ie(t) ? "text-right" : "text-left"} ${_e(t) ? "cursor-pointer hover:text-slate-700 dark:hover:text-slate-200" : ""}`,
416
417
  children: [
417
- t.label || Ge(t.field),
418
- _e(t) && /* @__PURE__ */ r("span", { className: i ? "ml-0.5 text-[#00a5cc]" : "ml-0.5 text-slate-300", children: i ? j.startsWith("-") ? "▼" : "▲" : "⇅" })
418
+ t.label || Je(t.field),
419
+ _e(t) && /* @__PURE__ */ r("span", { className: a ? "ml-0.5 text-[#00a5cc]" : "ml-0.5 text-slate-300", children: a ? j.startsWith("-") ? "▼" : "▲" : "⇅" })
419
420
  ]
420
421
  },
421
422
  t.field
@@ -425,24 +426,24 @@ function dl({
425
426
  ke && /* @__PURE__ */ u("tr", { className: "border-b border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800", children: [
426
427
  R && /* @__PURE__ */ r("th", { className: "px-1.5 py-1" }),
427
428
  O.map((t) => {
428
- const i = Le(t), o = ne[t.field];
429
+ const a = Le(t), d = ne[t.field];
429
430
  return /* @__PURE__ */ u("th", { className: "px-1.5 py-1 font-normal", children: [
430
- i === "text" && /* @__PURE__ */ r(
431
+ a === "text" && /* @__PURE__ */ r(
431
432
  "input",
432
433
  {
433
- value: (o == null ? void 0 : o.value) ?? "",
434
+ value: (d == null ? void 0 : d.value) ?? "",
434
435
  onChange: (f) => ae(t.field, "_contains", f.target.value),
435
436
  placeholder: "Filter…",
436
437
  "aria-label": `Filter ${t.field}`,
437
438
  className: "h-6 w-full min-w-[56px] rounded border border-slate-200 bg-white px-1.5 text-[10.5px] font-normal normal-case tracking-normal outline-none focus:border-nvr-cyan/50 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-100"
438
439
  }
439
440
  ),
440
- i === "num" && /* @__PURE__ */ u("span", { className: "flex items-center gap-0.5", children: [
441
+ a === "num" && /* @__PURE__ */ u("span", { className: "flex items-center gap-0.5", children: [
441
442
  /* @__PURE__ */ r(
442
- dt,
443
+ ot,
443
444
  {
444
- value: (o == null ? void 0 : o.op) ?? "_eq",
445
- onChange: (f) => ae(t.field, f, (o == null ? void 0 : o.value) ?? ""),
445
+ value: (d == null ? void 0 : d.op) ?? "_eq",
446
+ onChange: (f) => ae(t.field, f, (d == null ? void 0 : d.value) ?? ""),
446
447
  options: [
447
448
  { value: "_eq", label: "=" },
448
449
  { value: "_gte", label: "≥" },
@@ -455,17 +456,17 @@ function dl({
455
456
  "input",
456
457
  {
457
458
  type: "number",
458
- value: (o == null ? void 0 : o.value) ?? "",
459
- onChange: (f) => ae(t.field, (o == null ? void 0 : o.op) ?? "_eq", f.target.value),
459
+ value: (d == null ? void 0 : d.value) ?? "",
460
+ onChange: (f) => ae(t.field, (d == null ? void 0 : d.op) ?? "_eq", f.target.value),
460
461
  "aria-label": `Filter ${t.field}`,
461
462
  className: "h-6 w-full min-w-[48px] rounded border border-slate-200 bg-white px-1 text-[10.5px] font-normal outline-none focus:border-nvr-cyan/50 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-100"
462
463
  }
463
464
  )
464
465
  ] }),
465
- i === "bool" && /* @__PURE__ */ r(
466
- dt,
466
+ a === "bool" && /* @__PURE__ */ r(
467
+ ot,
467
468
  {
468
- value: (o == null ? void 0 : o.value) ?? "",
469
+ value: (d == null ? void 0 : d.value) ?? "",
469
470
  onChange: (f) => ae(t.field, "_eq", f),
470
471
  options: [
471
472
  { value: "", label: "All" },
@@ -496,13 +497,13 @@ function dl({
496
497
  className: `border-b border-slate-100 last:border-0 dark:border-slate-800 ${_ ? "cursor-pointer hover:bg-nvr-cyan/5 dark:hover:bg-nvr-cyan/10" : ""}`,
497
498
  children: [
498
499
  R && /* @__PURE__ */ r("td", { className: "px-2 py-1.5 text-right text-[11px] tabular-nums text-slate-400", children: t.line_number == null ? "" : String(t.line_number) }),
499
- O.map((i) => /* @__PURE__ */ r(
500
+ O.map((a) => /* @__PURE__ */ r(
500
501
  "td",
501
502
  {
502
- className: `whitespace-nowrap px-2.5 py-1.5 text-[12px] text-slate-700 dark:text-slate-200 ${ie(i) ? "text-right" : ""}`,
503
- children: Me(t, i)
503
+ className: `whitespace-nowrap px-2.5 py-1.5 text-[12px] text-slate-700 dark:text-slate-200 ${ie(a) ? "text-right" : ""}`,
504
+ children: Ue(t, a)
504
505
  },
505
- i.field
506
+ a.field
506
507
  ))
507
508
  ]
508
509
  },
@@ -517,13 +518,13 @@ function dl({
517
518
  children: [
518
519
  R && /* @__PURE__ */ r("td", {}),
519
520
  O.map((t) => {
520
- const i = xe(t);
521
+ const a = xe(t);
521
522
  return /* @__PURE__ */ r(
522
523
  "td",
523
524
  {
524
525
  className: `whitespace-nowrap px-2.5 py-1.5 ${ie(t) ? "text-right" : ""}`,
525
- children: i && /* @__PURE__ */ u(he, { children: [
526
- /* @__PURE__ */ r("span", { className: "mr-1 font-mono text-[10px] text-slate-400", children: i.toUpperCase() }),
526
+ children: a && /* @__PURE__ */ u(he, { children: [
527
+ /* @__PURE__ */ r("span", { className: "mr-1 font-mono text-[10px] text-slate-400", children: a.toUpperCase() }),
527
528
  /* @__PURE__ */ r("span", { className: "tabular-nums", children: ve(t) })
528
529
  ] })
529
530
  },
@@ -575,7 +576,7 @@ function dl({
575
576
  ] })
576
577
  ] });
577
578
  }
578
- function ot({
579
+ function ct({
579
580
  collection: n,
580
581
  itemId: m,
581
582
  layoutData: y,
@@ -587,8 +588,8 @@ function ot({
587
588
  onEditSection: _,
588
589
  gridCounts: h
589
590
  }) {
590
- var et;
591
- const q = Ce(), K = zt(), M = c ? c.record ?? {} : null, S = !!(c != null && c.context.showHidden), x = c ? String(((et = c.record) == null ? void 0 : et.id) ?? "") : m ?? "", g = ge(
591
+ var tt;
592
+ const q = Ce(), K = zt(), M = c ? c.record ?? {} : null, S = !!(c != null && c.context.showHidden), x = c ? String(((tt = c.record) == null ? void 0 : tt.id) ?? "") : m ?? "", b = ge(
592
593
  () => c ? {
593
594
  ...c.layout,
594
595
  layout: c.layout.layout ?? { id: 0, name: "" }
@@ -601,10 +602,10 @@ function ot({
601
602
  }), k = (e, l, s = !1) => c ? /* @__PURE__ */ r(Xt, { target: e, children: s ? /* @__PURE__ */ r("div", { "data-design-hidden": !0, className: "opacity-40", children: l }) : l }) : l, O = ge(
602
603
  () => [
603
604
  ...new Set(
604
- (c ? [] : (g == null ? void 0 : g.assignments) ?? []).map((e) => e.field).filter((e) => e && !e.startsWith("__") && !e.includes("."))
605
+ (c ? [] : (b == null ? void 0 : b.assignments) ?? []).map((e) => e.field).filter((e) => e && !e.startsWith("__") && !e.includes("."))
605
606
  )
606
607
  ].sort(),
607
- [g, c]
608
+ [b, c]
608
609
  ), { data: j } = Ht(n, x, O), v = (e) => {
609
610
  const l = j == null ? void 0 : j[e];
610
611
  if (!l) return null;
@@ -650,7 +651,7 @@ function ot({
650
651
  ), ne = ({ field: e }) => {
651
652
  const l = F == null ? void 0 : F.get(e);
652
653
  if (!l || l.length === 0) return null;
653
- const s = l.map((d) => d.message || d.rule).join(`
654
+ const s = l.map((o) => o.message || o.rule).join(`
654
655
  `);
655
656
  return /* @__PURE__ */ r(
656
657
  "span",
@@ -690,7 +691,7 @@ function ot({
690
691
  const e = B.current;
691
692
  if (B.current = p ?? null, c || !e || !p || e === p) return;
692
693
  const l = Object.keys(p).filter(
693
- (d) => !d.startsWith("__") && JSON.stringify(e[d]) !== JSON.stringify(p[d])
694
+ (o) => !o.startsWith("__") && JSON.stringify(e[o]) !== JSON.stringify(p[o])
694
695
  );
695
696
  if (l.length === 0) return;
696
697
  Ae(new Set(l));
@@ -698,10 +699,10 @@ function ot({
698
699
  return () => clearTimeout(s);
699
700
  }, [p, c]);
700
701
  const A = (e) => oe.has(e) ? " nvr-value-pulse-bg rounded-sm" : "", { data: X } = V({
701
- queryKey: ["rrv-field-config", n, g.layout.id],
702
+ queryKey: ["rrv-field-config", n, b.layout.id],
702
703
  enabled: !c,
703
704
  queryFn: () => q.request(
704
- G(`/field-config/${n}`, { layout_id: g.layout.id })
705
+ G(`/field-config/${n}`, { layout_id: b.layout.id })
705
706
  ).then((e) => e.data ?? []).catch(() => null),
706
707
  staleTime: 5 * 6e4,
707
708
  retry: !1
@@ -718,23 +719,23 @@ function ot({
718
719
  ) ?? null, R = (e) => {
719
720
  var l;
720
721
  return !((e.is_visible === void 0 || e.is_visible) && pe(e.overrides).hidden !== !0 && !((l = H.get(e.field)) != null && l.hidden));
721
- }, ye = g.assignments.filter(
722
+ }, ye = b.assignments.filter(
722
723
  (e) => (!e.field.startsWith("__") || qe(e.field)) && (S || !R(e))
723
- ), ae = g.assignments.filter(
724
+ ), ae = b.assignments.filter(
724
725
  (e) => e.field.startsWith("__widget_") && e.widget_id != null && (S || e.is_visible === void 0 || !!e.is_visible)
725
- ), We = (e) => {
726
+ ), Me = (e) => {
726
727
  if (!e.input_bindings) return [];
727
728
  try {
728
729
  return JSON.parse(String(e.input_bindings));
729
730
  } catch {
730
731
  return [];
731
732
  }
732
- }, Me = w || c ? g.assignments.filter(
733
+ }, Ue = w || c ? b.assignments.filter(
733
734
  (e) => e.field.startsWith("__") && !e.field.startsWith("__widget_") && !qe(e.field) && (S || e.is_visible === void 0 || !!e.is_visible)
734
- ).sort((e, l) => e.sort - l.sort) : [], ie = ["__pipeline__", "__addendums__"], Re = new Set(ie), xe = (e) => (w == null ? void 0 : w(e.field, e)) ?? (c ? /* @__PURE__ */ r("div", { className: "rounded-xl border border-dashed border-slate-300 bg-white px-5 py-3 text-[12px] font-medium text-slate-500 dark:border-slate-600 dark:bg-slate-900/40 dark:text-slate-400", children: e.label_override || Ge(e.field.replace(/^_+|_+$/g, "")) }) : null), De = (e, l = "trailing") => w || c ? Me.filter(
735
+ ).sort((e, l) => e.sort - l.sort) : [], ie = ["__pipeline__", "__addendums__"], Re = new Set(ie), xe = (e) => (w == null ? void 0 : w(e.field, e)) ?? (c ? /* @__PURE__ */ r("div", { className: "rounded-xl border border-dashed border-slate-300 bg-white px-5 py-3 text-[12px] font-medium text-slate-500 dark:border-slate-600 dark:bg-slate-900/40 dark:text-slate-400", children: e.label_override || Je(e.field.replace(/^_+|_+$/g, "")) }) : null), De = (e, l = "trailing") => w || c ? Ue.filter(
735
736
  (s) => e === null ? s.group_key == null && l === "leading" === Re.has(s.field) : s.group_key === e
736
737
  ).sort(
737
- (s, d) => l === "leading" && e === null ? ie.indexOf(s.field) - ie.indexOf(d.field) : 0
738
+ (s, o) => l === "leading" && e === null ? ie.indexOf(s.field) - ie.indexOf(o.field) : 0
738
739
  ).map((s) => ({ key: s.field, a: s, node: xe(s) })).filter((s) => s.node != null) : [], ve = (e, l = "trailing") => {
739
740
  const s = De(e, l);
740
741
  return s.length === 0 ? null : /* @__PURE__ */ r(
@@ -742,65 +743,65 @@ function ot({
742
743
  {
743
744
  className: l === "leading" ? "mb-4 space-y-4" : "mt-3 space-y-4",
744
745
  "data-read-live-slots": l,
745
- children: s.map((d) => /* @__PURE__ */ r("div", { children: k(
746
- { kind: "slot", field: d.a.field, group_key: d.a.group_key ?? null },
747
- d.node,
748
- R(d.a)
749
- ) }, d.key))
746
+ children: s.map((o) => /* @__PURE__ */ r("div", { children: k(
747
+ { kind: "slot", field: o.a.field, group_key: o.a.group_key ?? null },
748
+ o.node,
749
+ R(o.a)
750
+ ) }, o.key))
750
751
  }
751
752
  );
752
- }, [_e, Le] = Z({}), ke = (e) => S || _e[e] === !0, [t, i] = Z({}), o = st(
753
- (e) => (l) => i((s) => s[e] === l ? s : { ...s, [e]: l }),
753
+ }, [_e, Le] = Z({}), ke = (e) => S || _e[e] === !0, [t, a] = Z({}), d = dt(
754
+ (e) => (l) => a((s) => s[e] === l ? s : { ...s, [e]: l }),
754
755
  []
755
- ), [f, T] = Z({}), D = st(
756
+ ), [f, T] = Z({}), D = dt(
756
757
  (e) => (l) => T((s) => s[e] === l ? s : { ...s, [e]: l }),
757
758
  []
758
759
  ), te = (e) => {
759
- const l = ae.filter((d) => d.group_key === e).sort((d, b) => d.sort - b.sort);
760
+ const l = ae.filter((o) => o.group_key === e).sort((o, g) => o.sort - g.sort);
760
761
  if (l.length === 0) return null;
761
- const s = l.some((d) => ke(d.field));
762
- return /* @__PURE__ */ r("div", { className: s ? "mt-3 space-y-4" : "hidden", "data-read-widgets": !0, children: l.map((d) => /* @__PURE__ */ r("div", { hidden: !ke(d.field), children: k(
763
- { kind: "slot", field: d.field, group_key: d.group_key ?? null },
762
+ const s = l.some((o) => ke(o.field));
763
+ return /* @__PURE__ */ r("div", { className: s ? "mt-3 space-y-4" : "hidden", "data-read-widgets": !0, children: l.map((o) => /* @__PURE__ */ r("div", { hidden: !ke(o.field), children: k(
764
+ { kind: "slot", field: o.field, group_key: o.group_key ?? null },
764
765
  /* @__PURE__ */ r(
765
766
  rl,
766
767
  {
767
- widgetId: d.widget_id,
768
- inputBindings: We(d),
768
+ widgetId: o.widget_id,
769
+ inputBindings: Me(o),
769
770
  itemDraft: p ?? {},
770
771
  itemCollection: n,
771
772
  ready: !!p,
772
- label: d.label_override ?? void 0,
773
- defaultExpanded: d.default_expanded == null ? !0 : !!d.default_expanded,
774
- onContentChange: (b) => Le(
775
- (E) => E[d.field] === b ? E : { ...E, [d.field]: b }
773
+ label: o.label_override ?? void 0,
774
+ defaultExpanded: o.default_expanded == null ? !0 : !!o.default_expanded,
775
+ onContentChange: (g) => Le(
776
+ (E) => E[o.field] === g ? E : { ...E, [o.field]: g }
776
777
  )
777
778
  }
778
779
  ),
779
- R(d)
780
- ) }, d.field)) });
781
- }, le = [...g.groups].sort((e, l) => e.sort - l.sort).filter((e) => S || e.visibility_mode !== "new_only"), [Pe, me] = Z(() => /* @__PURE__ */ new Set()), fe = (e) => !e.is_collapsed || Pe.has(e.key), pt = (e) => me((l) => {
780
+ R(o)
781
+ ) }, o.field)) });
782
+ }, le = [...b.groups].sort((e, l) => e.sort - l.sort).filter((e) => S || e.visibility_mode !== "new_only"), [Pe, me] = Z(() => /* @__PURE__ */ new Set()), fe = (e) => !e.is_collapsed || Pe.has(e.key), pt = (e) => me((l) => {
782
783
  const s = new Set(l);
783
784
  return s.has(e) ? s.delete(e) : s.add(e), s;
784
785
  }), Ne = (c == null ? void 0 : c.context.fold) ?? null, we = (c == null ? void 0 : c.context.reveal) ?? null;
785
786
  be(() => {
786
- Ne && me(Ne.open ? new Set(g.groups.map((e) => e.key)) : /* @__PURE__ */ new Set());
787
+ Ne && me(Ne.open ? new Set(b.groups.map((e) => e.key)) : /* @__PURE__ */ new Set());
787
788
  }, [Ne == null ? void 0 : Ne.seq]), be(() => {
788
789
  const e = we ? el(we.target) : null;
789
790
  e && me((l) => l.has(e) ? l : new Set(l).add(e));
790
791
  }, [we == null ? void 0 : we.seq]);
791
- const Ue = [];
792
+ const Ve = [];
792
793
  for (const e of le) {
793
794
  if (e.type === "container") {
794
795
  for (const l of le.filter((s) => s.container_id != null && s.container_id === e.id))
795
- Ue.push(l);
796
+ Ve.push(l);
796
797
  continue;
797
798
  }
798
- e.container_id == null && Ue.push(e);
799
+ e.container_id == null && Ve.push(e);
799
800
  }
800
801
  const se = (e) => {
801
802
  var l;
802
803
  return !!((l = Q(e.field)) != null && l.junction_field);
803
- }, Qe = (e) => {
804
+ }, ze = (e) => {
804
805
  var s;
805
806
  const l = String(
806
807
  pe(e.overrides).interface ?? ((s = H.get(e.field)) == null ? void 0 : s.interface) ?? ""
@@ -812,47 +813,48 @@ function ot({
812
813
  const L = Mt(s), de = Yt((L == null ? void 0 : L.expr) ?? "", p ?? {});
813
814
  return /* @__PURE__ */ r("span", { "data-display-formula": e.field, className: "tabular-nums", children: de.error ? "—" : Ut(de.value, L ?? { format: "", currency: null }) });
814
815
  }
815
- const d = Q(e.field);
816
- if (c && !x && (d != null && d.junction_field)) return /* @__PURE__ */ r(ee, {});
817
- if (d != null && d.junction_field && d.many_collection && d.many_field)
816
+ const o = Q(e.field);
817
+ if (c && !x && (o != null && o.junction_field)) return /* @__PURE__ */ r(ee, {});
818
+ if (o != null && o.junction_field && o.many_collection && o.many_field)
818
819
  return /* @__PURE__ */ r(
819
820
  sl,
820
821
  {
821
- junction: d.many_collection,
822
- parentFk: d.many_field,
823
- junctionField: d.junction_field,
822
+ junction: o.many_collection,
823
+ parentFk: o.many_field,
824
+ junctionField: o.junction_field,
824
825
  parentId: x,
825
- onCount: o(e.field),
826
+ onCount: d(e.field),
826
827
  onTarget: D(e.field),
827
- relation: d
828
+ relation: o
828
829
  }
829
830
  );
830
- const b = p == null ? void 0 : p[e.field], E = ue(e.field);
831
- if (E === "nivaro_users" && b != null)
832
- return /* @__PURE__ */ r("span", { className: "inline-block", children: /* @__PURE__ */ r(ut, { userId: String(b), size: "compact" }) });
833
- if (E) return /* @__PURE__ */ r(He, { collection: E, id: b });
834
- if (b == null || b === "") return /* @__PURE__ */ r(ee, {});
831
+ const g = p == null ? void 0 : p[e.field], E = ue(e.field);
832
+ if (E === "nivaro_users" && g != null)
833
+ return /* @__PURE__ */ r("span", { className: "inline-block", children: /* @__PURE__ */ r(mt, { userId: String(g), size: "compact" }) });
834
+ if (E) return /* @__PURE__ */ r(Qe, { collection: E, id: g });
835
+ if ((l == null ? void 0 : l.type) === "boolean" && (g == null || g === "")) return /* @__PURE__ */ r(We, { value: !1 });
836
+ if (g == null || g === "") return /* @__PURE__ */ r(ee, {});
835
837
  if ((l == null ? void 0 : l.type) === "boolean")
836
838
  return /* @__PURE__ */ r(
837
- ft,
839
+ We,
838
840
  {
839
- value: b,
841
+ value: g,
840
842
  trueTone: (s.options ?? {}).trueTone ?? "positive"
841
843
  }
842
844
  );
843
845
  const z = s.options ?? {};
844
- return Qe(e) && typeof b == "string" ? /^\s*\{/.test(b) ? /* @__PURE__ */ r("div", { className: "min-w-0 whitespace-pre-wrap font-normal [overflow-wrap:anywhere]", children: Qt(b) }) : /* @__PURE__ */ r(
846
+ return ze(e) && typeof g == "string" ? /^\s*\{/.test(g) ? /* @__PURE__ */ r("div", { className: "min-w-0 whitespace-pre-wrap font-normal [overflow-wrap:anywhere]", children: Qt(g) }) : /* @__PURE__ */ r(
845
847
  "div",
846
848
  {
847
849
  className: "rrv-prose min-w-0 font-normal leading-relaxed [overflow-wrap:anywhere] [&_a]:underline [&_h1]:text-[15px] [&_h1]:font-semibold [&_h2]:text-[14px] [&_h2]:font-semibold [&_h3]:font-semibold [&_li]:ml-4 [&_ol]:list-decimal [&_p]:my-1 [&_ul]:list-disc",
848
- dangerouslySetInnerHTML: { __html: Bt(b) }
850
+ dangerouslySetInnerHTML: { __html: Bt(g) }
849
851
  }
850
- ) : z.format === "currency" ? /* @__PURE__ */ r("span", { className: "tabular-nums", children: Je(b) }) : (l == null ? void 0 : l.type) === "decimal" || (l == null ? void 0 : l.type) === "float" ? /* @__PURE__ */ r("span", { className: "tabular-nums", children: Ie(b) }) : (l == null ? void 0 : l.type) === "date" || (l == null ? void 0 : l.type) === "datetime" || (l == null ? void 0 : l.type) === "timestamp" ? mt(b) : String(b);
852
+ ) : z.format === "currency" ? /* @__PURE__ */ r("span", { className: "tabular-nums", children: He(g) }) : (l == null ? void 0 : l.type) === "decimal" || (l == null ? void 0 : l.type) === "float" ? /* @__PURE__ */ r("span", { className: "tabular-nums", children: Ie(g) }) : (l == null ? void 0 : l.type) === "date" || (l == null ? void 0 : l.type) === "datetime" || (l == null ? void 0 : l.type) === "timestamp" ? ft(g) : String(g);
851
853
  }, ht = (e) => {
852
854
  const l = pe(e.overrides), s = Q(e.field);
853
855
  if (!(s != null && s.many_collection) || !s.many_field) return null;
854
856
  if (c && !x) return /* @__PURE__ */ r("p", { className: "py-3 text-[12px] text-slate-400", children: "No records" });
855
- const d = l.options ?? {}, b = (() => {
857
+ const o = l.options ?? {}, g = (() => {
856
858
  var L;
857
859
  const z = (L = H.get(e.field)) == null ? void 0 : L.options;
858
860
  if (!z) return {};
@@ -863,7 +865,7 @@ function ot({
863
865
  return {};
864
866
  }
865
867
  return z;
866
- })(), E = d.layout_id ?? null;
868
+ })(), E = o.layout_id ?? null;
867
869
  return /* @__PURE__ */ r(
868
870
  dl,
869
871
  {
@@ -871,64 +873,64 @@ function ot({
871
873
  fkField: s.many_field,
872
874
  parentId: x,
873
875
  layoutId: E,
874
- presets: d.column_presets ?? b.column_presets,
875
- defaultPreset: d.default_preset ?? b.default_preset ?? null,
876
- onCount: o(e.field)
876
+ presets: o.column_presets ?? g.column_presets,
877
+ defaultPreset: o.default_preset ?? g.default_preset ?? null,
878
+ onCount: d(e.field)
877
879
  },
878
880
  e.field
879
881
  );
880
- }, Se = (e) => !!Q(e.field) && !se(e), gt = !!g.layout.hide_empty, ze = Array.isArray(g.layout.header_fields) ? g.layout.header_fields.filter((e) => typeof e == "string") : [], bt = new Set(ze), yt = (e) => {
882
+ }, Se = (e) => !!Q(e.field) && !se(e), gt = !!b.layout.hide_empty, Ye = Array.isArray(b.layout.header_fields) ? b.layout.header_fields.filter((e) => typeof e == "string") : [], bt = new Set(Ye), yt = (e) => {
881
883
  if (!p || se(e)) return !1;
882
884
  const l = p[e.field];
883
885
  return l == null || l === "" || Array.isArray(l) && l.length === 0;
884
886
  }, xt = (e) => ye.find((l) => l.field === e), $e = (e) => {
885
- var d;
887
+ var o;
886
888
  const l = pe(e.overrides).label, s = K ? Wt(e.overrides, K).label : void 0;
887
- return s !== void 0 ? s : qe(e.field) ? typeof l == "string" && l.trim() ? l : "Formula" : typeof l == "string" && l.trim() ? l : e.label_override || ((d = H.get(e.field)) == null ? void 0 : d.label) || Ge(e.field);
889
+ return s !== void 0 ? s : qe(e.field) ? typeof l == "string" && l.trim() ? l : "Formula" : typeof l == "string" && l.trim() ? l : e.label_override || ((o = H.get(e.field)) == null ? void 0 : o.label) || Je(e.field);
888
890
  }, vt = (e) => {
889
- const l = Kt(e.swap_config), s = ye.filter((a) => a.group_key === e.key && !bt.has(a.field)).filter((a) => S || !p || !jt(a.overrides) || !Be(p[a.field])).sort((a, I) => a.sort - I.sort), d = ae.filter((a) => a.group_key === e.key), b = De(e.key), E = s.length === 0 && d.length === 0 && b.length === 0;
891
+ const l = Kt(e.swap_config), s = ye.filter((i) => i.group_key === e.key && !bt.has(i.field)).filter((i) => S || !p || !jt(i.overrides) || !Ge(p[i.field])).sort((i, I) => i.sort - I.sort), o = ae.filter((i) => i.group_key === e.key), g = De(e.key), E = s.length === 0 && o.length === 0 && g.length === 0;
890
892
  if (E && !c) return null;
891
- const z = (a) => gt && !S && (Se(a) || se(a)) && ((h == null ? void 0 : h[a.field]) ?? t[a.field]) === 0, L = s.filter((a) => !Se(a)), de = s.filter(Se), tt = d.filter((a) => ke(a.field)), kt = s.filter((a) => !z(a)), Nt = !E && kt.length === 0 && b.length === 0 && tt.length === 0, wt = (a) => (h == null ? void 0 : h[a.field]) ?? t[a.field], Ve = !!l.emptyText && !!p && !c && b.length === 0 && tt.length === 0 && s.every((a) => Se(a) || se(a) ? wt(a) === 0 : Be(p[a.field])), St = Et(L, { rows: l.rows }).units, lt = e.read_width === "full" || e.read_width === "half" || e.read_width === "third" ? e.read_width : de.length > 0 || d.length > 0 || b.length > 0 || L.length > 4 ? "full" : "half", $t = (a) => {
892
- var nt, at, it;
893
- if (z(a)) return null;
894
- const Fe = !!(pe(a.overrides).options ?? {}).emphasis, U = Qe(a) || !!((at = (nt = H.get(a.field)) == null ? void 0 : nt.interface) != null && at.includes("rich-text")), je = p == null ? void 0 : p[a.field], rt = !U && !se(a) && !ue(a.field) && (String(((it = H.get(a.field)) == null ? void 0 : it.interface) ?? "").includes("textarea") || typeof je == "string" && je.length > 36);
893
+ const z = (i) => gt && !S && (Se(i) || se(i)) && ((h == null ? void 0 : h[i.field]) ?? t[i.field]) === 0, L = s.filter((i) => !Se(i)), de = s.filter(Se), lt = o.filter((i) => ke(i.field)), kt = s.filter((i) => !z(i)), Nt = !E && kt.length === 0 && g.length === 0 && lt.length === 0, wt = (i) => (h == null ? void 0 : h[i.field]) ?? t[i.field], Be = !!l.emptyText && !!p && !c && g.length === 0 && lt.length === 0 && s.every((i) => Se(i) || se(i) ? wt(i) === 0 : Ge(p[i.field])), St = Et(L, { rows: l.rows }).units, rt = e.read_width === "full" || e.read_width === "half" || e.read_width === "third" ? e.read_width : de.length > 0 || o.length > 0 || g.length > 0 || L.length > 4 ? "full" : "half", $t = (i) => {
894
+ var at, it, st;
895
+ if (z(i)) return null;
896
+ const Fe = !!(pe(i.overrides).options ?? {}).emphasis, U = ze(i) || !!((it = (at = H.get(i.field)) == null ? void 0 : at.interface) != null && it.includes("rich-text")), je = p == null ? void 0 : p[i.field], nt = !U && !se(i) && !ue(i.field) && (String(((st = H.get(i.field)) == null ? void 0 : st.interface) ?? "").includes("textarea") || typeof je == "string" && je.length > 36);
895
897
  return /* @__PURE__ */ r(
896
898
  "div",
897
899
  {
898
- className: `min-w-0 ${U || se(a) && (f[a.field] === "nivaro_files" || (t[a.field] ?? 0) > 3) ? "col-span-full" : Fe || rt ? "col-span-2" : ""}`,
900
+ className: `min-w-0 ${U || se(i) && (f[i.field] === "nivaro_files" || (t[i.field] ?? 0) > 3) ? "col-span-full" : Fe || nt ? "col-span-2" : ""}`,
899
901
  children: k(
900
- C(a),
902
+ C(i),
901
903
  /* @__PURE__ */ u(he, { children: [
902
904
  /* @__PURE__ */ u("dt", { className: Ee, children: [
903
- $e(a),
904
- /* @__PURE__ */ r(ne, { field: a.field }),
905
- v(a.field)
905
+ $e(i),
906
+ /* @__PURE__ */ r(ne, { field: i.field }),
907
+ v(i.field)
906
908
  ] }),
907
909
  /* @__PURE__ */ r(
908
910
  "dd",
909
911
  {
910
- "data-replay-field": a.field,
912
+ "data-replay-field": i.field,
911
913
  "data-field-collection": n,
912
- "data-remote-changed": oe.has(a.field) || void 0,
913
- className: `mt-1 min-w-0${A(a.field)} ${Fe ? "text-[17px] font-semibold tracking-[-0.01em] text-slate-900 dark:text-white" : `${se(a) || U ? "" : rt ? "line-clamp-3 break-words " : "truncate "}text-[13px] font-medium text-slate-800 dark:text-slate-100`}`,
914
- children: p ? Ke(a) : /* @__PURE__ */ r("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
914
+ "data-remote-changed": oe.has(i.field) || void 0,
915
+ className: `mt-1 min-w-0${A(i.field)} ${Fe ? "text-[17px] font-semibold tracking-[-0.01em] text-slate-900 dark:text-white" : `${se(i) || U ? "" : nt ? "line-clamp-3 break-words " : "truncate "}text-[13px] font-medium text-slate-800 dark:text-slate-100`}`,
916
+ children: p ? Ke(i) : /* @__PURE__ */ r("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
915
917
  }
916
918
  )
917
919
  ] }),
918
- R(a)
920
+ R(i)
919
921
  )
920
922
  },
921
- a.field
923
+ i.field
922
924
  );
923
- }, Ft = (a, I) => {
924
- const Fe = p && !c ? I.filter((U) => !Be(p[U.field])) : I;
925
+ }, Ft = (i, I) => {
926
+ const Fe = p && !c ? I.filter((U) => !Ge(p[U.field])) : I;
925
927
  return /* @__PURE__ */ u(
926
928
  "div",
927
929
  {
928
- "data-read-row": a.key,
930
+ "data-read-row": i.key,
929
931
  className: `min-w-0 ${I.length > 2 ? "col-span-full" : "col-span-2"}`,
930
932
  children: [
931
- /* @__PURE__ */ r("dt", { className: Ee, children: a.label.trim() || I.map($e).join(" / ") }),
933
+ /* @__PURE__ */ r("dt", { className: Ee, children: i.label.trim() || I.map($e).join(" / ") }),
932
934
  /* @__PURE__ */ r("dd", { className: "mt-1 flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-[13px] font-medium text-slate-800 dark:text-slate-100", children: p ? Fe.length === 0 ? /* @__PURE__ */ r(ee, {}) : Fe.map((U, je) => /* @__PURE__ */ u(At, { children: [
933
935
  je > 0 && /* @__PURE__ */ r("span", { "aria-hidden": !0, className: "text-slate-300 dark:text-slate-600", children: "·" }),
934
936
  k(
@@ -947,7 +949,7 @@ function ot({
947
949
  ] }, U.field)) : /* @__PURE__ */ r("span", { className: "inline-block h-3.5 w-28 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) })
948
950
  ]
949
951
  },
950
- `row:${a.key}`
952
+ `row:${i.key}`
951
953
  );
952
954
  };
953
955
  return /* @__PURE__ */ r(
@@ -955,7 +957,7 @@ function ot({
955
957
  {
956
958
  hidden: Nt,
957
959
  "data-read-section": e.key,
958
- "data-read-width": lt,
960
+ "data-read-width": rt,
959
961
  className: "min-w-0 rounded-xl border border-slate-200 bg-white dark:border-slate-700/60 dark:bg-slate-900/40",
960
962
  children: k(
961
963
  { kind: "group", key: e.key },
@@ -981,8 +983,8 @@ function ot({
981
983
  type: "button",
982
984
  "data-read-edit-section": e.key,
983
985
  onClick: () => {
984
- var a, I;
985
- return _(e.key, ((a = L[0]) == null ? void 0 : a.field) ?? ((I = de[0]) == null ? void 0 : I.field) ?? null);
986
+ var i, I;
987
+ return _(e.key, ((i = L[0]) == null ? void 0 : i.field) ?? ((I = de[0]) == null ? void 0 : I.field) ?? null);
986
988
  },
987
989
  title: `Edit ${e.label}`,
988
990
  "aria-label": `Edit ${e.label}`,
@@ -1001,7 +1003,7 @@ function ot({
1001
1003
  }
1002
1004
  ),
1003
1005
  /* @__PURE__ */ u("div", { className: "px-5 pb-5 pt-4", hidden: !fe(e), children: [
1004
- Ve && /* @__PURE__ */ r(
1006
+ Be && /* @__PURE__ */ r(
1005
1007
  "p",
1006
1008
  {
1007
1009
  "data-read-empty": e.key,
@@ -1009,39 +1011,39 @@ function ot({
1009
1011
  children: l.emptyText
1010
1012
  }
1011
1013
  ),
1012
- L.length > 0 && !Ve && // One column rhythm for the whole page: every section's facts sit
1014
+ L.length > 0 && !Be && // One column rhythm for the whole page: every section's facts sit
1013
1015
  // on the same 2 / 3 / 4 / 6 tracks, so values line up card to
1014
1016
  // card instead of each card auto-filling its own grid.
1015
- /* @__PURE__ */ r("dl", { className: "grid gap-x-6 gap-y-5", "data-read-dl": lt, children: St.map(
1016
- (a) => a.kind === "row" ? Ft(a.row, a.members) : $t(a.field)
1017
+ /* @__PURE__ */ r("dl", { className: "grid gap-x-6 gap-y-5", "data-read-dl": rt, children: St.map(
1018
+ (i) => i.kind === "row" ? Ft(i.row, i.members) : $t(i.field)
1017
1019
  ) }),
1018
- de.map((a) => {
1020
+ de.map((i) => {
1019
1021
  var I;
1020
1022
  return /* @__PURE__ */ r(
1021
1023
  "div",
1022
1024
  {
1023
1025
  className: L.length > 0 ? "mt-3" : "",
1024
- hidden: z(a) || Ve,
1026
+ hidden: z(i) || Be,
1025
1027
  children: k(
1026
- C(a),
1028
+ C(i),
1027
1029
  /* @__PURE__ */ u(he, { children: [
1028
- (I = F == null ? void 0 : F.get(a.field)) != null && I.length ? /* @__PURE__ */ u("div", { className: "mb-1.5 flex items-center gap-1.5 text-[11px] font-medium text-amber-700 dark:text-amber-300", children: [
1029
- /* @__PURE__ */ r("span", { children: $e(a) }),
1030
- /* @__PURE__ */ r(ne, { field: a.field }),
1030
+ (I = F == null ? void 0 : F.get(i.field)) != null && I.length ? /* @__PURE__ */ u("div", { className: "mb-1.5 flex items-center gap-1.5 text-[11px] font-medium text-amber-700 dark:text-amber-300", children: [
1031
+ /* @__PURE__ */ r("span", { children: $e(i) }),
1032
+ /* @__PURE__ */ r(ne, { field: i.field }),
1031
1033
  /* @__PURE__ */ u("span", { className: "font-normal text-amber-700/80 dark:text-amber-300/80", children: [
1032
1034
  "— ",
1033
- F.get(a.field).length,
1035
+ F.get(i.field).length,
1034
1036
  " line issue",
1035
- F.get(a.field).length === 1 ? "" : "s",
1037
+ F.get(i.field).length === 1 ? "" : "s",
1036
1038
  "; switch to Edit to fix"
1037
1039
  ] })
1038
1040
  ] }) : null,
1039
- (W ? W(a) : null) ?? ht(a)
1041
+ (W ? W(i) : null) ?? ht(i)
1040
1042
  ] }),
1041
- R(a)
1043
+ R(i)
1042
1044
  )
1043
1045
  },
1044
- a.field
1046
+ i.field
1045
1047
  );
1046
1048
  }),
1047
1049
  te(e.key),
@@ -1061,14 +1063,14 @@ function ot({
1061
1063
  },
1062
1064
  e.key
1063
1065
  );
1064
- }, Ye = ve(null), _t = ve(null, "leading"), Xe = ze.map((e) => xt(e)).filter((e) => !!e && !Se(e)).filter((e) => S || !yt(e)), [re, ...Ze] = Xe;
1066
+ }, Xe = ve(null), _t = ve(null, "leading"), Ze = Ye.map((e) => xt(e)).filter((e) => !!e && !Se(e)).filter((e) => S || !yt(e)), [re, ...et] = Ze;
1065
1067
  return /* @__PURE__ */ u(
1066
1068
  "div",
1067
1069
  {
1068
1070
  className: P ? "min-h-0 flex-1" : "min-h-0 flex-1 overflow-y-auto bg-slate-50/60 px-5 py-4 dark:bg-transparent",
1069
1071
  children: [
1070
1072
  _t,
1071
- Xe.length > 0 && /* @__PURE__ */ u(
1073
+ Ze.length > 0 && /* @__PURE__ */ u(
1072
1074
  "div",
1073
1075
  {
1074
1076
  "data-read-header": !0,
@@ -1093,7 +1095,7 @@ function ot({
1093
1095
  ] }),
1094
1096
  R(re)
1095
1097
  ),
1096
- Ze.length > 0 && /* @__PURE__ */ r("dl", { className: "mt-3 flex flex-wrap gap-x-8 gap-y-2", children: Ze.map((e) => /* @__PURE__ */ r("div", { className: "min-w-0", children: k(
1098
+ et.length > 0 && /* @__PURE__ */ r("dl", { className: "mt-3 flex flex-wrap gap-x-8 gap-y-2", children: et.map((e) => /* @__PURE__ */ r("div", { className: "min-w-0", children: k(
1097
1099
  { kind: "header", field: e.field },
1098
1100
  /* @__PURE__ */ u(he, { children: [
1099
1101
  /* @__PURE__ */ u("dt", { className: Ee, children: [
@@ -1118,18 +1120,18 @@ function ot({
1118
1120
  }
1119
1121
  ),
1120
1122
  /* @__PURE__ */ r("style", { children: nl }),
1121
- J ? /* @__PURE__ */ r("div", { className: "grid items-stretch gap-4", "data-read-board": !0, children: Ue.map(vt) }) : /* @__PURE__ */ u("div", { className: "flex flex-col gap-4", "data-read-board-pending": !0, children: [
1123
+ J ? /* @__PURE__ */ r("div", { className: "grid items-stretch gap-4", "data-read-board": !0, children: Ve.map(vt) }) : /* @__PURE__ */ u("div", { className: "flex flex-col gap-4", "data-read-board-pending": !0, children: [
1122
1124
  /* @__PURE__ */ r("div", { className: "h-32 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
1123
1125
  /* @__PURE__ */ r("div", { className: "h-32 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
1124
1126
  /* @__PURE__ */ r("div", { className: "h-56 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
1125
1127
  ] }),
1126
- Ye && /* @__PURE__ */ r("div", { className: "mt-4", children: Ye })
1128
+ Xe && /* @__PURE__ */ r("div", { className: "mt-4", children: Xe })
1127
1129
  ]
1128
1130
  }
1129
1131
  );
1130
1132
  }
1131
1133
  function Kl(n) {
1132
- return n.design ? /* @__PURE__ */ r(Zt, { design: n.design.context, onRefusedWrite: n.design.onRefusedWrite, children: /* @__PURE__ */ r(Rt.Provider, { value: null, children: /* @__PURE__ */ r(ot, { ...n }) }) }) : /* @__PURE__ */ r(ot, { ...n });
1134
+ return n.design ? /* @__PURE__ */ r(Zt, { design: n.design.context, onRefusedWrite: n.design.onRefusedWrite, children: /* @__PURE__ */ r(Rt.Provider, { value: null, children: /* @__PURE__ */ r(ct, { ...n }) }) }) : /* @__PURE__ */ r(ct, { ...n });
1133
1135
  }
1134
1136
  export {
1135
1137
  Kl as RecordReadView