@nivaro/react 0.3.124 → 0.3.125

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
1
  import { jsxs as r, jsx as t, Fragment as ee } from "react/jsx-runtime";
2
- import { useSensors as Ft, useSensor as Ye, PointerSensor as Dt, KeyboardSensor as At, DndContext as Lt, closestCenter as Ot } from "@dnd-kit/core";
3
- import { sortableKeyboardCoordinates as jt, SortableContext as qt, verticalListSortingStrategy as Pt, arrayMove as Et, useSortable as Mt } from "@dnd-kit/sortable";
4
- import { CSS as It } from "@dnd-kit/utilities";
5
- import { useQuery as le, useQueryClient as Ce, useMutation as Le } from "@tanstack/react-query";
6
- import { Clock as Oe, List as Kt, Table2 as Vt, Sigma as we, Download as Ge, ChevronDown as Ie, FileSpreadsheet as zt, GitCompareArrows as dt, ArrowRight as Ke, X as ct, GripVertical as mt, Zap as Bt, Search as Ut, Columns3 as Ht, ChevronsUpDown as Wt, History as Jt, ChevronRight as je, MessageSquare as Qt, RotateCcw as pt, Check as Yt, ChevronLeft as Gt, Pause as Zt, Play as Xt, CalendarClock as ea } from "lucide-react";
7
- import { useState as L, useRef as Ve, useEffect as qe, useMemo as O, useId as ta, createContext as aa, useContext as ht } from "react";
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";
8
8
  import { toast as se } from "sonner";
9
- import { useNivaroClient as pe, useItemEditAuth as ra } from "../../context.js";
10
- import { o2mSentence as sa, o2mTotalsText as Ze, activityPredicate as na, activityWhy as la, actorName as oa } from "../../lib/activity-sentence.js";
11
- import { get as ae, post as ve } from "../../lib/commands.js";
12
- import { compareValueText as ze } from "../../lib/compare-value.js";
13
- import { isEditorJsValue as Be, editorJsToText as ia, editorJsToHtml as da } from "../../lib/editorjs.js";
14
- import { toastError as Fe } from "../../lib/error-toast.js";
15
- import { useLiveRecordQueries as ut } from "../../lib/live.js";
16
- import { restoreSkippedNote as Xe } from "../../lib/restore-skipped.js";
17
- import { useRevisionPrefs as bt, useSharedColumnSets as ca } from "../../lib/revision-prefs.js";
18
- import { cn as M, formatDateTime as Z, toLocalDateString as xe, titleCase as fe } from "../../lib/utils.js";
19
- import { xlsxBlob as ma } from "../../lib/xlsx-lite.js";
20
- import { useActivityLabels as xt } from "../ActivityEntry.js";
21
- import { AgentBadge as pa } from "../AgentBadge.js";
22
- import { HScrollProxy as ha } from "../HScrollProxy.js";
23
- import { RelatedItemLabel as ua } from "../item-edit/RelationCombobox.js";
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";
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
24
  import { UserChip as ba } from "../item-edit/UserChip.js";
25
- import { UserAvatar as xa } from "../UserAvatar.js";
25
+ import { UserAvatar as fa } from "../UserAvatar.js";
26
26
  import { Button as oe } from "../ui/button.js";
27
27
  import { Checkbox as Pe } from "../ui/checkbox.js";
