@nivaro/react 0.3.64 → 0.3.66

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