@nivaro/react 0.3.41 → 0.3.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/dist/components/LayoutForm.js +100 -98
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +644 -15
  5. package/dist/index.js +814 -775
  6. package/dist/shared/components/ActivityEntry.js +154 -0
  7. package/dist/shared/components/AudienceConfirmPanel.js +98 -0
  8. package/dist/shared/components/BackgroundRunOffer.js +43 -31
  9. package/dist/shared/components/BroadcastView.js +225 -204
  10. package/dist/shared/components/CollectionBrowserView.js +3924 -3584
  11. package/dist/shared/components/ConfigHistory.js +153 -0
  12. package/dist/shared/components/ConfigReadBack.js +65 -0
  13. package/dist/shared/components/DataTable.js +379 -346
  14. package/dist/shared/components/ForceReloadBanner.js +47 -40
  15. package/dist/shared/components/IdleReloadWatcher.js +69 -0
  16. package/dist/shared/components/ItemEditForm.js +4041 -3853
  17. package/dist/shared/components/MyWorkView.js +278 -213
  18. package/dist/shared/components/NotificationBell.js +130 -121
  19. package/dist/shared/components/ProfileView.js +776 -1003
  20. package/dist/shared/components/RecentRecordsRail.js +34 -16
  21. package/dist/shared/components/RecordReadView.js +500 -477
  22. package/dist/shared/components/Skeletons.js +199 -0
  23. package/dist/shared/components/SlowNotice.js +63 -0
  24. package/dist/shared/components/Term.js +23 -0
  25. package/dist/shared/components/WidgetSlot.js +350 -353
  26. package/dist/shared/components/access/PermissionSummary.js +106 -0
  27. package/dist/shared/components/bulk/BulkActionButtons.js +76 -73
  28. package/dist/shared/components/chat/ChatPanel.js +902 -886
  29. package/dist/shared/components/chat/MemberPaging.js +70 -0
  30. package/dist/shared/components/chat/RoomParts.js +147 -117
  31. package/dist/shared/components/chat/ScreenClip.js +73 -69
  32. package/dist/shared/components/chat/chat-core.js +449 -396
  33. package/dist/shared/components/chat/huddle/huddle-store.js +48 -43
  34. package/dist/shared/components/help-videos/api.js +2 -5
  35. package/dist/shared/components/help-videos/viewer/HelpVideoMatchChip.js +79 -0
  36. package/dist/shared/components/help-videos/viewer/matchChip.js +50 -0
  37. package/dist/shared/components/imports/CollectionImportPanel.js +139 -133
  38. package/dist/shared/components/imports/RunDetailSheet.js +222 -227
  39. package/dist/shared/components/integrations/console/ErrorExplanation.js +121 -0
  40. package/dist/shared/components/integrations/console/PartnerDetail.js +175 -174
  41. package/dist/shared/components/integrations/console/SubmissionRow.js +36 -34
  42. package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +50 -48
  43. package/dist/shared/components/item-edit/FieldComments.js +212 -0
  44. package/dist/shared/components/item-edit/FieldRow.js +340 -336
  45. package/dist/shared/components/item-edit/RecordHeaderActions.js +23 -22
  46. package/dist/shared/components/item-edit/RelationCombobox.js +231 -222
  47. package/dist/shared/components/item-edit/RuleHiddenNotes.js +55 -0
  48. package/dist/shared/components/item-edit/field-comments-context.js +6 -0
  49. package/dist/shared/components/item-edit/field-sources.js +33 -0
  50. package/dist/shared/components/item-edit/rule-hidden.js +30 -0
  51. package/dist/shared/components/layout-editor/HistoryPanel.js +113 -96
  52. package/dist/shared/components/layout-editor/editors/cascade-filters.js +170 -145
  53. package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +22 -18
  54. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +177 -159
  55. package/dist/shared/components/layout-editor/inspector/PickerTab.js +35 -34
  56. package/dist/shared/components/layout-editor/inspector/RulesTab.js +124 -111
  57. package/dist/shared/components/layout-editor/inspector/kit.js +292 -277
  58. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  59. package/dist/shared/components/list/CopyListLinkButton.js +41 -0
  60. package/dist/shared/components/list/InlineEdit.js +363 -0
  61. package/dist/shared/components/notifications/NotificationCenterView.js +213 -181
  62. package/dist/shared/components/notifications/NotificationDetailBits.js +205 -82
  63. package/dist/shared/components/notifications/NotificationRulesEditor.js +515 -0
  64. package/dist/shared/components/notifications/TestMyRules.js +137 -0
  65. package/dist/shared/components/notifications/changes-lines.js +24 -0
  66. package/dist/shared/components/notifications/why-lines.js +64 -0
  67. package/dist/shared/components/panels/CommentPanel.js +316 -281
  68. package/dist/shared/components/panels/LegalHoldBanner.js +38 -0
  69. package/dist/shared/components/panels/PipelinePanel.js +201 -196
  70. package/dist/shared/components/panels/RevisionsPanel.js +496 -479
  71. package/dist/shared/components/pipeline/PipelineEditorView.js +1587 -1560
  72. package/dist/shared/components/pipeline/PipelineStateOwners.js +116 -103
  73. package/dist/shared/components/profile/PersonDidPanel.js +188 -0
  74. package/dist/shared/components/profile/PersonProfile.js +57 -52
  75. package/dist/shared/components/queue/QueueWorklist.js +1526 -1365
  76. package/dist/shared/hooks/useSlowReason.js +39 -0
  77. package/dist/shared/lib/activity-sentence.js +670 -0
  78. package/dist/shared/lib/config-sentences.js +418 -0
  79. package/dist/shared/lib/core-glossary.js +229 -0
  80. package/dist/shared/lib/error-hints.js +159 -0
  81. package/dist/shared/lib/error-message.js +105 -0
  82. package/dist/shared/lib/error-toast.js +22 -0
  83. package/dist/shared/lib/field-comments.js +25 -0
  84. package/dist/shared/lib/filter-sentence.js +261 -0
  85. package/dist/shared/lib/glossary.js +55 -48
  86. package/dist/shared/lib/idle-reload.js +138 -0
  87. package/dist/shared/lib/layout-resolve.js +42 -29
  88. package/dist/shared/lib/list-inline-edit.js +190 -0
  89. package/dist/shared/lib/list-link.js +147 -0
  90. package/dist/shared/lib/prefetch.js +259 -106
  91. package/dist/shared/lib/record-ref.js +72 -0
  92. package/dist/shared/lib/reload-holds.js +25 -0
  93. package/dist/shared/lib/safe-error.js +52 -24
  94. package/dist/shared/lib/skeleton-shapes.js +72 -0
  95. package/dist/shared/lib/slow-reason.js +63 -0
  96. package/package.json +1 -1
@@ -1,24 +1,26 @@
1
- import { jsxs as l, jsx as t, Fragment as T } from "react/jsx-runtime";
2
- import { useQuery as B, useQueryClient as Z, useMutation as J } from "@tanstack/react-query";
3
- import { Clock as Q, Search as Ne, X as ke, CalendarClock as ve, GitCompareArrows as we, ChevronDown as Se, ChevronRight as Ce, MessageSquare as _e, RotateCcw as de, ArrowRight as Te } from "lucide-react";
4
- import { useState as k, useRef as Re, useMemo as j, useEffect as je } from "react";
5
- import { toast as R } from "sonner";
6
- import { useNivaroClient as D } from "../../context.js";
7
- import { get as q, post as K } from "../../lib/commands.js";
8
- import { useLiveRecordQueries as Ae } from "../../lib/live.js";
9
- import { restoreSkippedNote as re } from "../../lib/restore-skipped.js";
10
- import { cn as _, titleCase as oe, toLocalDateString as $e } from "../../lib/utils.js";
11
- import { AgentBadge as Le } from "../AgentBadge.js";
12
- import { RelatedItemLabel as Oe } from "../item-edit/RelationCombobox.js";
13
- import { UserAvatar as ce } from "../UserAvatar.js";
1
+ import { jsxs as l, jsx as t, Fragment as j } from "react/jsx-runtime";
2
+ import { useQuery as B, useQueryClient as ee, useMutation as Q } from "@tanstack/react-query";
3
+ import { Clock as Y, Search as Se, X as Ce, CalendarClock as _e, GitCompareArrows as Te, ChevronDown as Re, ChevronRight as je, MessageSquare as Ae, RotateCcw as de, ArrowRight as Le } from "lucide-react";
4
+ import { useState as v, useRef as $e, useMemo as L, createContext as Oe, useEffect as qe, useContext as ce } from "react";
5
+ import { toast as A } from "sonner";
6
+ import { useNivaroClient as F } from "../../context.js";
7
+ import { activityPredicate as De, activityWhy as Fe, actorName as Ee } from "../../lib/activity-sentence.js";
8
+ import { get as D, post as K } from "../../lib/commands.js";
9
+ import { useLiveRecordQueries as Pe } from "../../lib/live.js";
10
+ import { restoreSkippedNote as se } from "../../lib/restore-skipped.js";
11
+ import { cn as T, titleCase as me, toLocalDateString as Be } from "../../lib/utils.js";
12
+ import { useActivityLabels as Ie } from "../ActivityEntry.js";
13
+ import { AgentBadge as Ke } from "../AgentBadge.js";
14
+ import { RelatedItemLabel as Me } from "../item-edit/RelationCombobox.js";
15
+ import { UserAvatar as pe } from "../UserAvatar.js";
14
16
  import { Button as M } from "../ui/button.js";
