@nivaro/react 0.3.125 → 0.3.127

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,42 +1,42 @@
1
- import { jsxs as r, jsx as t, Fragment as ee } from "react/jsx-runtime";
2
- import { useSensors as At, useSensor as Ge, PointerSensor as Lt, KeyboardSensor as Ot, DndContext as Mt, closestCenter as jt } from "@dnd-kit/core";
3
- import { sortableKeyboardCoordinates as qt, SortableContext as Pt, verticalListSortingStrategy as Et, arrayMove as It, useSortable as Kt } from "@dnd-kit/sortable";
4
- import { CSS as Vt } from "@dnd-kit/utilities";
5
- import { useQuery as le, useQueryClient as Se, useMutation as Oe } from "@tanstack/react-query";
6
- import { Clock as Me, List as zt, Table2 as Bt, Sigma as Ne, Download as Ze, ChevronDown as Ke, FileSpreadsheet as Ut, GitCompareArrows as mt, ArrowRight as Ve, X as pt, GripVertical as ht, Zap as De, Search as Ht, Columns3 as Wt, ChevronsUpDown as Jt, History as Qt, ChevronRight as je, MessageSquare as Yt, RotateCcw as ut, Check as Gt, ChevronLeft as Zt, Pause as Xt, Play as ea, CalendarClock as ta } from "lucide-react";
7
- import { useState as L, useRef as ze, useEffect as qe, useMemo as O, useId as aa, createContext as ra, useContext as xt } from "react";
1
+ import { jsxs as r, jsx as t, Fragment as X } from "react/jsx-runtime";
2
+ import { useSensors as Mt, useSensor as Ze, PointerSensor as jt, KeyboardSensor as qt, DndContext as Pt, closestCenter as Et } from "@dnd-kit/core";
3
+ import { sortableKeyboardCoordinates as It, SortableContext as Kt, verticalListSortingStrategy as Vt, arrayMove as zt, useSortable as Bt } from "@dnd-kit/sortable";
4
+ import { CSS as Ut } from "@dnd-kit/utilities";
5
+ import { useQuery as ne, useQueryClient as $e, useMutation as Me } from "@tanstack/react-query";
6
+ import { Clock as je, List as Ht, Table2 as Wt, Sigma as Se, Download as Xe, ChevronDown as Ve, FileSpreadsheet as Jt, GitCompareArrows as pt, ArrowRight as ze, X as ht, GripVertical as ut, Zap as Le, Search as Qt, Columns3 as Yt, ChevronsUpDown as Gt, History as Zt, ChevronRight as qe, MessageSquare as Xt, RotateCcw as bt, Check as ea, ChevronLeft as ta, Pause as aa, Play as ra, CalendarClock as sa } from "lucide-react";
7
+ import { useState as D, useRef as Be, useEffect as Pe, useMemo as A, useId as na, createContext as la, useContext as xt } from "react";
8
8
  import { toast as se } from "sonner";
9
- import { useNivaroClient as pe, useItemEditAuth as sa } from "../../context.js";
10
- import { o2mSentence as na, o2mTotalsText as Xe, activityPredicate as la, activityWhy as oa, actorName as ia } from "../../lib/activity-sentence.js";
11
- import { get as ae, post as ke } from "../../lib/commands.js";
12
- import { compareValueText as Be } from "../../lib/compare-value.js";
13
- import { isEditorJsValue as Ue, editorJsToText as da, editorJsToHtml as ca } from "../../lib/editorjs.js";
9
+ import { useNivaroClient as ce, useItemEditAuth as oa } from "../../context.js";
10
+ import { o2mSentence as ia, o2mTotalsText as et, activityPredicate as da, activityWhy as ca, actorName as ma } from "../../lib/activity-sentence.js";
11
+ import { get as Z, post as Ne } from "../../lib/commands.js";
12
+ import { compareValueText as Ue } from "../../lib/compare-value.js";
13
+ import { isEditorJsValue as He, editorJsToText as pa, editorJsToHtml as ha } from "../../lib/editorjs.js";
14
14
  import { toastError as Ae } from "../../lib/error-toast.js";