28
- import { Command as fa, CommandInput as ga, CommandList as ya, CommandEmpty as va, CommandGroup as et, CommandItem as tt } from "../ui/command.js";
29
- import { DropdownMenu as ka, DropdownMenuTrigger as wa, DropdownMenuContent as Na, DropdownMenuItem as at } from "../ui/dropdown-menu.js";
30
- import { Popover as Ca, PopoverTrigger as Sa, PopoverContent as _a } from "../ui/popover.js";
31
- import { Sheet as $a, SheetTrigger as Ta, SheetContent as Ra, SheetHeader as Fa, SheetTitle as Da } from "../ui/sheet.js";
32
- import { Skeleton as ft } from "../ui/skeleton.js";
33
- import { IntegrationActivitySection as Aa } from "./IntegrationActivitySection.js";
34
- import { buildSaveRows as gt, valueAt as La, sameValue as Oa, matrixColumns as ja, STEP_FIELD as De, rowsChanging as qa, saveActionLabel as rt, deriveOf as Pa, matrixCsv as Ea, recalcReason as Ma, signedAmount as Ia } from "./revision-changes.js";
35
- import { inDateRange as Ka, ColumnSetsMenu as Va, PeopleFilter as za, DateRangeFilter as Ba, FieldTrend as Ua } from "./revision-table-parts.js";
36
- const Ee = (e) => e.id != null && (e.action === "create" || e.action === "update" || e.action === "delete" || e.action === "restore"), Ha = (e) => !Ee(e), ne = (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
- }, Wa = /* @__PURE__ */ new Set([
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([
40
40
  "id",
41
41
  "created",
42
42
  "changed",
@@ -48,10 +48,10 @@ const Ee = (e) => e.id != null && (e.action === "create" || e.action === "update
48
48
  "updated_at",
49
49
  "sort"
50
50
  ]);
51
- function Ue(e, n) {
51
+ function He(e, l) {
52
52
  const i = pe(), { data: a } = le({
53
53
  queryKey: ["revisions-field-meta", e],
54
- enabled: n,
54
+ enabled: l,
55
55
  staleTime: 3e5,
56
56
  queryFn: async () => {
57
57
  const [m, o, p] = await Promise.all([
@@ -73,14 +73,14 @@ function Ue(e, n) {
73
73
  var s;
74
74
  const m = /* @__PURE__ */ new Map(), o = (g) => {
75
75
  const c = ((a == null ? void 0 : a.relations) ?? []).find(
76
- (x) => x.many_collection === e && x.many_field === g && x.junction_field == null
76
+ (b) => b.many_collection === e && b.many_field === g && b.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
79
  }, p = /* @__PURE__ */ new Map();
80
80
  for (const [g, c] of ((a == null ? void 0 : a.groups) ?? []).entries())
81
81
  p.set(c.key, {
82
82
  key: c.key,
83
- label: ((s = c.label) == null ? void 0 : s.trim()) || fe(c.key.replace(/_/g, " ")),
83
+ label: ((s = c.label) == null ? void 0 : s.trim()) || ge(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())
@@ -95,11 +95,11 @@ function Ue(e, n) {
95
95
  options: c.options,
96
96
  display_options: c.display_options
97
97
  },
98
- label: c.label || fe(c.field.replace(/_/g, " ")),
98
+ label: c.label || ge(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: Wa.has(c.field) || c.hidden === !0,
102
+ system: Ja.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,
@@ -109,70 +109,70 @@ function Ue(e, n) {
109
109
  return m;
110
110
  }, [a, e]);
111
111
  }
112
- function $(e, n) {
113
- return e.get(n) ?? {
112
+ function $(e, l) {
113
+ return e.get(l) ?? {
114
114
  // Unknown to the form = machine column. Still labeled, still reachable.
115
- label: fe(n.replace(/[_-]/g, " ")),
115
+ label: ge(l.replace(/[_-]/g, " ")),
116
116
  system: !0,
117
117
  onLayout: !1
118
118
  };
119
119
  }
120
- function Ja({ map: e, field: n }) {
121
- const i = $(e, n);
120
+ function Qa({ map: e, field: l }) {
121
+ const i = $(e, l);
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": n,
127
- title: n,
126
+ "data-tip": l,
127
+ title: l,
128
128
  children: i.label
129
129
  }
130
130
  );
131
131
  }
132
- const st = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, Qa = /^\d{4}-\d{2}-\d{2}(?:T00:00:00(?:\.0+)?Z)?$/;
133
- function yt(e, n = !1) {
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) {
134
134
  if (e == null || e === "") return "";
135
135
  if (typeof e == "boolean") return e ? "Yes" : "No";
136
- if (typeof e == "string" && (Qa.test(e) || n && st.test(e)))
137
- return xe(e);
138
- if (typeof e == "string" && st.test(e)) {
136
+ if (typeof e == "string" && (Ya.test(e) || l && nt.test(e)))
137
+ return be(e);
138
+ if (typeof e == "string" && nt.test(e)) {
139
139
  const i = new Date(e);
140
140
  if (!Number.isNaN(i.getTime())) return Z(i);
141
141
  }
142
142
  return typeof e == "object" ? JSON.stringify(e) : String(e);
143
143
  }
144
- function Ne(e) {
144
+ function Ce(e) {
145
145
  return e == null ? "" : typeof e == "object" ? JSON.stringify(e) : String(e);
146
146
  }
147
- function vt({ collection: e, id: n }) {
147
+ function wt({ collection: e, id: l }) {
148
148
  const i = pe(), { data: a } = le({
149
149
  queryKey: ["col-meta", e],
150
150
  queryFn: () => i.request(ae(`/collections/${e}`)).then((m) => m.data),
151
151
  staleTime: 3e5,
152
152
  retry: !1
153
153
  });
154
- return /* @__PURE__ */ t("span", { title: `${e} #${String(n)}`, children: /* @__PURE__ */ t(
155
- ua,
154
+ return /* @__PURE__ */ t("span", { title: `${e} #${String(l)}`, children: /* @__PURE__ */ t(
155
+ xa,
156
156
  {
157
157
  collection: e,
158
- id: n,
158
+ id: l,
159
159
  displayTemplate: a == null ? void 0 : a.display_template
160
160
  }
161
161
  ) });
162
162
  }
163
- function kt(e) {
164
- return Be(e) ? ia(e) : Me(e).join(" ");
163
+ function Nt(e) {
164
+ return Ue(e) ? da(e) : Ie(e).join(" ");
165
165
  }
166
- const nt = 160;
167
- function Ae({
166
+ const lt = 160;
167
+ function Le({
168
168
  value: e,
169
- tone: n,
169
+ tone: l,
170
170
  dateOnly: i
171
171
  }) {
172
- const [a, m] = L(!1), o = yt(e, i);
172
+ const [a, m] = L(!1), o = kt(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 > nt, s = a || !p ? o : `${o.slice(0, nt)}…`;
175
+ const p = o.length > lt, s = a || !p ? o : `${o.slice(0, lt)}…`;
176
176
  return /* @__PURE__ */ r("span", { className: "break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: [
177
177
  typeof e == "object" ? /* @__PURE__ */ t("span", { className: "font-mono text-[11px]", children: s }) : s,
178
178
  p && /* @__PURE__ */ t(
@@ -180,32 +180,32 @@ function Ae({
180
180
  {
181
181
  type: "button",
182
182
  onClick: () => m((g) => !g),
183
- className: M(
183
+ className: j(
184
184
  "ml-1 text-[10.5px] font-medium hover:underline",
185
- n === "before" ? "text-rose-500" : "text-emerald-600"
185
+ l === "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 ye(e) {
192
+ function ve(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 n = JSON.parse(e);
197
- return n && typeof n == "object" && !Array.isArray(n) ? n : null;
196
+ const l = JSON.parse(e);
197
+ return l && typeof l == "object" && !Array.isArray(l) ? l : null;
198
198
  } catch {
199
199
  return null;
200
200
  }
201
201
  return null;
202
202
  }
203
- function Ya({
203
+ function Ga({
204
204
  before: e,
205
- after: n
205
+ after: l
206
206
  }) {
207
- const a = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(n)])).sort().map((o) => {
208
- const p = o in e ? JSON.stringify(e[o]) : void 0, s = o in n ? JSON.stringify(n[o]) : void 0;
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
209
  return p === s ? null : { k: o, b: p, a: s };
210
210
  }).filter(Boolean);
211
211
  if (a.length === 0)
@@ -220,15 +220,15 @@ function Ya({
220
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)" })
221
221
  ] }, o)) });
222
222
  }
223
- function Ga({ 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: [
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: [
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: n.pending,
231
- onClick: () => n.revert(e),
230
+ disabled: l.pending,
231
+ onClick: () => l.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 Ga({ field: e, ctl: n }) {
237
237
  "button",
238
238
  {
239
239
  type: "button",
240
- onClick: () => n.setConfirmField(null),
240
+ onClick: () => l.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,25 +246,25 @@ function Ga({ field: e, ctl: n }) {
246
246
  "button",
247
247
  {
248
248
  type: "button",
249
- onClick: () => n.setConfirmField(e),
249
+ onClick: () => l.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(pt, { className: "h-3 w-3" }),
254
+ /* @__PURE__ */ t(ut, { className: "h-3 w-3" }),
255
255
  "Revert"
256
256
  ]
257
257
  }
258
258
  );
259
259
  }
260
- function ge(e) {
261
- return typeof e == "string" && /<[a-z][^>]*>/i.test(e) || Be(e);
260
+ function ye(e) {
261
+ return typeof e == "string" && /<[a-z][^>]*>/i.test(e) || Ue(e);
262
262
  }
263
- function Me(e) {
264
- return String(Be(e) ? da(e) : e ?? "").replace(/<[^>]*>/g, " ").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").split(/\s+/).filter(Boolean);
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);
265
265
  }
266
- function Za(e, n) {
267
- const a = Me(e).slice(0, 600), m = Me(n).slice(0, 600), o = a.length, p = m.length, s = Array.from({ length: o + 1 }, () => new Array(p + 1).fill(0));
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));
268
268
  for (let k = o - 1; k >= 0; k--)
269
269
  for (let u = p - 1; u >= 0; u--)
270
270
  s[k][u] = a[k] === m[u] ? s[k + 1][u + 1] + 1 : Math.max(s[k + 1][u], s[k][u + 1]);
@@ -272,15 +272,15 @@ function Za(e, n) {
272
272
  const R = g[g.length - 1];
273
273
  R && R.type === k ? R.text += ` ${u}` : g.push({ text: u, type: k });
274
274
  };
275
- let x = 0, f = 0;
276
- for (; x < o && f < p; )
277
- a[x] === m[f] ? (c("same", a[x]), x++, f++) : s[x + 1][f] >= s[x][f + 1] ? (c("del", a[x]), x++) : (c("ins", m[f]), f++);
278
- for (; x < o; ) c("del", a[x++]);
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
279
  for (; f < p; ) c("ins", m[f++]);
280
280
  return g;
281
281
  }
282
- function wt({ before: e, after: n }) {
283
- const i = Za(e, n);
282
+ function Ct({ before: e, after: l }) {
283
+ const i = Xa(e, l);
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
285
  (a, m) => a.type === "same" ? (
286
286
  // biome-ignore lint/suspicious/noArrayIndexKey: static segment list
@@ -317,21 +317,21 @@ function wt({ before: e, after: n }) {
317
317
  )
318
318
  ) });
319
319
  }
320
- const Xa = {
320
+ const er = {
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 Nt(e, n, i) {
326
- const a = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(n)])), m = (s) => s == null || s === "", o = a.map((s) => {
327
- const g = !(s in e) || m(e[s]), c = !(s in n) || m(n[s]);
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]);
328
328
  if (g && c) return null;
329
- const x = g ? "added" : c ? "removed" : Ne(e[s]) !== Ne(n[s]) ? "changed" : "unchanged";
329
+ const b = g ? "added" : c ? "removed" : Ce(e[s]) !== Ce(l[s]) ? "changed" : "unchanged";
330
330
  return {
331
331
  field: s,
332
- status: x,
332
+ status: b,
333
333
  before: e[s],
334
- after: n[s],
334
+ after: l[s],
335
335
  system: $(i, s).system
336
336
  };
337
337
  }).filter(Boolean), p = (s) => {
@@ -344,71 +344,71 @@ function Nt(e, n, i) {
344
344
  }
345
345
  function ie({
346
346
  value: e,
347
- meta: n,
347
+ meta: l,
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" }) : 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(vt, { collection: n.relatedCollection, id: e }) }) : ge(e) ? /* @__PURE__ */ t(Ae, { value: kt(e), tone: i }) : n.cmp && typeof e != "object" && !n.dateOnly ? /* @__PURE__ */ t(Ae, { value: ze(e, n.cmp), tone: i }) : /* @__PURE__ */ t(Ae, { value: e, tone: i, dateOnly: n.dateOnly });
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 });
351
351
  }
352
- function er({
352
+ function tr({
353
353
  row: e,
354
- meta: n,
354
+ meta: l,
355
355
  fieldRevert: i,
356
356
  mode: a,
357
357
  hideStatusChips: m,
358
358
  between: o
359
359
  }) {
360
- const p = e.status === "changed" && (ge(e.before) || ge(e.after)), s = e.status === "changed" && ye(e.before) && ye(e.after);
360
+ const p = e.status === "changed" && (ye(e.before) || ye(e.after)), s = e.status === "changed" && ve(e.before) && ve(e.after);
361
361
  return /* @__PURE__ */ r(
362
362
  "div",
363
363
  {
364
- className: M(
364
+ className: j(
365
365
  "group/frow border-b border-slate-100 px-3 py-2 last:border-0 dark:border-border/60",
366
366
  e.system && "bg-slate-50/60 dark:bg-muted/20"
367
367
  ),
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(Ja, { map: n, field: e.field }),
371
+ /* @__PURE__ */ t(Qa, { map: l, field: e.field }),
372
372
  e.status !== "unchanged" && !m && /* @__PURE__ */ t(
373
373
  "span",
374
374
  {
375
- className: M(
375
+ className: j(
376
376
  "rounded px-1 py-px text-[9px] font-semibold uppercase tracking-wide",
377
- Xa[e.status]
377
+ er[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(Ga, { field: e.field, ctl: i }) })
384
+ !o && /* @__PURE__ */ t("span", { className: "ml-auto shrink-0", children: /* @__PURE__ */ t(Za, { 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(wt, { before: e.before, after: e.after }) }) : s ? /* @__PURE__ */ t(
387
- Ya,
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,
388
388
  {
389
- before: ye(e.before),
390
- after: ye(e.after)
389
+ before: ve(e.before),
390
+ after: ve(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: $(n, e.field), tone: "before" }) }),
394
- /* @__PURE__ */ t(Ke, { className: "h-3 w-3 shrink-0 self-center text-slate-300 dark:text-slate-600" }),
395
- /* @__PURE__ */ t(ie, { value: e.after, meta: $(n, e.field), tone: "after" })
396
- ] }) : /* @__PURE__ */ t(ie, { value: e.after ?? e.before, meta: $(n, 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(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" }) })
397
397
  ]
398
398
  }
399
399
  );
400
400
  }
401
- function Ct({
401
+ function _t({
402
402
  before: e,
403
- after: n,
403
+ after: l,
404
404
  meta: i,
405
405
  fieldRevert: a,
406
406
  mode: m,
407
407
  hideStatusChips: o,
408
408
  ownFields: p
409
409
  }) {
410
- const [s, g] = L(!1), c = O(() => Nt(e, n, i), [e, n, i]), x = m === "changes" ? c.filter((v) => v.status !== "unchanged") : c, f = s ? x : x.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 = x.length - R.length;
411
- if (x.length === 0)
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
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
413
  const S = R.findIndex(
414
414
  (v) => !k(v) && !$(i, v.field).onLayout && !$(i, v.field).system
@@ -416,8 +416,8 @@ function Ct({
416
416
  (v) => !k(v) && $(i, v.field).onLayout && !$(i, v.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, b) => /* @__PURE__ */ r("div", { children: [
420
- b === C && /* @__PURE__ */ r(
419
+ R.map((v, x) => /* @__PURE__ */ r("div", { children: [
420
+ x === C && /* @__PURE__ */ r(
421
421
  "div",
422
422
  {
423
423
  "data-recalculated-between": !0,
@@ -428,12 +428,12 @@ function Ct({
428
428
  ]
429
429
  }
430
430
  ),
431
- b === 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
+ 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: [
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
- er,
436
+ tr,
437
437
  {
438
438
  row: v,
439
439
  meta: i,
@@ -460,7 +460,7 @@ function Ct({
460
460
  ]
461
461
  }
462
462
  ),
463
- y === 0 && s && x.some((v) => v.system) && /* @__PURE__ */ t(
463
+ y === 0 && s && b.some((v) => v.system) && /* @__PURE__ */ t(
464
464
  "button",
465
465
  {
466
466
  type: "button",
@@ -471,22 +471,22 @@ function Ct({
471
471
  )
472
472
  ] });
473
473
  }
474
- const tr = {
474
+ const ar = {
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
- }, He = aa(void 0);
480
- function te(e, n) {
479
+ }, We = ra(void 0);
480
+ function te(e, l) {
481
481
  var i;
482
- return e.actor && e.actor.kind !== "person" ? oa(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";
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";
483
483
  }
484
- function ar(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";
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";
486
486
  }
487
- function rr({ revision: e, isLast: n }) {
487
+ function sr({ revision: e, isLast: l }) {
488
488
  var f, k, u, R, C;
489
- const i = ht(He), 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;
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;
490
490
  let c;
491
491
  (a == null ? void 0 : a.kind) === "transition" && a.addendum ? c = /* @__PURE__ */ r(ee, { children: [
492
492
  "moved",
@@ -533,8 +533,8 @@ function rr({ revision: e, isLast: n }) {
533
533
  "started the pipeline",
534
534
  e.comment ? ` — ${e.comment.replace(/^Started pipeline\s*[—-]?\s*/i, "")}` : ""
535
535
  ] }) : (u = e.action) != null && u.startsWith("o2m-") ? c = /* @__PURE__ */ t("span", { "data-revision-o2m": !0, children: e.o2m ? /* @__PURE__ */ r(ee, { children: [
536
- sa(e.o2m),
537
- Ze(e.o2m) ? (
536
+ na(e.o2m),
537
+ Xe(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 rr({ revision: e, isLast: n }) {
544
544
  className: "ml-1 font-medium text-slate-700 dark:text-slate-200",
545
545
  children: [
546
546
  "· ",
547
- Ze(e.o2m)
547
+ Xe(e.o2m)
548
548
  ]
549
549
  }
550
550
  )
@@ -558,10 +558,10 @@ function rr({ revision: e, isLast: n }) {
558
558
  }
559
559
  ) : null
560
560
  ] }) : `${e.action === "o2m-create" ? "added" : e.action === "o2m-delete" ? "removed" : "changed"} related rows` }) : c = /* @__PURE__ */ r(ee, { children: [
561
- na({ ...e, item: null }, i),
561
+ la({ ...e, item: null }, i),
562
562
  e.comment ? ` — ${e.comment}` : ""
563
563
  ] });
564
- const x = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
564
+ const b = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
565
565
  return /* @__PURE__ */ r(
566
566
  "div",
567
567
  {
@@ -573,14 +573,14 @@ function rr({ revision: e, isLast: n }) {
573
573
  /* @__PURE__ */ t(
574
574
  "span",
575
575
  {
576
- className: M(
576
+ className: j(
577
577
  "absolute left-[11px] top-[18px] h-2.5 w-2.5 rounded-full ring-4 ring-white dark:ring-card",
578
578
  (a == null ? void 0 : a.kind) === "transition" && a.addendum ? "bg-amber-500" : (a == null ? void 0 : a.kind) === "transition" ? "bg-violet-500" : (a == null ? void 0 : a.kind) === "start" ? "bg-violet-300" : "bg-slate-300"
579
579
  ),
580
580
  "aria-hidden": !0
581
581
  }
582
582
  ),
583
- !n && /* @__PURE__ */ t(
583
+ !l && /* @__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 rr({ revision: e, isLast: n }) {
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(Se, { userId: e.user_id, name: g }),
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 }),
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
  " ",
@@ -611,7 +611,7 @@ function rr({ revision: e, isLast: n }) {
611
611
  {
612
612
  className: "shrink-0 text-[11px] tabular-nums text-slate-400",
613
613
  title: e.timestamp ? Z(e.timestamp) : void 0,
614
- children: x
614
+ children: b
615
615
  }
616
616
  )
617
617
  ] })
@@ -619,38 +619,38 @@ function rr({ revision: e, isLast: n }) {
619
619
  }
620
620
  );
621
621
  }
622
- function sr({
622
+ function nr({
623
623
  revision: e,
624
- previousData: n,
624
+ previousData: l,
625
625
  meta: i,
626
626
  onRollback: a,
627
627
  inlineTableFields: m,
628
628
  isLast: o
629
629
  }) {
630
- const p = pe(), s = ht(He), g = la(e).reason, [c, x] = L(!1), [f, k] = L(!1), [u, R] = L("changes"), [C, y] = L(!1), [S, T] = L(null), v = e.action === "update", b = e.action === "create" || e.action === "restore", w = e.action === "delete", F = w ? e.data ?? {} : b ? {} : n ?? {}, q = w ? {} : e.data ?? {}, { humanDelta: I, systemDelta: j } = O(() => {
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
631
  const A = e.delta ?? {};
632
632
  let z = 0, Y = 0;
633
633
  for (const ue of Object.keys(A)) {
634
- const $e = n == null ? void 0 : n[ue], G = (e.data ?? {})[ue];
635
- v && n && Ne($e) === Ne(G) || ($(i, ue).system ? Y++ : z++);
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++);
636
636
  }
637
637
  return { humanDelta: z, systemDelta: Y };
638
- }, [e, n, i, v]), P = O(() => new Set(Object.keys(e.delta ?? {})), [e]), W = v || b, [B, J] = L(null), he = Ce(), [de, h] = L(null), D = Le({
639
- mutationFn: (A) => p.request(ve(`/revisions/${e.id}/revert-field`, { field: A })),
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
640
  onSuccess: (A, z) => {
641
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();
642
642
  },
643
643
  onError: () => se.error("Failed to revert field")
644
- }), U = v || b ? {
644
+ }), U = v || x ? {
645
645
  confirmField: de,
646
646
  setConfirmField: h,
647
647
  revert: (A) => D.mutate(A),
648
648
  pending: D.isPending
649
- } : void 0, K = Le({
650
- mutationFn: () => p.request(ve(`/revisions/${e.id}/rollback`, {})),
649
+ } : void 0, K = Oe({
650
+ mutationFn: () => p.request(ke(`/revisions/${e.id}/rollback`, {})),
651
651
  onSuccess: (A) => {
652
652
  k(!1), se.success("Rolled back to this revision");
653
- const z = Xe(A);
653
+ const z = et(A);
654
654
  z && se.warning(z, { duration: 1e4 }), m != null && m.length && e.timestamp && J(e.timestamp), a == null || a();
655
655
  },
656
656
  onError: () => se.error("Failed to rollback")
@@ -660,7 +660,7 @@ function sr({
660
660
  T(A.field);
661
661
  try {
662
662
  const z = await p.request(
663
- ve("/revisions/o2m-restore", {
663
+ ke("/revisions/o2m-restore", {
664
664
  collection: A.relatedCollection,
665
665
  many_field: A.manyField,
666
666
  parent_id: A.parentId,
@@ -668,7 +668,7 @@ function sr({
668
668
  })
669
669
  );
670
670
  se.success(`Restored ${A.label}`);
671
- const Y = Xe(z);
671
+ const Y = et(z);
672
672
  Y && se.warning(Y, { duration: 1e4 });
673
673
  } catch {
674
674
  se.error(`Failed to restore ${A.label}`);
@@ -677,14 +677,14 @@ function sr({
677
677
  }
678
678
  }
679
679
  }
680
- const _e = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
680
+ const $e = 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
- className: M(
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
- tr[e.action ?? ""] ?? "bg-slate-300"
687
+ ar[e.action ?? ""] ?? "bg-slate-300"
688
688
  ),
689
689
  "aria-hidden": !0
690
690
  }
@@ -697,19 +697,19 @@ function sr({
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(Se, { userId: e.user_id, name: te(e, s) }),
700
+ /* @__PURE__ */ t(_e, { userId: e.user_id, name: te(e, s) }),
701
701
  /* @__PURE__ */ r(
702
702
  "button",
703
703
  {
704
704
  type: "button",
705
- onClick: () => x((A) => !A),
705
+ onClick: () => b((A) => !A),
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
710
  /* @__PURE__ */ t("span", { className: "font-medium", children: te(e, s) }),
711
711
  " ",
712
- /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: ar(e, I, j) }),
712
+ /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: rr(e, I, M) }),
713
713
  g && /* @__PURE__ */ r(
714
714
  "span",
715
715
  {
@@ -723,16 +723,16 @@ function sr({
723
723
  }
724
724
  )
725
725
  ] }),
726
- /* @__PURE__ */ t(pa, { label: e.via_agent }),
726
+ /* @__PURE__ */ t(ha, { 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
731
  title: e.timestamp ? Z(e.timestamp) : void 0,
732
- children: _e
732
+ children: $e
733
733
  }
734
734
  ),
735
- c ? /* @__PURE__ */ t(Ie, { 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(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" })
736
736
  ]
737
737
  }
738
738
  )
@@ -747,7 +747,7 @@ function sr({
747
747
  {
748
748
  type: "button",
749
749
  onClick: () => R(A),
750
- className: M(
750
+ className: j(
751
751
  "px-2.5 py-1 text-[11.5px] transition-colors",
752
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"
753
753
  ),
@@ -761,12 +761,12 @@ function sr({
761
761
  {
762
762
  type: "button",
763
763
  onClick: () => y((A) => !A),
764
- className: M(
764
+ className: j(
765
765
  "inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11.5px] transition-colors",
766
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"
767
767
  ),
768
768
  children: [
769
- /* @__PURE__ */ t(Qt, { className: "h-3 w-3" }),
769
+ /* @__PURE__ */ t(Yt, { className: "h-3 w-3" }),
770
770
  "Notes"
771
771
  ]
772
772
  }
@@ -804,23 +804,23 @@ function sr({
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(pt, { className: "h-3 w-3" }),
807
+ /* @__PURE__ */ t(ut, { className: "h-3 w-3" }),
808
808
  "Restore this version"
809
809
  ]
810
810
  }
811
811
  ))
812
812
  ] })
813
813
  ] }),
814
- C && /* @__PURE__ */ t(dr, { revisionId: e.id ?? "" }),
814
+ C && /* @__PURE__ */ t(cr, { revisionId: e.id ?? "" }),
815
815
  /* @__PURE__ */ t(
816
- Ct,
816
+ _t,
817
817
  {
818
818
  before: F,
819
819
  after: q,
820
820
  meta: i,
821
821
  fieldRevert: U,
822
822
  mode: u,
823
- hideStatusChips: b,
823
+ hideStatusChips: x,
824
824
  ownFields: v && e.delta ? P : null
825
825
  }
826
826
  ),
@@ -843,27 +843,27 @@ function sr({
843
843
  ] })
844
844
  ] });
845
845
  }
846
- function nr({
846
+ function lr({
847
847
  data: e,
848
- history: n,
848
+ history: l,
849
849
  meta: i,
850
850
  labels: a,
851
851
  focusSave: m
852
852
  }) {
853
- const [o, p] = L(m ? "replay" : null), [s, g] = L(""), [c, x] = L(""), f = O(() => {
853
+ const [o, p] = L(m ? "replay" : null), [s, g] = L(""), [c, b] = L(""), f = O(() => {
854
854
  if (!s || !c || !e) return null;
855
855
  const u = (/* @__PURE__ */ new Date(`${s}T23:59:59`)).getTime(), R = (/* @__PURE__ */ new Date(`${c}T23:59:59`)).getTime();
856
856
  if (R <= u) return { error: "The second date must be after the first" };
857
857
  const C = (F) => e.find((q) => q.timestamp && new Date(q.timestamp).getTime() <= F) ?? null, y = C(u), S = C(R);
858
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 ?? {}, b = /* @__PURE__ */ new Map();
859
+ const T = (y == null ? void 0 : y.data) ?? {}, v = S.data ?? {}, x = /* @__PURE__ */ new Map();
860
860
  for (const F of [...e].reverse()) {
861
861
  const q = F.timestamp ? new Date(F.timestamp).getTime() : 0;
862
862
  if (!(q <= u || q > R || !F.delta))
863
863
  for (const I of Object.keys(F.delta))
864
- b.set(I, { name: te(F), when: F.timestamp });
864
+ x.set(I, { name: te(F), when: F.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: b.get(F) ?? null })) };
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
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";
868
868
  return /* @__PURE__ */ r("div", { className: "space-y-2", children: [
869
869
  /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
@@ -875,12 +875,12 @@ function nr({
875
875
  disabled: e.length === 0,
876
876
  "aria-expanded": o === "replay",
877
877
  "data-history-replay-toggle": !0,
878
- className: M(
878
+ className: j(
879
879
  "inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-[11.5px] transition-colors disabled:opacity-50",
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(Jt, { className: "h-3.5 w-3.5" }),
883
+ /* @__PURE__ */ t(Qt, { className: "h-3.5 w-3.5" }),
884
884
  "Replay the record"
885
885
  ]
886
886
  }
@@ -890,12 +890,12 @@ function nr({
890
890
  {
891
891
  type: "button",
892
892
  onClick: () => p(o === "compare" ? null : "compare"),
893
- className: M(
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
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"
896
896
  ),
897
897
  children: [
898
- /* @__PURE__ */ t(dt, { className: "h-3.5 w-3.5" }),
898
+ /* @__PURE__ */ t(mt, { className: "h-3.5 w-3.5" }),
899
899
  "Compare two dates"
900
900
  ]
901
901
  }
@@ -905,7 +905,7 @@ function nr({
905
905
  fr,
906
906
  {
907
907
  snapshots: e,
908
- history: n,
908
+ history: l,
909
909
  meta: i,
910
910
  labels: a,
911
911
  startKey: m ?? null
@@ -931,7 +931,7 @@ function nr({
931
931
  {
932
932
  type: "date",
933
933
  value: c,
934
- onChange: (u) => x(u.target.value),
934
+ onChange: (u) => b(u.target.value),
935
935
  className: k,
936
936
  "aria-label": "Compare to date",
937
937
  "data-diff-to": !0
@@ -942,7 +942,7 @@ function nr({
942
942
  {
943
943
  type: "button",
944
944
  onClick: () => {
945
- g(""), x("");
945
+ g(""), b("");
946
946
  },
947
947
  className: "text-[11px] text-slate-400 hover:text-slate-600 dark:hover:text-slate-300",
948
948
  children: "Clear"
@@ -982,7 +982,7 @@ function nr({
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 ? ` · ${xe(u.by.when)}` : ""
985
+ u.by.when ? ` · ${be(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: [
@@ -999,7 +999,7 @@ function nr({
999
999
  ] })
1000
1000
  ] });
1001
1001
  }
1002
- function lr(e) {
1002
+ function or(e) {
1003
1003
  return e ? new Date(e).toLocaleDateString([], {
1004
1004
  weekday: "short",
1005
1005
  month: "short",
@@ -1007,44 +1007,44 @@ function lr(e) {
1007
1007
  year: "numeric"
1008
1008
  }) : "Unknown date";
1009
1009
  }
1010
- function or({
1010
+ function ir({
1011
1011
  collection: e,
1012
- item: n,
1012
+ item: l,
1013
1013
  onRollback: i,
1014
1014
  inlineTableFields: a,
1015
1015
  focusSave: m
1016
1016
  }) {
1017
- const o = pe(), p = Ue(e, !0), { data: s, isLoading: g } = le({
1018
- queryKey: ["revisions", e, n],
1019
- queryFn: () => o.request(ae("/revisions", { collection: e, item: n })).then((S) => S.data ?? []),
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 ?? []),
1020
1020
  staleTime: 3e4
1021
- }), c = Ce();
1022
- ut(e, n, [["revisions", e, n]], { client: c });
1023
- const x = Ve(null), f = O(() => {
1021
+ }), c = Se();
1022
+ bt(e, l, [["revisions", e, l]], { client: c });
1023
+ const b = ze(null), f = O(() => {
1024
1024
  if (!s) return /* @__PURE__ */ new Set();
1025
1025
  const S = s.map(ne);
1026
- if (!x.current)
1027
- return x.current = new Set(S), /* @__PURE__ */ new Set();
1028
- const T = x.current;
1026
+ if (!b.current)
1027
+ return b.current = new Set(S), /* @__PURE__ */ new Set();
1028
+ const T = b.current;
1029
1029
  return new Set(S.filter((v) => !T.has(v)));
1030
1030
  }, [s]), k = (s == null ? void 0 : s.length) ?? 0, u = O(() => (s ?? []).filter(Ee), [s]), R = O(
1031
1031
  () => (s ?? []).filter((S) => S.actor && S.actor.kind !== "person").map((S) => ({ action: S.action, user: S.user_id, actor: S.actor })),
1032
1032
  [s]
1033
- ), C = xt(R, { enabled: R.length > 0 }), y = O(() => {
1033
+ ), C = gt(R, { enabled: R.length > 0 }), y = O(() => {
1034
1034
  const S = [];
1035
1035
  for (const T of s ?? []) {
1036
- const v = lr(T.timestamp), b = S[S.length - 1];
1037
- b && b.day === v ? b.revisions.push(T) : S.push({ day: v, revisions: [T] });
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] });
1038
1038
  }
1039
1039
  return S;
1040
1040
  }, [s]);
1041
- return g ? /* @__PURE__ */ t("div", { className: "space-y-2 pt-3", children: [1, 2, 3, 4].map((S) => /* @__PURE__ */ t(ft, { 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(Oe, { className: "mb-2 h-8 w-8 text-slate-300 dark:text-slate-600" }),
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" }),
1043
1043
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-600 dark:text-slate-300", children: "No history yet" }),
1044
1044
  /* @__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(He.Provider, { value: C, children: /* @__PURE__ */ r("div", { className: "space-y-3 pt-3", children: [
1045
+ ] }) : /* @__PURE__ */ t(We.Provider, { value: C, children: /* @__PURE__ */ r("div", { className: "space-y-3 pt-3", children: [
1046
1046
  /* @__PURE__ */ t(
1047
- nr,
1047
+ lr,
1048
1048
  {
1049
1049
  data: u,
1050
1050
  history: s ?? [],
@@ -1056,18 +1056,18 @@ function or({
1056
1056
  /* @__PURE__ */ t("div", { children: y.map((S) => /* @__PURE__ */ r("div", { children: [
1057
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
1058
  S.revisions.map((T) => {
1059
- const v = (s ?? []).indexOf(T), b = v === ((s == null ? void 0 : s.length) ?? 1) - 1;
1060
- if (Ha(T))
1059
+ const v = (s ?? []).indexOf(T), x = v === ((s == null ? void 0 : s.length) ?? 1) - 1;
1060
+ if (Wa(T))
1061
1061
  return /* @__PURE__ */ r(
1062
1062
  "div",
1063
1063
  {
1064
- className: M(
1064
+ className: j(
1065
1065
  "nvr-fade-in relative",
1066
1066
  f.has(ne(T)) && "rounded-md bg-nvr-cyan/[0.06]"
1067
1067
  ),
1068
1068
  children: [
1069
- f.has(ne(T)) && /* @__PURE__ */ t(lt, {}),
1070
- /* @__PURE__ */ t(rr, { revision: T, isLast: b })
1069
+ f.has(ne(T)) && /* @__PURE__ */ t(ot, {}),
1070
+ /* @__PURE__ */ t(sr, { revision: T, isLast: x })
1071
1071
  ]
1072
1072
  },
1073
1073
  ne(T)
@@ -1076,21 +1076,21 @@ function or({
1076
1076
  return /* @__PURE__ */ r(
1077
1077
  "div",
1078
1078
  {
1079
- className: M(
1079
+ className: j(
1080
1080
  "nvr-fade-in relative",
1081
1081
  f.has(ne(T)) && "rounded-md bg-nvr-cyan/[0.06]"
1082
1082
  ),
1083
1083
  children: [
1084
- f.has(ne(T)) && /* @__PURE__ */ t(lt, {}),
1084
+ f.has(ne(T)) && /* @__PURE__ */ t(ot, {}),
1085
1085
  /* @__PURE__ */ t(
1086
- sr,
1086
+ nr,
1087
1087
  {
1088
1088
  revision: T,
1089
1089
  previousData: (w == null ? void 0 : w.data) ?? null,
1090
1090
  meta: p,
1091
1091
  onRollback: i,
1092
1092
  inlineTableFields: a,
1093
- isLast: b
1093
+ isLast: x
1094
1094
  }
1095
1095
  )
1096
1096
  ]
@@ -1101,7 +1101,7 @@ function or({
1101
1101
  ] }, S.day)) })
1102
1102
  ] }) });
1103
1103
  }
1104
- function lt() {
1104
+ function ot() {
1105
1105
  return (
1106
1106
  // Under the timeline dot, inside the row's 36px gutter.
1107
1107
  /* @__PURE__ */ t(
@@ -1116,7 +1116,7 @@ function lt() {
1116
1116
  }
1117
1117
  function Xr({
1118
1118
  collection: e,
1119
- item: n,
1119
+ item: l,
1120
1120
  onRollback: i,
1121
1121
  triggerClassName: a,
1122
1122
  inlineTableFields: m,
@@ -1124,19 +1124,19 @@ function Xr({
1124
1124
  onOpenChange: p,
1125
1125
  compact: s
1126
1126
  }) {
1127
- const g = o !== void 0, c = bt(e), [x, f] = L(cr), k = Ve(!1), [u, R] = L(null);
1127
+ const g = o !== void 0, c = ft(e), [b, f] = L(mr), k = ze(!1), [u, R] = L(null);
1128
1128
  qe(() => {
1129
1129
  k.current || !c.view || (k.current = !0, f(c.view));
1130
1130
  }, [c.view]);
1131
1131
  const C = (y) => {
1132
1132
  k.current = !0, R(null), f(y), c.setView(y);
1133
1133
  try {
1134
- localStorage.setItem(St, y);
1134
+ localStorage.setItem($t, y);
1135
1135
  } catch {
1136
1136
  }
1137
1137
  };
1138
- return /* @__PURE__ */ r($a, { open: o, onOpenChange: p, children: [
1139
- !g && /* @__PURE__ */ t(Ta, { asChild: !0, children: /* @__PURE__ */ r(
1138
+ return /* @__PURE__ */ r(Ta, { open: o, onOpenChange: p, children: [
1139
+ !g && /* @__PURE__ */ t(Ra, { asChild: !0, children: /* @__PURE__ */ r(
1140
1140
  oe,
1141
1141
  {
1142
1142
  variant: s ? "ghost" : "outline",
@@ -1145,47 +1145,47 @@ function Xr({
1145
1145
  "aria-label": "History",
1146
1146
  className: a ?? (s ? "h-8 w-8 rounded-none p-0" : "gap-1.5"),
1147
1147
  children: [
1148
- /* @__PURE__ */ t(Oe, { className: s ? "h-4 w-4" : "h-3.5 w-3.5" }),
1148
+ /* @__PURE__ */ t(Me, { className: s ? "h-4 w-4" : "h-3.5 w-3.5" }),
1149
1149
  !s && "History"
1150
1150
  ]
1151
1151
  }
1152
1152
  ) }),
1153
1153
  /* @__PURE__ */ t(
1154
- Ra,
1154
+ Fa,
1155
1155
  {
1156
- className: M(
1156
+ className: j(
1157
1157
  "overflow-y-auto p-0 transition-[width] duration-200 ease-out sm:max-w-[92vw]",
1158
1158
  // The table lays the fields out as columns: it gets the room for them.
1159
- x === "table" ? "w-[1320px]" : "w-[720px]"
1159
+ b === "table" ? "w-[1320px]" : "w-[720px]"
1160
1160
  ),
1161
1161
  children: /* @__PURE__ */ r("div", { className: "p-6", children: [
1162
- /* @__PURE__ */ r(Fa, { children: [
1162
+ /* @__PURE__ */ r(Da, { children: [
1163
1163
  /* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-2 pr-8", children: [
1164
- /* @__PURE__ */ r(Da, { className: "flex items-center gap-2 text-base", children: [
1165
- /* @__PURE__ */ t(Oe, { className: "h-4 w-4 text-slate-400" }),
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" }),
1166
1166
  "Revision history"
1167
1167
  ] }),
1168
- /* @__PURE__ */ t(mr, { view: x, onChange: C })
1168
+ /* @__PURE__ */ t(pr, { view: b, onChange: C })
1169
1169
  ] }),
1170
- /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: x === "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." })
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." })
1171
1171
  ] }),
1172
- x === "table" ? /* @__PURE__ */ t(
1173
- xr,
1172
+ b === "table" ? /* @__PURE__ */ t(
1173
+ br,
1174
1174
  {
1175
1175
  collection: e,
1176
- item: n,
1176
+ item: l,
1177
1177
  onOpenSave: (y) => {
1178
1178
  R(y.startsWith("move|") ? null : y), f("timeline");
1179
1179
  }
1180
1180
  }
1181
1181
  ) : /* @__PURE__ */ r(ee, { children: [
1182
- /* @__PURE__ */ t(ir, { collection: e, item: n }),
1183
- /* @__PURE__ */ t(Aa, { collection: e, item: String(n) }),
1182
+ /* @__PURE__ */ t(dr, { collection: e, item: l }),
1183
+ /* @__PURE__ */ t(La, { collection: e, item: String(l) }),
1184
1184
  /* @__PURE__ */ t(
1185
- or,
1185
+ ir,
1186
1186
  {
1187
1187
  collection: e,
1188
- item: n,
1188
+ item: l,
1189
1189
  onRollback: i,
1190
1190
  inlineTableFields: m,
1191
1191
  focusSave: u
@@ -1197,22 +1197,22 @@ function Xr({
1197
1197
  )
1198
1198
  ] });
1199
1199
  }
1200
- function ir({ collection: e, item: n }) {
1201
- const i = pe(), a = Ue(e, !0), [m, o] = L(""), [p, s] = L(""), { data: g, isFetching: c } = le({
1202
- queryKey: ["rev-value-search", e, n, p],
1203
- queryFn: () => i.request(ae("/revisions/value-search", { collection: e, item: n, q: p })).then((x) => x.data),
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
1204
  enabled: p.length >= 2
1205
1205
  });
1206
1206
  return /* @__PURE__ */ r("div", { className: "mt-3", children: [
1207
1207
  /* @__PURE__ */ r("div", { className: "relative", children: [
1208
- /* @__PURE__ */ t(Ut, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
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" }),
1209
1209
  /* @__PURE__ */ t(
1210
1210
  "input",
1211
1211
  {
1212
1212
  value: m,
1213
- onChange: (x) => o(x.target.value),
1214
- onKeyDown: (x) => {
1215
- x.key === "Enter" && s(m.trim());
1213
+ onChange: (b) => o(b.target.value),
1214
+ onKeyDown: (b) => {
1215
+ b.key === "Enter" && s(m.trim());
1216
1216
  },
1217
1217
  placeholder: "Search this record’s history for a value — who wrote it, and when",
1218
1218
  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"
@@ -1227,7 +1227,7 @@ function ir({ collection: e, item: n }) {
1227
1227
  },
1228
1228
  className: "absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",
1229
1229
  "aria-label": "Clear search",
1230
- children: /* @__PURE__ */ t(ct, { className: "h-3.5 w-3.5" })
1230
+ children: /* @__PURE__ */ t(pt, { className: "h-3.5 w-3.5" })
1231
1231
  }
1232
1232
  )
1233
1233
  ] }),
@@ -1236,8 +1236,8 @@ function ir({ collection: e, item: n }) {
1236
1236
  p,
1237
1237
  "” never appears in this record’s recorded changes."
1238
1238
  ] }) : /* @__PURE__ */ r(ee, { children: [
1239
- g == null ? void 0 : g.matches.map((x) => /* @__PURE__ */ r("div", { className: "text-[11.5px]", children: [
1240
- /* @__PURE__ */ t("p", { className: "text-slate-600 dark:text-slate-300", children: x.fields.map((f) => /* @__PURE__ */ r("span", { 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
1241
  /* @__PURE__ */ t("span", { className: "font-medium", title: f.field, children: $(a, f.field).label }),
1242
1242
  " ",
1243
1243
  "→ “",
@@ -1246,26 +1246,26 @@ function ir({ collection: e, item: n }) {
1246
1246
  " "
1247
1247
  ] }, f.field)) }),
1248
1248
  /* @__PURE__ */ r("p", { className: "text-[10.5px] text-slate-400", children: [
1249
- x.user_name ?? "System",
1249
+ b.user_name ?? "System",
1250
1250
  " · ",
1251
- x.timestamp ? Z(x.timestamp) : "",
1251
+ b.timestamp ? Z(b.timestamp) : "",
1252
1252
  " ·",
1253
1253
  " ",
1254
- x.action
1254
+ b.action
1255
1255
  ] })
1256
- ] }, x.revision_id)),
1256
+ ] }, b.revision_id)),
1257
1257
  (g == null ? void 0 : g.truncated) && /* @__PURE__ */ t("p", { className: "text-[10.5px] text-amber-600", children: "Showing the newest 200 matches." })
1258
1258
  ] }) })
1259
1259
  ] });
1260
1260
  }
1261
- function dr({ revisionId: e }) {
1262
- const n = pe(), i = Ce(), [a, m] = L(""), { data: o = [] } = le({
1261
+ function cr({ revisionId: e }) {
1262
+ const l = pe(), i = Se(), [a, m] = L(""), { data: o = [] } = le({
1263
1263
  queryKey: ["revision-notes", String(e)],
1264
- queryFn: () => n.request(ae("/comments", { collection: "nivaro_revisions", item: String(e) })).then((s) => s.data ?? []).catch(() => []),
1264
+ queryFn: () => l.request(ae("/comments", { collection: "nivaro_revisions", item: String(e) })).then((s) => s.data ?? []).catch(() => []),
1265
1265
  staleTime: 3e4
1266
- }), p = Le({
1267
- mutationFn: () => n.request(
1268
- ve("/comments", { collection: "nivaro_revisions", item: String(e), text: a })
1266
+ }), p = Oe({
1267
+ mutationFn: () => l.request(
1268
+ ke("/comments", { collection: "nivaro_revisions", item: String(e), text: a })
1269
1269
  ),
1270
1270
  onSuccess: () => {
1271
1271
  m(""), i.invalidateQueries({ queryKey: ["revision-notes", String(e)] });
@@ -1280,7 +1280,7 @@ function dr({ revisionId: e }) {
1280
1280
  "— ",
1281
1281
  s.user_name ?? "someone",
1282
1282
  " · ",
1283
- xe(s.created_at)
1283
+ be(s.created_at)
1284
1284
  ] })
1285
1285
  ] }, s.id)),
1286
1286
  /* @__PURE__ */ r(
@@ -1314,20 +1314,20 @@ function dr({ revisionId: e }) {
1314
1314
  )
1315
1315
  ] });
1316
1316
  }
1317
- function Se({
1317
+ function _e({
1318
1318
  userId: e,
1319
- name: n,
1319
+ name: l,
1320
1320
  size: i = "md"
1321
1321
  }) {
1322
- const a = i === "sm" ? "h-5 w-5 text-[9px]" : "h-6 w-6 text-[10px]", m = n.split(" ").map((p) => p[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() || "·", o = /* @__PURE__ */ t(
1323
- xa,
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,
1324
1324
  {
1325
1325
  userId: e,
1326
1326
  className: a,
1327
1327
  fallback: /* @__PURE__ */ t(
1328
1328
  "span",
1329
1329
  {
1330
- className: M(
1330
+ className: j(
1331
1331
  "flex shrink-0 items-center justify-center rounded-full bg-nvr-cyan/10 font-semibold text-nvr-navy dark:text-nvr-cyan",
1332
1332
  a
1333
1333
  ),
@@ -1340,7 +1340,7 @@ function Se({
1340
1340
  "button",
1341
1341
  {
1342
1342
  type: "button",
1343
- "aria-label": `${n} — open profile card`,
1343
+ "aria-label": `${l} — open profile card`,
1344
1344
  "data-revision-avatar": !0,
1345
1345
  onClick: (p) => p.stopPropagation(),
1346
1346
  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",
@@ -1348,17 +1348,17 @@ function Se({
1348
1348
  }
1349
1349
  ) }) : /* @__PURE__ */ t("span", { className: "shrink-0", children: o });
1350
1350
  }
1351
- const St = "nvr:revisions-view";
1352
- function cr() {
1351
+ const $t = "nvr:revisions-view";
1352
+ function mr() {
1353
1353
  try {
1354
- return localStorage.getItem(St) === "table" ? "table" : "timeline";
1354
+ return localStorage.getItem($t) === "table" ? "table" : "timeline";
1355
1355
  } catch {
1356
1356
  return "timeline";
1357
1357
  }
1358
1358
  }
1359
- function mr({
1359
+ function pr({
1360
1360
  view: e,
1361
- onChange: n
1361
+ onChange: l
1362
1362
  }) {
1363
1363
  return /* @__PURE__ */ t(
1364
1364
  "fieldset",
@@ -1367,8 +1367,8 @@ function mr({
1367
1367
  "data-revision-view-switch": !0,
1368
1368
  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
1369
  children: [
1370
- { v: "timeline", label: "Timeline", icon: Kt },
1371
- { v: "table", label: "Table", icon: Vt }
1370
+ { v: "timeline", label: "Timeline", icon: zt },
1371
+ { v: "table", label: "Table", icon: Bt }
1372
1372
  ].map(({ v: a, label: m, icon: o }) => {
1373
1373
  const p = e === a;
1374
1374
  return /* @__PURE__ */ r(
@@ -1376,8 +1376,8 @@ function mr({
1376
1376
  {
1377
1377
  type: "button",
1378
1378
  "aria-pressed": p,
1379
- onClick: () => n(a),
1380
- className: M(
1379
+ onClick: () => l(a),
1380
+ className: j(
1381
1381
  "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
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"
1383
1383
  ),
@@ -1392,41 +1392,41 @@ function mr({
1392
1392
  }
1393
1393
  );
1394
1394
  }
1395
- function be(e, n) {
1396
- return e == null || e === "" ? "" : ge(e) ? kt(e) : n.cmp && typeof e != "object" && !n.dateOnly ? ze(e, n.cmp) : yt(e, n.dateOnly);
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);
1397
1397
  }
1398
- function ke(e, n, i) {
1398
+ function we(e, l, i) {
1399
1399
  const a = $(i, e);
1400
- return Ma(
1400
+ return Ia(
1401
1401
  e,
1402
- n,
1402
+ l,
1403
1403
  a.derive ?? null,
1404
- (m, o) => m == null ? $(i, o ?? "").label : o ? fe(o.replace(/_/g, " ")) : fe(m.replace(/_/g, " ")),
1405
- (m) => pr(m, a)
1404
+ (m, o) => m == null ? $(i, o ?? "").label : o ? ge(o.replace(/_/g, " ")) : ge(m.replace(/_/g, " ")),
1405
+ (m) => hr(m, a)
1406
1406
  );
1407
1407
  }
1408
- const ot = (e) => e == null || e === "", it = (e) => ge(e) || typeof e == "string" && e.length > 60;
1409
- function pr(e, n) {
1410
- if (!n.cmp) return Ia(e);
1411
- const i = ze(Math.abs(e), n.cmp);
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);
1412
1412
  return `${e > 0 ? "+" : e < 0 ? "−" : ""}${i}`;
1413
1413
  }
1414
- function hr({
1414
+ function ur({
1415
1415
  field: e,
1416
- label: n,
1416
+ label: l,
1417
1417
  tag: i,
1418
1418
  onRemove: a
1419
1419
  }) {
1420
- const { attributes: m, listeners: o, setNodeRef: p, transform: s, transition: g, isDragging: c } = Mt({
1420
+ const { attributes: m, listeners: o, setNodeRef: p, transform: s, transition: g, isDragging: c } = Kt({
1421
1421
  id: e
1422
1422
  });
1423
1423
  return /* @__PURE__ */ r(
1424
1424
  "div",
1425
1425
  {
1426
1426
  ref: p,
1427
- style: { transform: It.Transform.toString(s), transition: g },
1427
+ style: { transform: Vt.Transform.toString(s), transition: g },
1428
1428
  "data-shown-field": e,
1429
- className: M(
1429
+ className: j(
1430
1430
  "flex items-center gap-2 rounded-sm px-2 py-1.5 text-[12px] hover:bg-slate-50 dark:hover:bg-muted/60",
1431
1431
  c && "relative z-10 bg-white shadow-md ring-1 ring-slate-200 dark:bg-card dark:ring-border"
1432
1432
  ),
@@ -1435,15 +1435,15 @@ function hr({
1435
1435
  "button",
1436
1436
  {
1437
1437
  type: "button",
1438
- "aria-label": `Drag to move ${n}`,
1438
+ "aria-label": `Drag to move ${l}`,
1439
1439
  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
1440
  ...m,
1441
1441
  ...o,
1442
- onKeyDown: (x) => {
1442
+ onKeyDown: (b) => {
1443
1443
  var f;
1444
- x.stopPropagation(), (f = o == null ? void 0 : o.onKeyDown) == null || f.call(o, x);
1444
+ b.stopPropagation(), (f = o == null ? void 0 : o.onKeyDown) == null || f.call(o, b);
1445
1445
  },
1446
- children: /* @__PURE__ */ t(mt, { className: "h-3.5 w-3.5" })
1446
+ children: /* @__PURE__ */ t(ht, { className: "h-3.5 w-3.5" })
1447
1447
  }
1448
1448
  ),
1449
1449
  /* @__PURE__ */ t(
@@ -1451,19 +1451,19 @@ function hr({
1451
1451
  {
1452
1452
  checked: !0,
1453
1453
  onCheckedChange: () => a(),
1454
- "aria-label": `Hide ${n}`,
1454
+ "aria-label": `Hide ${l}`,
1455
1455
  className: "h-3.5 w-3.5"
1456
1456
  }
1457
1457
  ),
1458
- /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", children: n }),
1458
+ /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", children: l }),
1459
1459
  i
1460
1460
  ]
1461
1461
  }
1462
1462
  );
1463
1463
  }
1464
- function ur({
1464
+ function xr({
1465
1465
  columns: e,
1466
- meta: n,
1466
+ meta: l,
1467
1467
  order: i,
1468
1468
  shown: a,
1469
1469
  defaultOrder: m,
@@ -1471,65 +1471,65 @@ function ur({
1471
1471
  onChange: p,
1472
1472
  onReset: s
1473
1473
  }) {
1474
- const [g, c] = L(!1), [x, f] = L(""), k = O(() => new Map(e.map((b) => [b.field, b])), [e]), u = i.filter((b) => k.has(b)), R = Ft(
1475
- Ye(Dt, { activationConstraint: { distance: 4 } }),
1476
- Ye(At, { coordinateGetter: jt })
1477
- ), C = (b) => {
1478
- const w = u.indexOf(String(b.active.id)), F = b.over ? u.indexOf(String(b.over.id)) : -1;
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
1479
  if (w < 0 || F < 0 || w === F) return;
1480
- const q = Et(u, w, F);
1480
+ const q = It(u, w, F);
1481
1481
  let I = 0;
1482
- p(i.map((j) => k.has(j) ? q[I++] : j));
1483
- }, y = (b) => p(a.has(b) ? i.filter((w) => w !== b) : [...i, b]), S = O(() => {
1484
- const b = e.filter((j) => !a.has(j.field)), w = [], F = /* @__PURE__ */ new Set(), q = (j, P, W) => {
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
1485
  const B = W.filter((J) => !F.has(J.field));
1486
1486
  for (const J of B) F.add(J.field);
1487
- B.length && w.push({ key: j, label: P, items: B });
1487
+ B.length && w.push({ key: M, label: P, items: B });
1488
1488
  };
1489
1489
  q(
1490
1490
  "changed",
1491
1491
  "Changed on this record",
1492
- b.filter((j) => j.changes > 0 && !j.field.startsWith("child:")).sort((j, P) => P.changes - j.changes)
1492
+ x.filter((M) => M.changes > 0 && !M.field.startsWith("child:")).sort((M, P) => P.changes - M.changes)
1493
1493
  ), q(
1494
1494
  "computed",
1495
1495
  "Totals and calculated fields",
1496
- b.filter((j) => $(n, j.field).derive)
1496
+ x.filter((M) => $(l, M.field).derive)
1497
1497
  );
1498
1498
  const I = /* @__PURE__ */ new Map();
1499
- for (const j of b) {
1500
- const P = $(n, j.field).section;
1499
+ for (const M of x) {
1500
+ const P = $(l, M.field).section;
1501
1501
  if (!P) continue;
1502
1502
  const W = I.get(P.key) ?? { label: P.label, sort: P.sort, items: [] };
1503
- W.items.push(j), I.set(P.key, W);
1503
+ W.items.push(M), I.set(P.key, W);
1504
1504
  }
1505
- for (const [j, P] of [...I].sort((W, B) => W[1].sort - B[1].sort))
1506
- q(`section:${j}`, P.label, P.items);
1507
- return q("other", "Other fields", b), w;
1508
- }, [e, a, n]), T = (b) => /* @__PURE__ */ t(
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(
1509
1509
  "span",
1510
1510
  {
1511
- className: M(
1511
+ className: j(
1512
1512
  "flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-sm border",
1513
- b ? "border-nvr-cyan bg-nvr-cyan text-white" : "border-slate-300 dark:border-slate-600"
1513
+ x ? "border-nvr-cyan bg-nvr-cyan text-white" : "border-slate-300 dark:border-slate-600"
1514
1514
  ),
1515
- children: b && /* @__PURE__ */ t(Yt, { className: "h-3 w-3" })
1515
+ children: x && /* @__PURE__ */ t(Gt, { className: "h-3 w-3" })
1516
1516
  }
1517
- ), v = (b) => /* @__PURE__ */ r("span", { className: "ml-auto flex shrink-0 items-center gap-1.5 text-[11px] text-slate-400", children: [
1518
- $(n, b.field).derive && /* @__PURE__ */ t(we, { className: "h-3 w-3", "aria-label": "Calculated" }),
1519
- b.changes > 0 && /* @__PURE__ */ r("span", { className: "tabular-nums", children: [
1520
- b.changes,
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,
1521
1521
  "×"
1522
1522
  ] })
1523
1523
  ] });
1524
- return /* @__PURE__ */ r(Ca, { open: g, onOpenChange: c, children: [
1525
- /* @__PURE__ */ t(Sa, { asChild: !0, children: /* @__PURE__ */ r(
1524
+ return /* @__PURE__ */ r(Sa, { open: g, onOpenChange: c, children: [
1525
+ /* @__PURE__ */ t(_a, { asChild: !0, children: /* @__PURE__ */ r(
1526
1526
  "button",
1527
1527
  {
1528
1528
  type: "button",
1529
1529
  "data-revision-columns": !0,
1530
1530
  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
1531
  children: [
1532
- /* @__PURE__ */ t(Ht, { className: "h-3.5 w-3.5 text-slate-400" }),
1532
+ /* @__PURE__ */ t(Wt, { className: "h-3.5 w-3.5 text-slate-400" }),
1533
1533
  /* @__PURE__ */ r("span", { children: [
1534
1534
  "Fields ",
1535
1535
  /* @__PURE__ */ t("span", { className: "tabular-nums text-slate-400", children: u.length }),
@@ -1538,17 +1538,17 @@ function ur({
1538
1538
  e.length
1539
1539
  ] })
1540
1540
  ] }),
1541
- /* @__PURE__ */ t(Wt, { className: "h-3.5 w-3.5 text-slate-400" })
1541
+ /* @__PURE__ */ t(Jt, { className: "h-3.5 w-3.5 text-slate-400" })
1542
1542
  ]
1543
1543
  }
1544
1544
  ) }),
1545
- /* @__PURE__ */ t(_a, { align: "start", className: "w-[380px] p-0", children: /* @__PURE__ */ r(fa, { children: [
1545
+ /* @__PURE__ */ t($a, { align: "start", className: "w-[380px] p-0", children: /* @__PURE__ */ r(ga, { children: [
1546
1546
  /* @__PURE__ */ t(
1547
- ga,
1547
+ ya,
1548
1548
  {
1549
1549
  placeholder: "Find a field…",
1550
1550
  className: "text-[12px]",
1551
- value: x,
1551
+ value: b,
1552
1552
  onValueChange: f
1553
1553
  }
1554
1554
  ),
@@ -1566,7 +1566,7 @@ function ur({
1566
1566
  "button",
1567
1567
  {
1568
1568
  type: "button",
1569
- onClick: () => p(e.map((b) => b.field)),
1569
+ onClick: () => p(e.map((x) => x.field)),
1570
1570
  className: "rounded px-2 py-0.5 text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-muted",
1571
1571
  children: "All"
1572
1572
  }
@@ -1591,39 +1591,39 @@ function ur({
1591
1591
  }
1592
1592
  )
1593
1593
  ] }),
1594
- /* @__PURE__ */ r(ya, { className: "max-h-[420px]", children: [
1595
- /* @__PURE__ */ t(va, { children: "No field by that name." }),
1596
- u.length > 0 && !x.trim() && /* @__PURE__ */ r("div", { className: "px-1 pb-1", "data-shown-columns": !0, children: [
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: [
1597
1597
  /* @__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
1598
  /* @__PURE__ */ t(
1599
- Lt,
1599
+ Mt,
1600
1600
  {
1601
1601
  sensors: R,
1602
- collisionDetection: Ot,
1602
+ collisionDetection: jt,
1603
1603
  onDragEnd: C,
1604
- children: /* @__PURE__ */ t(qt, { items: u, strategy: Pt, children: u.map((b) => {
1605
- const w = k.get(b);
1604
+ children: /* @__PURE__ */ t(Pt, { items: u, strategy: Et, children: u.map((x) => {
1605
+ const w = k.get(x);
1606
1606
  return /* @__PURE__ */ t(
1607
- hr,
1607
+ ur,
1608
1608
  {
1609
- field: b,
1609
+ field: x,
1610
1610
  label: w.label,
1611
1611
  tag: v(w),
1612
- onRemove: () => y(b)
1612
+ onRemove: () => y(x)
1613
1613
  },
1614
- b
1614
+ x
1615
1615
  );
1616
1616
  }) })
1617
1617
  }
1618
1618
  )
1619
1619
  ] }),
1620
- u.length > 0 && x.trim() !== "" && /* @__PURE__ */ t(et, { heading: "Shown", children: u.map((b) => {
1621
- const w = k.get(b);
1620
+ u.length > 0 && b.trim() !== "" && /* @__PURE__ */ t(tt, { heading: "Shown", children: u.map((x) => {
1621
+ const w = k.get(x);
1622
1622
  return /* @__PURE__ */ r(
1623
- tt,
1623
+ at,
1624
1624
  {
1625
- value: `${w.label} ${b} shown`,
1626
- onSelect: () => y(b),
1625
+ value: `${w.label} ${x} shown`,
1626
+ onSelect: () => y(x),
1627
1627
  className: "text-[12px]",
1628
1628
  children: [
1629
1629
  T(!0),
@@ -1631,13 +1631,13 @@ function ur({
1631
1631
  v(w)
1632
1632
  ]
1633
1633
  },
1634
- `shown-${b}`
1634
+ `shown-${x}`
1635
1635
  );
1636
1636
  }) }),
1637
- S.map((b) => /* @__PURE__ */ t(et, { heading: b.label, children: b.items.map((w) => /* @__PURE__ */ r(
1638
- tt,
1637
+ S.map((x) => /* @__PURE__ */ t(tt, { heading: x.label, children: x.items.map((w) => /* @__PURE__ */ r(
1638
+ at,
1639
1639
  {
1640
- value: `${w.label} ${w.field} ${b.label}`,
1640
+ value: `${w.label} ${w.field} ${x.label}`,
1641
1641
  onSelect: () => y(w.field),
1642
1642
  className: "text-[12px]",
1643
1643
  children: [
@@ -1646,117 +1646,117 @@ function ur({
1646
1646
  v(w)
1647
1647
  ]
1648
1648
  },
1649
- `${b.key}-${w.field}`
1650
- )) }, b.key))
1649
+ `${x.key}-${w.field}`
1650
+ )) }, x.key))
1651
1651
  ] }),
1652
1652
  /* @__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
1653
  ] }) })
1654
1654
  ] });
1655
1655
  }
1656
- const br = {
1656
+ const ct = {
1657
1657
  created: "bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",
1658
1658
  changed: "bg-slate-100 text-slate-600 dark:bg-muted dark:text-slate-300",
1659
1659
  deleted: "bg-red-50 text-red-700 dark:bg-red-500/10 dark:text-red-300",
1660
1660
  restored: "bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",
1661
1661
  moved: "bg-violet-50 text-violet-700 dark:bg-violet-500/10 dark:text-violet-300"
1662
1662
  };
1663
- function xr({
1663
+ function br({
1664
1664
  collection: e,
1665
- item: n,
1665
+ item: l,
1666
1666
  onOpenSave: i
1667
1667
  }) {
1668
- var Je, Qe;
1669
- const a = pe(), m = Ue(e, !0), { data: o, isLoading: p } = le({
1670
- queryKey: ["revisions", e, n],
1671
- queryFn: () => a.request(ae("/revisions", { collection: e, item: n })).then((l) => l.data ?? []),
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 ?? []),
1672
1672
  staleTime: 3e4
1673
- }), s = Ce();
1674
- ut(e, n, [["revisions", e, n]], { client: s });
1673
+ }), s = Se();
1674
+ bt(e, l, [["revisions", e, l]], { client: s });
1675
1675
  const g = O(
1676
- () => (o ?? []).filter((l) => l.actor && l.actor.kind !== "person").map((l) => ({ action: l.action, user: l.user_id, actor: l.actor })),
1676
+ () => (o ?? []).filter((n) => n.actor && n.actor.kind !== "person").map((n) => ({ action: n.action, user: n.user_id, actor: n.actor })),
1677
1677
  [o]
1678
- ), c = xt(g, { enabled: g.length > 0 }), x = O(
1679
- () => gt(o ?? [], {
1680
- name: (l) => te(l, c),
1678
+ ), c = gt(g, { enabled: g.length > 0 }), b = O(
1679
+ () => vt(o ?? [], {
1680
+ name: (n) => te(n, c),
1681
1681
  // Pipeline moves are rows of their own while the Pipeline step column is shown.
1682
1682
  withMoves: !0
1683
1683
  }),
1684
1684
  [o, c]
1685
1685
  ), { data: f } = le({
1686
- queryKey: ["revision-child-columns", e, n],
1687
- queryFn: () => a.request(ae("/revisions/child-columns", { collection: e, item: n })).then((l) => l.data),
1686
+ queryKey: ["revision-child-columns", e, l],
1687
+ queryFn: () => a.request(ae("/revisions/child-columns", { collection: e, item: l })).then((n) => n.data),
1688
1688
  staleTime: 3e4
1689
1689
  }), k = O(() => {
1690
- const l = new Map(m);
1690
+ const n = new Map(m);
1691
1691
  for (const d of (f == null ? void 0 : f.columns) ?? [])
1692
- l.set(d.key, {
1692
+ n.set(d.key, {
1693
1693
  label: `${d.row_label} · ${d.field_label}`,
1694
1694
  system: !1,
1695
1695
  onLayout: !1,
1696
1696
  cmp: d.cmp,
1697
1697
  section: { key: `child:${d.collection}`, label: d.collection_label, sort: 1e5 }
1698
1698
  });
1699
- return l;
1699
+ return n;
1700
1700
  }, [m, f]), u = O(() => {
1701
- const l = (f == null ? void 0 : f.columns) ?? [];
1702
- if (!l.length) return x;
1703
- const d = x.map((N) => ({ ...N, values: { ...N.values }, changed: new Set(N.changed) }));
1704
- for (const N of l) {
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
1705
  const _ = (f == null ? void 0 : f.series[N.key]) ?? [];
1706
- for (const V of d) V.values[N.key] = La(_, V.timestamp);
1706
+ for (const V of d) V.values[N.key] = Oa(_, V.timestamp);
1707
1707
  for (let V = 0; V < d.length - 1; V++)
1708
- Oa(d[V].values[N.key], d[V + 1].values[N.key]) || d[V].changed.add(N.key);
1708
+ Ma(d[V].values[N.key], d[V + 1].values[N.key]) || d[V].changed.add(N.key);
1709
1709
  }
1710
1710
  return d;
1711
- }, [x, f]), R = O(
1712
- () => ja(u, (l) => $(k, l)),
1711
+ }, [b, f]), R = O(
1712
+ () => ja(u, (n) => $(k, n)),
1713
1713
  [u, k]
1714
- ), C = bt(e), y = ca(e), { isAdmin: S } = ra(), T = O(
1715
- () => R.filter((l) => l.changes > 0 && !l.field.startsWith("child:")).map((l) => l.field),
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
1716
  [R]
1717
- ), v = C.columns ?? ((Je = y.roleDefault) == null ? void 0 : Je.fields) ?? T, b = O(() => new Set(v), [v]), w = O(() => {
1718
- const l = new Map(R.map((d) => [d.field, d]));
1719
- return v.map((d) => l.get(d)).filter((d) => !!d);
1720
- }, [v, R]), F = (l) => C.setColumns([...new Set(l)]), [q, I] = L(null), [j, P] = L(null), W = (l, d) => {
1721
- if (l === d) return;
1722
- const N = v.filter((V) => V !== l), _ = N.indexOf(d);
1723
- F(_ < 0 ? [...N, l] : [...N.slice(0, _), l, ...N.slice(_)]);
1724
- }, B = Ve(null), [J, he] = L(!0), de = ta(), [h, D] = L(""), [U, K] = L(""), [X, _e] = L(/* @__PURE__ */ new Set()), A = O(() => {
1725
- const l = /* @__PURE__ */ new Map();
1726
- for (const d of u) l.set(d.who, (l.get(d.who) ?? 0) + 1);
1727
- return [...l].map(([d, N]) => ({ name: d, count: N })).sort((d, N) => N.count - d.count);
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
1728
  }, [u]), z = O(() => {
1729
- let l = b.has(De) ? u : u.filter((d) => d.action !== "moved");
1730
- return l = l.filter(
1731
- (d) => Ka(d.timestamp, h, U) && (X.size === 0 || X.has(d.who))
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
1732
  ), J ? qa(
1733
- l,
1733
+ n,
1734
1734
  w.map((d) => d.field)
1735
- ) : l;
1736
- }, [u, w, b, J, h, U, X]), [Y, ue] = L([]), $e = (l) => ue((d) => d.includes(l) ? d.filter((N) => N !== l) : [...d, l].slice(-2)), G = O(() => {
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
1737
  if (Y.length !== 2) return null;
1738
- const l = Y.map((N) => u.find((_) => _.key === N)).filter((N) => !!N);
1739
- if (l.length !== 2) return null;
1738
+ const n = Y.map((N) => u.find((_) => _.key === N)).filter((N) => !!N);
1739
+ if (n.length !== 2) return null;
1740
1740
  const d = (N) => N.timestamp ? new Date(N.timestamp).getTime() : 0;
1741
- return l.sort((N, _) => d(N) - d(_));
1742
- }, [Y, u]), [re, We] = L(null), Te = O(() => {
1741
+ return n.sort((N, _) => d(N) - d(_));
1742
+ }, [Y, u]), [re, Je] = L(null), Re = O(() => {
1743
1743
  var N;
1744
1744
  if (!re) return null;
1745
- const l = $(k, re), d = [...u].filter((_) => re === De ? !0 : _.action !== "moved").reverse();
1745
+ const n = $(k, re), d = [...u].filter((_) => re === fe ? !0 : _.action !== "moved").reverse();
1746
1746
  return {
1747
- label: ((N = w.find((_) => _.field === re)) == null ? void 0 : N.label) ?? l.label,
1747
+ label: ((N = w.find((_) => _.field === re)) == null ? void 0 : N.label) ?? n.label,
1748
1748
  points: d.map((_) => ({
1749
1749
  t: _.timestamp,
1750
1750
  v: _.values[re],
1751
- text: be(_.values[re], l)
1751
+ text: xe(_.values[re], n)
1752
1752
  }))
1753
1753
  };
1754
- }, [re, u, k, w]), { data: _t } = le({
1754
+ }, [re, u, k, w]), { data: Tt } = le({
1755
1755
  queryKey: ["revision-sets-roles"],
1756
- queryFn: () => a.request(ae("/roles")).then((l) => (l.data ?? []).map((d) => ({ id: String(d.id), name: String(d.name) }))),
1756
+ queryFn: () => a.request(ae("/roles")).then((n) => (n.data ?? []).map((d) => ({ id: String(d.id), name: String(d.name) }))),
1757
1757
  enabled: S,
1758
1758
  staleTime: 3e5
1759
- }), Re = (l) => l.action === "moved" && !l.userId ? `Automatic${l.trigger ? ` (after ${l.trigger.name})` : ""}` : l.who, $t = () => {
1759
+ }), Fe = (n) => n.action === "moved" && !n.userId ? `Automatic${n.trigger ? ` (after ${n.trigger.name})` : ""}` : n.who, Rt = () => {
1760
1760
  const d = [["When", "Changed by", "Action", ...w.map((E) => E.label)].map((E) => ({ v: E, style: "header" }))], N = [
1761
1761
  ["When", "Field", "Value", "Moved by", "Why"].map((E) => ({ v: E, style: "header" }))
1762
1762
  ];
@@ -1764,26 +1764,26 @@ function xr({
1764
1764
  const ce = E.timestamp ? Z(E.timestamp) : "";
1765
1765
  d.push([
1766
1766
  { v: ce },
1767
- { v: Re(E) },
1768
- { v: rt(E.action), style: "muted" },
1767
+ { v: Fe(E) },
1768
+ { v: st(E.action), style: "muted" },
1769
1769
  ...w.map((Q) => {
1770
- const me = be(E.values[Q.field], $(k, Q.field)), Rt = E.recalculated.has(Q.field) ? "recalculated" : E.changed.has(Q.field) ? "changed" : "plain";
1771
- return { v: me, style: Rt };
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 };
1772
1772
  })
1773
1773
  ]);
1774
1774
  for (const Q of w) {
1775
1775
  if (!E.recalculated.has(Q.field)) continue;
1776
- const me = ke(Q.field, E, k);
1776
+ const me = we(Q.field, E, k);
1777
1777
  N.push([
1778
1778
  { v: ce },
1779
1779
  { v: Q.label },
1780
- { v: be(E.values[Q.field], $(k, Q.field)) },
1780
+ { v: xe(E.values[Q.field], $(k, Q.field)) },
1781
1781
  { v: me.because ?? "" },
1782
1782
  { v: me.why }
1783
1783
  ]);
1784
1784
  }
1785
1785
  }
1786
- const _ = ma([
1786
+ const _ = pa([
1787
1787
  {
1788
1788
  name: "History",
1789
1789
  rows: d,
@@ -1797,25 +1797,25 @@ function xr({
1797
1797
  },
1798
1798
  { name: "Recalculations", rows: N, widths: [20, 24, 18, 40, 50] }
1799
1799
  ]), V = URL.createObjectURL(_), H = document.createElement("a");
1800
- H.href = V, H.download = `history-${e}-${n}.xlsx`, document.body.appendChild(H), H.click(), H.remove(), setTimeout(() => URL.revokeObjectURL(V), 1e3);
1801
- }, Tt = () => {
1802
- const l = Ea(
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
1803
  z,
1804
1804
  w,
1805
- (V, H) => be(H, $(k, V)),
1806
- (V, H) => ke(V, H, k)
1807
- ), d = new Blob([l], { type: "text/csv;charset=utf-8" }), N = URL.createObjectURL(d), _ = document.createElement("a");
1808
- _.href = N, _.download = `history-${e}-${n}.csv`, document.body.appendChild(_), _.click(), _.remove(), setTimeout(() => URL.revokeObjectURL(N), 1e3);
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);
1809
1809
  };
1810
- return p ? /* @__PURE__ */ t("div", { className: "space-y-2 pt-4", children: [1, 2, 3, 4, 5].map((l) => /* @__PURE__ */ t(ft, { className: "h-9 rounded-md" }, l)) }) : /* @__PURE__ */ r("div", { className: "pt-4", "data-revision-table-view": !0, children: [
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: [
1811
1811
  /* @__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
1812
  /* @__PURE__ */ t(
1813
- ur,
1813
+ xr,
1814
1814
  {
1815
1815
  columns: R,
1816
1816
  meta: k,
1817
1817
  order: v,
1818
- shown: b,
1818
+ shown: x,
1819
1819
  defaultOrder: T,
1820
1820
  saved: C.columns != null,
1821
1821
  onChange: F,
@@ -1823,35 +1823,35 @@ function xr({
1823
1823
  }
1824
1824
  ),
1825
1825
  /* @__PURE__ */ t(
1826
- Va,
1826
+ za,
1827
1827
  {
1828
1828
  personal: C.personalSets,
1829
1829
  shared: y.sets,
1830
- roleDefaultName: ((Qe = y.roleDefault) == null ? void 0 : Qe.name) ?? null,
1830
+ roleDefaultName: ((Ye = y.roleDefault) == null ? void 0 : Ye.name) ?? null,
1831
1831
  isAdmin: S,
1832
- roles: _t ?? [],
1833
- onApply: (l) => F(l),
1834
- onSavePersonal: (l) => C.setPersonalSets([
1835
- ...C.personalSets.filter((d) => d.name.toLowerCase() !== l.toLowerCase()),
1836
- { name: l, fields: v }
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 }
1837
1837
  ]),
1838
- onDeletePersonal: (l) => C.setPersonalSets(C.personalSets.filter((d) => d.name !== l)),
1839
- onShare: (l, d, N) => void y.save([
1840
- ...y.sets.filter((_) => _.name.toLowerCase() !== l.toLowerCase()).map((_) => N ? { ..._, is_default: !1 } : _),
1841
- { name: l, fields: v, default_roles: d, is_default: N }
1842
- ]).catch((_) => Fe(_, "The column set was not shared")),
1843
- onSetDefault: (l) => void y.save(y.sets.map((d) => ({ ...d, is_default: l != null && d.id === l }))).catch((d) => Fe(d, "The default column set was not changed")),
1844
- onDeleteShared: (l) => void y.save(y.sets.filter((d) => d.id !== l)).catch((d) => Fe(d, "The column set was not deleted"))
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"))
1845
1845
  }
1846
1846
  ),
1847
- /* @__PURE__ */ t(za, { people: A, value: X, onChange: _e }),
1847
+ /* @__PURE__ */ t(Ba, { people: A, value: X, onChange: $e }),
1848
1848
  /* @__PURE__ */ t(
1849
- Ba,
1849
+ Ua,
1850
1850
  {
1851
1851
  from: h,
1852
1852
  to: U,
1853
- onChange: (l, d) => {
1854
- D(l), K(d);
1853
+ onChange: (n, d) => {
1854
+ D(n), K(d);
1855
1855
  }
1856
1856
  }
1857
1857
  ),
@@ -1861,7 +1861,7 @@ function xr({
1861
1861
  {
1862
1862
  id: de,
1863
1863
  checked: J,
1864
- onCheckedChange: (l) => he(l === !0),
1864
+ onCheckedChange: (n) => he(n === !0),
1865
1865
  className: "h-3.5 w-3.5"
1866
1866
  }
1867
1867
  ),
@@ -1881,7 +1881,7 @@ function xr({
1881
1881
  "Changed"
1882
1882
  ] }),
1883
1883
  /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1", children: [
1884
- /* @__PURE__ */ t(we, { className: "h-3 w-3" }),
1884
+ /* @__PURE__ */ t(Ne, { className: "h-3 w-3" }),
1885
1885
  "Recalculated"
1886
1886
  ] }),
1887
1887
  /* @__PURE__ */ t(
@@ -1894,8 +1894,8 @@ function xr({
1894
1894
  }
1895
1895
  )
1896
1896
  ] }),
1897
- /* @__PURE__ */ r(ka, { children: [
1898
- /* @__PURE__ */ t(wa, { asChild: !0, children: /* @__PURE__ */ r(
1897
+ /* @__PURE__ */ r(wa, { children: [
1898
+ /* @__PURE__ */ t(Na, { asChild: !0, children: /* @__PURE__ */ r(
1899
1899
  oe,
1900
1900
  {
1901
1901
  variant: "outline",
@@ -1904,22 +1904,22 @@ function xr({
1904
1904
  disabled: z.length === 0 || w.length === 0,
1905
1905
  "data-revision-download": !0,
1906
1906
  children: [
1907
- /* @__PURE__ */ t(Ge, { className: "h-3.5 w-3.5" }),
1907
+ /* @__PURE__ */ t(Ze, { className: "h-3.5 w-3.5" }),
1908
1908
  "Download",
1909
- /* @__PURE__ */ t(Ie, { className: "h-3 w-3 text-slate-400" })
1909
+ /* @__PURE__ */ t(Ke, { className: "h-3 w-3 text-slate-400" })
1910
1910
  ]
1911
1911
  }
1912
1912
  ) }),
1913
- /* @__PURE__ */ r(Na, { align: "end", className: "w-[240px]", children: [
1914
- /* @__PURE__ */ r(at, { onSelect: $t, className: "gap-2 text-[12px]", children: [
1915
- /* @__PURE__ */ t(zt, { className: "h-3.5 w-3.5" }),
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" }),
1916
1916
  /* @__PURE__ */ r("span", { className: "flex flex-col", children: [
1917
1917
  "Excel",
1918
1918
  /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-500", children: "Changed cells shaded, a sheet of why values moved" })
1919
1919
  ] })
1920
1920
  ] }),
1921
- /* @__PURE__ */ r(at, { onSelect: Tt, className: "gap-2 text-[12px]", children: [
1922
- /* @__PURE__ */ t(Ge, { className: "h-3.5 w-3.5" }),
1921
+ /* @__PURE__ */ r(rt, { onSelect: Ft, className: "gap-2 text-[12px]", children: [
1922
+ /* @__PURE__ */ t(Ze, { className: "h-3.5 w-3.5" }),
1923
1923
  /* @__PURE__ */ r("span", { className: "flex flex-col", children: [
1924
1924
  "CSV",
1925
1925
  /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-500", children: "Plain values, any spreadsheet" })
@@ -1935,19 +1935,19 @@ function xr({
1935
1935
  "data-revision-compare": !0,
1936
1936
  children: [
1937
1937
  /* @__PURE__ */ r("div", { className: "mb-2 flex items-center gap-2 text-[12.5px]", children: [
1938
- /* @__PURE__ */ t(dt, { className: "h-3.5 w-3.5 text-slate-400" }),
1938
+ /* @__PURE__ */ t(mt, { className: "h-3.5 w-3.5 text-slate-400" }),
1939
1939
  /* @__PURE__ */ r("span", { className: "font-medium text-slate-800 dark:text-slate-100", children: [
1940
1940
  G[0].timestamp ? Z(G[0].timestamp) : "",
1941
1941
  " ·",
1942
1942
  " ",
1943
- Re(G[0])
1943
+ Fe(G[0])
1944
1944
  ] }),
1945
- /* @__PURE__ */ t(Ke, { className: "h-3 w-3 text-slate-400" }),
1945
+ /* @__PURE__ */ t(Ve, { className: "h-3 w-3 text-slate-400" }),
1946
1946
  /* @__PURE__ */ r("span", { className: "font-medium text-slate-800 dark:text-slate-100", children: [
1947
1947
  G[1].timestamp ? Z(G[1].timestamp) : "",
1948
1948
  " ·",
1949
1949
  " ",
1950
- Re(G[1])
1950
+ Fe(G[1])
1951
1951
  ] }),
1952
1952
  /* @__PURE__ */ t(
1953
1953
  "button",
@@ -1956,12 +1956,12 @@ function xr({
1956
1956
  onClick: () => ue([]),
1957
1957
  "aria-label": "Close the comparison",
1958
1958
  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(ct, { className: "h-3.5 w-3.5" })
1959
+ children: /* @__PURE__ */ t(pt, { className: "h-3.5 w-3.5" })
1960
1960
  }
1961
1961
  )
1962
1962
  ] }),
1963
1963
  /* @__PURE__ */ t("div", { className: "max-h-[320px] overflow-y-auto", children: /* @__PURE__ */ t(
1964
- Ct,
1964
+ _t,
1965
1965
  {
1966
1966
  before: G[0].values,
1967
1967
  after: G[1].values,
@@ -1972,8 +1972,8 @@ function xr({
1972
1972
  ]
1973
1973
  }
1974
1974
  ),
1975
- Te && /* @__PURE__ */ t(Ua, { label: Te.label, points: Te.points, onClose: () => We(null) }),
1976
- x.length === 0 ? /* @__PURE__ */ r("div", { className: "rounded-lg border border-dashed border-slate-200 py-12 text-center dark:border-border", children: [
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: [
1977
1977
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-600 dark:text-slate-300", children: "No saves yet" }),
1978
1978
  /* @__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
1979
  ] }) : w.length === 0 ? /* @__PURE__ */ r("div", { className: "rounded-lg border border-dashed border-slate-200 py-12 text-center dark:border-border", children: [
@@ -2004,107 +2004,129 @@ function xr({
2004
2004
  /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ r("tr", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: [
2005
2005
  /* @__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
2006
  /* @__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((l) => /* @__PURE__ */ t(
2007
+ w.map((n) => /* @__PURE__ */ t(
2008
2008
  "th",
2009
2009
  {
2010
2010
  draggable: !0,
2011
2011
  onDragStart: (d) => {
2012
- I(l.field), d.dataTransfer.effectAllowed = "move", d.dataTransfer.setData("text/plain", l.field);
2012
+ I(n.field), d.dataTransfer.effectAllowed = "move", d.dataTransfer.setData("text/plain", n.field);
2013
2013
  },
2014
2014
  onDragOver: (d) => {
2015
- q && (d.preventDefault(), j !== l.field && P(l.field));
2015
+ q && (d.preventDefault(), M !== n.field && P(n.field));
2016
2016
  },
2017
- onDragLeave: () => P((d) => d === l.field ? null : d),
2017
+ onDragLeave: () => P((d) => d === n.field ? null : d),
2018
2018
  onDrop: (d) => {
2019
- d.preventDefault(), q && W(q, l.field), I(null), P(null);
2019
+ d.preventDefault(), q && W(q, n.field), I(null), P(null);
2020
2020
  },
2021
2021
  onDragEnd: () => {
2022
2022
  I(null), P(null);
2023
2023
  },
2024
- onClick: () => We((d) => d === l.field ? null : l.field),
2024
+ onClick: () => Je((d) => d === n.field ? null : n.field),
2025
2025
  "aria-sort": "none",
2026
- "data-tip": `${l.label} — click to see it over time, drag to move`,
2027
- className: M(
2026
+ "data-tip": `${n.label} — click to see it over time, drag to move`,
2027
+ className: j(
2028
2028
  "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 === l.field && "bg-[#e6faff] text-slate-800 dark:bg-[#0b2a33] dark:text-slate-100",
2030
- q === l.field && "opacity-40",
2031
- j === l.field && q !== l.field && "shadow-[inset_2px_0_0_0_rgb(var(--nvr-cyan-rgb,0_206_255))]"
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))]"
2032
2032
  ),
2033
2033
  children: /* @__PURE__ */ r("span", { className: "flex items-center gap-1", children: [
2034
- /* @__PURE__ */ t(mt, { className: "h-3 w-3 shrink-0 text-slate-300 opacity-0 transition-opacity group-hover/th:opacity-100 dark:text-slate-600" }),
2035
- l.label
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
2036
2036
  ] })
2037
2037
  },
2038
- l.field
2038
+ n.field
2039
2039
  ))
2040
2040
  ] }) }),
2041
- /* @__PURE__ */ t("tbody", { children: z.map((l) => /* @__PURE__ */ r("tr", { className: "group align-top", "data-save-action": l.action, children: [
2042
- /* @__PURE__ */ t("td", { className: "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", children: l.timestamp && /* @__PURE__ */ r("span", { className: "flex items-start gap-1.5", children: [
2043
- /* @__PURE__ */ t(
2044
- Pe,
2045
- {
2046
- checked: Y.includes(l.key),
2047
- onCheckedChange: () => $e(l.key),
2048
- "aria-label": "Compare this save",
2049
- className: "mt-0.5 h-3.5 w-3.5"
2050
- }
2051
- ),
2052
- /* @__PURE__ */ r(
2053
- "button",
2054
- {
2055
- type: "button",
2056
- onClick: () => i == null ? void 0 : i(l.key),
2057
- disabled: !i,
2058
- "data-tip": l.action === "moved" ? "Open the Timeline" : "Open this save in Replay",
2059
- 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",
2060
- children: [
2061
- /* @__PURE__ */ t("span", { className: "block text-slate-700 dark:text-slate-200", children: xe(l.timestamp) }),
2062
- /* @__PURE__ */ t("span", { className: "block text-[11px] text-slate-400", children: new Date(l.timestamp).toLocaleTimeString([], {
2063
- hour: "numeric",
2064
- minute: "2-digit"
2065
- }) })
2066
- ]
2067
- }
2068
- )
2069
- ] }) }),
2041
+ /* @__PURE__ */ t("tbody", { children: z.map((n) => /* @__PURE__ */ r("tr", { className: "group align-top", "data-save-action": n.action, children: [
2042
+ /* @__PURE__ */ t(
2043
+ "td",
2044
+ {
2045
+ className: j(
2046
+ "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
+ ),
2048
+ children: n.timestamp && /* @__PURE__ */ r("span", { className: "flex items-start gap-1.5", children: [
2049
+ /* @__PURE__ */ t(
2050
+ Pe,
2051
+ {
2052
+ checked: Y.includes(n.key),
2053
+ onCheckedChange: () => Te(n.key),
2054
+ "aria-label": "Compare this save",
2055
+ className: "mt-0.5 h-3.5 w-3.5"
2056
+ }
2057
+ ),
2058
+ /* @__PURE__ */ r(
2059
+ "button",
2060
+ {
2061
+ type: "button",
2062
+ onClick: () => i == null ? void 0 : i(n.key),
2063
+ disabled: !i,
2064
+ "data-tip": n.action === "moved" ? "Open the Timeline" : "Open this save in Replay",
2065
+ 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
+ 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([], {
2069
+ hour: "numeric",
2070
+ minute: "2-digit"
2071
+ }) })
2072
+ ]
2073
+ }
2074
+ )
2075
+ ] })
2076
+ }
2077
+ ),
2070
2078
  /* @__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: [
2071
- l.action === "moved" && !l.userId ? /* @__PURE__ */ t(
2079
+ n.action === "moved" && !n.userId ? /* @__PURE__ */ t(
2072
2080
  "span",
2073
2081
  {
2074
2082
  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",
2075
2083
  "aria-hidden": !0,
2076
- children: /* @__PURE__ */ t(Bt, { className: "h-3 w-3" })
2084
+ children: /* @__PURE__ */ t(De, { className: "h-3 w-3" })
2077
2085
  }
2078
- ) : /* @__PURE__ */ t(Se, { userId: l.userId, name: l.who, size: "sm" }),
2086
+ ) : /* @__PURE__ */ t(_e, { userId: n.userId, name: n.who, size: "sm" }),
2079
2087
  /* @__PURE__ */ r("span", { className: "min-w-0", children: [
2080
- /* @__PURE__ */ t("span", { className: "block truncate text-slate-700 dark:text-slate-200", children: l.who }),
2081
- l.action === "moved" && !l.userId && /* @__PURE__ */ t(
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(
2082
2090
  "span",
2083
2091
  {
2084
2092
  className: "block truncate text-[10.5px] text-slate-500 dark:text-slate-400",
2085
2093
  "data-tip": "The pipeline moved it by itself when a step’s condition was met",
2086
- children: l.trigger ? `after ${l.trigger.name}’s save` : "a step’s condition was met"
2094
+ children: n.trigger ? `after ${n.trigger.name}’s save` : "a step’s condition was met"
2087
2095
  }
2088
2096
  ),
2089
- l.action !== "changed" && /* @__PURE__ */ t(
2097
+ n.action !== "changed" && /* @__PURE__ */ t(
2090
2098
  "span",
2091
2099
  {
2092
- className: M(
2100
+ className: j(
2093
2101
  "mt-0.5 inline-block rounded px-1.5 py-px text-[10.5px] font-medium",
2094
- br[l.action]
2102
+ ct[n.action]
2095
2103
  ),
2096
- children: rt(l.action)
2104
+ children: st(n.action)
2105
+ }
2106
+ ),
2107
+ n.autoMove && /* @__PURE__ */ r(
2108
+ "span",
2109
+ {
2110
+ className: j(
2111
+ "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
2113
+ ),
2114
+ "data-tip": `This save moved it to ${n.autoMove.to ?? "the next step"} automatically (a step’s condition was met)`,
2115
+ children: [
2116
+ /* @__PURE__ */ t(De, { className: "h-2.5 w-2.5" }),
2117
+ "Moved"
2118
+ ]
2097
2119
  }
2098
2120
  )
2099
2121
  ] })
2100
2122
  ] }) }),
2101
2123
  w.map((d) => {
2102
- const N = $(k, d.field), _ = l.values[d.field], V = l.changed.has(d.field), H = l.recalculated.has(d.field), E = V || H, ce = H ? ke(d.field, l, k) : null, Q = ce ? `Recalculated: ${ce.because ? `${ce.because}. ` : ""}${ce.why}` : void 0, me = _ == null || _ === "";
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 || _ === "";
2103
2125
  return /* @__PURE__ */ t(
2104
2126
  "td",
2105
2127
  {
2106
2128
  "data-cell-changed": E || void 0,
2107
- className: M(
2129
+ className: j(
2108
2130
  "max-w-[260px] border-b border-slate-100 px-3 py-2 dark:border-border/50",
2109
2131
  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)]",
2110
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"
@@ -2112,13 +2134,20 @@ function xr({
2112
2134
  children: /* @__PURE__ */ r(
2113
2135
  "span",
2114
2136
  {
2115
- className: M(
2137
+ className: j(
2116
2138
  "flex items-start gap-1",
2117
2139
  E ? "font-medium text-slate-900 dark:text-slate-50" : "text-slate-500 dark:text-slate-400"
2118
2140
  ),
2119
2141
  children: [
2142
+ d.field === fe && n.autoMove && /* @__PURE__ */ t(
2143
+ De,
2144
+ {
2145
+ className: "mt-[3px] h-3 w-3 shrink-0 text-violet-600 dark:text-violet-300",
2146
+ "aria-label": "Moved automatically by this save"
2147
+ }
2148
+ ),
2120
2149
  H && /* @__PURE__ */ t(
2121
- we,
2150
+ Ne,
2122
2151
  {
2123
2152
  className: "mt-[3px] h-3 w-3 shrink-0 text-amber-700 dark:text-amber-300",
2124
2153
  "aria-label": "Recalculated"
@@ -2128,8 +2157,8 @@ function xr({
2128
2157
  "span",
2129
2158
  {
2130
2159
  className: "line-clamp-3 whitespace-pre-line break-words",
2131
- "data-tip": Q ?? (me ? void 0 : be(_, N)),
2132
- 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(vt, { collection: N.relatedCollection, id: _ }) : be(_, N)
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)
2133
2162
  }
2134
2163
  )
2135
2164
  ]
@@ -2139,38 +2168,38 @@ function xr({
2139
2168
  d.field
2140
2169
  );
2141
2170
  })
2142
- ] }, l.key)) })
2171
+ ] }, n.key)) })
2143
2172
  ] })
2144
2173
  }
2145
2174
  ),
2146
- /* @__PURE__ */ t(ha, { scrollerRef: B })
2175
+ /* @__PURE__ */ t(ua, { scrollerRef: B })
2147
2176
  ] }),
2148
- x.length > 0 && /* @__PURE__ */ t("p", { className: "mt-2 text-[11.5px] text-slate-500 dark:text-slate-400", children: b.has(De) ? "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." })
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." })
2149
2178
  ] });
2150
2179
  }
2151
2180
  function fr({
2152
2181
  snapshots: e,
2153
- history: n,
2182
+ history: l,
2154
2183
  meta: i,
2155
2184
  labels: a,
2156
2185
  startKey: m
2157
2186
  }) {
2158
2187
  var J, he, de;
2159
2188
  const o = O(() => [...e].reverse(), [e]), p = O(
2160
- () => gt(n, {
2189
+ () => vt(l, {
2161
2190
  name: (h) => te(h, a)
2162
2191
  }),
2163
- [n, a]
2192
+ [l, a]
2164
2193
  ), [s, g] = L(() => {
2165
2194
  const h = m ? o.findIndex((D) => `${D.id}|${D.timestamp ?? ""}` === m) : -1;
2166
2195
  return h >= 0 ? h : Math.max(0, o.length - 1);
2167
- }), [c, x] = L(!1), [f, k] = L(!1), [u, R] = L(""), C = o.length - 1;
2196
+ }), [c, b] = L(!1), [f, k] = L(!1), [u, R] = L(""), C = o.length - 1;
2168
2197
  qe(() => {
2169
2198
  s > C && g(Math.max(0, C));
2170
2199
  }, [s, C]), qe(() => {
2171
2200
  if (!c) return;
2172
2201
  if (s >= C) {
2173
- x(!1);
2202
+ b(!1);
2174
2203
  return;
2175
2204
  }
2176
2205
  const h = setTimeout(() => g((D) => D + 1), 1800);
@@ -2178,20 +2207,20 @@ function fr({
2178
2207
  }, [c, s, C]);
2179
2208
  const y = o[s], S = s > 0 ? o[s - 1] : null, T = O(() => {
2180
2209
  if (!y) return [];
2181
- const h = Nt((S == null ? void 0 : S.data) ?? {}, y.data ?? {}, i).filter(
2210
+ const h = St((S == null ? void 0 : S.data) ?? {}, y.data ?? {}, i).filter(
2182
2211
  (K) => K.status !== "unchanged" && !K.system && K.field !== "id"
2183
2212
  );
2184
2213
  if (!S) return [];
2185
2214
  const D = new Set(Object.keys(y.delta ?? {})), U = S.data ?? {};
2186
2215
  return h.filter((K) => D.has(K.field) || K.field in U).sort((K, X) => +!D.has(K.field) - +!D.has(X.field));
2187
- }, [y, S, i]), v = new Set(Object.keys((y == null ? void 0 : y.delta) ?? {})), b = T.filter((h) => v.has(h.field)).length, w = T.length - b, F = p.find((h) => h.key === `${y == null ? void 0 : y.id}|${(y == null ? void 0 : y.timestamp) ?? ""}`), q = O(
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(
2188
2217
  () => Object.entries((y == null ? void 0 : y.data) ?? {}).filter(
2189
2218
  ([h, D]) => h !== "id" && D !== null && D !== void 0 && D !== "" && !$(i, h).system
2190
2219
  ).sort(([h], [D]) => $(i, h).label.localeCompare($(i, D).label)),
2191
2220
  [y, i]
2192
2221
  ), I = (h) => {
2193
- x(!1), g(Math.min(C, Math.max(0, h)));
2194
- }, j = (h) => {
2222
+ b(!1), g(Math.min(C, Math.max(0, h)));
2223
+ }, M = (h) => {
2195
2224
  if (R(h), !h) return;
2196
2225
  const D = (/* @__PURE__ */ new Date(`${h}T23:59:59`)).getTime();
2197
2226
  let U = -1;
@@ -2200,7 +2229,7 @@ function fr({
2200
2229
  }), U >= 0 && I(U);
2201
2230
  };
2202
2231
  if (!y) return null;
2203
- const P = te(y, a), W = y.action === "create" ? "created the record" : y.action === "delete" ? "deleted the record" : y.action === "restore" ? "restored the record" : b ? `changed ${b} field${b === 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();
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();
2204
2233
  return /* @__PURE__ */ r(
2205
2234
  "div",
2206
2235
  {
@@ -2258,9 +2287,9 @@ function fr({
2258
2287
  children: /* @__PURE__ */ t(
2259
2288
  "span",
2260
2289
  {
2261
- className: M(
2290
+ className: j(
2262
2291
  "block rounded-full transition-all",
2263
- K ? "h-3 w-3 bg-nvr-cyan ring-4 ring-nvr-cyan/20" : M(
2292
+ K ? "h-3 w-3 bg-nvr-cyan ring-4 ring-nvr-cyan/20" : j(
2264
2293
  "h-2 w-2 hover:scale-125",
2265
2294
  D < s ? "bg-nvr-cyan/70" : "bg-slate-300 dark:bg-slate-600",
2266
2295
  h.action === "create" && "bg-emerald-500"
@@ -2278,12 +2307,12 @@ function fr({
2278
2307
  /* @__PURE__ */ r("div", { className: "mt-1 flex justify-between text-[10.5px] tabular-nums text-slate-400", children: [
2279
2308
  /* @__PURE__ */ r("span", { children: [
2280
2309
  "Save 1",
2281
- (he = o[0]) != null && he.timestamp ? ` · ${xe(o[0].timestamp)}` : ""
2310
+ (he = o[0]) != null && he.timestamp ? ` · ${be(o[0].timestamp)}` : ""
2282
2311
  ] }),
2283
2312
  /* @__PURE__ */ r("span", { children: [
2284
2313
  "Save ",
2285
2314
  o.length,
2286
- (de = o[C]) != null && de.timestamp ? ` · ${xe(o[C].timestamp)}` : ""
2315
+ (de = o[C]) != null && de.timestamp ? ` · ${be(o[C].timestamp)}` : ""
2287
2316
  ] })
2288
2317
  ] })
2289
2318
  ] }),
@@ -2297,7 +2326,7 @@ function fr({
2297
2326
  onClick: () => I(s - 1),
2298
2327
  disabled: s === 0,
2299
2328
  "aria-label": "Previous save",
2300
- children: /* @__PURE__ */ t(Gt, { className: "h-3.5 w-3.5" })
2329
+ children: /* @__PURE__ */ t(Zt, { className: "h-3.5 w-3.5" })
2301
2330
  }
2302
2331
  ),
2303
2332
  /* @__PURE__ */ r(
@@ -2306,12 +2335,12 @@ function fr({
2306
2335
  size: "sm",
2307
2336
  className: "h-7 gap-1.5 bg-nvr-cyan px-3 text-[12px] text-white hover:bg-nvr-cyan/90",
2308
2337
  onClick: () => {
2309
- !c && s >= C && g(0), x((h) => !h);
2338
+ !c && s >= C && g(0), b((h) => !h);
2310
2339
  },
2311
2340
  disabled: o.length < 2,
2312
2341
  "data-replay-play": !0,
2313
2342
  children: [
2314
- c ? /* @__PURE__ */ t(Zt, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(Xt, { className: "h-3.5 w-3.5" }),
2343
+ c ? /* @__PURE__ */ t(Xt, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(ea, { className: "h-3.5 w-3.5" }),
2315
2344
  c ? "Pause" : s >= C ? "Replay from the start" : "Play"
2316
2345
  ]
2317
2346
  }
@@ -2336,14 +2365,14 @@ function fr({
2336
2365
  s === C ? " · current" : ""
2337
2366
  ] }),
2338
2367
  /* @__PURE__ */ r("label", { className: "ml-auto inline-flex items-center gap-1.5 text-[11.5px] text-slate-500 dark:text-slate-400", children: [
2339
- /* @__PURE__ */ t(ea, { className: "h-3.5 w-3.5" }),
2368
+ /* @__PURE__ */ t(ta, { className: "h-3.5 w-3.5" }),
2340
2369
  "Jump to",
2341
2370
  /* @__PURE__ */ t(
2342
2371
  "input",
2343
2372
  {
2344
2373
  type: "date",
2345
2374
  value: u,
2346
- onChange: (h) => j(h.target.value),
2375
+ onChange: (h) => M(h.target.value),
2347
2376
  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",
2348
2377
  "aria-label": "Jump to the record as it was on a date",
2349
2378
  "data-as-of": !0
@@ -2353,7 +2382,7 @@ function fr({
2353
2382
  ] }),
2354
2383
  /* @__PURE__ */ r("div", { className: "px-3 py-3", children: [
2355
2384
  /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
2356
- /* @__PURE__ */ t(Se, { userId: y.user_id, name: P }),
2385
+ /* @__PURE__ */ t(_e, { userId: y.user_id, name: P }),
2357
2386
  /* @__PURE__ */ r("p", { className: "min-w-0 flex-1 text-[12.5px] text-slate-700 dark:text-slate-200", children: [
2358
2387
  /* @__PURE__ */ t("span", { className: "font-medium", children: P }),
2359
2388
  " ",
@@ -2375,31 +2404,31 @@ function fr({
2375
2404
  {
2376
2405
  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",
2377
2406
  "data-tip": F ? (() => {
2378
- const D = ke(h.field, F, i);
2407
+ const D = we(h.field, F, i);
2379
2408
  return `${D.because ? `${D.because} — ` : ""}${D.why}`;
2380
2409
  })() : void 0,
2381
2410
  children: [
2382
- /* @__PURE__ */ t(we, { className: "h-3 w-3 text-amber-700 dark:text-amber-300" }),
2411
+ /* @__PURE__ */ t(Ne, { className: "h-3 w-3 text-amber-700 dark:text-amber-300" }),
2383
2412
  "recalculated"
2384
2413
  ]
2385
2414
  }
2386
2415
  )
2387
2416
  ] }),
2388
- /* @__PURE__ */ t("span", { className: "min-w-0 text-[12px]", children: it(h.before) || it(h.after) ? (
2417
+ /* @__PURE__ */ t("span", { className: "min-w-0 text-[12px]", children: dt(h.before) || dt(h.after) ? (
2389
2418
  // A paragraph that gained a sentence reads as the words that moved.
2390
- /* @__PURE__ */ t("span", { className: "block break-words leading-relaxed text-slate-700 dark:text-slate-200", children: /* @__PURE__ */ t(wt, { before: h.before, after: h.after }) })
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 }) })
2391
2420
  ) : /* @__PURE__ */ r("span", { className: "flex flex-wrap items-baseline gap-x-2", children: [
2392
2421
  /* @__PURE__ */ t(
2393
2422
  "span",
2394
2423
  {
2395
- className: M(
2424
+ className: j(
2396
2425
  "text-slate-400",
2397
- !ot(h.before) && "line-through decoration-slate-300 dark:decoration-slate-600"
2426
+ !it(h.before) && "line-through decoration-slate-300 dark:decoration-slate-600"
2398
2427
  ),
2399
- children: ot(h.before) ? "—" : /* @__PURE__ */ t(ie, { value: h.before, meta: $(i, h.field), tone: "before" })
2428
+ children: it(h.before) ? "—" : /* @__PURE__ */ t(ie, { value: h.before, meta: $(i, h.field), tone: "before" })
2400
2429
  }
2401
2430
  ),
2402
- /* @__PURE__ */ t(Ke, { className: "h-3 w-3 shrink-0 self-center text-slate-400" }),
2431
+ /* @__PURE__ */ t(Ve, { className: "h-3 w-3 shrink-0 self-center text-slate-400" }),
2403
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" }) })
2404
2433
  ] }) })
2405
2434
  ]
@@ -2414,7 +2443,7 @@ function fr({
2414
2443
  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",
2415
2444
  "aria-expanded": f,
2416
2445
  children: [
2417
- f ? /* @__PURE__ */ t(Ie, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(je, { className: "h-3.5 w-3.5" }),
2446
+ f ? /* @__PURE__ */ t(Ke, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(je, { className: "h-3.5 w-3.5" }),
2418
2447
  "The whole record at this save",
2419
2448
  /* @__PURE__ */ r("span", { className: "font-normal text-slate-400", children: [
2420
2449
  "(",
@@ -2441,7 +2470,7 @@ function fr({
2441
2470
  );
2442
2471
  }
2443
2472
  export {
2444
- Ct as FieldChangeList,
2473
+ _t as FieldChangeList,
2445
2474
  Xr as RevisionsPanel,
2446
- yt as displayValue
2475
+ kt as displayValue
2447
2476
  };