@nivaro/react 0.3.49 → 0.3.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/components/InlineGridField.js +166 -105
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +38 -4
  5. package/dist/shared/components/ItemEditForm.js +5258 -5034
  6. package/dist/shared/components/QueryTable.js +489 -347
  7. package/dist/shared/components/ReportView.js +105 -99
  8. package/dist/shared/components/alerts/AlertManagerView.js +327 -301
  9. package/dist/shared/components/item-edit/CatalogPickerField.js +1230 -1175
  10. package/dist/shared/components/item-edit/CloneDialog.js +192 -142
  11. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
  12. package/dist/shared/components/item-edit/FieldRenderer.js +249 -244
  13. package/dist/shared/components/item-edit/FieldRow.js +402 -370
  14. package/dist/shared/components/item-edit/FilePickerField.js +315 -307
  15. package/dist/shared/components/item-edit/InlineGridField.js +92 -90
  16. package/dist/shared/components/item-edit/InlineTableField.js +3119 -2951
  17. package/dist/shared/components/item-edit/MidairCollisionDialog.js +175 -0
  18. package/dist/shared/components/item-edit/PlanGrid.js +162 -162
  19. package/dist/shared/components/item-edit/PolishFields.js +169 -162
  20. package/dist/shared/components/item-edit/RecordHeaderActions.js +76 -75
  21. package/dist/shared/components/item-edit/RecordLiveSync.js +93 -91
  22. package/dist/shared/components/item-edit/RelationCombobox.js +198 -191
  23. package/dist/shared/components/item-edit/SummaryPanel.js +282 -259
  24. package/dist/shared/components/item-edit/UserChip.js +233 -200
  25. package/dist/shared/components/item-edit/ValidationSummary.js +64 -47
  26. package/dist/shared/components/item-edit/header-midair.js +51 -0
  27. package/dist/shared/components/item-edit/helpers.js +181 -155
  28. package/dist/shared/components/item-edit/line-midair.js +207 -0
  29. package/dist/shared/components/item-edit/soft-rules.js +27 -0
  30. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  31. package/dist/shared/components/panels/CommentPanel.js +290 -284
  32. package/dist/shared/components/panels/ItemLockBanner.js +414 -358
  33. package/dist/shared/components/panels/PipelinePanel.js +1241 -992
  34. package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
  35. package/dist/shared/components/panels/TaskPanel.js +71 -61
  36. package/dist/shared/components/panels/TransitionRequirementsDialog.js +569 -439
  37. package/dist/shared/components/panels/requirement-side-effects.js +40 -0
  38. package/dist/shared/components/queue/QueueWorklist.js +925 -871
  39. package/dist/shared/components/queue/column-chooser.js +21 -0
  40. package/dist/shared/components/queue/live-state-aspect.js +6 -0
  41. package/dist/shared/components/ui/number-draft-input.js +93 -0
  42. package/dist/shared/components/widgets/ReviewListWidget.js +191 -166
  43. package/dist/shared/lib/draft-store.js +48 -34
  44. package/dist/shared/lib/error-hints.js +1 -0
  45. package/dist/shared/lib/query-stats.js +60 -60
  46. package/package.json +1 -1
@@ -1,34 +1,35 @@
1
- import { jsxs as d, jsx as n } from "react/jsx-runtime";
2
- import { useQueryClient as Ve, useQueries as xt, useQuery as re, useMutation as yt } from "@tanstack/react-query";
3
- import { Info as bt, Loader2 as gt, Sparkles as vt, Lock as wt, SlidersHorizontal as kt, History as _t, BellRing as Nt, Bell as Ft, Sigma as Ct } from "lucide-react";
4
- import { memo as Lt, useState as ve, useRef as R, useId as St, useEffect as le, useCallback as Ke } from "react";
5
- import { toast as oe } from "sonner";
6
- import { useParentDraft as Rt, useNivaroClient as ie } from "../../context.js";
7
- import { showsAiButton as $t, AUTOFILL_CHECK_KEY as qt, readAiFill as At } from "../../lib/ai-fill.js";
8
- import { get as K, del as Tt, post as ge } from "../../lib/commands.js";
9
- import { toastError as Et } from "../../lib/error-toast.js";
10
- import { titleCase as Z, cn as j } from "../../lib/utils.js";
11
- import { GlossaryLabel as Ue } from "../ai/GlossaryText.js";
12
- import { useFieldSource as Pt, FieldSourceInfo as jt } from "../ConfigReadBack.js";
13
- import { Label as Dt } from "../ui/label.js";
14
- import { TooltipProvider as I, Tooltip as ee, TooltipTrigger as te, TooltipContent as ne } from "../ui/tooltip.js";
15
- import { useAddendumFields as Bt } from "./AddendumFieldContext.js";
16
- import { AutoIdPreviewField as Ot } from "./AutoIdPreviewField.js";
17
- import { FOCUSABLE as He } from "./entry/entry-keys.js";
18
- import { useFieldAffordances as Mt, useFieldContextMenu as Kt, usePresenceSoftLock as Ut, LockReasonBadge as Ht, PresenceSoftLockStrip as Wt, RemoteChangeGhost as Vt } from "./FieldAffordances.js";
19
- import { FieldCommentButton as zt } from "./FieldComments.js";
20
- import { FieldRenderer as Gt } from "./FieldRenderer.js";
21
- import { FormHelpVideoButton as Qt } from "./FormHelpVideoButton.js";
22
- import { getCascadeFilters as Yt, SYSTEM_FIELDS as Jt, parseJson as Xt, buildCascadeFilter as Zt, CascadeEffectController as It } from "./helpers.js";
23
- import { isDerivedForRecord as en } from "./live-rollups.js";
24
- import { useM2MStaging as tn } from "./M2MStagingContext.js";
25
- import { personalDefaultSlotFor as nn, PersonalDefaultSlot as rn } from "./PersonalDefaultControl.js";
26
- import { PersonalDefaultHint as ln } from "./PersonalDefaultPill.js";
27
- import { isDisplayFormulaRow as We, usePlacementTextContext as on, placementFieldText as an, fieldCounterConfig as sn, fieldIsRecommended as cn, RecommendedMarker as dn, RepeatLastButton as un, DisplayFormulaValue as mn, FieldCounter as pn } from "./placement-behaviour.js";
28
- import { keepIfEqual as hn, jsonEqual as fn } from "./render-stability.js";
29
- import { usePersonalDefaultsApi as xn } from "./usePersonalDefaults.js";
30
- import { resolveOptionFilterTokens as yn } from "../../lib/option-filter-tokens.js";
31
- const bn = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger", "number"]), gn = /* @__PURE__ */ new Set(["string", "text", "richtext", "textarea", "markdown", "json", "csv"]), vn = /* @__PURE__ */ new Set([
1
+ import { jsxs as u, jsx as n } from "react/jsx-runtime";
2
+ import { useQueryClient as Ge, useQueries as bt, useQuery as le, useMutation as gt } from "@tanstack/react-query";
3
+ import { Info as vt, Loader2 as wt, Sparkles as kt, Lock as _t, SlidersHorizontal as Nt, History as Ft, BellRing as Ct, Bell as Lt, Sigma as Rt } from "lucide-react";
4
+ import { memo as St, useState as ve, useRef as $, useId as $t, useEffect as oe, useCallback as He } from "react";
5
+ import { toast as ae } from "sonner";
6
+ import { useParentDraft as qt, useNivaroClient as ie } from "../../context.js";
7
+ import { showsAiButton as At, AUTOFILL_CHECK_KEY as Tt, readAiFill as Et } from "../../lib/ai-fill.js";
8
+ import { get as K, del as Pt, post as ge } from "../../lib/commands.js";
9
+ import { toastError as jt } from "../../lib/error-toast.js";
10
+ import { titleCase as I, cn as j } from "../../lib/utils.js";
11
+ import { GlossaryLabel as We } from "../ai/GlossaryText.js";
12
+ import { useFieldSource as Bt, FieldSourceInfo as Dt } from "../ConfigReadBack.js";
13
+ import { Label as Mt } from "../ui/label.js";
14
+ import { TooltipProvider as ee, Tooltip as te, TooltipTrigger as ne, TooltipContent as re } from "../ui/tooltip.js";
15
+ import { useAddendumFields as Ot } from "./AddendumFieldContext.js";
16
+ import { AutoIdPreviewField as Kt } from "./AutoIdPreviewField.js";
17
+ import { FOCUSABLE as Ve } from "./entry/entry-keys.js";
18
+ import { useFieldAffordances as Ut, useFieldContextMenu as Ht, usePresenceSoftLock as Wt, LockReasonBadge as Vt, PresenceSoftLockStrip as zt, RemoteChangeGhost as Gt } from "./FieldAffordances.js";
19
+ import { FieldCommentButton as Qt } from "./FieldComments.js";
20
+ import { FieldRenderer as Yt } from "./FieldRenderer.js";
21
+ import { FormHelpVideoButton as Jt } from "./FormHelpVideoButton.js";
22
+ import { getCascadeFilters as Xt, SYSTEM_FIELDS as Zt, parseJson as It, buildCascadeFilter as en, CascadeEffectController as tn } from "./helpers.js";
23
+ import { isDerivedForRecord as nn } from "./live-rollups.js";
24
+ import { useM2MStaging as rn } from "./M2MStagingContext.js";
25
+ import { personalDefaultSlotFor as ln, PersonalDefaultSlot as on } from "./PersonalDefaultControl.js";
26
+ import { PersonalDefaultHint as an } from "./PersonalDefaultPill.js";
27
+ import { isDisplayFormulaRow as ze, usePlacementTextContext as sn, placementFieldText as cn, fieldCounterConfig as dn, fieldIsRecommended as un, RecommendedMarker as mn, RepeatLastButton as pn, DisplayFormulaValue as hn, FieldCounter as xn } from "./placement-behaviour.js";
28
+ import { keepIfEqual as fn, jsonEqual as yn } from "./render-stability.js";
29
+ import { softRuleWarning as bn } from "./soft-rules.js";
30
+ import { usePersonalDefaultsApi as gn } from "./usePersonalDefaults.js";
31
+ import { resolveOptionFilterTokens as vn } from "../../lib/option-filter-tokens.js";
32
+ const wn = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger", "number"]), kn = /* @__PURE__ */ new Set(["string", "text", "richtext", "textarea", "markdown", "json", "csv"]), _n = /* @__PURE__ */ new Set([
32
33
  "input",
