@nivaro/react 0.3.72 → 0.3.74

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.
@@ -1,38 +1,39 @@
1
- import { jsx as r, jsxs as p, Fragment as ce } from "react/jsx-runtime";
2
- import { useQuery as U, useQueryClient as Pt } from "@tanstack/react-query";
3
- import { Pencil as jt, ChevronDown as Kt } from "lucide-react";
4
- import { useMemo as xe, useRef as Wt, useState as X, useEffect as ve, useCallback as ht, Fragment as It } from "react";
5
- import { DrilldownContext as Ut, useNivaroClient as Ce, useApiFetchConfig as Vt, useDrilldown as xt } from "../context.js";
1
+ import { jsx as t, jsxs as p, Fragment as me } from "react/jsx-runtime";
2
+ import { useQuery as V, useQueryClient as xt } from "@tanstack/react-query";
3
+ import { Pencil as Kt, ChevronDown as jt } from "lucide-react";
4
+ import { useMemo as ve, useRef as Wt, useState as Q, useEffect as _e, useCallback as ht, Fragment as It } from "react";
5
+ import { DrilldownContext as Ut, useNivaroClient as ke, useApiFetchConfig as Vt, useDrilldown as vt } from "../context.js";
6
6
  import { useDebounced as Bt } from "../hooks/useDebounced.js";
7
7
  import { parseAllowedCollections as Ht } from "../lib/allowed-collections.js";
8
- import { get as Q } from "../lib/commands.js";
9
- import { readGroupStructure as Gt, isFolded as Jt, isEmptyValue as ge, planFieldGrid as Qt } from "../lib/form-structure.js";
10
- import { quietHiddenSectionsOf as Yt } from "../lib/layout-resolve.js";
11
- import { useLiveRecord as zt } from "../lib/live.js";
12
- import { isDisplayFormulaField as Re, resolvePlacementText as Xt, displayFormulaOf as Zt, formatDisplayValue as el } from "../lib/placement-behaviour.js";
13
- import { useRecordReader as tl } from "../lib/record-loader.js";
14
- import { sanitizeHtml as ll } from "../lib/sanitize-html.js";
8
+ import { get as Y, patch as Gt } from "../lib/commands.js";
9
+ import { toastError as Jt } from "../lib/error-toast.js";
10
+ import { readGroupStructure as Qt, isFolded as Yt, isEmptyValue as ye, planFieldGrid as zt } from "../lib/form-structure.js";
11
+ import { quietHiddenSectionsOf as Xt } from "../lib/layout-resolve.js";
12
+ import { useLiveRecord as Zt } from "../lib/live.js";
13
+ import { isDisplayFormulaField as Ce, resolvePlacementText as el, displayFormulaOf as tl, formatDisplayValue as ll } from "../lib/placement-behaviour.js";
14
+ import { invalidateRecordRow as rl, useRecordReader as nl } from "../lib/record-loader.js";
15
+ import { sanitizeHtml as al } from "../lib/sanitize-html.js";
15
16
  import { titleCase as Ze, formatRelative as Le } from "../lib/utils.js";
16
- import { matchesVisibleWhen as rl } from "../lib/visible-when.js";
17
- import { InboundRequestPopover as nl } from "./integrations/InboundRequest.js";
18
- import { FileM2MField as al } from "./item-edit/FilePickerField.js";
19
- import { useFieldTouches as il } from "./item-edit/HeaderFreshness.js";
20
- import { richTextToPlain as sl } from "./item-edit/helpers.js";
21
- import { isNamelessLabel as dl, NAMELESS_LABEL as ol } from "./item-edit/option-disambiguate.js";
17
+ import { matchesVisibleWhen as il } from "../lib/visible-when.js";
18
+ import { InboundRequestPopover as sl } from "./integrations/InboundRequest.js";
19
+ import { FileM2MField as dl } from "./item-edit/FilePickerField.js";
20
+ import { useFieldTouches as ol } from "./item-edit/HeaderFreshness.js";
21
+ import { richTextToPlain as cl } from "./item-edit/helpers.js";
22
+ import { isNamelessLabel as ul, NAMELESS_LABEL as ml } from "./item-edit/option-disambiguate.js";
22
23
  import { PersonalDefaultMark as bt } from "./item-edit/PersonalDefaultControl.js";
23
- import { usePlacementTextContext as cl, evaluateDisplayFormula as ml } from "./item-edit/placement-behaviour.js";
24
- import { RuleHiddenNotes as ul } from "./item-edit/RuleHiddenNotes.js";
25
- import { RelatedMissingLabel as fl } from "./item-edit/related-missing.js";
26
- import { ruleHiddenGroups as pl, groupHasReadableField as hl } from "./item-edit/rule-hidden.js";
27
- import { UserChip as vt } from "./item-edit/UserChip.js";
28
- import { DesignNode as bl } from "./layout-editor/DesignNode.js";
29
- import { DesignCanvas as gl } from "./layout-editor/design-canvas.js";
30
- import { revealGroupKey as yl } from "./layout-editor/design-context.js";
31
- import { choiceLabelsFrom as xl } from "./layout-editor/overview/describe-conditions.js";
32
- import { useRecordIntegrity as vl, integrityByField as _l } from "./panels/RecordIntegrityBanner.js";
24
+ import { usePlacementTextContext as fl, evaluateDisplayFormula as pl } from "./item-edit/placement-behaviour.js";
25
+ import { RuleHiddenNotes as hl } from "./item-edit/RuleHiddenNotes.js";
26
+ import { RelatedMissingLabel as bl } from "./item-edit/related-missing.js";
27
+ import { ruleHiddenGroups as gl, groupHasReadableField as yl } from "./item-edit/rule-hidden.js";
28
+ import { UserChip as _t } from "./item-edit/UserChip.js";
29
+ import { DesignNode as xl } from "./layout-editor/DesignNode.js";
30
+ import { DesignCanvas as vl } from "./layout-editor/design-canvas.js";
31
+ import { revealGroupKey as _l } from "./layout-editor/design-context.js";
32
+ import { choiceLabelsFrom as kl } from "./layout-editor/overview/describe-conditions.js";
33
+ import { useRecordIntegrity as Nl, integrityByField as wl } from "./panels/RecordIntegrityBanner.js";
33
34
  import { SimpleSelectXs as gt } from "./ui/SimpleSelect.js";
