@nivaro/react 0.3.75 → 0.3.77

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,13 +1,13 @@
1
1
  import { jsx as a, jsxs as _, Fragment as Ct } from "react/jsx-runtime";
2
2
  import { useQueryClient as cg, useQuery as $t, useQueries as ui, useMutation as Nf } from "@tanstack/react-query";
3
- import { Loader2 as Ir, ArrowLeft as ug, Check as mr, Copy as ks, Wand2 as fg, BookOpen as mg, Lock as $f, PencilLine as pg, Clipboard as hg, Waypoints as gg, PictureInPicture2 as yg, FileDown as Cf, MessageSquarePlus as _g, Wrench as bg, Eye as vg, Trash2 as wg, LifeBuoy as kg, Save as Rf, ChevronDown as fi, AlertTriangle as xg, ChevronLeft as Ff, ChevronRight as Of, AlertCircle as mm, X as Sg } from "lucide-react";
3
+ import { Loader2 as Ir, ArrowLeft as ug, Check as pr, Copy as ks, Wand2 as fg, BookOpen as mg, Lock as $f, PencilLine as pg, Clipboard as hg, Waypoints as gg, PictureInPicture2 as yg, FileDown as Cf, MessageSquarePlus as _g, Wrench as bg, Eye as vg, Trash2 as wg, LifeBuoy as kg, Save as Rf, ChevronDown as fi, AlertTriangle as xg, ChevronLeft as Ff, ChevronRight as Of, AlertCircle as mm, X as Sg } from "lucide-react";
4
4
  import { useContext as Ng, useState as P, useEffect as z, useMemo as A, useCallback as ce, useRef as $, useId as $g, Fragment as Sl } from "react";
5
5
  import { createPortal as Cg } from "react-dom";
6
6
  import { toast as _e } from "sonner";
7
7
  import { useNivaroClient as Rg, useApiFetchConfig as Fg, ItemEditAuthContext as Og, useItemNavigation as jg, useRecordSurface as jf, useNavigation as Ag, ReimportHandlerContext as qg, RelationPathDataContext as Tg, ParentDraftContext as Ig, GridFlushContext as Eg, StaleFieldReportContext as Pg } from "../context.js";
8
8
  import { useSlowReason as Lg } from "../hooks/useSlowReason.js";
9
9
  import { formatApiPayload as Mg } from "../lib/api-payload.js";
10
- import { get as se, post as sn, del as fr, patch as mi, put as Kg } from "../lib/commands.js";
10
+ import { get as se, post as sn, del as mr, patch as mi, put as Kg } from "../lib/commands.js";
11
11
  import { prefillSignature as Dg, loadDraft as Bg, draftHasContent as Nl, draftMatchesPrefill as zg, deleteDraft as vs, draftCreatedAs as Wg, draftFilledBack as Qg, markDraftCreated as Vg, draftKey as Hg, keepDraftSavedAt as Ug, lineBasesForDraft as Jg, saveDraft as Gg, draftPersistDecision as Yg } from "../lib/draft-store.js";
12
12
  import { editLockLockedFields as Zg } from "../lib/edit-lock-fields.js";
13
13
  import { entryConfigOf as Xg } from "../lib/entry-config.js";
@@ -210,7 +210,7 @@ function gi({ children: i }) {
210
210
  }
211
211
  const om = "nvr-form-validation";
212
212
  function pv({ status: i }) {
213
- return i === "running" ? /* @__PURE__ */ a(Ir, { className: "h-4 w-4 animate-spin text-nvr-cyan shrink-0" }) : i === "done" ? /* @__PURE__ */ a(mr, { className: "h-4 w-4 text-green-500 shrink-0" }) : i === "error" ? /* @__PURE__ */ a(mm, { className: "h-4 w-4 text-red-500 shrink-0" }) : /* @__PURE__ */ a("div", { className: "h-4 w-4 rounded-full border-2 border-slate-200 dark:border-slate-600 shrink-0" });
213
+ return i === "running" ? /* @__PURE__ */ a(Ir, { className: "h-4 w-4 animate-spin text-nvr-cyan shrink-0" }) : i === "done" ? /* @__PURE__ */ a(pr, { className: "h-4 w-4 text-green-500 shrink-0" }) : i === "error" ? /* @__PURE__ */ a(mm, { className: "h-4 w-4 text-red-500 shrink-0" }) : /* @__PURE__ */ a("div", { className: "h-4 w-4 rounded-full border-2 border-slate-200 dark:border-slate-600 shrink-0" });
214
214
  }