15
- import { Sheet as qe, SheetTrigger as De, SheetContent as Fe, SheetHeader as Ee, SheetTitle as Be } from "../ui/sheet.js";
16
- import { Skeleton as Pe } from "../ui/skeleton.js";
17
- import { IntegrationActivitySection as Ie } from "./IntegrationActivitySection.js";
18
- const Y = (e) => e.id != null && (e.action === "create" || e.action === "update" || e.action === "delete" || e.action === "restore"), Ke = (e) => !Y(e), $ = (e) => {
19
- var r;
20
- return e.id != null ? `r${e.id}` : `e${((r = e.event) == null ? void 0 : r.history_id) ?? ""}-${e.activity ?? ""}-${e.timestamp ?? ""}`;
21
- }, Me = /* @__PURE__ */ new Set([
17
+ import { Sheet as Ue, SheetTrigger as We, SheetContent as Ve, SheetHeader as ze, SheetTitle as He } from "../ui/sheet.js";
18
+ import { Skeleton as Je } from "../ui/skeleton.js";
19
+ import { IntegrationActivitySection as Qe } from "./IntegrationActivitySection.js";
20
+ const G = (e) => e.id != null && (e.action === "create" || e.action === "update" || e.action === "delete" || e.action === "restore"), Ye = (e) => !G(e), O = (e) => {
21
+ var s;
22
+ return e.id != null ? `r${e.id}` : `e${((s = e.event) == null ? void 0 : s.history_id) ?? ""}-${e.activity ?? ""}-${e.timestamp ?? ""}`;
23
+ }, Ge = /* @__PURE__ */ new Set([
22
24
  "id",
23
25
  "created",
24
26
  "changed",
@@ -30,120 +32,120 @@ const Y = (e) => e.id != null && (e.action === "create" || e.action === "update"
30
32
  "updated_at",
31
33
  "sort"
32
34
  ]);
33
- function me(e, r) {
34
- const a = D(), { data: i } = B({
35
+ function ue(e, s) {
36
+ const i = F(), { data: a } = B({
35
37
  queryKey: ["revisions-field-meta", e],
36
- enabled: r,
38
+ enabled: s,
37
39
  staleTime: 3e5,
38
40
  queryFn: async () => {
39
- const [d, o] = await Promise.all([
40
- a.request(q(`/field-config/${e}`)).then((n) => n.data ?? []).catch(() => []),
41
- a.request(
42
- q(`/collections/${e}`)
41
+ const [o, d] = await Promise.all([
42
+ i.request(D(`/field-config/${e}`)).then((n) => n.data ?? []).catch(() => []),
43
+ i.request(
44
+ D(`/collections/${e}`)
43
45
  ).then((n) => {
44
- var s;
45
- return ((s = n.data) == null ? void 0 : s.relations) ?? [];
46
+ var r;
47
+ return ((r = n.data) == null ? void 0 : r.relations) ?? [];
46
48
  }).catch(() => [])
47
49
  ]);
48
- return { fields: d, relations: o };
50
+ return { fields: o, relations: d };
49
51
  }
50
52
  });
51
- return j(() => {
52
- const d = /* @__PURE__ */ new Map(), o = (n) => {
53
- const s = ((i == null ? void 0 : i.relations) ?? []).find(
53
+ return L(() => {
54
+ const o = /* @__PURE__ */ new Map(), d = (n) => {
55
+ const r = ((a == null ? void 0 : a.relations) ?? []).find(
54
56
  (m) => m.many_collection === e && m.many_field === n && m.junction_field == null
55
57
  );
56
- return s != null && s.one_collection ? s.one_collection === "directus_users" ? "nivaro_users" : s.one_collection : null;
58
+ return r != null && r.one_collection ? r.one_collection === "directus_users" ? "nivaro_users" : r.one_collection : null;
57
59
  };
58
- for (const n of (i == null ? void 0 : i.fields) ?? [])
59
- n.field.startsWith("__") || d.set(n.field, {
60
- label: n.label || oe(n.field.replace(/_/g, " ")),
61
- system: Me.has(n.field),
60
+ for (const n of (a == null ? void 0 : a.fields) ?? [])
61
+ n.field.startsWith("__") || o.set(n.field, {
62
+ label: n.label || me(n.field.replace(/_/g, " ")),
63
+ system: Ge.has(n.field),
62
64
  // layout_assigned is only stamped when the collection HAS an active
63
65
  // layout — absent means there's no layout to be off of.
64
66
  onLayout: n.layout_assigned !== !1,
65
- relatedCollection: o(n.field),
67
+ relatedCollection: d(n.field),
66
68
  dateOnly: String(n.type ?? "").toLowerCase() === "date"
67
69
  });
68
- return d;
69
- }, [i, e]);
70
+ return o;
71
+ }, [a, e]);
70
72
  }
71
- function g(e, r) {
72
- return e.get(r) ?? {
73
+ function y(e, s) {
74
+ return e.get(s) ?? {
73
75
  // Unknown to the form = machine column. Still labeled, still reachable.
74
- label: oe(r.replace(/[_-]/g, " ")),
76
+ label: me(s.replace(/[_-]/g, " ")),
75
77
  system: !0,
76
78
  onLayout: !1
77
79
  };
78
80
  }
79
- function Ue({ map: e, field: r }) {
80
- const a = g(e, r);
81
+ function Xe({ map: e, field: s }) {
82
+ const i = y(e, s);
81
83
  return /* @__PURE__ */ t(
82
84
  "span",
83
85
  {
84
86
  className: "text-[12px] font-medium text-slate-700 dark:text-slate-200",
85
- "data-tip": r,
86
- title: r,
87
- children: a.label
87
+ "data-tip": s,
88
+ title: s,
89
+ children: i.label
88
90
  }
89
91
  );
90
92
  }
91
- const se = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, Ve = /^\d{4}-\d{2}-\d{2}(?:T00:00:00(?:\.0+)?Z)?$/;
92
- function We(e, r = !1) {
93
+ const ne = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, Ze = /^\d{4}-\d{2}-\d{2}(?:T00:00:00(?:\.0+)?Z)?$/;
94
+ function et(e, s = !1) {
93
95
  if (e == null || e === "") return "";
94
96
  if (typeof e == "boolean") return e ? "Yes" : "No";
95
- if (typeof e == "string" && (Ve.test(e) || r && se.test(e)))
96
- return $e(e);
97
- if (typeof e == "string" && se.test(e)) {
98
- const a = new Date(e);
99
- if (!Number.isNaN(a.getTime())) return a.toLocaleString();
97
+ if (typeof e == "string" && (Ze.test(e) || s && ne.test(e)))
98
+ return Be(e);
99
+ if (typeof e == "string" && ne.test(e)) {
100
+ const i = new Date(e);
101
+ if (!Number.isNaN(i.getTime())) return i.toLocaleString();
100
102
  }
101
103
  return typeof e == "object" ? JSON.stringify(e) : String(e);
102
104
  }
103
105
  function U(e) {
104
106
  return e == null ? "" : typeof e == "object" ? JSON.stringify(e) : String(e);
105
107
  }
106
- function ze({ collection: e, id: r }) {
107
- const a = D(), { data: i } = B({
108
+ function tt({ collection: e, id: s }) {
109
+ const i = F(), { data: a } = B({
108
110
  queryKey: ["col-meta", e],
109
- queryFn: () => a.request(q(`/collections/${e}`)).then((d) => d.data),
111
+ queryFn: () => i.request(D(`/collections/${e}`)).then((o) => o.data),
110
112
  staleTime: 3e5,
111
113
  retry: !1
112
114
  });
113
- return /* @__PURE__ */ t("span", { title: `${e} #${String(r)}`, children: /* @__PURE__ */ t(
114
- Oe,
115
+ return /* @__PURE__ */ t("span", { title: `${e} #${String(s)}`, children: /* @__PURE__ */ t(
116
+ Me,
115
117
  {
116
118
  collection: e,
117
- id: r,
118
- displayTemplate: i == null ? void 0 : i.display_template
119
+ id: s,
120
+ displayTemplate: a == null ? void 0 : a.display_template
119
121
  }
120
122
  ) });
121
123
  }
122
- function He(e) {
123
- return X(e).join(" ");
124
+ function at(e) {
125
+ return Z(e).join(" ");
124
126
  }
125
- const ne = 160;
126
- function le({
127
+ const le = 160;
128
+ function ie({
127
129
  value: e,
128
- tone: r,
129
- dateOnly: a
130
+ tone: s,
131
+ dateOnly: i
130
132
  }) {
131
- const [i, d] = k(!1), o = We(e, a);
132
- if (o === "")
133
+ const [a, o] = v(!1), d = et(e, i);
134
+ if (d === "")
133
135
  return /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" });
134
- const n = o.length > ne, s = i || !n ? o : `${o.slice(0, ne)}…`;
136
+ const n = d.length > le, r = a || !n ? d : `${d.slice(0, le)}…`;
135
137
  return /* @__PURE__ */ l("span", { className: "break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: [
136
- typeof e == "object" ? /* @__PURE__ */ t("span", { className: "font-mono text-[11px]", children: s }) : s,
138
+ typeof e == "object" ? /* @__PURE__ */ t("span", { className: "font-mono text-[11px]", children: r }) : r,
137
139
  n && /* @__PURE__ */ t(
138
140
  "button",
139
141
  {
140
142
  type: "button",
141
- onClick: () => d((m) => !m),
142
- className: _(
143
+ onClick: () => o((m) => !m),
144
+ className: T(
143
145
  "ml-1 text-[10.5px] font-medium hover:underline",
144
- r === "before" ? "text-rose-500" : "text-emerald-600"
146
+ s === "before" ? "text-rose-500" : "text-emerald-600"
145
147
  ),
146
- children: i ? "less" : "more"
148
+ children: a ? "less" : "more"
147
149
  }
148
150
  )
149
151
  ] });
@@ -152,42 +154,42 @@ function I(e) {
152
154
  if (e && typeof e == "object" && !Array.isArray(e)) return e;
153
155
  if (typeof e == "string" && e.trim().startsWith("{"))
154
156
  try {
155
- const r = JSON.parse(e);
156
- return r && typeof r == "object" && !Array.isArray(r) ? r : null;
157
+ const s = JSON.parse(e);
158
+ return s && typeof s == "object" && !Array.isArray(s) ? s : null;
157
159
  } catch {
158
160
  return null;
159
161
  }
160
162
  return null;
161
163
  }
162
- function Je({
164
+ function rt({
163
165
  before: e,
164
- after: r
166
+ after: s
165
167
  }) {
166
- const i = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(r)])).sort().map((o) => {
167
- const n = o in e ? JSON.stringify(e[o]) : void 0, s = o in r ? JSON.stringify(r[o]) : void 0;
168
- return n === s ? null : { k: o, b: n, a: s };
168
+ const a = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(s)])).sort().map((d) => {
169
+ const n = d in e ? JSON.stringify(e[d]) : void 0, r = d in s ? JSON.stringify(s[d]) : void 0;
170
+ return n === r ? null : { k: d, b: n, a: r };
169
171
  }).filter(Boolean);
170
- if (i.length === 0)
172
+ if (a.length === 0)
171
173
  return /* @__PURE__ */ t("span", { className: "text-[11px] italic text-slate-400", children: "keys reordered only" });
172
- const d = (o) => o == null ? void 0 : o.length > 80 ? `${o.slice(0, 80)}…` : o;
173
- return /* @__PURE__ */ t("div", { className: "space-y-0.5", "data-json-diff": !0, children: i.map(({ k: o, b: n, a: s }) => /* @__PURE__ */ l("p", { className: "text-[11.5px]", children: [
174
- /* @__PURE__ */ t("span", { className: "font-mono text-[10.5px] text-slate-500", children: o }),
174
+ const o = (d) => d == null ? void 0 : d.length > 80 ? `${d.slice(0, 80)}…` : d;
175
+ return /* @__PURE__ */ t("div", { className: "space-y-0.5", "data-json-diff": !0, children: a.map(({ k: d, b: n, a: r }) => /* @__PURE__ */ l("p", { className: "text-[11.5px]", children: [
176
+ /* @__PURE__ */ t("span", { className: "font-mono text-[10.5px] text-slate-500", children: d }),
175
177
  ":",
176
178
  " ",
177
- n !== void 0 && /* @__PURE__ */ t("span", { className: "text-rose-600 line-through dark:text-rose-400", children: d(n) }),
178
- n !== void 0 && s !== void 0 && " → ",
179
- s !== void 0 ? /* @__PURE__ */ t("span", { className: "text-emerald-700 dark:text-emerald-400", children: d(s) }) : /* @__PURE__ */ t("span", { className: "italic text-slate-400", children: " (removed)" })
180
- ] }, o)) });
179
+ n !== void 0 && /* @__PURE__ */ t("span", { className: "text-rose-600 line-through dark:text-rose-400", children: o(n) }),
180
+ n !== void 0 && r !== void 0 && " → ",
181
+ r !== void 0 ? /* @__PURE__ */ t("span", { className: "text-emerald-700 dark:text-emerald-400", children: o(r) }) : /* @__PURE__ */ t("span", { className: "italic text-slate-400", children: " (removed)" })
182
+ ] }, d)) });
181
183
  }
182
- function Qe({ field: e, ctl: r }) {
183
- return r.confirmField === e ? /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1", "data-revert-field-confirm": e, children: [
184
+ function st({ field: e, ctl: s }) {
185
+ return s.confirmField === e ? /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1", "data-revert-field-confirm": e, children: [
184
186
  /* @__PURE__ */ t("span", { className: "text-[10.5px] text-slate-500", children: "Revert?" }),
185
187
  /* @__PURE__ */ t(
186
188
  "button",
187
189
  {
188
190
  type: "button",
189
- disabled: r.pending,
190
- onClick: () => r.revert(e),
191
+ disabled: s.pending,
192
+ onClick: () => s.revert(e),
191
193
  className: "rounded bg-nvr-cyan px-1.5 py-px text-[10.5px] font-semibold text-white disabled:opacity-50",
192
194
  children: "Yes"
193
195
  }
@@ -196,7 +198,7 @@ function Qe({ field: e, ctl: r }) {
196
198
  "button",
197
199
  {
198
200
  type: "button",
199
- onClick: () => r.setConfirmField(null),
201
+ onClick: () => s.setConfirmField(null),
200
202
  className: "rounded border border-slate-200 px-1.5 py-px text-[10.5px] text-slate-500 dark:border-border",
201
203
  children: "Cancel"
202
204
  }
@@ -205,7 +207,7 @@ function Qe({ field: e, ctl: r }) {
205
207
  "button",
206
208
  {
207
209
  type: "button",
208
- onClick: () => r.setConfirmField(e),
210
+ onClick: () => s.setConfirmField(e),
209
211
  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",
210
212
  title: "Set the field back to this revision’s value",
211
213
  "data-revert-field": e,
@@ -216,49 +218,49 @@ function Qe({ field: e, ctl: r }) {
216
218
  }
217
219
  );
218
220
  }
219
- function G(e) {
221
+ function X(e) {
220
222
  return typeof e == "string" && /<[a-z][^>]*>/i.test(e);
221
223
  }
222
- function X(e) {
224
+ function Z(e) {
223
225
  return String(e ?? "").replace(/<[^>]*>/g, " ").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").split(/\s+/).filter(Boolean);
224
226
  }
225
- function Ye(e, r) {
226
- const i = X(e).slice(0, 600), d = X(r).slice(0, 600), o = i.length, n = d.length, s = Array.from({ length: o + 1 }, () => new Array(n + 1).fill(0));
227
- for (let y = o - 1; y >= 0; y--)
227
+ function nt(e, s) {
228
+ const a = Z(e).slice(0, 600), o = Z(s).slice(0, 600), d = a.length, n = o.length, r = Array.from({ length: d + 1 }, () => new Array(n + 1).fill(0));
229
+ for (let g = d - 1; g >= 0; g--)
228
230
  for (let c = n - 1; c >= 0; c--)
229
- s[y][c] = i[y] === d[c] ? s[y + 1][c + 1] + 1 : Math.max(s[y + 1][c], s[y][c + 1]);
230
- const m = [], x = (y, c) => {
231
- const u = m[m.length - 1];
232
- u && u.type === y ? u.text += ` ${c}` : m.push({ text: c, type: y });
231
+ r[g][c] = a[g] === o[c] ? r[g + 1][c + 1] + 1 : Math.max(r[g + 1][c], r[g][c + 1]);
232
+ const m = [], h = (g, c) => {
233
+ const x = m[m.length - 1];
234
+ x && x.type === g ? x.text += ` ${c}` : m.push({ text: c, type: g });
233
235
  };
234
- let p = 0, h = 0;
235
- for (; p < o && h < n; )
236
- i[p] === d[h] ? (x("same", i[p]), p++, h++) : s[p + 1][h] >= s[p][h + 1] ? (x("del", i[p]), p++) : (x("ins", d[h]), h++);
237
- for (; p < o; ) x("del", i[p++]);
238
- for (; h < n; ) x("ins", d[h++]);
236
+ let p = 0, u = 0;
237
+ for (; p < d && u < n; )
238
+ a[p] === o[u] ? (h("same", a[p]), p++, u++) : r[p + 1][u] >= r[p][u + 1] ? (h("del", a[p]), p++) : (h("ins", o[u]), u++);
239
+ for (; p < d; ) h("del", a[p++]);
240
+ for (; u < n; ) h("ins", o[u++]);
239
241
  return m;
240
242
  }
241
- function Ge({ before: e, after: r }) {
242
- const a = Ye(e, r);
243
- return /* @__PURE__ */ t("p", { className: "whitespace-pre-wrap break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: a.map(
244
- (i, d) => i.type === "same" ? (
243
+ function lt({ before: e, after: s }) {
244
+ const i = nt(e, s);
245
+ return /* @__PURE__ */ t("p", { className: "whitespace-pre-wrap break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: i.map(
246
+ (a, o) => a.type === "same" ? (
245
247
  // biome-ignore lint/suspicious/noArrayIndexKey: static segment list
246
248
  /* @__PURE__ */ l("span", { children: [
247
- i.text,
249
+ a.text,
248
250
  " "
249
- ] }, d)
250
- ) : i.type === "del" ? (
251
+ ] }, o)
252
+ ) : a.type === "del" ? (
251
253
  // biome-ignore lint/suspicious/noArrayIndexKey: static segment list
252
254
  /* @__PURE__ */ l(
253
255
  "del",
254
256
  {
255
257
  className: "rounded bg-red-100 px-0.5 text-red-700 no-underline line-through dark:bg-red-900/40 dark:text-red-400",
256
258
  children: [
257
- i.text,
259
+ a.text,
258
260
  " "
259
261
  ]
260
262
  },
261
- d
263
+ o
262
264
  )
263
265
  ) : (
264
266
  // biome-ignore lint/suspicious/noArrayIndexKey: static segment list
@@ -267,171 +269,171 @@ function Ge({ before: e, after: r }) {
267
269
  {
268
270
  className: "rounded bg-emerald-100 px-0.5 text-emerald-700 no-underline dark:bg-emerald-900/40 dark:text-emerald-400",
269
271
  children: [
270
- i.text,
272
+ a.text,
271
273
  " "
272
274
  ]
273
275
  },
274
- d
276
+ o
275
277
  )
276
278
  )
277
279
  ) });
278
280
  }
279
- const Xe = {
281
+ const it = {
280
282
  added: "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-400",
281
283
  removed: "bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-400",
282
284
  changed: "bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-400"
283
285
  };
284
- function Ze(e, r, a) {
285
- const i = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(r)])), d = (s) => s == null || s === "", o = i.map((s) => {
286
- const m = !(s in e) || d(e[s]), x = !(s in r) || d(r[s]);
287
- if (m && x) return null;
288
- const p = m ? "added" : x ? "removed" : U(e[s]) !== U(r[s]) ? "changed" : "unchanged";
286
+ function ot(e, s, i) {
287
+ const a = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(s)])), o = (r) => r == null || r === "", d = a.map((r) => {
288
+ const m = !(r in e) || o(e[r]), h = !(r in s) || o(s[r]);
289
+ if (m && h) return null;
290
+ const p = m ? "added" : h ? "removed" : U(e[r]) !== U(s[r]) ? "changed" : "unchanged";
289
291
  return {
290
- field: s,
292
+ field: r,
291
293
  status: p,
292
- before: e[s],
293
- after: r[s],
294
- system: g(a, s).system
294
+ before: e[r],
295
+ after: s[r],
296
+ system: y(i, r).system
295
297
  };
296
- }).filter(Boolean), n = (s) => {
297
- const m = g(a, s.field);
298
- return (m.system ? 8 : m.onLayout ? 0 : 4) + (s.status === "unchanged" ? 2 : 0);
298
+ }).filter(Boolean), n = (r) => {
299
+ const m = y(i, r.field);
300
+ return (m.system ? 8 : m.onLayout ? 0 : 4) + (r.status === "unchanged" ? 2 : 0);
299
301
  };
300
- return o.sort(
301
- (s, m) => n(s) - n(m) || g(a, s.field).label.localeCompare(g(a, m.field).label)
302
+ return d.sort(
303
+ (r, m) => n(r) - n(m) || y(i, r.field).label.localeCompare(y(i, m.field).label)
302
304
  );
303
305
  }
304
- function O({
306
+ function q({
305
307
  value: e,
306
- meta: r,
307
- tone: a
308
+ meta: s,
309
+ tone: i
308
310
  }) {
309
- return e == null || e === "" ? /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" }) : r.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(ze, { collection: r.relatedCollection, id: e }) }) : G(e) ? /* @__PURE__ */ t(le, { value: He(e), tone: a }) : /* @__PURE__ */ t(le, { value: e, tone: a, dateOnly: r.dateOnly });
311
+ return e == null || e === "" ? /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" }) : s.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(tt, { collection: s.relatedCollection, id: e }) }) : X(e) ? /* @__PURE__ */ t(ie, { value: at(e), tone: i }) : /* @__PURE__ */ t(ie, { value: e, tone: i, dateOnly: s.dateOnly });
310
312
  }
311
- function et({
313
+ function dt({
312
314
  row: e,
313
- meta: r,
314
- fieldRevert: a,
315
- mode: i,
316
- hideStatusChips: d
315
+ meta: s,
316
+ fieldRevert: i,
317
+ mode: a,
318
+ hideStatusChips: o
317
319
  }) {
318
- const o = e.status === "changed" && (G(e.before) || G(e.after)), n = e.status === "changed" && I(e.before) && I(e.after);
320
+ const d = e.status === "changed" && (X(e.before) || X(e.after)), n = e.status === "changed" && I(e.before) && I(e.after);
319
321
  return /* @__PURE__ */ l(
320
322
  "div",
321
323
  {
322
- className: _(
324
+ className: T(
323
325
  "group/frow border-b border-slate-100 px-3 py-2 last:border-0 dark:border-border/60",
324
326
  e.system && "bg-slate-50/60 dark:bg-muted/20"
325
327
  ),
326
328
  "data-field-row": e.field,
327
329
  children: [
328
330
  /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
329
- /* @__PURE__ */ t(Ue, { map: r, field: e.field }),
330
- e.status !== "unchanged" && !d && /* @__PURE__ */ t(
331
+ /* @__PURE__ */ t(Xe, { map: s, field: e.field }),
332
+ e.status !== "unchanged" && !o && /* @__PURE__ */ t(
331
333
  "span",
332
334
  {
333
- className: _(
335
+ className: T(
334
336
  "rounded px-1 py-px text-[9px] font-semibold uppercase tracking-wide",
335
- Xe[e.status]
337
+ it[e.status]
336
338
  ),
337
339
  children: e.status === "added" ? "set" : e.status
338
340
  }
339
341
  ),
340
- (e.status === "changed" || i === "changes" && e.status === "added") && a && e.field !== "id" && /* @__PURE__ */ t("span", { className: "ml-auto shrink-0", children: /* @__PURE__ */ t(Qe, { field: e.field, ctl: a }) })
342
+ (e.status === "changed" || a === "changes" && e.status === "added") && i && e.field !== "id" && /* @__PURE__ */ t("span", { className: "ml-auto shrink-0", children: /* @__PURE__ */ t(st, { field: e.field, ctl: i }) })
341
343
  ] }),
342
- /* @__PURE__ */ t("div", { className: "mt-1", children: o ? /* @__PURE__ */ t("div", { "data-richtext-diff": !0, children: /* @__PURE__ */ t(Ge, { before: e.before, after: e.after }) }) : n ? /* @__PURE__ */ t(
343
- Je,
344
+ /* @__PURE__ */ t("div", { className: "mt-1", children: d ? /* @__PURE__ */ t("div", { "data-richtext-diff": !0, children: /* @__PURE__ */ t(lt, { before: e.before, after: e.after }) }) : n ? /* @__PURE__ */ t(
345
+ rt,
344
346
  {
345
347
  before: I(e.before),
346
348
  after: I(e.after)
347
349
  }
348
350
  ) : e.status === "changed" || e.status === "removed" ? /* @__PURE__ */ l("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-0.5", children: [
349
- /* @__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(O, { value: e.before, meta: g(r, e.field), tone: "before" }) }),
350
- /* @__PURE__ */ t(Te, { className: "h-3 w-3 shrink-0 self-center text-slate-300 dark:text-slate-600" }),
351
- /* @__PURE__ */ t(O, { value: e.after, meta: g(r, e.field), tone: "after" })
352
- ] }) : /* @__PURE__ */ t(O, { value: e.after ?? e.before, meta: g(r, e.field), tone: "after" }) })
351
+ /* @__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(q, { value: e.before, meta: y(s, e.field), tone: "before" }) }),
352
+ /* @__PURE__ */ t(Le, { className: "h-3 w-3 shrink-0 self-center text-slate-300 dark:text-slate-600" }),
353
+ /* @__PURE__ */ t(q, { value: e.after, meta: y(s, e.field), tone: "after" })
354
+ ] }) : /* @__PURE__ */ t(q, { value: e.after ?? e.before, meta: y(s, e.field), tone: "after" }) })
353
355
  ]
354
356
  }
355
357
  );
356
358
  }
357
- function tt({
359
+ function ct({
358
360
  before: e,
359
- after: r,
360
- meta: a,
361
- fieldRevert: i,
362
- mode: d,
363
- hideStatusChips: o
361
+ after: s,
362
+ meta: i,
363
+ fieldRevert: a,
364
+ mode: o,
365
+ hideStatusChips: d
364
366
  }) {
365
- const [n, s] = k(!1), m = j(() => Ze(e, r, a), [e, r, a]), x = d === "changes" ? m.filter((u) => u.status !== "unchanged") : m, p = n ? x : x.filter((u) => !u.system), h = x.length - p.length;
366
- if (x.length === 0)
367
- return /* @__PURE__ */ t("p", { className: "px-3 py-3 text-[12px] text-slate-400", children: d === "changes" ? "No field changes recorded." : "No snapshot data available." });
368
- const y = p.findIndex(
369
- (u) => !g(a, u.field).onLayout && !g(a, u.field).system
367
+ const [n, r] = v(!1), m = L(() => ot(e, s, i), [e, s, i]), h = o === "changes" ? m.filter((x) => x.status !== "unchanged") : m, p = n ? h : h.filter((x) => !x.system), u = h.length - p.length;
368
+ if (h.length === 0)
369
+ return /* @__PURE__ */ t("p", { className: "px-3 py-3 text-[12px] text-slate-400", children: o === "changes" ? "No field changes recorded." : "No snapshot data available." });
370
+ const g = p.findIndex(
371
+ (x) => !y(i, x.field).onLayout && !y(i, x.field).system
370
372
  ), c = p.some(
371
- (u) => g(a, u.field).onLayout && !g(a, u.field).system
373
+ (x) => y(i, x.field).onLayout && !y(i, x.field).system
372
374
  );
373
375
  return /* @__PURE__ */ l("div", { className: "overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
374
- p.map((u, b) => /* @__PURE__ */ l("div", { children: [
375
- b === y && c && /* @__PURE__ */ l("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: [
376
+ p.map((x, R) => /* @__PURE__ */ l("div", { children: [
377
+ R === g && c && /* @__PURE__ */ l("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: [
376
378
  /* @__PURE__ */ t("p", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: "Behind the scenes" }),
377
379
  /* @__PURE__ */ t("p", { className: "text-[10.5px] text-slate-400", children: "Not on the form — written automatically by rules, computed fields or integrations." })
378
380
  ] }),
379
381
  /* @__PURE__ */ t(
380
- et,
382
+ dt,
381
383
  {
382
- row: u,
383
- meta: a,
384
- fieldRevert: i,
385
- mode: d,
386
- hideStatusChips: o
384
+ row: x,
385
+ meta: i,
386
+ fieldRevert: a,
387
+ mode: o,
388
+ hideStatusChips: d
387
389
  }
388
390
  )
389
- ] }, u.field)),
390
- h > 0 && /* @__PURE__ */ l(
391
+ ] }, x.field)),
392
+ u > 0 && /* @__PURE__ */ l(
391
393
  "button",
392
394
  {
393
395
  type: "button",
394
- onClick: () => s(!0),
396
+ onClick: () => r(!0),
395
397
  className: "w-full border-t border-slate-100 px-3 py-2 text-left text-[11.5px] text-slate-400 hover:text-slate-600 dark:border-border/60 dark:hover:text-slate-300",
396
398
  "data-show-system": !0,
397
399
  children: [
398
400
  "Show ",
399
- h,
401
+ u,
400
402
  " system field",
401
- h === 1 ? "" : "s",
403
+ u === 1 ? "" : "s",
402
404
  " (ids, timestamps, machine columns)"
403
405
  ]
404
406
  }
405
407
  ),
406
- h === 0 && n && x.some((u) => u.system) && /* @__PURE__ */ t(
408
+ u === 0 && n && h.some((x) => x.system) && /* @__PURE__ */ t(
407
409
  "button",
408
410
  {
409
411
  type: "button",
410
- onClick: () => s(!1),
412
+ onClick: () => r(!1),
411
413
  className: "w-full border-t border-slate-100 px-3 py-2 text-left text-[11.5px] text-slate-400 hover:text-slate-600 dark:border-border/60",
412
414
  children: "Hide system fields"
413
415
  }
414
416
  )
415
417
  ] });
416
418
  }
417
- const at = {
419
+ const mt = {
418
420
  create: "bg-emerald-500",
419
421
  restore: "bg-emerald-500",
420
422
  update: "bg-nvr-cyan",
421
423
  delete: "bg-red-500"
422
- };
423
- function E(e) {
424
- var r;
425
- return e.first_name || e.last_name ? [e.first_name, e.last_name].filter(Boolean).join(" ") : e.user_email ?? ((r = e.user_id) == null ? void 0 : r.slice(0, 8)) ?? "System";
424
+ }, te = Oe(void 0);
425
+ function P(e, s) {
426
+ var i;
427
+ return e.actor && e.actor.kind !== "person" ? Ee(e, s) : 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";
426
428
  }
427
- function rt(e, r, a) {
428
- return e.action === "create" ? "created this record" : e.action === "restore" ? "restored this record from trash" : e.action === "delete" ? "deleted this record" : r > 0 ? `changed ${r} field${r === 1 ? "" : "s"}` : a > 0 ? "updated system fields" : "saved this record";
429
+ function pt(e, s, i) {
430
+ return e.action === "create" ? "created this record" : e.action === "restore" ? "restored this record from trash" : e.action === "delete" ? "deleted this record" : s > 0 ? `changed ${s} field${s === 1 ? "" : "s"}` : i > 0 ? "updated system fields" : "saved this record";
429
431
  }
430
- function st({ revision: e, isLast: r }) {
431
- var m, x, p;
432
- const a = e.event, i = (a == null ? void 0 : a.source) === "auto" || !e.user_id && (a == null ? void 0 : a.kind) === "transition", d = !i && ((m = a == null ? void 0 : a.on_behalf_of) != null && m.name) ? a.on_behalf_of.name : null, o = i ? "Automatic rule" : d ? `${E(e)}, for ${d}` : E(e);
433
- let n;
434
- (a == null ? void 0 : a.kind) === "transition" && a.addendum ? n = /* @__PURE__ */ l(T, { children: [
432
+ function ut({ revision: e, isLast: s }) {
433
+ var h, p, u;
434
+ const i = ce(te), a = e.event, o = (a == null ? void 0 : a.source) === "auto" || !e.user_id && (a == null ? void 0 : a.kind) === "transition", d = !o && ((h = a == null ? void 0 : a.on_behalf_of) != null && h.name) ? a.on_behalf_of.name : null, n = o ? "Automatic rule" : d ? `${P(e, i)}, for ${d}` : P(e, i);
435
+ let r;
436
+ (a == null ? void 0 : a.kind) === "transition" && a.addendum ? r = /* @__PURE__ */ l(j, { children: [
435
437
  "moved",
436
438
  " ",
437
439
  /* @__PURE__ */ l("span", { className: "font-medium text-slate-700 dark:text-slate-200", "data-revision-addendum": !0, children: [
@@ -441,7 +443,7 @@ function st({ revision: e, isLast: r }) {
441
443
  ] }),
442
444
  ":",
443
445
  " ",
444
- a.from_label && /* @__PURE__ */ l(T, { children: [
446
+ a.from_label && /* @__PURE__ */ l(j, { children: [
445
447
  /* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: a.from_label }),
446
448
  " ",
447
449
  "→",
@@ -452,10 +454,10 @@ function st({ revision: e, isLast: r }) {
452
454
  " · ",
453
455
  a.transition_label
454
456
  ] })
455
- ] }) : (a == null ? void 0 : a.kind) === "transition" ? n = /* @__PURE__ */ l(T, { children: [
457
+ ] }) : (a == null ? void 0 : a.kind) === "transition" ? r = /* @__PURE__ */ l(j, { children: [
456
458
  "moved it",
457
459
  " ",
458
- a.from_label && /* @__PURE__ */ l(T, { children: [
460
+ a.from_label && /* @__PURE__ */ l(j, { children: [
459
461
  "from",
460
462
  " ",
461
463
  /* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: a.from_label }),
@@ -468,41 +470,41 @@ function st({ revision: e, isLast: r }) {
468
470
  " · ",
469
471
  a.transition_label
470
472
  ] })
471
- ] }) : (a == null ? void 0 : a.kind) === "start" && a.to_label ? n = /* @__PURE__ */ l(T, { children: [
473
+ ] }) : (a == null ? void 0 : a.kind) === "start" && a.to_label ? r = /* @__PURE__ */ l(j, { children: [
472
474
  "started it in",
473
475
  " ",
474
476
  /* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: a.to_label })
475
- ] }) : (a == null ? void 0 : a.kind) === "start" ? n = /* @__PURE__ */ l(T, { children: [
477
+ ] }) : (a == null ? void 0 : a.kind) === "start" ? r = /* @__PURE__ */ l(j, { children: [
476
478
  "started the pipeline",
477
479
  e.comment ? ` — ${e.comment.replace(/^Started pipeline\s*[—-]?\s*/i, "")}` : ""
478
- ] }) : (x = e.action) != null && x.startsWith("o2m-") ? n = /* @__PURE__ */ l(T, { children: [
480
+ ] }) : (p = e.action) != null && p.startsWith("o2m-") ? r = /* @__PURE__ */ l(j, { children: [
479
481
  e.action === "o2m-create" ? "added" : e.action === "o2m-delete" ? "removed" : "changed",
480
482
  " ",
481
483
  "related rows",
482
484
  e.comment ? ` — ${e.comment}` : ""
483
- ] }) : n = /* @__PURE__ */ l(T, { children: [
484
- e.action ?? "event",
485
+ ] }) : r = /* @__PURE__ */ l(j, { children: [
486
+ De({ ...e, item: null }, i),
485
487
  e.comment ? ` — ${e.comment}` : ""
486
488
  ] });
487
- const s = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
489
+ const m = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
488
490
  return /* @__PURE__ */ l(
489
491
  "div",
490
492
  {
491
493
  className: "relative pl-9",
492
494
  "data-revision-event": (a == null ? void 0 : a.kind) ?? e.action ?? "",
493
- "data-revision-on-behalf": d ? (p = a == null ? void 0 : a.on_behalf_of) == null ? void 0 : p.id : void 0,
495
+ "data-revision-on-behalf": d ? (u = a == null ? void 0 : a.on_behalf_of) == null ? void 0 : u.id : void 0,
494
496
  children: [
495
497
  /* @__PURE__ */ t(
496
498
  "span",
497
499
  {
498
- className: _(
500
+ className: T(
499
501
  "absolute left-[11px] top-[18px] h-2.5 w-2.5 rounded-full ring-4 ring-white dark:ring-card",
500
502
  (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"
501
503
  ),
502
504
  "aria-hidden": !0
503
505
  }
504
506
  ),
505
- !r && /* @__PURE__ */ t(
507
+ !s && /* @__PURE__ */ t(
506
508
  "span",
507
509
  {
508
510
  className: "absolute bottom-0 left-[15.5px] top-[30px] w-px bg-slate-200 dark:bg-border",
@@ -510,18 +512,18 @@ function st({ revision: e, isLast: r }) {
510
512
  }
511
513
  ),
512
514
  /* @__PURE__ */ l("div", { className: "flex w-full items-start gap-2.5 rounded-md px-2 py-2.5 text-left", children: [
513
- i ? /* @__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(
514
- ce,
515
+ o ? /* @__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(
516
+ pe,
515
517
  {
516
518
  userId: e.user_id,
517
519
  className: "h-6 w-6",
518
- fallback: /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy dark:text-nvr-cyan", children: o.split(" ").map((h) => h[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() })
520
+ fallback: /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy dark:text-nvr-cyan", children: n.split(" ").map((g) => g[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() })
519
521
  }
520
522
  ),
521
523
  /* @__PURE__ */ l("span", { className: "min-w-0 flex-1 text-[12.5px] text-slate-700 dark:text-slate-200", children: [
522
- /* @__PURE__ */ t("span", { className: "font-medium", children: o }),
524
+ /* @__PURE__ */ t("span", { className: "font-medium", children: n }),
523
525
  " ",
524
- /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: n }),
526
+ /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: r }),
525
527
  (a == null ? void 0 : a.kind) === "transition" && e.comment && /* @__PURE__ */ l(
526
528
  "span",
527
529
  {
@@ -540,7 +542,7 @@ function st({ revision: e, isLast: r }) {
540
542
  {
541
543
  className: "shrink-0 text-[11px] tabular-nums text-slate-400",
542
544
  title: e.timestamp ? new Date(e.timestamp).toLocaleString() : void 0,
543
- children: s
545
+ children: m
544
546
  }
545
547
  )
546
548
  ] })
@@ -548,77 +550,77 @@ function st({ revision: e, isLast: r }) {
548
550
  }
549
551
  );
550
552
  }
551
- function nt({
553
+ function ht({
552
554
  revision: e,
553
- previousData: r,
554
- meta: a,
555
- onRollback: i,
556
- inlineTableFields: d,
557
- isLast: o
555
+ previousData: s,
556
+ meta: i,
557
+ onRollback: a,
558
+ inlineTableFields: o,
559
+ isLast: d
558
560
  }) {
559
- const n = D(), [s, m] = k(!1), [x, p] = k(!1), [h, y] = k("changes"), [c, u] = k(!1), [b, v] = k(null), w = e.action === "update", S = e.action === "create" || e.action === "restore", L = e.action === "delete", P = L ? e.data ?? {} : S ? {} : r ?? {}, ee = L ? {} : e.data ?? {}, { humanDelta: N, systemDelta: A } = j(() => {
561
+ const n = F(), r = ce(te), m = Fe(e).reason, [h, p] = v(!1), [u, g] = v(!1), [c, x] = v("changes"), [R, b] = v(!1), [N, S] = v(null), w = e.action === "update", C = e.action === "create" || e.action === "restore", W = e.action === "delete", k = W ? e.data ?? {} : C ? {} : s ?? {}, $ = W ? {} : e.data ?? {}, { humanDelta: V, systemDelta: he } = L(() => {
560
562
  const f = e.delta ?? {};
561
- let C = 0, F = 0;
562
- for (const H of Object.keys(f)) {
563
- const ge = r == null ? void 0 : r[H], ye = (e.data ?? {})[H];
564
- w && r && U(ge) === U(ye) || (g(a, H).system ? F++ : C++);
563
+ let _ = 0, E = 0;
564
+ for (const J of Object.keys(f)) {
565
+ const ve = s == null ? void 0 : s[J], we = (e.data ?? {})[J];
566
+ w && s && U(ve) === U(we) || (y(i, J).system ? E++ : _++);
565
567
  }
566
- return { humanDelta: C, systemDelta: F };
567
- }, [e, r, a, w]), V = w || S, [W, pe] = k(null), ue = Z(), [he, te] = k(null), ae = J({
568
+ return { humanDelta: _, systemDelta: E };
569
+ }, [e, s, i, w]), xe = w || C, [z, fe] = v(null), be = ee(), [ge, ae] = v(null), re = Q({
568
570
  mutationFn: (f) => n.request(K(`/revisions/${e.id}/revert-field`, { field: f })),
569
- onSuccess: (f, C) => {
570
- te(null), R.success(`Reverted ${g(a, C).label} to this revision's value`), ue.invalidateQueries({ queryKey: ["revisions", e.collection, e.item] }), i == null || i();
571
+ onSuccess: (f, _) => {
572
+ ae(null), A.success(`Reverted ${y(i, _).label} to this revision's value`), be.invalidateQueries({ queryKey: ["revisions", e.collection, e.item] }), a == null || a();
571
573
  },
572
- onError: () => R.error("Failed to revert field")
573
- }), xe = w || S ? {
574
- confirmField: he,
575
- setConfirmField: te,
576
- revert: (f) => ae.mutate(f),
577
- pending: ae.isPending
578
- } : void 0, z = J({
574
+ onError: () => A.error("Failed to revert field")
575
+ }), ye = w || C ? {
576
+ confirmField: ge,
577
+ setConfirmField: ae,
578
+ revert: (f) => re.mutate(f),
579
+ pending: re.isPending
580
+ } : void 0, H = Q({
579
581
  mutationFn: () => n.request(K(`/revisions/${e.id}/rollback`, {})),
580
582
  onSuccess: (f) => {
581
- p(!1), R.success("Rolled back to this revision");
582
- const C = re(f);
583
- C && R.warning(C, { duration: 1e4 }), d != null && d.length && e.timestamp && pe(e.timestamp), i == null || i();
583
+ g(!1), A.success("Rolled back to this revision");
584
+ const _ = se(f);
585
+ _ && A.warning(_, { duration: 1e4 }), o != null && o.length && e.timestamp && fe(e.timestamp), a == null || a();
584
586
  },
585
- onError: () => R.error("Failed to rollback")
587
+ onError: () => A.error("Failed to rollback")
586
588
  });
587
- async function fe(f) {
588
- if (W) {
589
- v(f.field);
589
+ async function Ne(f) {
590
+ if (z) {
591
+ S(f.field);
590
592
  try {
591
- const C = await n.request(
593
+ const _ = await n.request(
592
594
  K("/revisions/o2m-restore", {
593
595
  collection: f.relatedCollection,
594
596
  many_field: f.manyField,
595
597
  parent_id: f.parentId,
596
- target_timestamp: W
598
+ target_timestamp: z
597
599
  })
598
600
  );
599
- R.success(`Restored ${f.label}`);
600
- const F = re(C);
601
- F && R.warning(F, { duration: 1e4 });
601
+ A.success(`Restored ${f.label}`);
602
+ const E = se(_);
603
+ E && A.warning(E, { duration: 1e4 });
602
604
  } catch {
603
- R.error(`Failed to restore ${f.label}`);
605
+ A.error(`Failed to restore ${f.label}`);
604
606
  } finally {
605
- v(null);
607
+ S(null);
606
608
  }
607
609
  }
608
610
  }
609
- const be = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
611
+ const ke = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
610
612
  return /* @__PURE__ */ l("div", { className: "relative pl-9", "data-revision-row": e.id, children: [
611
613
  /* @__PURE__ */ t(
612
614
  "span",
613
615
  {
614
- className: _(
616
+ className: T(
615
617
  "absolute left-[11px] top-[18px] h-2.5 w-2.5 rounded-full ring-4 ring-white dark:ring-card",
616
- at[e.action ?? ""] ?? "bg-slate-300"
618
+ mt[e.action ?? ""] ?? "bg-slate-300"
617
619
  ),
618
620
  "aria-hidden": !0
619
621
  }
620
622
  ),
621
- !o && /* @__PURE__ */ t(
623
+ !d && /* @__PURE__ */ t(
622
624
  "span",
623
625
  {
624
626
  className: "absolute bottom-0 left-[15.5px] top-[30px] w-px bg-slate-200 dark:bg-border",
@@ -629,50 +631,62 @@ function nt({
629
631
  "button",
630
632
  {
631
633
  type: "button",
632
- onClick: () => m((f) => !f),
634
+ onClick: () => p((f) => !f),
633
635
  className: "flex w-full items-center gap-2.5 rounded-md px-2 py-2.5 text-left transition-colors hover:bg-slate-50 dark:hover:bg-muted/40",
634
636
  children: [
635
637
  /* @__PURE__ */ t(
636
- ce,
638
+ pe,
637
639
  {
638
640
  userId: e.user_id,
639
641
  className: "h-6 w-6",
640
- fallback: /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy dark:text-nvr-cyan", children: E(e).split(" ").map((f) => f[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() })
642
+ fallback: /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy dark:text-nvr-cyan", children: P(e, r).split(" ").map((f) => f[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() })
641
643
  }
642
644
  ),
643
645
  /* @__PURE__ */ l("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: [
644
- /* @__PURE__ */ t("span", { className: "font-medium", children: E(e) }),
646
+ /* @__PURE__ */ t("span", { className: "font-medium", children: P(e, r) }),
645
647
  " ",
646
- /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: rt(e, N, A) })
648
+ /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: pt(e, V, he) }),
649
+ m && /* @__PURE__ */ l(
650
+ "span",
651
+ {
652
+ className: "mt-0.5 block truncate text-[11.5px] text-slate-500 dark:text-slate-400",
653
+ "data-revision-reason": !0,
654
+ "data-tip": m,
655
+ children: [
656
+ "Reason: ",
657
+ m
658
+ ]
659
+ }
660
+ )
647
661
  ] }),
648
- /* @__PURE__ */ t(Le, { label: e.via_agent }),
662
+ /* @__PURE__ */ t(Ke, { label: e.via_agent }),
649
663
  /* @__PURE__ */ t(
650
664
  "span",
651
665
  {
652
666
  className: "shrink-0 text-[11px] tabular-nums text-slate-400",
653
667
  title: e.timestamp ? new Date(e.timestamp).toLocaleString() : void 0,
654
- children: be
668
+ children: ke
655
669
  }
656
670
  ),
657
- s ? /* @__PURE__ */ t(Se, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }) : /* @__PURE__ */ t(Ce, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
671
+ h ? /* @__PURE__ */ t(Re, { 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" })
658
672
  ]
659
673
  }
660
674
  ),
661
- s && /* @__PURE__ */ l("div", { className: "space-y-2.5 px-2 pb-4 pt-1", children: [
675
+ h && /* @__PURE__ */ l("div", { className: "space-y-2.5 px-2 pb-4 pt-1", children: [
662
676
  /* @__PURE__ */ l("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
663
677
  /* @__PURE__ */ t("div", { className: "flex items-center overflow-hidden rounded-md border border-slate-200 dark:border-border", children: [
664
678
  ["changes", "What changed"],
665
679
  ["all", "Full record"]
666
- ].map(([f, C]) => /* @__PURE__ */ t(
680
+ ].map(([f, _]) => /* @__PURE__ */ t(
667
681
  "button",
668
682
  {
669
683
  type: "button",
670
- onClick: () => y(f),
671
- className: _(
684
+ onClick: () => x(f),
685
+ className: T(
672
686
  "px-2.5 py-1 text-[11.5px] transition-colors",
673
- h === f ? "bg-nvr-cyan/10 font-medium text-nvr-navy dark:text-nvr-cyan" : "text-slate-400 hover:text-slate-600 dark:hover:text-slate-300"
687
+ c === f ? "bg-nvr-cyan/10 font-medium text-nvr-navy dark:text-nvr-cyan" : "text-slate-400 hover:text-slate-600 dark:hover:text-slate-300"
674
688
  ),
675
- children: C
689
+ children: _
676
690
  },
677
691
  f
678
692
  )) }),
@@ -681,18 +695,18 @@ function nt({
681
695
  "button",
682
696
  {
683
697
  type: "button",
684
- onClick: () => u((f) => !f),
685
- className: _(
698
+ onClick: () => b((f) => !f),
699
+ className: T(
686
700
  "inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11.5px] transition-colors",
687
- 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"
701
+ R ? "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"
688
702
  ),
689
703
  children: [
690
- /* @__PURE__ */ t(_e, { className: "h-3 w-3" }),
704
+ /* @__PURE__ */ t(Ae, { className: "h-3 w-3" }),
691
705
  "Notes"
692
706
  ]
693
707
  }
694
708
  ),
695
- V && (x ? /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1.5", children: [
709
+ xe && (u ? /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1.5", children: [
696
710
  /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-500", children: "Restore this version?" }),
697
711
  /* @__PURE__ */ t(
698
712
  M,
@@ -700,8 +714,8 @@ function nt({
700
714
  size: "sm",
701
715
  variant: "destructive",
702
716
  className: "h-6 text-[11px]",
703
- disabled: z.isPending,
704
- onClick: () => z.mutate(),
717
+ disabled: H.isPending,
718
+ onClick: () => H.mutate(),
705
719
  children: "Yes, restore"
706
720
  }
707
721
  ),
@@ -711,7 +725,7 @@ function nt({
711
725
  size: "sm",
712
726
  variant: "outline",
713
727
  className: "h-6 text-[11px]",
714
- onClick: () => p(!1),
728
+ onClick: () => g(!1),
715
729
  children: "Cancel"
716
730
  }
717
731
  )
@@ -721,8 +735,8 @@ function nt({
721
735
  size: "sm",
722
736
  variant: "outline",
723
737
  className: "h-6 gap-1 text-[11px]",
724
- disabled: z.isPending,
725
- onClick: () => p(!0),
738
+ disabled: H.isPending,
739
+ onClick: () => g(!0),
726
740
  title: "Set the whole record back to how it looked after this save",
727
741
  children: [
728
742
  /* @__PURE__ */ t(de, { className: "h-3 w-3" }),
@@ -732,30 +746,30 @@ function nt({
732
746
  ))
733
747
  ] })
734
748
  ] }),
735
- c && /* @__PURE__ */ t(ct, { revisionId: e.id ?? "" }),
749
+ R && /* @__PURE__ */ t(yt, { revisionId: e.id ?? "" }),
736
750
  /* @__PURE__ */ t(
737
- tt,
751
+ ct,
738
752
  {
739
- before: P,
740
- after: ee,
741
- meta: a,
742
- fieldRevert: xe,
743
- mode: h,
744
- hideStatusChips: S
753
+ before: k,
754
+ after: $,
755
+ meta: i,
756
+ fieldRevert: ye,
757
+ mode: c,
758
+ hideStatusChips: C
745
759
  }
746
760
  ),
747
- W && d && d.length > 0 && /* @__PURE__ */ l("div", { className: "space-y-1.5 rounded-md border border-slate-100 bg-slate-50 p-2 dark:border-border dark:bg-muted/30", children: [
761
+ z && o && o.length > 0 && /* @__PURE__ */ l("div", { className: "space-y-1.5 rounded-md border border-slate-100 bg-slate-50 p-2 dark:border-border dark:bg-muted/30", children: [
748
762
  /* @__PURE__ */ t("p", { className: "text-[10.5px] font-medium text-slate-500", children: "Also restore related rows?" }),
749
- d.map((f) => /* @__PURE__ */ l("div", { className: "flex items-center justify-between gap-2", children: [
763
+ o.map((f) => /* @__PURE__ */ l("div", { className: "flex items-center justify-between gap-2", children: [
750
764
  /* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children: f.label }),
751
765
  /* @__PURE__ */ t(
752
766
  "button",
753
767
  {
754
768
  type: "button",
755
- disabled: b === f.field,
756
- onClick: () => fe(f),
769
+ disabled: N === f.field,
770
+ onClick: () => Ne(f),
757
771
  className: "rounded border border-nvr-cyan/40 px-2 py-0.5 text-[10.5px] font-medium text-nvr-cyan hover:bg-nvr-cyan/10 disabled:opacity-40",
758
- children: b === f.field ? "Restoring…" : "Restore"
772
+ children: N === f.field ? "Restoring…" : "Restore"
759
773
  }
760
774
  )
761
775
  ] }, f.field))
@@ -763,39 +777,39 @@ function nt({
763
777
  ] })
764
778
  ] });
765
779
  }
766
- function lt({ data: e, meta: r }) {
767
- const [a, i] = k(null), [d, o] = k(""), [n, s] = k(""), [m, x] = k(""), p = j(() => {
768
- if (!d || !e) return null;
769
- const c = (/* @__PURE__ */ new Date(`${d}T23:59:59`)).getTime();
770
- return e.find((u) => u.timestamp && new Date(u.timestamp).getTime() <= c) ?? null;
771
- }, [d, e]), h = j(() => {
780
+ function xt({ data: e, meta: s }) {
781
+ const [i, a] = v(null), [o, d] = v(""), [n, r] = v(""), [m, h] = v(""), p = L(() => {
782
+ if (!o || !e) return null;
783
+ const c = (/* @__PURE__ */ new Date(`${o}T23:59:59`)).getTime();
784
+ return e.find((x) => x.timestamp && new Date(x.timestamp).getTime() <= c) ?? null;
785
+ }, [o, e]), u = L(() => {
772
786
  if (!n || !m || !e) return null;
773
- const c = (/* @__PURE__ */ new Date(`${n}T23:59:59`)).getTime(), u = (/* @__PURE__ */ new Date(`${m}T23:59:59`)).getTime();
774
- if (u <= c) return { error: "The second date must be after the first" };
775
- const b = (N) => e.find((A) => A.timestamp && new Date(A.timestamp).getTime() <= N) ?? null, v = b(c), w = b(u);
776
- if (!w) return { error: "No snapshot exists at or before the second date" };
777
- const S = (v == null ? void 0 : v.data) ?? {}, L = w.data ?? {}, P = /* @__PURE__ */ new Map();
778
- for (const N of [...e].reverse()) {
779
- const A = N.timestamp ? new Date(N.timestamp).getTime() : 0;
780
- if (!(A <= c || A > u || !N.delta))
781
- for (const V of Object.keys(N.delta))
782
- P.set(V, { name: E(N), when: N.timestamp });
787
+ const c = (/* @__PURE__ */ new Date(`${n}T23:59:59`)).getTime(), x = (/* @__PURE__ */ new Date(`${m}T23:59:59`)).getTime();
788
+ if (x <= c) return { error: "The second date must be after the first" };
789
+ const R = (k) => e.find(($) => $.timestamp && new Date($.timestamp).getTime() <= k) ?? null, b = R(c), N = R(x);
790
+ if (!N) return { error: "No snapshot exists at or before the second date" };
791
+ const S = (b == null ? void 0 : b.data) ?? {}, w = N.data ?? {}, C = /* @__PURE__ */ new Map();
792
+ for (const k of [...e].reverse()) {
793
+ const $ = k.timestamp ? new Date(k.timestamp).getTime() : 0;
794
+ if (!($ <= c || $ > x || !k.delta))
795
+ for (const V of Object.keys(k.delta))
796
+ C.set(V, { name: P(k), when: k.timestamp });
783
797
  }
784
- return { fields: [.../* @__PURE__ */ new Set([...Object.keys(S), ...Object.keys(L)])].filter((N) => String(S[N] ?? "") !== String(L[N] ?? "")).map((N) => ({ field: N, from: S[N], to: L[N], by: P.get(N) ?? null })) };
785
- }, [n, m, e]), y = "h-7 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card";
798
+ return { fields: [.../* @__PURE__ */ new Set([...Object.keys(S), ...Object.keys(w)])].filter((k) => String(S[k] ?? "") !== String(w[k] ?? "")).map((k) => ({ field: k, from: S[k], to: w[k], by: C.get(k) ?? null })) };
799
+ }, [n, m, e]), g = "h-7 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card";
786
800
  return /* @__PURE__ */ l("div", { className: "space-y-2", children: [
787
801
  /* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
788
802
  /* @__PURE__ */ l(
789
803
  "button",
790
804
  {
791
805
  type: "button",
792
- onClick: () => i(a === "asof" ? null : "asof"),
793
- className: _(
806
+ onClick: () => a(i === "asof" ? null : "asof"),
807
+ className: T(
794
808
  "inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-[11.5px] transition-colors",
795
- a === "asof" || d ? "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"
809
+ i === "asof" || o ? "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"
796
810
  ),
797
811
  children: [
798
- /* @__PURE__ */ t(ve, { className: "h-3.5 w-3.5" }),
812
+ /* @__PURE__ */ t(_e, { className: "h-3.5 w-3.5" }),
799
813
  "View as of a date"
800
814
  ]
801
815
  }
@@ -804,50 +818,50 @@ function lt({ data: e, meta: r }) {
804
818
  "button",
805
819
  {
806
820
  type: "button",
807
- onClick: () => i(a === "compare" ? null : "compare"),
808
- className: _(
821
+ onClick: () => a(i === "compare" ? null : "compare"),
822
+ className: T(
809
823
  "inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-[11.5px] transition-colors",
810
- a === "compare" || n && m ? "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"
824
+ i === "compare" || n && m ? "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"
811
825
  ),
812
826
  children: [
813
- /* @__PURE__ */ t(we, { className: "h-3.5 w-3.5" }),
827
+ /* @__PURE__ */ t(Te, { className: "h-3.5 w-3.5" }),
814
828
  "Compare two dates"
815
829
  ]
816
830
  }
817
831
  )
818
832
  ] }),
819
- a === "asof" && /* @__PURE__ */ l("div", { className: "rounded-lg border border-slate-200 bg-slate-50/60 p-2.5 dark:border-border dark:bg-muted/20", children: [
833
+ i === "asof" && /* @__PURE__ */ l("div", { className: "rounded-lg border border-slate-200 bg-slate-50/60 p-2.5 dark:border-border dark:bg-muted/20", children: [
820
834
  /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
821
835
  /* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", children: "Show the record exactly as it was on" }),
822
836
  /* @__PURE__ */ t(
823
837
  "input",
824
838
  {
825
839
  type: "date",
826
- value: d,
827
- onChange: (c) => o(c.target.value),
828
- className: y,
840
+ value: o,
841
+ onChange: (c) => d(c.target.value),
842
+ className: g,
829
843
  "aria-label": "View record as of date",
830
844
  "data-as-of": !0
831
845
  }
832
846
  ),
833
- d && /* @__PURE__ */ t(
847
+ o && /* @__PURE__ */ t(
834
848
  "button",
835
849
  {
836
850
  type: "button",
837
- onClick: () => o(""),
851
+ onClick: () => d(""),
838
852
  className: "text-[11px] text-slate-400 hover:text-slate-600 dark:hover:text-slate-300",
839
853
  children: "Clear"
840
854
  }
841
855
  )
842
856
  ] }),
843
- d && !p && /* @__PURE__ */ t("p", { className: "mt-2 text-[12px] text-slate-400", children: "No snapshot exists at or before that date — the record is newer." }),
857
+ o && !p && /* @__PURE__ */ t("p", { className: "mt-2 text-[12px] text-slate-400", children: "No snapshot exists at or before that date — the record is newer." }),
844
858
  p && /* @__PURE__ */ l("div", { className: "mt-2 overflow-hidden rounded-lg border border-nvr-cyan/40 bg-white dark:bg-card", children: [
845
859
  /* @__PURE__ */ t("div", { className: "border-b border-slate-200 bg-[#f0fbff] px-2.5 py-1.5 dark:border-border dark:bg-nvr-cyan/10", children: /* @__PURE__ */ l("span", { className: "text-[11.5px] font-semibold text-slate-700 dark:text-slate-200", children: [
846
860
  "Record as of",
847
861
  " ",
848
- p.timestamp ? new Date(p.timestamp).toLocaleString() : d
862
+ p.timestamp ? new Date(p.timestamp).toLocaleString() : o
849
863
  ] }) }),
850
- /* @__PURE__ */ t("div", { className: "max-h-80 overflow-y-auto", children: Object.entries(p.data ?? {}).filter(([, c]) => c != null && c !== "").sort(([c], [u]) => g(r, c).label.localeCompare(g(r, u).label)).map(([c, u]) => /* @__PURE__ */ l(
864
+ /* @__PURE__ */ t("div", { className: "max-h-80 overflow-y-auto", children: Object.entries(p.data ?? {}).filter(([, c]) => c != null && c !== "").sort(([c], [x]) => y(s, c).label.localeCompare(y(s, x).label)).map(([c, x]) => /* @__PURE__ */ l(
851
865
  "div",
852
866
  {
853
867
  className: "flex items-start gap-3 border-b border-slate-100 px-2.5 py-1.5 last:border-0 dark:border-border/60",
@@ -857,17 +871,17 @@ function lt({ data: e, meta: r }) {
857
871
  {
858
872
  className: "w-[200px] shrink-0 text-[11.5px] font-medium text-slate-600 dark:text-slate-300",
859
873
  title: c,
860
- children: g(r, c).label
874
+ children: y(s, c).label
861
875
  }
862
876
  ),
863
- /* @__PURE__ */ t("span", { className: "break-words text-[11.5px] text-slate-700 dark:text-slate-300", children: /* @__PURE__ */ t(O, { value: u, meta: g(r, c), tone: "after" }) })
877
+ /* @__PURE__ */ t("span", { className: "break-words text-[11.5px] text-slate-700 dark:text-slate-300", children: /* @__PURE__ */ t(q, { value: x, meta: y(s, c), tone: "after" }) })
864
878
  ]
865
879
  },
866
880
  c
867
881
  )) })
868
882
  ] })
869
883
  ] }),
870
- a === "compare" && /* @__PURE__ */ l("div", { className: "rounded-lg border border-slate-200 bg-slate-50/60 p-2.5 dark:border-border dark:bg-muted/20", children: [
884
+ i === "compare" && /* @__PURE__ */ l("div", { className: "rounded-lg border border-slate-200 bg-slate-50/60 p-2.5 dark:border-border dark:bg-muted/20", children: [
871
885
  /* @__PURE__ */ l("div", { className: "flex flex-wrap items-center gap-2", children: [
872
886
  /* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", children: "What changed between" }),
873
887
  /* @__PURE__ */ t(
@@ -875,8 +889,8 @@ function lt({ data: e, meta: r }) {
875
889
  {
876
890
  type: "date",
877
891
  value: n,
878
- onChange: (c) => s(c.target.value),
879
- className: y,
892
+ onChange: (c) => r(c.target.value),
893
+ className: g,
880
894
  "aria-label": "Compare from date",
881
895
  "data-diff-from": !0
882
896
  }
@@ -887,8 +901,8 @@ function lt({ data: e, meta: r }) {
887
901
  {
888
902
  type: "date",
889
903
  value: m,
890
- onChange: (c) => x(c.target.value),
891
- className: y,
904
+ onChange: (c) => h(c.target.value),
905
+ className: g,
892
906
  "aria-label": "Compare to date",
893
907
  "data-diff-to": !0
894
908
  }
@@ -898,31 +912,31 @@ function lt({ data: e, meta: r }) {
898
912
  {
899
913
  type: "button",
900
914
  onClick: () => {
901
- s(""), x("");
915
+ r(""), h("");
902
916
  },
903
917
  className: "text-[11px] text-slate-400 hover:text-slate-600 dark:hover:text-slate-300",
904
918
  children: "Clear"
905
919
  }
906
920
  )
907
921
  ] }),
908
- (h == null ? void 0 : h.error) != null && /* @__PURE__ */ t("p", { className: "mt-2 text-[12px] text-amber-600 dark:text-amber-400", children: h == null ? void 0 : h.error }),
909
- (h == null ? void 0 : h.fields) != null && /* @__PURE__ */ l(
922
+ (u == null ? void 0 : u.error) != null && /* @__PURE__ */ t("p", { className: "mt-2 text-[12px] text-amber-600 dark:text-amber-400", children: u == null ? void 0 : u.error }),
923
+ (u == null ? void 0 : u.fields) != null && /* @__PURE__ */ l(
910
924
  "div",
911
925
  {
912
926
  className: "mt-2 overflow-hidden rounded-lg border border-nvr-cyan/40 bg-white dark:bg-card",
913
927
  "data-between-diff": !0,
914
928
  children: [
915
929
  /* @__PURE__ */ t("div", { className: "border-b border-slate-200 bg-[#f0fbff] px-2.5 py-1.5 dark:border-border dark:bg-nvr-cyan/10", children: /* @__PURE__ */ l("span", { className: "text-[11.5px] font-semibold text-slate-700 dark:text-slate-200", children: [
916
- h.fields.length,
930
+ u.fields.length,
917
931
  " field",
918
- h.fields.length === 1 ? "" : "s",
932
+ u.fields.length === 1 ? "" : "s",
919
933
  " changed between ",
920
934
  n,
921
935
  " and",
922
936
  " ",
923
937
  m
924
938
  ] }) }),
925
- h.fields.length === 0 ? /* @__PURE__ */ t("p", { className: "px-2.5 py-3 text-[12px] text-slate-400", children: "Nothing changed in that window." }) : /* @__PURE__ */ t("div", { className: "max-h-80 overflow-y-auto", children: h.fields.map((c) => /* @__PURE__ */ l(
939
+ u.fields.length === 0 ? /* @__PURE__ */ t("p", { className: "px-2.5 py-3 text-[12px] text-slate-400", children: "Nothing changed in that window." }) : /* @__PURE__ */ t("div", { className: "max-h-80 overflow-y-auto", children: u.fields.map((c) => /* @__PURE__ */ l(
926
940
  "div",
927
941
  {
928
942
  className: "border-b border-slate-100 px-2.5 py-1.5 last:border-0 dark:border-border/60",
@@ -933,7 +947,7 @@ function lt({ data: e, meta: r }) {
933
947
  {
934
948
  className: "text-[11.5px] font-medium text-slate-600 dark:text-slate-300",
935
949
  title: c.field,
936
- children: g(r, c.field).label
950
+ children: y(s, c.field).label
937
951
  }
938
952
  ),
939
953
  c.by && /* @__PURE__ */ l("span", { className: "shrink-0 text-[10.5px] text-slate-400", children: [
@@ -942,8 +956,8 @@ function lt({ data: e, meta: r }) {
942
956
  ] })
943
957
  ] }),
944
958
  /* @__PURE__ */ l("p", { className: "mt-0.5 flex flex-wrap items-baseline gap-x-2 break-words text-[11.5px]", children: [
945
- /* @__PURE__ */ t("span", { className: "text-red-500 line-through dark:text-red-400", children: /* @__PURE__ */ t(O, { value: c.from, meta: g(r, c.field), tone: "before" }) }),
946
- /* @__PURE__ */ t("span", { className: "text-emerald-600 dark:text-emerald-400", children: /* @__PURE__ */ t(O, { value: c.to, meta: g(r, c.field), tone: "after" }) })
959
+ /* @__PURE__ */ t("span", { className: "text-red-500 line-through dark:text-red-400", children: /* @__PURE__ */ t(q, { value: c.from, meta: y(s, c.field), tone: "before" }) }),
960
+ /* @__PURE__ */ t("span", { className: "text-emerald-600 dark:text-emerald-400", children: /* @__PURE__ */ t(q, { value: c.to, meta: y(s, c.field), tone: "after" }) })
947
961
  ] })
948
962
  ]
949
963
  },
@@ -955,7 +969,7 @@ function lt({ data: e, meta: r }) {
955
969
  ] })
956
970
  ] });
957
971
  }
958
- function it(e) {
972
+ function ft(e) {
959
973
  return e ? new Date(e).toLocaleDateString([], {
960
974
  weekday: "short",
961
975
  month: "short",
@@ -963,89 +977,92 @@ function it(e) {
963
977
  year: "numeric"
964
978
  }) : "Unknown date";
965
979
  }
966
- function dt({
980
+ function bt({
967
981
  collection: e,
968
- item: r,
969
- onRollback: a,
970
- inlineTableFields: i
982
+ item: s,
983
+ onRollback: i,
984
+ inlineTableFields: a
971
985
  }) {
972
- const d = D(), o = me(e, !0), { data: n, isLoading: s } = B({
973
- queryKey: ["revisions", e, r],
974
- queryFn: () => d.request(q("/revisions", { collection: e, item: r })).then((u) => u.data ?? []),
986
+ const o = F(), d = ue(e, !0), { data: n, isLoading: r } = B({
987
+ queryKey: ["revisions", e, s],
988
+ queryFn: () => o.request(D("/revisions", { collection: e, item: s })).then((b) => b.data ?? []),
975
989
  staleTime: 3e4
976
- }), m = Z();
977
- Ae(e, r, [["revisions", e, r]], { client: m });
978
- const x = Re(null), p = j(() => {
990
+ }), m = ee();
991
+ Pe(e, s, [["revisions", e, s]], { client: m });
992
+ const h = $e(null), p = L(() => {
979
993
  if (!n) return /* @__PURE__ */ new Set();
980
- const u = n.map($);
981
- if (!x.current)
982
- return x.current = new Set(u), /* @__PURE__ */ new Set();
983
- const b = x.current;
984
- return new Set(u.filter((v) => !b.has(v)));
985
- }, [n]), h = (n == null ? void 0 : n.length) ?? 0, y = j(() => (n ?? []).filter(Y), [n]), c = j(() => {
986
- const u = [];
987
- for (const b of n ?? []) {
988
- const v = it(b.timestamp), w = u[u.length - 1];
989
- w && w.day === v ? w.revisions.push(b) : u.push({ day: v, revisions: [b] });
994
+ const b = n.map(O);
995
+ if (!h.current)
996
+ return h.current = new Set(b), /* @__PURE__ */ new Set();
997
+ const N = h.current;
998
+ return new Set(b.filter((S) => !N.has(S)));
999
+ }, [n]), u = (n == null ? void 0 : n.length) ?? 0, g = L(() => (n ?? []).filter(G), [n]), c = L(
1000
+ () => (n ?? []).filter((b) => b.actor && b.actor.kind !== "person").map((b) => ({ action: b.action, user: b.user_id, actor: b.actor })),
1001
+ [n]
1002
+ ), x = Ie(c, { enabled: c.length > 0 }), R = L(() => {
1003
+ const b = [];
1004
+ for (const N of n ?? []) {
1005
+ const S = ft(N.timestamp), w = b[b.length - 1];
1006
+ w && w.day === S ? w.revisions.push(N) : b.push({ day: S, revisions: [N] });
990
1007
  }
991
- return u;
1008
+ return b;
992
1009
  }, [n]);
993
- return s ? /* @__PURE__ */ t("div", { className: "space-y-2 pt-3", children: [1, 2, 3, 4].map((u) => /* @__PURE__ */ t(Pe, { className: "h-11 rounded-md" }, u)) }) : h === 0 ? /* @__PURE__ */ l("div", { className: "flex flex-col items-center py-16 text-center", children: [
994
- /* @__PURE__ */ t(Q, { className: "mb-2 h-8 w-8 text-slate-300 dark:text-slate-600" }),
1010
+ return r ? /* @__PURE__ */ t("div", { className: "space-y-2 pt-3", children: [1, 2, 3, 4].map((b) => /* @__PURE__ */ t(Je, { className: "h-11 rounded-md" }, b)) }) : u === 0 ? /* @__PURE__ */ l("div", { className: "flex flex-col items-center py-16 text-center", children: [
1011
+ /* @__PURE__ */ t(Y, { className: "mb-2 h-8 w-8 text-slate-300 dark:text-slate-600" }),
995
1012
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-600 dark:text-slate-300", children: "No history yet" }),
996
1013
  /* @__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." })
997
- ] }) : /* @__PURE__ */ l("div", { className: "space-y-3 pt-3", children: [
998
- /* @__PURE__ */ t(lt, { data: y, meta: o }),
999
- y.length >= 3 && /* @__PURE__ */ t(mt, { revisions: y, meta: o }),
1000
- /* @__PURE__ */ t("div", { children: c.map((u) => /* @__PURE__ */ l("div", { children: [
1001
- /* @__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: u.day }) }),
1002
- u.revisions.map((b) => {
1003
- const v = (n ?? []).indexOf(b), w = v === ((n == null ? void 0 : n.length) ?? 1) - 1;
1004
- if (Ke(b))
1014
+ ] }) : /* @__PURE__ */ t(te.Provider, { value: x, children: /* @__PURE__ */ l("div", { className: "space-y-3 pt-3", children: [
1015
+ /* @__PURE__ */ t(xt, { data: g, meta: d }),
1016
+ g.length >= 3 && /* @__PURE__ */ t(Nt, { revisions: g, meta: d }),
1017
+ /* @__PURE__ */ t("div", { children: R.map((b) => /* @__PURE__ */ l("div", { children: [
1018
+ /* @__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: b.day }) }),
1019
+ b.revisions.map((N) => {
1020
+ const S = (n ?? []).indexOf(N), w = S === ((n == null ? void 0 : n.length) ?? 1) - 1;
1021
+ if (Ye(N))
1005
1022
  return /* @__PURE__ */ l(
1006
1023
  "div",
1007
1024
  {
1008
- className: _(
1025
+ className: T(
1009
1026
  "nvr-fade-in relative",
1010
- p.has($(b)) && "rounded-md bg-nvr-cyan/[0.06]"
1027
+ p.has(O(N)) && "rounded-md bg-nvr-cyan/[0.06]"
1011
1028
  ),
1012
1029
  children: [
1013
- p.has($(b)) && /* @__PURE__ */ t(ie, {}),
1014
- /* @__PURE__ */ t(st, { revision: b, isLast: w })
1030
+ p.has(O(N)) && /* @__PURE__ */ t(oe, {}),
1031
+ /* @__PURE__ */ t(ut, { revision: N, isLast: w })
1015
1032
  ]
1016
1033
  },
1017
- $(b)
1034
+ O(N)
1018
1035
  );
1019
- const S = (n ?? []).slice(v + 1).find(Y);
1036
+ const C = (n ?? []).slice(S + 1).find(G);
1020
1037
  return /* @__PURE__ */ l(
1021
1038
  "div",
1022
1039
  {
1023
- className: _(
1040
+ className: T(
1024
1041
  "nvr-fade-in relative",
1025
- p.has($(b)) && "rounded-md bg-nvr-cyan/[0.06]"
1042
+ p.has(O(N)) && "rounded-md bg-nvr-cyan/[0.06]"
1026
1043
  ),
1027
1044
  children: [
1028
- p.has($(b)) && /* @__PURE__ */ t(ie, {}),
1045
+ p.has(O(N)) && /* @__PURE__ */ t(oe, {}),
1029
1046
  /* @__PURE__ */ t(
1030
- nt,
1047
+ ht,
1031
1048
  {
1032
- revision: b,
1033
- previousData: (S == null ? void 0 : S.data) ?? null,
1034
- meta: o,
1035
- onRollback: a,
1036
- inlineTableFields: i,
1049
+ revision: N,
1050
+ previousData: (C == null ? void 0 : C.data) ?? null,
1051
+ meta: d,
1052
+ onRollback: i,
1053
+ inlineTableFields: a,
1037
1054
  isLast: w
1038
1055
  }
1039
1056
  )
1040
1057
  ]
1041
1058
  },
1042
- $(b)
1059
+ O(N)
1043
1060
  );
1044
1061
  })
1045
- ] }, u.day)) })
1046
- ] });
1062
+ ] }, b.day)) })
1063
+ ] }) });
1047
1064
  }
1048
- function ie() {
1065
+ function oe() {
1049
1066
  return (
1050
1067
  // Under the timeline dot, inside the row's 36px gutter.
1051
1068
  /* @__PURE__ */ t(
@@ -1058,69 +1075,69 @@ function ie() {
1058
1075
  )
1059
1076
  );
1060
1077
  }
1061
- function jt({
1078
+ function It({
1062
1079
  collection: e,
1063
- item: r,
1064
- onRollback: a,
1065
- triggerClassName: i,
1066
- inlineTableFields: d,
1067
- open: o,
1080
+ item: s,
1081
+ onRollback: i,
1082
+ triggerClassName: a,
1083
+ inlineTableFields: o,
1084
+ open: d,
1068
1085
  onOpenChange: n,
1069
- compact: s
1086
+ compact: r
1070
1087
  }) {
1071
- return /* @__PURE__ */ l(qe, { open: o, onOpenChange: n, children: [
1072
- !(o !== void 0) && /* @__PURE__ */ t(De, { asChild: !0, children: /* @__PURE__ */ l(
1088
+ return /* @__PURE__ */ l(Ue, { open: d, onOpenChange: n, children: [
1089
+ !(d !== void 0) && /* @__PURE__ */ t(We, { asChild: !0, children: /* @__PURE__ */ l(
1073
1090
  M,
1074
1091
  {
1075
- variant: s ? "ghost" : "outline",
1092
+ variant: r ? "ghost" : "outline",
1076
1093
  size: "sm",
1077
- title: s ? "History — revisions of this record" : void 0,
1094
+ title: r ? "History — revisions of this record" : void 0,
1078
1095
  "aria-label": "History",
1079
- className: i ?? (s ? "h-8 w-8 rounded-none p-0" : "gap-1.5"),
1096
+ className: a ?? (r ? "h-8 w-8 rounded-none p-0" : "gap-1.5"),
1080
1097
  children: [
1081
- /* @__PURE__ */ t(Q, { className: s ? "h-4 w-4" : "h-3.5 w-3.5" }),
1082
- !s && "History"
1098
+ /* @__PURE__ */ t(Y, { className: r ? "h-4 w-4" : "h-3.5 w-3.5" }),
1099
+ !r && "History"
1083
1100
  ]
1084
1101
  }
1085
1102
  ) }),
1086
- /* @__PURE__ */ t(Fe, { className: "w-[720px] overflow-y-auto p-0 sm:max-w-[92vw]", children: /* @__PURE__ */ l("div", { className: "p-6", children: [
1087
- /* @__PURE__ */ l(Ee, { children: [
1088
- /* @__PURE__ */ l(Be, { className: "flex items-center gap-2 text-base", children: [
1089
- /* @__PURE__ */ t(Q, { className: "h-4 w-4 text-slate-400" }),
1103
+ /* @__PURE__ */ t(Ve, { className: "w-[720px] overflow-y-auto p-0 sm:max-w-[92vw]", children: /* @__PURE__ */ l("div", { className: "p-6", children: [
1104
+ /* @__PURE__ */ l(ze, { children: [
1105
+ /* @__PURE__ */ l(He, { className: "flex items-center gap-2 text-base", children: [
1106
+ /* @__PURE__ */ t(Y, { className: "h-4 w-4 text-slate-400" }),
1090
1107
  "Revision history"
1091
1108
  ] }),
1092
1109
  /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "Who changed what, when — expand any entry to see the exact values, revert a single field, or restore the whole version." })
1093
1110
  ] }),
1094
- /* @__PURE__ */ t(ot, { collection: e, item: r }),
1095
- /* @__PURE__ */ t(Ie, { collection: e, item: String(r) }),
1111
+ /* @__PURE__ */ t(gt, { collection: e, item: s }),
1112
+ /* @__PURE__ */ t(Qe, { collection: e, item: String(s) }),
1096
1113
  /* @__PURE__ */ t(
1097
- dt,
1114
+ bt,
1098
1115
  {
1099
1116
  collection: e,
1100
- item: r,
1101
- onRollback: a,
1102
- inlineTableFields: d
1117
+ item: s,
1118
+ onRollback: i,
1119
+ inlineTableFields: o
1103
1120
  }
1104
1121
  )
1105
1122
  ] }) })
1106
1123
  ] });
1107
1124
  }
1108
- function ot({ collection: e, item: r }) {
1109
- const a = D(), i = me(e, !0), [d, o] = k(""), [n, s] = k(""), { data: m, isFetching: x } = B({
1110
- queryKey: ["rev-value-search", e, r, n],
1111
- queryFn: () => a.request(q("/revisions/value-search", { collection: e, item: r, q: n })).then((p) => p.data),
1125
+ function gt({ collection: e, item: s }) {
1126
+ const i = F(), a = ue(e, !0), [o, d] = v(""), [n, r] = v(""), { data: m, isFetching: h } = B({
1127
+ queryKey: ["rev-value-search", e, s, n],
1128
+ queryFn: () => i.request(D("/revisions/value-search", { collection: e, item: s, q: n })).then((p) => p.data),
1112
1129
  enabled: n.length >= 2
1113
1130
  });
1114
1131
  return /* @__PURE__ */ l("div", { className: "mt-3", children: [
1115
1132
  /* @__PURE__ */ l("div", { className: "relative", children: [
1116
- /* @__PURE__ */ t(Ne, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
1133
+ /* @__PURE__ */ t(Se, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
1117
1134
  /* @__PURE__ */ t(
1118
1135
  "input",
1119
1136
  {
1120
- value: d,
1121
- onChange: (p) => o(p.target.value),
1137
+ value: o,
1138
+ onChange: (p) => d(p.target.value),
1122
1139
  onKeyDown: (p) => {
1123
- p.key === "Enter" && s(d.trim());
1140
+ p.key === "Enter" && r(o.trim());
1124
1141
  },
1125
1142
  placeholder: "Search this record’s history for a value — who wrote it, and when",
1126
1143
  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"
@@ -1131,28 +1148,28 @@ function ot({ collection: e, item: r }) {
1131
1148
  {
1132
1149
  type: "button",
1133
1150
  onClick: () => {
1134
- o(""), s("");
1151
+ d(""), r("");
1135
1152
  },
1136
1153
  className: "absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",
1137
1154
  "aria-label": "Clear search",
1138
- children: /* @__PURE__ */ t(ke, { className: "h-3.5 w-3.5" })
1155
+ children: /* @__PURE__ */ t(Ce, { className: "h-3.5 w-3.5" })
1139
1156
  }
1140
1157
  )
1141
1158
  ] }),
1142
- n && /* @__PURE__ */ t("div", { className: "mt-2 space-y-1.5 rounded-lg border border-slate-200 p-2.5 dark:border-border", children: x ? /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-400", children: "Searching…" }) : ((m == null ? void 0 : m.matches) ?? []).length === 0 ? /* @__PURE__ */ l("p", { className: "text-[11.5px] text-slate-400", children: [
1159
+ n && /* @__PURE__ */ t("div", { className: "mt-2 space-y-1.5 rounded-lg border border-slate-200 p-2.5 dark:border-border", children: h ? /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-400", children: "Searching…" }) : ((m == null ? void 0 : m.matches) ?? []).length === 0 ? /* @__PURE__ */ l("p", { className: "text-[11.5px] text-slate-400", children: [
1143
1160
  "“",
1144
1161
  n,
1145
1162
  "” never appears in this record’s recorded changes."
1146
- ] }) : /* @__PURE__ */ l(T, { children: [
1163
+ ] }) : /* @__PURE__ */ l(j, { children: [
1147
1164
  m == null ? void 0 : m.matches.map((p) => /* @__PURE__ */ l("div", { className: "text-[11.5px]", children: [
1148
- /* @__PURE__ */ t("p", { className: "text-slate-600 dark:text-slate-300", children: p.fields.map((h) => /* @__PURE__ */ l("span", { children: [
1149
- /* @__PURE__ */ t("span", { className: "font-medium", title: h.field, children: g(i, h.field).label }),
1165
+ /* @__PURE__ */ t("p", { className: "text-slate-600 dark:text-slate-300", children: p.fields.map((u) => /* @__PURE__ */ l("span", { children: [
1166
+ /* @__PURE__ */ t("span", { className: "font-medium", title: u.field, children: y(a, u.field).label }),
1150
1167
  " ",
1151
1168
  "→ “",
1152
- h.value.length > 60 ? `${h.value.slice(0, 60)}…` : h.value,
1169
+ u.value.length > 60 ? `${u.value.slice(0, 60)}…` : u.value,
1153
1170
  "”",
1154
1171
  " "
1155
- ] }, h.field)) }),
1172
+ ] }, u.field)) }),
1156
1173
  /* @__PURE__ */ l("p", { className: "text-[10.5px] text-slate-400", children: [
1157
1174
  p.user_name ?? "System",
1158
1175
  " ·",
@@ -1166,49 +1183,49 @@ function ot({ collection: e, item: r }) {
1166
1183
  ] }) })
1167
1184
  ] });
1168
1185
  }
1169
- function ct({ revisionId: e }) {
1170
- const r = D(), a = Z(), [i, d] = k(""), { data: o = [] } = B({
1186
+ function yt({ revisionId: e }) {
1187
+ const s = F(), i = ee(), [a, o] = v(""), { data: d = [] } = B({
1171
1188
  queryKey: ["revision-notes", String(e)],
1172
- queryFn: () => r.request(q("/comments", { collection: "nivaro_revisions", item: String(e) })).then((s) => s.data ?? []).catch(() => []),
1189
+ queryFn: () => s.request(D("/comments", { collection: "nivaro_revisions", item: String(e) })).then((r) => r.data ?? []).catch(() => []),
1173
1190
  staleTime: 3e4
1174
- }), n = J({
1175
- mutationFn: () => r.request(
1176
- K("/comments", { collection: "nivaro_revisions", item: String(e), text: i })
1191
+ }), n = Q({
1192
+ mutationFn: () => s.request(
1193
+ K("/comments", { collection: "nivaro_revisions", item: String(e), text: a })
1177
1194
  ),
1178
1195
  onSuccess: () => {
1179
- d(""), a.invalidateQueries({ queryKey: ["revision-notes", String(e)] });
1196
+ o(""), i.invalidateQueries({ queryKey: ["revision-notes", String(e)] });
1180
1197
  },
1181
- onError: () => R.error("Note failed")
1198
+ onError: () => A.error("Note failed")
1182
1199
  });
1183
1200
  return /* @__PURE__ */ l("div", { className: "rounded-md border border-slate-100 bg-slate-50/60 p-2 dark:border-border/60 dark:bg-muted/30", children: [
1184
- o.map((s) => /* @__PURE__ */ l("p", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children: [
1185
- s.text,
1201
+ d.map((r) => /* @__PURE__ */ l("p", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children: [
1202
+ r.text,
1186
1203
  " ",
1187
1204
  /* @__PURE__ */ l("span", { className: "text-[10px] text-slate-400", children: [
1188
1205
  "— ",
1189
- s.user_name ?? "someone",
1206
+ r.user_name ?? "someone",
1190
1207
  " · ",
1191
- new Date(s.created_at).toLocaleDateString()
1208
+ new Date(r.created_at).toLocaleDateString()
1192
1209
  ] })
1193
- ] }, s.id)),
1210
+ ] }, r.id)),
1194
1211
  /* @__PURE__ */ l(
1195
1212
  "form",
1196
1213
  {
1197
- onSubmit: (s) => {
1198
- s.preventDefault(), i.trim() && n.mutate();
1214
+ onSubmit: (r) => {
1215
+ r.preventDefault(), a.trim() && n.mutate();
1199
1216
  },
1200
1217
  className: "mt-1 flex gap-1.5",
1201
1218
  children: [
1202
1219
  /* @__PURE__ */ t(
1203
1220
  "input",
1204
1221
  {
1205
- value: i,
1206
- onChange: (s) => d(s.target.value),
1222
+ value: a,
1223
+ onChange: (r) => o(r.target.value),
1207
1224
  placeholder: "Annotate this revision…",
1208
1225
  className: "h-6 flex-1 rounded border border-slate-200 bg-transparent px-1.5 text-[11.5px] outline-none dark:border-border"
1209
1226
  }
1210
1227
  ),
1211
- i.trim() && /* @__PURE__ */ t(
1228
+ a.trim() && /* @__PURE__ */ t(
1212
1229
  "button",
1213
1230
  {
1214
1231
  type: "submit",
@@ -1222,21 +1239,21 @@ function ct({ revisionId: e }) {
1222
1239
  )
1223
1240
  ] });
1224
1241
  }
1225
- function mt({
1242
+ function Nt({
1226
1243
  revisions: e,
1227
- meta: r
1244
+ meta: s
1228
1245
  }) {
1229
- const a = [...e].reverse(), [i, d] = k(!1), [o, n] = k(0);
1230
- je(() => {
1231
- if (!i) return;
1232
- if (o >= a.length - 1) {
1233
- d(!1);
1246
+ const i = [...e].reverse(), [a, o] = v(!1), [d, n] = v(0);
1247
+ qe(() => {
1248
+ if (!a) return;
1249
+ if (d >= i.length - 1) {
1250
+ o(!1);
1234
1251
  return;
1235
1252
  }
1236
- const x = setTimeout(() => n((p) => p + 1), 1600);
1237
- return () => clearTimeout(x);
1238
- }, [i, o, a.length]);
1239
- const s = a[o], m = s != null && s.delta ? Object.keys(s.delta).slice(0, 5).map((x) => g(r, x).label) : [];
1253
+ const h = setTimeout(() => n((p) => p + 1), 1600);
1254
+ return () => clearTimeout(h);
1255
+ }, [a, d, i.length]);
1256
+ const r = i[d], m = r != null && r.delta ? Object.keys(r.delta).slice(0, 5).map((h) => y(s, h).label) : [];
1240
1257
  return /* @__PURE__ */ l("div", { className: "rounded-md border border-slate-200 bg-slate-50/70 p-2 dark:border-border dark:bg-muted/30", children: [
1241
1258
  /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
1242
1259
  /* @__PURE__ */ t(
@@ -1244,10 +1261,10 @@ function mt({
1244
1261
  {
1245
1262
  type: "button",
1246
1263
  onClick: () => {
1247
- !i && o >= a.length - 1 && n(0), d((x) => !x);
1264
+ !a && d >= i.length - 1 && n(0), o((h) => !h);
1248
1265
  },
1249
1266
  className: "rounded-md bg-nvr-cyan px-2.5 py-1 text-[11.5px] font-semibold text-white",
1250
- children: i ? "Pause" : "▶ Time-lapse"
1267
+ children: a ? "Pause" : "▶ Time-lapse"
1251
1268
  }
1252
1269
  ),
1253
1270
  /* @__PURE__ */ t(
@@ -1255,25 +1272,25 @@ function mt({
1255
1272
  {
1256
1273
  type: "range",
1257
1274
  min: 0,
1258
- max: Math.max(0, a.length - 1),
1259
- value: o,
1260
- onChange: (x) => {
1261
- d(!1), n(Number(x.target.value));
1275
+ max: Math.max(0, i.length - 1),
1276
+ value: d,
1277
+ onChange: (h) => {
1278
+ o(!1), n(Number(h.target.value));
1262
1279
  },
1263
1280
  className: "flex-1 accent-nvr-cyan",
1264
1281
  "aria-label": "History position"
1265
1282
  }
1266
1283
  ),
1267
1284
  /* @__PURE__ */ l("span", { className: "shrink-0 tabular-nums text-[11px] text-slate-400", children: [
1268
- o + 1,
1285
+ d + 1,
1269
1286
  "/",
1270
- a.length
1287
+ i.length
1271
1288
  ] })
1272
1289
  ] }),
1273
- s && /* @__PURE__ */ l("p", { className: "mt-1 text-[11.5px] text-slate-600 dark:text-slate-300", children: [
1274
- /* @__PURE__ */ t("span", { className: "font-medium capitalize", children: s.action ?? "change" }),
1275
- s.timestamp ? ` · ${new Date(s.timestamp).toLocaleString()}` : "",
1276
- s.user_name ? ` · ${s.user_name}` : "",
1290
+ r && /* @__PURE__ */ l("p", { className: "mt-1 text-[11.5px] text-slate-600 dark:text-slate-300", children: [
1291
+ /* @__PURE__ */ t("span", { className: "font-medium capitalize", children: r.action ?? "change" }),
1292
+ r.timestamp ? ` · ${new Date(r.timestamp).toLocaleString()}` : "",
1293
+ r.user_name ? ` · ${r.user_name}` : "",
1277
1294
  m.length > 0 && /* @__PURE__ */ l("span", { className: "ml-1 text-[10.5px] text-slate-400", children: [
1278
1295
  "changed: ",
1279
1296
  m.join(", ")
@@ -1282,6 +1299,6 @@ function mt({
1282
1299
  ] });
1283
1300
  }
1284
1301
  export {
1285
- jt as RevisionsPanel,
1286
- We as displayValue
1302
+ It as RevisionsPanel,
1303
+ et as displayValue
1287
1304
  };