33
34
  "textarea",
34
35
  "wysiwyg",
@@ -36,7 +37,7 @@ const bn = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger",
36
37
  "input-rich-text-html",
37
38
  "rich_text",
38
39
  "extension-editorjs"
39
- ]), wn = /* @__PURE__ */ new Set([
40
+ ]), Nn = /* @__PURE__ */ new Set([
40
41
  "relation-m2o",
41
42
  "relation-m2m",
42
43
  "select-multiple-m2m",
@@ -47,220 +48,223 @@ const bn = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger",
47
48
  "file",
48
49
  "files",
49
50
  "image"
50
- ]), kn = /* @__PURE__ */ new Set(["file", "file-image", "files-m2m", "files", "image"]);
51
- function _n(c) {
51
+ ]), Fn = /* @__PURE__ */ new Set(["file", "file-image", "files-m2m", "files", "image"]);
52
+ function Cn(c) {
52
53
  const e = c.interface ?? "";
53
- return wn.has(e) || e.startsWith("relation-") || e.endsWith("-m2o") || e.endsWith("-m2m") ? !1 : !!(gn.has(c.type ?? "") || vn.has(e) || !e && c.type && !bn.has(c.type));
54
+ return Nn.has(e) || e.startsWith("relation-") || e.endsWith("-m2o") || e.endsWith("-m2m") ? !1 : !!(kn.has(c.type ?? "") || _n.has(e) || !e && c.type && !wn.has(c.type));
54
55
  }