15
- import { useLiveRecordQueries as bt } from "../../lib/live.js";
16
- import { restoreSkippedNote as et } from "../../lib/restore-skipped.js";
17
- import { useRevisionPrefs as ft, useSharedColumnSets as ma } from "../../lib/revision-prefs.js";
18
- import { cn as j, formatDateTime as Z, toLocalDateString as be, titleCase as ge } from "../../lib/utils.js";
19
- import { xlsxBlob as pa } from "../../lib/xlsx-lite.js";
20
- import { useActivityLabels as gt } from "../ActivityEntry.js";
21
- import { AgentBadge as ha } from "../AgentBadge.js";
22
- import { HScrollProxy as ua } from "../HScrollProxy.js";
23
- import { RelatedItemLabel as xa } from "../item-edit/RelationCombobox.js";
24
- import { UserChip as ba } from "../item-edit/UserChip.js";
25
- import { UserAvatar as fa } from "../UserAvatar.js";
26
- import { Button as oe } from "../ui/button.js";
27
- import { Checkbox as Pe } from "../ui/checkbox.js";
28
- import { Command as ga, CommandInput as ya, CommandList as va, CommandEmpty as ka, CommandGroup as tt, CommandItem as at } from "../ui/command.js";
29
- import { DropdownMenu as wa, DropdownMenuTrigger as Na, DropdownMenuContent as Ca, DropdownMenuItem as rt } from "../ui/dropdown-menu.js";
30
- import { Popover as Sa, PopoverTrigger as _a, PopoverContent as $a } from "../ui/popover.js";
31
- import { Sheet as Ta, SheetTrigger as Ra, SheetContent as Fa, SheetHeader as Da, SheetTitle as Aa } from "../ui/sheet.js";
32
- import { Skeleton as yt } from "../ui/skeleton.js";
33
- import { IntegrationActivitySection as La } from "./IntegrationActivitySection.js";
34
- import { buildSaveRows as vt, valueAt as Oa, sameValue as Ma, matrixColumns as ja, STEP_FIELD as fe, rowsChanging as qa, saveActionLabel as st, deriveOf as Pa, matrixCsv as Ea, recalcReason as Ia, signedAmount as Ka } from "./revision-changes.js";
35
- import { inDateRange as Va, ColumnSetsMenu as za, PeopleFilter as Ba, DateRangeFilter as Ua, FieldTrend as Ha } from "./revision-table-parts.js";
36
- const Ee = (e) => e.id != null && (e.action === "create" || e.action === "update" || e.action === "delete" || e.action === "restore"), Wa = (e) => !Ee(e), ne = (e) => {
37
- var l;
38
- return e.id != null ? `r${e.id}` : `e${((l = e.event) == null ? void 0 : l.history_id) ?? ""}-${e.activity ?? ""}-${e.timestamp ?? ""}`;
39
- }, Ja = /* @__PURE__ */ new Set([
15
+ import { useLiveRecordQueries as ft } from "../../lib/live.js";
16
+ import { restoreSkippedNote as tt } from "../../lib/restore-skipped.js";
17
+ import { useRevisionPrefs as gt, useSharedColumnSets as ua } from "../../lib/revision-prefs.js";
18
+ import { cn as j, formatDateTime as G, toLocalDateString as fe, titleCase as ye } from "../../lib/utils.js";
19
+ import { xlsxBlob as ba } from "../../lib/xlsx-lite.js";
20
+ import { useActivityLabels as yt } from "../ActivityEntry.js";
21
+ import { AgentBadge as xa } from "../AgentBadge.js";
22
+ import { HScrollProxy as fa } from "../HScrollProxy.js";
23
+ import { RelatedItemLabel as ga } from "../item-edit/RelationCombobox.js";
24
+ import { UserChip as ya } from "../item-edit/UserChip.js";
25
+ import { UserAvatar as va } from "../UserAvatar.js";
26
+ import { Button as ie } from "../ui/button.js";
27
+ import { Checkbox as Ee } from "../ui/checkbox.js";
28
+ import { Command as ka, CommandInput as wa, CommandList as Na, CommandEmpty as Ca, CommandGroup as at, CommandItem as rt } from "../ui/command.js";
29
+ import { DropdownMenu as Sa, DropdownMenuTrigger as _a, DropdownMenuContent as $a, DropdownMenuItem as st } from "../ui/dropdown-menu.js";
30
+ import { Popover as Ta, PopoverTrigger as Ra, PopoverContent as Fa } from "../ui/popover.js";
31
+ import { Sheet as Da, SheetTrigger as La, SheetContent as Aa, SheetHeader as Oa, SheetTitle as Ma } from "../ui/sheet.js";
32
+ import { Skeleton as vt } from "../ui/skeleton.js";
33
+ import { IntegrationActivitySection as ja } from "./IntegrationActivitySection.js";
34
+ import { buildSaveRows as kt, withLinkLabels as wt, valueAt as qa, sameValue as Pa, matrixColumns as Ea, STEP_FIELD as ge, rowsChanging as Ia, saveActionLabel as nt, deriveOf as Ka, matrixCsv as Va, recalcReason as za, signedAmount as Ba } from "./revision-changes.js";
35
+ import { inDateRange as Ua, ColumnSetsMenu as Ha, PeopleFilter as Wa, DateRangeFilter as Ja, FieldTrend as Qa } from "./revision-table-parts.js";
36
+ const Ie = (e) => e.id != null && (e.action === "create" || e.action === "update" || e.action === "delete" || e.action === "restore"), Ya = (e) => !Ie(e), oe = (e) => {
37
+ var n;
38
+ return e.id != null ? `r${e.id}` : `e${((n = e.event) == null ? void 0 : n.history_id) ?? ""}-${e.activity ?? ""}-${e.timestamp ?? ""}`;
39
+ }, Ga = /* @__PURE__ */ new Set([
40
40
  "id",
41
41
  "created",
42
42
  "changed",
@@ -48,46 +48,46 @@ const Ee = (e) => e.id != null && (e.action === "create" || e.action === "update
48
48
  "updated_at",
49
49
  "sort"
50
50
  ]);
51
- function He(e, l) {
52
- const i = pe(), { data: a } = le({
51
+ function We(e, n) {
52
+ const i = ce(), { data: a } = ne({
53
53
  queryKey: ["revisions-field-meta", e],
54
- enabled: l,
54
+ enabled: n,
55
55
  staleTime: 3e5,
56
56
  queryFn: async () => {
57
- const [m, o, p] = await Promise.all([
58
- i.request(ae(`/field-config/${e}`)).then((s) => s.data ?? []).catch(() => []),
57
+ const [h, o, b] = await Promise.all([
58
+ i.request(Z(`/field-config/${e}`)).then((l) => l.data ?? []).catch(() => []),
59
59
  i.request(
60
- ae(`/collections/${e}`)
61
- ).then((s) => {
60
+ Z(`/collections/${e}`)
61
+ ).then((l) => {
62
62
  var g;
63
- return ((g = s.data) == null ? void 0 : g.relations) ?? [];
63
+ return ((g = l.data) == null ? void 0 : g.relations) ?? [];
64
64
  }).catch(() => []),
65
65
  i.request(
66
- ae(`/field-groups/${e}`)
67
- ).then((s) => s.data ?? []).catch(() => [])
66
+ Z(`/field-groups/${e}`)
67
+ ).then((l) => l.data ?? []).catch(() => [])
68
68
  ]);
69
- return { fields: m, relations: o, groups: p };
69
+ return { fields: h, relations: o, groups: b };
70
70
  }
71
71
  });
72
- return O(() => {
73
- var s;
74
- const m = /* @__PURE__ */ new Map(), o = (g) => {
72
+ return A(() => {
73
+ var l;
74
+ const h = /* @__PURE__ */ new Map(), o = (g) => {
75
75
  const c = ((a == null ? void 0 : a.relations) ?? []).find(
76
- (b) => b.many_collection === e && b.many_field === g && b.junction_field == null
76
+ (p) => p.many_collection === e && p.many_field === g && p.junction_field == null
77
77
  );
78
78
  return c != null && c.one_collection ? c.one_collection === "directus_users" ? "nivaro_users" : c.one_collection : null;
79
- }, p = /* @__PURE__ */ new Map();
79
+ }, b = /* @__PURE__ */ new Map();
80
80
  for (const [g, c] of ((a == null ? void 0 : a.groups) ?? []).entries())
81
- p.set(c.key, {
81
+ b.set(c.key, {
82
82
  key: c.key,
83
- label: ((s = c.label) == null ? void 0 : s.trim()) || ge(c.key.replace(/_/g, " ")),
83
+ label: ((l = c.label) == null ? void 0 : l.trim()) || ye(c.key.replace(/_/g, " ")),
84
84
  sort: c.sort ?? g
85
85
  });
86
86
  for (const [g, c] of ((a == null ? void 0 : a.fields) ?? []).entries())
87
- c.field.startsWith("__") || m.set(c.field, {
87
+ c.field.startsWith("__") || h.set(c.field, {
88
88
  order: g,
89
- section: c.group_key ? p.get(c.group_key) ?? null : null,
90
- derive: Pa(c.computed_type, c.computed_formula),
89
+ section: c.group_key ? b.get(c.group_key) ?? null : null,
90
+ derive: Ka(c.computed_type, c.computed_formula),
91
91
  cmp: {
92
92
  field: c.field,
93
93
  type: c.type ?? null,
@@ -95,140 +95,140 @@ function He(e, l) {
95
95
  options: c.options,
96
96
  display_options: c.display_options
97
97
  },
98
- label: c.label || ge(c.field.replace(/_/g, " ")),
98
+ label: c.label || ye(c.field.replace(/_/g, " ")),
99
99
  // Hidden fields are machine columns (e.g. the retired "workflow_state
100
100
  // (legacy)" a save still writes) — folded with the system fields, not
101
101
  // listed among what a person changed (army8 b01).
102
- system: Ja.has(c.field) || c.hidden === !0,
102
+ system: Ga.has(c.field) || c.hidden === !0,
103
103
  // layout_assigned is only stamped when the collection HAS an active
104
104
  // layout — absent means there's no layout to be off of.
105
105
  onLayout: c.layout_assigned !== !1,
106
106
  relatedCollection: o(c.field),
107
107
  dateOnly: String(c.type ?? "").toLowerCase() === "date"
108
108
  });
109
- return m;
109
+ return h;
110
110
  }, [a, e]);
111
111
  }
112
- function $(e, l) {
113
- return e.get(l) ?? {
112
+ function T(e, n) {
113
+ return e.get(n) ?? {
114
114
  // Unknown to the form = machine column. Still labeled, still reachable.
115
- label: ge(l.replace(/[_-]/g, " ")),
115
+ label: ye(n.replace(/[_-]/g, " ")),
116
116
  system: !0,
117
117
  onLayout: !1
118
118
  };
119
119
  }
120
- function Qa({ map: e, field: l }) {
121
- const i = $(e, l);
120
+ function Za({ map: e, field: n }) {
121
+ const i = T(e, n);
122
122
  return /* @__PURE__ */ t(
123
123
  "span",
124
124
  {
125
125
  className: "text-[12px] font-medium text-slate-700 dark:text-slate-200",
126
- "data-tip": l,
127
- title: l,
126
+ "data-tip": n,
127
+ title: n,
128
128
  children: i.label
129
129
  }
130
130
  );
131
131
  }
132
- const nt = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, Ya = /^\d{4}-\d{2}-\d{2}(?:T00:00:00(?:\.0+)?Z)?$/;
133
- function kt(e, l = !1) {
132
+ const lt = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, Xa = /^\d{4}-\d{2}-\d{2}(?:T00:00:00(?:\.0+)?Z)?$/;
133
+ function Nt(e, n = !1) {
134
134
  if (e == null || e === "") return "";
135
135
  if (typeof e == "boolean") return e ? "Yes" : "No";
136
- if (typeof e == "string" && (Ya.test(e) || l && nt.test(e)))
137
- return be(e);
138
- if (typeof e == "string" && nt.test(e)) {
136
+ if (typeof e == "string" && (Xa.test(e) || n && lt.test(e)))
137
+ return fe(e);
138
+ if (typeof e == "string" && lt.test(e)) {
139
139
  const i = new Date(e);
140
- if (!Number.isNaN(i.getTime())) return Z(i);
140
+ if (!Number.isNaN(i.getTime())) return G(i);
141
141
  }
142
142
  return typeof e == "object" ? JSON.stringify(e) : String(e);
143
143
  }
144
- function Ce(e) {
144
+ function _e(e) {
145
145
  return e == null ? "" : typeof e == "object" ? JSON.stringify(e) : String(e);
146
146
  }
147
- function wt({ collection: e, id: l }) {
148
- const i = pe(), { data: a } = le({
147
+ function Ct({ collection: e, id: n }) {
148
+ const i = ce(), { data: a } = ne({
149
149
  queryKey: ["col-meta", e],
150
- queryFn: () => i.request(ae(`/collections/${e}`)).then((m) => m.data),
150
+ queryFn: () => i.request(Z(`/collections/${e}`)).then((h) => h.data),
151
151
  staleTime: 3e5,
152
152
  retry: !1
153
153
  });
154
- return /* @__PURE__ */ t("span", { title: `${e} #${String(l)}`, children: /* @__PURE__ */ t(
155
- xa,
154
+ return /* @__PURE__ */ t("span", { title: `${e} #${String(n)}`, children: /* @__PURE__ */ t(
155
+ ga,
156
156
  {
157
157
  collection: e,
158
- id: l,
158
+ id: n,
159
159
  displayTemplate: a == null ? void 0 : a.display_template
160
160
  }
161
161
  ) });
162
162
  }
163
- function Nt(e) {
164
- return Ue(e) ? da(e) : Ie(e).join(" ");
163
+ function St(e) {
164
+ return He(e) ? pa(e) : Ke(e).join(" ");
165
165
  }
166
- const lt = 160;
167
- function Le({
166
+ const ot = 160;
167
+ function Oe({
168
168
  value: e,
169
- tone: l,
169
+ tone: n,
170
170
  dateOnly: i
171
171
  }) {
172
- const [a, m] = L(!1), o = kt(e, i);
172
+ const [a, h] = D(!1), o = Nt(e, i);
173
173
  if (o === "")
174
174
  return /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" });
175
- const p = o.length > lt, s = a || !p ? o : `${o.slice(0, lt)}…`;
175
+ const b = o.length > ot, l = a || !b ? o : `${o.slice(0, ot)}…`;
176
176
  return /* @__PURE__ */ r("span", { className: "break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: [
177
- typeof e == "object" ? /* @__PURE__ */ t("span", { className: "font-mono text-[11px]", children: s }) : s,
178
- p && /* @__PURE__ */ t(
177
+ typeof e == "object" ? /* @__PURE__ */ t("span", { className: "font-mono text-[11px]", children: l }) : l,
178
+ b && /* @__PURE__ */ t(
179
179
  "button",
180
180
  {
181
181
  type: "button",
182
- onClick: () => m((g) => !g),
182
+ onClick: () => h((g) => !g),
183
183
  className: j(
184
184
  "ml-1 text-[10.5px] font-medium hover:underline",
185
- l === "before" ? "text-rose-500" : "text-emerald-600"
185
+ n === "before" ? "text-rose-500" : "text-emerald-600"
186
186
  ),
187
187
  children: a ? "less" : "more"
188
188
  }
189
189
  )
190
190
  ] });
191
191
  }
192
- function ve(e) {
192
+ function we(e) {
193
193
  if (e && typeof e == "object" && !Array.isArray(e)) return e;
194
194
  if (typeof e == "string" && e.trim().startsWith("{"))
195
195
  try {
196
- const l = JSON.parse(e);
197
- return l && typeof l == "object" && !Array.isArray(l) ? l : null;
196
+ const n = JSON.parse(e);
197
+ return n && typeof n == "object" && !Array.isArray(n) ? n : null;
198
198
  } catch {
199
199
  return null;
200
200
  }
201
201
  return null;
202
202
  }
203
- function Ga({
203
+ function er({
204
204
  before: e,
205
- after: l
205
+ after: n
206
206
  }) {
207
- const a = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(l)])).sort().map((o) => {
208
- const p = o in e ? JSON.stringify(e[o]) : void 0, s = o in l ? JSON.stringify(l[o]) : void 0;
209
- return p === s ? null : { k: o, b: p, a: s };
207
+ const a = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(n)])).sort().map((o) => {
208
+ const b = o in e ? JSON.stringify(e[o]) : void 0, l = o in n ? JSON.stringify(n[o]) : void 0;
209
+ return b === l ? null : { k: o, b, a: l };
210
210
  }).filter(Boolean);
211
211
  if (a.length === 0)
212
212
  return /* @__PURE__ */ t("span", { className: "text-[11px] italic text-slate-400", children: "keys reordered only" });
213
- const m = (o) => o == null ? void 0 : o.length > 80 ? `${o.slice(0, 80)}…` : o;
214
- return /* @__PURE__ */ t("div", { className: "space-y-0.5", "data-json-diff": !0, children: a.map(({ k: o, b: p, a: s }) => /* @__PURE__ */ r("p", { className: "text-[11.5px]", children: [
213
+ const h = (o) => o == null ? void 0 : o.length > 80 ? `${o.slice(0, 80)}…` : o;
214
+ return /* @__PURE__ */ t("div", { className: "space-y-0.5", "data-json-diff": !0, children: a.map(({ k: o, b, a: l }) => /* @__PURE__ */ r("p", { className: "text-[11.5px]", children: [
215
215
  /* @__PURE__ */ t("span", { className: "font-mono text-[10.5px] text-slate-500", children: o }),
216
216
  ":",
217
217
  " ",
218
- p !== void 0 && /* @__PURE__ */ t("span", { className: "text-rose-600 line-through dark:text-rose-400", children: m(p) }),
219
- p !== void 0 && s !== void 0 && " → ",
220
- s !== void 0 ? /* @__PURE__ */ t("span", { className: "text-emerald-700 dark:text-emerald-400", children: m(s) }) : /* @__PURE__ */ t("span", { className: "italic text-slate-400", children: " (removed)" })
218
+ b !== void 0 && /* @__PURE__ */ t("span", { className: "text-rose-600 line-through dark:text-rose-400", children: h(b) }),
219
+ b !== void 0 && l !== void 0 && " → ",
220
+ l !== void 0 ? /* @__PURE__ */ t("span", { className: "text-emerald-700 dark:text-emerald-400", children: h(l) }) : /* @__PURE__ */ t("span", { className: "italic text-slate-400", children: " (removed)" })
221
221
  ] }, o)) });
222
222
  }
223
- function Za({ field: e, ctl: l }) {
224
- return l.confirmField === e ? /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1", "data-revert-field-confirm": e, children: [
223
+ function tr({ field: e, ctl: n }) {
224
+ return n.confirmField === e ? /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1", "data-revert-field-confirm": e, children: [
225
225
  /* @__PURE__ */ t("span", { className: "text-[10.5px] text-slate-500", children: "Revert?" }),
226
226
  /* @__PURE__ */ t(
227
227
  "button",
228
228
  {
229
229
  type: "button",
230
- disabled: l.pending,
231
- onClick: () => l.revert(e),
230
+ disabled: n.pending,
231
+ onClick: () => n.revert(e),
232
232
  className: "rounded bg-nvr-cyan px-1.5 py-px text-[10.5px] font-semibold text-white disabled:opacity-50",
233
233
  children: "Yes"
234
234
  }
@@ -237,7 +237,7 @@ function Za({ field: e, ctl: l }) {
237
237
  "button",
238
238
  {
239
239
  type: "button",
240
- onClick: () => l.setConfirmField(null),
240
+ onClick: () => n.setConfirmField(null),
241
241
  className: "rounded border border-slate-200 px-1.5 py-px text-[10.5px] text-slate-500 dark:border-border",
242
242
  children: "Cancel"
243
243
  }
@@ -246,48 +246,48 @@ function Za({ field: e, ctl: l }) {
246
246
  "button",
247
247
  {
248
248
  type: "button",
249
- onClick: () => l.setConfirmField(e),
249
+ onClick: () => n.setConfirmField(e),
250
250
  className: "inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10.5px] font-medium text-slate-400 opacity-0 transition-opacity hover:bg-nvr-cyan/10 hover:text-nvr-navy group-hover/frow:opacity-100 dark:hover:text-nvr-cyan",
251
251
  title: "Set the field back to this revision’s value",
252
252
  "data-revert-field": e,
253
253
  children: [
254
- /* @__PURE__ */ t(ut, { className: "h-3 w-3" }),
254
+ /* @__PURE__ */ t(bt, { className: "h-3 w-3" }),
255
255
  "Revert"
256
256
  ]
257
257
  }
258
258
  );
259
259
  }
260
- function ye(e) {
261
- return typeof e == "string" && /<[a-z][^>]*>/i.test(e) || Ue(e);
260
+ function ve(e) {
261
+ return typeof e == "string" && /<[a-z][^>]*>/i.test(e) || He(e);
262
262
  }
263
- function Ie(e) {
264
- return String(Ue(e) ? ca(e) : e ?? "").replace(/<[^>]*>/g, " ").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").split(/\s+/).filter(Boolean);
263
+ function Ke(e) {
264
+ return String(He(e) ? ha(e) : e ?? "").replace(/<[^>]*>/g, " ").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").split(/\s+/).filter(Boolean);
265
265
  }
266
- function Xa(e, l) {
267
- const a = Ie(e).slice(0, 600), m = Ie(l).slice(0, 600), o = a.length, p = m.length, s = Array.from({ length: o + 1 }, () => new Array(p + 1).fill(0));
266
+ function ar(e, n) {
267
+ const a = Ke(e).slice(0, 600), h = Ke(n).slice(0, 600), o = a.length, b = h.length, l = Array.from({ length: o + 1 }, () => new Array(b + 1).fill(0));
268
268
  for (let k = o - 1; k >= 0; k--)
269
- for (let u = p - 1; u >= 0; u--)
270
- s[k][u] = a[k] === m[u] ? s[k + 1][u + 1] + 1 : Math.max(s[k + 1][u], s[k][u + 1]);
269
+ for (let u = b - 1; u >= 0; u--)
270
+ l[k][u] = a[k] === h[u] ? l[k + 1][u + 1] + 1 : Math.max(l[k + 1][u], l[k][u + 1]);
271
271
  const g = [], c = (k, u) => {
272
- const R = g[g.length - 1];
273
- R && R.type === k ? R.text += ` ${u}` : g.push({ text: u, type: k });
272
+ const $ = g[g.length - 1];
273
+ $ && $.type === k ? $.text += ` ${u}` : g.push({ text: u, type: k });
274
274
  };
275
- let b = 0, f = 0;
276
- for (; b < o && f < p; )
277
- a[b] === m[f] ? (c("same", a[b]), b++, f++) : s[b + 1][f] >= s[b][f + 1] ? (c("del", a[b]), b++) : (c("ins", m[f]), f++);
278
- for (; b < o; ) c("del", a[b++]);
279
- for (; f < p; ) c("ins", m[f++]);
275
+ let p = 0, v = 0;
276
+ for (; p < o && v < b; )
277
+ a[p] === h[v] ? (c("same", a[p]), p++, v++) : l[p + 1][v] >= l[p][v + 1] ? (c("del", a[p]), p++) : (c("ins", h[v]), v++);
278
+ for (; p < o; ) c("del", a[p++]);
279
+ for (; v < b; ) c("ins", h[v++]);
280
280
  return g;
281
281
  }
282
- function Ct({ before: e, after: l }) {
283
- const i = Xa(e, l);
282
+ function _t({ before: e, after: n }) {
283
+ const i = ar(e, n);
284
284
  return /* @__PURE__ */ t("p", { className: "whitespace-pre-wrap break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: i.map(
285
- (a, m) => a.type === "same" ? (
285
+ (a, h) => a.type === "same" ? (
286
286
  // biome-ignore lint/suspicious/noArrayIndexKey: static segment list
287
287
  /* @__PURE__ */ r("span", { children: [
288
288
  a.text,
289
289
  " "
290
- ] }, m)
290
+ ] }, h)
291
291
  ) : a.type === "del" ? (
292
292
  // biome-ignore lint/suspicious/noArrayIndexKey: static segment list
293
293
  /* @__PURE__ */ r(
@@ -299,7 +299,7 @@ function Ct({ before: e, after: l }) {
299
299
  " "
300
300
  ]
301
301
  },
302
- m
302
+ h
303
303
  )
304
304
  ) : (
305
305
  // biome-ignore lint/suspicious/noArrayIndexKey: static segment list
@@ -312,52 +312,52 @@ function Ct({ before: e, after: l }) {
312
312
  " "
313
313
  ]
314
314
  },
315
- m
315
+ h
316
316
  )
317
317
  )
318
318
  ) });
319
319
  }
320
- const er = {
320
+ const rr = {
321
321
  added: "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-400",
322
322
  removed: "bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-400",
323
323
  changed: "bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-400"
324
324
  };
325
- function St(e, l, i) {
326
- const a = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(l)])), m = (s) => s == null || s === "", o = a.map((s) => {
327
- const g = !(s in e) || m(e[s]), c = !(s in l) || m(l[s]);
325
+ function $t(e, n, i) {
326
+ const a = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(n)])), h = (l) => l == null || l === "", o = a.map((l) => {
327
+ const g = !(l in e) || h(e[l]), c = !(l in n) || h(n[l]);
328
328
  if (g && c) return null;
329
- const b = g ? "added" : c ? "removed" : Ce(e[s]) !== Ce(l[s]) ? "changed" : "unchanged";
329
+ const p = g ? "added" : c ? "removed" : _e(e[l]) !== _e(n[l]) ? "changed" : "unchanged";
330
330
  return {
331
- field: s,
332
- status: b,
333
- before: e[s],
334
- after: l[s],
335
- system: $(i, s).system
331
+ field: l,
332
+ status: p,
333
+ before: e[l],
334
+ after: n[l],
335
+ system: T(i, l).system
336
336
  };
337
- }).filter(Boolean), p = (s) => {
338
- const g = $(i, s.field);
339
- return (g.system ? 8 : g.onLayout ? 0 : 4) + (s.status === "unchanged" ? 2 : 0);
337
+ }).filter(Boolean), b = (l) => {
338
+ const g = T(i, l.field);
339
+ return (g.system ? 8 : g.onLayout ? 0 : 4) + (l.status === "unchanged" ? 2 : 0);
340
340
  };
341
341
  return o.sort(
342
- (s, g) => p(s) - p(g) || $(i, s.field).label.localeCompare($(i, g.field).label)
342
+ (l, g) => b(l) - b(g) || T(i, l.field).label.localeCompare(T(i, g.field).label)
343
343
  );
344
344
  }
345
- function ie({
345
+ function de({
346
346
  value: e,
347
- meta: l,
347
+ meta: n,
348
348
  tone: i
349
349
  }) {
350
- return e == null || e === "" ? /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" }) : l.relatedCollection && (typeof e == "string" || typeof e == "number") ? /* @__PURE__ */ t("span", { className: "break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: /* @__PURE__ */ t(wt, { collection: l.relatedCollection, id: e }) }) : ye(e) ? /* @__PURE__ */ t(Le, { value: Nt(e), tone: i }) : l.cmp && typeof e != "object" && !l.dateOnly ? /* @__PURE__ */ t(Le, { value: Be(e, l.cmp), tone: i }) : /* @__PURE__ */ t(Le, { value: e, tone: i, dateOnly: l.dateOnly });
350
+ return e == null || e === "" ? /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" }) : n.relatedCollection && (typeof e == "string" || typeof e == "number") ? /* @__PURE__ */ t("span", { className: "break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: /* @__PURE__ */ t(Ct, { collection: n.relatedCollection, id: e }) }) : ve(e) ? /* @__PURE__ */ t(Oe, { value: St(e), tone: i }) : n.cmp && typeof e != "object" && !n.dateOnly ? /* @__PURE__ */ t(Oe, { value: Ue(e, n.cmp), tone: i }) : /* @__PURE__ */ t(Oe, { value: e, tone: i, dateOnly: n.dateOnly });
351
351
  }
352
- function tr({
352
+ function sr({
353
353
  row: e,
354
- meta: l,
354
+ meta: n,
355
355
  fieldRevert: i,
356
356
  mode: a,
357
- hideStatusChips: m,
357
+ hideStatusChips: h,
358
358
  between: o
359
359
  }) {
360
- const p = e.status === "changed" && (ye(e.before) || ye(e.after)), s = e.status === "changed" && ve(e.before) && ve(e.after);
360
+ const b = e.status === "changed" && (ve(e.before) || ve(e.after)), l = e.status === "changed" && we(e.before) && we(e.after);
361
361
  return /* @__PURE__ */ r(
362
362
  "div",
363
363
  {
@@ -368,56 +368,56 @@ function tr({
368
368
  "data-field-row": e.field,
369
369
  children: [
370
370
  /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
371
- /* @__PURE__ */ t(Qa, { map: l, field: e.field }),
372
- e.status !== "unchanged" && !m && /* @__PURE__ */ t(
371
+ /* @__PURE__ */ t(Za, { map: n, field: e.field }),
372
+ e.status !== "unchanged" && !h && /* @__PURE__ */ t(
373
373
  "span",
374
374
  {
375
375
  className: j(
376
376
  "rounded px-1 py-px text-[9px] font-semibold uppercase tracking-wide",
377
- er[e.status]
377
+ rr[e.status]
378
378
  ),
379
379
  children: e.status === "added" ? "set" : e.status
380
380
  }
381
381
  ),
382
382
  (e.status === "changed" || a === "changes" && e.status === "added") && i && e.field !== "id" && // A value worked out between saves (a rollup, a forecast status) is
383
383
  // not something to put back by hand (army11 f1 design review).
384
- !o && /* @__PURE__ */ t("span", { className: "ml-auto shrink-0", children: /* @__PURE__ */ t(Za, { field: e.field, ctl: i }) })
384
+ !o && /* @__PURE__ */ t("span", { className: "ml-auto shrink-0", children: /* @__PURE__ */ t(tr, { field: e.field, ctl: i }) })
385
385
  ] }),
386
- /* @__PURE__ */ t("div", { className: "mt-1", children: p ? /* @__PURE__ */ t("div", { "data-richtext-diff": !0, children: /* @__PURE__ */ t(Ct, { before: e.before, after: e.after }) }) : s ? /* @__PURE__ */ t(
387
- Ga,
386
+ /* @__PURE__ */ t("div", { className: "mt-1", children: b ? /* @__PURE__ */ t("div", { "data-richtext-diff": !0, children: /* @__PURE__ */ t(_t, { before: e.before, after: e.after }) }) : l ? /* @__PURE__ */ t(
387
+ er,
388
388
  {
389
- before: ve(e.before),
390
- after: ve(e.after)
389
+ before: we(e.before),
390
+ after: we(e.after)
391
391
  }
392
392
  ) : e.status === "changed" || e.status === "removed" ? /* @__PURE__ */ r("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-0.5", children: [
393
- /* @__PURE__ */ t("span", { className: "max-w-full break-words text-[12px] text-rose-600 line-through decoration-rose-300 dark:text-rose-400", children: /* @__PURE__ */ t(ie, { value: e.before, meta: $(l, e.field), tone: "before" }) }),
394
- /* @__PURE__ */ t(Ve, { className: "h-3 w-3 shrink-0 self-center text-slate-300 dark:text-slate-600" }),
395
- /* @__PURE__ */ t(ie, { value: e.after, meta: $(l, e.field), tone: "after" })
396
- ] }) : /* @__PURE__ */ t(ie, { value: e.after ?? e.before, meta: $(l, e.field), tone: "after" }) })
393
+ /* @__PURE__ */ t("span", { className: "max-w-full break-words text-[12px] text-rose-600 line-through decoration-rose-300 dark:text-rose-400", children: /* @__PURE__ */ t(de, { value: e.before, meta: T(n, e.field), tone: "before" }) }),
394
+ /* @__PURE__ */ t(ze, { className: "h-3 w-3 shrink-0 self-center text-slate-300 dark:text-slate-600" }),
395
+ /* @__PURE__ */ t(de, { value: e.after, meta: T(n, e.field), tone: "after" })
396
+ ] }) : /* @__PURE__ */ t(de, { value: e.after ?? e.before, meta: T(n, e.field), tone: "after" }) })
397
397
  ]
398
398
  }
399
399
  );
400
400
  }
401
- function _t({
401
+ function Tt({
402
402
  before: e,
403
- after: l,
403
+ after: n,
404
404
  meta: i,
405
405
  fieldRevert: a,
406
- mode: m,
406
+ mode: h,
407
407
  hideStatusChips: o,
408
- ownFields: p
408
+ ownFields: b
409
409
  }) {
410
- const [s, g] = L(!1), c = O(() => St(e, l, i), [e, l, i]), b = m === "changes" ? c.filter((v) => v.status !== "unchanged") : c, f = s ? b : b.filter((v) => !v.system), k = (v) => !!p && m === "changes" && !v.system && !p.has(v.field), u = f.filter(k), R = [...f.filter((v) => !k(v)), ...u], C = u.length ? R.length - u.length : -1, y = b.length - R.length;
411
- if (b.length === 0)
412
- return /* @__PURE__ */ t("p", { className: "px-3 py-3 text-[12px] text-slate-400", children: m === "changes" ? "No field changes recorded." : "No snapshot data available." });
413
- const S = R.findIndex(
414
- (v) => !k(v) && !$(i, v.field).onLayout && !$(i, v.field).system
415
- ), T = R.some(
416
- (v) => !k(v) && $(i, v.field).onLayout && !$(i, v.field).system
410
+ const [l, g] = D(!1), c = A(() => $t(e, n, i), [e, n, i]), p = h === "changes" ? c.filter((f) => f.status !== "unchanged") : c, v = l ? p : p.filter((f) => !f.system), k = (f) => !!b && h === "changes" && !f.system && !b.has(f.field), u = v.filter(k), $ = [...v.filter((f) => !k(f)), ...u], _ = u.length ? $.length - u.length : -1, y = p.length - $.length;
411
+ if (p.length === 0)
412
+ return /* @__PURE__ */ t("p", { className: "px-3 py-3 text-[12px] text-slate-400", children: h === "changes" ? "No field changes recorded." : "No snapshot data available." });
413
+ const L = $.findIndex(
414
+ (f) => !k(f) && !T(i, f.field).onLayout && !T(i, f.field).system
415
+ ), E = $.some(
416
+ (f) => !k(f) && T(i, f.field).onLayout && !T(i, f.field).system
417
417
  );
418
418
  return /* @__PURE__ */ r("div", { className: "overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
419
- R.map((v, x) => /* @__PURE__ */ r("div", { children: [
420
- x === C && /* @__PURE__ */ r(
419
+ $.map((f, m) => /* @__PURE__ */ r("div", { children: [
420
+ m === _ && /* @__PURE__ */ r(
421
421
  "div",
422
422
  {
423
423
  "data-recalculated-between": !0,
@@ -428,22 +428,22 @@ function _t({
428
428
  ]
429
429
  }
430
430
  ),
431
- x === S && T && /* @__PURE__ */ r("div", { className: "border-b border-t border-slate-100 bg-slate-50/70 px-3 py-1.5 dark:border-border/60 dark:bg-muted/30", children: [
431
+ m === L && E && /* @__PURE__ */ r("div", { className: "border-b border-t border-slate-100 bg-slate-50/70 px-3 py-1.5 dark:border-border/60 dark:bg-muted/30", children: [
432
432
  /* @__PURE__ */ t("p", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: "Behind the scenes" }),
433
433
  /* @__PURE__ */ t("p", { className: "text-[10.5px] text-slate-400", children: "Not on the form — written automatically by rules, computed fields or integrations." })
434
434
  ] }),
435
435
  /* @__PURE__ */ t(
436
- tr,
436
+ sr,
437
437
  {
438
- row: v,
438
+ row: f,
439
439
  meta: i,
440
440
  fieldRevert: a,
441
- mode: m,
441
+ mode: h,
442
442
  hideStatusChips: o,
443
- between: k(v)
443
+ between: k(f)
444
444
  }
445
445
  )
446
- ] }, v.field)),
446
+ ] }, f.field)),
447
447
  y > 0 && /* @__PURE__ */ r(
448
448
  "button",
449
449
  {
@@ -460,7 +460,7 @@ function _t({
460
460
  ]
461
461
  }
462
462
  ),
463
- y === 0 && s && b.some((v) => v.system) && /* @__PURE__ */ t(
463
+ y === 0 && l && p.some((f) => f.system) && /* @__PURE__ */ t(
464
464
  "button",
465
465
  {
466
466
  type: "button",
@@ -471,24 +471,24 @@ function _t({
471
471
  )
472
472
  ] });
473
473
  }
474
- const ar = {
474
+ const nr = {
475
475
  create: "bg-emerald-500",
476
476
  restore: "bg-emerald-500",
477
477
  update: "bg-nvr-cyan",
478
478
  delete: "bg-red-500"
479
- }, We = ra(void 0);
480
- function te(e, l) {
479
+ }, Je = la(void 0);
480
+ function ee(e, n) {
481
481
  var i;
482
- return e.actor && e.actor.kind !== "person" ? ia(e, l) : e.first_name || e.last_name ? [e.first_name, e.last_name].filter(Boolean).join(" ") : e.user_email ?? ((i = e.user_id) == null ? void 0 : i.slice(0, 8)) ?? "System";
482
+ return e.actor && e.actor.kind !== "person" ? ma(e, n) : e.first_name || e.last_name ? [e.first_name, e.last_name].filter(Boolean).join(" ") : e.user_email ?? ((i = e.user_id) == null ? void 0 : i.slice(0, 8)) ?? "System";
483
483
  }
484
- function rr(e, l, i) {
485
- return e.action === "create" ? "created this record" : e.action === "restore" ? "restored this record from trash" : e.action === "delete" ? "deleted this record" : l > 0 ? `changed ${l} field${l === 1 ? "" : "s"}` : i > 0 ? "updated system fields" : "saved this record";
484
+ function lr(e, n, i) {
485
+ return e.action === "create" ? "created this record" : e.action === "restore" ? "restored this record from trash" : e.action === "delete" ? "deleted this record" : n > 0 ? `changed ${n} field${n === 1 ? "" : "s"}` : i > 0 ? "updated system fields" : "saved this record";
486
486
  }
487
- function sr({ revision: e, isLast: l }) {
488
- var f, k, u, R, C;
489
- const i = xt(We), a = e.event, m = (a == null ? void 0 : a.source) === "auto" || !e.user_id && (a == null ? void 0 : a.kind) === "transition", o = !m && ((f = a == null ? void 0 : a.on_behalf_of) != null && f.name) ? a.on_behalf_of.name : null, p = !m && ((k = a == null ? void 0 : a.acting_admin) != null && k.name) ? a.acting_admin.name : null, s = p ? `${p} as ${te(e, i)}` : te(e, i), g = m ? "Automatic rule" : o ? `${s}, for ${o}` : s;
487
+ function or({ revision: e, isLast: n }) {
488
+ var v, k, u, $, _;
489
+ const i = xt(Je), a = e.event, h = (a == null ? void 0 : a.source) === "auto" || !e.user_id && (a == null ? void 0 : a.kind) === "transition", o = !h && ((v = a == null ? void 0 : a.on_behalf_of) != null && v.name) ? a.on_behalf_of.name : null, b = !h && ((k = a == null ? void 0 : a.acting_admin) != null && k.name) ? a.acting_admin.name : null, l = b ? `${b} as ${ee(e, i)}` : ee(e, i), g = h ? "Automatic rule" : o ? `${l}, for ${o}` : l;
490
490
  let c;
491
- (a == null ? void 0 : a.kind) === "transition" && a.addendum ? c = /* @__PURE__ */ r(ee, { children: [
491
+ (a == null ? void 0 : a.kind) === "transition" && a.addendum ? c = /* @__PURE__ */ r(X, { children: [
492
492
  "moved",
493
493
  " ",
494
494
  /* @__PURE__ */ r("span", { className: "font-medium text-slate-700 dark:text-slate-200", "data-revision-addendum": !0, children: [
@@ -498,7 +498,7 @@ function sr({ revision: e, isLast: l }) {
498
498
  ] }),
499
499
  ":",
500
500
  " ",
501
- a.from_label && /* @__PURE__ */ r(ee, { children: [
501
+ a.from_label && /* @__PURE__ */ r(X, { children: [
502
502
  /* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: a.from_label }),
503
503
  " ",
504
504
  "→",
@@ -509,10 +509,10 @@ function sr({ revision: e, isLast: l }) {
509
509
  " · ",
510
510
  a.transition_label
511
511
  ] })
512
- ] }) : (a == null ? void 0 : a.kind) === "transition" ? c = /* @__PURE__ */ r(ee, { children: [
512
+ ] }) : (a == null ? void 0 : a.kind) === "transition" ? c = /* @__PURE__ */ r(X, { children: [
513
513
  "moved it",
514
514
  " ",
515
- a.from_label && /* @__PURE__ */ r(ee, { children: [
515
+ a.from_label && /* @__PURE__ */ r(X, { children: [
516
516
  "from",
517
517
  " ",
518
518
  /* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: a.from_label }),
@@ -525,16 +525,16 @@ function sr({ revision: e, isLast: l }) {
525
525
  " · ",
526
526
  a.transition_label
527
527
  ] })
528
- ] }) : (a == null ? void 0 : a.kind) === "start" && a.to_label ? c = /* @__PURE__ */ r(ee, { children: [
528
+ ] }) : (a == null ? void 0 : a.kind) === "start" && a.to_label ? c = /* @__PURE__ */ r(X, { children: [
529
529
  "started it in",
530
530
  " ",
531
531
  /* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: a.to_label })
532
- ] }) : (a == null ? void 0 : a.kind) === "start" ? c = /* @__PURE__ */ r(ee, { children: [
532
+ ] }) : (a == null ? void 0 : a.kind) === "start" ? c = /* @__PURE__ */ r(X, { children: [
533
533
  "started the pipeline",
534
534
  e.comment ? ` — ${e.comment.replace(/^Started pipeline\s*[—-]?\s*/i, "")}` : ""
535
- ] }) : (u = e.action) != null && u.startsWith("o2m-") ? c = /* @__PURE__ */ t("span", { "data-revision-o2m": !0, children: e.o2m ? /* @__PURE__ */ r(ee, { children: [
536
- na(e.o2m),
537
- Xe(e.o2m) ? (
535
+ ] }) : (u = e.action) != null && u.startsWith("o2m-") ? c = /* @__PURE__ */ t("span", { "data-revision-o2m": !0, children: e.o2m ? /* @__PURE__ */ r(X, { children: [
536
+ ia(e.o2m),
537
+ et(e.o2m) ? (
538
538
  // Which totals on this record the row's write moved (audit: who changed the
539
539
  // requisition amount — the person who wrote the line).
540
540
  /* @__PURE__ */ r(
@@ -544,7 +544,7 @@ function sr({ revision: e, isLast: l }) {
544
544
  className: "ml-1 font-medium text-slate-700 dark:text-slate-200",
545
545
  children: [
546
546
  "· ",
547
- Xe(e.o2m)
547
+ et(e.o2m)
548
548
  ]
549
549
  }
550
550
  )
@@ -557,18 +557,18 @@ function sr({ revision: e, isLast: l }) {
557
557
  children: "outside this record"
558
558
  }
559
559
  ) : null
560
- ] }) : `${e.action === "o2m-create" ? "added" : e.action === "o2m-delete" ? "removed" : "changed"} related rows` }) : c = /* @__PURE__ */ r(ee, { children: [
561
- la({ ...e, item: null }, i),
560
+ ] }) : `${e.action === "o2m-create" ? "added" : e.action === "o2m-delete" ? "removed" : "changed"} related rows` }) : c = /* @__PURE__ */ r(X, { children: [
561
+ da({ ...e, item: null }, i),
562
562
  e.comment ? ` — ${e.comment}` : ""
563
563
  ] });
564
- const b = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
564
+ const p = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
565
565
  return /* @__PURE__ */ r(
566
566
  "div",
567
567
  {
568
568
  className: "relative pl-9",
569
569
  "data-revision-event": (a == null ? void 0 : a.kind) ?? e.action ?? "",
570
- "data-revision-on-behalf": o ? (R = a == null ? void 0 : a.on_behalf_of) == null ? void 0 : R.id : void 0,
571
- "data-revision-acting-admin": p ? (C = a == null ? void 0 : a.acting_admin) == null ? void 0 : C.id : void 0,
570
+ "data-revision-on-behalf": o ? ($ = a == null ? void 0 : a.on_behalf_of) == null ? void 0 : $.id : void 0,
571
+ "data-revision-acting-admin": b ? (_ = a == null ? void 0 : a.acting_admin) == null ? void 0 : _.id : void 0,
572
572
  children: [
573
573
  /* @__PURE__ */ t(
574
574
  "span",
@@ -580,7 +580,7 @@ function sr({ revision: e, isLast: l }) {
580
580
  "aria-hidden": !0
581
581
  }
582
582
  ),
583
- !l && /* @__PURE__ */ t(
583
+ !n && /* @__PURE__ */ t(
584
584
  "span",
585
585
  {
586
586
  className: "absolute bottom-0 left-[15.5px] top-[30px] w-px bg-slate-200 dark:bg-border",
@@ -588,7 +588,7 @@ function sr({ revision: e, isLast: l }) {
588
588
  }
589
589
  ),
590
590
  /* @__PURE__ */ r("div", { className: "flex w-full items-start gap-2.5 rounded-md px-2 py-2.5 text-left", children: [
591
- m ? /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-violet-500/10 text-[10px] font-semibold text-violet-700 dark:text-violet-300", children: "⚡" }) : /* @__PURE__ */ t(_e, { userId: e.user_id, name: g }),
591
+ h ? /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-violet-500/10 text-[10px] font-semibold text-violet-700 dark:text-violet-300", children: "⚡" }) : /* @__PURE__ */ t(Te, { userId: e.user_id, name: g }),
592
592
  /* @__PURE__ */ r("span", { className: "min-w-0 flex-1 text-[12.5px] text-slate-700 dark:text-slate-200", children: [
593
593
  /* @__PURE__ */ t("span", { className: "font-medium", children: g }),
594
594
  " ",
@@ -610,8 +610,8 @@ function sr({ revision: e, isLast: l }) {
610
610
  "span",
611
611
  {
612
612
  className: "shrink-0 text-[11px] tabular-nums text-slate-400",
613
- title: e.timestamp ? Z(e.timestamp) : void 0,
614
- children: b
613
+ title: e.timestamp ? G(e.timestamp) : void 0,
614
+ children: p
615
615
  }
616
616
  )
617
617
  ] })
@@ -619,72 +619,72 @@ function sr({ revision: e, isLast: l }) {
619
619
  }
620
620
  );
621
621
  }
622
- function nr({
622
+ function ir({
623
623
  revision: e,
624
- previousData: l,
624
+ previousData: n,
625
625
  meta: i,
626
626
  onRollback: a,
627
- inlineTableFields: m,
627
+ inlineTableFields: h,
628
628
  isLast: o
629
629
  }) {
630
- const p = pe(), s = xt(We), g = oa(e).reason, [c, b] = L(!1), [f, k] = L(!1), [u, R] = L("changes"), [C, y] = L(!1), [S, T] = L(null), v = e.action === "update", x = e.action === "create" || e.action === "restore", w = e.action === "delete", F = w ? e.data ?? {} : x ? {} : l ?? {}, q = w ? {} : e.data ?? {}, { humanDelta: I, systemDelta: M } = O(() => {
631
- const A = e.delta ?? {};
632
- let z = 0, Y = 0;
633
- for (const ue of Object.keys(A)) {
634
- const Te = l == null ? void 0 : l[ue], G = (e.data ?? {})[ue];
635
- v && l && Ce(Te) === Ce(G) || ($(i, ue).system ? Y++ : z++);
630
+ const b = ce(), l = xt(Je), g = ca(e).reason, [c, p] = D(!1), [v, k] = D(!1), [u, $] = D("changes"), [_, y] = D(!1), [L, E] = D(null), f = e.action === "update", m = e.action === "create" || e.action === "restore", C = e.action === "delete", w = C ? e.data ?? {} : m ? {} : n ?? {}, M = C ? {} : e.data ?? {}, { humanDelta: q, systemDelta: O } = A(() => {
631
+ const F = e.delta ?? {};
632
+ let U = 0, W = 0;
633
+ for (const te of Object.keys(F)) {
634
+ const ke = n == null ? void 0 : n[te], Re = (e.data ?? {})[te];
635
+ f && n && _e(ke) === _e(Re) || (T(i, te).system ? W++ : U++);
636
636
  }
637
- return { humanDelta: z, systemDelta: Y };
638
- }, [e, l, i, v]), P = O(() => new Set(Object.keys(e.delta ?? {})), [e]), W = v || x, [B, J] = L(null), he = Se(), [de, h] = L(null), D = Oe({
639
- mutationFn: (A) => p.request(ke(`/revisions/${e.id}/revert-field`, { field: A })),
640
- onSuccess: (A, z) => {
641
- h(null), se.success(`Reverted ${$(i, z).label} to this revision's value`), he.invalidateQueries({ queryKey: ["revisions", e.collection, e.item] }), a == null || a();
637
+ return { humanDelta: U, systemDelta: W };
638
+ }, [e, n, i, f]), I = A(() => new Set(Object.keys(e.delta ?? {})), [e]), z = f || m, [B, Q] = D(null), le = $e(), [ue, x] = D(null), R = Me({
639
+ mutationFn: (F) => b.request(Ne(`/revisions/${e.id}/revert-field`, { field: F })),
640
+ onSuccess: (F, U) => {
641
+ x(null), se.success(`Reverted ${T(i, U).label} to this revision's value`), le.invalidateQueries({ queryKey: ["revisions", e.collection, e.item] }), a == null || a();
642
642
  },
643
643
  onError: () => se.error("Failed to revert field")
644
- }), U = v || x ? {
645
- confirmField: de,
646
- setConfirmField: h,
647
- revert: (A) => D.mutate(A),
648
- pending: D.isPending
649
- } : void 0, K = Oe({
650
- mutationFn: () => p.request(ke(`/revisions/${e.id}/rollback`, {})),
651
- onSuccess: (A) => {
644
+ }), Y = f || m ? {
645
+ confirmField: ue,
646
+ setConfirmField: x,
647
+ revert: (F) => R.mutate(F),
648
+ pending: R.isPending
649
+ } : void 0, K = Me({
650
+ mutationFn: () => b.request(Ne(`/revisions/${e.id}/rollback`, {})),
651
+ onSuccess: (F) => {
652
652
  k(!1), se.success("Rolled back to this revision");
653
- const z = et(A);
654
- z && se.warning(z, { duration: 1e4 }), m != null && m.length && e.timestamp && J(e.timestamp), a == null || a();
653
+ const U = tt(F);
654
+ U && se.warning(U, { duration: 1e4 }), h != null && h.length && e.timestamp && Q(e.timestamp), a == null || a();
655
655
  },
656
656
  onError: () => se.error("Failed to rollback")
657
657
  });
658
- async function X(A) {
658
+ async function me(F) {
659
659
  if (B) {
660
- T(A.field);
660
+ E(F.field);
661
661
  try {
662
- const z = await p.request(
663
- ke("/revisions/o2m-restore", {
664
- collection: A.relatedCollection,
665
- many_field: A.manyField,
666
- parent_id: A.parentId,
662
+ const U = await b.request(
663
+ Ne("/revisions/o2m-restore", {
664
+ collection: F.relatedCollection,
665
+ many_field: F.manyField,
666
+ parent_id: F.parentId,
667
667
  target_timestamp: B
668
668
  })
669
669
  );
670
- se.success(`Restored ${A.label}`);
671
- const Y = et(z);
672
- Y && se.warning(Y, { duration: 1e4 });
670
+ se.success(`Restored ${F.label}`);
671
+ const W = tt(U);
672
+ W && se.warning(W, { duration: 1e4 });
673
673
  } catch {
674
- se.error(`Failed to restore ${A.label}`);
674
+ se.error(`Failed to restore ${F.label}`);
675
675
  } finally {
676
- T(null);
676
+ E(null);
677
677
  }
678
678
  }
679
679
  }
680
- const $e = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
680
+ const be = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
681
681
  return /* @__PURE__ */ r("div", { className: "relative pl-9", "data-revision-row": e.id, children: [
682
682
  /* @__PURE__ */ t(
683
683
  "span",
684
684
  {
685
685
  className: j(
686
686
  "absolute left-[11px] top-[18px] h-2.5 w-2.5 rounded-full ring-4 ring-white dark:ring-card",
687
- ar[e.action ?? ""] ?? "bg-slate-300"
687
+ nr[e.action ?? ""] ?? "bg-slate-300"
688
688
  ),
689
689
  "aria-hidden": !0
690
690
  }
@@ -697,19 +697,19 @@ function nr({
697
697
  }
698
698
  ),
699
699
  /* @__PURE__ */ r("div", { className: "flex w-full items-center gap-2.5 rounded-md px-2 py-2.5 transition-colors hover:bg-slate-50 dark:hover:bg-muted/40", children: [
700
- /* @__PURE__ */ t(_e, { userId: e.user_id, name: te(e, s) }),
700
+ /* @__PURE__ */ t(Te, { userId: e.user_id, name: ee(e, l) }),
701
701
  /* @__PURE__ */ r(
702
702
  "button",
703
703
  {
704
704
  type: "button",
705
- onClick: () => b((A) => !A),
705
+ onClick: () => p((F) => !F),
706
706
  "aria-expanded": c,
707
707
  className: "flex min-w-0 flex-1 items-center gap-2.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan rounded",
708
708
  children: [
709
709
  /* @__PURE__ */ r("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: [
710
- /* @__PURE__ */ t("span", { className: "font-medium", children: te(e, s) }),
710
+ /* @__PURE__ */ t("span", { className: "font-medium", children: ee(e, l) }),
711
711
  " ",
712
- /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: rr(e, I, M) }),
712
+ /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: lr(e, q, O) }),
713
713
  g && /* @__PURE__ */ r(
714
714
  "span",
715
715
  {
@@ -723,16 +723,16 @@ function nr({
723
723
  }
724
724
  )
725
725
  ] }),
726
- /* @__PURE__ */ t(ha, { label: e.via_agent }),
726
+ /* @__PURE__ */ t(xa, { label: e.via_agent }),
727
727
  /* @__PURE__ */ t(
728
728
  "span",
729
729
  {
730
730
  className: "shrink-0 text-[11px] tabular-nums text-slate-400",
731
- title: e.timestamp ? Z(e.timestamp) : void 0,
732
- children: $e
731
+ title: e.timestamp ? G(e.timestamp) : void 0,
732
+ children: be
733
733
  }
734
734
  ),
735
- c ? /* @__PURE__ */ t(Ke, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }) : /* @__PURE__ */ t(je, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
735
+ c ? /* @__PURE__ */ t(Ve, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }) : /* @__PURE__ */ t(qe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
736
736
  ]
737
737
  }
738
738
  )
@@ -742,39 +742,39 @@ function nr({
742
742
  /* @__PURE__ */ t("div", { className: "flex items-center overflow-hidden rounded-md border border-slate-200 dark:border-border", children: [
743
743
  ["changes", "What changed"],
744
744
  ["all", "Full record"]
745
- ].map(([A, z]) => /* @__PURE__ */ t(
745
+ ].map(([F, U]) => /* @__PURE__ */ t(
746
746
  "button",
747
747
  {
748
748
  type: "button",
749
- onClick: () => R(A),
749
+ onClick: () => $(F),
750
750
  className: j(
751
751
  "px-2.5 py-1 text-[11.5px] transition-colors",
752
- u === A ? "bg-nvr-cyan/10 font-medium text-nvr-navy dark:text-nvr-cyan" : "text-slate-400 hover:text-slate-600 dark:hover:text-slate-300"
752
+ u === F ? "bg-nvr-cyan/10 font-medium text-nvr-navy dark:text-nvr-cyan" : "text-slate-400 hover:text-slate-600 dark:hover:text-slate-300"
753
753
  ),
754
- children: z
754
+ children: U
755
755
  },
756
- A
756
+ F
757
757
  )) }),
758
758
  /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
759
759
  /* @__PURE__ */ r(
760
760
  "button",
761
761
  {
762
762
  type: "button",
763
- onClick: () => y((A) => !A),
763
+ onClick: () => y((F) => !F),
764
764
  className: j(
765
765
  "inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11.5px] transition-colors",
766
- C ? "border-nvr-cyan/40 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-400 hover:text-slate-600 dark:border-border dark:hover:text-slate-300"
766
+ _ ? "border-nvr-cyan/40 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-400 hover:text-slate-600 dark:border-border dark:hover:text-slate-300"
767
767
  ),
768
768
  children: [
769
- /* @__PURE__ */ t(Yt, { className: "h-3 w-3" }),
769
+ /* @__PURE__ */ t(Xt, { className: "h-3 w-3" }),
770
770
  "Notes"
771
771
  ]
772
772
  }
773
773
  ),
774
- W && (f ? /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1.5", children: [
774
+ z && (v ? /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1.5", children: [
775
775
  /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-500", children: "Restore this version?" }),
776
776
  /* @__PURE__ */ t(
777
- oe,
777
+ ie,
778
778
  {
779
779
  size: "sm",
780
780
  variant: "destructive",
@@ -785,7 +785,7 @@ function nr({
785
785
  }
786
786
  ),
787
787
  /* @__PURE__ */ t(
788
- oe,
788
+ ie,
789
789
  {
790
790
  size: "sm",
791
791
  variant: "outline",
@@ -795,7 +795,7 @@ function nr({
795
795
  }
796
796
  )
797
797
  ] }) : /* @__PURE__ */ r(
798
- oe,
798
+ ie,
799
799
  {
800
800
  size: "sm",
801
801
  variant: "outline",
@@ -804,74 +804,74 @@ function nr({
804
804
  onClick: () => k(!0),
805
805
  title: "Set the whole record back to how it looked after this save",
806
806
  children: [
807
- /* @__PURE__ */ t(ut, { className: "h-3 w-3" }),
807
+ /* @__PURE__ */ t(bt, { className: "h-3 w-3" }),
808
808
  "Restore this version"
809
809
  ]
810
810
  }
811
811
  ))
812
812
  ] })
813
813
  ] }),
814
- C && /* @__PURE__ */ t(cr, { revisionId: e.id ?? "" }),
814
+ _ && /* @__PURE__ */ t(hr, { revisionId: e.id ?? "" }),
815
815
  /* @__PURE__ */ t(
816
- _t,
816
+ Tt,
817
817
  {
818
- before: F,
819
- after: q,
818
+ before: w,
819
+ after: M,
820
820
  meta: i,
821
- fieldRevert: U,
821
+ fieldRevert: Y,
822
822
  mode: u,
823
- hideStatusChips: x,
824
- ownFields: v && e.delta ? P : null
823
+ hideStatusChips: m,
824
+ ownFields: f && e.delta ? I : null
825
825
  }
826
826
  ),
827
- B && m && m.length > 0 && /* @__PURE__ */ r("div", { className: "space-y-1.5 rounded-md border border-slate-100 bg-slate-50 p-2 dark:border-border dark:bg-muted/30", children: [
827
+ B && h && h.length > 0 && /* @__PURE__ */ r("div", { className: "space-y-1.5 rounded-md border border-slate-100 bg-slate-50 p-2 dark:border-border dark:bg-muted/30", children: [
828
828
  /* @__PURE__ */ t("p", { className: "text-[10.5px] font-medium text-slate-500", children: "Also restore related rows?" }),
829
- m.map((A) => /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-2", children: [
830
- /* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children: A.label }),
829
+ h.map((F) => /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-2", children: [
830
+ /* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children: F.label }),
831
831
  /* @__PURE__ */ t(
832
832
  "button",
833
833
  {
834
834
  type: "button",
835
- disabled: S === A.field,
836
- onClick: () => X(A),
835
+ disabled: L === F.field,
836
+ onClick: () => me(F),
837
837
  className: "rounded border border-nvr-cyan/40 px-2 py-0.5 text-[10.5px] font-medium text-nvr-cyan hover:bg-nvr-cyan/10 disabled:opacity-40",
838
- children: S === A.field ? "Restoring…" : "Restore"
838
+ children: L === F.field ? "Restoring…" : "Restore"
839
839
  }
840
840
  )
841
- ] }, A.field))
841
+ ] }, F.field))
842
842
  ] })
843
843
  ] })
844
844
  ] });
845
845
  }
846
- function lr({
846
+ function dr({
847
847
  data: e,
848
- history: l,
848
+ history: n,
849
849
  meta: i,
850
850
  labels: a,
851
- focusSave: m
851
+ focusSave: h
852
852
  }) {
853
- const [o, p] = L(m ? "replay" : null), [s, g] = L(""), [c, b] = L(""), f = O(() => {
854
- if (!s || !c || !e) return null;
855
- const u = (/* @__PURE__ */ new Date(`${s}T23:59:59`)).getTime(), R = (/* @__PURE__ */ new Date(`${c}T23:59:59`)).getTime();
856
- if (R <= u) return { error: "The second date must be after the first" };
857
- const C = (F) => e.find((q) => q.timestamp && new Date(q.timestamp).getTime() <= F) ?? null, y = C(u), S = C(R);
858
- if (!S) return { error: "No snapshot exists at or before the second date" };
859
- const T = (y == null ? void 0 : y.data) ?? {}, v = S.data ?? {}, x = /* @__PURE__ */ new Map();
860
- for (const F of [...e].reverse()) {
861
- const q = F.timestamp ? new Date(F.timestamp).getTime() : 0;
862
- if (!(q <= u || q > R || !F.delta))
863
- for (const I of Object.keys(F.delta))
864
- x.set(I, { name: te(F), when: F.timestamp });
853
+ const [o, b] = D(h ? "replay" : null), [l, g] = D(""), [c, p] = D(""), v = A(() => {
854
+ if (!l || !c || !e) return null;
855
+ const u = (/* @__PURE__ */ new Date(`${l}T23:59:59`)).getTime(), $ = (/* @__PURE__ */ new Date(`${c}T23:59:59`)).getTime();
856
+ if ($ <= u) return { error: "The second date must be after the first" };
857
+ const _ = (w) => e.find((M) => M.timestamp && new Date(M.timestamp).getTime() <= w) ?? null, y = _(u), L = _($);
858
+ if (!L) return { error: "No snapshot exists at or before the second date" };
859
+ const E = (y == null ? void 0 : y.data) ?? {}, f = L.data ?? {}, m = /* @__PURE__ */ new Map();
860
+ for (const w of [...e].reverse()) {
861
+ const M = w.timestamp ? new Date(w.timestamp).getTime() : 0;
862
+ if (!(M <= u || M > $ || !w.delta))
863
+ for (const q of Object.keys(w.delta))
864
+ m.set(q, { name: ee(w), when: w.timestamp });
865
865
  }
866
- return { fields: [.../* @__PURE__ */ new Set([...Object.keys(T), ...Object.keys(v)])].filter((F) => String(T[F] ?? "") !== String(v[F] ?? "")).map((F) => ({ field: F, from: T[F], to: v[F], by: x.get(F) ?? null })) };
867
- }, [s, c, e]), k = "h-7 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card";
866
+ return { fields: [.../* @__PURE__ */ new Set([...Object.keys(E), ...Object.keys(f)])].filter((w) => String(E[w] ?? "") !== String(f[w] ?? "")).map((w) => ({ field: w, from: E[w], to: f[w], by: m.get(w) ?? null })) };
867
+ }, [l, c, e]), k = "h-7 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card";
868
868
  return /* @__PURE__ */ r("div", { className: "space-y-2", children: [
869
869
  /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
870
870
  /* @__PURE__ */ r(
871
871
  "button",
872
872
  {
873
873
  type: "button",
874
- onClick: () => p(o === "replay" ? null : "replay"),
874
+ onClick: () => b(o === "replay" ? null : "replay"),
875
875
  disabled: e.length === 0,
876
876
  "aria-expanded": o === "replay",
877
877
  "data-history-replay-toggle": !0,
@@ -880,7 +880,7 @@ function lr({
880
880
  o === "replay" ? "border-nvr-cyan/40 bg-nvr-cyan/5 font-medium text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-border dark:text-slate-400 dark:hover:text-slate-200"
881
881
  ),
882
882
  children: [
883
- /* @__PURE__ */ t(Qt, { className: "h-3.5 w-3.5" }),
883
+ /* @__PURE__ */ t(Zt, { className: "h-3.5 w-3.5" }),
884
884
  "Replay the record"
885
885
  ]
886
886
  }
@@ -889,26 +889,26 @@ function lr({
889
889
  "button",
890
890
  {
891
891
  type: "button",
892
- onClick: () => p(o === "compare" ? null : "compare"),
892
+ onClick: () => b(o === "compare" ? null : "compare"),
893
893
  className: j(
894
894
  "inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-[11.5px] transition-colors",
895
- o === "compare" || s && c ? "border-nvr-cyan/40 bg-nvr-cyan/5 font-medium text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-border dark:text-slate-400 dark:hover:text-slate-200"
895
+ o === "compare" || l && c ? "border-nvr-cyan/40 bg-nvr-cyan/5 font-medium text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-border dark:text-slate-400 dark:hover:text-slate-200"
896
896
  ),
897
897
  children: [
898
- /* @__PURE__ */ t(mt, { className: "h-3.5 w-3.5" }),
898
+ /* @__PURE__ */ t(pt, { className: "h-3.5 w-3.5" }),
899
899
  "Compare two dates"
900
900
  ]
901
901
  }
902
902
  )
903
903
  ] }),
904
904
  o === "replay" && /* @__PURE__ */ t(
905
- fr,
905
+ vr,
906
906
  {
907
907
  snapshots: e,
908
- history: l,
908
+ history: n,
909
909
  meta: i,
910
910
  labels: a,
911
- startKey: m ?? null
911
+ startKey: h ?? null
912
912
  }
913
913
  ),
914
914
  o === "compare" && /* @__PURE__ */ r("div", { className: "rounded-lg border border-slate-200 bg-slate-50/60 p-2.5 dark:border-border dark:bg-muted/20", children: [
@@ -918,7 +918,7 @@ function lr({
918
918
  "input",
919
919
  {
920
920
  type: "date",
921
- value: s,
921
+ value: l,
922
922
  onChange: (u) => g(u.target.value),
923
923
  className: k,
924
924
  "aria-label": "Compare from date",
@@ -931,42 +931,42 @@ function lr({
931
931
  {
932
932
  type: "date",
933
933
  value: c,
934
- onChange: (u) => b(u.target.value),
934
+ onChange: (u) => p(u.target.value),
935
935
  className: k,
936
936
  "aria-label": "Compare to date",
937
937
  "data-diff-to": !0
938
938
  }
939
939
  ),
940
- (s || c) && /* @__PURE__ */ t(
940
+ (l || c) && /* @__PURE__ */ t(
941
941
  "button",
942
942
  {
943
943
  type: "button",
944
944
  onClick: () => {
945
- g(""), b("");
945
+ g(""), p("");
946
946
  },
947
947
  className: "text-[11px] text-slate-400 hover:text-slate-600 dark:hover:text-slate-300",
948
948
  children: "Clear"
949
949
  }
950
950
  )
951
951
  ] }),
952
- (f == null ? void 0 : f.error) != null && /* @__PURE__ */ t("p", { className: "mt-2 text-[12px] text-amber-600 dark:text-amber-400", children: f == null ? void 0 : f.error }),
953
- (f == null ? void 0 : f.fields) != null && /* @__PURE__ */ r(
952
+ (v == null ? void 0 : v.error) != null && /* @__PURE__ */ t("p", { className: "mt-2 text-[12px] text-amber-600 dark:text-amber-400", children: v == null ? void 0 : v.error }),
953
+ (v == null ? void 0 : v.fields) != null && /* @__PURE__ */ r(
954
954
  "div",
955
955
  {
956
956
  className: "mt-2 overflow-hidden rounded-lg border border-nvr-cyan/40 bg-white dark:bg-card",
957
957
  "data-between-diff": !0,
958
958
  children: [
959
959
  /* @__PURE__ */ t("div", { className: "border-b border-slate-200 bg-[#f0fbff] px-2.5 py-1.5 dark:border-border dark:bg-nvr-cyan/10", children: /* @__PURE__ */ r("span", { className: "text-[11.5px] font-semibold text-slate-700 dark:text-slate-200", children: [
960
- f.fields.length,
960
+ v.fields.length,
961
961
  " field",
962
- f.fields.length === 1 ? "" : "s",
962
+ v.fields.length === 1 ? "" : "s",
963
963
  " changed between ",
964
- s,
964
+ l,
965
965
  " and",
966
966
  " ",
967
967
  c
968
968
  ] }) }),
969
- f.fields.length === 0 ? /* @__PURE__ */ t("p", { className: "px-2.5 py-3 text-[12px] text-slate-400", children: "Nothing changed in that window." }) : /* @__PURE__ */ t("div", { className: "max-h-80 overflow-y-auto", children: f.fields.map((u) => /* @__PURE__ */ r(
969
+ v.fields.length === 0 ? /* @__PURE__ */ t("p", { className: "px-2.5 py-3 text-[12px] text-slate-400", children: "Nothing changed in that window." }) : /* @__PURE__ */ t("div", { className: "max-h-80 overflow-y-auto", children: v.fields.map((u) => /* @__PURE__ */ r(
970
970
  "div",
971
971
  {
972
972
  className: "border-b border-slate-100 px-2.5 py-1.5 last:border-0 dark:border-border/60",
@@ -977,17 +977,17 @@ function lr({
977
977
  {
978
978
  className: "text-[11.5px] font-medium text-slate-600 dark:text-slate-300",
979
979
  title: u.field,
980
- children: $(i, u.field).label
980
+ children: T(i, u.field).label
981
981
  }
982
982
  ),
983
983
  u.by && /* @__PURE__ */ r("span", { className: "shrink-0 text-[10.5px] text-slate-400", children: [
984
984
  u.by.name,
985
- u.by.when ? ` · ${be(u.by.when)}` : ""
985
+ u.by.when ? ` · ${fe(u.by.when)}` : ""
986
986
  ] })
987
987
  ] }),
988
988
  /* @__PURE__ */ r("p", { className: "mt-0.5 flex flex-wrap items-baseline gap-x-2 break-words text-[11.5px]", children: [
989
- /* @__PURE__ */ t("span", { className: "text-red-500 line-through dark:text-red-400", children: /* @__PURE__ */ t(ie, { value: u.from, meta: $(i, u.field), tone: "before" }) }),
990
- /* @__PURE__ */ t("span", { className: "text-emerald-600 dark:text-emerald-400", children: /* @__PURE__ */ t(ie, { value: u.to, meta: $(i, u.field), tone: "after" }) })
989
+ /* @__PURE__ */ t("span", { className: "text-red-500 line-through dark:text-red-400", children: /* @__PURE__ */ t(de, { value: u.from, meta: T(i, u.field), tone: "before" }) }),
990
+ /* @__PURE__ */ t("span", { className: "text-emerald-600 dark:text-emerald-400", children: /* @__PURE__ */ t(de, { value: u.to, meta: T(i, u.field), tone: "after" }) })
991
991
  ] })
992
992
  ]
993
993
  },
@@ -999,7 +999,7 @@ function lr({
999
999
  ] })
1000
1000
  ] });
1001
1001
  }
1002
- function or(e) {
1002
+ function cr(e) {
1003
1003
  return e ? new Date(e).toLocaleDateString([], {
1004
1004
  weekday: "short",
1005
1005
  month: "short",
@@ -1007,101 +1007,109 @@ function or(e) {
1007
1007
  year: "numeric"
1008
1008
  }) : "Unknown date";
1009
1009
  }
1010
- function ir({
1010
+ function Rt(e, n) {
1011
+ const i = ce(), { data: a } = ne({
1012
+ queryKey: ["revision-link-labels", e, n],
1013
+ queryFn: () => i.request(Z("/revisions/link-labels", { collection: e, item: n })).then((h) => h.data),
1014
+ staleTime: 3e4
1015
+ });
1016
+ return a;
1017
+ }
1018
+ function mr({
1011
1019
  collection: e,
1012
- item: l,
1020
+ item: n,
1013
1021
  onRollback: i,
1014
1022
  inlineTableFields: a,
1015
- focusSave: m
1023
+ focusSave: h
1016
1024
  }) {
1017
- const o = pe(), p = He(e, !0), { data: s, isLoading: g } = le({
1018
- queryKey: ["revisions", e, l],
1019
- queryFn: () => o.request(ae("/revisions", { collection: e, item: l })).then((S) => S.data ?? []),
1025
+ const o = ce(), b = We(e, !0), { data: l, isLoading: g } = ne({
1026
+ queryKey: ["revisions", e, n],
1027
+ queryFn: () => o.request(Z("/revisions", { collection: e, item: n })).then((f) => f.data ?? []),
1020
1028
  staleTime: 3e4
1021
- }), c = Se();
1022
- bt(e, l, [["revisions", e, l]], { client: c });
1023
- const b = ze(null), f = O(() => {
1024
- if (!s) return /* @__PURE__ */ new Set();
1025
- const S = s.map(ne);
1026
- if (!b.current)
1027
- return b.current = new Set(S), /* @__PURE__ */ new Set();
1028
- const T = b.current;
1029
- return new Set(S.filter((v) => !T.has(v)));
1030
- }, [s]), k = (s == null ? void 0 : s.length) ?? 0, u = O(() => (s ?? []).filter(Ee), [s]), R = O(
1031
- () => (s ?? []).filter((S) => S.actor && S.actor.kind !== "person").map((S) => ({ action: S.action, user: S.user_id, actor: S.actor })),
1032
- [s]
1033
- ), C = gt(R, { enabled: R.length > 0 }), y = O(() => {
1034
- const S = [];
1035
- for (const T of s ?? []) {
1036
- const v = or(T.timestamp), x = S[S.length - 1];
1037
- x && x.day === v ? x.revisions.push(T) : S.push({ day: v, revisions: [T] });
1029
+ }), c = Rt(e, n), p = A(() => l && wt(l, c), [l, c]), v = $e();
1030
+ ft(e, n, [["revisions", e, n]], { client: v });
1031
+ const k = Be(null), u = A(() => {
1032
+ if (!p) return /* @__PURE__ */ new Set();
1033
+ const f = p.map(oe);
1034
+ if (!k.current)
1035
+ return k.current = new Set(f), /* @__PURE__ */ new Set();
1036
+ const m = k.current;
1037
+ return new Set(f.filter((C) => !m.has(C)));
1038
+ }, [p]), $ = (p == null ? void 0 : p.length) ?? 0, _ = A(() => (p ?? []).filter(Ie), [p]), y = A(
1039
+ () => (p ?? []).filter((f) => f.actor && f.actor.kind !== "person").map((f) => ({ action: f.action, user: f.user_id, actor: f.actor })),
1040
+ [p]
1041
+ ), L = yt(y, { enabled: y.length > 0 }), E = A(() => {
1042
+ const f = [];
1043
+ for (const m of p ?? []) {
1044
+ const C = cr(m.timestamp), w = f[f.length - 1];
1045
+ w && w.day === C ? w.revisions.push(m) : f.push({ day: C, revisions: [m] });
1038
1046
  }
1039
- return S;
1040
- }, [s]);
1041
- return g ? /* @__PURE__ */ t("div", { className: "space-y-2 pt-3", children: [1, 2, 3, 4].map((S) => /* @__PURE__ */ t(yt, { className: "h-11 rounded-md" }, S)) }) : k === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center py-16 text-center", children: [
1042
- /* @__PURE__ */ t(Me, { className: "mb-2 h-8 w-8 text-slate-300 dark:text-slate-600" }),
1047
+ return f;
1048
+ }, [p]);
1049
+ return g ? /* @__PURE__ */ t("div", { className: "space-y-2 pt-3", children: [1, 2, 3, 4].map((f) => /* @__PURE__ */ t(vt, { className: "h-11 rounded-md" }, f)) }) : $ === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center py-16 text-center", children: [
1050
+ /* @__PURE__ */ t(je, { className: "mb-2 h-8 w-8 text-slate-300 dark:text-slate-600" }),
1043
1051
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-600 dark:text-slate-300", children: "No history yet" }),
1044
1052
  /* @__PURE__ */ t("p", { className: "mt-1 max-w-[38ch] text-[12px] text-slate-400", children: "Every save records who changed what — the trail will appear here." })
1045
- ] }) : /* @__PURE__ */ t(We.Provider, { value: C, children: /* @__PURE__ */ r("div", { className: "space-y-3 pt-3", children: [
1053
+ ] }) : /* @__PURE__ */ t(Je.Provider, { value: L, children: /* @__PURE__ */ r("div", { className: "space-y-3 pt-3", children: [
1046
1054
  /* @__PURE__ */ t(
1047
- lr,
1055
+ dr,
1048
1056
  {
1049
- data: u,
1050
- history: s ?? [],
1051
- meta: p,
1052
- labels: C,
1053
- focusSave: m ?? null
1057
+ data: _,
1058
+ history: p ?? [],
1059
+ meta: b,
1060
+ labels: L,
1061
+ focusSave: h ?? null
1054
1062
  }
1055
1063
  ),
1056
- /* @__PURE__ */ t("div", { children: y.map((S) => /* @__PURE__ */ r("div", { children: [
1057
- /* @__PURE__ */ t("div", { className: "sticky top-0 z-10 -mx-6 border-b border-slate-100 bg-white px-6 py-1.5 dark:border-border/60 dark:bg-card", children: /* @__PURE__ */ t("span", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: S.day }) }),
1058
- S.revisions.map((T) => {
1059
- const v = (s ?? []).indexOf(T), x = v === ((s == null ? void 0 : s.length) ?? 1) - 1;
1060
- if (Wa(T))
1064
+ /* @__PURE__ */ t("div", { children: E.map((f) => /* @__PURE__ */ r("div", { children: [
1065
+ /* @__PURE__ */ t("div", { className: "sticky top-0 z-10 -mx-6 border-b border-slate-100 bg-white px-6 py-1.5 dark:border-border/60 dark:bg-card", children: /* @__PURE__ */ t("span", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: f.day }) }),
1066
+ f.revisions.map((m) => {
1067
+ const C = (p ?? []).indexOf(m), w = C === ((p == null ? void 0 : p.length) ?? 1) - 1;
1068
+ if (Ya(m))
1061
1069
  return /* @__PURE__ */ r(
1062
1070
  "div",
1063
1071
  {
1064
1072
  className: j(
1065
1073
  "nvr-fade-in relative",
1066
- f.has(ne(T)) && "rounded-md bg-nvr-cyan/[0.06]"
1074
+ u.has(oe(m)) && "rounded-md bg-nvr-cyan/[0.06]"
1067
1075
  ),
1068
1076
  children: [
1069
- f.has(ne(T)) && /* @__PURE__ */ t(ot, {}),
1070
- /* @__PURE__ */ t(sr, { revision: T, isLast: x })
1077
+ u.has(oe(m)) && /* @__PURE__ */ t(it, {}),
1078
+ /* @__PURE__ */ t(or, { revision: m, isLast: w })
1071
1079
  ]
1072
1080
  },
1073
- ne(T)
1081
+ oe(m)
1074
1082
  );
1075
- const w = (s ?? []).slice(v + 1).find(Ee);
1083
+ const M = (p ?? []).slice(C + 1).find(Ie);
1076
1084
  return /* @__PURE__ */ r(
1077
1085
  "div",
1078
1086
  {
1079
1087
  className: j(
1080
1088
  "nvr-fade-in relative",
1081
- f.has(ne(T)) && "rounded-md bg-nvr-cyan/[0.06]"
1089
+ u.has(oe(m)) && "rounded-md bg-nvr-cyan/[0.06]"
1082
1090
  ),
1083
1091
  children: [
1084
- f.has(ne(T)) && /* @__PURE__ */ t(ot, {}),
1092
+ u.has(oe(m)) && /* @__PURE__ */ t(it, {}),
1085
1093
  /* @__PURE__ */ t(
1086
- nr,
1094
+ ir,
1087
1095
  {
1088
- revision: T,
1089
- previousData: (w == null ? void 0 : w.data) ?? null,
1090
- meta: p,
1096
+ revision: m,
1097
+ previousData: (M == null ? void 0 : M.data) ?? null,
1098
+ meta: b,
1091
1099
  onRollback: i,
1092
1100
  inlineTableFields: a,
1093
- isLast: x
1101
+ isLast: w
1094
1102
  }
1095
1103
  )
1096
1104
  ]
1097
1105
  },
1098
- ne(T)
1106
+ oe(m)
1099
1107
  );
1100
1108
  })
1101
- ] }, S.day)) })
1109
+ ] }, f.day)) })
1102
1110
  ] }) });
1103
1111
  }
1104
- function ot() {
1112
+ function it() {
1105
1113
  return (
1106
1114
  // Under the timeline dot, inside the row's 36px gutter.
1107
1115
  /* @__PURE__ */ t(
@@ -1114,80 +1122,80 @@ function ot() {
1114
1122
  )
1115
1123
  );
1116
1124
  }
1117
- function Xr({
1125
+ function as({
1118
1126
  collection: e,
1119
- item: l,
1127
+ item: n,
1120
1128
  onRollback: i,
1121
1129
  triggerClassName: a,
1122
- inlineTableFields: m,
1130
+ inlineTableFields: h,
1123
1131
  open: o,
1124
- onOpenChange: p,
1125
- compact: s
1132
+ onOpenChange: b,
1133
+ compact: l
1126
1134
  }) {
1127
- const g = o !== void 0, c = ft(e), [b, f] = L(mr), k = ze(!1), [u, R] = L(null);
1128
- qe(() => {
1129
- k.current || !c.view || (k.current = !0, f(c.view));
1135
+ const g = o !== void 0, c = gt(e), [p, v] = D(ur), k = Be(!1), [u, $] = D(null);
1136
+ Pe(() => {
1137
+ k.current || !c.view || (k.current = !0, v(c.view));
1130
1138
  }, [c.view]);
1131
- const C = (y) => {
1132
- k.current = !0, R(null), f(y), c.setView(y);
1139
+ const _ = (y) => {
1140
+ k.current = !0, $(null), v(y), c.setView(y);
1133
1141
  try {
1134
- localStorage.setItem($t, y);
1142
+ localStorage.setItem(Ft, y);
1135
1143
  } catch {
1136
1144
  }
1137
1145
  };
1138
- return /* @__PURE__ */ r(Ta, { open: o, onOpenChange: p, children: [
1139
- !g && /* @__PURE__ */ t(Ra, { asChild: !0, children: /* @__PURE__ */ r(
1140
- oe,
1146
+ return /* @__PURE__ */ r(Da, { open: o, onOpenChange: b, children: [
1147
+ !g && /* @__PURE__ */ t(La, { asChild: !0, children: /* @__PURE__ */ r(
1148
+ ie,
1141
1149
  {
1142
- variant: s ? "ghost" : "outline",
1150
+ variant: l ? "ghost" : "outline",
1143
1151
  size: "sm",
1144
- title: s ? "History — revisions of this record" : void 0,
1152
+ title: l ? "History — revisions of this record" : void 0,
1145
1153
  "aria-label": "History",
1146
- className: a ?? (s ? "h-8 w-8 rounded-none p-0" : "gap-1.5"),
1154
+ className: a ?? (l ? "h-8 w-8 rounded-none p-0" : "gap-1.5"),
1147
1155
  children: [
1148
- /* @__PURE__ */ t(Me, { className: s ? "h-4 w-4" : "h-3.5 w-3.5" }),
1149
- !s && "History"
1156
+ /* @__PURE__ */ t(je, { className: l ? "h-4 w-4" : "h-3.5 w-3.5" }),
1157
+ !l && "History"
1150
1158
  ]
1151
1159
  }
1152
1160
  ) }),
1153
1161
  /* @__PURE__ */ t(
1154
- Fa,
1162
+ Aa,
1155
1163
  {
1156
1164
  className: j(
1157
1165
  "overflow-y-auto p-0 transition-[width] duration-200 ease-out sm:max-w-[92vw]",
1158
1166
  // The table lays the fields out as columns: it gets the room for them.
1159
- b === "table" ? "w-[1320px]" : "w-[720px]"
1167
+ p === "table" ? "w-[1320px]" : "w-[720px]"
1160
1168
  ),
1161
1169
  children: /* @__PURE__ */ r("div", { className: "p-6", children: [
1162
- /* @__PURE__ */ r(Da, { children: [
1170
+ /* @__PURE__ */ r(Oa, { children: [
1163
1171
  /* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-2 pr-8", children: [
1164
- /* @__PURE__ */ r(Aa, { className: "flex items-center gap-2 text-base", children: [
1165
- /* @__PURE__ */ t(Me, { className: "h-4 w-4 text-slate-400" }),
1172
+ /* @__PURE__ */ r(Ma, { className: "flex items-center gap-2 text-base", children: [
1173
+ /* @__PURE__ */ t(je, { className: "h-4 w-4 text-slate-400" }),
1166
1174
  "Revision history"
1167
1175
  ] }),
1168
- /* @__PURE__ */ t(pr, { view: b, onChange: C })
1176
+ /* @__PURE__ */ t(br, { view: p, onChange: _ })
1169
1177
  ] }),
1170
- /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: b === "table" ? "Each save is a row and each field a column — read down a column to follow it over time, totals included." : "Who changed what, when — expand any entry to see the exact values, revert a single field, or restore the whole version." })
1178
+ /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: p === "table" ? "Each save is a row and each field a column — read down a column to follow it over time, totals included." : "Who changed what, when — expand any entry to see the exact values, revert a single field, or restore the whole version." })
1171
1179
  ] }),
1172
- b === "table" ? /* @__PURE__ */ t(
1173
- br,
1180
+ p === "table" ? /* @__PURE__ */ t(
1181
+ yr,
1174
1182
  {
1175
1183
  collection: e,
1176
- item: l,
1184
+ item: n,
1177
1185
  onOpenSave: (y) => {
1178
- R(y.startsWith("move|") ? null : y), f("timeline");
1186
+ $(y.startsWith("move|") ? null : y), v("timeline");
1179
1187
  }
1180
1188
  }
1181
- ) : /* @__PURE__ */ r(ee, { children: [
1182
- /* @__PURE__ */ t(dr, { collection: e, item: l }),
1183
- /* @__PURE__ */ t(La, { collection: e, item: String(l) }),
1189
+ ) : /* @__PURE__ */ r(X, { children: [
1190
+ /* @__PURE__ */ t(pr, { collection: e, item: n }),
1191
+ /* @__PURE__ */ t(ja, { collection: e, item: String(n) }),
1184
1192
  /* @__PURE__ */ t(
1185
- ir,
1193
+ mr,
1186
1194
  {
1187
1195
  collection: e,
1188
- item: l,
1196
+ item: n,
1189
1197
  onRollback: i,
1190
- inlineTableFields: m,
1198
+ inlineTableFields: h,
1191
1199
  focusSave: u
1192
1200
  }
1193
1201
  )
@@ -1197,97 +1205,97 @@ function Xr({
1197
1205
  )
1198
1206
  ] });
1199
1207
  }
1200
- function dr({ collection: e, item: l }) {
1201
- const i = pe(), a = He(e, !0), [m, o] = L(""), [p, s] = L(""), { data: g, isFetching: c } = le({
1202
- queryKey: ["rev-value-search", e, l, p],
1203
- queryFn: () => i.request(ae("/revisions/value-search", { collection: e, item: l, q: p })).then((b) => b.data),
1204
- enabled: p.length >= 2
1208
+ function pr({ collection: e, item: n }) {
1209
+ const i = ce(), a = We(e, !0), [h, o] = D(""), [b, l] = D(""), { data: g, isFetching: c } = ne({
1210
+ queryKey: ["rev-value-search", e, n, b],
1211
+ queryFn: () => i.request(Z("/revisions/value-search", { collection: e, item: n, q: b })).then((p) => p.data),
1212
+ enabled: b.length >= 2
1205
1213
  });
1206
1214
  return /* @__PURE__ */ r("div", { className: "mt-3", children: [
1207
1215
  /* @__PURE__ */ r("div", { className: "relative", children: [
1208
- /* @__PURE__ */ t(Ht, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
1216
+ /* @__PURE__ */ t(Qt, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
1209
1217
  /* @__PURE__ */ t(
1210
1218
  "input",
1211
1219
  {
1212
- value: m,
1213
- onChange: (b) => o(b.target.value),
1214
- onKeyDown: (b) => {
1215
- b.key === "Enter" && s(m.trim());
1220
+ value: h,
1221
+ onChange: (p) => o(p.target.value),
1222
+ onKeyDown: (p) => {
1223
+ p.key === "Enter" && l(h.trim());
1216
1224
  },
1217
1225
  placeholder: "Search this record’s history for a value — who wrote it, and when",
1218
1226
  className: "h-8 w-full rounded-md border border-slate-200 bg-background pl-8 pr-8 text-[12.5px] outline-none focus:border-nvr-cyan dark:border-border"
1219
1227
  }
1220
1228
  ),
1221
- p && /* @__PURE__ */ t(
1229
+ b && /* @__PURE__ */ t(
1222
1230
  "button",
1223
1231
  {
1224
1232
  type: "button",
1225
1233
  onClick: () => {
1226
- o(""), s("");
1234
+ o(""), l("");
1227
1235
  },
1228
1236
  className: "absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",
1229
1237
  "aria-label": "Clear search",
1230
- children: /* @__PURE__ */ t(pt, { className: "h-3.5 w-3.5" })
1238
+ children: /* @__PURE__ */ t(ht, { className: "h-3.5 w-3.5" })
1231
1239
  }
1232
1240
  )
1233
1241
  ] }),
1234
- p && /* @__PURE__ */ t("div", { className: "mt-2 space-y-1.5 rounded-lg border border-slate-200 p-2.5 dark:border-border", children: c ? /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-400", children: "Searching…" }) : ((g == null ? void 0 : g.matches) ?? []).length === 0 ? /* @__PURE__ */ r("p", { className: "text-[11.5px] text-slate-400", children: [
1242
+ b && /* @__PURE__ */ t("div", { className: "mt-2 space-y-1.5 rounded-lg border border-slate-200 p-2.5 dark:border-border", children: c ? /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-400", children: "Searching…" }) : ((g == null ? void 0 : g.matches) ?? []).length === 0 ? /* @__PURE__ */ r("p", { className: "text-[11.5px] text-slate-400", children: [
1235
1243
  "“",
1236
- p,
1244
+ b,
1237
1245
  "” never appears in this record’s recorded changes."
1238
- ] }) : /* @__PURE__ */ r(ee, { children: [
1239
- g == null ? void 0 : g.matches.map((b) => /* @__PURE__ */ r("div", { className: "text-[11.5px]", children: [
1240
- /* @__PURE__ */ t("p", { className: "text-slate-600 dark:text-slate-300", children: b.fields.map((f) => /* @__PURE__ */ r("span", { children: [
1241
- /* @__PURE__ */ t("span", { className: "font-medium", title: f.field, children: $(a, f.field).label }),
1246
+ ] }) : /* @__PURE__ */ r(X, { children: [
1247
+ g == null ? void 0 : g.matches.map((p) => /* @__PURE__ */ r("div", { className: "text-[11.5px]", children: [
1248
+ /* @__PURE__ */ t("p", { className: "text-slate-600 dark:text-slate-300", children: p.fields.map((v) => /* @__PURE__ */ r("span", { children: [
1249
+ /* @__PURE__ */ t("span", { className: "font-medium", title: v.field, children: T(a, v.field).label }),
1242
1250
  " ",
1243
1251
  "→ “",
1244
- f.value.length > 60 ? `${f.value.slice(0, 60)}…` : f.value,
1252
+ v.value.length > 60 ? `${v.value.slice(0, 60)}…` : v.value,
1245
1253
  "”",
1246
1254
  " "
1247
- ] }, f.field)) }),
1255
+ ] }, v.field)) }),
1248
1256
  /* @__PURE__ */ r("p", { className: "text-[10.5px] text-slate-400", children: [
1249
- b.user_name ?? "System",
1257
+ p.user_name ?? "System",
1250
1258
  " · ",
1251
- b.timestamp ? Z(b.timestamp) : "",
1259
+ p.timestamp ? G(p.timestamp) : "",
1252
1260
  " ·",
1253
1261
  " ",
1254
- b.action
1262
+ p.action
1255
1263
  ] })
1256
- ] }, b.revision_id)),
1264
+ ] }, p.revision_id)),
1257
1265
  (g == null ? void 0 : g.truncated) && /* @__PURE__ */ t("p", { className: "text-[10.5px] text-amber-600", children: "Showing the newest 200 matches." })
1258
1266
  ] }) })
1259
1267
  ] });
1260
1268
  }
1261
- function cr({ revisionId: e }) {
1262
- const l = pe(), i = Se(), [a, m] = L(""), { data: o = [] } = le({
1269
+ function hr({ revisionId: e }) {
1270
+ const n = ce(), i = $e(), [a, h] = D(""), { data: o = [] } = ne({
1263
1271
  queryKey: ["revision-notes", String(e)],
1264
- queryFn: () => l.request(ae("/comments", { collection: "nivaro_revisions", item: String(e) })).then((s) => s.data ?? []).catch(() => []),
1272
+ queryFn: () => n.request(Z("/comments", { collection: "nivaro_revisions", item: String(e) })).then((l) => l.data ?? []).catch(() => []),
1265
1273
  staleTime: 3e4
1266
- }), p = Oe({
1267
- mutationFn: () => l.request(
1268
- ke("/comments", { collection: "nivaro_revisions", item: String(e), text: a })
1274
+ }), b = Me({
1275
+ mutationFn: () => n.request(
1276
+ Ne("/comments", { collection: "nivaro_revisions", item: String(e), text: a })
1269
1277
  ),
1270
1278
  onSuccess: () => {
1271
- m(""), i.invalidateQueries({ queryKey: ["revision-notes", String(e)] });
1279
+ h(""), i.invalidateQueries({ queryKey: ["revision-notes", String(e)] });
1272
1280
  },
1273
1281
  onError: () => se.error("Note failed")
1274
1282
  });
1275
1283
  return /* @__PURE__ */ r("div", { className: "rounded-md border border-slate-100 bg-slate-50/60 p-2 dark:border-border/60 dark:bg-muted/30", children: [
1276
- o.map((s) => /* @__PURE__ */ r("p", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children: [
1277
- s.text,
1284
+ o.map((l) => /* @__PURE__ */ r("p", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children: [
1285
+ l.text,
1278
1286
  " ",
1279
1287
  /* @__PURE__ */ r("span", { className: "text-[10px] text-slate-400", children: [
1280
1288
  "— ",
1281
- s.user_name ?? "someone",
1289
+ l.user_name ?? "someone",
1282
1290
  " · ",
1283
- be(s.created_at)
1291
+ fe(l.created_at)
1284
1292
  ] })
1285
- ] }, s.id)),
1293
+ ] }, l.id)),
1286
1294
  /* @__PURE__ */ r(
1287
1295
  "form",
1288
1296
  {
1289
- onSubmit: (s) => {
1290
- s.preventDefault(), a.trim() && p.mutate();
1297
+ onSubmit: (l) => {
1298
+ l.preventDefault(), a.trim() && b.mutate();
1291
1299
  },
1292
1300
  className: "mt-1 flex gap-1.5",
1293
1301
  children: [
@@ -1295,7 +1303,7 @@ function cr({ revisionId: e }) {
1295
1303
  "input",
1296
1304
  {
1297
1305
  value: a,
1298
- onChange: (s) => m(s.target.value),
1306
+ onChange: (l) => h(l.target.value),
1299
1307
  placeholder: "Annotate this revision…",
1300
1308
  className: "h-6 flex-1 rounded border border-slate-200 bg-transparent px-1.5 text-[11.5px] outline-none dark:border-border"
1301
1309
  }
@@ -1304,7 +1312,7 @@ function cr({ revisionId: e }) {
1304
1312
  "button",
1305
1313
  {
1306
1314
  type: "submit",
1307
- disabled: p.isPending,
1315
+ disabled: b.isPending,
1308
1316
  className: "rounded bg-nvr-cyan px-2 text-[11px] font-semibold text-white disabled:opacity-50",
1309
1317
  children: "Add"
1310
1318
  }
@@ -1314,13 +1322,13 @@ function cr({ revisionId: e }) {
1314
1322
  )
1315
1323
  ] });
1316
1324
  }
1317
- function _e({
1325
+ function Te({
1318
1326
  userId: e,
1319
- name: l,
1327
+ name: n,
1320
1328
  size: i = "md"
1321
1329
  }) {
1322
- const a = i === "sm" ? "h-5 w-5 text-[9px]" : "h-6 w-6 text-[10px]", m = l.split(" ").map((p) => p[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() || "·", o = /* @__PURE__ */ t(
1323
- fa,
1330
+ const a = i === "sm" ? "h-5 w-5 text-[9px]" : "h-6 w-6 text-[10px]", h = n.split(" ").map((b) => b[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() || "·", o = /* @__PURE__ */ t(
1331
+ va,
1324
1332
  {
1325
1333
  userId: e,
1326
1334
  className: a,
@@ -1331,34 +1339,34 @@ function _e({
1331
1339
  "flex shrink-0 items-center justify-center rounded-full bg-nvr-cyan/10 font-semibold text-nvr-navy dark:text-nvr-cyan",
1332
1340
  a
1333
1341
  ),
1334
- children: m
1342
+ children: h
1335
1343
  }
1336
1344
  )
1337
1345
  }
1338
1346
  );
1339
- return e ? /* @__PURE__ */ t(ba, { userId: e, children: /* @__PURE__ */ t(
1347
+ return e ? /* @__PURE__ */ t(ya, { userId: e, children: /* @__PURE__ */ t(
1340
1348
  "button",
1341
1349
  {
1342
1350
  type: "button",
1343
- "aria-label": `${l} — open profile card`,
1351
+ "aria-label": `${n} — open profile card`,
1344
1352
  "data-revision-avatar": !0,
1345
- onClick: (p) => p.stopPropagation(),
1353
+ onClick: (b) => b.stopPropagation(),
1346
1354
  className: "shrink-0 rounded-full transition-shadow hover:ring-2 hover:ring-nvr-cyan/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
1347
1355
  children: o
1348
1356
  }
1349
1357
  ) }) : /* @__PURE__ */ t("span", { className: "shrink-0", children: o });
1350
1358
  }
1351
- const $t = "nvr:revisions-view";
1352
- function mr() {
1359
+ const Ft = "nvr:revisions-view";
1360
+ function ur() {
1353
1361
  try {
1354
- return localStorage.getItem($t) === "table" ? "table" : "timeline";
1362
+ return localStorage.getItem(Ft) === "table" ? "table" : "timeline";
1355
1363
  } catch {
1356
1364
  return "timeline";
1357
1365
  }
1358
1366
  }
1359
- function pr({
1367
+ function br({
1360
1368
  view: e,
1361
- onChange: l
1369
+ onChange: n
1362
1370
  }) {
1363
1371
  return /* @__PURE__ */ t(
1364
1372
  "fieldset",
@@ -1367,23 +1375,23 @@ function pr({
1367
1375
  "data-revision-view-switch": !0,
1368
1376
  className: "m-0 inline-flex min-w-0 shrink-0 rounded-lg border border-slate-200 bg-slate-100 p-0.5 dark:border-border dark:bg-muted",
1369
1377
  children: [
1370
- { v: "timeline", label: "Timeline", icon: zt },
1371
- { v: "table", label: "Table", icon: Bt }
1372
- ].map(({ v: a, label: m, icon: o }) => {
1373
- const p = e === a;
1378
+ { v: "timeline", label: "Timeline", icon: Ht },
1379
+ { v: "table", label: "Table", icon: Wt }
1380
+ ].map(({ v: a, label: h, icon: o }) => {
1381
+ const b = e === a;
1374
1382
  return /* @__PURE__ */ r(
1375
1383
  "button",
1376
1384
  {
1377
1385
  type: "button",
1378
- "aria-pressed": p,
1379
- onClick: () => l(a),
1386
+ "aria-pressed": b,
1387
+ onClick: () => n(a),
1380
1388
  className: j(
1381
1389
  "inline-flex h-7 items-center gap-1.5 rounded-md px-3 text-[12px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
1382
- p ? "bg-white text-slate-900 shadow-[0_1px_2px_rgba(15,23,42,0.08)] dark:bg-card dark:text-slate-100" : "text-slate-500 hover:text-slate-800 dark:text-slate-400 dark:hover:text-slate-200"
1390
+ b ? "bg-white text-slate-900 shadow-[0_1px_2px_rgba(15,23,42,0.08)] dark:bg-card dark:text-slate-100" : "text-slate-500 hover:text-slate-800 dark:text-slate-400 dark:hover:text-slate-200"
1383
1391
  ),
1384
1392
  children: [
1385
1393
  /* @__PURE__ */ t(o, { className: "h-3.5 w-3.5" }),
1386
- m
1394
+ h
1387
1395
  ]
1388
1396
  },
1389
1397
  a
@@ -1392,39 +1400,39 @@ function pr({
1392
1400
  }
1393
1401
  );
1394
1402
  }
1395
- function xe(e, l) {
1396
- return e == null || e === "" ? "" : ye(e) ? Nt(e) : l.cmp && typeof e != "object" && !l.dateOnly ? Be(e, l.cmp) : kt(e, l.dateOnly);
1403
+ function xe(e, n) {
1404
+ return e == null || e === "" ? "" : ve(e) ? St(e) : n.cmp && typeof e != "object" && !n.dateOnly ? Ue(e, n.cmp) : Nt(e, n.dateOnly);
1397
1405
  }
1398
- function we(e, l, i) {
1399
- const a = $(i, e);
1400
- return Ia(
1406
+ function Ce(e, n, i) {
1407
+ const a = T(i, e);
1408
+ return za(
1401
1409
  e,
1402
- l,
1410
+ n,
1403
1411
  a.derive ?? null,
1404
- (m, o) => m == null ? $(i, o ?? "").label : o ? ge(o.replace(/_/g, " ")) : ge(m.replace(/_/g, " ")),
1405
- (m) => hr(m, a)
1412
+ (h, o) => h == null ? T(i, o ?? "").label : o ? ye(o.replace(/_/g, " ")) : ye(h.replace(/_/g, " ")),
1413
+ (h) => xr(h, a)
1406
1414
  );
1407
1415
  }
1408
- const it = (e) => e == null || e === "", dt = (e) => ye(e) || typeof e == "string" && e.length > 60;
1409
- function hr(e, l) {
1410
- if (!l.cmp) return Ka(e);
1411
- const i = Be(Math.abs(e), l.cmp);
1416
+ const dt = (e) => e == null || e === "", ct = (e) => ve(e) || typeof e == "string" && e.length > 60;
1417
+ function xr(e, n) {
1418
+ if (!n.cmp) return Ba(e);
1419
+ const i = Ue(Math.abs(e), n.cmp);
1412
1420
  return `${e > 0 ? "+" : e < 0 ? "−" : ""}${i}`;
1413
1421
  }
1414
- function ur({
1422
+ function fr({
1415
1423
  field: e,
1416
- label: l,
1424
+ label: n,
1417
1425
  tag: i,
1418
1426
  onRemove: a
1419
1427
  }) {
1420
- const { attributes: m, listeners: o, setNodeRef: p, transform: s, transition: g, isDragging: c } = Kt({
1428
+ const { attributes: h, listeners: o, setNodeRef: b, transform: l, transition: g, isDragging: c } = Bt({
1421
1429
  id: e
1422
1430
  });
1423
1431
  return /* @__PURE__ */ r(
1424
1432
  "div",
1425
1433
  {
1426
- ref: p,
1427
- style: { transform: Vt.Transform.toString(s), transition: g },
1434
+ ref: b,
1435
+ style: { transform: Ut.Transform.toString(l), transition: g },
1428
1436
  "data-shown-field": e,
1429
1437
  className: j(
1430
1438
  "flex items-center gap-2 rounded-sm px-2 py-1.5 text-[12px] hover:bg-slate-50 dark:hover:bg-muted/60",
@@ -1435,101 +1443,101 @@ function ur({
1435
1443
  "button",
1436
1444
  {
1437
1445
  type: "button",
1438
- "aria-label": `Drag to move ${l}`,
1446
+ "aria-label": `Drag to move ${n}`,
1439
1447
  className: "cursor-grab touch-none rounded p-0.5 text-slate-400 hover:text-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan active:cursor-grabbing dark:hover:text-slate-200",
1440
- ...m,
1448
+ ...h,
1441
1449
  ...o,
1442
- onKeyDown: (b) => {
1443
- var f;
1444
- b.stopPropagation(), (f = o == null ? void 0 : o.onKeyDown) == null || f.call(o, b);
1450
+ onKeyDown: (p) => {
1451
+ var v;
1452
+ p.stopPropagation(), (v = o == null ? void 0 : o.onKeyDown) == null || v.call(o, p);
1445
1453
  },
1446
- children: /* @__PURE__ */ t(ht, { className: "h-3.5 w-3.5" })
1454
+ children: /* @__PURE__ */ t(ut, { className: "h-3.5 w-3.5" })
1447
1455
  }
1448
1456
  ),
1449
1457
  /* @__PURE__ */ t(
1450
- Pe,
1458
+ Ee,
1451
1459
  {
1452
1460
  checked: !0,
1453
1461
  onCheckedChange: () => a(),
1454
- "aria-label": `Hide ${l}`,
1462
+ "aria-label": `Hide ${n}`,
1455
1463
  className: "h-3.5 w-3.5"
1456
1464
  }
1457
1465
  ),
1458
- /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", children: l }),
1466
+ /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", children: n }),
1459
1467
  i
1460
1468
  ]
1461
1469
  }
1462
1470
  );
1463
1471
  }
1464
- function xr({
1472
+ function gr({
1465
1473
  columns: e,
1466
- meta: l,
1474
+ meta: n,
1467
1475
  order: i,
1468
1476
  shown: a,
1469
- defaultOrder: m,
1477
+ defaultOrder: h,
1470
1478
  saved: o,
1471
- onChange: p,
1472
- onReset: s
1479
+ onChange: b,
1480
+ onReset: l
1473
1481
  }) {
1474
- const [g, c] = L(!1), [b, f] = L(""), k = O(() => new Map(e.map((x) => [x.field, x])), [e]), u = i.filter((x) => k.has(x)), R = At(
1475
- Ge(Lt, { activationConstraint: { distance: 4 } }),
1476
- Ge(Ot, { coordinateGetter: qt })
1477
- ), C = (x) => {
1478
- const w = u.indexOf(String(x.active.id)), F = x.over ? u.indexOf(String(x.over.id)) : -1;
1479
- if (w < 0 || F < 0 || w === F) return;
1480
- const q = It(u, w, F);
1481
- let I = 0;
1482
- p(i.map((M) => k.has(M) ? q[I++] : M));
1483
- }, y = (x) => p(a.has(x) ? i.filter((w) => w !== x) : [...i, x]), S = O(() => {
1484
- const x = e.filter((M) => !a.has(M.field)), w = [], F = /* @__PURE__ */ new Set(), q = (M, P, W) => {
1485
- const B = W.filter((J) => !F.has(J.field));
1486
- for (const J of B) F.add(J.field);
1487
- B.length && w.push({ key: M, label: P, items: B });
1482
+ const [g, c] = D(!1), [p, v] = D(""), k = A(() => new Map(e.map((m) => [m.field, m])), [e]), u = i.filter((m) => k.has(m)), $ = Mt(
1483
+ Ze(jt, { activationConstraint: { distance: 4 } }),
1484
+ Ze(qt, { coordinateGetter: It })
1485
+ ), _ = (m) => {
1486
+ const C = u.indexOf(String(m.active.id)), w = m.over ? u.indexOf(String(m.over.id)) : -1;
1487
+ if (C < 0 || w < 0 || C === w) return;
1488
+ const M = zt(u, C, w);
1489
+ let q = 0;
1490
+ b(i.map((O) => k.has(O) ? M[q++] : O));
1491
+ }, y = (m) => b(a.has(m) ? i.filter((C) => C !== m) : [...i, m]), L = A(() => {
1492
+ const m = e.filter((O) => !a.has(O.field)), C = [], w = /* @__PURE__ */ new Set(), M = (O, I, z) => {
1493
+ const B = z.filter((Q) => !w.has(Q.field));
1494
+ for (const Q of B) w.add(Q.field);
1495
+ B.length && C.push({ key: O, label: I, items: B });
1488
1496
  };
1489
- q(
1497
+ M(
1490
1498
  "changed",
1491
1499
  "Changed on this record",
1492
- x.filter((M) => M.changes > 0 && !M.field.startsWith("child:")).sort((M, P) => P.changes - M.changes)
1493
- ), q(
1500
+ m.filter((O) => O.changes > 0 && !O.field.startsWith("child:")).sort((O, I) => I.changes - O.changes)
1501
+ ), M(
1494
1502
  "computed",
1495
1503
  "Totals and calculated fields",
1496
- x.filter((M) => $(l, M.field).derive)
1504
+ m.filter((O) => T(n, O.field).derive)
1497
1505
  );
1498
- const I = /* @__PURE__ */ new Map();
1499
- for (const M of x) {
1500
- const P = $(l, M.field).section;
1501
- if (!P) continue;
1502
- const W = I.get(P.key) ?? { label: P.label, sort: P.sort, items: [] };
1503
- W.items.push(M), I.set(P.key, W);
1506
+ const q = /* @__PURE__ */ new Map();
1507
+ for (const O of m) {
1508
+ const I = T(n, O.field).section;
1509
+ if (!I) continue;
1510
+ const z = q.get(I.key) ?? { label: I.label, sort: I.sort, items: [] };
1511
+ z.items.push(O), q.set(I.key, z);
1504
1512
  }
1505
- for (const [M, P] of [...I].sort((W, B) => W[1].sort - B[1].sort))
1506
- q(`section:${M}`, P.label, P.items);
1507
- return q("other", "Other fields", x), w;
1508
- }, [e, a, l]), T = (x) => /* @__PURE__ */ t(
1513
+ for (const [O, I] of [...q].sort((z, B) => z[1].sort - B[1].sort))
1514
+ M(`section:${O}`, I.label, I.items);
1515
+ return M("other", "Other fields", m), C;
1516
+ }, [e, a, n]), E = (m) => /* @__PURE__ */ t(
1509
1517
  "span",
1510
1518
  {
1511
1519
  className: j(
1512
1520
  "flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-sm border",
1513
- x ? "border-nvr-cyan bg-nvr-cyan text-white" : "border-slate-300 dark:border-slate-600"
1521
+ m ? "border-nvr-cyan bg-nvr-cyan text-white" : "border-slate-300 dark:border-slate-600"
1514
1522
  ),
1515
- children: x && /* @__PURE__ */ t(Gt, { className: "h-3 w-3" })
1523
+ children: m && /* @__PURE__ */ t(ea, { className: "h-3 w-3" })
1516
1524
  }
1517
- ), v = (x) => /* @__PURE__ */ r("span", { className: "ml-auto flex shrink-0 items-center gap-1.5 text-[11px] text-slate-400", children: [
1518
- $(l, x.field).derive && /* @__PURE__ */ t(Ne, { className: "h-3 w-3", "aria-label": "Calculated" }),
1519
- x.changes > 0 && /* @__PURE__ */ r("span", { className: "tabular-nums", children: [
1520
- x.changes,
1525
+ ), f = (m) => /* @__PURE__ */ r("span", { className: "ml-auto flex shrink-0 items-center gap-1.5 text-[11px] text-slate-400", children: [
1526
+ T(n, m.field).derive && /* @__PURE__ */ t(Se, { className: "h-3 w-3", "aria-label": "Calculated" }),
1527
+ m.changes > 0 && /* @__PURE__ */ r("span", { className: "tabular-nums", children: [
1528
+ m.changes,
1521
1529
  "×"
1522
1530
  ] })
1523
1531
  ] });
1524
- return /* @__PURE__ */ r(Sa, { open: g, onOpenChange: c, children: [
1525
- /* @__PURE__ */ t(_a, { asChild: !0, children: /* @__PURE__ */ r(
1532
+ return /* @__PURE__ */ r(Ta, { open: g, onOpenChange: c, children: [
1533
+ /* @__PURE__ */ t(Ra, { asChild: !0, children: /* @__PURE__ */ r(
1526
1534
  "button",
1527
1535
  {
1528
1536
  type: "button",
1529
1537
  "data-revision-columns": !0,
1530
1538
  className: "inline-flex h-8 shrink-0 items-center gap-2 whitespace-nowrap rounded-md border border-slate-200 bg-white px-2.5 text-[12px] text-slate-700 transition-colors hover:border-slate-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:border-border dark:bg-card dark:text-slate-200",
1531
1539
  children: [
1532
- /* @__PURE__ */ t(Wt, { className: "h-3.5 w-3.5 text-slate-400" }),
1540
+ /* @__PURE__ */ t(Yt, { className: "h-3.5 w-3.5 text-slate-400" }),
1533
1541
  /* @__PURE__ */ r("span", { children: [
1534
1542
  "Fields ",
1535
1543
  /* @__PURE__ */ t("span", { className: "tabular-nums text-slate-400", children: u.length }),
@@ -1538,18 +1546,18 @@ function xr({
1538
1546
  e.length
1539
1547
  ] })
1540
1548
  ] }),
1541
- /* @__PURE__ */ t(Jt, { className: "h-3.5 w-3.5 text-slate-400" })
1549
+ /* @__PURE__ */ t(Gt, { className: "h-3.5 w-3.5 text-slate-400" })
1542
1550
  ]
1543
1551
  }
1544
1552
  ) }),
1545
- /* @__PURE__ */ t($a, { align: "start", className: "w-[380px] p-0", children: /* @__PURE__ */ r(ga, { children: [
1553
+ /* @__PURE__ */ t(Fa, { align: "start", className: "w-[380px] p-0", children: /* @__PURE__ */ r(ka, { children: [
1546
1554
  /* @__PURE__ */ t(
1547
- ya,
1555
+ wa,
1548
1556
  {
1549
1557
  placeholder: "Find a field…",
1550
1558
  className: "text-[12px]",
1551
- value: b,
1552
- onValueChange: f
1559
+ value: p,
1560
+ onValueChange: v
1553
1561
  }
1554
1562
  ),
1555
1563
  /* @__PURE__ */ r("div", { className: "flex items-center gap-1 border-b border-slate-100 px-2 py-1.5 text-[11.5px] dark:border-border/60", children: [
@@ -1557,7 +1565,7 @@ function xr({
1557
1565
  "button",
1558
1566
  {
1559
1567
  type: "button",
1560
- onClick: () => p(m),
1568
+ onClick: () => b(h),
1561
1569
  className: "rounded px-2 py-0.5 text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-muted",
1562
1570
  children: "Changed fields"
1563
1571
  }
@@ -1566,7 +1574,7 @@ function xr({
1566
1574
  "button",
1567
1575
  {
1568
1576
  type: "button",
1569
- onClick: () => p(e.map((x) => x.field)),
1577
+ onClick: () => b(e.map((m) => m.field)),
1570
1578
  className: "rounded px-2 py-0.5 text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-muted",
1571
1579
  children: "All"
1572
1580
  }
@@ -1575,7 +1583,7 @@ function xr({
1575
1583
  "button",
1576
1584
  {
1577
1585
  type: "button",
1578
- onClick: () => p([]),
1586
+ onClick: () => b([]),
1579
1587
  className: "rounded px-2 py-0.5 text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-muted",
1580
1588
  children: "None"
1581
1589
  }
@@ -1584,206 +1592,206 @@ function xr({
1584
1592
  "button",
1585
1593
  {
1586
1594
  type: "button",
1587
- onClick: s,
1595
+ onClick: l,
1588
1596
  className: "ml-auto rounded px-2 py-0.5 text-slate-500 hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-muted",
1589
1597
  "data-tip": "Forget your columns for this collection and go back to the fields that changed",
1590
1598
  children: "Reset"
1591
1599
  }
1592
1600
  )
1593
1601
  ] }),
1594
- /* @__PURE__ */ r(va, { className: "max-h-[420px]", children: [
1595
- /* @__PURE__ */ t(ka, { children: "No field by that name." }),
1596
- u.length > 0 && !b.trim() && /* @__PURE__ */ r("div", { className: "px-1 pb-1", "data-shown-columns": !0, children: [
1602
+ /* @__PURE__ */ r(Na, { className: "max-h-[420px]", children: [
1603
+ /* @__PURE__ */ t(Ca, { children: "No field by that name." }),
1604
+ u.length > 0 && !p.trim() && /* @__PURE__ */ r("div", { className: "px-1 pb-1", "data-shown-columns": !0, children: [
1597
1605
  /* @__PURE__ */ t("p", { className: "px-2 pb-1 pt-2 text-[11px] font-medium text-slate-500 dark:text-slate-400", children: "Shown, in this order — drag to move" }),
1598
1606
  /* @__PURE__ */ t(
1599
- Mt,
1607
+ Pt,
1600
1608
  {
1601
- sensors: R,
1602
- collisionDetection: jt,
1603
- onDragEnd: C,
1604
- children: /* @__PURE__ */ t(Pt, { items: u, strategy: Et, children: u.map((x) => {
1605
- const w = k.get(x);
1609
+ sensors: $,
1610
+ collisionDetection: Et,
1611
+ onDragEnd: _,
1612
+ children: /* @__PURE__ */ t(Kt, { items: u, strategy: Vt, children: u.map((m) => {
1613
+ const C = k.get(m);
1606
1614
  return /* @__PURE__ */ t(
1607
- ur,
1615
+ fr,
1608
1616
  {
1609
- field: x,
1610
- label: w.label,
1611
- tag: v(w),
1612
- onRemove: () => y(x)
1617
+ field: m,
1618
+ label: C.label,
1619
+ tag: f(C),
1620
+ onRemove: () => y(m)
1613
1621
  },
1614
- x
1622
+ m
1615
1623
  );
1616
1624
  }) })
1617
1625
  }
1618
1626
  )
1619
1627
  ] }),
1620
- u.length > 0 && b.trim() !== "" && /* @__PURE__ */ t(tt, { heading: "Shown", children: u.map((x) => {
1621
- const w = k.get(x);
1628
+ u.length > 0 && p.trim() !== "" && /* @__PURE__ */ t(at, { heading: "Shown", children: u.map((m) => {
1629
+ const C = k.get(m);
1622
1630
  return /* @__PURE__ */ r(
1623
- at,
1631
+ rt,
1624
1632
  {
1625
- value: `${w.label} ${x} shown`,
1626
- onSelect: () => y(x),
1633
+ value: `${C.label} ${m} shown`,
1634
+ onSelect: () => y(m),
1627
1635
  className: "text-[12px]",
1628
1636
  children: [
1629
- T(!0),
1630
- /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", children: w.label }),
1631
- v(w)
1637
+ E(!0),
1638
+ /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", children: C.label }),
1639
+ f(C)
1632
1640
  ]
1633
1641
  },
1634
- `shown-${x}`
1642
+ `shown-${m}`
1635
1643
  );
1636
1644
  }) }),
1637
- S.map((x) => /* @__PURE__ */ t(tt, { heading: x.label, children: x.items.map((w) => /* @__PURE__ */ r(
1638
- at,
1645
+ L.map((m) => /* @__PURE__ */ t(at, { heading: m.label, children: m.items.map((C) => /* @__PURE__ */ r(
1646
+ rt,
1639
1647
  {
1640
- value: `${w.label} ${w.field} ${x.label}`,
1641
- onSelect: () => y(w.field),
1648
+ value: `${C.label} ${C.field} ${m.label}`,
1649
+ onSelect: () => y(C.field),
1642
1650
  className: "text-[12px]",
1643
1651
  children: [
1644
- T(!1),
1645
- /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", children: w.label }),
1646
- v(w)
1652
+ E(!1),
1653
+ /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", children: C.label }),
1654
+ f(C)
1647
1655
  ]
1648
1656
  },
1649
- `${x.key}-${w.field}`
1650
- )) }, x.key))
1657
+ `${m.key}-${C.field}`
1658
+ )) }, m.key))
1651
1659
  ] }),
1652
1660
  /* @__PURE__ */ t("p", { className: "border-t border-slate-100 px-3 py-1.5 text-[11px] text-slate-500 dark:border-border/60 dark:text-slate-400", children: "Saved to your account for every record of this kind. Drag here or drag a column header to move it." })
1653
1661
  ] }) })
1654
1662
  ] });
1655
1663
  }
1656
- const ct = {
1664
+ const mt = {
1657
1665
  created: "bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",
1658
1666
  changed: "bg-slate-100 text-slate-600 dark:bg-muted dark:text-slate-300",
1659
1667
  deleted: "bg-red-50 text-red-700 dark:bg-red-500/10 dark:text-red-300",
1660
1668
  restored: "bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",
1661
1669
  moved: "bg-violet-50 text-violet-700 dark:bg-violet-500/10 dark:text-violet-300"
1662
1670
  };
1663
- function br({
1671
+ function yr({
1664
1672
  collection: e,
1665
- item: l,
1673
+ item: n,
1666
1674
  onOpenSave: i
1667
1675
  }) {
1668
- var Qe, Ye;
1669
- const a = pe(), m = He(e, !0), { data: o, isLoading: p } = le({
1670
- queryKey: ["revisions", e, l],
1671
- queryFn: () => a.request(ae("/revisions", { collection: e, item: l })).then((n) => n.data ?? []),
1676
+ var Ye, Ge;
1677
+ const a = ce(), h = We(e, !0), { data: o, isLoading: b } = ne({
1678
+ queryKey: ["revisions", e, n],
1679
+ queryFn: () => a.request(Z("/revisions", { collection: e, item: n })).then((s) => s.data ?? []),
1672
1680
  staleTime: 3e4
1673
- }), s = Se();
1674
- bt(e, l, [["revisions", e, l]], { client: s });
1675
- const g = O(
1676
- () => (o ?? []).filter((n) => n.actor && n.actor.kind !== "person").map((n) => ({ action: n.action, user: n.user_id, actor: n.actor })),
1681
+ }), l = $e();
1682
+ ft(e, n, [["revisions", e, n]], { client: l });
1683
+ const g = A(
1684
+ () => (o ?? []).filter((s) => s.actor && s.actor.kind !== "person").map((s) => ({ action: s.action, user: s.user_id, actor: s.actor })),
1677
1685
  [o]
1678
- ), c = gt(g, { enabled: g.length > 0 }), b = O(
1679
- () => vt(o ?? [], {
1680
- name: (n) => te(n, c),
1686
+ ), c = yt(g, { enabled: g.length > 0 }), p = Rt(e, n), v = A(
1687
+ () => kt(wt(o ?? [], p), {
1688
+ name: (s) => ee(s, c),
1681
1689
  // Pipeline moves are rows of their own while the Pipeline step column is shown.
1682
1690
  withMoves: !0
1683
1691
  }),
1684
- [o, c]
1685
- ), { data: f } = le({
1686
- queryKey: ["revision-child-columns", e, l],
1687
- queryFn: () => a.request(ae("/revisions/child-columns", { collection: e, item: l })).then((n) => n.data),
1692
+ [o, c, p]
1693
+ ), { data: k } = ne({
1694
+ queryKey: ["revision-child-columns", e, n],
1695
+ queryFn: () => a.request(Z("/revisions/child-columns", { collection: e, item: n })).then((s) => s.data),
1688
1696
  staleTime: 3e4
1689
- }), k = O(() => {
1690
- const n = new Map(m);
1691
- for (const d of (f == null ? void 0 : f.columns) ?? [])
1692
- n.set(d.key, {
1697
+ }), u = A(() => {
1698
+ const s = new Map(h);
1699
+ for (const d of (k == null ? void 0 : k.columns) ?? [])
1700
+ s.set(d.key, {
1693
1701
  label: `${d.row_label} · ${d.field_label}`,
1694
1702
  system: !1,
1695
1703
  onLayout: !1,
1696
1704
  cmp: d.cmp,
1697
1705
  section: { key: `child:${d.collection}`, label: d.collection_label, sort: 1e5 }
1698
1706
  });
1699
- return n;
1700
- }, [m, f]), u = O(() => {
1701
- const n = (f == null ? void 0 : f.columns) ?? [];
1702
- if (!n.length) return b;
1703
- const d = b.map((N) => ({ ...N, values: { ...N.values }, changed: new Set(N.changed) }));
1704
- for (const N of n) {
1705
- const _ = (f == null ? void 0 : f.series[N.key]) ?? [];
1706
- for (const V of d) V.values[N.key] = Oa(_, V.timestamp);
1707
+ return s;
1708
+ }, [h, k]), $ = A(() => {
1709
+ const s = (k == null ? void 0 : k.columns) ?? [];
1710
+ if (!s.length) return v;
1711
+ const d = v.map((N) => ({ ...N, values: { ...N.values }, changed: new Set(N.changed) }));
1712
+ for (const N of s) {
1713
+ const S = (k == null ? void 0 : k.series[N.key]) ?? [];
1714
+ for (const V of d) V.values[N.key] = qa(S, V.timestamp);
1707
1715
  for (let V = 0; V < d.length - 1; V++)
1708
- Ma(d[V].values[N.key], d[V + 1].values[N.key]) || d[V].changed.add(N.key);
1716
+ Pa(d[V].values[N.key], d[V + 1].values[N.key]) || d[V].changed.add(N.key);
1709
1717
  }
1710
1718
  return d;
1711
- }, [b, f]), R = O(
1712
- () => ja(u, (n) => $(k, n)),
1713
- [u, k]
1714
- ), C = ft(e), y = ma(e), { isAdmin: S } = sa(), T = O(
1715
- () => R.filter((n) => n.changes > 0 && !n.field.startsWith("child:")).map((n) => n.field),
1716
- [R]
1717
- ), v = C.columns ?? ((Qe = y.roleDefault) == null ? void 0 : Qe.fields) ?? T, x = O(() => new Set(v), [v]), w = O(() => {
1718
- const n = new Map(R.map((d) => [d.field, d]));
1719
- return v.map((d) => n.get(d)).filter((d) => !!d);
1720
- }, [v, R]), F = (n) => C.setColumns([...new Set(n)]), [q, I] = L(null), [M, P] = L(null), W = (n, d) => {
1721
- if (n === d) return;
1722
- const N = v.filter((V) => V !== n), _ = N.indexOf(d);
1723
- F(_ < 0 ? [...N, n] : [...N.slice(0, _), n, ...N.slice(_)]);
1724
- }, B = ze(null), [J, he] = L(!0), de = aa(), [h, D] = L(""), [U, K] = L(""), [X, $e] = L(/* @__PURE__ */ new Set()), A = O(() => {
1725
- const n = /* @__PURE__ */ new Map();
1726
- for (const d of u) n.set(d.who, (n.get(d.who) ?? 0) + 1);
1727
- return [...n].map(([d, N]) => ({ name: d, count: N })).sort((d, N) => N.count - d.count);
1728
- }, [u]), z = O(() => {
1729
- let n = x.has(fe) ? u : u.filter((d) => d.action !== "moved");
1730
- return n = n.filter(
1731
- (d) => Va(d.timestamp, h, U) && (X.size === 0 || X.has(d.who))
1732
- ), J ? qa(
1733
- n,
1719
+ }, [v, k]), _ = A(
1720
+ () => Ea($, (s) => T(u, s)),
1721
+ [$, u]
1722
+ ), y = gt(e), L = ua(e), { isAdmin: E } = oa(), f = A(
1723
+ () => _.filter((s) => s.changes > 0 && !s.field.startsWith("child:")).map((s) => s.field),
1724
+ [_]
1725
+ ), m = y.columns ?? ((Ye = L.roleDefault) == null ? void 0 : Ye.fields) ?? f, C = A(() => new Set(m), [m]), w = A(() => {
1726
+ const s = new Map(_.map((d) => [d.field, d]));
1727
+ return m.map((d) => s.get(d)).filter((d) => !!d);
1728
+ }, [m, _]), M = (s) => y.setColumns([...new Set(s)]), [q, O] = D(null), [I, z] = D(null), B = (s, d) => {
1729
+ if (s === d) return;
1730
+ const N = m.filter((V) => V !== s), S = N.indexOf(d);
1731
+ M(S < 0 ? [...N, s] : [...N.slice(0, S), s, ...N.slice(S)]);
1732
+ }, Q = Be(null), [le, ue] = D(!0), x = na(), [R, Y] = D(""), [K, me] = D(""), [be, F] = D(/* @__PURE__ */ new Set()), U = A(() => {
1733
+ const s = /* @__PURE__ */ new Map();
1734
+ for (const d of $) s.set(d.who, (s.get(d.who) ?? 0) + 1);
1735
+ return [...s].map(([d, N]) => ({ name: d, count: N })).sort((d, N) => N.count - d.count);
1736
+ }, [$]), W = A(() => {
1737
+ let s = C.has(ge) ? $ : $.filter((d) => d.action !== "moved");
1738
+ return s = s.filter(
1739
+ (d) => Ua(d.timestamp, R, K) && (be.size === 0 || be.has(d.who))
1740
+ ), le ? Ia(
1741
+ s,
1734
1742
  w.map((d) => d.field)
1735
- ) : n;
1736
- }, [u, w, x, J, h, U, X]), [Y, ue] = L([]), Te = (n) => ue((d) => d.includes(n) ? d.filter((N) => N !== n) : [...d, n].slice(-2)), G = O(() => {
1737
- if (Y.length !== 2) return null;
1738
- const n = Y.map((N) => u.find((_) => _.key === N)).filter((N) => !!N);
1739
- if (n.length !== 2) return null;
1743
+ ) : s;
1744
+ }, [$, w, C, le, R, K, be]), [te, ke] = D([]), Re = (s) => ke((d) => d.includes(s) ? d.filter((N) => N !== s) : [...d, s].slice(-2)), ae = A(() => {
1745
+ if (te.length !== 2) return null;
1746
+ const s = te.map((N) => $.find((S) => S.key === N)).filter((N) => !!N);
1747
+ if (s.length !== 2) return null;
1740
1748
  const d = (N) => N.timestamp ? new Date(N.timestamp).getTime() : 0;
1741
- return n.sort((N, _) => d(N) - d(_));
1742
- }, [Y, u]), [re, Je] = L(null), Re = O(() => {
1749
+ return s.sort((N, S) => d(N) - d(S));
1750
+ }, [te, $]), [re, Qe] = D(null), Fe = A(() => {
1743
1751
  var N;
1744
1752
  if (!re) return null;
1745
- const n = $(k, re), d = [...u].filter((_) => re === fe ? !0 : _.action !== "moved").reverse();
1753
+ const s = T(u, re), d = [...$].filter((S) => re === ge ? !0 : S.action !== "moved").reverse();
1746
1754
  return {
1747
- label: ((N = w.find((_) => _.field === re)) == null ? void 0 : N.label) ?? n.label,
1748
- points: d.map((_) => ({
1749
- t: _.timestamp,
1750
- v: _.values[re],
1751
- text: xe(_.values[re], n)
1755
+ label: ((N = w.find((S) => S.field === re)) == null ? void 0 : N.label) ?? s.label,
1756
+ points: d.map((S) => ({
1757
+ t: S.timestamp,
1758
+ v: S.values[re],
1759
+ text: xe(S.values[re], s)
1752
1760
  }))
1753
1761
  };
1754
- }, [re, u, k, w]), { data: Tt } = le({
1762
+ }, [re, $, u, w]), { data: Dt } = ne({
1755
1763
  queryKey: ["revision-sets-roles"],
1756
- queryFn: () => a.request(ae("/roles")).then((n) => (n.data ?? []).map((d) => ({ id: String(d.id), name: String(d.name) }))),
1757
- enabled: S,
1764
+ queryFn: () => a.request(Z("/roles")).then((s) => (s.data ?? []).map((d) => ({ id: String(d.id), name: String(d.name) }))),
1765
+ enabled: E,
1758
1766
  staleTime: 3e5
1759
- }), Fe = (n) => n.action === "moved" && !n.userId ? `Automatic${n.trigger ? ` (after ${n.trigger.name})` : ""}` : n.who, Rt = () => {
1760
- const d = [["When", "Changed by", "Action", ...w.map((E) => E.label)].map((E) => ({ v: E, style: "header" }))], N = [
1761
- ["When", "Field", "Value", "Moved by", "Why"].map((E) => ({ v: E, style: "header" }))
1767
+ }), De = (s) => s.action === "moved" && !s.userId ? `Automatic${s.trigger ? ` (after ${s.trigger.name})` : ""}` : s.who, Lt = () => {
1768
+ const d = [["When", "Changed by", "Action", ...w.map((P) => P.label)].map((P) => ({ v: P, style: "header" }))], N = [
1769
+ ["When", "Field", "Value", "Moved by", "Why"].map((P) => ({ v: P, style: "header" }))
1762
1770
  ];
1763
- for (const E of z) {
1764
- const ce = E.timestamp ? Z(E.timestamp) : "";
1771
+ for (const P of W) {
1772
+ const pe = P.timestamp ? G(P.timestamp) : "";
1765
1773
  d.push([
1766
- { v: ce },
1767
- { v: Fe(E) },
1768
- { v: st(E.action), style: "muted" },
1769
- ...w.map((Q) => {
1770
- const me = xe(E.values[Q.field], $(k, Q.field)), Dt = E.recalculated.has(Q.field) ? "recalculated" : E.changed.has(Q.field) ? "changed" : "plain";
1771
- return { v: me, style: Dt };
1774
+ { v: pe },
1775
+ { v: De(P) },
1776
+ { v: nt(P.action), style: "muted" },
1777
+ ...w.map((J) => {
1778
+ const he = xe(P.values[J.field], T(u, J.field)), Ot = P.recalculated.has(J.field) ? "recalculated" : P.changed.has(J.field) ? "changed" : "plain";
1779
+ return { v: he, style: Ot };
1772
1780
  })
1773
1781
  ]);
1774
- for (const Q of w) {
1775
- if (!E.recalculated.has(Q.field)) continue;
1776
- const me = we(Q.field, E, k);
1782
+ for (const J of w) {
1783
+ if (!P.recalculated.has(J.field)) continue;
1784
+ const he = Ce(J.field, P, u);
1777
1785
  N.push([
1778
- { v: ce },
1779
- { v: Q.label },
1780
- { v: xe(E.values[Q.field], $(k, Q.field)) },
1781
- { v: me.because ?? "" },
1782
- { v: me.why }
1786
+ { v: pe },
1787
+ { v: J.label },
1788
+ { v: xe(P.values[J.field], T(u, J.field)) },
1789
+ { v: he.because ?? "" },
1790
+ { v: he.why }
1783
1791
  ]);
1784
1792
  }
1785
1793
  }
1786
- const _ = pa([
1794
+ const S = ba([
1787
1795
  {
1788
1796
  name: "History",
1789
1797
  rows: d,
@@ -1791,84 +1799,84 @@ function br({
1791
1799
  20,
1792
1800
  26,
1793
1801
  10,
1794
- ...w.map((E) => Math.min(40, Math.max(14, E.label.length + 4)))
1802
+ ...w.map((P) => Math.min(40, Math.max(14, P.label.length + 4)))
1795
1803
  ],
1796
1804
  freezeColumns: 3
1797
1805
  },
1798
1806
  { name: "Recalculations", rows: N, widths: [20, 24, 18, 40, 50] }
1799
- ]), V = URL.createObjectURL(_), H = document.createElement("a");
1800
- H.href = V, H.download = `history-${e}-${l}.xlsx`, document.body.appendChild(H), H.click(), H.remove(), setTimeout(() => URL.revokeObjectURL(V), 1e3);
1801
- }, Ft = () => {
1802
- const n = Ea(
1803
- z,
1807
+ ]), V = URL.createObjectURL(S), H = document.createElement("a");
1808
+ H.href = V, H.download = `history-${e}-${n}.xlsx`, document.body.appendChild(H), H.click(), H.remove(), setTimeout(() => URL.revokeObjectURL(V), 1e3);
1809
+ }, At = () => {
1810
+ const s = Va(
1811
+ W,
1804
1812
  w,
1805
- (V, H) => xe(H, $(k, V)),
1806
- (V, H) => we(V, H, k)
1807
- ), d = new Blob([n], { type: "text/csv;charset=utf-8" }), N = URL.createObjectURL(d), _ = document.createElement("a");
1808
- _.href = N, _.download = `history-${e}-${l}.csv`, document.body.appendChild(_), _.click(), _.remove(), setTimeout(() => URL.revokeObjectURL(N), 1e3);
1813
+ (V, H) => xe(H, T(u, V)),
1814
+ (V, H) => Ce(V, H, u)
1815
+ ), d = new Blob([s], { type: "text/csv;charset=utf-8" }), N = URL.createObjectURL(d), S = document.createElement("a");
1816
+ S.href = N, S.download = `history-${e}-${n}.csv`, document.body.appendChild(S), S.click(), S.remove(), setTimeout(() => URL.revokeObjectURL(N), 1e3);
1809
1817
  };
1810
- return p ? /* @__PURE__ */ t("div", { className: "space-y-2 pt-4", children: [1, 2, 3, 4, 5].map((n) => /* @__PURE__ */ t(yt, { className: "h-9 rounded-md" }, n)) }) : /* @__PURE__ */ r("div", { className: "pt-4", "data-revision-table-view": !0, children: [
1818
+ return b ? /* @__PURE__ */ t("div", { className: "space-y-2 pt-4", children: [1, 2, 3, 4, 5].map((s) => /* @__PURE__ */ t(vt, { className: "h-9 rounded-md" }, s)) }) : /* @__PURE__ */ r("div", { className: "pt-4", "data-revision-table-view": !0, children: [
1811
1819
  /* @__PURE__ */ r("div", { className: "mb-3 flex items-center gap-2 overflow-x-auto pb-0.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", children: [
1812
1820
  /* @__PURE__ */ t(
1813
- xr,
1821
+ gr,
1814
1822
  {
1815
- columns: R,
1816
- meta: k,
1817
- order: v,
1818
- shown: x,
1819
- defaultOrder: T,
1820
- saved: C.columns != null,
1821
- onChange: F,
1822
- onReset: () => C.setColumns(null)
1823
+ columns: _,
1824
+ meta: u,
1825
+ order: m,
1826
+ shown: C,
1827
+ defaultOrder: f,
1828
+ saved: y.columns != null,
1829
+ onChange: M,
1830
+ onReset: () => y.setColumns(null)
1823
1831
  }
1824
1832
  ),
1825
1833
  /* @__PURE__ */ t(
1826
- za,
1834
+ Ha,
1827
1835
  {
1828
- personal: C.personalSets,
1829
- shared: y.sets,
1830
- roleDefaultName: ((Ye = y.roleDefault) == null ? void 0 : Ye.name) ?? null,
1831
- isAdmin: S,
1832
- roles: Tt ?? [],
1833
- onApply: (n) => F(n),
1834
- onSavePersonal: (n) => C.setPersonalSets([
1835
- ...C.personalSets.filter((d) => d.name.toLowerCase() !== n.toLowerCase()),
1836
- { name: n, fields: v }
1836
+ personal: y.personalSets,
1837
+ shared: L.sets,
1838
+ roleDefaultName: ((Ge = L.roleDefault) == null ? void 0 : Ge.name) ?? null,
1839
+ isAdmin: E,
1840
+ roles: Dt ?? [],
1841
+ onApply: (s) => M(s),
1842
+ onSavePersonal: (s) => y.setPersonalSets([
1843
+ ...y.personalSets.filter((d) => d.name.toLowerCase() !== s.toLowerCase()),
1844
+ { name: s, fields: m }
1837
1845
  ]),
1838
- onDeletePersonal: (n) => C.setPersonalSets(C.personalSets.filter((d) => d.name !== n)),
1839
- onShare: (n, d, N) => void y.save([
1840
- ...y.sets.filter((_) => _.name.toLowerCase() !== n.toLowerCase()).map((_) => N ? { ..._, is_default: !1 } : _),
1841
- { name: n, fields: v, default_roles: d, is_default: N }
1842
- ]).catch((_) => Ae(_, "The column set was not shared")),
1843
- onSetDefault: (n) => void y.save(y.sets.map((d) => ({ ...d, is_default: n != null && d.id === n }))).catch((d) => Ae(d, "The default column set was not changed")),
1844
- onDeleteShared: (n) => void y.save(y.sets.filter((d) => d.id !== n)).catch((d) => Ae(d, "The column set was not deleted"))
1846
+ onDeletePersonal: (s) => y.setPersonalSets(y.personalSets.filter((d) => d.name !== s)),
1847
+ onShare: (s, d, N) => void L.save([
1848
+ ...L.sets.filter((S) => S.name.toLowerCase() !== s.toLowerCase()).map((S) => N ? { ...S, is_default: !1 } : S),
1849
+ { name: s, fields: m, default_roles: d, is_default: N }
1850
+ ]).catch((S) => Ae(S, "The column set was not shared")),
1851
+ onSetDefault: (s) => void L.save(L.sets.map((d) => ({ ...d, is_default: s != null && d.id === s }))).catch((d) => Ae(d, "The default column set was not changed")),
1852
+ onDeleteShared: (s) => void L.save(L.sets.filter((d) => d.id !== s)).catch((d) => Ae(d, "The column set was not deleted"))
1845
1853
  }
1846
1854
  ),
1847
- /* @__PURE__ */ t(Ba, { people: A, value: X, onChange: $e }),
1855
+ /* @__PURE__ */ t(Wa, { people: U, value: be, onChange: F }),
1848
1856
  /* @__PURE__ */ t(
1849
- Ua,
1857
+ Ja,
1850
1858
  {
1851
- from: h,
1852
- to: U,
1853
- onChange: (n, d) => {
1854
- D(n), K(d);
1859
+ from: R,
1860
+ to: K,
1861
+ onChange: (s, d) => {
1862
+ Y(s), me(d);
1855
1863
  }
1856
1864
  }
1857
1865
  ),
1858
1866
  /* @__PURE__ */ r("span", { className: "inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap", children: [
1859
1867
  /* @__PURE__ */ t(
1860
- Pe,
1868
+ Ee,
1861
1869
  {
1862
- id: de,
1863
- checked: J,
1864
- onCheckedChange: (n) => he(n === !0),
1870
+ id: x,
1871
+ checked: le,
1872
+ onCheckedChange: (s) => ue(s === !0),
1865
1873
  className: "h-3.5 w-3.5"
1866
1874
  }
1867
1875
  ),
1868
1876
  /* @__PURE__ */ t(
1869
1877
  "label",
1870
1878
  {
1871
- htmlFor: de,
1879
+ htmlFor: x,
1872
1880
  className: "cursor-pointer select-none text-[12px] text-slate-600 dark:text-slate-300",
1873
1881
  "data-tip": "Only saves that changed at least one of the shown fields",
1874
1882
  children: "Changed saves only"
@@ -1881,7 +1889,7 @@ function br({
1881
1889
  "Changed"
1882
1890
  ] }),
1883
1891
  /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1", children: [
1884
- /* @__PURE__ */ t(Ne, { className: "h-3 w-3" }),
1892
+ /* @__PURE__ */ t(Se, { className: "h-3 w-3" }),
1885
1893
  "Recalculated"
1886
1894
  ] }),
1887
1895
  /* @__PURE__ */ t(
@@ -1890,36 +1898,36 @@ function br({
1890
1898
  className: "tabular-nums",
1891
1899
  "aria-live": "polite",
1892
1900
  "data-tip": "Tick two saves to compare them · click a column title to see it over time",
1893
- children: Y.length === 1 ? "Tick one more to compare" : `${z.length} save${z.length === 1 ? "" : "s"}`
1901
+ children: te.length === 1 ? "Tick one more to compare" : `${W.length} save${W.length === 1 ? "" : "s"}`
1894
1902
  }
1895
1903
  )
1896
1904
  ] }),
1897
- /* @__PURE__ */ r(wa, { children: [
1898
- /* @__PURE__ */ t(Na, { asChild: !0, children: /* @__PURE__ */ r(
1899
- oe,
1905
+ /* @__PURE__ */ r(Sa, { children: [
1906
+ /* @__PURE__ */ t(_a, { asChild: !0, children: /* @__PURE__ */ r(
1907
+ ie,
1900
1908
  {
1901
1909
  variant: "outline",
1902
1910
  size: "sm",
1903
1911
  className: "h-8 shrink-0 gap-1.5 text-[12px]",
1904
- disabled: z.length === 0 || w.length === 0,
1912
+ disabled: W.length === 0 || w.length === 0,
1905
1913
  "data-revision-download": !0,
1906
1914
  children: [
1907
- /* @__PURE__ */ t(Ze, { className: "h-3.5 w-3.5" }),
1915
+ /* @__PURE__ */ t(Xe, { className: "h-3.5 w-3.5" }),
1908
1916
  "Download",
1909
- /* @__PURE__ */ t(Ke, { className: "h-3 w-3 text-slate-400" })
1917
+ /* @__PURE__ */ t(Ve, { className: "h-3 w-3 text-slate-400" })
1910
1918
  ]
1911
1919
  }
1912
1920
  ) }),
1913
- /* @__PURE__ */ r(Ca, { align: "end", className: "w-[240px]", children: [
1914
- /* @__PURE__ */ r(rt, { onSelect: Rt, className: "gap-2 text-[12px]", children: [
1915
- /* @__PURE__ */ t(Ut, { className: "h-3.5 w-3.5" }),
1921
+ /* @__PURE__ */ r($a, { align: "end", className: "w-[240px]", children: [
1922
+ /* @__PURE__ */ r(st, { onSelect: Lt, className: "gap-2 text-[12px]", children: [
1923
+ /* @__PURE__ */ t(Jt, { className: "h-3.5 w-3.5" }),
1916
1924
  /* @__PURE__ */ r("span", { className: "flex flex-col", children: [
1917
1925
  "Excel",
1918
1926
  /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-500", children: "Changed cells shaded, a sheet of why values moved" })
1919
1927
  ] })
1920
1928
  ] }),
1921
- /* @__PURE__ */ r(rt, { onSelect: Ft, className: "gap-2 text-[12px]", children: [
1922
- /* @__PURE__ */ t(Ze, { className: "h-3.5 w-3.5" }),
1929
+ /* @__PURE__ */ r(st, { onSelect: At, className: "gap-2 text-[12px]", children: [
1930
+ /* @__PURE__ */ t(Xe, { className: "h-3.5 w-3.5" }),
1923
1931
  /* @__PURE__ */ r("span", { className: "flex flex-col", children: [
1924
1932
  "CSV",
1925
1933
  /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-500", children: "Plain values, any spreadsheet" })
@@ -1928,52 +1936,52 @@ function br({
1928
1936
  ] })
1929
1937
  ] })
1930
1938
  ] }),
1931
- G && /* @__PURE__ */ r(
1939
+ ae && /* @__PURE__ */ r(
1932
1940
  "div",
1933
1941
  {
1934
1942
  className: "mb-3 rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card",
1935
1943
  "data-revision-compare": !0,
1936
1944
  children: [
1937
1945
  /* @__PURE__ */ r("div", { className: "mb-2 flex items-center gap-2 text-[12.5px]", children: [
1938
- /* @__PURE__ */ t(mt, { className: "h-3.5 w-3.5 text-slate-400" }),
1946
+ /* @__PURE__ */ t(pt, { className: "h-3.5 w-3.5 text-slate-400" }),
1939
1947
  /* @__PURE__ */ r("span", { className: "font-medium text-slate-800 dark:text-slate-100", children: [
1940
- G[0].timestamp ? Z(G[0].timestamp) : "",
1948
+ ae[0].timestamp ? G(ae[0].timestamp) : "",
1941
1949
  " ·",
1942
1950
  " ",
1943
- Fe(G[0])
1951
+ De(ae[0])
1944
1952
  ] }),
1945
- /* @__PURE__ */ t(Ve, { className: "h-3 w-3 text-slate-400" }),
1953
+ /* @__PURE__ */ t(ze, { className: "h-3 w-3 text-slate-400" }),
1946
1954
  /* @__PURE__ */ r("span", { className: "font-medium text-slate-800 dark:text-slate-100", children: [
1947
- G[1].timestamp ? Z(G[1].timestamp) : "",
1955
+ ae[1].timestamp ? G(ae[1].timestamp) : "",
1948
1956
  " ·",
1949
1957
  " ",
1950
- Fe(G[1])
1958
+ De(ae[1])
1951
1959
  ] }),
1952
1960
  /* @__PURE__ */ t(
1953
1961
  "button",
1954
1962
  {
1955
1963
  type: "button",
1956
- onClick: () => ue([]),
1964
+ onClick: () => ke([]),
1957
1965
  "aria-label": "Close the comparison",
1958
1966
  className: "ml-auto rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
1959
- children: /* @__PURE__ */ t(pt, { className: "h-3.5 w-3.5" })
1967
+ children: /* @__PURE__ */ t(ht, { className: "h-3.5 w-3.5" })
1960
1968
  }
1961
1969
  )
1962
1970
  ] }),
1963
1971
  /* @__PURE__ */ t("div", { className: "max-h-[320px] overflow-y-auto", children: /* @__PURE__ */ t(
1964
- _t,
1972
+ Tt,
1965
1973
  {
1966
- before: G[0].values,
1967
- after: G[1].values,
1968
- meta: k,
1974
+ before: ae[0].values,
1975
+ after: ae[1].values,
1976
+ meta: u,
1969
1977
  mode: "changes"
1970
1978
  }
1971
1979
  ) })
1972
1980
  ]
1973
1981
  }
1974
1982
  ),
1975
- Re && /* @__PURE__ */ t(Ha, { label: Re.label, points: Re.points, onClose: () => Je(null) }),
1976
- b.length === 0 ? /* @__PURE__ */ r("div", { className: "rounded-lg border border-dashed border-slate-200 py-12 text-center dark:border-border", children: [
1983
+ Fe && /* @__PURE__ */ t(Qa, { label: Fe.label, points: Fe.points, onClose: () => Qe(null) }),
1984
+ v.length === 0 ? /* @__PURE__ */ r("div", { className: "rounded-lg border border-dashed border-slate-200 py-12 text-center dark:border-border", children: [
1977
1985
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-600 dark:text-slate-300", children: "No saves yet" }),
1978
1986
  /* @__PURE__ */ t("p", { className: "mx-auto mt-1 max-w-[42ch] text-[12px] text-slate-400", children: "Every save records the whole record — each one will be a row here." })
1979
1987
  ] }) : w.length === 0 ? /* @__PURE__ */ r("div", { className: "rounded-lg border border-dashed border-slate-200 py-12 text-center dark:border-border", children: [
@@ -1997,60 +2005,60 @@ function br({
1997
2005
  /* @__PURE__ */ t(
1998
2006
  "div",
1999
2007
  {
2000
- ref: B,
2008
+ ref: Q,
2001
2009
  className: "max-h-[calc(100vh-250px)] overflow-y-auto overflow-x-hidden",
2002
2010
  "data-revision-table-scroll": !0,
2003
2011
  children: /* @__PURE__ */ r("table", { className: "border-separate border-spacing-0 text-left text-[12px]", children: [
2004
2012
  /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ r("tr", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: [
2005
2013
  /* @__PURE__ */ t("th", { className: "sticky left-0 top-0 z-[3] w-[112px] min-w-[112px] border-b border-r border-slate-200 bg-slate-50 px-3 py-2 font-medium dark:border-border dark:bg-muted", children: "When" }),
2006
2014
  /* @__PURE__ */ t("th", { className: "sticky left-[112px] top-0 z-[3] w-[176px] min-w-[176px] border-b border-r border-slate-200 bg-slate-50 px-3 py-2 font-medium dark:border-border dark:bg-muted", children: "Changed by" }),
2007
- w.map((n) => /* @__PURE__ */ t(
2015
+ w.map((s) => /* @__PURE__ */ t(
2008
2016
  "th",
2009
2017
  {
2010
2018
  draggable: !0,
2011
2019
  onDragStart: (d) => {
2012
- I(n.field), d.dataTransfer.effectAllowed = "move", d.dataTransfer.setData("text/plain", n.field);
2020
+ O(s.field), d.dataTransfer.effectAllowed = "move", d.dataTransfer.setData("text/plain", s.field);
2013
2021
  },
2014
2022
  onDragOver: (d) => {
2015
- q && (d.preventDefault(), M !== n.field && P(n.field));
2023
+ q && (d.preventDefault(), I !== s.field && z(s.field));
2016
2024
  },
2017
- onDragLeave: () => P((d) => d === n.field ? null : d),
2025
+ onDragLeave: () => z((d) => d === s.field ? null : d),
2018
2026
  onDrop: (d) => {
2019
- d.preventDefault(), q && W(q, n.field), I(null), P(null);
2027
+ d.preventDefault(), q && B(q, s.field), O(null), z(null);
2020
2028
  },
2021
2029
  onDragEnd: () => {
2022
- I(null), P(null);
2030
+ O(null), z(null);
2023
2031
  },
2024
- onClick: () => Je((d) => d === n.field ? null : n.field),
2032
+ onClick: () => Qe((d) => d === s.field ? null : s.field),
2025
2033
  "aria-sort": "none",
2026
- "data-tip": `${n.label} — click to see it over time, drag to move`,
2034
+ "data-tip": `${s.label} — click to see it over time, drag to move`,
2027
2035
  className: j(
2028
2036
  "group/th sticky top-0 z-[2] min-w-[132px] max-w-[260px] cursor-grab border-b border-slate-200 bg-slate-50 px-3 py-2 font-medium active:cursor-grabbing dark:border-border dark:bg-muted",
2029
- re === n.field && "bg-[#e6faff] text-slate-800 dark:bg-[#0b2a33] dark:text-slate-100",
2030
- q === n.field && "opacity-40",
2031
- M === n.field && q !== n.field && "shadow-[inset_2px_0_0_0_rgb(var(--nvr-cyan-rgb,0_206_255))]"
2037
+ re === s.field && "bg-[#e6faff] text-slate-800 dark:bg-[#0b2a33] dark:text-slate-100",
2038
+ q === s.field && "opacity-40",
2039
+ I === s.field && q !== s.field && "shadow-[inset_2px_0_0_0_rgb(var(--nvr-cyan-rgb,0_206_255))]"
2032
2040
  ),
2033
2041
  children: /* @__PURE__ */ r("span", { className: "flex items-center gap-1", children: [
2034
- /* @__PURE__ */ t(ht, { className: "h-3 w-3 shrink-0 text-slate-300 opacity-0 transition-opacity group-hover/th:opacity-100 dark:text-slate-600" }),
2035
- n.label
2042
+ /* @__PURE__ */ t(ut, { className: "h-3 w-3 shrink-0 text-slate-300 opacity-0 transition-opacity group-hover/th:opacity-100 dark:text-slate-600" }),
2043
+ s.label
2036
2044
  ] })
2037
2045
  },
2038
- n.field
2046
+ s.field
2039
2047
  ))
2040
2048
  ] }) }),
2041
- /* @__PURE__ */ t("tbody", { children: z.map((n) => /* @__PURE__ */ r("tr", { className: "group align-top", "data-save-action": n.action, children: [
2049
+ /* @__PURE__ */ t("tbody", { children: W.map((s) => /* @__PURE__ */ r("tr", { className: "group align-top", "data-save-action": s.action, children: [
2042
2050
  /* @__PURE__ */ t(
2043
2051
  "td",
2044
2052
  {
2045
2053
  className: j(
2046
2054
  "sticky left-0 z-[1] border-b border-r border-slate-100 bg-white px-2 py-2 group-hover:bg-slate-50 dark:border-border/50 dark:bg-card dark:group-hover:bg-muted"
2047
2055
  ),
2048
- children: n.timestamp && /* @__PURE__ */ r("span", { className: "flex items-start gap-1.5", children: [
2056
+ children: s.timestamp && /* @__PURE__ */ r("span", { className: "flex items-start gap-1.5", children: [
2049
2057
  /* @__PURE__ */ t(
2050
- Pe,
2058
+ Ee,
2051
2059
  {
2052
- checked: Y.includes(n.key),
2053
- onCheckedChange: () => Te(n.key),
2060
+ checked: te.includes(s.key),
2061
+ onCheckedChange: () => Re(s.key),
2054
2062
  "aria-label": "Compare this save",
2055
2063
  className: "mt-0.5 h-3.5 w-3.5"
2056
2064
  }
@@ -2059,13 +2067,13 @@ function br({
2059
2067
  "button",
2060
2068
  {
2061
2069
  type: "button",
2062
- onClick: () => i == null ? void 0 : i(n.key),
2070
+ onClick: () => i == null ? void 0 : i(s.key),
2063
2071
  disabled: !i,
2064
- "data-tip": n.action === "moved" ? "Open the Timeline" : "Open this save in Replay",
2072
+ "data-tip": s.action === "moved" ? "Open the Timeline" : "Open this save in Replay",
2065
2073
  className: "block rounded text-left tabular-nums leading-tight hover:text-nvr-navy focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:cursor-default dark:hover:text-nvr-cyan",
2066
2074
  children: [
2067
- /* @__PURE__ */ t("span", { className: "block text-slate-700 dark:text-slate-200", children: be(n.timestamp) }),
2068
- /* @__PURE__ */ t("span", { className: "block text-[11px] text-slate-400", children: new Date(n.timestamp).toLocaleTimeString([], {
2075
+ /* @__PURE__ */ t("span", { className: "block text-slate-700 dark:text-slate-200", children: fe(s.timestamp) }),
2076
+ /* @__PURE__ */ t("span", { className: "block text-[11px] text-slate-400", children: new Date(s.timestamp).toLocaleTimeString([], {
2069
2077
  hour: "numeric",
2070
2078
  minute: "2-digit"
2071
2079
  }) })
@@ -2076,44 +2084,44 @@ function br({
2076
2084
  }
2077
2085
  ),
2078
2086
  /* @__PURE__ */ t("td", { className: "sticky left-[112px] z-[1] border-b border-r border-slate-100 bg-white px-3 py-2 group-hover:bg-slate-50 dark:border-border/50 dark:bg-card dark:group-hover:bg-muted", children: /* @__PURE__ */ r("span", { className: "flex items-center gap-2", children: [
2079
- n.action === "moved" && !n.userId ? /* @__PURE__ */ t(
2087
+ s.action === "moved" && !s.userId ? /* @__PURE__ */ t(
2080
2088
  "span",
2081
2089
  {
2082
2090
  className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-violet-500/10 text-violet-700 dark:text-violet-300",
2083
2091
  "aria-hidden": !0,
2084
- children: /* @__PURE__ */ t(De, { className: "h-3 w-3" })
2092
+ children: /* @__PURE__ */ t(Le, { className: "h-3 w-3" })
2085
2093
  }
2086
- ) : /* @__PURE__ */ t(_e, { userId: n.userId, name: n.who, size: "sm" }),
2094
+ ) : /* @__PURE__ */ t(Te, { userId: s.userId, name: s.who, size: "sm" }),
2087
2095
  /* @__PURE__ */ r("span", { className: "min-w-0", children: [
2088
- /* @__PURE__ */ t("span", { className: "block truncate text-slate-700 dark:text-slate-200", children: n.who }),
2089
- n.action === "moved" && !n.userId && /* @__PURE__ */ t(
2096
+ /* @__PURE__ */ t("span", { className: "block truncate text-slate-700 dark:text-slate-200", children: s.who }),
2097
+ s.action === "moved" && !s.userId && /* @__PURE__ */ t(
2090
2098
  "span",
2091
2099
  {
2092
2100
  className: "block truncate text-[10.5px] text-slate-500 dark:text-slate-400",
2093
2101
  "data-tip": "The pipeline moved it by itself when a step’s condition was met",
2094
- children: n.trigger ? `after ${n.trigger.name}’s save` : "a step’s condition was met"
2102
+ children: s.trigger ? `after ${s.trigger.name}’s save` : "a step’s condition was met"
2095
2103
  }
2096
2104
  ),
2097
- n.action !== "changed" && /* @__PURE__ */ t(
2105
+ s.action !== "changed" && /* @__PURE__ */ t(
2098
2106
  "span",
2099
2107
  {
2100
2108
  className: j(
2101
2109
  "mt-0.5 inline-block rounded px-1.5 py-px text-[10.5px] font-medium",
2102
- ct[n.action]
2110
+ mt[s.action]
2103
2111
  ),
2104
- children: st(n.action)
2112
+ children: nt(s.action)
2105
2113
  }
2106
2114
  ),
2107
- n.autoMove && /* @__PURE__ */ r(
2115
+ s.autoMove && /* @__PURE__ */ r(
2108
2116
  "span",
2109
2117
  {
2110
2118
  className: j(
2111
2119
  "mt-0.5 ml-1 inline-flex items-center gap-0.5 rounded px-1.5 py-px text-[10.5px] font-medium first:ml-0",
2112
- ct.moved
2120
+ mt.moved
2113
2121
  ),
2114
- "data-tip": `This save moved it to ${n.autoMove.to ?? "the next step"} automatically (a step’s condition was met)`,
2122
+ "data-tip": `This save moved it to ${s.autoMove.to ?? "the next step"} automatically (a step’s condition was met)`,
2115
2123
  children: [
2116
- /* @__PURE__ */ t(De, { className: "h-2.5 w-2.5" }),
2124
+ /* @__PURE__ */ t(Le, { className: "h-2.5 w-2.5" }),
2117
2125
  "Moved"
2118
2126
  ]
2119
2127
  }
@@ -2121,33 +2129,33 @@ function br({
2121
2129
  ] })
2122
2130
  ] }) }),
2123
2131
  w.map((d) => {
2124
- const N = $(k, d.field), _ = n.values[d.field], V = n.changed.has(d.field), H = n.recalculated.has(d.field), E = V || H, ce = H ? we(d.field, n, k) : null, Q = ce ? `Recalculated: ${ce.because ? `${ce.because}. ` : ""}${ce.why}` : d.field === fe && n.autoMove ? `Moved automatically by this save: ${n.autoMove.from ?? "—"} → ${n.autoMove.to ?? "—"} (a step’s condition was met)` : void 0, me = _ == null || _ === "";
2132
+ const N = T(u, d.field), S = s.values[d.field], V = s.changed.has(d.field), H = s.recalculated.has(d.field), P = V || H, pe = H ? Ce(d.field, s, u) : null, J = pe ? `Recalculated: ${pe.because ? `${pe.because}. ` : ""}${pe.why}` : d.field === ge && s.autoMove ? `Moved automatically by this save: ${s.autoMove.from ?? "—"} → ${s.autoMove.to ?? "—"} (a step’s condition was met)` : void 0, he = S == null || S === "";
2125
2133
  return /* @__PURE__ */ t(
2126
2134
  "td",
2127
2135
  {
2128
- "data-cell-changed": E || void 0,
2136
+ "data-cell-changed": P || void 0,
2129
2137
  className: j(
2130
2138
  "max-w-[260px] border-b border-slate-100 px-3 py-2 dark:border-border/50",
2131
2139
  re === d.field && "shadow-[inset_1px_0_0_0_rgba(0,206,255,0.35),inset_-1px_0_0_0_rgba(0,206,255,0.35)]",
2132
- E ? "bg-amber-50 group-hover:bg-amber-100/70 dark:bg-amber-500/10 dark:group-hover:bg-amber-500/15" : "group-hover:bg-slate-50 dark:group-hover:bg-muted/40"
2140
+ P ? "bg-amber-50 group-hover:bg-amber-100/70 dark:bg-amber-500/10 dark:group-hover:bg-amber-500/15" : "group-hover:bg-slate-50 dark:group-hover:bg-muted/40"
2133
2141
  ),
2134
2142
  children: /* @__PURE__ */ r(
2135
2143
  "span",
2136
2144
  {
2137
2145
  className: j(
2138
2146
  "flex items-start gap-1",
2139
- E ? "font-medium text-slate-900 dark:text-slate-50" : "text-slate-500 dark:text-slate-400"
2147
+ P ? "font-medium text-slate-900 dark:text-slate-50" : "text-slate-500 dark:text-slate-400"
2140
2148
  ),
2141
2149
  children: [
2142
- d.field === fe && n.autoMove && /* @__PURE__ */ t(
2143
- De,
2150
+ d.field === ge && s.autoMove && /* @__PURE__ */ t(
2151
+ Le,
2144
2152
  {
2145
2153
  className: "mt-[3px] h-3 w-3 shrink-0 text-violet-600 dark:text-violet-300",
2146
2154
  "aria-label": "Moved automatically by this save"
2147
2155
  }
2148
2156
  ),
2149
2157
  H && /* @__PURE__ */ t(
2150
- Ne,
2158
+ Se,
2151
2159
  {
2152
2160
  className: "mt-[3px] h-3 w-3 shrink-0 text-amber-700 dark:text-amber-300",
2153
2161
  "aria-label": "Recalculated"
@@ -2157,8 +2165,8 @@ function br({
2157
2165
  "span",
2158
2166
  {
2159
2167
  className: "line-clamp-3 whitespace-pre-line break-words",
2160
- "data-tip": Q ?? (me ? void 0 : xe(_, N)),
2161
- children: me ? /* @__PURE__ */ t("span", { className: "font-normal italic text-slate-300 dark:text-slate-600", children: E ? "cleared" : "—" }) : N.relatedCollection && (typeof _ == "string" || typeof _ == "number") ? /* @__PURE__ */ t(wt, { collection: N.relatedCollection, id: _ }) : xe(_, N)
2168
+ "data-tip": J ?? (he ? void 0 : xe(S, N)),
2169
+ children: he ? /* @__PURE__ */ t("span", { className: "font-normal italic text-slate-300 dark:text-slate-600", children: P ? "cleared" : "—" }) : N.relatedCollection && (typeof S == "string" || typeof S == "number") ? /* @__PURE__ */ t(Ct, { collection: N.relatedCollection, id: S }) : xe(S, N)
2162
2170
  }
2163
2171
  )
2164
2172
  ]
@@ -2168,68 +2176,68 @@ function br({
2168
2176
  d.field
2169
2177
  );
2170
2178
  })
2171
- ] }, n.key)) })
2179
+ ] }, s.key)) })
2172
2180
  ] })
2173
2181
  }
2174
2182
  ),
2175
- /* @__PURE__ */ t(ua, { scrollerRef: B })
2183
+ /* @__PURE__ */ t(fa, { scrollerRef: Q })
2176
2184
  ] }),
2177
- b.length > 0 && /* @__PURE__ */ t("p", { className: "mt-2 text-[11.5px] text-slate-500 dark:text-slate-400", children: x.has(fe) ? "Line edits that changed no field on this record are in Timeline." : "Add Pipeline step from Fields to see each move as a row. Line edits that changed no field on this record are in Timeline." })
2185
+ v.length > 0 && /* @__PURE__ */ t("p", { className: "mt-2 text-[11.5px] text-slate-500 dark:text-slate-400", children: C.has(ge) ? "Line edits that changed no field on this record are in Timeline." : "Add Pipeline step from Fields to see each move as a row. Line edits that changed no field on this record are in Timeline." })
2178
2186
  ] });
2179
2187
  }
2180
- function fr({
2188
+ function vr({
2181
2189
  snapshots: e,
2182
- history: l,
2190
+ history: n,
2183
2191
  meta: i,
2184
2192
  labels: a,
2185
- startKey: m
2193
+ startKey: h
2186
2194
  }) {
2187
- var J, he, de;
2188
- const o = O(() => [...e].reverse(), [e]), p = O(
2189
- () => vt(l, {
2190
- name: (h) => te(h, a)
2195
+ var Q, le, ue;
2196
+ const o = A(() => [...e].reverse(), [e]), b = A(
2197
+ () => kt(n, {
2198
+ name: (x) => ee(x, a)
2191
2199
  }),
2192
- [l, a]
2193
- ), [s, g] = L(() => {
2194
- const h = m ? o.findIndex((D) => `${D.id}|${D.timestamp ?? ""}` === m) : -1;
2195
- return h >= 0 ? h : Math.max(0, o.length - 1);
2196
- }), [c, b] = L(!1), [f, k] = L(!1), [u, R] = L(""), C = o.length - 1;
2197
- qe(() => {
2198
- s > C && g(Math.max(0, C));
2199
- }, [s, C]), qe(() => {
2200
+ [n, a]
2201
+ ), [l, g] = D(() => {
2202
+ const x = h ? o.findIndex((R) => `${R.id}|${R.timestamp ?? ""}` === h) : -1;
2203
+ return x >= 0 ? x : Math.max(0, o.length - 1);
2204
+ }), [c, p] = D(!1), [v, k] = D(!1), [u, $] = D(""), _ = o.length - 1;
2205
+ Pe(() => {
2206
+ l > _ && g(Math.max(0, _));
2207
+ }, [l, _]), Pe(() => {
2200
2208
  if (!c) return;
2201
- if (s >= C) {
2202
- b(!1);
2209
+ if (l >= _) {
2210
+ p(!1);
2203
2211
  return;
2204
2212
  }
2205
- const h = setTimeout(() => g((D) => D + 1), 1800);
2206
- return () => clearTimeout(h);
2207
- }, [c, s, C]);
2208
- const y = o[s], S = s > 0 ? o[s - 1] : null, T = O(() => {
2213
+ const x = setTimeout(() => g((R) => R + 1), 1800);
2214
+ return () => clearTimeout(x);
2215
+ }, [c, l, _]);
2216
+ const y = o[l], L = l > 0 ? o[l - 1] : null, E = A(() => {
2209
2217
  if (!y) return [];
2210
- const h = St((S == null ? void 0 : S.data) ?? {}, y.data ?? {}, i).filter(
2218
+ const x = $t((L == null ? void 0 : L.data) ?? {}, y.data ?? {}, i).filter(
2211
2219
  (K) => K.status !== "unchanged" && !K.system && K.field !== "id"
2212
2220
  );
2213
- if (!S) return [];
2214
- const D = new Set(Object.keys(y.delta ?? {})), U = S.data ?? {};
2215
- return h.filter((K) => D.has(K.field) || K.field in U).sort((K, X) => +!D.has(K.field) - +!D.has(X.field));
2216
- }, [y, S, i]), v = new Set(Object.keys((y == null ? void 0 : y.delta) ?? {})), x = T.filter((h) => v.has(h.field)).length, w = T.length - x, F = p.find((h) => h.key === `${y == null ? void 0 : y.id}|${(y == null ? void 0 : y.timestamp) ?? ""}`), q = O(
2221
+ if (!L) return [];
2222
+ const R = new Set(Object.keys(y.delta ?? {})), Y = L.data ?? {};
2223
+ return x.filter((K) => R.has(K.field) || K.field in Y).sort((K, me) => +!R.has(K.field) - +!R.has(me.field));
2224
+ }, [y, L, i]), f = new Set(Object.keys((y == null ? void 0 : y.delta) ?? {})), m = E.filter((x) => f.has(x.field)).length, C = E.length - m, w = b.find((x) => x.key === `${y == null ? void 0 : y.id}|${(y == null ? void 0 : y.timestamp) ?? ""}`), M = A(
2217
2225
  () => Object.entries((y == null ? void 0 : y.data) ?? {}).filter(
2218
- ([h, D]) => h !== "id" && D !== null && D !== void 0 && D !== "" && !$(i, h).system
2219
- ).sort(([h], [D]) => $(i, h).label.localeCompare($(i, D).label)),
2226
+ ([x, R]) => x !== "id" && R !== null && R !== void 0 && R !== "" && !T(i, x).system
2227
+ ).sort(([x], [R]) => T(i, x).label.localeCompare(T(i, R).label)),
2220
2228
  [y, i]
2221
- ), I = (h) => {
2222
- b(!1), g(Math.min(C, Math.max(0, h)));
2223
- }, M = (h) => {
2224
- if (R(h), !h) return;
2225
- const D = (/* @__PURE__ */ new Date(`${h}T23:59:59`)).getTime();
2226
- let U = -1;
2227
- o.forEach((K, X) => {
2228
- K.timestamp && new Date(K.timestamp).getTime() <= D && (U = X);
2229
- }), U >= 0 && I(U);
2229
+ ), q = (x) => {
2230
+ p(!1), g(Math.min(_, Math.max(0, x)));
2231
+ }, O = (x) => {
2232
+ if ($(x), !x) return;
2233
+ const R = (/* @__PURE__ */ new Date(`${x}T23:59:59`)).getTime();
2234
+ let Y = -1;
2235
+ o.forEach((K, me) => {
2236
+ K.timestamp && new Date(K.timestamp).getTime() <= R && (Y = me);
2237
+ }), Y >= 0 && q(Y);
2230
2238
  };
2231
2239
  if (!y) return null;
2232
- const P = te(y, a), W = y.action === "create" ? "created the record" : y.action === "delete" ? "deleted the record" : y.action === "restore" ? "restored the record" : x ? `changed ${x} field${x === 1 ? "" : "s"}${w ? ` · ${w} recalculated` : ""}` : w ? `saved the record · ${w} recalculated` : "saved the record", B = u !== "" && ((J = o[0]) == null ? void 0 : J.timestamp) != null && (/* @__PURE__ */ new Date(`${u}T23:59:59`)).getTime() < new Date(o[0].timestamp).getTime();
2240
+ const I = ee(y, a), z = y.action === "create" ? "created the record" : y.action === "delete" ? "deleted the record" : y.action === "restore" ? "restored the record" : m ? `changed ${m} field${m === 1 ? "" : "s"}${C ? ` · ${C} recalculated` : ""}` : C ? `saved the record · ${C} recalculated` : "saved the record", B = u !== "" && ((Q = o[0]) == null ? void 0 : Q.timestamp) != null && (/* @__PURE__ */ new Date(`${u}T23:59:59`)).getTime() < new Date(o[0].timestamp).getTime();
2233
2241
  return /* @__PURE__ */ r(
2234
2242
  "div",
2235
2243
  {
@@ -2245,15 +2253,15 @@ function fr({
2245
2253
  "aria-label": "Save shown",
2246
2254
  "aria-valuemin": 1,
2247
2255
  "aria-valuemax": o.length,
2248
- "aria-valuenow": s + 1,
2249
- "aria-valuetext": `${s + 1} of ${o.length}${y.timestamp ? `, ${Z(y.timestamp)}` : ""}, ${P}`,
2250
- onKeyDown: (h) => {
2251
- if (h.key === "ArrowLeft") I(s - 1);
2252
- else if (h.key === "ArrowRight") I(s + 1);
2253
- else if (h.key === "Home") I(0);
2254
- else if (h.key === "End") I(C);
2256
+ "aria-valuenow": l + 1,
2257
+ "aria-valuetext": `${l + 1} of ${o.length}${y.timestamp ? `, ${G(y.timestamp)}` : ""}, ${I}`,
2258
+ onKeyDown: (x) => {
2259
+ if (x.key === "ArrowLeft") q(l - 1);
2260
+ else if (x.key === "ArrowRight") q(l + 1);
2261
+ else if (x.key === "Home") q(0);
2262
+ else if (x.key === "End") q(_);
2255
2263
  else return;
2256
- h.preventDefault();
2264
+ x.preventDefault();
2257
2265
  },
2258
2266
  className: "relative h-6 rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
2259
2267
  children: [
@@ -2268,22 +2276,22 @@ function fr({
2268
2276
  "span",
2269
2277
  {
2270
2278
  className: "absolute left-2 top-1/2 h-0.5 -translate-y-1/2 bg-nvr-cyan transition-[width] duration-300 ease-out motion-reduce:transition-none",
2271
- style: { width: C > 0 ? `calc((100% - 1rem) * ${s / C})` : "0" },
2279
+ style: { width: _ > 0 ? `calc((100% - 1rem) * ${l / _})` : "0" },
2272
2280
  "aria-hidden": !0
2273
2281
  }
2274
2282
  ),
2275
- o.map((h, D) => {
2276
- const U = C > 0 ? D / C : 0.5, K = D === s;
2283
+ o.map((x, R) => {
2284
+ const Y = _ > 0 ? R / _ : 0.5, K = R === l;
2277
2285
  return /* @__PURE__ */ t(
2278
2286
  "button",
2279
2287
  {
2280
2288
  type: "button",
2281
2289
  tabIndex: -1,
2282
- onClick: () => I(D),
2283
- "aria-label": `${h.timestamp ? Z(h.timestamp) : "Save"} — ${te(h, a)}`,
2284
- "data-tip": `${h.timestamp ? Z(h.timestamp) : ""} · ${te(h, a)}`,
2290
+ onClick: () => q(R),
2291
+ "aria-label": `${x.timestamp ? G(x.timestamp) : "Save"} — ${ee(x, a)}`,
2292
+ "data-tip": `${x.timestamp ? G(x.timestamp) : ""} · ${ee(x, a)}`,
2285
2293
  className: "absolute top-1/2 -translate-x-1/2 -translate-y-1/2 p-1",
2286
- style: { left: `calc(0.5rem + (100% - 1rem) * ${U})` },
2294
+ style: { left: `calc(0.5rem + (100% - 1rem) * ${Y})` },
2287
2295
  children: /* @__PURE__ */ t(
2288
2296
  "span",
2289
2297
  {
@@ -2291,14 +2299,14 @@ function fr({
2291
2299
  "block rounded-full transition-all",
2292
2300
  K ? "h-3 w-3 bg-nvr-cyan ring-4 ring-nvr-cyan/20" : j(
2293
2301
  "h-2 w-2 hover:scale-125",
2294
- D < s ? "bg-nvr-cyan/70" : "bg-slate-300 dark:bg-slate-600",
2295
- h.action === "create" && "bg-emerald-500"
2302
+ R < l ? "bg-nvr-cyan/70" : "bg-slate-300 dark:bg-slate-600",
2303
+ x.action === "create" && "bg-emerald-500"
2296
2304
  )
2297
2305
  )
2298
2306
  }
2299
2307
  )
2300
2308
  },
2301
- ne(h)
2309
+ oe(x)
2302
2310
  );
2303
2311
  })
2304
2312
  ]
@@ -2307,72 +2315,72 @@ function fr({
2307
2315
  /* @__PURE__ */ r("div", { className: "mt-1 flex justify-between text-[10.5px] tabular-nums text-slate-400", children: [
2308
2316
  /* @__PURE__ */ r("span", { children: [
2309
2317
  "Save 1",
2310
- (he = o[0]) != null && he.timestamp ? ` · ${be(o[0].timestamp)}` : ""
2318
+ (le = o[0]) != null && le.timestamp ? ` · ${fe(o[0].timestamp)}` : ""
2311
2319
  ] }),
2312
2320
  /* @__PURE__ */ r("span", { children: [
2313
2321
  "Save ",
2314
2322
  o.length,
2315
- (de = o[C]) != null && de.timestamp ? ` · ${be(o[C].timestamp)}` : ""
2323
+ (ue = o[_]) != null && ue.timestamp ? ` · ${fe(o[_].timestamp)}` : ""
2316
2324
  ] })
2317
2325
  ] })
2318
2326
  ] }),
2319
2327
  /* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-1.5 border-b border-slate-100 px-3 py-2 dark:border-border/60", children: [
2320
2328
  /* @__PURE__ */ t(
2321
- oe,
2329
+ ie,
2322
2330
  {
2323
2331
  variant: "outline",
2324
2332
  size: "sm",
2325
2333
  className: "h-7 w-7 p-0",
2326
- onClick: () => I(s - 1),
2327
- disabled: s === 0,
2334
+ onClick: () => q(l - 1),
2335
+ disabled: l === 0,
2328
2336
  "aria-label": "Previous save",
2329
- children: /* @__PURE__ */ t(Zt, { className: "h-3.5 w-3.5" })
2337
+ children: /* @__PURE__ */ t(ta, { className: "h-3.5 w-3.5" })
2330
2338
  }
2331
2339
  ),
2332
2340
  /* @__PURE__ */ r(
2333
- oe,
2341
+ ie,
2334
2342
  {
2335
2343
  size: "sm",
2336
2344
  className: "h-7 gap-1.5 bg-nvr-cyan px-3 text-[12px] text-white hover:bg-nvr-cyan/90",
2337
2345
  onClick: () => {
2338
- !c && s >= C && g(0), b((h) => !h);
2346
+ !c && l >= _ && g(0), p((x) => !x);
2339
2347
  },
2340
2348
  disabled: o.length < 2,
2341
2349
  "data-replay-play": !0,
2342
2350
  children: [
2343
- c ? /* @__PURE__ */ t(Xt, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(ea, { className: "h-3.5 w-3.5" }),
2344
- c ? "Pause" : s >= C ? "Replay from the start" : "Play"
2351
+ c ? /* @__PURE__ */ t(aa, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(ra, { className: "h-3.5 w-3.5" }),
2352
+ c ? "Pause" : l >= _ ? "Replay from the start" : "Play"
2345
2353
  ]
2346
2354
  }
2347
2355
  ),
2348
2356
  /* @__PURE__ */ t(
2349
- oe,
2357
+ ie,
2350
2358
  {
2351
2359
  variant: "outline",
2352
2360
  size: "sm",
2353
2361
  className: "h-7 w-7 p-0",
2354
- onClick: () => I(s + 1),
2355
- disabled: s >= C,
2362
+ onClick: () => q(l + 1),
2363
+ disabled: l >= _,
2356
2364
  "aria-label": "Next save",
2357
- children: /* @__PURE__ */ t(je, { className: "h-3.5 w-3.5" })
2365
+ children: /* @__PURE__ */ t(qe, { className: "h-3.5 w-3.5" })
2358
2366
  }
2359
2367
  ),
2360
2368
  /* @__PURE__ */ r("span", { className: "ml-1 tabular-nums text-[11.5px] text-slate-500 dark:text-slate-400", children: [
2361
2369
  "Save ",
2362
- s + 1,
2370
+ l + 1,
2363
2371
  " of ",
2364
2372
  o.length,
2365
- s === C ? " · current" : ""
2373
+ l === _ ? " · current" : ""
2366
2374
  ] }),
2367
2375
  /* @__PURE__ */ r("label", { className: "ml-auto inline-flex items-center gap-1.5 text-[11.5px] text-slate-500 dark:text-slate-400", children: [
2368
- /* @__PURE__ */ t(ta, { className: "h-3.5 w-3.5" }),
2376
+ /* @__PURE__ */ t(sa, { className: "h-3.5 w-3.5" }),
2369
2377
  "Jump to",
2370
2378
  /* @__PURE__ */ t(
2371
2379
  "input",
2372
2380
  {
2373
2381
  type: "date",
2374
2382
  value: u,
2375
- onChange: (h) => M(h.target.value),
2383
+ onChange: (x) => O(x.target.value),
2376
2384
  className: "h-7 rounded-md border border-slate-200 bg-white px-2 text-[12px] text-slate-700 dark:border-border dark:bg-card dark:text-slate-200",
2377
2385
  "aria-label": "Jump to the record as it was on a date",
2378
2386
  "data-as-of": !0
@@ -2382,87 +2390,87 @@ function fr({
2382
2390
  ] }),
2383
2391
  /* @__PURE__ */ r("div", { className: "px-3 py-3", children: [
2384
2392
  /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
2385
- /* @__PURE__ */ t(_e, { userId: y.user_id, name: P }),
2393
+ /* @__PURE__ */ t(Te, { userId: y.user_id, name: I }),
2386
2394
  /* @__PURE__ */ r("p", { className: "min-w-0 flex-1 text-[12.5px] text-slate-700 dark:text-slate-200", children: [
2387
- /* @__PURE__ */ t("span", { className: "font-medium", children: P }),
2395
+ /* @__PURE__ */ t("span", { className: "font-medium", children: I }),
2388
2396
  " ",
2389
- /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: W })
2397
+ /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: z })
2390
2398
  ] }),
2391
- /* @__PURE__ */ t("span", { className: "shrink-0 tabular-nums text-[11.5px] text-slate-400", children: y.timestamp ? Z(y.timestamp) : "" })
2399
+ /* @__PURE__ */ t("span", { className: "shrink-0 tabular-nums text-[11.5px] text-slate-400", children: y.timestamp ? G(y.timestamp) : "" })
2392
2400
  ] }),
2393
2401
  B && /* @__PURE__ */ t("p", { className: "mt-2 text-[12px] text-slate-500 dark:text-slate-400", children: "The record did not exist yet on that date — showing its first save." }),
2394
- T.length > 0 && /* @__PURE__ */ t("div", { className: "mt-3 overflow-hidden rounded-md border border-amber-200/80 dark:border-amber-900/50", children: T.map((h) => /* @__PURE__ */ r(
2402
+ E.length > 0 && /* @__PURE__ */ t("div", { className: "mt-3 overflow-hidden rounded-md border border-amber-200/80 dark:border-amber-900/50", children: E.map((x) => /* @__PURE__ */ r(
2395
2403
  "div",
2396
2404
  {
2397
2405
  className: "grid grid-cols-[minmax(120px,180px)_1fr] gap-3 border-b border-amber-100 bg-amber-50/60 px-2.5 py-1.5 last:border-0 dark:border-amber-900/30 dark:bg-amber-950/20",
2398
- "data-replay-changed": h.field,
2406
+ "data-replay-changed": x.field,
2399
2407
  children: [
2400
2408
  /* @__PURE__ */ r("span", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: [
2401
- $(i, h.field).label,
2402
- !v.has(h.field) && y.action === "update" && /* @__PURE__ */ r(
2409
+ T(i, x.field).label,
2410
+ !f.has(x.field) && y.action === "update" && /* @__PURE__ */ r(
2403
2411
  "span",
2404
2412
  {
2405
2413
  className: "mt-0.5 flex w-fit cursor-help items-center gap-0.5 text-[10.5px] font-normal text-slate-500 dark:text-slate-400",
2406
- "data-tip": F ? (() => {
2407
- const D = we(h.field, F, i);
2408
- return `${D.because ? `${D.because} — ` : ""}${D.why}`;
2414
+ "data-tip": w ? (() => {
2415
+ const R = Ce(x.field, w, i);
2416
+ return `${R.because ? `${R.because} — ` : ""}${R.why}`;
2409
2417
  })() : void 0,
2410
2418
  children: [
2411
- /* @__PURE__ */ t(Ne, { className: "h-3 w-3 text-amber-700 dark:text-amber-300" }),
2419
+ /* @__PURE__ */ t(Se, { className: "h-3 w-3 text-amber-700 dark:text-amber-300" }),
2412
2420
  "recalculated"
2413
2421
  ]
2414
2422
  }
2415
2423
  )
2416
2424
  ] }),
2417
- /* @__PURE__ */ t("span", { className: "min-w-0 text-[12px]", children: dt(h.before) || dt(h.after) ? (
2425
+ /* @__PURE__ */ t("span", { className: "min-w-0 text-[12px]", children: ct(x.before) || ct(x.after) ? (
2418
2426
  // A paragraph that gained a sentence reads as the words that moved.
2419
- /* @__PURE__ */ t("span", { className: "block break-words leading-relaxed text-slate-700 dark:text-slate-200", children: /* @__PURE__ */ t(Ct, { before: h.before, after: h.after }) })
2427
+ /* @__PURE__ */ t("span", { className: "block break-words leading-relaxed text-slate-700 dark:text-slate-200", children: /* @__PURE__ */ t(_t, { before: x.before, after: x.after }) })
2420
2428
  ) : /* @__PURE__ */ r("span", { className: "flex flex-wrap items-baseline gap-x-2", children: [
2421
2429
  /* @__PURE__ */ t(
2422
2430
  "span",
2423
2431
  {
2424
2432
  className: j(
2425
2433
  "text-slate-400",
2426
- !it(h.before) && "line-through decoration-slate-300 dark:decoration-slate-600"
2434
+ !dt(x.before) && "line-through decoration-slate-300 dark:decoration-slate-600"
2427
2435
  ),
2428
- children: it(h.before) ? "—" : /* @__PURE__ */ t(ie, { value: h.before, meta: $(i, h.field), tone: "before" })
2436
+ children: dt(x.before) ? "—" : /* @__PURE__ */ t(de, { value: x.before, meta: T(i, x.field), tone: "before" })
2429
2437
  }
2430
2438
  ),
2431
- /* @__PURE__ */ t(Ve, { className: "h-3 w-3 shrink-0 self-center text-slate-400" }),
2432
- /* @__PURE__ */ t("span", { className: "font-medium text-slate-900 dark:text-slate-100", children: /* @__PURE__ */ t(ie, { value: h.after, meta: $(i, h.field), tone: "after" }) })
2439
+ /* @__PURE__ */ t(ze, { className: "h-3 w-3 shrink-0 self-center text-slate-400" }),
2440
+ /* @__PURE__ */ t("span", { className: "font-medium text-slate-900 dark:text-slate-100", children: /* @__PURE__ */ t(de, { value: x.after, meta: T(i, x.field), tone: "after" }) })
2433
2441
  ] }) })
2434
2442
  ]
2435
2443
  },
2436
- h.field
2444
+ x.field
2437
2445
  )) }),
2438
2446
  /* @__PURE__ */ r(
2439
2447
  "button",
2440
2448
  {
2441
2449
  type: "button",
2442
- onClick: () => k((h) => !h),
2450
+ onClick: () => k((x) => !x),
2443
2451
  className: "mt-3 inline-flex items-center gap-1 text-[12px] font-medium text-slate-600 hover:text-slate-900 dark:text-slate-300 dark:hover:text-slate-100",
2444
- "aria-expanded": f,
2452
+ "aria-expanded": v,
2445
2453
  children: [
2446
- f ? /* @__PURE__ */ t(Ke, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(je, { className: "h-3.5 w-3.5" }),
2454
+ v ? /* @__PURE__ */ t(Ve, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(qe, { className: "h-3.5 w-3.5" }),
2447
2455
  "The whole record at this save",
2448
2456
  /* @__PURE__ */ r("span", { className: "font-normal text-slate-400", children: [
2449
2457
  "(",
2450
- q.length,
2458
+ M.length,
2451
2459
  " fields)"
2452
2460
  ] })
2453
2461
  ]
2454
2462
  }
2455
2463
  ),
2456
- f && /* @__PURE__ */ t("div", { className: "mt-2 max-h-80 overflow-y-auto rounded-md border border-slate-200 dark:border-border", children: q.map(([h, D]) => /* @__PURE__ */ r(
2464
+ v && /* @__PURE__ */ t("div", { className: "mt-2 max-h-80 overflow-y-auto rounded-md border border-slate-200 dark:border-border", children: M.map(([x, R]) => /* @__PURE__ */ r(
2457
2465
  "div",
2458
2466
  {
2459
2467
  className: "grid grid-cols-[minmax(120px,180px)_1fr] gap-3 border-b border-slate-100 px-2.5 py-1.5 last:border-0 dark:border-border/60",
2460
2468
  children: [
2461
- /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500 dark:text-slate-400", title: h, children: $(i, h).label }),
2462
- /* @__PURE__ */ t("span", { className: "break-words text-[12px] text-slate-800 dark:text-slate-200", children: /* @__PURE__ */ t(ie, { value: D, meta: $(i, h), tone: "after" }) })
2469
+ /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500 dark:text-slate-400", title: x, children: T(i, x).label }),
2470
+ /* @__PURE__ */ t("span", { className: "break-words text-[12px] text-slate-800 dark:text-slate-200", children: /* @__PURE__ */ t(de, { value: R, meta: T(i, x), tone: "after" }) })
2463
2471
  ]
2464
2472
  },
2465
- h
2473
+ x
2466
2474
  )) })
2467
2475
  ] })
2468
2476
  ]
@@ -2470,7 +2478,7 @@ function fr({
2470
2478
  );
2471
2479
  }
2472
2480
  export {
2473
- _t as FieldChangeList,
2474
- Xr as RevisionsPanel,
2475
- kt as displayValue
2481
+ Tt as FieldChangeList,
2482
+ as as RevisionsPanel,
2483
+ Nt as displayValue
2476
2484
  };