215
215
  function hv({
216
216
  open: i,
@@ -238,7 +238,7 @@ function hv({
238
238
  /* @__PURE__ */ _(zo, { className: "flex items-center gap-2 text-[15px]", children: [
239
239
  !O && /* @__PURE__ */ a(Ir, { className: "h-4 w-4 animate-spin text-nvr-cyan" }),
240
240
  O && L && /* @__PURE__ */ a(mm, { className: "h-4 w-4 text-red-500" }),
241
- O && !L && /* @__PURE__ */ a(mr, { className: "h-4 w-4 text-green-500" }),
241
+ O && !L && /* @__PURE__ */ a(pr, { className: "h-4 w-4 text-green-500" }),
242
242
  L ? le === 0 ? "Nothing was saved" : "Saved with errors" : O ? "All changes saved" : "Saving changes…"
243
243
  ] }),
244
244
  /* @__PURE__ */ _("div", { className: "flex items-center gap-3 pt-1", children: [
@@ -426,16 +426,16 @@ function yv({
426
426
  return ((ue = q.find(
427
427
  (At) => At.many_collection === N && At.many_field === H && !At.junction_field
428
428
  )) == null ? void 0 : ue.one_collection) ?? null;
429
- }, Gn = (H, ue) => (ue == null ? void 0 : ue.label) || be(H.replace(/_/g, " ")), Er = new Map((O ?? []).map((H) => [H.field, H])), pr = [];
429
+ }, Gn = (H, ue) => (ue == null ? void 0 : ue.label) || be(H.replace(/_/g, " ")), Er = new Map((O ?? []).map((H) => [H.field, H])), hr = [];
430
430
  for (const H of O ?? [])
431
- et(L[H.field], ne[H.field]) || L[H.field] !== void 0 && pr.push({
431
+ et(L[H.field], ne[H.field]) || L[H.field] !== void 0 && hr.push({
432
432
  key: H.field,
433
433
  label: Gn(H.field, H),
434
434
  from: ne[H.field],
435
435
  to: L[H.field]
436
436
  });
437
437
  for (const H of Object.keys(L))
438
- Er.has(H) || H.startsWith("__") || et(L[H], ne[H]) || pr.push({ key: H, label: H, from: ne[H], to: L[H] });
438
+ Er.has(H) || H.startsWith("__") || et(L[H], ne[H]) || hr.push({ key: H, label: H, from: ne[H], to: L[H] });
439
439
  const xs = (H) => {
440
440
  var At;
441
441
  const ue = q.find((Yn) => Yn.one_collection === N && Yn.one_field === H);
@@ -465,8 +465,8 @@ function yv({
465
465
  }
466
466
  )
467
467
  ] }),
468
- pr.length === 0 && Lr === 0 && vi === 0 && Ne === 0 && W === 0 ? /* @__PURE__ */ a("p", { className: "text-[11.5px] text-slate-400", children: "Nothing differs from the saved record — this flag may be stale. Saving is a no-op; reloading clears it." }) : /* @__PURE__ */ _("div", { className: "max-h-[300px] space-y-1.5 overflow-y-auto", children: [
469
- pr.map((H) => {
468
+ hr.length === 0 && Lr === 0 && vi === 0 && Ne === 0 && W === 0 ? /* @__PURE__ */ a("p", { className: "text-[11.5px] text-slate-400", children: "Nothing differs from the saved record — this flag may be stale. Saving is a no-op; reloading clears it." }) : /* @__PURE__ */ _("div", { className: "max-h-[300px] space-y-1.5 overflow-y-auto", children: [
469
+ hr.map((H) => {
470
470
  const ue = Er.get(H.key) ?? null, At = Jn(H.key);
471
471
  return /* @__PURE__ */ _("div", { className: "text-[11.5px]", children: [
472
472
  /* @__PURE__ */ a("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: H.label }),
@@ -870,7 +870,7 @@ function fm({
870
870
  showItemActions: Jn = !1,
871
871
  showGrantedTools: Gn = !1,
872
872
  moreMenuItems: Er,
873
- onViewModeChange: pr,
873
+ onViewModeChange: hr,
874
874
  onDirtyChange: xs,
875
875
  documentTitle: Pr = !0,
876
876
  active: bi = !0,
@@ -885,7 +885,7 @@ function fm({
885
885
  showLockBanner: Ul = !0,
886
886
  className: Ss,
887
887
  headerClassName: Nm,
888
- renderField: hr,
888
+ renderField: gr,
889
889
  extraTopContent: $m,
890
890
  hideHelpVideoButton: Cm = !1,
891
891
  extraBottomContent: Rm,
@@ -963,7 +963,7 @@ function fm({
963
963
  }), Jo = Be == null ? void 0 : Be.ghost, j = A(() => !Jo || !m || !ki ? ki : ki.map((e) => {
964
964
  const t = Jo(e.field);
965
965
  return t ? { ...e, placeholder: t } : e;
966
- }), [Jo, m, ki]), ed = A(() => L0(j ?? []), [j]), Dr = M0(), { data: D = [], isFetched: gr } = $t({
966
+ }), [Jo, m, ki]), ed = A(() => L0(j ?? []), [j]), Dr = M0(), { data: D = [], isFetched: yr } = $t({
967
967
  queryKey: ["relations", i],
968
968
  queryFn: () => R.request(se(`/data-model/relations/for/${i}`)).then((e) => e.data ?? []),
969
969
  staleTime: 6e4
@@ -984,7 +984,7 @@ function fm({
984
984
  queryFn: () => R.request(se("/collection-layouts", { collection: i })).then((e) => (e.data ?? []).filter((t) => t.layout_type === "file" && !!t.is_active)),
985
985
  enabled: !!i && !m,
986
986
  staleTime: 6e4
987
- }), [Lm, Mm] = P({}), [nd, rd] = P(null), [sd, id] = P(!1), [yr, od] = P(!1), [Si, Ni] = P(0), [He, Go] = P(q || "original"), $i = $(O);
987
+ }), [Lm, Mm] = P({}), [nd, rd] = P(null), [sd, id] = P(!1), [_r, od] = P(!1), [Si, Ni] = P(0), [He, Go] = P(q || "original"), $i = $(O);
988
988
  $i.current = O, z(() => {
989
989
  var e;
990
990
  (e = $i.current) == null || e.call($i, He === "original" ? null : He);
@@ -1060,7 +1060,7 @@ function fm({
1060
1060
  if (m || !zn) return !1;
1061
1061
  const e = (zn == null ? void 0 : zn.status) ?? ((t = zn == null ? void 0 : zn.response) == null ? void 0 : t.status);
1062
1062
  return e === 403 || e === 404;
1063
- })(), cd = na && !de, Bt = de != null, [M, pt] = P({}), U = $({}), ra = $(!1), Oi = $(!1), Le = $(/* @__PURE__ */ new Set()), Os = $(0), _r = $(/* @__PURE__ */ new Map()), sa = $(/* @__PURE__ */ new Map()), zm = A(
1063
+ })(), cd = na && !de, Bt = de != null, [M, pt] = P({}), U = $({}), ra = $(!1), Oi = $(!1), Le = $(/* @__PURE__ */ new Set()), Os = $(0), br = $(/* @__PURE__ */ new Map()), sa = $(/* @__PURE__ */ new Map()), zm = A(
1064
1064
  () => ({
1065
1065
  register: (e, t) => {
1066
1066
  sa.current.set(e, t);
@@ -1138,8 +1138,8 @@ function fm({
1138
1138
  z(() => {
1139
1139
  Pe && Fy(R, Pe, X);
1140
1140
  }, [R, Pe, X]), z(() => Ei, [i, p]);
1141
- const [Ue, Fn] = P(!1), [Gm, wd] = P(!1), [js, Hr] = P({}), da = $(0), Pi = $(null), [bt, ca] = P(!1), Li = (e) => ca(e), Mi = $(pr);
1142
- Mi.current = pr;
1141
+ const [Ue, Fn] = P(!1), [Gm, wd] = P(!1), [js, Hr] = P({}), da = $(0), Pi = $(null), [bt, ca] = P(!1), Li = (e) => ca(e), Mi = $(hr);
1142
+ Mi.current = hr;
1143
1143
  const kd = ((Ju = $s == null ? void 0 : $s.layout) == null ? void 0 : Ju.id) != null ? Number($s.layout.id) : null;
1144
1144
  z(() => {
1145
1145
  var e;
@@ -1148,10 +1148,10 @@ function fm({
1148
1148
  summaryLayoutId: kd
1149
1149
  });
1150
1150
  }, [bt, m, kd]);
1151
- const br = A(
1151
+ const vr = A(
1152
1152
  () => x != null && x.read_mode_toggle ? Ef(x.summary_mode_rules) : null,
1153
1153
  [x == null ? void 0 : x.read_mode_toggle, x == null ? void 0 : x.summary_mode_rules]
1154
- ), [Ym, Zm] = P(null), ua = `${i}|${String(p)}`, Ur = I || m || x !== void 0 && (!br || Ym === ua), vt = Hg(i, p, Pe), xd = A(
1154
+ ), [Ym, Zm] = P(null), ua = `${i}|${String(p)}`, Ur = I || m || x !== void 0 && (!vr || Ym === ua), vt = Hg(i, p, Pe), xd = A(
1155
1155
  () => m && (Mt || Kn || Zn) ? Dg({
1156
1156
  v: Mt ?? null,
1157
1157
  l: Kn ?? null,
@@ -1160,7 +1160,7 @@ function fm({
1160
1160
  [m, Mt, Kn, Zn]
1161
1161
  ), [Xt, Jr] = P({ state: I ? "none" : "checking" }), Sd = $(Xt);
1162
1162
  Sd.current = Xt;
1163
- const [Xm, ep] = P(!1), [As, tp] = P(null), vr = $(!1), [fa, Nd] = P(!1);
1163
+ const [Xm, ep] = P(!1), [As, tp] = P(null), wr = $(!1), [fa, Nd] = P(!1);
1164
1164
  z(() => {
1165
1165
  const e = (t) => {
1166
1166
  const n = t.detail;
@@ -1252,7 +1252,7 @@ function fm({
1252
1252
  ya((t) => [...t, e]);
1253
1253
  }, []), [je, rr] = P(
1254
1254
  /* @__PURE__ */ new Map()
1255
- ), Ji = $(/* @__PURE__ */ new Map()), [ze, wr] = P(/* @__PURE__ */ new Map()), [We, Gi] = P(/* @__PURE__ */ new Map()), jd = $(() => {
1255
+ ), Ji = $(/* @__PURE__ */ new Map()), [ze, kr] = P(/* @__PURE__ */ new Map()), [We, Gi] = P(/* @__PURE__ */ new Map()), jd = $(() => {
1256
1256
  }), [Es, fp] = P(() => /* @__PURE__ */ new Set()), _a = $(/* @__PURE__ */ new Map()), an = A(
1257
1257
  () => ({
1258
1258
  noteEditIntent: () => jd.current(),
@@ -1285,7 +1285,7 @@ function fm({
1285
1285
  getPendingDeletes: (e, t) => We.get(`${e}.${t}`) ?? /* @__PURE__ */ new Set(),
1286
1286
  queueEdit: (e, t, n, r) => {
1287
1287
  const { __base_revision: s, ...o } = r;
1288
- _d.current(e, n, s), wr((l) => {
1288
+ _d.current(e, n, s), kr((l) => {
1289
1289
  const c = new Map(l), d = `${e}.${t}`, g = new Map(c.get(d) ?? []);
1290
1290
  return g.set(n, { ...g.get(n) ?? {}, ...o }), c.set(d, g), c;
1291
1291
  });
@@ -1294,13 +1294,13 @@ function fm({
1294
1294
  ht.current.delete(`${e}:${n}`), Gi((r) => {
1295
1295
  const s = new Map(r), o = `${e}.${t}`, l = new Set(s.get(o) ?? []);
1296
1296
  return l.add(n), s.set(o, l), s;
1297
- }), wr((r) => {
1297
+ }), kr((r) => {
1298
1298
  const s = new Map(r), o = `${e}.${t}`, l = new Map(s.get(o) ?? []);
1299
1299
  return l.delete(n), s.set(o, l), s;
1300
1300
  });
1301
1301
  },
1302
1302
  cancelPendingEdit: (e, t, n) => {
1303
- ht.current.delete(`${e}:${n}`), wr((r) => {
1303
+ ht.current.delete(`${e}:${n}`), kr((r) => {
1304
1304
  const s = new Map(r), o = `${e}.${t}`, l = new Map(s.get(o) ?? []);
1305
1305
  return l.delete(n), s.set(o, l), s;
1306
1306
  });
@@ -1311,12 +1311,12 @@ function fm({
1311
1311
  })
1312
1312
  }),
1313
1313
  [je, ze, We]
1314
- ), [Ad, Xr] = P([]), qd = $(!1), ba = $(!1), va = $({}), [Ge, es] = P(/* @__PURE__ */ new Map()), [at, Ps] = P(/* @__PURE__ */ new Map()), kr = $(
1314
+ ), [Ad, Xr] = P([]), qd = $(!1), ba = $(!1), va = $({}), [Ge, es] = P(/* @__PURE__ */ new Map()), [at, Ps] = P(/* @__PURE__ */ new Map()), xr = $(
1315
1315
  null
1316
1316
  ), Ls = $(/* @__PURE__ */ new Map()), en = $(0), Ms = $(/* @__PURE__ */ new Map()), On = $(/* @__PURE__ */ new Map()), ts = $(/* @__PURE__ */ new Map()), wa = (e) => x_(
1317
1317
  {
1318
1318
  touched: Le.current,
1319
- seq: _r.current,
1319
+ seq: br.current,
1320
1320
  next: () => ++Os.current
1321
1321
  },
1322
1322
  e,
@@ -1335,7 +1335,7 @@ function fm({
1335
1335
  return c.set(e, l), c;
1336
1336
  }), en.current === 0) {
1337
1337
  const s = Ls.current.get(e);
1338
- s && (Rt.current === 0 && (wa(s), On.current.delete(s), Tt.current.delete(s), Gr.current.delete(e), Bi.current(s)), (n = kr.current) == null || n.call(kr, s, t), (r = wt.current) == null || r.call(wt, s, t));
1338
+ s && (Rt.current === 0 && (wa(s), On.current.delete(s), Tt.current.delete(s), Gr.current.delete(e), Bi.current(s)), (n = xr.current) == null || n.call(xr, s, t), (r = wt.current) == null || r.call(wt, s, t));
1339
1339
  }
1340
1340
  },
1341
1341
  stageUnlink: (e, t) => {
@@ -1825,8 +1825,8 @@ function fm({
1825
1825
  U.current[e] === t && Xi.current(e, t);
1826
1826
  }
1827
1827
  }, [xa, td]), z(() => {
1828
- !m || !Lt || qd.current || (Lt.lines.length > 0 || Object.keys(Lt.m2m ?? {}).length > 0) && !gr || Lt.lines.length > 0 && !xi || (qd.current = !0, ns(Lt));
1829
- }, [m, Lt, gr, xi, ns]), z(() => {
1828
+ !m || !Lt || qd.current || (Lt.lines.length > 0 || Object.keys(Lt.m2m ?? {}).length > 0) && !yr || Lt.lines.length > 0 && !xi || (qd.current = !0, ns(Lt));
1829
+ }, [m, Lt, yr, xi, ns]), z(() => {
1830
1830
  if (!de) return;
1831
1831
  const e = $e.current, t = Object.keys(e).length === 0, n = Date.now() - da.current < 8e3;
1832
1832
  if (!t && !n) {
@@ -1893,7 +1893,7 @@ function fm({
1893
1893
  }
1894
1894
  ).catch(() => null) : Promise.resolve(null);
1895
1895
  return Promise.all([Bg(vt), n]).then(([r, s]) => {
1896
- if (s && (vr.current = !0), e) return;
1896
+ if (s && (wr.current = !0), e) return;
1897
1897
  tp(vt);
1898
1898
  const o = r && s ? String(s.saved_at) > String(r.saved_at) ? s : r : r ?? s;
1899
1899
  if (!o || !Nl(o) || m && !zg(o, xd) || // A new form seeded by a file import (Import BID Template, BOM Upload)
@@ -1933,7 +1933,7 @@ function fm({
1933
1933
  const r = Di.current(Ge), s = je.size + ze.size + We.size + (r.size ? Hf(Ge, r) : Ge.size) + at.size, o = je.size + ze.size + We.size, l = Yg({ isDirty: Ue, forReload: n, staged: s, stagedLines: o });
1934
1934
  if (l === "hold") return !1;
1935
1935
  if (l === "drop")
1936
- return vs(vt), Pe && vr.current && (vr.current = !1, R.request(fr(`/drafts/${i}/${m ? "new" : String(p)}`)).catch(() => {
1936
+ return vs(vt), Pe && wr.current && (wr.current = !1, R.request(mr(`/drafts/${i}/${m ? "new" : String(p)}`)).catch(() => {
1937
1937
  })), !0;
1938
1938
  const c = $e.current, d = {}, g = {};
1939
1939
  for (const [y, T] of Object.entries(U.current))
@@ -1970,10 +1970,10 @@ function fm({
1970
1970
  Xo.current
1971
1971
  );
1972
1972
  if (Xo.current = h, !Nl(h))
1973
- return vs(vt), Pe && vr.current && (vr.current = !1, R.request(fr(`/drafts/${i}/${m ? "new" : String(p)}`)).catch(() => {
1973
+ return vs(vt), Pe && wr.current && (wr.current = !1, R.request(mr(`/drafts/${i}/${m ? "new" : String(p)}`)).catch(() => {
1974
1974
  })), !0;
1975
1975
  const v = Gg(h);
1976
- Pe && (vr.current = !0);
1976
+ Pe && (wr.current = !0);
1977
1977
  const S = Pe ? R.request(
1978
1978
  Kg(`/drafts/${i}/${m ? "new" : String(p)}`, {
1979
1979
  payload: h,
@@ -2040,12 +2040,12 @@ function fm({
2040
2040
  ma.current.add(o);
2041
2041
  continue;
2042
2042
  }
2043
- Le.current.add(o), _r.current.set(o, ++Os.current);
2043
+ Le.current.add(o), br.current.set(o, ++Os.current);
2044
2044
  }
2045
2045
  if (Object.keys(t.pending_rows ?? {}).length && rr(new Map(Object.entries(t.pending_rows))), Object.keys(t.pending_edits ?? {}).length) {
2046
2046
  for (const [o, l] of Object.entries(t.line_bases ?? {}))
2047
2047
  typeof l == "number" && Number.isFinite(l) && l > 0 && ht.current.set(o, Promise.resolve(l));
2048
- wr(
2048
+ kr(
2049
2049
  new Map(Object.entries(t.pending_edits).map(([o, l]) => [o, new Map(Object.entries(l))]))
2050
2050
  ), yd.current(
2051
2051
  t.pending_edits,
@@ -2058,7 +2058,7 @@ function fm({
2058
2058
  for (const [o, l] of Object.entries(t.fields))
2059
2059
  l == null || l === "" || Xi.current(o, l);
2060
2060
  }, []), _p = ce(() => {
2061
- vs(vt), Pe && R.request(fr(`/drafts/${i}/${m ? "new" : String(p)}`)).catch(() => {
2061
+ vs(vt), Pe && R.request(mr(`/drafts/${i}/${m ? "new" : String(p)}`)).catch(() => {
2062
2062
  }), Jr({ state: "none" });
2063
2063
  }, [vt, Pe, R, i, m, p]);
2064
2064
  z(() => {
@@ -2071,7 +2071,7 @@ function fm({
2071
2071
  ba.current = !0;
2072
2072
  return;
2073
2073
  }
2074
- if (Object.values(e).some(Array.isArray) && !gr) return;
2074
+ if (Object.values(e).some(Array.isArray) && !yr) return;
2075
2075
  ba.current = !0, va.current = e;
2076
2076
  const t = {};
2077
2077
  for (const [s, o] of Object.entries(e)) {
@@ -2096,10 +2096,10 @@ function fm({
2096
2096
  }
2097
2097
  const n = _v(U.current, t);
2098
2098
  U.current = n, pt(n);
2099
- }, [m, w, D, gr, i, xe]);
2099
+ }, [m, w, D, yr, i, xe]);
2100
2100
  const Md = $(!1);
2101
2101
  z(() => {
2102
- if (!m || !Mt || Md.current || !gr) return;
2102
+ if (!m || !Mt || Md.current || !yr) return;
2103
2103
  Md.current = !0;
2104
2104
  const e = Tv(Mt, D, i);
2105
2105
  if (e.length === 0) return;
@@ -2112,7 +2112,7 @@ function fm({
2112
2112
  }
2113
2113
  const t = new Set(e.map((r) => r.field)), n = (r) => Object.fromEntries(Object.entries(r).filter(([s]) => !t.has(s)));
2114
2114
  U.current = n(U.current), pt((r) => n(r));
2115
- }, [m, Mt, D, gr, i, xe]);
2115
+ }, [m, Mt, D, yr, i, xe]);
2116
2116
  const Na = A(
2117
2117
  () => (j ?? []).filter(
2118
2118
  (e) => e.interface === "relation-path" && e.field.includes(".") && !Ns.fields.has(e.field)
@@ -2400,7 +2400,7 @@ function fm({
2400
2400
  const E = U.current[K];
2401
2401
  if (E != null && E !== "") continue;
2402
2402
  const V = G[0];
2403
- U.current = { ...U.current, [K]: V }, pt((B) => ({ ...B, [K]: V })), Ts([K]), Tt.current.has(o) ? Tt.current.add(K) : Fn(!0), (Q = kr.current) == null || Q.call(kr, K, V, 1), On.current.set(K, o), ts.current.set(K, { source: o, value: V }), (Y = wt.current) == null || Y.call(wt, K, V, n + 1, c, o);
2403
+ U.current = { ...U.current, [K]: V }, pt((B) => ({ ...B, [K]: V })), Ts([K]), Tt.current.has(o) ? Tt.current.add(K) : Fn(!0), (Q = xr.current) == null || Q.call(xr, K, V, 1), On.current.set(K, o), ts.current.set(K, { source: o, value: V }), (Y = wt.current) == null || Y.call(wt, K, V, n + 1, c, o);
2404
2404
  }
2405
2405
  } catch {
2406
2406
  }
@@ -2558,7 +2558,7 @@ function fm({
2558
2558
  const { __links: e, ...t } = Mt ?? {};
2559
2559
  for (const [n, r] of Object.entries(t))
2560
2560
  r == null || r === "" || (jn(n, r), wt.current(n, r));
2561
- }, [m, j, D, Mt, jn]), kr.current = jn;
2561
+ }, [m, j, D, Mt, jn]), xr.current = jn;
2562
2562
  const Yd = ce(
2563
2563
  (e, t, n = !1) => {
2564
2564
  var c, d;
@@ -2567,7 +2567,7 @@ function fm({
2567
2567
  new Set(ie.keys())
2568
2568
  ), o = {};
2569
2569
  for (const [g, u] of Object.entries(r))
2570
- t !== void 0 && (_r.current.get(g) ?? 0) > t || (o[g] = u, t !== void 0 && _r.current.set(g, t));
2570
+ t !== void 0 && (br.current.get(g) ?? 0) > t || (o[g] = u, t !== void 0 && br.current.set(g, t));
2571
2571
  const l = Dv(s, Qe);
2572
2572
  for (const [g, u] of Object.entries(l)) {
2573
2573
  const f = ie.get(g);
@@ -2688,7 +2688,7 @@ function fm({
2688
2688
  (e, t) => {
2689
2689
  var o;
2690
2690
  if (I || ra.current && !Oi.current || et(U.current[e], t)) return;
2691
- Le.current.add(e), en.current === 0 && On.current.delete(e), (o = An.current) == null || o.call(An), _r.current.set(e, ++Os.current);
2691
+ Le.current.add(e), en.current === 0 && On.current.delete(e), (o = An.current) == null || o.call(An), br.current.set(e, ++Os.current);
2692
2692
  const n = { ...U.current, [e]: t };
2693
2693
  for (const l of j ?? [])
2694
2694
  if (l.dependency_config)
@@ -2826,7 +2826,7 @@ function fm({
2826
2826
  revalidate: rc.revalidate,
2827
2827
  disabled: I || Xm,
2828
2828
  enabled: !I && tc.size > 0,
2829
- ready: m && !I && w !== void 0 && xi && gr && Xt.state === "none" && As === vt && // The draft check ran for the real person (the auth id can arrive a render late; the
2829
+ ready: m && !I && w !== void 0 && xi && yr && Xt.state === "none" && As === vt && // The draft check ran for the real person (the auth id can arrive a render late; the
2830
2830
  // anonymous key's check never saw their server draft).
2831
2831
  !!Pe,
2832
2832
  resetKey: `${i}:${p}`,
@@ -2952,7 +2952,7 @@ function fm({
2952
2952
  }, [Wt, qn]), z(() => {
2953
2953
  lm(tt, M) !== tt && hn((e) => lm(e, M));
2954
2954
  }, [M]);
2955
- const xr = ce(
2955
+ const Sr = ce(
2956
2956
  (e, t) => {
2957
2957
  $p((n) => n[e] === t ? n : { ...n, [e]: t }), t > 0 && Wi.current.add(e), hn((n) => {
2958
2958
  const r = (j ?? []).find((o) => o.field === e);
@@ -2979,7 +2979,7 @@ function fm({
2979
2979
  }), bn = qa == null ? void 0 : qa.edit_lock, gt = !I && !m && (bn == null ? void 0 : bn.locked) === !0 && bn.allowed === !1 ? ((Gu = bn.message) == null ? void 0 : Gu.trim()) || "This record is in approval — you can view it but not change it." : null, Ta = A(
2980
2980
  () => new Set((bn == null ? void 0 : bn.open_fields) ?? []),
2981
2981
  [bn == null ? void 0 : bn.open_fields]
2982
- ), Sr = !!gt && Ta.size > 0, ic = $(gt);
2982
+ ), Nr = !!gt && Ta.size > 0, ic = $(gt);
2983
2983
  z(() => {
2984
2984
  const e = ic.current;
2985
2985
  ic.current = gt;
@@ -2989,7 +2989,7 @@ function fm({
2989
2989
  duration: 3e4
2990
2990
  });
2991
2991
  }, [gt, zt, Es.size, m, I, i, p]);
2992
- const Qs = !I && Ul && !m && !cd && !!(x != null && x.item_locking_enabled) && Ur && !bt && (!gt || Sr), Rp = jf().active, {
2992
+ const Qs = !I && Ul && !m && !cd && !!(x != null && x.item_locking_enabled) && Ur && !bt && (!gt || Nr), Rp = jf().active, {
2993
2993
  lockHolder: Tn,
2994
2994
  acquired: Ia,
2995
2995
  isReadOnly: oc,
@@ -3015,7 +3015,7 @@ function fm({
3015
3015
  // a10-4: a clean form (saved, or edits undone) lets the lock go. A line
3016
3016
  // editor still holding a typed change is not clean (army 11 f4 L1).
3017
3017
  dirty: zt || Es.size > 0
3018
- }), Qt = oc || !!er || !!gt && !Sr;
3018
+ }), Qt = oc || !!er || !!gt && !Nr;
3019
3019
  ra.current = Qt && !m, z(
3020
3020
  () => X.getQueryCache().subscribe((e) => {
3021
3021
  var s, o, l, c;
@@ -3034,7 +3034,7 @@ function fm({
3034
3034
  var e;
3035
3035
  zt && ((e = An.current) == null || e.call(An));
3036
3036
  }, [zt, Qs]);
3037
- const lt = (w == null ? void 0 : w.assignments) ?? [], Pa = lt.some((e) => e.lock_conditions), os = !!(x != null && x.addendums_enabled) && !m, io = !m && Qy(br), oo = !m && Vy(br), dc = () => R.request(se("/users/me")).then((e) => e.data ?? null), La = Pa || os || io || ed.role, { data: Fe, isError: cc } = $t({
3037
+ const lt = (w == null ? void 0 : w.assignments) ?? [], Pa = lt.some((e) => e.lock_conditions), os = !!(x != null && x.addendums_enabled) && !m, io = !m && Qy(vr), oo = !m && Vy(vr), dc = () => R.request(se("/users/me")).then((e) => e.data ?? null), La = Pa || os || io || ed.role, { data: Fe, isError: cc } = $t({
3038
3038
  queryKey: ["current-user-me"],
3039
3039
  queryFn: dc,
3040
3040
  staleTime: 5 * 6e4,
@@ -3304,21 +3304,21 @@ function fm({
3304
3304
  i,
3305
3305
  m || I ? null : String(p),
3306
3306
  Up,
3307
- { fieldsLocked: !!gt && !Sr, valuesPending: !de }
3308
- ), [Gp, Cc] = P(null), Nr = Vt.find((e) => e.id === He), za = !!Nr && ["approved", "reverted"].includes(Nr.status), { data: Wa } = $t({
3307
+ { fieldsLocked: !!gt && !Nr, valuesPending: !de }
3308
+ ), [Gp, Cc] = P(null), ir = Vt.find((e) => e.id === He), za = !!ir && (["approved", "reverted"].includes(ir.status) || !Object.values(ir.data ?? {}).some((e) => Array.isArray(e) && e.length > 0)), { data: Wa } = $t({
3309
3309
  queryKey: ["addendum-lines", He],
3310
3310
  queryFn: () => R.request(se(`/addendums/${He}/lines`)).then((e) => e.data ?? {}),
3311
3311
  enabled: za,
3312
3312
  staleTime: 6e4
3313
3313
  }), Yp = A(() => {
3314
3314
  const e = {};
3315
- if (za && Nr && Wa)
3315
+ if (za && ir && Wa)
3316
3316
  for (const [t, n] of Object.entries(Wa))
3317
3317
  e[t] = [
3318
3318
  {
3319
- addendumId: Nr.id,
3320
- addendumTitle: Nr.title,
3321
- addendumStatus: Nr.status,
3319
+ addendumId: ir.id,
3320
+ addendumTitle: ir.title,
3321
+ addendumStatus: ir.status,
3322
3322
  rows: n.after,
3323
3323
  baseRows: n.before
3324
3324
  }
@@ -3333,7 +3333,7 @@ function fm({
3333
3333
  rows: r
3334
3334
  }));
3335
3335
  return e;
3336
- }, [Vt, za, Nr, Wa]), Qa = A(() => !Bn || !w ? null : new Set(lt.map((e) => e.field)), [Bn, w, lt]), Zp = A(
3336
+ }, [Vt, za, ir, Wa]), Qa = A(() => !Bn || !w ? null : new Set(lt.map((e) => e.field)), [Bn, w, lt]), Zp = A(
3337
3337
  () => (j ?? []).filter(
3338
3338
  (e) => !e.hidden && !e.field.startsWith("__") && !e.field.includes(".") && !D.some((t) => t.one_collection === i && t.one_field === e.field)
3339
3339
  ).map((e) => e.field).slice(0, 40),
@@ -3357,11 +3357,11 @@ function fm({
3357
3357
  typeof r != "string" && r.field && "agg" in r && r.agg && r.agg_field && (e[r.field] = r);
3358
3358
  }
3359
3359
  return e;
3360
- }, [Ce]), ir = A(
3360
+ }, [Ce]), or = A(
3361
3361
  () => Ft.filter((e) => e.one_field && e.one_field in $r),
3362
3362
  [Ft, $r]
3363
3363
  ), Rc = ui({
3364
- queries: ir.map((e) => ({
3364
+ queries: or.map((e) => ({
3365
3365
  queryKey: ["field-config", e.many_collection],
3366
3366
  queryFn: () => R.request(
3367
3367
  se(`/field-config/${e.many_collection}`)
@@ -3371,7 +3371,7 @@ function fm({
3371
3371
  }))
3372
3372
  }), Fc = A(() => {
3373
3373
  const e = { ...$r };
3374
- return ir.forEach((t, n) => {
3374
+ return or.forEach((t, n) => {
3375
3375
  var c;
3376
3376
  if (!t.one_field) return;
3377
3377
  const r = $r[t.one_field];
@@ -3381,8 +3381,8 @@ function fm({
3381
3381
  const l = o.options ? typeof o.options == "string" ? o.options : JSON.stringify(o.options) : null;
3382
3382
  l && (e[t.one_field] = { ...r, field_options: l });
3383
3383
  }), e;
3384
- }, [$r, ir, Rc]), po = ui({
3385
- queries: ir.map((e) => ($r[e.one_field], {
3384
+ }, [$r, or, Rc]), po = ui({
3385
+ queries: or.map((e) => ($r[e.one_field], {
3386
3386
  queryKey: ["o2m-rows", e.many_collection, e.many_field, p],
3387
3387
  queryFn: () => R.request(
3388
3388
  se(`/items/${e.many_collection}`, {
@@ -3395,7 +3395,7 @@ function fm({
3395
3395
  }))
3396
3396
  }), Xp = A(() => {
3397
3397
  const e = {};
3398
- return ir.forEach((t, n) => {
3398
+ return or.forEach((t, n) => {
3399
3399
  var f;
3400
3400
  if (!t.one_field || !t.many_collection || !t.many_field) return;
3401
3401
  const r = ((f = po[n]) == null ? void 0 : f.data) ?? [], s = Fc[t.one_field];
@@ -3418,7 +3418,7 @@ function fm({
3418
3418
  s.agg === "sum" ? e[t.one_field] = u.reduce((h, v) => h + v, 0) : s.agg === "avg" ? e[t.one_field] = u.reduce((h, v) => h + v, 0) / u.length : s.agg === "min" ? e[t.one_field] = Math.min(...u) : s.agg === "max" && (e[t.one_field] = Math.max(...u));
3419
3419
  }), e;
3420
3420
  }, [
3421
- ir,
3421
+ or,
3422
3422
  po,
3423
3423
  $r,
3424
3424
  je,
@@ -3429,11 +3429,11 @@ function fm({
3429
3429
  return Ft.forEach((t, n) => {
3430
3430
  var r;
3431
3431
  (r = so[n]) != null && r.isLoading && t.one_field && e.add(t.one_field);
3432
- }), ir.forEach((t, n) => {
3432
+ }), or.forEach((t, n) => {
3433
3433
  var r;
3434
3434
  (r = po[n]) != null && r.isLoading && t.one_field && e.add(t.one_field);
3435
3435
  }), e;
3436
- }, [Ft, so, ir, po]), Oc = A(() => {
3436
+ }, [Ft, so, or, po]), Oc = A(() => {
3437
3437
  const e = /* @__PURE__ */ new Map();
3438
3438
  for (const t of j ?? []) {
3439
3439
  if (t.interface !== "inline-table") continue;
@@ -3532,7 +3532,7 @@ function fm({
3532
3532
  config: Or,
3533
3533
  hasTabs: kt || qc,
3534
3534
  enabled: !I
3535
- }), Ha = (e) => Qn.mode && (e.tab_mode === "steps" || e.tab_mode === "tabs") ? Qn.mode === "beginner" : e.tab_mode === "steps", un = kt && (Qn.mode ? Qn.mode === "beginner" : (ee == null ? void 0 : ee.tab_mode) === "steps"), th = !!(ee != null && ee.validate_before_next), vn = !!(ee != null && ee.summary_enabled), nh = !!(ee != null && ee.summary_hide_empty), rh = ee ? !ee.disable_revisions && Mr : Mr, or = ee ? !ee.disable_comments && Yn : Yn, jr = ee ? !ee.disable_tasks && Hl : Hl, sh = ee ? !ee.disable_clone && H : H, ih = ee ? !ee.disable_delete : !0, go = !!(ee != null && ee.accordion_mode), [wn, us] = P(
3535
+ }), Ha = (e) => Qn.mode && (e.tab_mode === "steps" || e.tab_mode === "tabs") ? Qn.mode === "beginner" : e.tab_mode === "steps", un = kt && (Qn.mode ? Qn.mode === "beginner" : (ee == null ? void 0 : ee.tab_mode) === "steps"), th = !!(ee != null && ee.validate_before_next), vn = !!(ee != null && ee.summary_enabled), nh = !!(ee != null && ee.summary_hide_empty), rh = ee ? !ee.disable_revisions && Mr : Mr, ar = ee ? !ee.disable_comments && Yn : Yn, jr = ee ? !ee.disable_tasks && Hl : Hl, sh = ee ? !ee.disable_clone && H : H, ih = ee ? !ee.disable_delete : !0, go = !!(ee != null && ee.accordion_mode), [wn, us] = P(
3536
3536
  () => I ? Zf(Pe) ?? !1 : !1
3537
3537
  ), [In, oh] = P(null), Ic = $(!1);
3538
3538
  z(() => {
@@ -3776,7 +3776,7 @@ function fm({
3776
3776
  `${d}: ${S.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim().slice(0, 160)}`
3777
3777
  );
3778
3778
  }
3779
- const o = `${dr && dr !== ((x == null ? void 0 : x.display_name) ?? "") ? dr : `${(x == null ? void 0 : x.singular) || (x == null ? void 0 : x.display_name) || be(i ?? "")} (no number)`}
3779
+ const o = `${cr && cr !== ((x == null ? void 0 : x.display_name) ?? "") ? cr : `${(x == null ? void 0 : x.singular) || (x == null ? void 0 : x.display_name) || be(i ?? "")} (no number)`}
3780
3780
  ${window.location.href}
3781
3781
 
3782
3782
  ${r.join(`
@@ -3803,7 +3803,7 @@ ${r.join(`
3803
3803
  collection: i,
3804
3804
  itemId: p,
3805
3805
  // After the record answered (army 10: the comments read 404'd for a missing record).
3806
- enabled: !m && !I && or && Bt,
3806
+ enabled: !m && !I && ar && Bt,
3807
3807
  labelOf: ph,
3808
3808
  jump: hh
3809
3809
  }), Hc = $(Ya);
@@ -4154,9 +4154,9 @@ ${r.join(`
4154
4154
  } catch {
4155
4155
  return {};
4156
4156
  }
4157
- })() : null, Pn = (It == null ? void 0 : It.attach_to_field) ?? null, ou = (It == null ? void 0 : It.filename_template) ?? null, ms = (Ve == null ? void 0 : Ve.group_key) ?? null, ei = !!(ms && Ce.some((e) => e.key === ms)), Sh = (It == null ? void 0 : It.source_layout_id) ?? null, vo = !!(It != null && It.auto_generate_on_save), Nh = (It == null ? void 0 : It.overwrite_generated) !== !1, ar = async (e) => {
4157
+ })() : null, Pn = (It == null ? void 0 : It.attach_to_field) ?? null, ou = (It == null ? void 0 : It.filename_template) ?? null, ms = (Ve == null ? void 0 : Ve.group_key) ?? null, ei = !!(ms && Ce.some((e) => e.key === ms)), Sh = (It == null ? void 0 : It.source_layout_id) ?? null, vo = !!(It != null && It.auto_generate_on_save), Nh = (It == null ? void 0 : It.overwrite_generated) !== !1, lr = async (e) => {
4158
4158
  const t = (e == null ? void 0 : e.itemId) ?? p, n = (e == null ? void 0 : e.attachField) ?? Pn, r = (e == null ? void 0 : e.sourceLayoutId) ?? Sh ?? Dt;
4159
- if (!(yr || !n || !r || !t)) {
4159
+ if (!(_r || !n || !r || !t)) {
4160
4160
  od(!0);
4161
4161
  try {
4162
4162
  const s = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", o = await fetch(
@@ -4193,7 +4193,7 @@ ${r.join(`
4193
4193
  }) => {
4194
4194
  if (!e || !(t != null && t.auto_generate_on_save)) return;
4195
4195
  const n = t.attach_to_field;
4196
- n && ar({
4196
+ n && lr({
4197
4197
  silent: !0,
4198
4198
  addendumId: e,
4199
4199
  attachField: n,
@@ -4460,7 +4460,7 @@ ${r.join(`
4460
4460
  const r = [
4461
4461
  ue && Te ? Te.sort : null,
4462
4462
  jr && ct ? ct.sort : null,
4463
- or && dt ? dt.sort : null,
4463
+ ar && dt ? dt.sort : null,
4464
4464
  ue && ut && !ti ? ut.sort : null,
4465
4465
  Ve && !m && !ei ? Ve.sort : null
4466
4466
  ].filter((o) => o !== null), s = r.length > 0 ? Math.min(...r) : 1 / 0;
@@ -4471,7 +4471,7 @@ ${r.join(`
4471
4471
  tie: 1
4472
4472
  }
4473
4473
  ];
4474
- ue && Te && e(Te) && t.push({ item: "__pipeline__", sort: Te.sort, tie: 2 }), jr && ct && e(ct) && t.push({ item: "__tasks__", sort: ct.sort, tie: 3 }), or && dt && e(dt) && t.push({ item: "__comments__", sort: dt.sort, tie: 4 }), x != null && x.addendums_enabled && !m && tn && e(tn) && t.push({ item: "__addendums__", sort: tn.sort, tie: 7 }), !m && kn && e(kn) && t.push({ item: "__referenced_by__", sort: kn.sort, tie: 8 }), !m && xn && e(xn) && t.push({ item: "__related_records__", sort: xn.sort, tie: 9 }), ue && ut && e(ut) && !ti && ps !== "__header__" && t.push({ item: "__owners__", sort: ut.sort, tie: 5 }), Ve && e(Ve) && !m && !ei && t.push({ item: "__pdf__", sort: Ve.sort, tie: 6 });
4474
+ ue && Te && e(Te) && t.push({ item: "__pipeline__", sort: Te.sort, tie: 2 }), jr && ct && e(ct) && t.push({ item: "__tasks__", sort: ct.sort, tie: 3 }), ar && dt && e(dt) && t.push({ item: "__comments__", sort: dt.sort, tie: 4 }), x != null && x.addendums_enabled && !m && tn && e(tn) && t.push({ item: "__addendums__", sort: tn.sort, tie: 7 }), !m && kn && e(kn) && t.push({ item: "__referenced_by__", sort: kn.sort, tie: 8 }), !m && xn && e(xn) && t.push({ item: "__related_records__", sort: xn.sort, tie: 9 }), ue && ut && e(ut) && !ti && ps !== "__header__" && t.push({ item: "__owners__", sort: ut.sort, tie: 5 }), Ve && e(Ve) && !m && !ei && t.push({ item: "__pdf__", sort: Ve.sort, tie: 6 });
4475
4475
  for (const n of lt)
4476
4476
  Tf(n.field) && e(n) && t.push({ item: n.field, sort: n.sort, tie: 8 });
4477
4477
  return t.sort((n, r) => n.sort - r.sort || n.tie - r.tie).map((n) => n.item);
@@ -4486,7 +4486,7 @@ ${r.join(`
4486
4486
  ut,
4487
4487
  ti,
4488
4488
  ue,
4489
- or,
4489
+ ar,
4490
4490
  jr,
4491
4491
  Ve,
4492
4492
  ei,
@@ -4841,7 +4841,7 @@ ${r.join(`
4841
4841
  return n ? (Wr(n), !1) : (dl(), St.mutate(), !0);
4842
4842
  }
4843
4843
  const Dh = () => {
4844
- rs.current = !0, vs(vt), Pe && (vr.current = !1, R.request(fr(`/drafts/${i}/${m ? "new" : String(p)}`)).catch(() => {
4844
+ rs.current = !0, vs(vt), Pe && (wr.current = !1, R.request(mr(`/drafts/${i}/${m ? "new" : String(p)}`)).catch(() => {
4845
4845
  }));
4846
4846
  }, St = Nf({
4847
4847
  mutationFn: async () => {
@@ -5144,7 +5144,7 @@ ${r.join(`
5144
5144
  if (ye)
5145
5145
  for (const ae of ge)
5146
5146
  J.push(
5147
- R.request(fr(`/items/${ye.many_collection}/${ae}`)).catch(F("A link could not be removed"))
5147
+ R.request(mr(`/items/${ye.many_collection}/${ae}`)).catch(F("A link could not be removed"))
5148
5148
  );
5149
5149
  }
5150
5150
  await Promise.all(J);
@@ -5236,7 +5236,7 @@ ${r.join(`
5236
5236
  ve(F, {
5237
5237
  detail: `Saving ${ye(Ke, yt)} (${yt + 1} of ${te.length})`
5238
5238
  }), await (async () => {
5239
- var cr;
5239
+ var ur;
5240
5240
  const mn = Object.entries(Ke).filter(([Xe]) => Xe.startsWith("__o2m_")), pn = Object.fromEntries(
5241
5241
  Object.entries(Ke).filter(([Xe]) => !Xe.startsWith("__o2m_"))
5242
5242
  );
@@ -5259,7 +5259,7 @@ ${r.join(`
5259
5259
  })) : ae.push({ label: ye(Ke, yt), error: e(Xe) }), Je.push(Ke);
5260
5260
  return;
5261
5261
  }
5262
- const Yt = (cr = mt == null ? void 0 : mt.data) == null ? void 0 : cr.id;
5262
+ const Yt = (ur = mt == null ? void 0 : mt.data) == null ? void 0 : ur.id;
5263
5263
  ve(F, (Xe) => {
5264
5264
  var Ae;
5265
5265
  return {
@@ -5268,17 +5268,17 @@ ${r.join(`
5268
5268
  });
5269
5269
  for (const [Xe, Ae] of mn) {
5270
5270
  const Sn = Xe.slice(6), nn = D.find(
5271
- (ur) => ur.one_collection === J && ur.one_field === Sn
5271
+ (fr) => fr.one_collection === J && fr.one_field === Sn
5272
5272
  ), Nn = Array.isArray(Ae) ? Ae : [];
5273
5273
  if (Yt == null || !(nn != null && nn.many_collection) || !nn.many_field) {
5274
5274
  pe += Nn.length;
5275
5275
  continue;
5276
5276
  }
5277
- for (const ur of Nn)
5277
+ for (const fr of Nn)
5278
5278
  try {
5279
5279
  await R.request(
5280
5280
  sn(`/items/${nn.many_collection}`, {
5281
- ...ur,
5281
+ ...fr,
5282
5282
  [nn.many_field]: Yt
5283
5283
  })
5284
5284
  );
@@ -5332,9 +5332,9 @@ ${r.join(`
5332
5332
  ht.current.delete(`${J}:${pe}`), El(R, J).forget(pe);
5333
5333
  }).catch(async (Yt) => {
5334
5334
  ye = !0, mn = !0;
5335
- const cr = jl(Yt), Xe = cr ? null : Rl(Yt);
5336
- if (cr)
5337
- n = cr, ve(F, { status: "error", error: "Waiting for a change reason" });
5335
+ const ur = jl(Yt), Xe = ur ? null : Rl(Yt);
5336
+ if (ur)
5337
+ n = ur, ve(F, { status: "error", error: "Waiting for a change reason" });
5338
5338
  else if (Xe) {
5339
5339
  const Ae = To(
5340
5340
  te,
@@ -5375,14 +5375,14 @@ ${r.join(`
5375
5375
  }
5376
5376
  const pn = {};
5377
5377
  for (const [mt, Yt] of yt) {
5378
- const cr = mt.slice(13), Xe = D.find(
5379
- (rn) => rn.one_collection === J && rn.one_field === cr
5378
+ const ur = mt.slice(13), Xe = D.find(
5379
+ (rn) => rn.one_collection === J && rn.one_field === ur
5380
5380
  ), Ae = Yt, Sn = Ae.collection ?? (Xe == null ? void 0 : Xe.many_collection) ?? null, nn = Ae.collection ? null : (Xe == null ? void 0 : Xe.many_field) ?? null;
5381
5381
  if (!Sn || !Ae.collection && !nn) {
5382
5382
  ae += Ae.created.length + Ae.updated.length + Ae.deleted.length, pn[mt] = Ae;
5383
5383
  continue;
5384
5384
  }
5385
- const Nn = [], ur = [], xl = [];
5385
+ const Nn = [], fr = [], xl = [];
5386
5386
  await Promise.all(
5387
5387
  Ae.created.map(
5388
5388
  (rn) => R.request(
@@ -5397,18 +5397,18 @@ ${r.join(`
5397
5397
  ), await Promise.all(
5398
5398
  Ae.updated.map(
5399
5399
  (rn) => R.request(mi(`/items/${Sn}/${rn.id}`, rn.changes)).catch(() => {
5400
- ae++, ur.push(rn);
5400
+ ae++, fr.push(rn);
5401
5401
  })
5402
5402
  )
5403
5403
  ), await Promise.all(
5404
5404
  Ae.deleted.map(
5405
- (rn) => R.request(fr(`/items/${Sn}/${rn}`)).catch(() => {
5405
+ (rn) => R.request(mr(`/items/${Sn}/${rn}`)).catch(() => {
5406
5406
  ae++, xl.push(rn);
5407
5407
  })
5408
5408
  )
5409
- ), (Nn.length || ur.length || xl.length) && (pn[mt] = {
5409
+ ), (Nn.length || fr.length || xl.length) && (pn[mt] = {
5410
5410
  created: Nn,
5411
- updated: ur,
5411
+ updated: fr,
5412
5412
  deleted: xl,
5413
5413
  ...Ae.collection ? { collection: Ae.collection } : {}
5414
5414
  });
@@ -5425,7 +5425,7 @@ ${r.join(`
5425
5425
  error: `${ae} nested row${ae !== 1 ? "s" : ""} failed`
5426
5426
  }));
5427
5427
  }
5428
- wr(Ze), n && (Wr(n), Oe.current.reasonWaiting = !0), Hn.length > 0 && (Oe.current.lineConflicts = Hn.length, qi(Hn));
5428
+ kr(Ze), n && (Wr(n), Oe.current.reasonWaiting = !0), Hn.length > 0 && (Oe.current.lineConflicts = Hn.length, qi(Hn));
5429
5429
  const Gt = new Map(We);
5430
5430
  for (const b of S) {
5431
5431
  const F = `o2m:del:${b}`, [J] = b.split("."), me = We.get(b) ?? /* @__PURE__ */ new Set();
@@ -5433,7 +5433,7 @@ ${r.join(`
5433
5433
  let te = !1;
5434
5434
  await Promise.all(
5435
5435
  [...me].map(async (ge) => {
5436
- await R.request(fr(`/items/${J}/${ge}${s}`)).catch((ye) => {
5436
+ await R.request(mr(`/items/${J}/${ge}${s}`)).catch((ye) => {
5437
5437
  te = !0;
5438
5438
  const ae = `${To(Ti(J, b.split(".")[1]), ge)} not removed: ${e(ye)}`;
5439
5439
  Oe.current.childFailed = !0, Oe.current.childErrors = [
@@ -5545,7 +5545,7 @@ ${r.join(`
5545
5545
  }
5546
5546
  rr(new Map(Ji.current));
5547
5547
  const r = ds.current.size > 0;
5548
- if (ds.current.clear(), Da(/* @__PURE__ */ new Map()), X.invalidateQueries({ queryKey: ["item", i] }), r ? X.invalidateQueries({ queryKey: ["m2m-items"] }) : Wf(X, [e, ...O0(ze)]), tb(X, i, String(e)), X.invalidateQueries({ queryKey: ["last-touch", i, String(e)] }), X.invalidateQueries({ queryKey: ["field-lineage", i, String(e)] }), X.invalidateQueries({ queryKey: ["child-summary", i, String(e)] }), nb(X, i, String(e)), vo && Pn && ar({ itemId: String(e), silent: !0 }), m && Ks.current) {
5548
+ if (ds.current.clear(), Da(/* @__PURE__ */ new Map()), X.invalidateQueries({ queryKey: ["item", i] }), r ? X.invalidateQueries({ queryKey: ["m2m-items"] }) : Wf(X, [e, ...O0(ze)]), tb(X, i, String(e)), X.invalidateQueries({ queryKey: ["last-touch", i, String(e)] }), X.invalidateQueries({ queryKey: ["field-lineage", i, String(e)] }), X.invalidateQueries({ queryKey: ["child-summary", i, String(e)] }), nb(X, i, String(e)), vo && Pn && lr({ itemId: String(e), silent: !0 }), m && Ks.current) {
5549
5549
  const d = Ks.current;
5550
5550
  Ks.current = null;
5551
5551
  const g = {};
@@ -5609,7 +5609,7 @@ ${r.join(`
5609
5609
  ), u = g0(d, g);
5610
5610
  u ? (c.set(s.rowId, u), ht.current.set(`${o}:${s.rowId}`, Promise.resolve(s.latest || null)), r++) : (c.delete(s.rowId), ht.current.delete(`${o}:${s.rowId}`)), c.size > 0 ? n.set(s.key, c) : n.delete(s.key);
5611
5611
  }
5612
- if (wr(n), r > 0 && Cs.current && !_t.current && (_t.current = Cs.current), Cs.current = null, aa) {
5612
+ if (kr(n), r > 0 && Cs.current && !_t.current && (_t.current = Cs.current), Cs.current = null, aa) {
5613
5613
  la(!1), _e.success(
5614
5614
  r > 0 ? "Your draft now holds your picks — press Save when you are ready" : "Kept the newer values"
5615
5615
  );
@@ -5660,7 +5660,7 @@ ${r.join(`
5660
5660
  const t = { ...U.current, ...e.payload };
5661
5661
  U.current = t, pt(t);
5662
5662
  for (const r of Object.keys(e.payload))
5663
- Le.current.add(r), _r.current.set(r, ++Os.current);
5663
+ Le.current.add(r), br.current.set(r, ++Os.current);
5664
5664
  if (Fn(!0), e.change_reason && (_t.current = e.change_reason), e.status === "conflict" && ((n = e.conflicts) != null && n.length)) {
5665
5665
  const r = {};
5666
5666
  for (const s of e.conflicts) r[s.field] = e.payload[s.field];
@@ -5726,7 +5726,7 @@ ${r.join(`
5726
5726
  const Yh = () => new Promise((e) => {
5727
5727
  Fo.current.push(e), setTimeout(e, 400);
5728
5728
  }), ml = Nf({
5729
- mutationFn: () => R.request(fr(`/items/${i}/${p}`)),
5729
+ mutationFn: () => R.request(mr(`/items/${i}/${p}`)),
5730
5730
  onSuccess: () => {
5731
5731
  _e.success("Record deleted"), X.invalidateQueries({ queryKey: ["item", i] }), le == null || le();
5732
5732
  },
@@ -5743,7 +5743,7 @@ ${r.join(`
5743
5743
  }), [Zh, ju] = P(!1), Nt = /* @__PURE__ */ new Set(), Et = /* @__PURE__ */ new Set();
5744
5744
  if (Qt)
5745
5745
  for (const e of j ?? []) Et.add(e.field);
5746
- if (Sr)
5746
+ if (Nr)
5747
5747
  for (const e of Zg(
5748
5748
  (j ?? []).map((t) => t.field),
5749
5749
  Ta
@@ -5931,7 +5931,7 @@ ${r.join(`
5931
5931
  label: be(f.replace(/_/g, " ")),
5932
5932
  from: d ? d[f] : void 0,
5933
5933
  to: c[f],
5934
- onRevert: () => wr((h) => {
5934
+ onRevert: () => kr((h) => {
5935
5935
  const v = new Map(h), S = new Map(v.get(e)), y = { ...S.get(l) ?? {} };
5936
5936
  return delete y[f], Object.keys(y).filter((T) => !T.startsWith("__")).length === 0 ? S.delete(l) : S.set(l, y), S.size === 0 ? v.delete(e) : v.set(e, S), v;
5937
5937
  })
@@ -5976,7 +5976,7 @@ ${r.join(`
5976
5976
  z(() => {
5977
5977
  var d, g, u;
5978
5978
  const e = ua;
5979
- if (m || !br || I || io && Fe === void 0 && !cc || oo && ke === void 0 && !mc || Hy(br) && de === void 0 && !zn) return;
5979
+ if (m || !vr || I || io && Fe === void 0 && !cc || oo && ke === void 0 && !mc || Hy(vr) && de === void 0 && !zn) return;
5980
5980
  const t = ((d = ke == null ? void 0 : ke.instance) == null ? void 0 : d.current_state) ?? null, n = ((u = (g = ke == null ? void 0 : ke.states) == null ? void 0 : g.find((f) => f.id === t)) == null ? void 0 : u.key) ?? null, r = Fe != null && Fe.role ? String(Fe.role) : null, s = Uy(
5981
5981
  e,
5982
5982
  oo ? n : null,
@@ -5986,7 +5986,7 @@ ${r.join(`
5986
5986
  const l = !Jy(o, e);
5987
5987
  if (Gy({ first: l, unsaved: zt, lineDrafts: Es.size })) return;
5988
5988
  Iu.current = s;
5989
- const c = Yy(br, {
5989
+ const c = Yy(vr, {
5990
5990
  role: r,
5991
5991
  stateKey: n,
5992
5992
  isNew: m,
@@ -5999,7 +5999,7 @@ ${r.join(`
5999
5999
  ua,
6000
6000
  I,
6001
6001
  m,
6002
- br,
6002
+ vr,
6003
6003
  io,
6004
6004
  oo,
6005
6005
  Fe,
@@ -6054,7 +6054,7 @@ ${r.join(`
6054
6054
  const t = (j ?? []).find((n) => n.field === e);
6055
6055
  return t && Ll(t, uo).label || (t == null ? void 0 : t.label) || be(e);
6056
6056
  },
6057
- editSeq: (e) => _r.current.get(e) ?? (Le.current.has(e) ? 0 : -1)
6057
+ editSeq: (e) => br.current.get(e) ?? (Le.current.has(e) ? 0 : -1)
6058
6058
  }), Oo = $g();
6059
6059
  z(() => () => V0(Oo), [Oo]);
6060
6060
  const sg = A(
@@ -6082,7 +6082,7 @@ ${r.join(`
6082
6082
  field: e,
6083
6083
  group_key: t !== void 0 ? t : ((n = lt.find((r) => r.field === e)) == null ? void 0 : n.group_key) ?? null
6084
6084
  };
6085
- }, lr = (e, t = !0) => $n && (e.hidden || !t), jo = (e, t) => e ? /* @__PURE__ */ a("div", { "data-design-hidden": "", className: "opacity-40", children: t }) : t, bl = (e) => ({
6085
+ }, dr = (e, t = !0) => $n && (e.hidden || !t), jo = (e, t) => e ? /* @__PURE__ */ a("div", { "data-design-hidden": "", className: "opacity-40", children: t }) : t, bl = (e) => ({
6086
6086
  // A display formula is a `__calc_<n>__` placement — the editor's slot kind (#2712).
6087
6087
  kind: W0(e) ? "slot" : "field",
6088
6088
  field: e.field,
@@ -6123,7 +6123,7 @@ ${r.join(`
6123
6123
  },
6124
6124
  "__pipeline__"
6125
6125
  );
6126
- if (e === "__comments__" && or)
6126
+ if (e === "__comments__" && ar)
6127
6127
  return /* @__PURE__ */ a(
6128
6128
  Po,
6129
6129
  {
@@ -6232,8 +6232,8 @@ ${r.join(`
6232
6232
  "button",
6233
6233
  {
6234
6234
  type: "button",
6235
- onClick: () => void ar(),
6236
- disabled: yr || l,
6235
+ onClick: () => void lr(),
6236
+ disabled: _r || l,
6237
6237
  title: l ? "Configure PDF field in Data Model → Layouts" : void 0,
6238
6238
  className: "inline-flex items-center gap-1.5 rounded-md border border-nvr-cyan/40 bg-nvr-cyan/10 px-3 py-1.5 text-[12px] font-medium text-nvr-navy hover:bg-nvr-cyan/20 disabled:cursor-not-allowed disabled:opacity-40 dark:text-nvr-cyan",
6239
6239
  children: [
@@ -6256,7 +6256,7 @@ ${r.join(`
6256
6256
  ]
6257
6257
  }
6258
6258
  ),
6259
- yr ? "Generating…" : o
6259
+ _r ? "Generating…" : o
6260
6260
  ]
6261
6261
  }
6262
6262
  ) }, "__pdf__");
@@ -6282,7 +6282,7 @@ ${r.join(`
6282
6282
  bl(n),
6283
6283
  /* @__PURE__ */ _("div", { style: { gridColumn: `span ${Tl(n.options, t)}` }, children: [
6284
6284
  jo(
6285
- lr(n),
6285
+ dr(n),
6286
6286
  /* @__PURE__ */ a(
6287
6287
  ws,
6288
6288
  {
@@ -6295,11 +6295,11 @@ ${r.join(`
6295
6295
  error: tt[n.field],
6296
6296
  autoFillTick: qs[n.field],
6297
6297
  visible: !0,
6298
- forceVisible: lr(n) || void 0,
6298
+ forceVisible: dr(n) || void 0,
6299
6299
  locked: Qt || Et.has(n.field) || He !== "original",
6300
6300
  layoutAiEnabled: Fr,
6301
- renderField: hr,
6302
- onCountChange: xr
6301
+ renderField: gr,
6302
+ onCountChange: Sr
6303
6303
  }
6304
6304
  )
6305
6305
  ),
@@ -6493,8 +6493,8 @@ ${r.join(`
6493
6493
  forceVisible: !0,
6494
6494
  locked: Et.has(Ze.field) || He !== "original",
6495
6495
  layoutAiEnabled: Fr,
6496
- renderField: hr,
6497
- onCountChange: xr
6496
+ renderField: gr,
6497
+ onCountChange: Sr
6498
6498
  }
6499
6499
  ) }, Ze.field) : null;
6500
6500
  }) }) }) : void 0;
@@ -6502,7 +6502,7 @@ ${r.join(`
6502
6502
  bl(Q),
6503
6503
  /* @__PURE__ */ _("div", { style: { gridColumn: `span ${Tl(Q.options, Y)}` }, children: [
6504
6504
  jo(
6505
- lr(Q, Nt.has(Q.field) || !Nt.size),
6505
+ dr(Q, Nt.has(Q.field) || !Nt.size),
6506
6506
  /* @__PURE__ */ a(
6507
6507
  ws,
6508
6508
  {
@@ -6515,11 +6515,11 @@ ${r.join(`
6515
6515
  error: tt[Q.field],
6516
6516
  autoFillTick: qs[Q.field],
6517
6517
  visible: Nt.has(Q.field) || !Nt.size,
6518
- forceVisible: lr(Q, Nt.has(Q.field) || !Nt.size) || void 0,
6518
+ forceVisible: dr(Q, Nt.has(Q.field) || !Nt.size) || void 0,
6519
6519
  locked: Et.has(Q.field) || He !== "original",
6520
6520
  layoutAiEnabled: Fr,
6521
- renderField: hr,
6522
- onCountChange: xr,
6521
+ renderField: gr,
6522
+ onCountChange: Sr,
6523
6523
  swapButton: fe,
6524
6524
  swapContent: Re
6525
6525
  }
@@ -6575,8 +6575,8 @@ ${r.join(`
6575
6575
  "button",
6576
6576
  {
6577
6577
  type: "button",
6578
- onClick: () => void ar(),
6579
- disabled: yr || !Pn,
6578
+ onClick: () => void lr(),
6579
+ disabled: _r || !Pn,
6580
6580
  title: Pn ? void 0 : "Configure PDF field in Data Model → Layouts",
6581
6581
  className: "inline-flex items-center gap-1.5 rounded-md border border-nvr-cyan/40 bg-nvr-cyan/10 px-3 py-1.5 text-[12px] font-medium text-nvr-navy hover:bg-nvr-cyan/20 disabled:cursor-not-allowed disabled:opacity-40 dark:text-nvr-cyan",
6582
6582
  children: [
@@ -6599,7 +6599,7 @@ ${r.join(`
6599
6599
  ]
6600
6600
  }
6601
6601
  ),
6602
- yr ? "Generating…" : ((S = Ve == null ? void 0 : Ve.label_override) == null ? void 0 : S.trim()) || "Generate PDF"
6602
+ _r ? "Generating…" : ((S = Ve == null ? void 0 : Ve.label_override) == null ? void 0 : S.trim()) || "Generate PDF"
6603
6603
  ]
6604
6604
  }
6605
6605
  ) }),
@@ -6698,8 +6698,8 @@ ${r.join(`
6698
6698
  lockedFields: Et,
6699
6699
  layoutAiEnabled: Fr,
6700
6700
  displayOnly: t.type === "metadata",
6701
- renderField: hr,
6702
- onCountChange: xr,
6701
+ renderField: gr,
6702
+ onCountChange: Sr,
6703
6703
  isNew: m,
6704
6704
  fieldValues: l.map((h) => M[h.field]),
6705
6705
  isOpen: u ? lh === t.id : void 0,
@@ -6760,7 +6760,7 @@ ${r.join(`
6760
6760
  !xn && /* @__PURE__ */ a(Kl, { collection: i, itemId: String(p) }),
6761
6761
  !kn && /* @__PURE__ */ a(Ml, { collection: i, itemId: String(p) })
6762
6762
  ] }),
6763
- !dt && or && /* @__PURE__ */ a(
6763
+ !dt && ar && /* @__PURE__ */ a(
6764
6764
  Po,
6765
6765
  {
6766
6766
  collection: i,
@@ -6781,7 +6781,7 @@ ${r.join(`
6781
6781
  onActiveCountChange: Ni,
6782
6782
  onCreated: wo,
6783
6783
  onApplied: () => {
6784
- vo && Pn && ar({ silent: !0 });
6784
+ vo && Pn && lr({ silent: !0 });
6785
6785
  }
6786
6786
  }
6787
6787
  )
@@ -6806,7 +6806,7 @@ ${r.join(`
6806
6806
  renderMember: (s) => Pt(
6807
6807
  { kind: "field", field: s.field, group_key: r },
6808
6808
  /* @__PURE__ */ a("div", { children: jo(
6809
- lr(s, Nt.has(s.field) || !Nt.size),
6809
+ dr(s, Nt.has(s.field) || !Nt.size),
6810
6810
  /* @__PURE__ */ a(
6811
6811
  ws,
6812
6812
  {
@@ -6819,11 +6819,11 @@ ${r.join(`
6819
6819
  error: tt[s.field],
6820
6820
  autoFillTick: qs[s.field],
6821
6821
  visible: Nt.has(s.field) || !Nt.size,
6822
- forceVisible: lr(s, Nt.has(s.field) || !Nt.size) || void 0,
6822
+ forceVisible: dr(s, Nt.has(s.field) || !Nt.size) || void 0,
6823
6823
  locked: Et.has(s.field) || Qt || He !== "original",
6824
6824
  layoutAiEnabled: Fr,
6825
- renderField: hr,
6826
- onCountChange: xr
6825
+ renderField: gr,
6826
+ onCountChange: Sr
6827
6827
  }
6828
6828
  )
6829
6829
  ) }, s.field),
@@ -6910,8 +6910,8 @@ ${r.join(`
6910
6910
  "button",
6911
6911
  {
6912
6912
  type: "button",
6913
- onClick: () => void ar(),
6914
- disabled: yr || G,
6913
+ onClick: () => void lr(),
6914
+ disabled: _r || G,
6915
6915
  title: G ? "Configure PDF field in Data Model → Layouts" : void 0,
6916
6916
  className: "inline-flex items-center gap-1.5 rounded-md border border-nvr-cyan/40 bg-nvr-cyan/10 px-3 py-1.5 text-[12px] font-medium text-nvr-navy hover:bg-nvr-cyan/20 disabled:cursor-not-allowed disabled:opacity-40 dark:text-nvr-cyan",
6917
6917
  children: [
@@ -6932,7 +6932,7 @@ ${r.join(`
6932
6932
  ]
6933
6933
  }
6934
6934
  ),
6935
- yr ? "Generating…" : Z
6935
+ _r ? "Generating…" : Z
6936
6936
  ]
6937
6937
  }
6938
6938
  ) }, "__pdf__"),
@@ -6964,7 +6964,7 @@ ${r.join(`
6964
6964
  bl(f),
6965
6965
  /* @__PURE__ */ _("div", { style: { gridColumn: `span ${Tl(f.options, u)}` }, children: [
6966
6966
  jo(
6967
- lr(f),
6967
+ dr(f),
6968
6968
  /* @__PURE__ */ a(
6969
6969
  ws,
6970
6970
  {
@@ -6977,11 +6977,11 @@ ${r.join(`
6977
6977
  error: tt[f.field],
6978
6978
  autoFillTick: qs[f.field],
6979
6979
  visible: !0,
6980
- forceVisible: lr(f) || void 0,
6980
+ forceVisible: dr(f) || void 0,
6981
6981
  locked: Qt || Et.has(f.field) || He !== "original",
6982
6982
  layoutAiEnabled: Fr,
6983
- renderField: hr,
6984
- onCountChange: xr
6983
+ renderField: gr,
6984
+ onCountChange: Sr
6985
6985
  }
6986
6986
  )
6987
6987
  ),
@@ -7111,7 +7111,7 @@ ${r.join(`
7111
7111
  !xn && /* @__PURE__ */ a(Kl, { collection: i, itemId: String(p) }),
7112
7112
  !kn && /* @__PURE__ */ a(Ml, { collection: i, itemId: String(p) })
7113
7113
  ] }),
7114
- !dt && or && /* @__PURE__ */ a(
7114
+ !dt && ar && /* @__PURE__ */ a(
7115
7115
  Po,
7116
7116
  {
7117
7117
  collection: i,
@@ -7132,7 +7132,7 @@ ${r.join(`
7132
7132
  onActiveCountChange: Ni,
7133
7133
  onCreated: wo,
7134
7134
  onApplied: () => {
7135
- vo && Pn && ar({ silent: !0 });
7135
+ vo && Pn && lr({ silent: !0 });
7136
7136
  }
7137
7137
  }
7138
7138
  )
@@ -7250,7 +7250,7 @@ ${r.join(`
7250
7250
  onRemoveQueuedTask: m ? Hi : void 0
7251
7251
  }
7252
7252
  ),
7253
- !dt && or && /* @__PURE__ */ a(
7253
+ !dt && ar && /* @__PURE__ */ a(
7254
7254
  Po,
7255
7255
  {
7256
7256
  collection: i,
@@ -7272,7 +7272,7 @@ ${r.join(`
7272
7272
  onActiveCountChange: Ni,
7273
7273
  onCreated: wo,
7274
7274
  onApplied: () => {
7275
- vo && Pn && ar({ silent: !0 });
7275
+ vo && Pn && lr({ silent: !0 });
7276
7276
  }
7277
7277
  }
7278
7278
  ),
@@ -7364,7 +7364,7 @@ ${r.join(`
7364
7364
  Fi.slow && /* @__PURE__ */ a(Xf, { reason: Fi })
7365
7365
  ] })
7366
7366
  ] });
7367
- const Bu = (x == null ? void 0 : x.display_name) ?? be(i ?? ""), zu = (x == null ? void 0 : x.singular) || Bu, dr = !m && de && (x != null && x.display_template) ? rm(
7367
+ const Bu = (x == null ? void 0 : x.display_name) ?? be(i ?? ""), zu = (x == null ? void 0 : x.singular) || Bu, cr = !m && de && (x != null && x.display_template) ? rm(
7368
7368
  ql(x.display_template, de),
7369
7369
  de,
7370
7370
  zu
@@ -7620,15 +7620,15 @@ ${r.join(`
7620
7620
  className: Ho ? "flex min-w-[200px] flex-col" : "flex min-w-[180px] flex-col md:min-w-[260px]",
7621
7621
  children: [
7622
7622
  /* @__PURE__ */ _("div", { className: "group/title flex items-center gap-1.5", children: [
7623
- /* @__PURE__ */ a("h1", { className: "truncate text-[17px] font-bold leading-tight text-slate-900 dark:text-slate-50", children: m ? `New ${zu}` : dr }),
7624
- !m && dr && (Is === "__title__" ? /* @__PURE__ */ a(mr, { className: "h-3 w-3 shrink-0 text-emerald-500" }) : /* @__PURE__ */ a(
7623
+ /* @__PURE__ */ a("h1", { className: "truncate text-[17px] font-bold leading-tight text-slate-900 dark:text-slate-50", children: m ? `New ${zu}` : cr }),
7624
+ !m && cr && (Is === "__title__" ? /* @__PURE__ */ a(pr, { className: "h-3 w-3 shrink-0 text-emerald-500" }) : /* @__PURE__ */ a(
7625
7625
  "button",
7626
7626
  {
7627
7627
  type: "button",
7628
7628
  "aria-label": "Copy title",
7629
7629
  className: "cursor-pointer opacity-0 transition-opacity group-hover/title:opacity-100",
7630
7630
  onClick: () => {
7631
- navigator.clipboard.writeText(dr ?? "").catch(() => {
7631
+ navigator.clipboard.writeText(cr ?? "").catch(() => {
7632
7632
  }), nr("__title__"), setTimeout(
7633
7633
  () => nr(
7634
7634
  (e) => e === "__title__" ? null : e
@@ -7745,7 +7745,7 @@ ${r.join(`
7745
7745
  })
7746
7746
  }
7747
7747
  ),
7748
- Is === "__subtitle__" ? /* @__PURE__ */ a(mr, { className: "h-3 w-3 shrink-0 text-emerald-500" }) : /* @__PURE__ */ a(
7748
+ Is === "__subtitle__" ? /* @__PURE__ */ a(pr, { className: "h-3 w-3 shrink-0 text-emerald-500" }) : /* @__PURE__ */ a(
7749
7749
  "button",
7750
7750
  {
7751
7751
  type: "button",
@@ -7874,13 +7874,13 @@ ${r.join(`
7874
7874
  role: "radio",
7875
7875
  "aria-checked": !bt,
7876
7876
  "data-summary-mode-option": "edit",
7877
- title: gt && !Sr ? `Form view — read-only: ${gt}` : "Edit mode — change this record",
7877
+ title: gt && !Nr ? `Form view — read-only: ${gt}` : "Edit mode — change this record",
7878
7878
  onClick: () => Li(!1),
7879
7879
  className: De(
7880
7880
  "inline-flex h-full items-center gap-1.5 rounded px-2.5 transition-colors",
7881
7881
  bt ? "text-slate-600 hover:bg-muted dark:text-slate-300" : "bg-nvr-cyan text-white shadow-sm"
7882
7882
  ),
7883
- children: gt && !Sr ? /* @__PURE__ */ _(Ct, { children: [
7883
+ children: gt && !Nr ? /* @__PURE__ */ _(Ct, { children: [
7884
7884
  /* @__PURE__ */ a($f, { className: "h-3.5 w-3.5", strokeWidth: 2 }),
7885
7885
  "Form"
7886
7886
  ] }) : /* @__PURE__ */ _(Ct, { children: [
@@ -8663,11 +8663,11 @@ ${r.join(`
8663
8663
  // L29 (army 6): a record this person cannot change
8664
8664
  // (step-locked, every field locked, gone) shows no
8665
8665
  // Save. Another editor's lock keeps it, disabled.
8666
- !m && !Ue && !oc && (hl || !!er || !!gt && !Sr) && "hidden",
8666
+ !m && !Ue && !oc && (hl || !!er || !!gt && !Nr) && "hidden",
8667
8667
  fa && "bg-emerald-500 hover:bg-emerald-500 text-white"
8668
8668
  ),
8669
8669
  children: [
8670
- St.isPending ? /* @__PURE__ */ a(Ir, { className: "h-3.5 w-3.5 animate-spin" }) : fa ? /* @__PURE__ */ a(mr, { className: "nvr-pop h-3.5 w-3.5" }) : /* @__PURE__ */ a(Rf, { className: "h-3.5 w-3.5" }),
8670
+ St.isPending ? /* @__PURE__ */ a(Ir, { className: "h-3.5 w-3.5 animate-spin" }) : fa ? /* @__PURE__ */ a(pr, { className: "nvr-pop h-3.5 w-3.5" }) : /* @__PURE__ */ a(Rf, { className: "h-3.5 w-3.5" }),
8671
8671
  fa ? "Saved" : m ? "Create" : "Save"
8672
8672
  ]
8673
8673
  }
@@ -8866,7 +8866,7 @@ ${r.join(`
8866
8866
  onOpenChange: au,
8867
8867
  collection: i,
8868
8868
  item: String(p),
8869
- recordLabel: dr ? String(dr) : null,
8869
+ recordLabel: cr ? String(cr) : null,
8870
8870
  onCreated: (e) => _e.success(`Request #${e.id} sent to the administrators`)
8871
8871
  }
8872
8872
  ),
@@ -9040,7 +9040,7 @@ ${r.join(`
9040
9040
  }))
9041
9041
  }
9042
9042
  ),
9043
- !Z && (Is === C.field ? /* @__PURE__ */ a(mr, { className: "absolute top-2 right-2 h-3 w-3 text-green-500" }) : /* @__PURE__ */ a(
9043
+ !Z && (Is === C.field ? /* @__PURE__ */ a(pr, { className: "absolute top-2 right-2 h-3 w-3 text-green-500" }) : /* @__PURE__ */ a(
9044
9044
  "button",
9045
9045
  {
9046
9046
  type: "button",
@@ -9094,7 +9094,7 @@ ${r.join(`
9094
9094
  )
9095
9095
  }
9096
9096
  ),
9097
- Is === "__owners__" ? /* @__PURE__ */ a(mr, { className: "absolute top-2 right-2 h-3 w-3 text-green-500" }) : /* @__PURE__ */ a(
9097
+ Is === "__owners__" ? /* @__PURE__ */ a(pr, { className: "absolute top-2 right-2 h-3 w-3 text-green-500" }) : /* @__PURE__ */ a(
9098
9098
  "button",
9099
9099
  {
9100
9100
  type: "button",
@@ -9236,7 +9236,7 @@ ${r.join(`
9236
9236
  className: "absolute top-2 right-6"
9237
9237
  }
9238
9238
  ),
9239
- Is === s.field ? /* @__PURE__ */ a(mr, { className: "absolute top-2 right-2 h-3 w-3 text-green-500" }) : /* @__PURE__ */ a(
9239
+ Is === s.field ? /* @__PURE__ */ a(pr, { className: "absolute top-2 right-2 h-3 w-3 text-green-500" }) : /* @__PURE__ */ a(
9240
9240
  "button",
9241
9241
  {
9242
9242
  type: "button",
@@ -9596,8 +9596,8 @@ ${r.join(`
9596
9596
  visible: !0,
9597
9597
  locked: !1,
9598
9598
  layoutAiEnabled: Fr,
9599
- renderField: hr,
9600
- onCountChange: xr
9599
+ renderField: gr,
9600
+ onCountChange: Sr
9601
9601
  },
9602
9602
  `summary-grid-${e.field}`
9603
9603
  ) : null;