55
- function Nn(c, e, m, p) {
56
- const x = ie();
57
- return re({
58
- queryKey: ["field-lineage", c, e, m],
59
- queryFn: () => x.request(
60
- K(`/lineage/${c}/${encodeURIComponent(e)}/${m}`)
61
- ).then((a) => a.data),
56
+ function Ln(c, e, i) {
57
+ return c.filter((p) => (i == null ? void 0 : i(p)) !== e);
58
+ }
59
+ function Rn(c, e, i, p) {
60
+ const f = ie();
61
+ return le({
62
+ queryKey: ["field-lineage", c, e, i],
63
+ queryFn: () => f.request(
64
+ K(`/lineage/${c}/${encodeURIComponent(e)}/${i}`)
65
+ ).then((s) => s.data),
62
66
  enabled: p,
63
67
  staleTime: 3e4
64
68
  });
65
69
  }
66
- function or(c, e = "rows") {
67
- var l, _, b;
70
+ function dr(c, e = "rows") {
71
+ var l, w, g;
68
72
  if (c && (c.kind === "write" || c.kind === "read") && c.formula) {
69
- const u = (y) => typeof y == "number" ? y.toLocaleString(void 0, { maximumFractionDigits: 2 }) : y == null || y === "" ? "∅" : String(y);
70
- return `= ${c.formula.replace(/item\.([A-Za-z_][A-Za-z0-9_]*)/g, (y, o) => {
71
- var f;
72
- return u((f = c.inputs) == null ? void 0 : f[o]);
73
+ const m = (b) => typeof b == "number" ? b.toLocaleString(void 0, { maximumFractionDigits: 2 }) : b == null || b === "" ? "∅" : String(b);
74
+ return `= ${c.formula.replace(/item\.([A-Za-z_][A-Za-z0-9_]*)/g, (b, o) => {
75
+ var x;
76
+ return m((x = c.inputs) == null ? void 0 : x[o]);
73
77
  }).replace(/\s*-\s*/g, " − ").replace(/\s*\*\s*/g, " × ").replace(/\s*\/\s*/g, " ÷ ")}`;
74
78
  }
75
79
  if (!c || c.kind !== "rollup") return null;
76
- const m = (c.sources ?? []).reduce((u, i) => u + i.rows.length, 0), p = (c.sources ?? []).reduce((u, i) => {
77
- var y;
78
- return u + (((y = i.excluded) == null ? void 0 : y.length) ?? 0);
79
- }, 0), x = (b = (_ = (l = (c.sources ?? []).find((u) => {
80
- var i;
81
- return (i = u.excluded) == null ? void 0 : i.length;
82
- })) == null ? void 0 : l.excluded) == null ? void 0 : _[0]) == null ? void 0 : b.reason, a = [`= ${m} ${m === 1 ? e.replace(/s$/, "") : e}`];
83
- return p && a.push(
84
- `${p} excluded${x ? ` (${x.replace(/^does not match: /, "")})` : ""}`
85
- ), a.join(" · ");
80
+ const i = (c.sources ?? []).reduce((m, a) => m + a.rows.length, 0), p = (c.sources ?? []).reduce((m, a) => {
81
+ var b;
82
+ return m + (((b = a.excluded) == null ? void 0 : b.length) ?? 0);
83
+ }, 0), f = (g = (w = (l = (c.sources ?? []).find((m) => {
84
+ var a;
85
+ return (a = m.excluded) == null ? void 0 : a.length;
86
+ })) == null ? void 0 : l.excluded) == null ? void 0 : w[0]) == null ? void 0 : g.reason, s = [`= ${i} ${i === 1 ? e.replace(/s$/, "") : e}`];
87
+ return p && s.push(
88
+ `${p} excluded${f ? ` (${f.replace(/^does not match: /, "")})` : ""}`
89
+ ), s.join(" · ");
86
90
  }
87
- function Fn({
91
+ function Sn({
88
92
  collection: c,
89
93
  itemId: e,
90
- field: m
94
+ field: i
91
95
  }) {
92
- const [p, x] = ve(!1), a = R(null), { data: l, isLoading: _ } = Nn(c, e, m, p);
93
- le(() => {
96
+ const [p, f] = ve(!1), s = $(null), { data: l, isLoading: w } = Rn(c, e, i, p);
97
+ oe(() => {
94
98
  if (!p) return;
95
- const i = (y) => {
99
+ const a = (b) => {
96
100
  var o;
97
- (o = a.current) != null && o.contains(y.target) || x(!1);
101
+ (o = s.current) != null && o.contains(b.target) || f(!1);
98
102
  };
99
- return window.addEventListener("mousedown", i), () => window.removeEventListener("mousedown", i);
103
+ return window.addEventListener("mousedown", a), () => window.removeEventListener("mousedown", a);
100
104
  }, [p]);
101
- const b = (i) => i == null ? "—" : Number(i).toLocaleString(void 0, { maximumFractionDigits: 2 }), u = (l == null ? void 0 : l.stored_value) != null ? Number(l.stored_value) : null;
102
- return /* @__PURE__ */ d("div", { ref: a, className: "relative inline-flex", children: [
105
+ const g = (a) => a == null ? "—" : Number(a).toLocaleString(void 0, { maximumFractionDigits: 2 }), m = (l == null ? void 0 : l.stored_value) != null ? Number(l.stored_value) : null;
106
+ return /* @__PURE__ */ u("div", { ref: s, className: "relative inline-flex", children: [
103
107
  /* @__PURE__ */ n(
104
108
  "button",
105
109
  {
106
110
  type: "button",
107
- onClick: () => x((i) => !i),
111
+ onClick: () => f((a) => !a),
108
112
  title: "Where does this number come from?",
109
113
  className: j(
110
114
  "inline-flex items-center rounded p-0.5 transition-opacity",
111
115
  p ? "text-nvr-cyan opacity-100" : "text-slate-400 hover:text-nvr-cyan dark:text-slate-300 dark:hover:text-nvr-cyan"
112
116
  ),
113
117
  "data-field-lineage": !0,
114
- children: /* @__PURE__ */ n(Ct, { className: "h-3 w-3" })
118
+ children: /* @__PURE__ */ n(Rt, { className: "h-3 w-3" })
115
119
  }
116
120
  ),
117
- p && /* @__PURE__ */ d("div", { className: "absolute left-0 top-full z-40 mt-1 max-h-[340px] w-[360px] overflow-y-auto rounded-lg border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-card", children: [
121
+ p && /* @__PURE__ */ u("div", { className: "absolute left-0 top-full z-40 mt-1 max-h-[340px] w-[360px] overflow-y-auto rounded-lg border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-card", children: [
118
122
  /* @__PURE__ */ n("p", { className: "mb-1 px-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "Where this number comes from" }),
119
- _ && /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "Loading…" }),
120
- (l == null ? void 0 : l.kind) === "write" && /* @__PURE__ */ d("div", { className: "space-y-1 px-1 py-1", children: [
123
+ w && /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "Loading…" }),
124
+ (l == null ? void 0 : l.kind) === "write" && /* @__PURE__ */ u("div", { className: "space-y-1 px-1 py-1", children: [
121
125
  /* @__PURE__ */ n("p", { className: "font-mono text-[11px] text-slate-600 dark:text-slate-300", children: l.formula }),
122
- Object.entries(l.inputs ?? {}).map(([i, y]) => /* @__PURE__ */ d("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
123
- /* @__PURE__ */ n("span", { className: "font-mono", children: i }),
126
+ Object.entries(l.inputs ?? {}).map(([a, b]) => /* @__PURE__ */ u("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
127
+ /* @__PURE__ */ n("span", { className: "font-mono", children: a }),
124
128
  " = ",
125
- b(y)
126
- ] }, i)),
127
- /* @__PURE__ */ d("p", { className: "pt-1 text-[11.5px] font-medium text-slate-700 dark:text-slate-200", children: [
129
+ g(b)
130
+ ] }, a)),
131
+ /* @__PURE__ */ u("p", { className: "pt-1 text-[11.5px] font-medium text-slate-700 dark:text-slate-200", children: [
128
132
  "= ",
129
- b(l.stored_value)
133
+ g(l.stored_value)
130
134
  ] })
131
135
  ] }),
132
- (l == null ? void 0 : l.kind) === "rollup" && (l.sources ?? []).map((i, y) => {
136
+ (l == null ? void 0 : l.kind) === "rollup" && (l.sources ?? []).map((a, b) => {
133
137
  var o;
134
- return /* @__PURE__ */ d("div", { className: "mb-1.5", children: [
135
- /* @__PURE__ */ d("p", { className: "px-1 text-[10.5px] text-slate-400", children: [
136
- (i.aggregate ?? "sum").toUpperCase(),
137
- i.value_field ? ` of ${i.value_field}` : "",
138
+ return /* @__PURE__ */ u("div", { className: "mb-1.5", children: [
139
+ /* @__PURE__ */ u("p", { className: "px-1 text-[10.5px] text-slate-400", children: [
140
+ (a.aggregate ?? "sum").toUpperCase(),
141
+ a.value_field ? ` of ${a.value_field}` : "",
138
142
  " across ",
139
- i.collection,
140
- i.filtered ? " (filtered)" : ""
143
+ a.collection,
144
+ a.filtered ? " (filtered)" : ""
141
145
  ] }),
142
- i.error && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-[11.5px] text-amber-600 dark:text-amber-400", children: i.error }),
143
- i.note && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-[11.5px] text-slate-400", children: i.note }),
144
- i.rows.length > 0 && /* @__PURE__ */ n("div", { className: "mt-0.5 space-y-px", children: i.rows.map((f) => /* @__PURE__ */ d(
146
+ a.error && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-[11.5px] text-amber-600 dark:text-amber-400", children: a.error }),
147
+ a.note && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-[11.5px] text-slate-400", children: a.note }),
148
+ a.rows.length > 0 && /* @__PURE__ */ n("div", { className: "mt-0.5 space-y-px", children: a.rows.map((x) => /* @__PURE__ */ u(
145
149
  "div",
146
150
  {
147
151
  className: "flex items-baseline gap-2 rounded px-1 py-0.5 text-[11.5px] hover:bg-slate-50 dark:hover:bg-muted",
148
152
  children: [
149
- /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: f.label }),
150
- /* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums text-slate-800 dark:text-slate-100", children: b(f.value) }),
153
+ /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: x.label }),
154
+ /* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums text-slate-800 dark:text-slate-100", children: g(x.value) }),
151
155
  /* @__PURE__ */ n(
152
156
  "span",
153
157
  {
154
158
  className: "w-[88px] shrink-0 truncate text-right text-[10px] text-slate-400",
155
- "data-tip": f.updated_at ? `${f.updated_by ?? "unknown"} · ${new Date(f.updated_at).toLocaleString()}` : void 0,
156
- children: f.updated_by ?? ""
159
+ "data-tip": x.updated_at ? `${x.updated_by ?? "unknown"} · ${new Date(x.updated_at).toLocaleString()}` : void 0,
160
+ children: x.updated_by ?? ""
157
161
  }
158
162
  )
159
163
  ]
160
164
  },
161
- f.id
165
+ x.id
162
166
  )) }),
163
- i.truncated && /* @__PURE__ */ n("p", { className: "px-1 pt-0.5 text-[10.5px] text-amber-600 dark:text-amber-400", children: "Showing the first 200 rows — the subtotal covers only these." }),
164
- i.subtotal != null && /* @__PURE__ */ d("p", { className: "border-t border-slate-100 px-1 pt-1 text-right text-[11.5px] font-medium text-slate-700 dark:border-border dark:text-slate-200", children: [
167
+ a.truncated && /* @__PURE__ */ n("p", { className: "px-1 pt-0.5 text-[10.5px] text-amber-600 dark:text-amber-400", children: "Showing the first 200 rows — the subtotal covers only these." }),
168
+ a.subtotal != null && /* @__PURE__ */ u("p", { className: "border-t border-slate-100 px-1 pt-1 text-right text-[11.5px] font-medium text-slate-700 dark:border-border dark:text-slate-200", children: [
165
169
  "subtotal ",
166
- b(i.subtotal)
170
+ g(a.subtotal)
167
171
  ] }),
168
- (((o = i.excluded) == null ? void 0 : o.length) ?? 0) > 0 && /* @__PURE__ */ d("div", { className: "mt-1 rounded bg-slate-50 px-1 py-1 dark:bg-muted/40", children: [
169
- /* @__PURE__ */ d("p", { className: "text-[10.5px] text-slate-500 dark:text-muted-foreground", children: [
170
- i.excluded.length,
172
+ (((o = a.excluded) == null ? void 0 : o.length) ?? 0) > 0 && /* @__PURE__ */ u("div", { className: "mt-1 rounded bg-slate-50 px-1 py-1 dark:bg-muted/40", children: [
173
+ /* @__PURE__ */ u("p", { className: "text-[10.5px] text-slate-500 dark:text-muted-foreground", children: [
174
+ a.excluded.length,
171
175
  " excluded —",
172
176
  " ",
173
- i.excluded[0].reason.replace(/^does not match: /, "")
177
+ a.excluded[0].reason.replace(/^does not match: /, "")
174
178
  ] }),
175
- i.excluded.slice(0, 8).map((f) => /* @__PURE__ */ d(
179
+ a.excluded.slice(0, 8).map((x) => /* @__PURE__ */ u(
176
180
  "div",
177
181
  {
178
182
  className: "flex items-baseline gap-2 px-0.5 text-[11px] text-slate-400",
179
183
  children: [
180
- /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate line-through decoration-slate-300", children: f.label }),
181
- /* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums", children: b(f.value) })
184
+ /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate line-through decoration-slate-300", children: x.label }),
185
+ /* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums", children: g(x.value) })
182
186
  ]
183
187
  },
184
- f.id
188
+ x.id
185
189
  )),
186
- i.excluded.length > 8 && /* @__PURE__ */ d("p", { className: "px-0.5 text-[10.5px] text-slate-400", children: [
190
+ a.excluded.length > 8 && /* @__PURE__ */ u("p", { className: "px-0.5 text-[10.5px] text-slate-400", children: [
187
191
  "+",
188
- i.excluded.length - 8,
192
+ a.excluded.length - 8,
189
193
  " more"
190
194
  ] })
191
195
  ] })
192
- ] }, y);
196
+ ] }, b);
193
197
  }),
194
- (l == null ? void 0 : l.kind) === "rollup" && u != null && /* @__PURE__ */ d("p", { className: "px-1 pt-0.5 text-right text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
198
+ (l == null ? void 0 : l.kind) === "rollup" && m != null && /* @__PURE__ */ u("p", { className: "px-1 pt-0.5 text-right text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
195
199
  "stored ",
196
- b(u),
200
+ g(m),
197
201
  (() => {
198
- const i = (l.sources ?? []).reduce((o, f) => o + (f.subtotal ?? 0), 0);
199
- return (l.sources ?? []).some((o) => o.truncated) ? null : Math.abs(i - u) < 0.01 ? /* @__PURE__ */ n("span", { className: "ml-1 text-emerald-600 dark:text-emerald-400", children: "✓ matches" }) : /* @__PURE__ */ n("span", { className: "ml-1 text-amber-600 dark:text-amber-400", children: "✕ differs from contributions" });
202
+ const a = (l.sources ?? []).reduce((o, x) => o + (x.subtotal ?? 0), 0);
203
+ return (l.sources ?? []).some((o) => o.truncated) ? null : Math.abs(a - m) < 0.01 ? /* @__PURE__ */ n("span", { className: "ml-1 text-emerald-600 dark:text-emerald-400", children: "✓ matches" }) : /* @__PURE__ */ n("span", { className: "ml-1 text-amber-600 dark:text-amber-400", children: "✕ differs from contributions" });
200
204
  })()
201
205
  ] })
202
206
  ] })
203
207
  ] });
204
208
  }
205
- function Cn({
209
+ function $n({
206
210
  collection: c,
207
211
  itemId: e,
208
- field: m,
212
+ field: i,
209
213
  formatValue: p,
210
- onRestore: x
214
+ onRestore: f
211
215
  }) {
212
- const a = ie(), [l, _] = ve(!1), b = R(null), { data: u, isLoading: i } = re({
213
- queryKey: ["field-value-history", c, e, m],
214
- queryFn: () => a.request(K(`/field-history/${c}/${encodeURIComponent(e)}/${m}`)).then((o) => o.data ?? []),
216
+ const s = ie(), [l, w] = ve(!1), g = $(null), { data: m, isLoading: a } = le({
217
+ queryKey: ["field-value-history", c, e, i],
218
+ queryFn: () => s.request(K(`/field-history/${c}/${encodeURIComponent(e)}/${i}`)).then((o) => o.data ?? []),
215
219
  enabled: l,
216
220
  staleTime: 6e4
217
221
  });
218
- le(() => {
222
+ oe(() => {
219
223
  if (!l) return;
220
- const o = (f) => {
224
+ const o = (x) => {
221
225
  var U;
222
- (U = b.current) != null && U.contains(f.target) || _(!1);
226
+ (U = g.current) != null && U.contains(x.target) || w(!1);
223
227
  };
224
228
  return window.addEventListener("mousedown", o), () => window.removeEventListener("mousedown", o);
225
229
  }, [l]);
226
- const y = (o, f) => f || (o == null || o === "" ? "—" : p ? p(o) : typeof o == "boolean" || o === "true" || o === "false" ? o === !0 || o === "true" ? "Yes" : "No" : typeof o == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(o) ? new Date(o).toLocaleString() : typeof o == "object" ? JSON.stringify(o).slice(0, 60) : String(o).slice(0, 80));
227
- return /* @__PURE__ */ d("div", { ref: b, className: "relative inline-flex", children: [
230
+ const b = (o, x) => x || (o == null || o === "" ? "—" : p ? p(o) : typeof o == "boolean" || o === "true" || o === "false" ? o === !0 || o === "true" ? "Yes" : "No" : typeof o == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(o) ? new Date(o).toLocaleString() : typeof o == "object" ? JSON.stringify(o).slice(0, 60) : String(o).slice(0, 80));
231
+ return /* @__PURE__ */ u("div", { ref: g, className: "relative inline-flex", children: [
228
232
  /* @__PURE__ */ n(
229
233
  "button",
230
234
  {
231
235
  type: "button",
232
- onClick: () => _((o) => !o),
236
+ onClick: () => w((o) => !o),
233
237
  title: "Value history",
234
238
  className: j(
235
239
  "inline-flex items-center rounded p-0.5 transition-opacity",
236
240
  l ? "text-nvr-cyan opacity-100" : "text-slate-400 hover:text-nvr-cyan dark:text-slate-300 dark:hover:text-nvr-cyan"
237
241
  ),
238
242
  "data-field-history": !0,
239
- children: /* @__PURE__ */ n(_t, { className: "h-3 w-3" })
243
+ children: /* @__PURE__ */ n(Ft, { className: "h-3 w-3" })
240
244
  }
241
245
  ),
242
- l && /* @__PURE__ */ d("div", { className: "absolute left-0 top-full z-40 mt-1 max-h-64 w-[300px] overflow-y-auto rounded-lg border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-card", children: [
246
+ l && /* @__PURE__ */ u("div", { className: "absolute left-0 top-full z-40 mt-1 max-h-64 w-[300px] overflow-y-auto rounded-lg border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-card", children: [
243
247
  /* @__PURE__ */ n("p", { className: "mb-1 px-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "Value history" }),
244
- i ? /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "Loading…" }) : (u ?? []).length === 0 ? /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "No recorded changes for this field." }) : /* @__PURE__ */ n("div", { className: "space-y-1", children: (u ?? []).map((o, f) => /* @__PURE__ */ d(
248
+ a ? /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "Loading…" }) : (m ?? []).length === 0 ? /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "No recorded changes for this field." }) : /* @__PURE__ */ n("div", { className: "space-y-1", children: (m ?? []).map((o, x) => /* @__PURE__ */ u(
245
249
  "div",
246
250
  {
247
251
  className: "rounded px-1 py-1 text-[11.5px] leading-snug hover:bg-slate-50 dark:hover:bg-muted",
248
252
  children: [
249
- /* @__PURE__ */ d("span", { className: "flex items-baseline justify-between gap-2", children: [
250
- /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: y(o.value, o.display) }),
251
- x && f > 0 && /* @__PURE__ */ n(
253
+ /* @__PURE__ */ u("span", { className: "flex items-baseline justify-between gap-2", children: [
254
+ /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: b(o.value, o.display) }),
255
+ f && x > 0 && /* @__PURE__ */ n(
252
256
  "button",
253
257
  {
254
258
  type: "button",
255
259
  onClick: () => {
256
- x(o.value ?? null), _(!1);
260
+ f(o.value ?? null), w(!1);
257
261
  },
258
262
  className: "shrink-0 rounded border border-slate-200 px-1.5 py-px text-[10px] text-slate-500 hover:border-nvr-cyan/60 hover:text-nvr-navy dark:border-border dark:hover:text-nvr-cyan",
259
263
  children: "Restore"
260
264
  }
261
265
  )
262
266
  ] }),
263
- /* @__PURE__ */ d("span", { className: "block text-[10.5px] text-slate-400", children: [
267
+ /* @__PURE__ */ u("span", { className: "block text-[10.5px] text-slate-400", children: [
264
268
  o.action === "create" ? "initial value" : "changed",
265
269
  o.timestamp ? ` · ${new Date(o.timestamp).toLocaleString()}` : "",
266
270
  o.user_name ? ` · ${o.user_name}` : "",
@@ -272,91 +276,91 @@ function Cn({
272
276
  }
273
277
  )
274
278
  ] }),
275
- o.note && /* @__PURE__ */ d("span", { className: "block text-[10.5px] italic text-slate-500 dark:text-slate-400", children: [
279
+ o.note && /* @__PURE__ */ u("span", { className: "block text-[10.5px] italic text-slate-500 dark:text-slate-400", children: [
276
280
  "“",
277
281
  o.note,
278
282
  "”"
279
283
  ] })
280
284
  ]
281
285
  },
282
- f
286
+ x
283
287
  )) })
284
288
  ] })
285
289
  ] });
286
290
  }
287
- function Ln({
291
+ function qn({
288
292
  collection: c,
289
293
  itemId: e,
290
- field: m
294
+ field: i
291
295
  }) {
292
- const p = ie(), x = Ve(), { data: a } = re({
296
+ const p = ie(), f = Ge(), { data: s } = le({
293
297
  queryKey: ["field-watch-config"],
294
- queryFn: () => p.request(K("/field-watches/config")).then((i) => i.data).catch(() => ({ enabled: !1 })),
298
+ queryFn: () => p.request(K("/field-watches/config")).then((a) => a.data).catch(() => ({ enabled: !1 })),
295
299
  staleTime: 5 * 6e4
296
- }), l = ["field-watch-self", c, e], { data: _ = [] } = re({
300
+ }), l = ["field-watch-self", c, e], { data: w = [] } = le({
297
301
  queryKey: l,
298
- queryFn: () => p.request(K("/field-watches/self", { collection: c, item_id: e })).then((i) => i.data ?? []).catch(() => []),
299
- enabled: !!(a != null && a.enabled),
302
+ queryFn: () => p.request(K("/field-watches/self", { collection: c, item_id: e })).then((a) => a.data ?? []).catch(() => []),
303
+ enabled: !!(s != null && s.enabled),
300
304
  staleTime: 6e4
301
- }), b = _.includes(m), u = yt({
302
- mutationFn: () => b ? p.request(
303
- Tt(
304
- `/field-watches/self?collection=${encodeURIComponent(c)}&field=${encodeURIComponent(m)}&item_id=${encodeURIComponent(e)}`
305
+ }), g = w.includes(i), m = gt({
306
+ mutationFn: () => g ? p.request(
307
+ Pt(
308
+ `/field-watches/self?collection=${encodeURIComponent(c)}&field=${encodeURIComponent(i)}&item_id=${encodeURIComponent(e)}`
305
309
  )
306
- ) : p.request(ge("/field-watches/self", { collection: c, field: m, item_id: e })),
310
+ ) : p.request(ge("/field-watches/self", { collection: c, field: i, item_id: e })),
307
311
  onSuccess: () => {
308
- x.invalidateQueries({ queryKey: l }), oe.success(
309
- b ? "No longer watching this field" : "Watching — you will be notified when it changes"
312
+ f.invalidateQueries({ queryKey: l }), ae.success(
313
+ g ? "No longer watching this field" : "Watching — you will be notified when it changes"
310
314
  );
311
315
  },
312
- onError: () => oe.error("Could not update the watch")
316
+ onError: () => ae.error("Could not update the watch")
313
317
  });
314
- return a != null && a.enabled ? /* @__PURE__ */ n(
318
+ return s != null && s.enabled ? /* @__PURE__ */ n(
315
319
  "button",
316
320
  {
317
321
  type: "button",
318
- onClick: () => u.mutate(),
319
- title: b ? "Stop watching this field on this record" : "Watch this field on this record",
320
- "data-field-watch": m,
321
- className: `rounded p-0.5 transition-colors ${b ? "text-nvr-navy dark:text-nvr-cyan" : "text-slate-300 hover:text-slate-500"}`,
322
- children: b ? /* @__PURE__ */ n(Nt, { className: "h-3 w-3" }) : /* @__PURE__ */ n(Ft, { className: "h-3 w-3" })
322
+ onClick: () => m.mutate(),
323
+ title: g ? "Stop watching this field on this record" : "Watch this field on this record",
324
+ "data-field-watch": i,
325
+ className: `rounded p-0.5 transition-colors ${g ? "text-nvr-navy dark:text-nvr-cyan" : "text-slate-300 hover:text-slate-500"}`,
326
+ children: g ? /* @__PURE__ */ n(Ct, { className: "h-3 w-3" }) : /* @__PURE__ */ n(Lt, { className: "h-3 w-3" })
323
327
  }
324
328
  ) : null;
325
329
  }
326
- function Sn(c) {
330
+ function An(c) {
327
331
  return c ? c.querySelector(
328
332
  'input:not([type=hidden]), textarea, [role="combobox"], [contenteditable="true"]'
329
333
  ) ?? c.querySelector("button") : null;
330
334
  }
331
- const ir = Lt(function({
335
+ const ur = St(function({
332
336
  field: e,
333
- draft: m,
337
+ draft: i,
334
338
  onChange: p,
335
- relations: x,
336
- collection: a,
339
+ relations: f,
340
+ collection: s,
337
341
  itemId: l,
338
- error: _,
339
- visible: b,
340
- locked: u,
341
- layoutAiEnabled: i,
342
- renderField: y,
342
+ error: w,
343
+ visible: g,
344
+ locked: m,
345
+ layoutAiEnabled: a,
346
+ renderField: b,
343
347
  onCountChange: o,
344
- swapButton: f,
348
+ swapButton: x,
345
349
  swapContent: U,
346
- forceVisible: ze,
347
- autoFillTick: ae
350
+ forceVisible: Qe,
351
+ autoFillTick: se
348
352
  }) {
349
- var De, Be, Oe;
350
- const H = kn.has(e.interface ?? ""), F = Rt(), g = tn(), we = Ve(), se = ie(), [ke, W] = ve(!1), s = Mt(), _e = Pt(e.field), V = R(null), z = St(), ce = R(null), Ne = R(!1);
351
- le(() => {
352
- const t = Ne.current ? Sn(ce.current) : null;
353
+ var De, Me, Oe, Ke;
354
+ const H = Fn.has(e.interface ?? ""), N = qt(), y = rn(), we = Ge(), ce = ie(), [ke, W] = ve(!1), d = Ut(), _e = Bt(e.field), V = $(null), z = $t(), de = $(null), Ne = $(!1);
355
+ oe(() => {
356
+ const t = Ne.current ? An(de.current) : null;
353
357
  if (!t || t.hasAttribute("aria-label")) return;
354
358
  t.id || (t.id = `${z}-control`);
355
359
  const r = t.tagName === "BUTTON" ? `${z} ${t.id}` : z;
356
360
  t.getAttribute("aria-labelledby") !== r && t.setAttribute("aria-labelledby", r);
357
361
  });
358
- const Fe = u && !H, Ce = R(null);
359
- le(() => {
362
+ const Fe = m && !H, Ce = $(null);
363
+ oe(() => {
360
364
  const t = Ce.current;
361
365
  if (!t) return;
362
366
  if (!Fe) {
@@ -365,42 +369,42 @@ const ir = Lt(function({
365
369
  }
366
370
  const r = typeof document < "u" ? document.activeElement : null;
367
371
  r instanceof HTMLElement && t.contains(r) && r.blur(), t.setAttribute("inert", "");
368
- }, [Fe, ae]);
369
- const G = e.field, Le = Ke(
372
+ }, [Fe, se]);
373
+ const G = e.field, Le = He(
370
374
  (t) => {
371
- u || p(G, t);
375
+ m || p(G, t);
372
376
  },
373
- [u, p, G]
374
- ), Ge = Ke(
377
+ [m, p, G]
378
+ ), Ye = He(
375
379
  (t) => o == null ? void 0 : o(G, t),
376
380
  [o, G]
377
- ), Qe = R(void 0), Se = R(void 0), Re = R(void 0), $e = !u && !e.readonly && !e.computed_formula && !(e.hidden && !e.layout_assigned) && !We(e), {
378
- onContextMenu: Ye,
379
- onKeyDown: Je,
380
- menu: Xe,
381
- confirmSaveFrom: Ze,
382
- openedBy: de
383
- } = Kt({
381
+ ), Je = $(void 0), Re = $(void 0), Se = $(void 0), $e = !m && !e.readonly && !e.computed_formula && !(e.hidden && !e.layout_assigned) && !ze(e), {
382
+ onContextMenu: Xe,
383
+ onKeyDown: Ze,
384
+ menu: Ie,
385
+ confirmSaveFrom: et,
386
+ openedBy: ue
387
+ } = Ht({
384
388
  wrapperRef: V,
385
389
  field: e,
386
- value: m[e.field],
387
- relations: x,
388
- collection: a,
390
+ value: i[e.field],
391
+ relations: f,
392
+ collection: s,
389
393
  itemId: l,
390
- openRelated: s == null ? void 0 : s.openRelated,
394
+ openRelated: d == null ? void 0 : d.openRelated,
391
395
  editable: $e
392
- }), T = Ut(V), Ie = on(), qe = s == null ? void 0 : s.remoteChanges[e.field], D = s == null ? void 0 : s.lockReasons[e.field], q = s == null ? void 0 : s.applyToLines[e.field], C = xn(), et = (C == null ? void 0 : C.applied(e.field)) ?? !1, Ae = (C == null ? void 0 : C.hintFor(e.field)) ?? null, ue = nn(C, e.field, $e), me = () => {
396
+ }), E = Wt(V), tt = sn(), qe = d == null ? void 0 : d.remoteChanges[e.field], B = d == null ? void 0 : d.lockReasons[e.field], T = d == null ? void 0 : d.applyToLines[e.field], C = gn(), nt = (C == null ? void 0 : C.applied(e.field)) ?? !1, Ae = (C == null ? void 0 : C.hintFor(e.field)) ?? null, me = ln(C, e.field, $e), pe = () => {
393
397
  var t, r;
394
- return ((t = ce.current) == null ? void 0 : t.querySelector(He)) ?? ((r = V.current) == null ? void 0 : r.querySelector(He));
395
- }, Q = $t(e._overrides, i, _n(e)), pe = !!(s != null && s.fromAutofill) && !!e._overrides && e._overrides[qt] === !0;
396
- async function tt() {
398
+ return ((t = de.current) == null ? void 0 : t.querySelector(Ve)) ?? ((r = V.current) == null ? void 0 : r.querySelector(Ve));
399
+ }, Q = At(e._overrides, a, Cn(e)), he = !!(d != null && d.fromAutofill) && !!e._overrides && e._overrides[Tt] === !0;
400
+ async function rt() {
397
401
  var t;
398
- if (Q.perField) return nt();
402
+ if (Q.perField) return lt();
399
403
  W(!0);
400
404
  try {
401
- const r = await se.request(
405
+ const r = await ce.request(
402
406
  ge("/ai/generate", {
403
- collection: a,
407
+ collection: s,
404
408
  item_id: l !== "new" ? l : void 0,
405
409
  field: e.field
406
410
  })
@@ -411,42 +415,42 @@ const ir = Lt(function({
411
415
  W(!1);
412
416
  }
413
417
  }
414
- async function nt() {
415
- var r, h, w, P;
418
+ async function lt() {
419
+ var r, h, k, R;
416
420
  const t = {};
417
- for (const k of ((r = At(e._overrides)) == null ? void 0 : r.tokens) ?? []) k in m && (t[k] = m[k]);
421
+ for (const _ of ((r = Et(e._overrides)) == null ? void 0 : r.tokens) ?? []) _ in i && (t[_] = i[_]);
418
422
  W(!0);
419
423
  try {
420
- const k = await se.request(
424
+ const _ = await ce.request(
421
425
  ge("/ai/field-fill", {
422
- collection: a,
423
- layout_id: (s == null ? void 0 : s.layoutId) ?? null,
426
+ collection: s,
427
+ layout_id: (d == null ? void 0 : d.layoutId) ?? null,
424
428
  field: e.field,
425
429
  item_id: l && l !== "new" ? l : null,
426
430
  values: t
427
431
  })
428
- ), N = (h = k.data) == null ? void 0 : h.value;
429
- typeof N == "string" && N !== "" ? p(e.field, N) : oe.info("The AI had nothing to write here"), (P = (w = k.data) == null ? void 0 : w.missing) != null && P.length && oe.info(`Filled without ${k.data.missing.join(", ")} (empty or not visible to you)`);
430
- } catch (k) {
431
- Et(k, "AI fill failed", { action: "Fill with AI" });
432
+ ), F = (h = _.data) == null ? void 0 : h.value;
433
+ typeof F == "string" && F !== "" ? p(e.field, F) : ae.info("The AI had nothing to write here"), (R = (k = _.data) == null ? void 0 : k.missing) != null && R.length && ae.info(`Filled without ${_.data.missing.join(", ")} (empty or not visible to you)`);
434
+ } catch (_) {
435
+ jt(_, "AI fill failed", { action: "Fill with AI" });
432
436
  } finally {
433
437
  W(!1);
434
438
  }
435
439
  }
436
- const E = Yt(e.dependency_config), Te = E.flatMap((t) => {
437
- const r = x.find(
438
- (w) => w.one_collection === a && w.one_field === t.parent_field
440
+ const P = Xt(e.dependency_config), Te = P.flatMap((t) => {
441
+ const r = f.find(
442
+ (k) => k.one_collection === s && k.one_field === t.parent_field
439
443
  );
440
444
  if (!r) return [];
441
445
  if (r.junction_field) return [{ rule: t, rel: r }];
442
- const h = x.find(
443
- (w) => w.many_collection === r.many_collection && w.id !== r.id
446
+ const h = f.find(
447
+ (k) => k.many_collection === r.many_collection && k.id !== r.id
444
448
  );
445
449
  return h != null && h.many_field ? [{ rule: t, rel: { ...r, junction_field: h.many_field } }] : [];
446
- }), rt = xt({
450
+ }), ot = bt({
447
451
  queries: Te.map(({ rel: t }) => ({
448
452
  queryKey: ["m2m-items", t.many_collection, t.many_field, l],
449
- queryFn: () => se.request(
453
+ queryFn: () => ce.request(
450
454
  K(`/items/${t.many_collection}`, {
451
455
  filter: JSON.stringify({ [t.many_field]: { _eq: l } }),
452
456
  limit: 200,
@@ -456,89 +460,96 @@ const ir = Lt(function({
456
460
  enabled: !!l && l !== "new",
457
461
  staleTime: 3e4
458
462
  }))
459
- }), lt = Object.fromEntries(
463
+ }), at = Object.fromEntries(
460
464
  Te.map(({ rule: t, rel: r }, h) => {
461
- var k;
462
- const w = r.one_field ?? `${r.many_collection}.${r.junction_field}`, P = (g == null ? void 0 : g.getStagedUnlinks(w)) ?? /* @__PURE__ */ new Set();
465
+ var _;
466
+ const k = r.one_field ?? `${r.many_collection}.${r.junction_field}`, R = (y == null ? void 0 : y.getStagedUnlinks(k)) ?? /* @__PURE__ */ new Set();
463
467
  return [
464
468
  t.parent_field,
465
- (((k = rt[h]) == null ? void 0 : k.data) ?? []).filter((N) => !P.has(N.id)).map((N) => N[r.junction_field])
469
+ (((_ = ot[h]) == null ? void 0 : _.data) ?? []).filter((F) => !R.has(F.id)).map((F) => F[r.junction_field])
466
470
  ];
467
471
  })
468
- ), Y = Bt()[e.field] ?? [];
469
- if (!ze && (!b || !e.layout_assigned && (e.hidden || Jt.has(e.field))))
472
+ ), Y = Ot()[e.field] ?? [];
473
+ if (!Qe && (!g || !e.layout_assigned && (e.hidden || Zt.has(e.field))))
470
474
  return null;
471
- const he = m[e.field] ?? null, J = an(e, Ie), L = J.label ?? Z(e.field);
475
+ const xe = i[e.field] ?? null, J = cn(e, tt), L = J.label ?? I(e.field);
472
476
  Ne.current = L !== "";
473
- const A = We(e), Ee = A ? null : sn(e), ot = !A && !u && !e.readonly && ((De = e._overrides) == null ? void 0 : De.repeat_last) === !0, it = en(e, m), at = (Oe = (Be = Xt(e.options)) == null ? void 0 : Be.auto_id) == null ? void 0 : Oe.pattern, v = (() => {
474
- const t = x.find(
475
- (h) => h.one_collection === a && h.one_field === e.field
477
+ const q = ze(e), Ee = q ? null : dn(e), Pe = q || !(l === "new" || !l || (De = N == null ? void 0 : N.dirtyFields) != null && De.has(e.field)) ? null : bn(e, i), it = !q && !m && !e.readonly && ((Me = e._overrides) == null ? void 0 : Me.repeat_last) === !0, st = nn(e, i), ct = (Ke = (Oe = It(e.options)) == null ? void 0 : Oe.auto_id) == null ? void 0 : Ke.pattern, v = (() => {
478
+ const t = f.find(
479
+ (h) => h.one_collection === s && h.one_field === e.field
476
480
  );
477
481
  if (!t) return null;
478
482
  if (t.junction_field) return t;
479
- const r = x.find(
483
+ const r = f.find(
480
484
  (h) => h.many_collection === t.many_collection && h.id !== t.id
481
485
  );
482
486
  return r ? { ...t, junction_field: r.many_field } : null;
483
- })(), fe = v ? null : x.find((t) => t.many_collection === a && t.many_field === e.field) ?? null, xe = v ? x.find(
487
+ })(), fe = v ? null : f.find((t) => t.many_collection === s && t.many_field === e.field) ?? null, ye = v ? f.find(
484
488
  (t) => t.many_collection === v.many_collection && t.many_field === v.junction_field && t.id !== v.id
485
- ) ?? null : null, B = v ? v.one_field ?? `${v.many_collection}.${v.junction_field}` : null, Pe = B ? (g == null ? void 0 : g.getStagedLinks(B)) ?? [] : [], st = v ? (we.getQueryData([
489
+ ) ?? null : null, D = v ? v.one_field ?? `${v.many_collection}.${v.junction_field}` : null, je = D ? (y == null ? void 0 : y.getStagedLinks(D)) ?? [] : [], dt = v ? (we.getQueryData([
486
490
  "m2m-items",
487
491
  v.many_collection,
488
492
  v.many_field,
489
493
  l
490
- ]) ?? []).map((t) => t[v.junction_field]) : [], ct = v ? Pe[0] ?? st[0] ?? null : he, dt = (xe == null ? void 0 : xe.one_collection) ?? (fe == null ? void 0 : fe.one_collection) ?? void 0, X = (t) => {
494
+ ]) ?? []).map((t) => t[v.junction_field]) : [], ut = v ? je[0] ?? dt[0] ?? null : xe, mt = (ye == null ? void 0 : ye.one_collection) ?? (fe == null ? void 0 : fe.one_collection) ?? void 0, X = (t) => {
491
495
  var r;
492
- return ((F == null ? void 0 : F.collection) === a ? (r = F == null ? void 0 : F.fieldLabels) == null ? void 0 : r[t] : void 0) ?? Z(String(t));
493
- }, $ = Zt({
494
- rules: E,
496
+ return ((N == null ? void 0 : N.collection) === s ? (r = N == null ? void 0 : N.fieldLabels) == null ? void 0 : r[t] : void 0) ?? I(String(t));
497
+ }, A = en({
498
+ rules: P,
495
499
  // A parent whose value THIS field's own pick derived must not narrow this
496
500
  // field's options — otherwise picking a region locks the region picker
497
501
  // into the zone the pick itself filled, and cross-zone changes read as
498
502
  // "No results".
499
503
  skipParent: (t) => {
500
504
  var r;
501
- return ((r = g == null ? void 0 : g.getDerivedOrigin) == null ? void 0 : r.call(g, t)) === e.field;
505
+ return ((r = y == null ? void 0 : y.getDerivedOrigin) == null ? void 0 : r.call(y, t)) === e.field;
502
506
  },
503
507
  parentValue: (t) => {
504
- if (m[t] != null) return m[t];
505
- const r = x.find((S) => S.one_collection === a && S.one_field === t);
508
+ if (i[t] != null) return i[t];
509
+ const r = f.find((S) => S.one_collection === s && S.one_field === t);
506
510
  if (!r) return null;
507
511
  let h = r;
508
512
  if (!h.junction_field) {
509
- const S = x.find(
510
- (Me) => Me.many_collection === r.many_collection && Me.id !== r.id
513
+ const S = f.find(
514
+ (Ue) => Ue.many_collection === r.many_collection && Ue.id !== r.id
511
515
  );
512
516
  if (S != null && S.many_field) h = { ...r, junction_field: S.many_field };
513
517
  else return null;
514
518
  }
515
- const w = h.one_field ?? `${h.many_collection}.${h.junction_field}`, P = (g == null ? void 0 : g.getStagedLinks(w)) ?? [], k = lt[t] ?? [], N = [...new Set([...P, ...k].map((S) => String(S)))];
516
- return N.length === 0 ? null : N.length === 1 ? N[0] : N;
519
+ const k = h.one_field ?? `${h.many_collection}.${h.junction_field}`, R = (y == null ? void 0 : y.getStagedLinks(k)) ?? [], _ = at[t] ?? [], F = [...new Set([...R, ..._].map((S) => String(S)))];
520
+ return F.length === 0 ? null : F.length === 1 ? F[0] : F;
517
521
  },
518
522
  parentOptionFilter: (t) => {
519
523
  var h;
520
- const r = (F == null ? void 0 : F.collection) === a ? (h = F.fieldOptionFilters) == null ? void 0 : h[t] : void 0;
521
- return r ? yn(r, m, l) : void 0;
524
+ const r = (N == null ? void 0 : N.collection) === s ? (h = N.fieldOptionFilters) == null ? void 0 : h[t] : void 0;
525
+ return r ? vn(r, i, l) : void 0;
522
526
  }
523
- }), O = $.filter ? hn(Qe, $.filter, fn) : $.filter, M = $.satisfiedParents.map(X), ye = $.satisfiedParents, ut = $.unsatisfiedParents.length ? X($.unsatisfiedParents[0]) : null, be = $.missingRequiredParents, je = be.length ? X(be[0]) : null;
524
- function mt() {
525
- const t = Re.current;
527
+ }), M = A.filter ? fn(Je, A.filter, yn) : A.filter, O = A.satisfiedParents.map(X), Z = A.satisfiedParents, pt = A.unsatisfiedParents.length ? X(A.unsatisfiedParents[0]) : null, be = A.missingRequiredParents, Be = be.length ? X(be[0]) : null;
528
+ function ht() {
529
+ const t = Se.current;
526
530
  if (t && t.src === e) return t.value;
527
531
  const r = { ...e, readonly: !0 };
528
- return Re.current = { src: e, value: r }, r;
532
+ return Se.current = { src: e, value: r }, r;
529
533
  }
530
- function pt() {
531
- const t = JSON.stringify([M, ye]), r = Se.current;
532
- if (r && r.sig === t && r.onChange === p) return r.value;
533
- const h = {
534
- labels: M,
535
- keys: ye,
536
- onClear: (w) => p(w, null)
534
+ function xt() {
535
+ const t = Ln(
536
+ Z,
537
+ e.field,
538
+ y == null ? void 0 : y.getDerivedOrigin
539
+ ), r = JSON.stringify([O, Z, t]), h = Re.current;
540
+ if (h && h.sig === r && h.onChange === p) return h.value;
541
+ const k = {
542
+ labels: O,
543
+ keys: Z,
544
+ clearable: t,
545
+ onClear: t.length > 0 ? (R) => {
546
+ t.includes(R) && p(R, null);
547
+ } : void 0
537
548
  };
538
- return Se.current = { sig: t, onChange: p, value: h }, h;
549
+ return Re.current = { sig: r, onChange: p, value: k }, k;
539
550
  }
540
- function ht() {
541
- for (const t of ye) {
551
+ function ft() {
552
+ for (const t of Z) {
542
553
  const r = document.querySelector(`[data-field="${t}"]`);
543
554
  r && (r.scrollIntoView({ behavior: "smooth", block: "center" }), r.style.transition = "box-shadow 0.15s ease", r.style.boxShadow = "0 0 0 2px rgb(var(--nvr-cyan-rgb, 0 206 255)), 0 0 0 5px rgb(var(--nvr-cyan-rgb, 0 206 255) / 0.25)", r.style.borderRadius = "12px", setTimeout(() => {
544
555
  r.style.boxShadow = "none", setTimeout(() => {
@@ -547,103 +558,103 @@ const ir = Lt(function({
547
558
  }, 900));
548
559
  }
549
560
  }
550
- const ft = () => {
551
- if (v && B) {
552
- for (const r of Pe) g == null || g.unstageLink(B, r);
561
+ const yt = () => {
562
+ if (v && D) {
563
+ for (const r of je) y == null || y.unstageLink(D, r);
553
564
  const t = we.getQueryData([
554
565
  "m2m-items",
555
566
  v.many_collection,
556
567
  v.many_field,
557
568
  l
558
569
  ]) ?? [];
559
- for (const r of t) g == null || g.stageUnlink(B, r.id);
570
+ for (const r of t) y == null || y.stageUnlink(D, r.id);
560
571
  } else
561
572
  p(e.field, null);
562
573
  };
563
574
  return (
564
575
  // biome-ignore lint/a11y/noStaticElementInteractions: the wrapper only hosts the field context menu (right-click / Shift+F10); the inputs inside stay the controls
565
- /* @__PURE__ */ d(
576
+ /* @__PURE__ */ u(
566
577
  "div",
567
578
  {
568
579
  ref: V,
569
580
  "data-field": e.field,
570
- "data-field-collection": a,
581
+ "data-field-collection": s,
571
582
  "data-field-interface": e.interface ?? void 0,
572
- "data-autofill-check": pe ? "" : void 0,
583
+ "data-autofill-check": he ? "" : void 0,
573
584
  className: j(
574
585
  "group/fieldrow space-y-1.5",
575
- pe && "rounded-md bg-amber-50/60 p-1.5 ring-1 ring-amber-300 dark:bg-amber-500/10 dark:ring-amber-500/40"
586
+ he && "rounded-md bg-amber-50/60 p-1.5 ring-1 ring-amber-300 dark:bg-amber-500/10 dark:ring-amber-500/40"
576
587
  ),
577
- onContextMenu: Ye,
578
- onKeyDown: Je,
579
- onFocusCapture: T.onFocusCapture,
588
+ onContextMenu: Xe,
589
+ onKeyDown: Ze,
590
+ onFocusCapture: E.onFocusCapture,
580
591
  children: [
581
- Xe,
582
- E.length > 0 && /* @__PURE__ */ n(
583
- It,
592
+ Ie,
593
+ P.length > 0 && /* @__PURE__ */ n(
594
+ tn,
584
595
  {
585
- cascadeRules: E,
586
- cascadeFilter: O,
587
- currentValue: ct,
588
- relatedCollection: dt,
596
+ cascadeRules: P,
597
+ cascadeFilter: M,
598
+ currentValue: ut,
599
+ relatedCollection: mt,
589
600
  missingRequiredParents: be,
590
- onClear: ft
601
+ onClear: yt
591
602
  }
592
603
  ),
593
- (L !== "" || Y.length > 0) && /* @__PURE__ */ d(
604
+ (L !== "" || Y.length > 0) && /* @__PURE__ */ u(
594
605
  "div",
595
606
  {
596
607
  className: "flex flex-wrap items-center gap-1.5 min-h-[1.5rem]",
597
- "data-pd-row": ue ? "" : void 0,
608
+ "data-pd-row": me ? "" : void 0,
598
609
  children: [
599
- L !== "" && /* @__PURE__ */ d(Dt, { id: z, "data-field-label": !0, className: "text-sm font-medium", children: [
600
- /* @__PURE__ */ n(Ue, { text: L, collection: a }),
610
+ L !== "" && /* @__PURE__ */ u(Mt, { id: z, "data-field-label": !0, className: "text-sm font-medium", children: [
611
+ /* @__PURE__ */ n(We, { text: L, collection: s }),
601
612
  e.required && /* @__PURE__ */ n("span", { className: "ml-0.5 text-destructive", children: "*" }),
602
- cn(e) && /* @__PURE__ */ n(dn, {})
613
+ un(e) && /* @__PURE__ */ n(mn, {})
603
614
  ] }),
604
- J.note && /* @__PURE__ */ n(I, { delayDuration: 100, children: /* @__PURE__ */ d(ee, { children: [
605
- /* @__PURE__ */ n(te, { asChild: !0, children: /* @__PURE__ */ n(bt, { className: "h-3.5 w-3.5 shrink-0 cursor-help text-slate-400 hover:text-slate-600" }) }),
606
- /* @__PURE__ */ n(ne, { side: "top", className: "max-w-[240px] text-[12px]", children: (s == null ? void 0 : s.glossaryHelp) === !1 ? J.note : /* @__PURE__ */ n(Ue, { text: J.note, collection: a }) })
615
+ J.note && /* @__PURE__ */ n(ee, { delayDuration: 100, children: /* @__PURE__ */ u(te, { children: [
616
+ /* @__PURE__ */ n(ne, { asChild: !0, children: /* @__PURE__ */ n(vt, { className: "h-3.5 w-3.5 shrink-0 cursor-help text-slate-400 hover:text-slate-600" }) }),
617
+ /* @__PURE__ */ n(re, { side: "top", className: "max-w-[240px] text-[12px]", children: (d == null ? void 0 : d.glossaryHelp) === !1 ? J.note : /* @__PURE__ */ n(We, { text: J.note, collection: s }) })
607
618
  ] }) }),
608
- _e && /* @__PURE__ */ n(jt, { source: _e, label: L }),
609
- !A && l && l !== "new" && /* @__PURE__ */ n(
610
- Cn,
619
+ _e && /* @__PURE__ */ n(Dt, { source: _e, label: L }),
620
+ !q && l && l !== "new" && /* @__PURE__ */ n(
621
+ $n,
611
622
  {
612
- collection: a,
623
+ collection: s,
613
624
  itemId: l,
614
625
  field: e.field,
615
626
  onRestore: e.readonly ? void 0 : (t) => p(e.field, t)
616
627
  }
617
628
  ),
618
- !A && l && l !== "new" && /* @__PURE__ */ n(Ln, { collection: a, itemId: l, field: e.field }),
619
- !A && l && l !== "new" && /* @__PURE__ */ n(zt, { field: e.field, label: L || Z(e.field) }),
620
- l && l !== "new" && it && /* @__PURE__ */ n(Fn, { collection: a, itemId: l, field: e.field }),
621
- ot && /* @__PURE__ */ n(
622
- un,
629
+ !q && l && l !== "new" && /* @__PURE__ */ n(qn, { collection: s, itemId: l, field: e.field }),
630
+ !q && l && l !== "new" && /* @__PURE__ */ n(Qt, { field: e.field, label: L || I(e.field) }),
631
+ l && l !== "new" && st && /* @__PURE__ */ n(Sn, { collection: s, itemId: l, field: e.field }),
632
+ it && /* @__PURE__ */ n(
633
+ pn,
623
634
  {
624
- collection: a,
635
+ collection: s,
625
636
  itemId: l,
626
637
  field: e.field,
627
- label: L || Z(e.field),
638
+ label: L || I(e.field),
628
639
  onFill: (t) => p(e.field, t)
629
640
  }
630
641
  ),
631
- !A && Q.show && !(Q.perField && (u || e.readonly)) && /* @__PURE__ */ d(
642
+ !q && Q.show && !(Q.perField && (m || e.readonly)) && /* @__PURE__ */ u(
632
643
  "button",
633
644
  {
634
645
  type: "button",
635
- onClick: tt,
646
+ onClick: rt,
636
647
  disabled: ke,
637
648
  "data-ai-fill": Q.perField ? e.field : void 0,
638
649
  className: "inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[10px] font-medium text-nvr-cyan hover:bg-nvr-cyan/10 disabled:opacity-50 transition-colors",
639
650
  title: "Generate with AI",
640
651
  children: [
641
- ke ? /* @__PURE__ */ n(gt, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(vt, { className: "h-3 w-3" }),
652
+ ke ? /* @__PURE__ */ n(wt, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(kt, { className: "h-3 w-3" }),
642
653
  "AI"
643
654
  ]
644
655
  }
645
656
  ),
646
- pe && /* @__PURE__ */ n(
657
+ he && /* @__PURE__ */ n(
647
658
  "span",
648
659
  {
649
660
  "data-tip": "People often change what the AI read from the document here — check it",
@@ -651,37 +662,37 @@ const ir = Lt(function({
651
662
  children: "Check this"
652
663
  }
653
664
  ),
654
- f,
655
- q && !u && !e.readonly && /* @__PURE__ */ d(
665
+ x,
666
+ T && !m && !e.readonly && /* @__PURE__ */ u(
656
667
  "button",
657
668
  {
658
669
  type: "button",
659
- onClick: () => q.onApply(m[e.field] ?? null),
660
- disabled: m[e.field] == null || m[e.field] === "" || q.count === 0,
670
+ onClick: () => T.onApply(i[e.field] ?? null),
671
+ disabled: i[e.field] == null || i[e.field] === "" || T.count === 0,
661
672
  "data-apply-to-lines": e.field,
662
- "data-tip": q.count === 0 ? "No lines yet — add lines first" : m[e.field] == null || m[e.field] === "" ? "Pick a value first" : q.count != null ? `Copy this value onto all ${q.count} lines (staged until you save)` : "Copy this value onto every line (staged until you save)",
673
+ "data-tip": T.count === 0 ? "No lines yet — add lines first" : i[e.field] == null || i[e.field] === "" ? "Pick a value first" : T.count != null ? `Copy this value onto all ${T.count} lines (staged until you save)` : "Copy this value onto every line (staged until you save)",
663
674
  className: "inline-flex items-center gap-1 rounded border border-nvr-cyan/40 px-1.5 py-0.5 text-[10.5px] font-medium text-[#0e7490] transition-colors hover:bg-nvr-cyan/10 disabled:cursor-not-allowed disabled:opacity-40 dark:text-nvr-cyan",
664
675
  children: [
665
- q.label ?? "Apply to lines",
676
+ T.label ?? "Apply to lines",
666
677
  " ↓"
667
678
  ]
668
679
  }
669
680
  ),
670
- Y.length > 0 && /* @__PURE__ */ n(I, { delayDuration: 100, children: /* @__PURE__ */ d(ee, { children: [
671
- /* @__PURE__ */ n(te, { asChild: !0, children: /* @__PURE__ */ d("span", { className: "inline-flex items-center gap-1 rounded-full bg-amber-50 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 border border-amber-200 dark:bg-amber-500/10 dark:text-amber-400 dark:border-amber-500/20 cursor-default", children: [
681
+ Y.length > 0 && /* @__PURE__ */ n(ee, { delayDuration: 100, children: /* @__PURE__ */ u(te, { children: [
682
+ /* @__PURE__ */ n(ne, { asChild: !0, children: /* @__PURE__ */ u("span", { className: "inline-flex items-center gap-1 rounded-full bg-amber-50 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 border border-amber-200 dark:bg-amber-500/10 dark:text-amber-400 dark:border-amber-500/20 cursor-default", children: [
672
683
  /* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 shrink-0" }),
673
684
  "addendum"
674
685
  ] }) }),
675
- /* @__PURE__ */ d(ne, { side: "top", className: "max-w-[220px] text-[12px]", children: [
676
- /* @__PURE__ */ d("p", { className: "font-medium mb-1", children: [
686
+ /* @__PURE__ */ u(re, { side: "top", className: "max-w-[220px] text-[12px]", children: [
687
+ /* @__PURE__ */ u("p", { className: "font-medium mb-1", children: [
677
688
  "In active addendum",
678
689
  Y.length > 1 ? "s" : "",
679
690
  ":"
680
691
  ] }),
681
- Y.map((t) => /* @__PURE__ */ d("p", { className: "text-slate-400", children: [
692
+ Y.map((t) => /* @__PURE__ */ u("p", { className: "text-slate-400", children: [
682
693
  t.title,
683
694
  " ",
684
- /* @__PURE__ */ d("span", { className: "capitalize", children: [
695
+ /* @__PURE__ */ u("span", { className: "capitalize", children: [
685
696
  "(",
686
697
  t.status,
687
698
  ")"
@@ -690,65 +701,65 @@ const ir = Lt(function({
690
701
  ] })
691
702
  ] }) }),
692
703
  /* @__PURE__ */ n(
693
- Qt,
704
+ Jt,
694
705
  {
695
- collection: a,
706
+ collection: s,
696
707
  kind: "field",
697
708
  name: e.field,
698
709
  label: L
699
710
  }
700
711
  ),
701
- (u || e.readonly) && D ? /* @__PURE__ */ n(Ht, { reason: D, onHover: s == null ? void 0 : s.onLockHover }) : u ? /* @__PURE__ */ n(I, { delayDuration: 200, children: /* @__PURE__ */ d(ee, { children: [
702
- /* @__PURE__ */ n(te, { asChild: !0, children: /* @__PURE__ */ n("span", { className: "inline-flex items-center text-amber-400 dark:text-amber-500", children: /* @__PURE__ */ n(wt, { className: "h-3 w-3" }) }) }),
703
- /* @__PURE__ */ n(ne, { side: "top", className: "text-[12px]", children: "This field is locked" })
712
+ (m || e.readonly) && B ? /* @__PURE__ */ n(Vt, { reason: B, onHover: d == null ? void 0 : d.onLockHover }) : m ? /* @__PURE__ */ n(ee, { delayDuration: 200, children: /* @__PURE__ */ u(te, { children: [
713
+ /* @__PURE__ */ n(ne, { asChild: !0, children: /* @__PURE__ */ n("span", { className: "inline-flex items-center text-amber-400 dark:text-amber-500", children: /* @__PURE__ */ n(_t, { className: "h-3 w-3" }) }) }),
714
+ /* @__PURE__ */ n(re, { side: "top", className: "text-[12px]", children: "This field is locked" })
704
715
  ] }) }) : null,
705
- E.length > 0 && (() => {
706
- const t = !!O && Object.keys(O).length > 0 && M.length > 0, r = E.map(
716
+ P.length > 0 && (() => {
717
+ const t = !!M && Object.keys(M).length > 0 && O.length > 0, r = P.map(
707
718
  (h) => X(String(h.parent_field))
708
719
  );
709
- return /* @__PURE__ */ n(I, { delayDuration: 100, children: /* @__PURE__ */ d(ee, { children: [
710
- /* @__PURE__ */ n(te, { asChild: !0, children: /* @__PURE__ */ n(
720
+ return /* @__PURE__ */ n(ee, { delayDuration: 100, children: /* @__PURE__ */ u(te, { children: [
721
+ /* @__PURE__ */ n(ne, { asChild: !0, children: /* @__PURE__ */ n(
711
722
  "button",
712
723
  {
713
724
  type: "button",
714
725
  "aria-label": `Show the fields that narrow ${L || "this list"}`,
715
- onClick: ht,
726
+ onClick: ft,
716
727
  className: j(
717
728
  "inline-flex items-center transition-colors",
718
729
  t ? "text-nvr-cyan hover:text-nvr-cyan" : "text-slate-300 hover:text-nvr-cyan dark:text-slate-600 dark:hover:text-nvr-cyan"
719
730
  ),
720
- children: /* @__PURE__ */ n(kt, { className: "h-3 w-3" })
731
+ children: /* @__PURE__ */ n(Nt, { className: "h-3 w-3" })
721
732
  }
722
733
  ) }),
723
- /* @__PURE__ */ n(ne, { side: "top", className: "text-[12px]", children: t ? `Filtered by ${M.join(", ")} — click to highlight` : `Options filter by ${r.join(", ")} once set` })
734
+ /* @__PURE__ */ n(re, { side: "top", className: "text-[12px]", children: t ? `Filtered by ${O.join(", ")} — click to highlight` : `Options filter by ${r.join(", ")} once set` })
724
735
  ] }) });
725
736
  })(),
726
- ue && // Right-anchored: the personal-default control flush with the field's right edge
737
+ me && // Right-anchored: the personal-default control flush with the field's right edge
727
738
  // (it carries Make / Update / Clear itself — no ⋯ button; right-click and
728
739
  // Shift+F10 still open the field menu). The slot keeps one box whatever it shows,
729
740
  // so nothing to its left moves.
730
741
  /* @__PURE__ */ n("span", { className: "ml-auto inline-flex shrink-0 items-center gap-1", children: /* @__PURE__ */ n(
731
- rn,
742
+ on,
732
743
  {
733
744
  field: e.field,
734
745
  label: L,
735
- state: ue,
736
- confirmOpen: de === "make" || de === "update" ? de : null,
746
+ state: me,
747
+ confirmOpen: ue === "make" || ue === "update" ? ue : null,
737
748
  onConfirm: (t, r) => (
738
749
  // After a save the button becomes "Your default": focus goes to the field.
739
- Ze(t, me, r)
750
+ et(t, pe, r)
740
751
  ),
741
752
  onUndo: () => {
742
753
  C == null || C.undo(e.field), requestAnimationFrame(() => {
743
754
  var t;
744
- return (t = me()) == null ? void 0 : t.focus();
755
+ return (t = pe()) == null ? void 0 : t.focus();
745
756
  });
746
757
  },
747
758
  onCleared: () => (
748
759
  // The Clear button is gone (and not a tab stop): focus goes to the field.
749
760
  requestAnimationFrame(() => {
750
761
  var t;
751
- return (t = me()) == null ? void 0 : t.focus();
762
+ return (t = pe()) == null ? void 0 : t.focus();
752
763
  })
753
764
  )
754
765
  }
@@ -756,22 +767,22 @@ const ir = Lt(function({
756
767
  ]
757
768
  }
758
769
  ),
759
- T.editor && !u && /* @__PURE__ */ n(
760
- Wt,
770
+ E.editor && !m && /* @__PURE__ */ n(
771
+ zt,
761
772
  {
762
- editor: T.editor,
763
- confirming: T.confirming,
764
- onConfirm: T.confirm,
765
- onCancel: T.cancel
773
+ editor: E.editor,
774
+ confirming: E.confirming,
775
+ onConfirm: E.confirm,
776
+ onCancel: E.cancel
766
777
  }
767
778
  ),
768
779
  U ?? /* @__PURE__ */ n(
769
780
  "div",
770
781
  {
771
- ref: ce,
772
- className: j(u && !H && "cursor-not-allowed"),
773
- "data-tip": (u || e.readonly) && D ? D : void 0,
774
- onPointerEnter: (u || e.readonly) && D ? s == null ? void 0 : s.onLockHover : void 0,
782
+ ref: de,
783
+ className: j(m && !H && "cursor-not-allowed"),
784
+ "data-tip": (m || e.readonly) && B ? B : void 0,
785
+ onPointerEnter: (m || e.readonly) && B ? d == null ? void 0 : d.onLockHover : void 0,
775
786
  children: /* @__PURE__ */ n(
776
787
  "div",
777
788
  {
@@ -782,61 +793,81 @@ const ir = Lt(function({
782
793
  // upload/replace/remove when readonly) — blocking pointer events
783
794
  // made attachments unopenable on every locked form (addendum
784
795
  // view, terminal states).
785
- u && !H && "pointer-events-none opacity-60",
796
+ m && !H && "pointer-events-none opacity-60",
786
797
  // The ring lands with a 2px shake so the eye finds the field;
787
798
  // the animation runs once when the class is added.
788
- _ && "nvr-shake ring-1 ring-red-400 rounded-md",
789
- ae && "nvr-autofill-glow"
799
+ w && "nvr-shake ring-1 ring-red-400 rounded-md",
800
+ se && "nvr-autofill-glow"
790
801
  ),
791
- children: A ? /* @__PURE__ */ n(mn, { field: e, values: m }) : at ? /* @__PURE__ */ n(
792
- Ot,
802
+ children: q ? /* @__PURE__ */ n(hn, { field: e, values: i }) : ct ? /* @__PURE__ */ n(
803
+ Kt,
793
804
  {
794
- collection: a,
805
+ collection: s,
795
806
  field: e,
796
- draft: m,
807
+ draft: i,
797
808
  itemId: l
798
809
  }
799
- ) : y ? y({
810
+ ) : b ? b({
800
811
  field: e,
801
- value: he,
812
+ value: xe,
802
813
  onChange: Le,
803
- disabled: u,
804
- collection: a,
814
+ disabled: m,
815
+ collection: s,
805
816
  itemId: l,
806
- relations: x,
807
- cascadeFilter: O,
808
- unsatisfiedParentLabel: ut,
809
- requiredParentLabel: je
817
+ relations: f,
818
+ cascadeFilter: M,
819
+ unsatisfiedParentLabel: pt,
820
+ requiredParentLabel: Be
810
821
  }) : /* @__PURE__ */ n(
811
- Gt,
822
+ Yt,
812
823
  {
813
- field: u && H ? mt() : e,
814
- value: he,
824
+ field: m && H ? ht() : e,
825
+ value: xe,
815
826
  onChange: Le,
816
- relations: x,
817
- collection: a,
827
+ relations: f,
828
+ collection: s,
818
829
  itemId: l,
819
- cascadeFilter: O,
820
- requiredParentLabel: je,
821
- narrowedBy: M.length > 0 ? pt() : void 0,
822
- onCountChange: o ? Ge : void 0
830
+ cascadeFilter: M,
831
+ requiredParentLabel: Be,
832
+ narrowedBy: O.length > 0 ? xt() : void 0,
833
+ onCountChange: o ? Ye : void 0
823
834
  }
824
835
  )
825
836
  },
826
- ae ?? 0
837
+ se ?? 0
827
838
  )
828
839
  }
829
840
  ),
830
- Ee && /* @__PURE__ */ n(pn, { value: m[e.field], config: Ee }),
831
- Ae && !et && /* @__PURE__ */ n(ln, { field: e.field, text: Ae }),
841
+ Ee && /* @__PURE__ */ n(xn, { value: i[e.field], config: Ee }),
842
+ w && // The message under the field: a red border alone never said WHY (Service End before
843
+ // Start, b01-N5). The form's summary at the top lists it too.
844
+ /* @__PURE__ */ n(
845
+ "p",
846
+ {
847
+ role: "alert",
848
+ "data-field-error": e.field,
849
+ className: "text-[11.5px] leading-snug text-red-600 dark:text-red-400",
850
+ children: w
851
+ }
852
+ ),
853
+ !w && Pe && // A soft (warning-only) rule the value breaks: said here, never blocks the save.
854
+ /* @__PURE__ */ n(
855
+ "p",
856
+ {
857
+ "data-field-warning": e.field,
858
+ className: "text-[11.5px] leading-snug text-amber-700 dark:text-amber-400",
859
+ children: Pe
860
+ }
861
+ ),
862
+ Ae && !nt && /* @__PURE__ */ n(an, { field: e.field, text: Ae }),
832
863
  qe && /* @__PURE__ */ n(
833
- Vt,
864
+ Gt,
834
865
  {
835
866
  change: qe,
836
- onDismiss: () => s == null ? void 0 : s.dismissRemoteChange(e.field),
837
- onTakeTheirs: s != null && s.takeRemoteChange ? () => {
867
+ onDismiss: () => d == null ? void 0 : d.dismissRemoteChange(e.field),
868
+ onTakeTheirs: d != null && d.takeRemoteChange ? () => {
838
869
  var t;
839
- return (t = s.takeRemoteChange) == null ? void 0 : t.call(s, e.field);
870
+ return (t = d.takeRemoteChange) == null ? void 0 : t.call(d, e.field);
840
871
  } : void 0
841
872
  }
842
873
  )
@@ -846,7 +877,8 @@ const ir = Lt(function({
846
877
  );
847
878
  });
848
879
  export {
849
- ir as FieldRow,
850
- or as lineageSummary,
851
- Nn as useFieldLineage
880
+ ur as FieldRow,
881
+ Ln as clearableParents,
882
+ dr as lineageSummary,
883
+ Rn as useFieldLineage
852
884
  };