34
- import { WidgetSlot as kl } from "./WidgetSlot.js";
35
- const ye = (a) => {
35
+ import { WidgetSlot as Sl } from "./WidgetSlot.js";
36
+ const xe = (a) => {
36
37
  if (!a) return {};
37
38
  if (typeof a == "object") return a;
38
39
  try {
@@ -40,40 +41,40 @@ const ye = (a) => {
40
41
  } catch {
41
42
  return {};
42
43
  }
43
- }, Nl = 3;
44
- function wl(a) {
44
+ }, $l = 3;
45
+ function Fl(a) {
45
46
  let u = a;
46
47
  if (typeof u == "string")
47
48
  try {
48
49
  u = JSON.parse(u);
49
50
  } catch {
50
- u = u ? u.split(",").map((d) => d.trim()) : [];
51
+ u = u ? u.split(",").map((s) => s.trim()) : [];
51
52
  }
52
53
  if (!Array.isArray(u)) return [];
53
- const y = [];
54
- for (const d of u)
55
- if (typeof d == "string" && d) y.push({ field: d, label: null });
56
- else if (d && typeof d == "object" && typeof d.field == "string") {
57
- const q = d.label;
58
- y.push({
59
- field: d.field,
60
- label: typeof q == "string" && q.trim() ? q.trim() : null
54
+ const b = [];
55
+ for (const s of u)
56
+ if (typeof s == "string" && s) b.push({ field: s, label: null });
57
+ else if (s && typeof s == "object" && typeof s.field == "string") {
58
+ const F = s.label;
59
+ b.push({
60
+ field: s.field,
61
+ label: typeof F == "string" && F.trim() ? F.trim() : null
61
62
  });
62
63
  }
63
- return y.filter((d) => !d.field.startsWith("__"));
64
+ return b.filter((s) => !s.field.startsWith("__"));
64
65
  }
65
- const _t = (a) => {
66
+ const kt = (a) => {
66
67
  const u = String(a).match(/^(\d{4})-(\d{2})-(\d{2})(?:[T ]00:00:00(?:\.0+)?(?:Z|[+-]00:?00)?)?$/);
67
68
  if (u) return `${u[2]}/${u[3]}/${u[1]}`;
68
- const y = new Date(String(a));
69
- return Number.isNaN(y.getTime()) ? String(a) : `${String(y.getMonth() + 1).padStart(2, "0")}/${String(y.getDate()).padStart(2, "0")}/${y.getFullYear()}`;
69
+ const b = new Date(String(a));
70
+ return Number.isNaN(b.getTime()) ? String(a) : `${String(b.getMonth() + 1).padStart(2, "0")}/${String(b.getDate()).padStart(2, "0")}/${b.getFullYear()}`;
70
71
  }, et = (a) => {
71
72
  const u = Number(a);
72
73
  return Number.isNaN(u) ? String(a) : `$${u.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
73
74
  }, Ue = (a) => {
74
75
  const u = Number(a);
75
76
  return Number.isNaN(u) ? String(a) : u.toLocaleString("en-US");
76
- }, Ie = "text-[11.5px] font-medium text-slate-500 dark:text-slate-400", le = () => /* @__PURE__ */ r("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }), Sl = `
77
+ }, Ie = "text-[11.5px] font-medium text-slate-500 dark:text-slate-400", le = () => /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }), ql = `
77
78
  [data-read-board]{grid-template-columns:minmax(0,1fr)}
78
79
  [data-read-dl]{grid-template-columns:repeat(2,minmax(0,1fr))}
79
80
  @media (min-width:640px){[data-read-dl="full"]{grid-template-columns:repeat(3,minmax(0,1fr))}}
@@ -92,45 +93,45 @@ function Ve({
92
93
  value: a,
93
94
  trueTone: u = "positive"
94
95
  }) {
95
- const y = a === !0 || a === 1 || a === "1" || a === "true";
96
- return /* @__PURE__ */ r(
96
+ const b = a === !0 || a === 1 || a === "1" || a === "true";
97
+ return /* @__PURE__ */ t(
97
98
  "span",
98
99
  {
99
- className: `inline-flex h-[18px] items-center rounded-full px-1.5 text-[10.5px] font-semibold ${y ? u === "danger" ? "bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-400" : "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-400" : "bg-slate-100 text-slate-500 dark:bg-slate-800 dark:text-slate-400"}`,
100
- children: y ? "Yes" : "No"
100
+ className: `inline-flex h-[18px] items-center rounded-full px-1.5 text-[10.5px] font-semibold ${b ? u === "danger" ? "bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-400" : "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-400" : "bg-slate-100 text-slate-500 dark:bg-slate-800 dark:text-slate-400"}`,
101
+ children: b ? "Yes" : "No"
101
102
  }
102
103
  );
103
104
  }
104
- function $l({ collection: a, id: u }) {
105
- const y = Ce(), d = tl(), q = xt(), { data: w } = U({
105
+ function Al({ collection: a, id: u }) {
106
+ const b = ke(), s = nl(), F = vt(), { data: N } = V({
106
107
  queryKey: ["cbv-collection-meta", a],
107
- queryFn: () => y.request(
108
- Q(`/collections/${a}`)
109
- ).then((O) => O.data).catch(() => ({ display_template: null, fields: [] })),
108
+ queryFn: () => b.request(
109
+ Y(`/collections/${a}`)
110
+ ).then((A) => A.data).catch(() => ({ display_template: null, fields: [] })),
110
111
  staleTime: 10 * 6e4,
111
112
  retry: !1
112
113
  }), {
113
- data: $,
114
- isPending: W,
115
- error: A
116
- } = U({
114
+ data: _,
115
+ isPending: C,
116
+ error: q
117
+ } = V({
117
118
  queryKey: ["rrv-related", a, String(u)],
118
- queryFn: () => d(a, u),
119
- enabled: u != null && !!w,
119
+ queryFn: () => s(a, u),
120
+ enabled: u != null && !!N,
120
121
  staleTime: 6e4,
121
122
  retry: !1
122
123
  });
123
- if (u == null) return /* @__PURE__ */ r(le, {});
124
- if (!$ && !A && (W || !w))
125
- return /* @__PURE__ */ r("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 align-middle dark:bg-[hsl(var(--nvr-skeleton))]" });
126
- if (!$) return /* @__PURE__ */ r(fl, { error: A });
124
+ if (u == null) return /* @__PURE__ */ t(le, {});
125
+ if (!_ && !q && (C || !N))
126
+ return /* @__PURE__ */ t("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 align-middle dark:bg-[hsl(var(--nvr-skeleton))]" });
127
+ if (!_) return /* @__PURE__ */ t(bl, { error: q });
127
128
  let f = "";
128
- const R = w == null ? void 0 : w.display_template;
129
- if (R && (f = R.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (O, V) => {
130
- const _ = V.split(".").reduce((x, b) => x == null ? void 0 : x[b], $);
131
- return _ == null ? "" : String(_);
129
+ const R = N == null ? void 0 : N.display_template;
130
+ if (R && (f = R.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (A, j) => {
131
+ const w = j.split(".").reduce((x, g) => x == null ? void 0 : x[g], _);
132
+ return w == null ? "" : String(w);
132
133
  }).trim()), !f) {
133
- for (const O of [
134
+ for (const A of [
134
135
  "name",
135
136
  "title",
136
137
  "label",
@@ -140,65 +141,65 @@ function $l({ collection: a, id: u }) {
140
141
  "filename_download",
141
142
  "filename"
142
143
  ])
143
- if ($[O]) {
144
- f = String($[O]);
144
+ if (_[A]) {
145
+ f = String(_[A]);
145
146
  break;
146
147
  }
147
148
  }
148
- return dl(f) && (f = ol), q ? /* @__PURE__ */ r(
149
+ return ul(f) && (f = ml), F ? /* @__PURE__ */ t(
149
150
  "button",
150
151
  {
151
152
  type: "button",
152
- onClick: () => q.open({ collection: a, itemId: String(u) }),
153
+ onClick: () => F.open({ collection: a, itemId: String(u) }),
153
154
  className: "text-left underline decoration-slate-300 underline-offset-2 transition-colors hover:text-[#007a99] hover:decoration-[#007a99] dark:decoration-slate-600 dark:hover:text-nvr-cyan dark:hover:decoration-nvr-cyan",
154
155
  children: f
155
156
  }
156
- ) : /* @__PURE__ */ r(ce, { children: f });
157
+ ) : /* @__PURE__ */ t(me, { children: f });
157
158
  }
158
- function Fl({ id: a }) {
159
- const u = Ce(), { apiBase: y } = Vt(), { data: d, isPending: q } = U({
159
+ function Ol({ id: a }) {
160
+ const u = ke(), { apiBase: b } = Vt(), { data: s, isPending: F } = V({
160
161
  queryKey: ["rrv-file-meta", String(a)],
161
162
  queryFn: () => u.request(
162
- Q(`/files/${a}/meta`)
163
- ).then(($) => $.data).catch(() => null),
163
+ Y(`/files/${a}/meta`)
164
+ ).then((_) => _.data).catch(() => null),
164
165
  enabled: a != null,
165
166
  staleTime: 5 * 6e4,
166
167
  retry: !1
167
168
  });
168
- if (a == null) return /* @__PURE__ */ r(le, {});
169
- if (!d && q)
170
- return /* @__PURE__ */ r("span", { className: "inline-block h-3.5 w-24 animate-pulse rounded bg-slate-100 align-middle dark:bg-[hsl(var(--nvr-skeleton))]" });
171
- const w = (d == null ? void 0 : d.title) || (d == null ? void 0 : d.filename_download) || `#${String(a)}`;
172
- return /* @__PURE__ */ r(
169
+ if (a == null) return /* @__PURE__ */ t(le, {});
170
+ if (!s && F)
171
+ return /* @__PURE__ */ t("span", { className: "inline-block h-3.5 w-24 animate-pulse rounded bg-slate-100 align-middle dark:bg-[hsl(var(--nvr-skeleton))]" });
172
+ const N = (s == null ? void 0 : s.title) || (s == null ? void 0 : s.filename_download) || `#${String(a)}`;
173
+ return /* @__PURE__ */ t(
173
174
  "a",
174
175
  {
175
- href: `${y}/files/${a}`,
176
+ href: `${b}/files/${a}`,
176
177
  target: "_blank",
177
178
  rel: "noreferrer",
178
179
  className: "underline decoration-slate-300 underline-offset-2 transition-colors hover:text-[#007a99] hover:decoration-[#007a99] dark:decoration-slate-600 dark:hover:text-nvr-cyan dark:hover:decoration-nvr-cyan",
179
- children: w
180
+ children: N
180
181
  }
181
182
  );
182
183
  }
183
- const tt = ({ collection: a, id: u }) => a === "nivaro_files" ? /* @__PURE__ */ r(Fl, { id: u }) : /* @__PURE__ */ r($l, { collection: a, id: u });
184
- function ql({
184
+ const tt = ({ collection: a, id: u }) => a === "nivaro_files" ? /* @__PURE__ */ t(Ol, { id: u }) : /* @__PURE__ */ t(Al, { collection: a, id: u });
185
+ function Rl({
185
186
  junction: a,
186
187
  parentFk: u,
187
- junctionField: y,
188
- parentId: d,
189
- onCount: q,
190
- onTarget: w,
191
- relation: $
188
+ junctionField: b,
189
+ parentId: s,
190
+ onCount: F,
191
+ onTarget: N,
192
+ relation: _
192
193
  }) {
193
- var j;
194
- const W = Ce(), { data: A } = U({
194
+ var W;
195
+ const C = ke(), { data: q } = V({
195
196
  queryKey: ["cbv-collection-meta", a],
196
- queryFn: () => W.request(Q(`/collections/${a}`)).then((v) => v.data),
197
+ queryFn: () => C.request(Y(`/collections/${a}`)).then((v) => v.data),
197
198
  staleTime: 10 * 6e4,
198
199
  retry: !1
199
- }), f = ((A == null ? void 0 : A.relations) ?? []).find(
200
- (v) => v.many_collection === a && v.many_field === y
201
- ), R = Ht(f == null ? void 0 : f.one_allowed_collections), O = !!f && !f.one_collection && (R.length > 0 || !!f.one_collection_field), V = (f == null ? void 0 : f.one_collection_field) ?? "collection", _ = (v) => v ? v === "directus_users" ? "nivaro_users" : v : null, x = (f == null ? void 0 : f.one_collection) ?? (O ? R.some((v) => v === "directus_users" || v === "nivaro_users") ? "nivaro_users" : _(R[0]) : null), { data: b } = U({
200
+ }), f = ((q == null ? void 0 : q.relations) ?? []).find(
201
+ (v) => v.many_collection === a && v.many_field === b
202
+ ), R = Ht(f == null ? void 0 : f.one_allowed_collections), A = !!f && !f.one_collection && (R.length > 0 || !!f.one_collection_field), j = (f == null ? void 0 : f.one_collection_field) ?? "collection", w = (v) => v ? v === "directus_users" ? "nivaro_users" : v : null, x = (f == null ? void 0 : f.one_collection) ?? (A ? R.some((v) => v === "directus_users" || v === "nivaro_users") ? "nivaro_users" : w(R[0]) : null), { data: g } = V({
202
203
  // Under the edit form's ['m2m-items', junction, parentFk, parentId] prefix (a longer key,
203
204
  // so never the same cache entry): every link write that refreshes the form's list —
204
205
  // a file upload, a picker change, the save itself — refreshes Summary's too. Its own
@@ -207,88 +208,88 @@ function ql({
207
208
  "m2m-items",
208
209
  a,
209
210
  u,
210
- d,
211
+ s,
211
212
  "rrv",
212
- y,
213
- O ? V : ""
213
+ b,
214
+ A ? j : ""
214
215
  ],
215
- queryFn: () => W.request(
216
- Q(`/items/${a}`, {
217
- filter: JSON.stringify({ [u]: { _eq: d } }),
218
- fields: O ? `id,${y},${V}` : `id,${y}`,
216
+ queryFn: () => C.request(
217
+ Y(`/items/${a}`, {
218
+ filter: JSON.stringify({ [u]: { _eq: s } }),
219
+ fields: A ? `id,${b},${j}` : `id,${b}`,
219
220
  limit: 200
220
221
  })
221
222
  ).then(
222
- (v) => (v.data ?? []).filter((N) => N[y] != null).map((N) => {
223
- const F = N[y];
223
+ (v) => (v.data ?? []).filter((k) => k[b] != null).map((k) => {
224
+ const $ = k[b];
224
225
  return {
225
- id: String(typeof F == "object" ? F.id : F),
226
- collection: O ? _(N[V]) : null
226
+ id: String(typeof $ == "object" ? $.id : $),
227
+ collection: A ? w(k[j]) : null
227
228
  };
228
229
  })
229
230
  ).catch(() => []),
230
231
  // The fields list depends on the companion leg — wait for it.
231
- enabled: !!A,
232
+ enabled: !!q,
232
233
  staleTime: 3e4,
233
234
  retry: !1
234
- }), L = b == null ? void 0 : b.map((v) => v.id), k = x ?? (O ? ((j = b == null ? void 0 : b.find((v) => v.collection)) == null ? void 0 : j.collection) ?? null : null), C = L == null ? void 0 : L.length;
235
- return ve(() => {
236
- C !== void 0 && (q == null || q(C));
237
- }, [C, q]), ve(() => {
238
- k && (w == null || w(k));
239
- }, [k, w]), A && !k && (!O || b) ? /* @__PURE__ */ r(le, {}) : !L || !k ? /* @__PURE__ */ r("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) : L.length === 0 ? /* @__PURE__ */ r(le, {}) : k === "nivaro_files" && $ ? /* @__PURE__ */ r("div", { className: "mt-1", children: /* @__PURE__ */ r(
240
- al,
235
+ }), L = g == null ? void 0 : g.map((v) => v.id), S = x ?? (A ? ((W = g == null ? void 0 : g.find((v) => v.collection)) == null ? void 0 : W.collection) ?? null : null), D = L == null ? void 0 : L.length;
236
+ return _e(() => {
237
+ D !== void 0 && (F == null || F(D));
238
+ }, [D, F]), _e(() => {
239
+ S && (N == null || N(S));
240
+ }, [S, N]), q && !S && (!A || g) ? /* @__PURE__ */ t(le, {}) : !L || !S ? /* @__PURE__ */ t("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) : L.length === 0 ? /* @__PURE__ */ t(le, {}) : S === "nivaro_files" && _ ? /* @__PURE__ */ t("div", { className: "mt-1", children: /* @__PURE__ */ t(
241
+ dl,
241
242
  {
242
- relation: $,
243
- parentId: d,
243
+ relation: _,
244
+ parentId: s,
244
245
  allRelations: [],
245
246
  disabled: !0
246
247
  }
247
- ) }) : /* @__PURE__ */ r("span", { className: "flex flex-wrap gap-x-1.5 gap-y-0.5", children: (b ?? []).map(({ id: v, collection: N }, F) => /* @__PURE__ */ p(
248
+ ) }) : /* @__PURE__ */ t("span", { className: "flex flex-wrap gap-x-1.5 gap-y-0.5", children: (g ?? []).map(({ id: v, collection: k }, $) => /* @__PURE__ */ p(
248
249
  "span",
249
250
  {
250
251
  className: "inline-flex items-center whitespace-nowrap",
251
252
  children: [
252
- /* @__PURE__ */ r(tt, { collection: N ?? k, id: v }),
253
- F < L.length - 1 && /* @__PURE__ */ r("span", { className: "text-slate-300 dark:text-slate-600", children: "," })
253
+ /* @__PURE__ */ t(tt, { collection: k ?? S, id: v }),
254
+ $ < L.length - 1 && /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "," })
254
255
  ]
255
256
  },
256
- `${N ?? k}:${v}`
257
+ `${k ?? S}:${v}`
257
258
  )) });
258
259
  }
259
- function Al({
260
+ function Tl({
260
261
  collection: a,
261
262
  fkField: u,
262
- parentId: y,
263
- layoutId: d,
264
- presets: q,
265
- defaultPreset: w,
266
- onCount: $
263
+ parentId: b,
264
+ layoutId: s,
265
+ presets: F,
266
+ defaultPreset: N,
267
+ onCount: _
267
268
  }) {
268
- const W = Ce(), A = xt(), f = (q ?? []).filter((t) => t && Array.isArray(t.columns)), [R, O] = X(
269
+ const C = ke(), q = vt(), f = (F ?? []).filter((l) => l && Array.isArray(l.columns)), [R, A] = Q(
269
270
  () => {
270
- var t;
271
- return f.length >= 2 ? ((t = f.find((s) => s.name === w)) == null ? void 0 : t.name) ?? f[0].name : "__all__";
271
+ var l;
272
+ return f.length >= 2 ? ((l = f.find((d) => d.name === N)) == null ? void 0 : l.name) ?? f[0].name : "__all__";
272
273
  }
273
- ), { data: V } = U({
274
+ ), { data: j } = V({
274
275
  queryKey: ["cbv-collection-meta", a],
275
- queryFn: () => W.request(Q(`/collections/${a}`)).then((t) => t.data),
276
+ queryFn: () => C.request(Y(`/collections/${a}`)).then((l) => l.data),
276
277
  staleTime: 10 * 6e4,
277
278
  retry: !1
278
- }), _ = (t) => {
279
- var s;
280
- return ((s = ((V == null ? void 0 : V.relations) ?? []).find(
281
- (o) => o.many_collection === a && o.many_field === t && o.one_collection
282
- )) == null ? void 0 : s.one_collection) ?? null;
283
- }, { data: x } = U({
284
- queryKey: ["rrv-cols", a, d ?? null],
285
- queryFn: () => W.request(
286
- Q(`/field-config/${a}`, d ? { layout_id: d } : {})
287
- ).then((t) => ({
279
+ }), w = (l) => {
280
+ var d;
281
+ return ((d = ((j == null ? void 0 : j.relations) ?? []).find(
282
+ (o) => o.many_collection === a && o.many_field === l && o.one_collection
283
+ )) == null ? void 0 : d.one_collection) ?? null;
284
+ }, { data: x } = V({
285
+ queryKey: ["rrv-cols", a, s ?? null],
286
+ queryFn: () => C.request(
287
+ Y(`/field-config/${a}`, s ? { layout_id: s } : {})
288
+ ).then((l) => ({
288
289
  // Lines carry their own number — sort by it and show it first.
289
- lineNo: (t.data ?? []).some((s) => s.field === "line_number"),
290
- cols: (t.data ?? []).filter(
291
- (s) => !s.hidden && !s.field.startsWith("__") && (!s.field.includes(".") || s.interface === "relation-path") && s.field !== u && ((d ? s.layout_assigned : !0) ?? !0) && (s.interface === "relation-path" || [
290
+ lineNo: (l.data ?? []).some((d) => d.field === "line_number"),
291
+ cols: (l.data ?? []).filter(
292
+ (d) => !d.hidden && !d.field.startsWith("__") && (!d.field.includes(".") || d.interface === "relation-path") && d.field !== u && ((s ? d.layout_assigned : !0) ?? !0) && (d.interface === "relation-path" || [
292
293
  "string",
293
294
  "text",
294
295
  "integer",
@@ -299,279 +300,279 @@ function Al({
299
300
  "datetime",
300
301
  "timestamp",
301
302
  "uuid"
302
- ].includes(s.type ?? ""))
303
- ).filter((s, o, h) => h.findIndex((T) => T.field === s.field) === o)
303
+ ].includes(d.type ?? ""))
304
+ ).filter((d, o, h) => h.findIndex((T) => T.field === d.field) === o)
304
305
  })),
305
306
  staleTime: 5 * 6e4,
306
307
  retry: !1
307
- }), b = (x == null ? void 0 : x.cols) ?? [], L = !!(x != null && x.lineNo), k = R !== "__all__" ? f.find((t) => t.name === R) : null, C = xe(() => {
308
- if (!k) return b;
309
- const t = new Set(k.columns), s = b.filter((o) => t.has(o.field));
310
- return s.length > 0 ? s : b;
311
- }, [b, k]), [j, v] = X(""), [N, F] = X(1), [ie, B] = X({}), Z = Bt(ie, 350), De = xe(() => {
312
- const t = [
313
- { path: [u], op: "_eq", value: y }
308
+ }), g = (x == null ? void 0 : x.cols) ?? [], L = !!(x != null && x.lineNo), S = R !== "__all__" ? f.find((l) => l.name === R) : null, D = ve(() => {
309
+ if (!S) return g;
310
+ const l = new Set(S.columns), d = g.filter((o) => l.has(o.field));
311
+ return d.length > 0 ? d : g;
312
+ }, [g, S]), [W, v] = Q(""), [k, $] = Q(1), [ie, B] = Q({}), Z = Bt(ie, 350), De = ve(() => {
313
+ const l = [
314
+ { path: [u], op: "_eq", value: b }
314
315
  ];
315
- for (const [s, o] of Object.entries(Z)) {
316
+ for (const [d, o] of Object.entries(Z)) {
316
317
  if (!(o != null && o.value.trim())) continue;
317
318
  const h = o.value.trim(), T = Number(h), M = o.op === "_contains" ? h : h === "true" || h === "false" ? h === "true" : Number.isNaN(T) ? h : T;
318
- t.push({ path: [s], op: o.op, value: M });
319
+ l.push({ path: [d], op: o.op, value: M });
319
320
  }
320
- return JSON.stringify(t);
321
- }, [Z, u, y]), m = 25, {
321
+ return JSON.stringify(l);
322
+ }, [Z, u, b]), m = 25, {
322
323
  data: H,
323
- isLoading: me,
324
+ isLoading: fe,
324
325
  isFetching: Ee
325
- } = U({
326
- queryKey: ["rrv-rows", a, u, y, j, L, N, De],
327
- queryFn: () => W.request(
328
- Q(`/items/${a}`, {
326
+ } = V({
327
+ queryKey: ["rrv-rows", a, u, b, W, L, k, De],
328
+ queryFn: () => C.request(
329
+ Y(`/items/${a}`, {
329
330
  limit: m,
330
- page: N,
331
- ...j ? { sort: j } : L ? { sort: "line_number" } : {},
331
+ page: k,
332
+ ...W ? { sort: W } : L ? { sort: "line_number" } : {},
332
333
  conditions: De
333
334
  })
334
335
  ),
335
- placeholderData: (t) => t,
336
+ placeholderData: (l) => l,
336
337
  staleTime: 3e4,
337
338
  retry: !1
338
- }), D = (H == null ? void 0 : H.data) ?? [], ee = (H == null ? void 0 : H.total) ?? D.length, I = Object.values(Z).some((t) => !!(t != null && t.value.trim()));
339
- ve(() => {
340
- H && !I && ($ == null || $(ee));
341
- }, [H, I, ee, $]);
342
- const ue = C.filter((t) => t.field.includes(".")), fe = D.map((t) => String(t.id)), { data: Y } = U({
339
+ }), E = (H == null ? void 0 : H.data) ?? [], ee = (H == null ? void 0 : H.total) ?? E.length, U = Object.values(Z).some((l) => !!(l != null && l.value.trim()));
340
+ _e(() => {
341
+ H && !U && (_ == null || _(ee));
342
+ }, [H, U, ee, _]);
343
+ const pe = D.filter((l) => l.field.includes(".")), he = E.map((l) => String(l.id)), { data: z } = V({
343
344
  queryKey: [
344
345
  "rrv-resolve-paths",
345
346
  a,
346
- ue.map((t) => t.field).join(","),
347
- fe.join(",")
347
+ pe.map((l) => l.field).join(","),
348
+ he.join(",")
348
349
  ],
349
- queryFn: () => W.request(
350
- Q(`/items/${a}/resolve-paths`, {
351
- ids: fe.join(","),
352
- paths: ue.map((t) => t.field).join(",")
350
+ queryFn: () => C.request(
351
+ Y(`/items/${a}/resolve-paths`, {
352
+ ids: he.join(","),
353
+ paths: pe.map((l) => l.field).join(",")
353
354
  })
354
- ).then((t) => t.data ?? { rows: {}, targets: {} }).catch(() => ({ rows: {}, targets: {} })),
355
- enabled: ue.length > 0 && fe.length > 0,
355
+ ).then((l) => l.data ?? { rows: {}, targets: {} }).catch(() => ({ rows: {}, targets: {} })),
356
+ enabled: pe.length > 0 && he.length > 0,
356
357
  staleTime: 3e4
357
- }), E = L && D.some((t) => t.line_number != null), _e = Math.max(1, Math.ceil(ee / m)), se = (t, s, o) => {
358
- F(1), B((h) => {
358
+ }), P = L && E.some((l) => l.line_number != null), se = Math.max(1, Math.ceil(ee / m)), de = (l, d, o) => {
359
+ $(1), B((h) => {
359
360
  const T = { ...h };
360
- return o ? T[t] = { op: s, value: o } : delete T[t], T;
361
+ return o ? T[l] = { op: d, value: o } : delete T[l], T;
361
362
  });
362
- }, Be = (t) => {
363
- F(1), v((s) => s === t ? `-${t}` : s === `-${t}` ? "" : t);
363
+ }, Be = (l) => {
364
+ $(1), v((d) => d === l ? `-${l}` : d === `-${l}` ? "" : l);
364
365
  };
365
- if (me)
366
- return /* @__PURE__ */ r("div", { className: "space-y-1.5 py-2", children: [0, 1, 2].map((t) => /* @__PURE__ */ r(
366
+ if (fe)
367
+ return /* @__PURE__ */ t("div", { className: "space-y-1.5 py-2", children: [0, 1, 2].map((l) => /* @__PURE__ */ t(
367
368
  "div",
368
369
  {
369
370
  className: "h-6 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]"
370
371
  },
371
- t
372
+ l
372
373
  )) });
373
- if (D.length === 0 && Object.keys(Z).length === 0)
374
- return /* @__PURE__ */ r("p", { className: "py-3 text-[12px] text-slate-400", children: "No records" });
375
- const He = (t, s) => {
374
+ if (E.length === 0 && Object.keys(Z).length === 0)
375
+ return /* @__PURE__ */ t("p", { className: "py-3 text-[12px] text-slate-400", children: "No records" });
376
+ const He = (l, d) => {
376
377
  var M, re;
377
- if (s.field.includes(".")) {
378
- const ne = (M = Y == null ? void 0 : Y.rows[String(t.id)]) == null ? void 0 : M[s.field];
379
- if (!Y)
380
- return /* @__PURE__ */ r("span", { className: "inline-block h-3 w-14 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" });
381
- if (!ne || ne.value === "") return /* @__PURE__ */ r(le, {});
382
- const Ke = Y.targets[s.field], $e = (re = ne.ids) == null ? void 0 : re[0];
383
- return A && Ke && $e ? /* @__PURE__ */ r(
378
+ if (d.field.includes(".")) {
379
+ const ne = (M = z == null ? void 0 : z.rows[String(l.id)]) == null ? void 0 : M[d.field];
380
+ if (!z)
381
+ return /* @__PURE__ */ t("span", { className: "inline-block h-3 w-14 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" });
382
+ if (!ne || ne.value === "") return /* @__PURE__ */ t(le, {});
383
+ const je = z.targets[d.field], Fe = (re = ne.ids) == null ? void 0 : re[0];
384
+ return q && je && Fe ? /* @__PURE__ */ t(
384
385
  "button",
385
386
  {
386
387
  type: "button",
387
388
  onClick: (Ge) => {
388
- Ge.stopPropagation(), A.open({ collection: Ke, itemId: String($e) });
389
+ Ge.stopPropagation(), q.open({ collection: je, itemId: String(Fe) });
389
390
  },
390
391
  className: "text-left underline decoration-slate-300 underline-offset-2 hover:text-[#007a99] dark:decoration-slate-600 dark:hover:text-nvr-cyan",
391
392
  children: ne.value
392
393
  }
393
394
  ) : ne.value;
394
395
  }
395
- const o = t[s.field];
396
- if (s.type === "boolean" && o == null) return /* @__PURE__ */ r(Ve, { value: !1 });
397
- if (o == null || o === "") return /* @__PURE__ */ r(le, {});
398
- const h = _(s.field);
396
+ const o = l[d.field];
397
+ if (d.type === "boolean" && o == null) return /* @__PURE__ */ t(Ve, { value: !1 });
398
+ if (o == null || o === "") return /* @__PURE__ */ t(le, {});
399
+ const h = w(d.field);
399
400
  if (h === "nivaro_users")
400
- return /* @__PURE__ */ r("span", { className: "inline-block", children: /* @__PURE__ */ r(vt, { userId: String(o), size: "compact" }) });
401
- if (h) return /* @__PURE__ */ r(tt, { collection: h, id: o });
402
- if (s.type === "boolean") return /* @__PURE__ */ r(Ve, { value: o });
403
- if (s.type === "decimal" || s.type === "float") return et(o);
404
- if (s.type === "integer") return Ue(o);
405
- if (s.type === "date" || s.type === "datetime" || s.type === "timestamp") return _t(o);
401
+ return /* @__PURE__ */ t("span", { className: "inline-block", children: /* @__PURE__ */ t(_t, { userId: String(o), size: "compact" }) });
402
+ if (h) return /* @__PURE__ */ t(tt, { collection: h, id: o });
403
+ if (d.type === "boolean") return /* @__PURE__ */ t(Ve, { value: o });
404
+ if (d.type === "decimal" || d.type === "float") return et(o);
405
+ if (d.type === "integer") return Ue(o);
406
+ if (d.type === "date" || d.type === "datetime" || d.type === "timestamp") return kt(o);
406
407
  const T = String(o);
407
408
  return T.length > 48 ? `${T.slice(0, 48)}…` : T;
408
- }, de = (t) => ["decimal", "float", "integer"].includes(t.type ?? "") && !_(t.field) && !t.field.includes("."), Me = (t) => {
409
- const s = t.options;
410
- if (!s) return {};
411
- if (typeof s == "string")
409
+ }, oe = (l) => ["decimal", "float", "integer"].includes(l.type ?? "") && !w(l.field) && !l.field.includes("."), Pe = (l) => {
410
+ const d = l.options;
411
+ if (!d) return {};
412
+ if (typeof d == "string")
412
413
  try {
413
- return JSON.parse(s);
414
+ return JSON.parse(d);
414
415
  } catch {
415
416
  return {};
416
417
  }
417
- return s;
418
- }, ke = (t) => {
419
- const s = Me(t).aggregate;
420
- return typeof s == "string" && ["sum", "avg", "min", "max", "count"].includes(s) ? s : null;
421
- }, Pe = C.some((t) => ke(t)), Ne = (t) => {
422
- const s = ke(t);
423
- if (!s) return null;
424
- const o = D.map((M) => Number(M[t.field])).filter((M) => !Number.isNaN(M));
418
+ return d;
419
+ }, Ne = (l) => {
420
+ const d = Pe(l).aggregate;
421
+ return typeof d == "string" && ["sum", "avg", "min", "max", "count"].includes(d) ? d : null;
422
+ }, Me = D.some((l) => Ne(l)), we = (l) => {
423
+ const d = Ne(l);
424
+ if (!d) return null;
425
+ const o = E.map((M) => Number(M[l.field])).filter((M) => !Number.isNaN(M));
425
426
  let h = null;
426
- if (s === "count" ? h = D.length : o.length > 0 && (s === "sum" ? h = o.reduce((M, re) => M + re, 0) : s === "avg" ? h = o.reduce((M, re) => M + re, 0) / o.length : s === "min" ? h = Math.min(...o) : s === "max" && (h = Math.max(...o))), h === null) return "—";
427
- const T = Me(t).format;
428
- return s === "count" || T === "int" ? Ue(Math.round(h)) : T === "currency" || t.type === "decimal" || t.type === "float" ? et(h) : s === "avg" ? h.toFixed(2) : Ue(h);
429
- }, we = (t) => !_(t.field) && !t.field.includes("."), je = (t) => _(t.field) || t.field.includes(".") ? null : t.type === "boolean" ? "bool" : ["integer", "decimal", "float"].includes(t.type ?? "") ? "num" : ["string", "text"].includes(t.type ?? "") ? "text" : null, Se = C.some((t) => je(t) != null);
427
+ if (d === "count" ? h = E.length : o.length > 0 && (d === "sum" ? h = o.reduce((M, re) => M + re, 0) : d === "avg" ? h = o.reduce((M, re) => M + re, 0) / o.length : d === "min" ? h = Math.min(...o) : d === "max" && (h = Math.max(...o))), h === null) return "—";
428
+ const T = Pe(l).format;
429
+ return d === "count" || T === "int" ? Ue(Math.round(h)) : T === "currency" || l.type === "decimal" || l.type === "float" ? et(h) : d === "avg" ? h.toFixed(2) : Ue(h);
430
+ }, Se = (l) => !w(l.field) && !l.field.includes("."), Ke = (l) => w(l.field) || l.field.includes(".") ? null : l.type === "boolean" ? "bool" : ["integer", "decimal", "float"].includes(l.type ?? "") ? "num" : ["string", "text"].includes(l.type ?? "") ? "text" : null, $e = D.some((l) => Ke(l) != null);
430
431
  return /* @__PURE__ */ p("div", { children: [
431
- f.length >= 2 && /* @__PURE__ */ r("div", { className: "mb-1.5 flex flex-wrap items-center gap-1", "data-read-presets": !0, children: [
432
+ f.length >= 2 && /* @__PURE__ */ t("div", { className: "mb-1.5 flex flex-wrap items-center gap-1", "data-read-presets": !0, children: [
432
433
  { name: "__all__", label: "All" },
433
- ...f.map((t) => ({ name: t.name, label: t.name }))
434
- ].map((t) => /* @__PURE__ */ r(
434
+ ...f.map((l) => ({ name: l.name, label: l.name }))
435
+ ].map((l) => /* @__PURE__ */ t(
435
436
  "button",
436
437
  {
437
438
  type: "button",
438
- onClick: () => O(t.name),
439
- "aria-pressed": R === t.name,
440
- className: `rounded-full border px-2 py-0.5 text-[10.5px] font-medium transition-colors ${R === t.name ? "border-nvr-cyan bg-nvr-cyan/10 text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-400 dark:hover:bg-slate-800"}`,
441
- children: t.label
439
+ onClick: () => A(l.name),
440
+ "aria-pressed": R === l.name,
441
+ className: `rounded-full border px-2 py-0.5 text-[10.5px] font-medium transition-colors ${R === l.name ? "border-nvr-cyan bg-nvr-cyan/10 text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-400 dark:hover:bg-slate-800"}`,
442
+ children: l.label
442
443
  },
443
- t.name
444
+ l.name
444
445
  )) }),
445
- /* @__PURE__ */ r(
446
+ /* @__PURE__ */ t(
446
447
  "div",
447
448
  {
448
- className: `overflow-x-auto rounded-md border border-slate-200 dark:border-slate-700 ${Ee && !me ? "opacity-70" : ""}`,
449
+ className: `overflow-x-auto rounded-md border border-slate-200 dark:border-slate-700 ${Ee && !fe ? "opacity-70" : ""}`,
449
450
  children: /* @__PURE__ */ p("table", { className: "w-full", style: { fontVariantNumeric: "tabular-nums" }, children: [
450
451
  /* @__PURE__ */ p("thead", { children: [
451
452
  /* @__PURE__ */ p("tr", { className: "border-b border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800", children: [
452
- E && /* @__PURE__ */ r("th", { className: "h-7 w-8 px-2 text-right text-[9.5px] font-bold uppercase tracking-wider text-slate-400", children: "#" }),
453
- C.map((t) => {
454
- const s = j === t.field || j === `-${t.field}`;
453
+ P && /* @__PURE__ */ t("th", { className: "h-7 w-8 px-2 text-right text-[9.5px] font-bold uppercase tracking-wider text-slate-400", children: "#" }),
454
+ D.map((l) => {
455
+ const d = W === l.field || W === `-${l.field}`;
455
456
  return /* @__PURE__ */ p(
456
457
  "th",
457
458
  {
458
- onClick: () => we(t) && Be(t.field),
459
- 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 ${de(t) ? "text-right" : "text-left"} ${we(t) ? "cursor-pointer hover:text-slate-700 dark:hover:text-slate-200" : ""}`,
459
+ onClick: () => Se(l) && Be(l.field),
460
+ 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 ${oe(l) ? "text-right" : "text-left"} ${Se(l) ? "cursor-pointer hover:text-slate-700 dark:hover:text-slate-200" : ""}`,
460
461
  children: [
461
- t.label || Ze(t.field),
462
- we(t) && /* @__PURE__ */ r("span", { className: s ? "ml-0.5 text-[#00a5cc]" : "ml-0.5 text-slate-300", children: s ? j.startsWith("-") ? "▼" : "▲" : "⇅" })
462
+ l.label || Ze(l.field),
463
+ Se(l) && /* @__PURE__ */ t("span", { className: d ? "ml-0.5 text-[#00a5cc]" : "ml-0.5 text-slate-300", children: d ? W.startsWith("-") ? "▼" : "▲" : "⇅" })
463
464
  ]
464
465
  },
465
- t.field
466
+ l.field
466
467
  );
467
468
  })
468
469
  ] }),
469
- Se && /* @__PURE__ */ p("tr", { className: "border-b border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800", children: [
470
- E && /* @__PURE__ */ r("th", { className: "px-1.5 py-1" }),
471
- C.map((t) => {
472
- const s = je(t), o = ie[t.field];
470
+ $e && /* @__PURE__ */ p("tr", { className: "border-b border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800", children: [
471
+ P && /* @__PURE__ */ t("th", { className: "px-1.5 py-1" }),
472
+ D.map((l) => {
473
+ const d = Ke(l), o = ie[l.field];
473
474
  return /* @__PURE__ */ p("th", { className: "px-1.5 py-1 font-normal", children: [
474
- s === "text" && /* @__PURE__ */ r(
475
+ d === "text" && /* @__PURE__ */ t(
475
476
  "input",
476
477
  {
477
478
  value: (o == null ? void 0 : o.value) ?? "",
478
- onChange: (h) => se(t.field, "_contains", h.target.value),
479
+ onChange: (h) => de(l.field, "_contains", h.target.value),
479
480
  placeholder: "Filter…",
480
- "aria-label": `Filter ${t.field}`,
481
+ "aria-label": `Filter ${l.field}`,
481
482
  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"
482
483
  }
483
484
  ),
484
- s === "num" && /* @__PURE__ */ p("span", { className: "flex items-center gap-0.5", children: [
485
- /* @__PURE__ */ r(
485
+ d === "num" && /* @__PURE__ */ p("span", { className: "flex items-center gap-0.5", children: [
486
+ /* @__PURE__ */ t(
486
487
  gt,
487
488
  {
488
489
  value: (o == null ? void 0 : o.op) ?? "_eq",
489
- onChange: (h) => se(t.field, h, (o == null ? void 0 : o.value) ?? ""),
490
+ onChange: (h) => de(l.field, h, (o == null ? void 0 : o.value) ?? ""),
490
491
  options: [
491
492
  { value: "_eq", label: "=" },
492
493
  { value: "_gte", label: "≥" },
493
494
  { value: "_lte", label: "≤" }
494
495
  ],
495
- ariaLabel: `Filter op ${t.field}`
496
+ ariaLabel: `Filter op ${l.field}`
496
497
  }
497
498
  ),
498
- /* @__PURE__ */ r(
499
+ /* @__PURE__ */ t(
499
500
  "input",
500
501
  {
501
502
  type: "number",
502
503
  value: (o == null ? void 0 : o.value) ?? "",
503
- onChange: (h) => se(t.field, (o == null ? void 0 : o.op) ?? "_eq", h.target.value),
504
- "aria-label": `Filter ${t.field}`,
504
+ onChange: (h) => de(l.field, (o == null ? void 0 : o.op) ?? "_eq", h.target.value),
505
+ "aria-label": `Filter ${l.field}`,
505
506
  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"
506
507
  }
507
508
  )
508
509
  ] }),
509
- s === "bool" && /* @__PURE__ */ r(
510
+ d === "bool" && /* @__PURE__ */ t(
510
511
  gt,
511
512
  {
512
513
  value: (o == null ? void 0 : o.value) ?? "",
513
- onChange: (h) => se(t.field, "_eq", h),
514
+ onChange: (h) => de(l.field, "_eq", h),
514
515
  options: [
515
516
  { value: "", label: "All" },
516
517
  { value: "true", label: "Yes" },
517
518
  { value: "false", label: "No" }
518
519
  ],
519
- ariaLabel: `Filter ${t.field}`,
520
+ ariaLabel: `Filter ${l.field}`,
520
521
  className: "w-full"
521
522
  }
522
523
  )
523
- ] }, t.field);
524
+ ] }, l.field);
524
525
  })
525
526
  ] })
526
527
  ] }),
527
528
  /* @__PURE__ */ p("tbody", { children: [
528
- D.length === 0 && /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r(
529
+ E.length === 0 && /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t(
529
530
  "td",
530
531
  {
531
- colSpan: C.length + (E ? 1 : 0),
532
+ colSpan: D.length + (P ? 1 : 0),
532
533
  className: "py-4 text-center text-[12px] text-slate-400",
533
534
  children: "No matches — adjust filters"
534
535
  }
535
536
  ) }),
536
- D.map((t) => /* @__PURE__ */ p(
537
+ E.map((l) => /* @__PURE__ */ p(
537
538
  "tr",
538
539
  {
539
- onClick: A ? () => A.open({ collection: a, itemId: String(t.id) }) : void 0,
540
- className: `border-b border-slate-100 last:border-0 dark:border-slate-800 ${A ? "cursor-pointer hover:bg-nvr-cyan/5 dark:hover:bg-nvr-cyan/10" : ""}`,
540
+ onClick: q ? () => q.open({ collection: a, itemId: String(l.id) }) : void 0,
541
+ className: `border-b border-slate-100 last:border-0 dark:border-slate-800 ${q ? "cursor-pointer hover:bg-nvr-cyan/5 dark:hover:bg-nvr-cyan/10" : ""}`,
541
542
  children: [
542
- E && /* @__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) }),
543
- C.map((s) => /* @__PURE__ */ r(
543
+ P && /* @__PURE__ */ t("td", { className: "px-2 py-1.5 text-right text-[11px] tabular-nums text-slate-400", children: l.line_number == null ? "" : String(l.line_number) }),
544
+ D.map((d) => /* @__PURE__ */ t(
544
545
  "td",
545
546
  {
546
- className: `whitespace-nowrap px-2.5 py-1.5 text-[12px] text-slate-700 dark:text-slate-200 ${de(s) ? "text-right" : ""}`,
547
- children: He(t, s)
547
+ className: `whitespace-nowrap px-2.5 py-1.5 text-[12px] text-slate-700 dark:text-slate-200 ${oe(d) ? "text-right" : ""}`,
548
+ children: He(l, d)
548
549
  },
549
- s.field
550
+ d.field
550
551
  ))
551
552
  ]
552
553
  },
553
- String(t.id)
554
+ String(l.id)
554
555
  ))
555
556
  ] }),
556
- Pe && D.length > 0 && /* @__PURE__ */ r("tfoot", { children: /* @__PURE__ */ p(
557
+ Me && E.length > 0 && /* @__PURE__ */ t("tfoot", { children: /* @__PURE__ */ p(
557
558
  "tr",
558
559
  {
559
560
  "data-read-grid-footer": !0,
560
561
  className: "border-t border-slate-200 bg-slate-50 text-[11px] font-medium text-slate-600 dark:border-slate-700 dark:bg-slate-800/60 dark:text-slate-300",
561
562
  children: [
562
- E && /* @__PURE__ */ r("td", {}),
563
- C.map((t) => {
564
- const s = ke(t);
565
- return /* @__PURE__ */ r(
563
+ P && /* @__PURE__ */ t("td", {}),
564
+ D.map((l) => {
565
+ const d = Ne(l);
566
+ return /* @__PURE__ */ t(
566
567
  "td",
567
568
  {
568
- className: `whitespace-nowrap px-2.5 py-1.5 ${de(t) ? "text-right" : ""}`,
569
- children: s && /* @__PURE__ */ p(ce, { children: [
570
- /* @__PURE__ */ r("span", { className: "mr-1 font-mono text-[10px] text-slate-400", children: s.toUpperCase() }),
571
- /* @__PURE__ */ r("span", { className: "tabular-nums", children: Ne(t) })
569
+ className: `whitespace-nowrap px-2.5 py-1.5 ${oe(l) ? "text-right" : ""}`,
570
+ children: d && /* @__PURE__ */ p(me, { children: [
571
+ /* @__PURE__ */ t("span", { className: "mr-1 font-mono text-[10px] text-slate-400", children: d.toUpperCase() }),
572
+ /* @__PURE__ */ t("span", { className: "tabular-nums", children: we(l) })
572
573
  ] })
573
574
  },
574
- t.field
575
+ l.field
575
576
  );
576
577
  })
577
578
  ]
@@ -582,38 +583,62 @@ function Al({
582
583
  ),
583
584
  ee > m && /* @__PURE__ */ p("div", { className: "mt-1.5 flex items-center justify-between", children: [
584
585
  /* @__PURE__ */ p("p", { className: "text-[11px] tabular-nums text-slate-400", children: [
585
- ((N - 1) * m + 1).toLocaleString("en-US"),
586
+ ((k - 1) * m + 1).toLocaleString("en-US"),
586
587
  "–",
587
- Math.min(N * m, ee).toLocaleString("en-US"),
588
+ Math.min(k * m, ee).toLocaleString("en-US"),
588
589
  " of",
589
590
  " ",
590
591
  ee.toLocaleString("en-US")
591
592
  ] }),
592
593
  /* @__PURE__ */ p("span", { className: "flex items-center gap-0.5", children: [
593
- /* @__PURE__ */ r(
594
+ /* @__PURE__ */ t(
594
595
  "button",
595
596
  {
596
597
  type: "button",
597
- disabled: N <= 1,
598
- onClick: () => F((t) => Math.max(1, t - 1)),
598
+ disabled: k <= 1,
599
+ onClick: () => $(1),
600
+ "aria-label": "First page",
601
+ "data-tip": "First page",
602
+ className: "h-6 rounded px-2 text-[11px] text-slate-600 hover:bg-slate-100 disabled:opacity-30 dark:text-slate-300 dark:hover:bg-slate-800",
603
+ children: "«"
604
+ }
605
+ ),
606
+ /* @__PURE__ */ t(
607
+ "button",
608
+ {
609
+ type: "button",
610
+ disabled: k <= 1,
611
+ onClick: () => $((l) => Math.max(1, l - 1)),
599
612
  className: "h-6 rounded px-2 text-[11px] text-slate-600 hover:bg-slate-100 disabled:opacity-30 dark:text-slate-300 dark:hover:bg-slate-800",
600
613
  children: "← Prev"
601
614
  }
602
615
  ),
603
616
  /* @__PURE__ */ p("span", { className: "min-w-[48px] text-center text-[11px] tabular-nums text-slate-500", children: [
604
- N,
617
+ k,
605
618
  " / ",
606
- _e.toLocaleString("en-US")
619
+ se.toLocaleString("en-US")
607
620
  ] }),
608
- /* @__PURE__ */ r(
621
+ /* @__PURE__ */ t(
609
622
  "button",
610
623
  {
611
624
  type: "button",
612
- disabled: N >= _e,
613
- onClick: () => F((t) => t + 1),
625
+ disabled: k >= se,
626
+ onClick: () => $((l) => l + 1),
614
627
  className: "h-6 rounded px-2 text-[11px] text-slate-600 hover:bg-slate-100 disabled:opacity-30 dark:text-slate-300 dark:hover:bg-slate-800",
615
628
  children: "Next →"
616
629
  }
630
+ ),
631
+ /* @__PURE__ */ t(
632
+ "button",
633
+ {
634
+ type: "button",
635
+ disabled: k >= se,
636
+ onClick: () => $(se),
637
+ "aria-label": "Last page",
638
+ "data-tip": "Last page",
639
+ className: "h-6 rounded px-2 text-[11px] text-slate-600 hover:bg-slate-100 disabled:opacity-30 dark:text-slate-300 dark:hover:bg-slate-800",
640
+ children: "»"
641
+ }
617
642
  )
618
643
  ] })
619
644
  ] })
@@ -622,42 +647,42 @@ function Al({
622
647
  function yt({
623
648
  collection: a,
624
649
  itemId: u,
625
- layoutData: y,
626
- design: d,
627
- flush: q,
628
- renderSlot: w,
629
- integrityMarks: $,
630
- renderGrid: W,
631
- onEditSection: A,
650
+ layoutData: b,
651
+ design: s,
652
+ flush: F,
653
+ renderSlot: N,
654
+ integrityMarks: _,
655
+ renderGrid: C,
656
+ onEditSection: q,
632
657
  gridCounts: f
633
658
  }) {
634
659
  var dt;
635
- const R = Ce(), O = cl(), V = d ? d.record ?? {} : null, _ = !!(d != null && d.context.showHidden), x = d ? String(((dt = d.record) == null ? void 0 : dt.id) ?? "") : u ?? "", b = xe(
636
- () => d ? {
637
- ...d.layout,
638
- layout: d.layout.layout ?? { id: 0, name: "" }
639
- } : y,
640
- [d, y]
660
+ const R = ke(), A = fl(), j = s ? s.record ?? {} : null, w = !!(s != null && s.context.showHidden), x = s ? String(((dt = s.record) == null ? void 0 : dt.id) ?? "") : u ?? "", g = ve(
661
+ () => s ? {
662
+ ...s.layout,
663
+ layout: s.layout.layout ?? { id: 0, name: "" }
664
+ } : b,
665
+ [s, b]
641
666
  ), L = (e) => ({
642
- kind: Re(e.field) ? "slot" : "field",
667
+ kind: Ce(e.field) ? "slot" : "field",
643
668
  field: e.field,
644
669
  group_key: e.group_key ?? null
645
- }), k = (e, l, i = !1) => d ? /* @__PURE__ */ r(bl, { target: e, children: i ? /* @__PURE__ */ r("div", { "data-design-hidden": !0, className: "opacity-40", children: l }) : l }) : l, C = xe(
670
+ }), S = (e, r, i = !1) => s ? /* @__PURE__ */ t(xl, { target: e, children: i ? /* @__PURE__ */ t("div", { "data-design-hidden": !0, className: "opacity-40", children: r }) : r }) : r, D = ve(
646
671
  () => [
647
672
  ...new Set(
648
- (d ? [] : (b == null ? void 0 : b.assignments) ?? []).map((e) => e.field).filter((e) => e && !e.startsWith("__") && !e.includes("."))
673
+ (s ? [] : (g == null ? void 0 : g.assignments) ?? []).map((e) => e.field).filter((e) => e && !e.startsWith("__") && !e.includes("."))
649
674
  )
650
675
  ].sort(),
651
- [b, d]
652
- ), { data: j } = il(a, x, C), v = (e) => {
653
- const l = j == null ? void 0 : j[e];
654
- if (!l) return null;
655
- const i = l.via !== "user";
656
- return l.caller && l.activity_id ? /* @__PURE__ */ r(
657
- nl,
676
+ [g, s]
677
+ ), { data: W } = ol(a, x, D), v = (e) => {
678
+ const r = W == null ? void 0 : W[e];
679
+ if (!r) return null;
680
+ const i = r.via !== "user";
681
+ return r.caller && r.activity_id ? /* @__PURE__ */ t(
682
+ sl,
658
683
  {
659
- activityId: l.activity_id,
660
- callerName: l.caller.name,
684
+ activityId: r.activity_id,
685
+ callerName: r.caller.name,
661
686
  collection: a,
662
687
  itemId: x,
663
688
  children: /* @__PURE__ */ p(
@@ -665,59 +690,59 @@ function yt({
665
690
  {
666
691
  type: "button",
667
692
  "data-field-touch": e,
668
- "data-field-touch-caller": l.caller.key,
669
- "data-tip": `Changed ${Le(l.at)} by ${l.caller.name} (through the API) — click for the request`,
670
- "aria-label": `Changed ${Le(l.at)} by ${l.caller.name} through the API`,
693
+ "data-field-touch-caller": r.caller.key,
694
+ "data-tip": `Changed ${Le(r.at)} by ${r.caller.name} (through the API) — click for the request`,
695
+ "aria-label": `Changed ${Le(r.at)} by ${r.caller.name} through the API`,
671
696
  className: "ml-1 inline-flex items-center gap-1 rounded-full bg-amber-50 px-1.5 align-middle text-[9.5px] font-medium leading-4 text-amber-800 hover:bg-amber-100 dark:bg-amber-400/10 dark:text-amber-300 dark:hover:bg-amber-400/20",
672
697
  children: [
673
- /* @__PURE__ */ r("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400", "aria-hidden": !0 }),
674
- l.caller.name,
698
+ /* @__PURE__ */ t("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400", "aria-hidden": !0 }),
699
+ r.caller.name,
675
700
  " · ",
676
- Le(l.at)
701
+ Le(r.at)
677
702
  ]
678
703
  }
679
704
  )
680
705
  }
681
- ) : /* @__PURE__ */ r(
706
+ ) : /* @__PURE__ */ t(
682
707
  "span",
683
708
  {
684
709
  "data-field-touch": e,
685
- "data-tip": `Changed ${Le(l.at)} by ${l.who}${i ? ` · ${l.via}` : ""}`,
710
+ "data-tip": `Changed ${Le(r.at)} by ${r.who}${i ? ` · ${r.via}` : ""}`,
686
711
  role: "img",
687
- "aria-label": `Changed ${Le(l.at)} by ${l.who}`,
712
+ "aria-label": `Changed ${Le(r.at)} by ${r.who}`,
688
713
  className: `ml-1 inline-block h-1.5 w-1.5 rounded-full align-middle ${i ? "bg-amber-400" : "bg-slate-300 dark:bg-slate-600"}`
689
714
  }
690
715
  );
691
- }, { data: N } = vl(a, x, !!$ && !d), F = xe(
692
- () => $ && (N != null && N.enabled) ? _l(N.findings) : null,
693
- [$, N]
716
+ }, { data: k } = Nl(a, x, !!_ && !s), $ = ve(
717
+ () => _ && (k != null && k.enabled) ? wl(k.findings) : null,
718
+ [_, k]
694
719
  ), ie = ({ field: e }) => {
695
- const l = F == null ? void 0 : F.get(e);
696
- if (!l || l.length === 0) return null;
697
- const i = l.map((c) => c.message || c.rule).join(`
720
+ const r = $ == null ? void 0 : $.get(e);
721
+ if (!r || r.length === 0) return null;
722
+ const i = r.map((c) => c.message || c.rule).join(`
698
723
  `);
699
- return /* @__PURE__ */ r(
724
+ return /* @__PURE__ */ t(
700
725
  "span",
701
726
  {
702
727
  "data-integrity-mark": e,
703
728
  "data-tip": i,
704
729
  role: "img",
705
- "aria-label": `${l.length} data integrity issue${l.length === 1 ? "" : "s"}: ${i}`,
730
+ "aria-label": `${r.length} data integrity issue${r.length === 1 ? "" : "s"}: ${i}`,
706
731
  className: "ml-1.5 inline-flex h-[14px] min-w-[14px] items-center justify-center rounded-full bg-amber-400/90 px-1 align-middle text-[9px] font-bold leading-none text-amber-950 dark:bg-amber-400 dark:text-amber-950",
707
- children: l.length > 1 ? l.length : "!"
732
+ children: r.length > 1 ? r.length : "!"
708
733
  }
709
734
  );
710
- }, { data: B } = U({
735
+ }, { data: B } = V({
711
736
  queryKey: ["cbv-collection-meta", a],
712
737
  queryFn: () => R.request(
713
- Q(`/collections/${a}`)
738
+ Y(`/collections/${a}`)
714
739
  ).then((e) => e.data),
715
740
  staleTime: 10 * 6e4,
716
741
  retry: !1
717
- }), Z = Pt(), { data: De } = U({
742
+ }), Z = xt(), { data: De } = V({
718
743
  queryKey: ["rrv-record", a, x],
719
- enabled: !d,
720
- queryFn: () => R.request(Q(`/items/${a}/${x}`)).then((e) => e.data),
744
+ enabled: !s,
745
+ queryFn: () => R.request(Y(`/items/${a}/${x}`)).then((e) => e.data),
721
746
  initialData: () => Z.getQueryData(["item", a, x]) ?? void 0,
722
747
  initialDataUpdatedAt: () => {
723
748
  var e;
@@ -725,47 +750,47 @@ function yt({
725
750
  },
726
751
  staleTime: 3e4,
727
752
  retry: !1
728
- }), m = V ?? De;
729
- zt(a, d ? null : x, (e) => {
753
+ }), m = j ?? De;
754
+ Zt(a, s ? null : x, (e) => {
730
755
  e.aspectsOnly || e.deleted || (Z.invalidateQueries({ queryKey: ["rrv-record", a, x] }), Z.invalidateQueries({ queryKey: ["field-touch", a, x] }));
731
756
  });
732
- const H = Wt(null), [me, Ee] = X(() => /* @__PURE__ */ new Set());
733
- ve(() => {
757
+ const H = Wt(null), [fe, Ee] = Q(() => /* @__PURE__ */ new Set());
758
+ _e(() => {
734
759
  const e = H.current;
735
- if (H.current = m ?? null, d || !e || !m || e === m) return;
736
- const l = Object.keys(m).filter(
760
+ if (H.current = m ?? null, s || !e || !m || e === m) return;
761
+ const r = Object.keys(m).filter(
737
762
  (c) => !c.startsWith("__") && JSON.stringify(e[c]) !== JSON.stringify(m[c])
738
763
  );
739
- if (l.length === 0) return;
740
- Ee(new Set(l));
764
+ if (r.length === 0) return;
765
+ Ee(new Set(r));
741
766
  const i = setTimeout(() => Ee(/* @__PURE__ */ new Set()), 2400);
742
767
  return () => clearTimeout(i);
743
- }, [m, d]);
744
- const D = (e) => me.has(e) ? " nvr-value-pulse-bg rounded-sm" : "", { data: ee } = U({
745
- queryKey: ["rrv-field-config", a, b.layout.id],
746
- enabled: !d,
768
+ }, [m, s]);
769
+ const E = (e) => fe.has(e) ? " nvr-value-pulse-bg rounded-sm" : "", { data: ee } = V({
770
+ queryKey: ["rrv-field-config", a, g.layout.id],
771
+ enabled: !s,
747
772
  queryFn: () => R.request(
748
- Q(`/field-config/${a}`, { layout_id: b.layout.id })
773
+ Y(`/field-config/${a}`, { layout_id: g.layout.id })
749
774
  ).then((e) => e.data ?? []).catch(() => null),
750
775
  staleTime: 5 * 6e4,
751
776
  retry: !1
752
- }), I = xe(
777
+ }), U = ve(
753
778
  () => new Map((ee ?? (B == null ? void 0 : B.fields) ?? []).map((e) => [e.field, e])),
754
779
  [ee, B]
755
- ), ue = (B == null ? void 0 : B.relations) ?? [], fe = (e) => {
756
- var l;
757
- return ((l = ue.find(
780
+ ), pe = (B == null ? void 0 : B.relations) ?? [], he = (e) => {
781
+ var r;
782
+ return ((r = pe.find(
758
783
  (i) => i.many_collection === a && i.many_field === e && i.one_collection
759
- )) == null ? void 0 : l.one_collection) ?? null;
760
- }, Y = (e) => ue.find(
761
- (l) => l.one_collection === a && (l.one_field === e || l.many_collection === e)
762
- ) ?? null, E = (e) => {
763
- var l;
764
- return !((e.is_visible === void 0 || e.is_visible) && ye(e.overrides).hidden !== !0 && !((l = I.get(e.field)) != null && l.hidden));
765
- }, _e = b.assignments.filter(
766
- (e) => (!e.field.startsWith("__") || Re(e.field)) && (_ || !E(e))
767
- ), se = b.assignments.filter(
768
- (e) => e.field.startsWith("__widget_") && e.widget_id != null && (_ || e.is_visible === void 0 || !!e.is_visible)
784
+ )) == null ? void 0 : r.one_collection) ?? null;
785
+ }, z = (e) => pe.find(
786
+ (r) => r.one_collection === a && (r.one_field === e || r.many_collection === e)
787
+ ) ?? null, P = (e) => {
788
+ var r;
789
+ return !((e.is_visible === void 0 || e.is_visible) && xe(e.overrides).hidden !== !0 && !((r = U.get(e.field)) != null && r.hidden));
790
+ }, se = g.assignments.filter(
791
+ (e) => (!e.field.startsWith("__") || Ce(e.field)) && (w || !P(e))
792
+ ), de = g.assignments.filter(
793
+ (e) => e.field.startsWith("__widget_") && e.widget_id != null && (w || e.is_visible === void 0 || !!e.is_visible)
769
794
  ), Be = (e) => {
770
795
  if (!e.input_bindings) return [];
771
796
  try {
@@ -773,40 +798,40 @@ function yt({
773
798
  } catch {
774
799
  return [];
775
800
  }
776
- }, He = w || d ? b.assignments.filter(
777
- (e) => e.field.startsWith("__") && !e.field.startsWith("__widget_") && !Re(e.field) && (_ || e.is_visible === void 0 || !!e.is_visible)
778
- ).sort((e, l) => e.sort - l.sort) : [], de = ["__pipeline__", "__addendums__"], Me = new Set(de), ke = (e) => (w == null ? void 0 : w(e.field, e)) ?? (d ? /* @__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 || Ze(e.field.replace(/^_+|_+$/g, "")) }) : null), Pe = (e, l = "trailing") => w || d ? He.filter(
779
- (i) => e === null ? i.group_key == null && l === "leading" === Me.has(i.field) : i.group_key === e
801
+ }, He = N || s ? g.assignments.filter(
802
+ (e) => e.field.startsWith("__") && !e.field.startsWith("__widget_") && !Ce(e.field) && (w || e.is_visible === void 0 || !!e.is_visible)
803
+ ).sort((e, r) => e.sort - r.sort) : [], oe = ["__pipeline__", "__addendums__"], Pe = new Set(oe), Ne = (e) => (N == null ? void 0 : N(e.field, e)) ?? (s ? /* @__PURE__ */ t("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 || Ze(e.field.replace(/^_+|_+$/g, "")) }) : null), Me = (e, r = "trailing") => N || s ? He.filter(
804
+ (i) => e === null ? i.group_key == null && r === "leading" === Pe.has(i.field) : i.group_key === e
780
805
  ).sort(
781
- (i, c) => l === "leading" && e === null ? de.indexOf(i.field) - de.indexOf(c.field) : 0
782
- ).map((i) => ({ key: i.field, a: i, node: ke(i) })).filter((i) => i.node != null) : [], Ne = (e, l = "trailing") => {
783
- const i = Pe(e, l);
784
- return i.length === 0 ? null : /* @__PURE__ */ r(
806
+ (i, c) => r === "leading" && e === null ? oe.indexOf(i.field) - oe.indexOf(c.field) : 0
807
+ ).map((i) => ({ key: i.field, a: i, node: Ne(i) })).filter((i) => i.node != null) : [], we = (e, r = "trailing") => {
808
+ const i = Me(e, r);
809
+ return i.length === 0 ? null : /* @__PURE__ */ t(
785
810
  "div",
786
811
  {
787
- className: l === "leading" ? "mb-4 space-y-4" : "mt-3 space-y-4",
788
- "data-read-live-slots": l,
789
- children: i.map((c) => /* @__PURE__ */ r("div", { children: k(
812
+ className: r === "leading" ? "mb-4 space-y-4" : "mt-3 space-y-4",
813
+ "data-read-live-slots": r,
814
+ children: i.map((c) => /* @__PURE__ */ t("div", { children: S(
790
815
  { kind: "slot", field: c.a.field, group_key: c.a.group_key ?? null },
791
816
  c.node,
792
- E(c.a)
817
+ P(c.a)
793
818
  ) }, c.key))
794
819
  }
795
820
  );
796
- }, [we, je] = X({}), Se = (e) => _ || we[e] === !0, [t, s] = X({}), o = ht(
797
- (e) => (l) => s((i) => i[e] === l ? i : { ...i, [e]: l }),
821
+ }, [Se, Ke] = Q({}), $e = (e) => w || Se[e] === !0, [l, d] = Q({}), o = ht(
822
+ (e) => (r) => d((i) => i[e] === r ? i : { ...i, [e]: r }),
798
823
  []
799
- ), [h, T] = X({}), M = ht(
800
- (e) => (l) => T((i) => i[e] === l ? i : { ...i, [e]: l }),
824
+ ), [h, T] = Q({}), M = ht(
825
+ (e) => (r) => T((i) => i[e] === r ? i : { ...i, [e]: r }),
801
826
  []
802
827
  ), re = (e) => {
803
- const l = se.filter((c) => c.group_key === e).sort((c, g) => c.sort - g.sort);
804
- if (l.length === 0) return null;
805
- const i = l.some((c) => Se(c.field));
806
- return /* @__PURE__ */ r("div", { className: i ? "mt-3 space-y-4" : "hidden", "data-read-widgets": !0, children: l.map((c) => /* @__PURE__ */ r("div", { hidden: !Se(c.field), children: k(
828
+ const r = de.filter((c) => c.group_key === e).sort((c, y) => c.sort - y.sort);
829
+ if (r.length === 0) return null;
830
+ const i = r.some((c) => $e(c.field));
831
+ return /* @__PURE__ */ t("div", { className: i ? "mt-3 space-y-4" : "hidden", "data-read-widgets": !0, children: r.map((c) => /* @__PURE__ */ t("div", { hidden: !$e(c.field), children: S(
807
832
  { kind: "slot", field: c.field, group_key: c.group_key ?? null },
808
- /* @__PURE__ */ r(
809
- kl,
833
+ /* @__PURE__ */ t(
834
+ Sl,
810
835
  {
811
836
  widgetId: c.widget_id,
812
837
  inputBindings: Be(c),
@@ -815,70 +840,81 @@ function yt({
815
840
  ready: !!m,
816
841
  label: c.label_override ?? void 0,
817
842
  defaultExpanded: c.default_expanded == null ? !0 : !!c.default_expanded,
818
- onContentChange: (g) => je(
819
- (K) => K[c.field] === g ? K : { ...K, [c.field]: g }
843
+ onContentChange: (y) => Ke(
844
+ (I) => I[c.field] === y ? I : { ...I, [c.field]: y }
820
845
  )
821
846
  }
822
847
  ),
823
- E(c)
848
+ P(c)
824
849
  ) }, c.field)) });
825
- }, [ne, Ke] = X(() => /* @__PURE__ */ new Set()), $e = _ || !m ? [] : pl({
826
- groups: b.groups.filter(
850
+ }, [ne, je] = Q(() => /* @__PURE__ */ new Set()), Fe = w || !m ? [] : gl({
851
+ groups: g.groups.filter(
827
852
  (e) => e.type !== "container" && e.visibility_mode !== "new_only"
828
853
  ),
829
854
  values: m,
830
- fields: [...I.values()],
831
- choices: xl([...I.values()]),
832
- quiet: Yt(b.layout.conditions),
833
- readable: (e) => hl(
834
- b.assignments.filter((l) => l.group_key === e).map((l) => l.field),
855
+ fields: [...U.values()],
856
+ choices: kl([...U.values()]),
857
+ quiet: Xt(g.layout.conditions),
858
+ readable: (e) => yl(
859
+ g.assignments.filter((r) => r.group_key === e).map((r) => r.field),
835
860
  m,
836
- !!d
861
+ !!s
837
862
  )
838
- }), Ge = (e) => Ke((l) => {
839
- const i = new Set(l);
863
+ }), Ge = (e) => je((r) => {
864
+ const i = new Set(r);
840
865
  return i.has(e) ? i.delete(e) : i.add(e), i;
841
- }), lt = [...b.groups].sort((e, l) => e.sort - l.sort).filter((e) => _ || e.visibility_mode !== "new_only").filter(
842
- (e) => _ || !m || ne.has(e.key) || rl(e.visible_when, m)
843
- ), [kt, Je] = X(() => /* @__PURE__ */ new Set()), pe = (e) => !e.is_collapsed || kt.has(e.key), Nt = (e) => Je((l) => {
844
- const i = new Set(l);
866
+ }), lt = [...g.groups].sort((e, r) => e.sort - r.sort).filter((e) => w || e.visibility_mode !== "new_only").filter(
867
+ (e) => w || !m || ne.has(e.key) || il(e.visible_when, m)
868
+ ), [Nt, Je] = Q(() => /* @__PURE__ */ new Set()), be = (e) => !e.is_collapsed || Nt.has(e.key), wt = (e) => Je((r) => {
869
+ const i = new Set(r);
845
870
  return i.has(e) ? i.delete(e) : i.add(e), i;
846
- }), Fe = (d == null ? void 0 : d.context.fold) ?? null, qe = (d == null ? void 0 : d.context.reveal) ?? null;
847
- ve(() => {
848
- Fe && Je(Fe.open ? new Set(b.groups.map((e) => e.key)) : /* @__PURE__ */ new Set());
849
- }, [Fe == null ? void 0 : Fe.seq]), ve(() => {
850
- const e = qe ? yl(qe.target) : null;
851
- e && Je((l) => l.has(e) ? l : new Set(l).add(e));
852
- }, [qe == null ? void 0 : qe.seq]);
871
+ }), qe = (s == null ? void 0 : s.context.fold) ?? null, Ae = (s == null ? void 0 : s.context.reveal) ?? null;
872
+ _e(() => {
873
+ qe && Je(qe.open ? new Set(g.groups.map((e) => e.key)) : /* @__PURE__ */ new Set());
874
+ }, [qe == null ? void 0 : qe.seq]), _e(() => {
875
+ const e = Ae ? _l(Ae.target) : null;
876
+ e && Je((r) => r.has(e) ? r : new Set(r).add(e));
877
+ }, [Ae == null ? void 0 : Ae.seq]);
853
878
  const Qe = [];
854
879
  for (const e of lt) {
855
880
  if (e.type === "container") {
856
- for (const l of lt.filter((i) => i.container_id != null && i.container_id === e.id))
857
- Qe.push(l);
881
+ for (const r of lt.filter((i) => i.container_id != null && i.container_id === e.id))
882
+ Qe.push(r);
858
883
  continue;
859
884
  }
860
885
  e.container_id == null && Qe.push(e);
861
886
  }
862
887
  const G = (e) => {
863
- var l;
864
- return !!((l = Y(e.field)) != null && l.junction_field);
888
+ var r;
889
+ return !!((r = z(e.field)) != null && r.junction_field);
865
890
  }, rt = (e) => {
866
891
  var i;
867
- const l = String(
868
- ye(e.overrides).interface ?? ((i = I.get(e.field)) == null ? void 0 : i.interface) ?? ""
892
+ const r = String(
893
+ xe(e.overrides).interface ?? ((i = U.get(e.field)) == null ? void 0 : i.interface) ?? ""
869
894
  );
870
- return /rich|wysiwyg|editorjs/i.test(l);
871
- }, Ae = (e) => {
872
- const l = I.get(e.field), i = ye(e.overrides);
873
- if (Re(e.field)) {
874
- const P = Zt(i), oe = ml((P == null ? void 0 : P.expr) ?? "", m ?? {});
875
- return /* @__PURE__ */ r("span", { "data-display-formula": e.field, className: "tabular-nums", children: oe.error ? "—" : el(oe.value, P ?? { format: "", currency: null }) });
895
+ return /rich|wysiwyg|editorjs/i.test(r);
896
+ }, Oe = (e) => {
897
+ const r = U.get(e.field), i = xe(e.overrides);
898
+ if (i.summary_toggle === !0 && !s && x && m)
899
+ return /* @__PURE__ */ t(
900
+ Cl,
901
+ {
902
+ collection: a,
903
+ itemId: String(x),
904
+ field: e.field,
905
+ value: m[e.field],
906
+ label: ce(e)
907
+ }
908
+ );
909
+ if (Ce(e.field)) {
910
+ const K = tl(i), ue = pl((K == null ? void 0 : K.expr) ?? "", m ?? {});
911
+ return /* @__PURE__ */ t("span", { "data-display-formula": e.field, className: "tabular-nums", children: ue.error ? "—" : ll(ue.value, K ?? { format: "", currency: null }) });
876
912
  }
877
- const c = Y(e.field);
878
- if (d && !x && (c != null && c.junction_field)) return /* @__PURE__ */ r(le, {});
913
+ const c = z(e.field);
914
+ if (s && !x && (c != null && c.junction_field)) return /* @__PURE__ */ t(le, {});
879
915
  if (c != null && c.junction_field && c.many_collection && c.many_field)
880
- return /* @__PURE__ */ r(
881
- ql,
916
+ return /* @__PURE__ */ t(
917
+ Rl,
882
918
  {
883
919
  junction: c.many_collection,
884
920
  parentFk: c.many_field,
@@ -889,35 +925,35 @@ function yt({
889
925
  relation: c
890
926
  }
891
927
  );
892
- const g = m == null ? void 0 : m[e.field], K = fe(e.field);
893
- if (K === "nivaro_users" && g != null)
894
- return /* @__PURE__ */ r("span", { className: "inline-block", children: /* @__PURE__ */ r(vt, { userId: String(g), size: "compact" }) });
895
- if (K) return /* @__PURE__ */ r(tt, { collection: K, id: g });
896
- if ((l == null ? void 0 : l.type) === "boolean" && (g == null || g === "")) return /* @__PURE__ */ r(Ve, { value: !1 });
897
- if (g == null || g === "") return /* @__PURE__ */ r(le, {});
898
- if ((l == null ? void 0 : l.type) === "boolean")
899
- return /* @__PURE__ */ r(
928
+ const y = m == null ? void 0 : m[e.field], I = he(e.field);
929
+ if (I === "nivaro_users" && y != null)
930
+ return /* @__PURE__ */ t("span", { className: "inline-block", children: /* @__PURE__ */ t(_t, { userId: String(y), size: "compact" }) });
931
+ if (I) return /* @__PURE__ */ t(tt, { collection: I, id: y });
932
+ if ((r == null ? void 0 : r.type) === "boolean" && (y == null || y === "")) return /* @__PURE__ */ t(Ve, { value: !1 });
933
+ if (y == null || y === "") return /* @__PURE__ */ t(le, {});
934
+ if ((r == null ? void 0 : r.type) === "boolean")
935
+ return /* @__PURE__ */ t(
900
936
  Ve,
901
937
  {
902
- value: g,
938
+ value: y,
903
939
  trueTone: (i.options ?? {}).trueTone ?? "positive"
904
940
  }
905
941
  );
906
942
  const te = i.options ?? {};
907
- return rt(e) && typeof g == "string" ? /^\s*\{/.test(g) ? /* @__PURE__ */ r("div", { className: "min-w-0 whitespace-pre-wrap font-normal [overflow-wrap:anywhere]", children: sl(g) }) : /* @__PURE__ */ r(
943
+ return rt(e) && typeof y == "string" ? /^\s*\{/.test(y) ? /* @__PURE__ */ t("div", { className: "min-w-0 whitespace-pre-wrap font-normal [overflow-wrap:anywhere]", children: cl(y) }) : /* @__PURE__ */ t(
908
944
  "div",
909
945
  {
910
946
  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",
911
- dangerouslySetInnerHTML: { __html: ll(g) }
947
+ dangerouslySetInnerHTML: { __html: al(y) }
912
948
  }
913
- ) : te.format === "currency" ? /* @__PURE__ */ r("span", { className: "tabular-nums", children: et(g) }) : (l == null ? void 0 : l.type) === "decimal" || (l == null ? void 0 : l.type) === "float" ? /* @__PURE__ */ r("span", { className: "tabular-nums", children: Ue(g) }) : (l == null ? void 0 : l.type) === "date" || (l == null ? void 0 : l.type) === "datetime" || (l == null ? void 0 : l.type) === "timestamp" ? _t(g) : String(g);
914
- }, wt = (e) => {
915
- const l = ye(e.overrides), i = Y(e.field);
949
+ ) : te.format === "currency" ? /* @__PURE__ */ t("span", { className: "tabular-nums", children: et(y) }) : (r == null ? void 0 : r.type) === "decimal" || (r == null ? void 0 : r.type) === "float" ? /* @__PURE__ */ t("span", { className: "tabular-nums", children: Ue(y) }) : (r == null ? void 0 : r.type) === "date" || (r == null ? void 0 : r.type) === "datetime" || (r == null ? void 0 : r.type) === "timestamp" ? kt(y) : String(y);
950
+ }, St = (e) => {
951
+ const r = xe(e.overrides), i = z(e.field);
916
952
  if (!(i != null && i.many_collection) || !i.many_field) return null;
917
- if (d && !x) return /* @__PURE__ */ r("p", { className: "py-3 text-[12px] text-slate-400", children: "No records" });
918
- const c = l.options ?? {}, g = (() => {
919
- var P;
920
- const te = (P = I.get(e.field)) == null ? void 0 : P.options;
953
+ if (s && !x) return /* @__PURE__ */ t("p", { className: "py-3 text-[12px] text-slate-400", children: "No records" });
954
+ const c = r.options ?? {}, y = (() => {
955
+ var K;
956
+ const te = (K = U.get(e.field)) == null ? void 0 : K.options;
921
957
  if (!te) return {};
922
958
  if (typeof te == "string")
923
959
  try {
@@ -926,221 +962,221 @@ function yt({
926
962
  return {};
927
963
  }
928
964
  return te;
929
- })(), K = c.layout_id ?? null;
930
- return /* @__PURE__ */ r(
931
- Al,
965
+ })(), I = c.layout_id ?? null;
966
+ return /* @__PURE__ */ t(
967
+ Tl,
932
968
  {
933
969
  collection: i.many_collection,
934
970
  fkField: i.many_field,
935
971
  parentId: x,
936
- layoutId: K,
937
- presets: c.column_presets ?? g.column_presets,
938
- defaultPreset: c.default_preset ?? g.default_preset ?? null,
972
+ layoutId: I,
973
+ presets: c.column_presets ?? y.column_presets,
974
+ defaultPreset: c.default_preset ?? y.default_preset ?? null,
939
975
  onCount: o(e.field)
940
976
  },
941
977
  e.field
942
978
  );
943
- }, z = (e) => !!Y(e.field) && !G(e), St = !!b.layout.hide_empty, nt = Array.isArray(b.layout.header_fields) ? b.layout.header_fields.filter((e) => typeof e == "string") : [], $t = new Set(nt), Ft = (e) => {
979
+ }, X = (e) => !!z(e.field) && !G(e), $t = !!g.layout.hide_empty, nt = Array.isArray(g.layout.header_fields) ? g.layout.header_fields.filter((e) => typeof e == "string") : [], Ft = new Set(nt), qt = (e) => {
944
980
  if (!m || G(e)) return !1;
945
- const l = m[e.field];
946
- return l == null || l === "" || Array.isArray(l) && l.length === 0;
947
- }, qt = (e) => _e.find((l) => l.field === e), he = (e) => {
981
+ const r = m[e.field];
982
+ return r == null || r === "" || Array.isArray(r) && r.length === 0;
983
+ }, At = (e) => se.find((r) => r.field === e), ce = (e) => {
948
984
  var c;
949
- const l = ye(e.overrides).label, i = O ? Xt(e.overrides, O).label : void 0;
950
- return i !== void 0 ? i : Re(e.field) ? typeof l == "string" && l.trim() ? l : "Formula" : typeof l == "string" && l.trim() ? l : e.label_override || ((c = I.get(e.field)) == null ? void 0 : c.label) || Ze(e.field);
951
- }, At = (e) => {
952
- const l = Gt(e.swap_config), i = _e.filter((n) => n.group_key === e.key && !$t.has(n.field)).filter((n) => _ || !m || !Jt(n.overrides) || !ge(m[n.field])).sort((n, S) => n.sort - S.sort), c = se.filter((n) => n.group_key === e.key), g = Pe(e.key), K = i.length === 0 && c.length === 0 && g.length === 0;
953
- if (K && !d) return null;
954
- const te = (n) => St && !_ && (z(n) || G(n)) && ((f == null ? void 0 : f[n.field]) ?? t[n.field]) === 0, P = i.filter((n) => !z(n)), oe = i.filter(z), We = c.filter((n) => Se(n.field)), Tt = !e.hide_when_empty && g.length === 0 && We.length === 0 && i.length > 0 && i.some((n) => z(n) || G(n)) && i.every(te), Ye = (n) => !Tt && te(n), Rt = i.filter((n) => !Ye(n)), be = (n) => (f == null ? void 0 : f[n.field]) ?? t[n.field], Lt = !!e.hide_when_empty && !d && !_ && !!m && g.length === 0 && We.length === 0 && i.every((n) => z(n) || G(n) ? be(n) === 0 : ge(m[n.field])) || !K && Rt.length === 0 && g.length === 0 && We.length === 0, Ct = (n) => (f == null ? void 0 : f[n.field]) ?? t[n.field], ze = !!l.emptyText && !!m && !d && g.length === 0 && We.length === 0 && i.every((n) => z(n) || G(n) ? Ct(n) === 0 : ge(m[n.field])), Dt = Qt(P, { rows: l.rows }).units, Xe = e.is_collapsed ? wl(e.summary_fields).map((n) => {
955
- const S = i.find((Oe) => Oe.field === n.field);
956
- return S ? { a: S, label: n.label || he(S) } : null;
985
+ const r = xe(e.overrides).label, i = A ? el(e.overrides, A).label : void 0;
986
+ return i !== void 0 ? i : Ce(e.field) ? typeof r == "string" && r.trim() ? r : "Formula" : typeof r == "string" && r.trim() ? r : e.label_override || ((c = U.get(e.field)) == null ? void 0 : c.label) || Ze(e.field);
987
+ }, Ot = (e) => {
988
+ const r = Qt(e.swap_config), i = se.filter((n) => n.group_key === e.key && !Ft.has(n.field)).filter((n) => w || !m || !Yt(n.overrides) || !ye(m[n.field])).sort((n, O) => n.sort - O.sort), c = de.filter((n) => n.group_key === e.key), y = Me(e.key), I = i.length === 0 && c.length === 0 && y.length === 0;
989
+ if (I && !s) return null;
990
+ const te = (n) => $t && !w && (X(n) || G(n)) && ((f == null ? void 0 : f[n.field]) ?? l[n.field]) === 0, K = i.filter((n) => !X(n)), ue = i.filter(X), We = c.filter((n) => $e(n.field)), Tt = !e.hide_when_empty && y.length === 0 && We.length === 0 && i.length > 0 && i.some((n) => X(n) || G(n)) && i.every(te), Ye = (n) => !Tt && te(n), Ct = i.filter((n) => !Ye(n)), ge = (n) => (f == null ? void 0 : f[n.field]) ?? l[n.field], Lt = !!e.hide_when_empty && !s && !w && !!m && y.length === 0 && We.length === 0 && i.every((n) => X(n) || G(n) ? ge(n) === 0 : ye(m[n.field])) || !I && Ct.length === 0 && y.length === 0 && We.length === 0, Dt = (n) => (f == null ? void 0 : f[n.field]) ?? l[n.field], ze = !!r.emptyText && !!m && !s && y.length === 0 && We.length === 0 && i.every((n) => X(n) || G(n) ? Dt(n) === 0 : ye(m[n.field])), Et = zt(K, { rows: r.rows }).units, Xe = e.is_collapsed ? Fl(e.summary_fields).map((n) => {
991
+ const O = i.find((Re) => Re.field === n.field);
992
+ return O ? { a: O, label: n.label || ce(O) } : null;
957
993
  }).filter((n) => !!n).filter(
958
- ({ a: n }) => !e.summary_hide_empty || !m || (z(n) || G(n) ? be(n) !== 0 : !ge(m[n.field]))
959
- ).slice(0, Nl) : [], ot = e.read_width === "full" || e.read_width === "half" || e.read_width === "third" ? e.read_width : oe.length > 0 || c.length > 0 || g.length > 0 || P.length > 4 ? "full" : "half", Et = (n) => {
960
- var ut, ft, pt;
961
- const S = Ye(n), J = !!(ye(n.overrides).options ?? {}).emphasis, Te = rt(n) || !!((ft = (ut = I.get(n.field)) == null ? void 0 : ut.interface) != null && ft.includes("rich-text")), ct = m == null ? void 0 : m[n.field], mt = !Te && !G(n) && !fe(n.field) && (String(((pt = I.get(n.field)) == null ? void 0 : pt.interface) ?? "").includes("textarea") || typeof ct == "string" && ct.length > 36);
962
- return /* @__PURE__ */ r(
994
+ ({ a: n }) => !e.summary_hide_empty || !m || (X(n) || G(n) ? ge(n) !== 0 : !ye(m[n.field]))
995
+ ).slice(0, $l) : [], ot = e.read_width === "full" || e.read_width === "half" || e.read_width === "third" ? e.read_width : ue.length > 0 || c.length > 0 || y.length > 0 || K.length > 4 ? "full" : "half", Pt = (n) => {
996
+ var mt, ft, pt;
997
+ const O = Ye(n), J = !!(xe(n.overrides).options ?? {}).emphasis, Te = rt(n) || !!((ft = (mt = U.get(n.field)) == null ? void 0 : mt.interface) != null && ft.includes("rich-text")), ct = m == null ? void 0 : m[n.field], ut = !Te && !G(n) && !he(n.field) && (String(((pt = U.get(n.field)) == null ? void 0 : pt.interface) ?? "").includes("textarea") || typeof ct == "string" && ct.length > 36);
998
+ return /* @__PURE__ */ t(
963
999
  "div",
964
1000
  {
965
- hidden: S,
966
- className: `min-w-0 ${Te || G(n) && (h[n.field] === "nivaro_files" || (t[n.field] ?? 0) > 3) ? "col-span-full" : J || mt ? "col-span-2" : ""}`,
967
- children: k(
1001
+ hidden: O,
1002
+ className: `min-w-0 ${Te || G(n) && (h[n.field] === "nivaro_files" || (l[n.field] ?? 0) > 3) ? "col-span-full" : J || ut ? "col-span-2" : ""}`,
1003
+ children: S(
968
1004
  L(n),
969
- /* @__PURE__ */ p(ce, { children: [
1005
+ /* @__PURE__ */ p(me, { children: [
970
1006
  /* @__PURE__ */ p("dt", { className: Ie, children: [
971
- he(n),
972
- /* @__PURE__ */ r(ie, { field: n.field }),
973
- /* @__PURE__ */ r(bt, { field: n.field }),
1007
+ ce(n),
1008
+ /* @__PURE__ */ t(ie, { field: n.field }),
1009
+ /* @__PURE__ */ t(bt, { field: n.field }),
974
1010
  v(n.field)
975
1011
  ] }),
976
- /* @__PURE__ */ r(
1012
+ /* @__PURE__ */ t(
977
1013
  "dd",
978
1014
  {
979
1015
  "data-replay-field": n.field,
980
1016
  "data-field-collection": a,
981
- "data-remote-changed": me.has(n.field) || void 0,
982
- className: `mt-1 min-w-0${D(n.field)} ${J ? "text-[17px] font-semibold tracking-[-0.01em] text-slate-900 dark:text-white" : `${G(n) || Te ? "" : mt ? "line-clamp-3 break-words " : "truncate "}text-[13px] font-medium text-slate-800 dark:text-slate-100`}`,
983
- children: m ? Ae(n) : /* @__PURE__ */ r("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
1017
+ "data-remote-changed": fe.has(n.field) || void 0,
1018
+ className: `mt-1 min-w-0${E(n.field)} ${J ? "text-[17px] font-semibold tracking-[-0.01em] text-slate-900 dark:text-white" : `${G(n) || Te ? "" : ut ? "line-clamp-3 break-words " : "truncate "}text-[13px] font-medium text-slate-800 dark:text-slate-100`}`,
1019
+ children: m ? Oe(n) : /* @__PURE__ */ t("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
984
1020
  }
985
1021
  )
986
1022
  ] }),
987
- E(n)
1023
+ P(n)
988
1024
  )
989
1025
  },
990
1026
  n.field
991
1027
  );
992
- }, Mt = (n, S) => {
993
- const Oe = m && !d ? S.filter((J) => !ge(m[J.field])) : S;
1028
+ }, Mt = (n, O) => {
1029
+ const Re = m && !s ? O.filter((J) => !ye(m[J.field])) : O;
994
1030
  return /* @__PURE__ */ p(
995
1031
  "div",
996
1032
  {
997
1033
  "data-read-row": n.key,
998
- className: `min-w-0 ${S.length > 2 ? "col-span-full" : "col-span-2"}`,
1034
+ className: `min-w-0 ${O.length > 2 ? "col-span-full" : "col-span-2"}`,
999
1035
  children: [
1000
- /* @__PURE__ */ r("dt", { className: Ie, children: n.label.trim() || S.map(he).join(" / ") }),
1001
- /* @__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: m ? Oe.length === 0 ? /* @__PURE__ */ r(le, {}) : Oe.map((J, Te) => /* @__PURE__ */ p(It, { children: [
1002
- Te > 0 && /* @__PURE__ */ r("span", { "aria-hidden": !0, className: "text-slate-300 dark:text-slate-600", children: "·" }),
1003
- k(
1036
+ /* @__PURE__ */ t("dt", { className: Ie, children: n.label.trim() || O.map(ce).join(" / ") }),
1037
+ /* @__PURE__ */ t("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: m ? Re.length === 0 ? /* @__PURE__ */ t(le, {}) : Re.map((J, Te) => /* @__PURE__ */ p(It, { children: [
1038
+ Te > 0 && /* @__PURE__ */ t("span", { "aria-hidden": !0, className: "text-slate-300 dark:text-slate-600", children: "·" }),
1039
+ S(
1004
1040
  L(J),
1005
- /* @__PURE__ */ r(
1041
+ /* @__PURE__ */ t(
1006
1042
  "span",
1007
1043
  {
1008
1044
  "data-replay-field": J.field,
1009
1045
  "data-field-collection": a,
1010
- className: `min-w-0 break-words${D(J.field)}`,
1011
- children: Ae(J)
1046
+ className: `min-w-0 break-words${E(J.field)}`,
1047
+ children: Oe(J)
1012
1048
  }
1013
1049
  ),
1014
- E(J)
1050
+ P(J)
1015
1051
  )
1016
- ] }, J.field)) : /* @__PURE__ */ r("span", { className: "inline-block h-3.5 w-28 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) })
1052
+ ] }, J.field)) : /* @__PURE__ */ t("span", { className: "inline-block h-3.5 w-28 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) })
1017
1053
  ]
1018
1054
  },
1019
1055
  `row:${n.key}`
1020
1056
  );
1021
1057
  };
1022
- return /* @__PURE__ */ r(
1058
+ return /* @__PURE__ */ t(
1023
1059
  "section",
1024
1060
  {
1025
1061
  hidden: Lt,
1026
1062
  "data-read-section": e.key,
1027
1063
  "data-read-width": ot,
1028
1064
  className: "min-w-0 rounded-xl border border-slate-200 bg-white dark:border-slate-700/60 dark:bg-slate-900/40",
1029
- children: k(
1065
+ children: S(
1030
1066
  { kind: "group", key: e.key },
1031
- /* @__PURE__ */ p(ce, { children: [
1067
+ /* @__PURE__ */ p(me, { children: [
1032
1068
  /* @__PURE__ */ p(
1033
1069
  "h3",
1034
1070
  {
1035
1071
  "data-read-head": "",
1036
- className: `group/rs relative flex items-center justify-between gap-2 px-5 py-2.5 text-[12.5px] font-semibold text-slate-700 dark:text-slate-200 ${pe(e) ? "border-b border-slate-100 dark:border-slate-800" : ""}`,
1072
+ className: `group/rs relative flex items-center justify-between gap-2 px-5 py-2.5 text-[12.5px] font-semibold text-slate-700 dark:text-slate-200 ${be(e) ? "border-b border-slate-100 dark:border-slate-800" : ""}`,
1037
1073
  children: [
1038
- e.is_collapsed ? /* @__PURE__ */ p(ce, { children: [
1039
- /* @__PURE__ */ r(
1074
+ e.is_collapsed ? /* @__PURE__ */ p(me, { children: [
1075
+ /* @__PURE__ */ t(
1040
1076
  "button",
1041
1077
  {
1042
1078
  type: "button",
1043
- onClick: () => Nt(e.key),
1044
- "aria-expanded": pe(e),
1045
- className: `min-w-0 text-left after:absolute after:inset-0 group-hover/rs:text-slate-900 dark:group-hover/rs:text-white ${Xe.length > 0 && !pe(e) ? "shrink-0" : "flex-1"}`,
1079
+ onClick: () => wt(e.key),
1080
+ "aria-expanded": be(e),
1081
+ className: `min-w-0 text-left after:absolute after:inset-0 group-hover/rs:text-slate-900 dark:group-hover/rs:text-white ${Xe.length > 0 && !be(e) ? "shrink-0" : "flex-1"}`,
1046
1082
  children: e.label
1047
1083
  }
1048
1084
  ),
1049
- !pe(e) && Xe.length > 0 && // #3195: two or three values while the section is closed. Not
1085
+ !be(e) && Xe.length > 0 && // #3195: two or three values while the section is closed. Not
1050
1086
  // interactive: the heading's toggle covers the whole row.
1051
- /* @__PURE__ */ r(
1087
+ /* @__PURE__ */ t(
1052
1088
  "span",
1053
1089
  {
1054
1090
  "data-read-collapsed-summary": e.key,
1055
1091
  className: "pointer-events-none flex min-w-0 flex-1 items-baseline gap-x-3 overflow-hidden whitespace-nowrap text-[12px] font-normal",
1056
- children: Xe.map(({ a: n, label: S }) => /* @__PURE__ */ p("span", { className: "flex min-w-0 shrink items-baseline gap-1", children: [
1057
- /* @__PURE__ */ r("span", { className: "shrink-0 text-[10px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500", children: S }),
1058
- /* @__PURE__ */ r("span", { className: "min-w-0 truncate font-medium text-slate-700 dark:text-slate-300", children: m ? z(n) || G(n) ? be(n) == null ? "…" : `${be(n)} ${z(n) ? be(n) === 1 ? "row" : "rows" : be(n) === 1 ? "item" : "items"}` : ge(m[n.field]) ? /* @__PURE__ */ r("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : Ae(n) : "…" })
1092
+ children: Xe.map(({ a: n, label: O }) => /* @__PURE__ */ p("span", { className: "flex min-w-0 shrink items-baseline gap-1", children: [
1093
+ /* @__PURE__ */ t("span", { className: "shrink-0 text-[10px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500", children: O }),
1094
+ /* @__PURE__ */ t("span", { className: "min-w-0 truncate font-medium text-slate-700 dark:text-slate-300", children: m ? X(n) || G(n) ? ge(n) == null ? "…" : `${ge(n)} ${X(n) ? ge(n) === 1 ? "row" : "rows" : ge(n) === 1 ? "item" : "items"}` : ye(m[n.field]) ? /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : Oe(n) : "…" })
1059
1095
  ] }, n.field))
1060
1096
  }
1061
1097
  )
1062
- ] }) : /* @__PURE__ */ r("span", { className: "min-w-0 flex-1", children: e.label }),
1063
- A && (P.length > 0 || oe.length > 0) && /* @__PURE__ */ r(
1098
+ ] }) : /* @__PURE__ */ t("span", { className: "min-w-0 flex-1", children: e.label }),
1099
+ q && (K.length > 0 || ue.length > 0) && /* @__PURE__ */ t(
1064
1100
  "button",
1065
1101
  {
1066
1102
  type: "button",
1067
1103
  "data-read-edit-section": e.key,
1068
1104
  onClick: () => {
1069
- var n, S;
1070
- return A(e.key, ((n = P[0]) == null ? void 0 : n.field) ?? ((S = oe[0]) == null ? void 0 : S.field) ?? null);
1105
+ var n, O;
1106
+ return q(e.key, ((n = K[0]) == null ? void 0 : n.field) ?? ((O = ue[0]) == null ? void 0 : O.field) ?? null);
1071
1107
  },
1072
1108
  title: `Edit ${e.label}`,
1073
1109
  "aria-label": `Edit ${e.label}`,
1074
1110
  className: "relative -my-1 rounded p-1 text-slate-400 opacity-0 transition-opacity hover:bg-slate-100 hover:text-slate-700 focus-visible:opacity-100 group-hover/rs:opacity-100 dark:hover:bg-white/5 dark:hover:text-slate-200 motion-reduce:transition-none",
1075
- children: /* @__PURE__ */ r(jt, { className: "h-3 w-3" })
1111
+ children: /* @__PURE__ */ t(Kt, { className: "h-3 w-3" })
1076
1112
  }
1077
1113
  ),
1078
- e.is_collapsed && /* @__PURE__ */ r(
1079
- Kt,
1114
+ e.is_collapsed && /* @__PURE__ */ t(
1115
+ jt,
1080
1116
  {
1081
1117
  "aria-hidden": "true",
1082
- className: `pointer-events-none h-3.5 w-3.5 shrink-0 transition-transform group-hover/rs:text-slate-700 dark:group-hover/rs:text-slate-200 ${pe(e) ? "" : "-rotate-90"}`
1118
+ className: `pointer-events-none h-3.5 w-3.5 shrink-0 transition-transform group-hover/rs:text-slate-700 dark:group-hover/rs:text-slate-200 ${be(e) ? "" : "-rotate-90"}`
1083
1119
  }
1084
1120
  )
1085
1121
  ]
1086
1122
  }
1087
1123
  ),
1088
- /* @__PURE__ */ p("div", { "data-read-body": "", className: "px-5 pb-5 pt-4", hidden: !pe(e), children: [
1089
- ze && /* @__PURE__ */ r(
1124
+ /* @__PURE__ */ p("div", { "data-read-body": "", className: "px-5 pb-5 pt-4", hidden: !be(e), children: [
1125
+ ze && /* @__PURE__ */ t(
1090
1126
  "p",
1091
1127
  {
1092
1128
  "data-read-empty": e.key,
1093
1129
  className: "text-[13px] text-slate-500 dark:text-slate-400",
1094
- children: l.emptyText
1130
+ children: r.emptyText
1095
1131
  }
1096
1132
  ),
1097
- P.length > 0 && // One column rhythm for the whole page: every section's facts sit
1133
+ K.length > 0 && // One column rhythm for the whole page: every section's facts sit
1098
1134
  // on the same 2 / 3 / 4 / 6 tracks, so values line up card to
1099
1135
  // card instead of each card auto-filling its own grid. Hidden, not
1100
1136
  // unrendered, under the empty text: its link facts must keep reporting.
1101
- /* @__PURE__ */ r(
1137
+ /* @__PURE__ */ t(
1102
1138
  "dl",
1103
1139
  {
1104
1140
  className: "grid gap-x-6 gap-y-5",
1105
1141
  "data-read-dl": ot,
1106
1142
  style: ze ? { display: "none" } : void 0,
1107
- children: Dt.map(
1108
- (n) => n.kind === "row" ? Mt(n.row, n.members) : Et(n.field)
1143
+ children: Et.map(
1144
+ (n) => n.kind === "row" ? Mt(n.row, n.members) : Pt(n.field)
1109
1145
  )
1110
1146
  }
1111
1147
  ),
1112
- oe.map((n) => {
1113
- var S;
1114
- return /* @__PURE__ */ r(
1148
+ ue.map((n) => {
1149
+ var O;
1150
+ return /* @__PURE__ */ t(
1115
1151
  "div",
1116
1152
  {
1117
- className: P.length > 0 ? "mt-3" : "",
1153
+ className: K.length > 0 ? "mt-3" : "",
1118
1154
  hidden: Ye(n) || ze,
1119
- children: k(
1155
+ children: S(
1120
1156
  L(n),
1121
- /* @__PURE__ */ p(ce, { children: [
1122
- (S = F == null ? void 0 : F.get(n.field)) != null && S.length ? /* @__PURE__ */ p("div", { className: "mb-1.5 flex items-center gap-1.5 text-[11px] font-medium text-amber-700 dark:text-amber-300", children: [
1123
- /* @__PURE__ */ r("span", { children: he(n) }),
1124
- /* @__PURE__ */ r(ie, { field: n.field }),
1157
+ /* @__PURE__ */ p(me, { children: [
1158
+ (O = $ == null ? void 0 : $.get(n.field)) != null && O.length ? /* @__PURE__ */ p("div", { className: "mb-1.5 flex items-center gap-1.5 text-[11px] font-medium text-amber-700 dark:text-amber-300", children: [
1159
+ /* @__PURE__ */ t("span", { children: ce(n) }),
1160
+ /* @__PURE__ */ t(ie, { field: n.field }),
1125
1161
  /* @__PURE__ */ p("span", { className: "font-normal text-amber-700/80 dark:text-amber-300/80", children: [
1126
1162
  "— ",
1127
- F.get(n.field).length,
1163
+ $.get(n.field).length,
1128
1164
  " line issue",
1129
- F.get(n.field).length === 1 ? "" : "s",
1165
+ $.get(n.field).length === 1 ? "" : "s",
1130
1166
  "; switch to Edit to fix"
1131
1167
  ] })
1132
1168
  ] }) : null,
1133
- (W ? W(n) : null) ?? wt(n)
1169
+ (C ? C(n) : null) ?? St(n)
1134
1170
  ] }),
1135
- E(n)
1171
+ P(n)
1136
1172
  )
1137
1173
  },
1138
1174
  n.field
1139
1175
  );
1140
1176
  }),
1141
1177
  re(e.key),
1142
- Ne(e.key),
1143
- K && d && /* @__PURE__ */ r(
1178
+ we(e.key),
1179
+ I && s && /* @__PURE__ */ t(
1144
1180
  "div",
1145
1181
  {
1146
1182
  "data-design-drop": e.key,
@@ -1155,80 +1191,132 @@ function yt({
1155
1191
  },
1156
1192
  e.key
1157
1193
  );
1158
- }, at = Ne(null), Ot = Ne(null, "leading"), it = nt.map((e) => qt(e)).filter((e) => !!e && !z(e)).filter((e) => _ || !Ft(e)), [ae, ...st] = it;
1194
+ }, at = we(null), Rt = we(null, "leading"), it = nt.map((e) => At(e)).filter((e) => !!e && !X(e)).filter((e) => w || !qt(e)), [ae, ...st] = it;
1159
1195
  return /* @__PURE__ */ p(
1160
1196
  "div",
1161
1197
  {
1162
- className: q ? "min-h-0 flex-1" : "min-h-0 flex-1 overflow-y-auto bg-slate-50/60 px-5 py-4 dark:bg-transparent",
1198
+ className: F ? "min-h-0 flex-1" : "min-h-0 flex-1 overflow-y-auto bg-slate-50/60 px-5 py-4 dark:bg-transparent",
1163
1199
  children: [
1164
- Ot,
1200
+ Rt,
1165
1201
  it.length > 0 && /* @__PURE__ */ p(
1166
1202
  "div",
1167
1203
  {
1168
1204
  "data-read-header": !0,
1169
1205
  className: "mb-4 rounded-xl border border-slate-200 bg-white px-5 py-4 dark:border-slate-700/60 dark:bg-slate-900/40",
1170
1206
  children: [
1171
- ae && k(
1207
+ ae && S(
1172
1208
  { kind: "header", field: ae.field },
1173
1209
  /* @__PURE__ */ p("div", { className: "min-w-0", children: [
1174
1210
  /* @__PURE__ */ p("p", { className: Ie, children: [
1175
- he(ae),
1176
- /* @__PURE__ */ r(ie, { field: ae.field })
1211
+ ce(ae),
1212
+ /* @__PURE__ */ t(ie, { field: ae.field })
1177
1213
  ] }),
1178
- /* @__PURE__ */ r(
1214
+ /* @__PURE__ */ t(
1179
1215
  "p",
1180
1216
  {
1181
1217
  "data-replay-field": ae.field,
1182
1218
  "data-field-collection": a,
1183
- className: `truncate text-[22px] font-semibold leading-tight tracking-[-0.015em] text-slate-900 dark:text-white${D(ae.field)}`,
1184
- children: m ? Ae(ae) : "…"
1219
+ className: `truncate text-[22px] font-semibold leading-tight tracking-[-0.015em] text-slate-900 dark:text-white${E(ae.field)}`,
1220
+ children: m ? Oe(ae) : "…"
1185
1221
  }
1186
1222
  )
1187
1223
  ] }),
1188
- E(ae)
1224
+ P(ae)
1189
1225
  ),
1190
- st.length > 0 && /* @__PURE__ */ r("dl", { className: "mt-3 flex flex-wrap gap-x-8 gap-y-2", children: st.map((e) => /* @__PURE__ */ r("div", { className: "min-w-0", children: k(
1226
+ st.length > 0 && /* @__PURE__ */ t("dl", { className: "mt-3 flex flex-wrap gap-x-8 gap-y-2", children: st.map((e) => /* @__PURE__ */ t("div", { className: "min-w-0", children: S(
1191
1227
  { kind: "header", field: e.field },
1192
- /* @__PURE__ */ p(ce, { children: [
1228
+ /* @__PURE__ */ p(me, { children: [
1193
1229
  /* @__PURE__ */ p("dt", { className: Ie, children: [
1194
- he(e),
1195
- /* @__PURE__ */ r(ie, { field: e.field }),
1196
- /* @__PURE__ */ r(bt, { field: e.field }),
1230
+ ce(e),
1231
+ /* @__PURE__ */ t(ie, { field: e.field }),
1232
+ /* @__PURE__ */ t(bt, { field: e.field }),
1197
1233
  v(e.field)
1198
1234
  ] }),
1199
- /* @__PURE__ */ r(
1235
+ /* @__PURE__ */ t(
1200
1236
  "dd",
1201
1237
  {
1202
1238
  "data-replay-field": e.field,
1203
1239
  "data-field-collection": a,
1204
- "data-remote-changed": me.has(e.field) || void 0,
1205
- className: `mt-0.5 truncate text-[13px] font-medium text-slate-800 dark:text-slate-100${D(e.field)}`,
1206
- children: m ? Ae(e) : "…"
1240
+ "data-remote-changed": fe.has(e.field) || void 0,
1241
+ className: `mt-0.5 truncate text-[13px] font-medium text-slate-800 dark:text-slate-100${E(e.field)}`,
1242
+ children: m ? Oe(e) : "…"
1207
1243
  }
1208
1244
  )
1209
1245
  ] }),
1210
- E(e)
1246
+ P(e)
1211
1247
  ) }, e.field)) })
1212
1248
  ]
1213
1249
  }
1214
1250
  ),
1215
- /* @__PURE__ */ r("style", { children: Sl }),
1216
- B && $e.length > 0 && /* @__PURE__ */ r("div", { className: "mb-3", children: /* @__PURE__ */ r(ul, { items: $e, revealed: ne, onToggle: Ge }) }),
1217
- B ? /* @__PURE__ */ r("div", { className: "grid items-stretch gap-4", "data-read-board": !0, children: Qe.map(At) }) : /* @__PURE__ */ p("div", { className: "flex flex-col gap-4", "data-read-board-pending": !0, children: [
1218
- /* @__PURE__ */ r("div", { className: "h-32 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
1219
- /* @__PURE__ */ r("div", { className: "h-32 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
1220
- /* @__PURE__ */ r("div", { className: "h-56 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
1251
+ /* @__PURE__ */ t("style", { children: ql }),
1252
+ B && Fe.length > 0 && /* @__PURE__ */ t("div", { className: "mb-3", children: /* @__PURE__ */ t(hl, { items: Fe, revealed: ne, onToggle: Ge }) }),
1253
+ B ? /* @__PURE__ */ t("div", { className: "grid items-stretch gap-4", "data-read-board": !0, children: Qe.map(Ot) }) : /* @__PURE__ */ p("div", { className: "flex flex-col gap-4", "data-read-board-pending": !0, children: [
1254
+ /* @__PURE__ */ t("div", { className: "h-32 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
1255
+ /* @__PURE__ */ t("div", { className: "h-32 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
1256
+ /* @__PURE__ */ t("div", { className: "h-56 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
1221
1257
  ] }),
1222
- at && /* @__PURE__ */ r("div", { className: "mt-4", children: at })
1258
+ at && /* @__PURE__ */ t("div", { className: "mt-4", children: at })
1223
1259
  ]
1224
1260
  }
1225
1261
  );
1226
1262
  }
1227
- function fr(a) {
1228
- return a.design ? /* @__PURE__ */ r(gl, { design: a.design.context, onRefusedWrite: a.design.onRefusedWrite, children: /* @__PURE__ */ r(Ut.Provider, { value: null, children: /* @__PURE__ */ r(yt, { ...a }) }) }) : /* @__PURE__ */ r(yt, { ...a });
1263
+ function yr(a) {
1264
+ return a.design ? /* @__PURE__ */ t(vl, { design: a.design.context, onRefusedWrite: a.design.onRefusedWrite, children: /* @__PURE__ */ t(Ut.Provider, { value: null, children: /* @__PURE__ */ t(yt, { ...a }) }) }) : /* @__PURE__ */ t(yt, { ...a });
1265
+ }
1266
+ function Cl({
1267
+ collection: a,
1268
+ itemId: u,
1269
+ field: b,
1270
+ value: s,
1271
+ label: F
1272
+ }) {
1273
+ const N = ke(), _ = xt(), [C, q] = Q(null), f = C ?? (s === !0 || s === 1 || s === "1" || s === "true"), R = async () => {
1274
+ if (C !== null) return;
1275
+ const A = !f;
1276
+ q(A);
1277
+ try {
1278
+ await N.request(Gt(`/items/${a}/${u}`, { [b]: A })), await Promise.all([
1279
+ _.invalidateQueries({ queryKey: ["rrv-record", a, u] }),
1280
+ _.invalidateQueries({ queryKey: ["item", a, u] })
1281
+ ]), rl(_, a, u);
1282
+ } catch (j) {
1283
+ Jt(j, "Could not save that change");
1284
+ } finally {
1285
+ q(null);
1286
+ }
1287
+ };
1288
+ return /* @__PURE__ */ p(
1289
+ "button",
1290
+ {
1291
+ type: "button",
1292
+ role: "switch",
1293
+ "aria-checked": f,
1294
+ "aria-label": typeof F == "string" ? F : b,
1295
+ disabled: C !== null,
1296
+ onClick: () => void R(),
1297
+ "data-summary-toggle": b,
1298
+ className: "group inline-flex items-center gap-2 rounded-md py-0.5 text-[13px] font-medium text-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:opacity-60 dark:text-slate-100",
1299
+ children: [
1300
+ /* @__PURE__ */ t(
1301
+ "span",
1302
+ {
1303
+ "aria-hidden": !0,
1304
+ className: `relative inline-flex h-[18px] w-8 shrink-0 items-center rounded-full transition-colors ${f ? "bg-nvr-cyan" : "bg-slate-300 dark:bg-slate-600"}`,
1305
+ children: /* @__PURE__ */ t(
1306
+ "span",
1307
+ {
1308
+ className: `inline-block h-3.5 w-3.5 rounded-full bg-white shadow transition-transform ${f ? "translate-x-[16px]" : "translate-x-[2px]"}`
1309
+ }
1310
+ )
1311
+ }
1312
+ ),
1313
+ f ? "Yes" : "No"
1314
+ ]
1315
+ }
1316
+ );
1229
1317
  }
1230
1318
  export {
1231
- Nl as COLLAPSED_SUMMARY_MAX,
1232
- fr as RecordReadView,
1233
- wl as collapsedSummaryEntries
1319
+ $l as COLLAPSED_SUMMARY_MAX,
1320
+ yr as RecordReadView,
1321
+ Fl as collapsedSummaryEntries
1234
1322
  };