@nivaro/react 0.3.8 → 0.3.10

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 (60) hide show
  1. package/dist/components/fields/FileField.js +20 -19
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/replayUploadQueue.js +107 -93
  4. package/dist/hooks/useNivaroForm.js +129 -126
  5. package/dist/hooks/useSessionRecorder.js +103 -101
  6. package/dist/index.d.ts +115 -2
  7. package/dist/index.js +466 -447
  8. package/dist/shared/components/CollectionBrowserView.js +1058 -1059
  9. package/dist/shared/components/ConformanceView.js +36 -35
  10. package/dist/shared/components/DataTable.js +230 -223
  11. package/dist/shared/components/ForceReloadBanner.js +58 -34
  12. package/dist/shared/components/ItemEditForm.js +3687 -3580
  13. package/dist/shared/components/JsonMapEditor.js +18 -17
  14. package/dist/shared/components/MatrixEditor.js +8 -7
  15. package/dist/shared/components/MyWorkView.js +32 -31
  16. package/dist/shared/components/PageRenderer.js +146 -145
  17. package/dist/shared/components/QueryTable.js +49 -49
  18. package/dist/shared/components/RecordGridEditor.js +76 -75
  19. package/dist/shared/components/ai/AiMemorySuggestions.js +15 -14
  20. package/dist/shared/components/ai/AskPanel.js +55 -54
  21. package/dist/shared/components/bulk/BulkActionButtons.js +30 -29
  22. package/dist/shared/components/bulk/PushBulkButtons.js +57 -56
  23. package/dist/shared/components/chat/ChatPanel.js +288 -287
  24. package/dist/shared/components/chat/SlashCommands.js +30 -29
  25. package/dist/shared/components/chat/chat-outbox.js +76 -75
  26. package/dist/shared/components/help-videos/recorder/useLeaveWarning.js +6 -5
  27. package/dist/shared/components/integrations/console/SignalCard.js +124 -123
  28. package/dist/shared/components/integrations/console/SnoozeMenu.js +24 -23
  29. package/dist/shared/components/item-edit/CloneDialog.js +85 -78
  30. package/dist/shared/components/item-edit/InlineTableField.js +301 -300
  31. package/dist/shared/components/item-edit/MembershipSetField.js +24 -23
  32. package/dist/shared/components/item-edit/QuickCreateButton.js +8 -7
  33. package/dist/shared/components/item-edit/RecordLiveSync.js +101 -100
  34. package/dist/shared/components/item-edit/staged-links.js +86 -0
  35. package/dist/shared/components/layout-editor/LayoutEditor.js +275 -274
  36. package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +18 -17
  37. package/dist/shared/components/layout-editor/inspector/HelpTab.js +37 -36
  38. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +50 -49
  39. package/dist/shared/components/panels/CommentPanel.js +237 -236
  40. package/dist/shared/components/profile/AiMemoryCard.js +15 -14
  41. package/dist/shared/components/profile/PersonAdminTools.js +70 -67
  42. package/dist/shared/components/profile/usePersonPresence.js +42 -37
  43. package/dist/shared/components/queue/QueueItemSheet.js +36 -35
  44. package/dist/shared/components/queue/QueueWorklist.js +597 -598
  45. package/dist/shared/lib/client-version.js +63 -0
  46. package/dist/shared/lib/force-reload.js +36 -0
  47. package/dist/shared/lib/load-error.js +11 -10
  48. package/dist/shared/lib/presence-live.js +73 -0
  49. package/dist/shared/lib/presence-state.js +39 -31
  50. package/dist/shared/lib/record-outbox.js +76 -75
  51. package/dist/shared/lib/request-gate.js +120 -102
  52. package/dist/shared/lib/rum.js +45 -36
  53. package/dist/shared/lib/safe-error.js +39 -0
  54. package/dist/shared/lib/server-clock.js +11 -7
  55. package/dist/shared/lib/signed-out.js +114 -0
  56. package/dist/shared/lib/socket-realtime.js +19 -17
  57. package/dist/shared/lib/unsaved-work.js +62 -0
  58. package/dist/shared/lib/use-online-users.js +11 -10
  59. package/dist/shared/lib/worker-socket.js +89 -79
  60. package/package.json +1 -1
@@ -1,29 +1,30 @@
1
1
  import { jsxs as s, jsx as e, Fragment as ce } from "react/jsx-runtime";
2
2
  import { useQueryClient as xe, useQuery as B, useMutation as A } from "@tanstack/react-query";
3
3
  import { MessageSquare as _e, ChevronDown as Ce, ClipboardPlus as Se, Pencil as $e, Trash2 as qe, Check as Ee, X as Re, SmilePlus as he } from "lucide-react";
4
- import { useState as w, useRef as J, useEffect as G, useMemo as Y } from "react";
4
+ import { useState as C, useRef as J, useEffect as G, useMemo as Y } from "react";
5
5
  import { createPortal as Te } from "react-dom";
6
- import { toast as M } from "sonner";
7
- import { useNivaroClient as ae, useItemEditAuth as De, useDrilldown as Fe } from "../../context.js";
8
- import { useDebounced as Pe } from "../../hooks/useDebounced.js";
6
+ import { toast as D } from "sonner";
7
+ import { useNivaroClient as ne, useItemEditAuth as De, useDrilldown as Pe } from "../../context.js";
8
+ import { useDebounced as Fe } from "../../hooks/useDebounced.js";
9
9
  import { get as U, post as z, patch as Me, del as je } from "../../lib/commands.js";
10
- import { useRecordSignalPeers as Ie, useRecordSignalSender as Oe, signalSentence as Le } from "../../lib/presence-signals.js";
11
- import { invalidateRecordTasks as Ae } from "../../lib/record-tasks.js";
12
- import { formatRelative as ne } from "../../lib/utils.js";
10
+ import { usePresenceOnlinePoll as Ie } from "../../lib/presence-live.js";
11
+ import { useRecordSignalPeers as Oe, useRecordSignalSender as Le, signalSentence as Ae } from "../../lib/presence-signals.js";
12
+ import { invalidateRecordTasks as Ke } from "../../lib/record-tasks.js";
13
+ import { formatRelative as ae } from "../../lib/utils.js";
13
14
  import { AutolinkedText as re } from "../AutolinkedText.js";
14
- import { InboundRequestPopover as Ke } from "../integrations/InboundRequest.js";
15
- import { UserAvatar as Qe } from "../UserAvatar.js";
16
- import { Avatar as ze, AvatarFallback as Be } from "../ui/avatar.js";
15
+ import { InboundRequestPopover as Qe } from "../integrations/InboundRequest.js";
16
+ import { UserAvatar as ze } from "../UserAvatar.js";
17
+ import { Avatar as Be, AvatarFallback as Ue } from "../ui/avatar.js";
17
18
  import { Button as X } from "../ui/button.js";
18
19
  import { Separator as me } from "../ui/separator.js";
19
- import { Textarea as Ue } from "../ui/textarea.js";
20
- import { RecordEventPathSheet as We } from "./IntegrationActivitySection.js";
20
+ import { Textarea as We } from "../ui/textarea.js";
21
+ import { RecordEventPathSheet as He } from "./IntegrationActivitySection.js";
21
22
  const be = ["👍", "✅", "👀", "🎉", "❤️", "😂"];
22
- function He(t) {
23
- var d, c, b, u;
24
- return [(d = t.first_name) == null ? void 0 : d[0], (c = t.last_name) == null ? void 0 : c[0]].filter(Boolean).join("").toUpperCase() || ((u = (b = t.email) == null ? void 0 : b[0]) == null ? void 0 : u.toUpperCase()) || "?";
23
+ function Xe(t) {
24
+ var d, c, b, m;
25
+ return [(d = t.first_name) == null ? void 0 : d[0], (c = t.last_name) == null ? void 0 : c[0]].filter(Boolean).join("").toUpperCase() || ((m = (b = t.email) == null ? void 0 : b[0]) == null ? void 0 : m.toUpperCase()) || "?";
25
26
  }
26
- function Xe({ comment: t }) {
27
+ function Ge({ comment: t }) {
27
28
  const i = (t.mentions ?? []).filter(
28
29
  (d) => {
29
30
  var c;
@@ -46,7 +47,7 @@ function Xe({ comment: t }) {
46
47
  children: [
47
48
  d.seen_at ? "✓ " : "",
48
49
  c,
49
- d.seen_at ? ` saw this ${ne(d.seen_at)}` : " has not seen this yet"
50
+ d.seen_at ? ` saw this ${ae(d.seen_at)}` : " has not seen this yet"
50
51
  ]
51
52
  },
52
53
  d.id
@@ -58,11 +59,11 @@ function Xe({ comment: t }) {
58
59
  function ee(t) {
59
60
  return [t.first_name, t.last_name].filter(Boolean).join(" ") || t.email;
60
61
  }
61
- function Ge(t, i) {
62
+ function Je(t, i) {
62
63
  const c = t.slice(0, i).match(/(^|\s)@([a-zA-Z0-9._-]{2,})$/);
63
64
  return c ? { start: i - c[2].length - 1, query: c[2] } : null;
64
65
  }
65
- function ue(t) {
66
+ function pe(t) {
66
67
  return t.email.split("@")[0];
67
68
  }
68
69
  function te({
@@ -70,103 +71,103 @@ function te({
70
71
  onChange: i,
71
72
  ...d
72
73
  }) {
73
- const c = ae(), b = J(null), [u, h] = w(null), [E, f] = w(0), y = Pe((u == null ? void 0 : u.query) ?? "", 200), { data: I = [] } = B({
74
- queryKey: ["users", "mention-search", y],
74
+ const c = ne(), b = J(null), [m, h] = C(null), [E, f] = C(0), N = Fe((m == null ? void 0 : m.query) ?? "", 200), { data: M = [] } = B({
75
+ queryKey: ["users", "mention-search", N],
75
76
  queryFn: () => c.request(
76
- U("/users", { limit: 8, sort: "first_name", search: y })
77
+ U("/users", { limit: 8, sort: "first_name", search: N })
77
78
  ).then((r) => r.data),
78
- enabled: !!u && y.length >= 2,
79
+ enabled: !!m && N.length >= 2,
79
80
  staleTime: 3e4
80
- }), { data: T } = B({
81
+ }), j = Ie(15e3, !!m), { data: u } = B({
81
82
  queryKey: ["presence-online"],
82
83
  queryFn: () => c.request(
83
84
  U("/presence/online")
84
85
  ),
85
- enabled: !!u,
86
- refetchInterval: 15e3,
86
+ enabled: !!m,
87
+ refetchInterval: j,
87
88
  staleTime: 5e3
88
- }), m = (r) => {
89
+ }), g = (r) => {
89
90
  var x;
90
- const l = (x = T == null ? void 0 : T.data) == null ? void 0 : x.find((k) => String(k.user_id).toUpperCase() === r.toUpperCase());
91
+ const l = (x = u == null ? void 0 : u.data) == null ? void 0 : x.find((k) => String(k.user_id).toUpperCase() === r.toUpperCase());
91
92
  return l ? l.is_idle || l.away ? 1 : 0 : 2;
92
- }, g = [...I].sort((r, l) => m(r.id) - m(l.id)), { data: D = [] } = B({
93
+ }, w = [...M].sort((r, l) => g(r.id) - g(l.id)), { data: I = [] } = B({
93
94
  queryKey: ["mention-roles"],
94
95
  queryFn: () => c.request(U("/chat/roles")).then((r) => r.data).catch(() => []),
95
- enabled: !!u,
96
+ enabled: !!m,
96
97
  staleTime: 5 * 6e4
97
- }), R = u ? D.filter(
98
- (r) => r.name.toLowerCase().replace(/\s+/g, "-").startsWith(y.toLowerCase())
99
- ).slice(0, 3) : [], C = !!u && y.length >= 2 && "owners".startsWith(y.toLowerCase()), S = !!u && y.length >= 2 && (g.length > 0 || C || R.length > 0), _ = g.length + (C ? 1 : 0) + R.length, [o, v] = w(null), F = J(null);
98
+ }), P = m ? I.filter(
99
+ (r) => r.name.toLowerCase().replace(/\s+/g, "-").startsWith(N.toLowerCase())
100
+ ).slice(0, 3) : [], _ = !!m && N.length >= 2 && "owners".startsWith(N.toLowerCase()), S = !!m && N.length >= 2 && (w.length > 0 || _ || P.length > 0), o = w.length + (_ ? 1 : 0) + P.length, [y, R] = C(null), K = J(null);
100
101
  G(() => {
101
102
  if (!S || !b.current) {
102
- v(null);
103
+ R(null);
103
104
  return;
104
105
  }
105
106
  const r = b.current.getBoundingClientRect();
106
- v({ top: r.bottom + 4, left: r.left, width: Math.min(r.width, 360) });
107
+ R({ top: r.bottom + 4, left: r.left, width: Math.min(r.width, 360) });
107
108
  const l = (k) => {
108
- var N;
109
- (N = F.current) != null && N.contains(k.target) || h(null);
109
+ var q;
110
+ (q = K.current) != null && q.contains(k.target) || h(null);
110
111
  }, x = () => h(null);
111
112
  return window.addEventListener("scroll", l, !0), window.addEventListener("resize", x), () => {
112
113
  window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", x);
113
114
  };
114
115
  }, [S]);
115
- function K(r) {
116
- const l = Ge(r.value, r.selectionStart ?? r.value.length);
116
+ function O(r) {
117
+ const l = Je(r.value, r.selectionStart ?? r.value.length);
117
118
  h(l), l || f(0);
118
119
  }
119
120
  function $(r) {
120
- if (!u || !b.current) return;
121
- const l = b.current.selectionStart ?? t.length, x = r === "__owners__" ? "@owners " : typeof r == "object" && "role" in r ? `@${r.role.toLowerCase().replace(/\s+/g, "-")} ` : `@${ue(r)} `, k = t.slice(0, u.start) + x + t.slice(l);
121
+ if (!m || !b.current) return;
122
+ const l = b.current.selectionStart ?? t.length, x = r === "__owners__" ? "@owners " : typeof r == "object" && "role" in r ? `@${r.role.toLowerCase().replace(/\s+/g, "-")} ` : `@${pe(r)} `, k = t.slice(0, m.start) + x + t.slice(l);
122
123
  i(k), h(null), f(0);
123
- const N = u.start + x.length;
124
+ const q = m.start + x.length;
124
125
  requestAnimationFrame(() => {
125
- var O, L;
126
- (O = b.current) == null || O.focus(), (L = b.current) == null || L.setSelectionRange(N, N);
126
+ var F, v;
127
+ (F = b.current) == null || F.focus(), (v = b.current) == null || v.setSelectionRange(q, q);
127
128
  });
128
129
  }
129
- function j(r) {
130
+ function L(r) {
130
131
  if (S)
131
132
  if (r.key === "ArrowDown")
132
- r.preventDefault(), f((l) => (l + 1) % _);
133
+ r.preventDefault(), f((l) => (l + 1) % o);
133
134
  else if (r.key === "ArrowUp")
134
- r.preventDefault(), f((l) => (l - 1 + _) % _);
135
+ r.preventDefault(), f((l) => (l - 1 + o) % o);
135
136
  else if (r.key === "Enter" || r.key === "Tab") {
136
137
  r.preventDefault();
137
- const l = Math.min(E, _ - 1), x = C ? 1 : 0, k = x + g.length;
138
- if (C && l === 0) $("__owners__");
138
+ const l = Math.min(E, o - 1), x = _ ? 1 : 0, k = x + w.length;
139
+ if (_ && l === 0) $("__owners__");
139
140
  else if (l >= k) {
140
- const N = R[l - k];
141
- N && $({ role: N.name });
142
- } else $(g[l - x]);
141
+ const q = P[l - k];
142
+ q && $({ role: q.name });
143
+ } else $(w[l - x]);
143
144
  } else r.key === "Escape" && (r.preventDefault(), h(null));
144
145
  }
145
146
  return /* @__PURE__ */ s("div", { className: "relative", children: [
146
147
  /* @__PURE__ */ e(
147
- Ue,
148
+ We,
148
149
  {
149
150
  ...d,
150
151
  ref: b,
151
152
  value: t,
152
153
  onChange: (r) => {
153
- i(r.target.value), K(r.target);
154
+ i(r.target.value), O(r.target);
154
155
  },
155
- onKeyDown: j,
156
- onClick: (r) => K(r.currentTarget),
156
+ onKeyDown: L,
157
+ onClick: (r) => O(r.currentTarget),
157
158
  onBlur: () => setTimeout(() => h(null), 150)
158
159
  }
159
160
  ),
160
- S && o && Te(
161
+ S && y && Te(
161
162
  /* @__PURE__ */ s(
162
163
  "div",
163
164
  {
164
- ref: F,
165
+ ref: K,
165
166
  className: "fixed z-[110] max-h-60 overflow-y-auto rounded-md border border-slate-200 bg-white shadow-lg dark:border-border dark:bg-popover",
166
- style: { top: o.top, left: o.left, width: o.width },
167
+ style: { top: y.top, left: y.left, width: y.width },
167
168
  onMouseDown: (r) => r.preventDefault(),
168
169
  children: [
169
- C && /* @__PURE__ */ s(
170
+ _ && /* @__PURE__ */ s(
170
171
  "button",
171
172
  {
172
173
  type: "button",
@@ -184,27 +185,27 @@ function te({
184
185
  ]
185
186
  }
186
187
  ),
187
- g.map((r, l) => {
188
- var N, O;
189
- const x = C ? l + 1 : l, k = [r.first_name, r.last_name].filter(Boolean).join(" ") || r.email;
188
+ w.map((r, l) => {
189
+ var q, F;
190
+ const x = _ ? l + 1 : l, k = [r.first_name, r.last_name].filter(Boolean).join(" ") || r.email;
190
191
  return /* @__PURE__ */ s(
191
192
  "button",
192
193
  {
193
194
  type: "button",
194
- onMouseDown: (L) => {
195
- L.preventDefault(), $(r);
195
+ onMouseDown: (v) => {
196
+ v.preventDefault(), $(r);
196
197
  },
197
198
  onMouseEnter: () => f(x),
198
199
  className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${x === E ? "bg-nvr-cyan/10" : ""}`,
199
200
  children: [
200
201
  /* @__PURE__ */ s("span", { className: "relative flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/15 text-[10px] font-semibold text-nvr-navy/80 dark:text-nvr-cyan", children: [
201
- (`${((N = r.first_name) == null ? void 0 : N[0]) ?? ""}${((O = r.last_name) == null ? void 0 : O[0]) ?? ""}`.trim() || r.email[0]).toUpperCase(),
202
- m(r.id) < 2 && /* @__PURE__ */ e(
202
+ (`${((q = r.first_name) == null ? void 0 : q[0]) ?? ""}${((F = r.last_name) == null ? void 0 : F[0]) ?? ""}`.trim() || r.email[0]).toUpperCase(),
203
+ g(r.id) < 2 && /* @__PURE__ */ e(
203
204
  "span",
204
205
  {
205
- "data-mention-presence": m(r.id) === 0 ? "online" : "idle",
206
- title: m(r.id) === 0 ? "Online" : "Idle",
207
- className: `absolute -bottom-px -right-px h-2 w-2 rounded-full ring-2 ring-white dark:ring-popover ${m(r.id) === 0 ? "bg-emerald-500" : "border border-amber-500 bg-white dark:bg-popover"}`
206
+ "data-mention-presence": g(r.id) === 0 ? "online" : "idle",
207
+ title: g(r.id) === 0 ? "Online" : "Idle",
208
+ className: `absolute -bottom-px -right-px h-2 w-2 rounded-full ring-2 ring-white dark:ring-popover ${g(r.id) === 0 ? "bg-emerald-500" : "border border-amber-500 bg-white dark:bg-popover"}`
208
209
  }
209
210
  )
210
211
  ] }),
@@ -216,7 +217,7 @@ function te({
216
217
  r.ooo_end ? ` until ${String(r.ooo_end).slice(0, 10)}` : ""
217
218
  ] }),
218
219
  "@",
219
- ue(r),
220
+ pe(r),
220
221
  (r.title || r.department) && /* @__PURE__ */ s("span", { className: "text-slate-400 dark:text-slate-500", children: [
221
222
  " · ",
222
223
  [r.title, r.department].filter(Boolean).join(", ")
@@ -228,8 +229,8 @@ function te({
228
229
  r.id
229
230
  );
230
231
  }),
231
- R.map((r, l) => {
232
- const x = g.length + (C ? 1 : 0) + l;
232
+ P.map((r, l) => {
233
+ const x = w.length + (_ ? 1 : 0) + l;
233
234
  return /* @__PURE__ */ s(
234
235
  "button",
235
236
  {
@@ -257,7 +258,7 @@ function te({
257
258
  )
258
259
  ] });
259
260
  }
260
- function pe(t) {
261
+ function ue(t) {
261
262
  if (t.kind === "comment") return "people";
262
263
  switch (t.note.source) {
263
264
  case "note":
@@ -269,81 +270,81 @@ function pe(t) {
269
270
  return "system";
270
271
  }
271
272
  }
272
- const Je = {
273
+ const Ve = {
273
274
  people: "People",
274
275
  system: "System",
275
276
  integration: "Integration"
276
- }, Ve = "integrations:";
277
- function Ze({
277
+ }, Ze = "integrations:";
278
+ function Ye({
278
279
  note: t,
279
280
  collection: i,
280
281
  item: d
281
282
  }) {
282
- var _;
283
- const c = Fe(), [b, u] = w(!1), h = t.source === "external" && !!t.provider && !t.provider.startsWith(Ve), E = ae(), f = xe(), [y, I] = w(!1), T = A({
283
+ var S;
284
+ const c = Pe(), [b, m] = C(!1), h = t.source === "external" && !!t.provider && !t.provider.startsWith(Ze), E = ne(), f = xe(), [N, M] = C(!1), j = A({
284
285
  mutationFn: (o) => E.request(z(`/comments/${t.comment_id}/reactions`, { emoji: o })),
285
286
  onSuccess: () => {
286
- I(!1), f.invalidateQueries({ queryKey: ["comments-related"] }), f.invalidateQueries({ queryKey: ["row-comment-counts"] });
287
+ M(!1), f.invalidateQueries({ queryKey: ["comments-related"] }), f.invalidateQueries({ queryKey: ["row-comment-counts"] });
287
288
  },
288
- onError: () => M.error("Failed to react")
289
- }), [m, g] = w(!1), D = A({
289
+ onError: () => D.error("Failed to react")
290
+ }), [u, g] = C(!1), w = A({
290
291
  mutationFn: () => E.request(
291
292
  z(`/integration-events/${encodeURIComponent(t.provider ?? "")}/replay`, {
292
293
  entry_id: t.id.replace(/^external:/, "")
293
294
  })
294
295
  ),
295
296
  onSuccess: (o) => {
296
- var v;
297
- g(!1), M.success("Event replayed", {
298
- description: (v = o == null ? void 0 : o.data) == null ? void 0 : v.detail
297
+ var y;
298
+ g(!1), D.success("Event replayed", {
299
+ description: (y = o == null ? void 0 : o.data) == null ? void 0 : y.detail
299
300
  }), f.invalidateQueries({ queryKey: ["comments-related"] });
300
301
  },
301
302
  onError: (o) => {
302
- var F;
303
+ var R;
303
304
  g(!1);
304
- const v = (F = o == null ? void 0 : o.response) == null ? void 0 : F.error;
305
- M.error(v ?? (o == null ? void 0 : o.message) ?? "Replay failed", { duration: 8e3 });
305
+ const y = (R = o == null ? void 0 : o.response) == null ? void 0 : R.error;
306
+ D.error(y ?? (o == null ? void 0 : o.message) ?? "Replay failed", { duration: 8e3 });
306
307
  }
307
- }), R = t.link ? () => {
308
+ }), I = t.link ? () => {
308
309
  const o = t.link;
309
310
  if (!o) return;
310
- const v = document.querySelector(`[data-o2m-row="${o.collection}:${o.item_id}"]`);
311
- if (v) {
312
- v.scrollIntoView({ behavior: "smooth", block: "center" }), v.classList.add("nvr-row-flash"), setTimeout(() => v.classList.remove("nvr-row-flash"), 2400);
311
+ const y = document.querySelector(`[data-o2m-row="${o.collection}:${o.item_id}"]`);
312
+ if (y) {
313
+ y.scrollIntoView({ behavior: "smooth", block: "center" }), y.classList.add("nvr-row-flash"), setTimeout(() => y.classList.remove("nvr-row-flash"), 2400);
313
314
  return;
314
315
  }
315
316
  c == null || c.open({ collection: o.collection, itemId: o.item_id });
316
- } : null, C = t.source === "transition" ? "border-nvr-cyan/30 bg-nvr-cyan/[0.06] text-nvr-navy dark:text-nvr-cyan" : t.source === "addendum" ? "border-amber-200 bg-amber-50/60 text-amber-700 dark:border-amber-900/40 dark:bg-amber-900/10 dark:text-amber-400" : t.source === "external" || t.source === "inbound" ? "border-sky-200 bg-sky-50/70 text-sky-700 dark:border-sky-900/40 dark:bg-sky-900/10 dark:text-sky-300" : t.source === "import" ? "border-emerald-200 bg-emerald-50/70 text-emerald-700 dark:border-emerald-900/40 dark:bg-emerald-900/10 dark:text-emerald-300" : "border-slate-200 bg-slate-50/80 text-slate-600 dark:border-border dark:bg-muted/40 dark:text-slate-300", S = t.source === "import" && ((_ = t.import) != null && _.file_id) ? t.import : null;
317
+ } : null, P = t.source === "transition" ? "border-nvr-cyan/30 bg-nvr-cyan/[0.06] text-nvr-navy dark:text-nvr-cyan" : t.source === "addendum" ? "border-amber-200 bg-amber-50/60 text-amber-700 dark:border-amber-900/40 dark:bg-amber-900/10 dark:text-amber-400" : t.source === "external" || t.source === "inbound" ? "border-sky-200 bg-sky-50/70 text-sky-700 dark:border-sky-900/40 dark:bg-sky-900/10 dark:text-sky-300" : t.source === "import" ? "border-emerald-200 bg-emerald-50/70 text-emerald-700 dark:border-emerald-900/40 dark:bg-emerald-900/10 dark:text-emerald-300" : "border-slate-200 bg-slate-50/80 text-slate-600 dark:border-border dark:bg-muted/40 dark:text-slate-300", _ = t.source === "import" && ((S = t.import) != null && S.file_id) ? t.import : null;
317
318
  return /* @__PURE__ */ s("div", { className: "flex gap-3", "data-recorded-note": t.source, children: [
318
319
  /* @__PURE__ */ e("div", { className: "mt-1 h-8 w-8 shrink-0", "aria-hidden": !0 }),
319
320
  /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
320
321
  /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
321
- /* @__PURE__ */ e("span", { className: `rounded border px-1.5 py-px text-[10px] font-medium ${C}`, children: t.label }),
322
+ /* @__PURE__ */ e("span", { className: `rounded border px-1.5 py-px text-[10px] font-medium ${P}`, children: t.label }),
322
323
  t.user_name && /* @__PURE__ */ e("span", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: t.user_name }),
323
- t.context && (R ? /* @__PURE__ */ e(
324
+ t.context && (I ? /* @__PURE__ */ e(
324
325
  "button",
325
326
  {
326
327
  type: "button",
327
- onClick: R,
328
+ onClick: I,
328
329
  className: "truncate text-[11px] text-nvr-navy underline-offset-2 hover:underline dark:text-nvr-cyan",
329
330
  "data-line-comment-link": !0,
330
331
  children: t.context
331
332
  }
332
- ) : S ? /* @__PURE__ */ e(
333
+ ) : _ ? /* @__PURE__ */ e(
333
334
  "a",
334
335
  {
335
- href: `/api/files/${S.file_id}?download=1`,
336
+ href: `/api/files/${_.file_id}?download=1`,
336
337
  target: "_blank",
337
338
  rel: "noreferrer",
338
339
  onClick: (o) => o.stopPropagation(),
339
340
  className: "truncate text-[11px] text-nvr-navy underline decoration-dotted underline-offset-2 dark:text-nvr-cyan",
340
- "data-note-import-file": S.file_id ?? void 0,
341
+ "data-note-import-file": _.file_id ?? void 0,
341
342
  children: t.context
342
343
  }
343
344
  ) : /* @__PURE__ */ e("span", { className: "truncate text-[11px] text-slate-400", children: t.context })),
344
- /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: ne(t.created_at) }),
345
+ /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: ae(t.created_at) }),
345
346
  t.source === "inbound" && t.inbound && /* @__PURE__ */ e(
346
- Ke,
347
+ Qe,
347
348
  {
348
349
  activityId: t.inbound.activity_id,
349
350
  callerName: t.label,
@@ -367,7 +368,7 @@ function Ze({
367
368
  "button",
368
369
  {
369
370
  type: "button",
370
- onClick: () => u(!0),
371
+ onClick: () => m(!0),
371
372
  "data-note-show-path": t.id,
372
373
  className: "ml-auto rounded px-1.5 py-px text-[10.5px] font-medium text-sky-700 transition-colors hover:bg-sky-50 dark:text-sky-300 dark:hover:bg-sky-900/20",
373
374
  "data-tip": "Everything this event set off, step by step",
@@ -378,13 +379,13 @@ function Ze({
378
379
  "button",
379
380
  {
380
381
  type: "button",
381
- onClick: () => m ? D.mutate() : g(!0),
382
+ onClick: () => u ? w.mutate() : g(!0),
382
383
  onBlur: () => g(!1),
383
- disabled: D.isPending,
384
+ disabled: w.isPending,
384
385
  "data-note-replay": t.id,
385
- className: `rounded px-1.5 py-px text-[10.5px] font-medium transition-colors ${m ? "bg-sky-600 text-white" : "text-sky-700 hover:bg-sky-50 dark:text-sky-300 dark:hover:bg-sky-900/20"}`,
386
+ className: `rounded px-1.5 py-px text-[10.5px] font-medium transition-colors ${u ? "bg-sky-600 text-white" : "text-sky-700 hover:bg-sky-50 dark:text-sky-300 dark:hover:bg-sky-900/20"}`,
386
387
  "data-tip": "Re-apply this event from its stored payload",
387
- children: D.isPending ? "Replaying…" : m ? "Replay this event?" : "Replay"
388
+ children: w.isPending ? "Replaying…" : u ? "Replay this event?" : "Replay"
388
389
  }
389
390
  )
390
391
  ] }),
@@ -394,7 +395,7 @@ function Ze({
394
395
  "button",
395
396
  {
396
397
  type: "button",
397
- onClick: () => T.mutate(o.emoji),
398
+ onClick: () => j.mutate(o.emoji),
398
399
  className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-px text-[11px] transition-colors ${o.mine ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 bg-slate-50 text-slate-600 hover:border-slate-300 dark:border-border dark:bg-muted dark:text-slate-300"}`,
399
400
  children: [
400
401
  o.emoji,
@@ -408,17 +409,17 @@ function Ze({
408
409
  "button",
409
410
  {
410
411
  type: "button",
411
- onClick: () => I((o) => !o),
412
+ onClick: () => M((o) => !o),
412
413
  className: "rounded p-0.5 text-slate-300 transition-colors hover:bg-slate-100 hover:text-slate-500 dark:hover:bg-muted",
413
414
  "aria-label": "Add reaction",
414
415
  children: /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5" })
415
416
  }
416
417
  ),
417
- y && /* @__PURE__ */ e("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children: be.map((o) => /* @__PURE__ */ e(
418
+ N && /* @__PURE__ */ e("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children: be.map((o) => /* @__PURE__ */ e(
418
419
  "button",
419
420
  {
420
421
  type: "button",
421
- onClick: () => T.mutate(o),
422
+ onClick: () => j.mutate(o),
422
423
  className: "rounded-full px-1 text-[14px] hover:bg-muted",
423
424
  children: o
424
425
  },
@@ -428,7 +429,7 @@ function Ze({
428
429
  ] })
429
430
  ] }),
430
431
  h && t.provider && /* @__PURE__ */ e(
431
- We,
432
+ He,
432
433
  {
433
434
  target: b ? {
434
435
  source: t.provider,
@@ -436,104 +437,104 @@ function Ze({
436
437
  record: { collection: i, item: d }
437
438
  } : null,
438
439
  event: { label: t.label },
439
- onClose: () => u(!1)
440
+ onClose: () => m(!1)
440
441
  }
441
442
  )
442
443
  ] });
443
444
  }
444
- function yt({
445
+ function kt({
445
446
  collection: t,
446
447
  item: i,
447
448
  title: d,
448
449
  defaultExpanded: c,
449
450
  queuedComments: b,
450
- onQueueComment: u
451
+ onQueueComment: m
451
452
  }) {
452
- const h = ae(), { userId: E } = De(), f = xe(), [y, I] = w(!1), T = J(!1);
453
+ const h = ne(), { userId: E } = De(), f = xe(), [N, M] = C(!1), j = J(!1);
453
454
  G(() => {
454
- !T.current && c !== void 0 && (T.current = !0, I(c));
455
+ !j.current && c !== void 0 && (j.current = !0, M(c));
455
456
  }, [c]);
456
- const [m, g] = w(""), [D, R] = w(!1), C = async () => {
457
- var a;
458
- if (!(!m.trim() || D)) {
459
- R(!0);
457
+ const [u, g] = C(""), [w, I] = C(!1), P = async () => {
458
+ var n;
459
+ if (!(!u.trim() || w)) {
460
+ I(!0);
460
461
  try {
461
- const n = await h.request(
462
- z("/ai/cleanup", { text: m })
462
+ const a = await h.request(
463
+ z("/ai/cleanup", { text: u })
463
464
  );
464
- (a = n.data) != null && a.text && g(n.data.text);
465
+ (n = a.data) != null && n.text && g(a.data.text);
465
466
  } catch {
466
467
  } finally {
467
- R(!1);
468
+ I(!1);
468
469
  }
469
470
  }
470
- }, S = Ie(t, i, "note"), _ = Oe(t, i, "note"), o = J(0);
471
+ }, _ = Oe(t, i, "note"), S = Le(t, i, "note"), o = J(0);
471
472
  G(() => {
472
- if (!m.trim()) {
473
- o.current && _("stop"), o.current = 0;
473
+ if (!u.trim()) {
474
+ o.current && S("stop"), o.current = 0;
474
475
  return;
475
476
  }
476
- const a = Date.now();
477
- a - o.current < 2500 || (o.current = a, _("start"));
478
- }, [m, _]), G(() => () => _("stop"), [_]);
479
- const [v, F] = w(null), [K, $] = w(""), j = !i || i === "new", r = ["comments", t, String(i)], { data: l, isLoading: x, isError: k } = B({
480
- queryKey: r,
481
- queryFn: () => h.request(U("/comments", { collection: t, item: i })).then((a) => a.data),
482
- enabled: !j
483
- }), N = l ?? [], { data: O } = B({
477
+ const n = Date.now();
478
+ n - o.current < 2500 || (o.current = n, S("start"));
479
+ }, [u, S]), G(() => () => S("stop"), [S]);
480
+ const [y, R] = C(null), [K, O] = C(""), $ = !i || i === "new", L = ["comments", t, String(i)], { data: r, isLoading: l, isError: x } = B({
481
+ queryKey: L,
482
+ queryFn: () => h.request(U("/comments", { collection: t, item: i })).then((n) => n.data),
483
+ enabled: !$
484
+ }), k = r ?? [], { data: q } = B({
484
485
  queryKey: ["comments-related", t, String(i)],
485
- queryFn: () => h.request(U("/comments/related", { collection: t, item: i })).then((a) => a.data ?? []).catch(() => []),
486
- enabled: !j,
486
+ queryFn: () => h.request(U("/comments/related", { collection: t, item: i })).then((n) => n.data ?? []).catch(() => []),
487
+ enabled: !$,
487
488
  staleTime: 3e4
488
- }), L = O ?? [], q = Y(() => {
489
- const a = N.map((p) => ({ kind: "comment", at: p.created_at, comment: p })), n = L.map((p) => ({ kind: "related", at: p.created_at, note: p }));
490
- return [...a, ...n].sort((p, Q) => new Date(Q.at).getTime() - new Date(p.at).getTime());
491
- }, [N, L]), [W, fe] = w(() => /* @__PURE__ */ new Set()), [H, ge] = w(""), ye = Y(() => {
492
- const a = { people: 0, system: 0, integration: 0 };
493
- for (const n of q) a[pe(n)]++;
494
- return a;
495
- }, [q]), V = Y(() => {
496
- const a = H.trim().toLowerCase();
497
- return q.filter((n) => W.has(pe(n)) ? !1 : a ? (n.kind === "comment" ? `${n.comment.text} ${ee(n.comment.user)}` : `${n.note.text} ${n.note.user_name ?? ""} ${n.note.label} ${n.note.context ?? ""} ${n.note.provider ?? ""}`).toLowerCase().includes(a) : !0);
498
- }, [q, W, H]), ve = (a) => fe((n) => {
499
- const p = new Set(n);
500
- return p.has(a) ? p.delete(a) : p.add(a), p;
489
+ }), F = q ?? [], v = Y(() => {
490
+ const n = k.map((p) => ({ kind: "comment", at: p.created_at, comment: p })), a = F.map((p) => ({ kind: "related", at: p.created_at, note: p }));
491
+ return [...n, ...a].sort((p, Q) => new Date(Q.at).getTime() - new Date(p.at).getTime());
492
+ }, [k, F]), [W, fe] = C(() => /* @__PURE__ */ new Set()), [H, ge] = C(""), ye = Y(() => {
493
+ const n = { people: 0, system: 0, integration: 0 };
494
+ for (const a of v) n[ue(a)]++;
495
+ return n;
496
+ }, [v]), V = Y(() => {
497
+ const n = H.trim().toLowerCase();
498
+ return v.filter((a) => W.has(ue(a)) ? !1 : n ? (a.kind === "comment" ? `${a.comment.text} ${ee(a.comment.user)}` : `${a.note.text} ${a.note.user_name ?? ""} ${a.note.label} ${a.note.context ?? ""} ${a.note.provider ?? ""}`).toLowerCase().includes(n) : !0);
499
+ }, [v, W, H]), ve = (n) => fe((a) => {
500
+ const p = new Set(a);
501
+ return p.has(n) ? p.delete(n) : p.add(n), p;
501
502
  }), ke = W.size > 0 || H.trim() !== "", Z = A({
502
- mutationFn: (a) => h.request(z("/comments", { collection: t, item: i, text: a })),
503
+ mutationFn: (n) => h.request(z("/comments", { collection: t, item: i, text: n })),
503
504
  onSuccess: () => {
504
- f.invalidateQueries({ queryKey: r }), g("");
505
+ f.invalidateQueries({ queryKey: L }), g("");
505
506
  },
506
- onError: () => M.error("Failed to post comment")
507
+ onError: () => D.error("Failed to post comment")
507
508
  }), se = A({
508
- mutationFn: ({ id: a, text: n }) => h.request(Me(`/comments/${a}`, { text: n })),
509
+ mutationFn: ({ id: n, text: a }) => h.request(Me(`/comments/${n}`, { text: a })),
509
510
  onSuccess: () => {
510
- f.invalidateQueries({ queryKey: r }), F(null), $("");
511
+ f.invalidateQueries({ queryKey: L }), R(null), O("");
511
512
  },
512
- onError: () => M.error("Failed to update comment")
513
+ onError: () => D.error("Failed to update comment")
513
514
  }), Ne = A({
514
- mutationFn: (a) => h.request(je(`/comments/${a}`)),
515
- onSuccess: () => f.invalidateQueries({ queryKey: r }),
516
- onError: () => M.error("Failed to delete comment")
515
+ mutationFn: (n) => h.request(je(`/comments/${n}`)),
516
+ onSuccess: () => f.invalidateQueries({ queryKey: L }),
517
+ onError: () => D.error("Failed to delete comment")
517
518
  }), oe = A({
518
- mutationFn: ({ id: a, emoji: n }) => h.request(z(`/comments/${a}/reactions`, { emoji: n })),
519
- onSuccess: () => f.invalidateQueries({ queryKey: r }),
520
- onError: () => M.error("Failed to react")
521
- }), [le, ie] = w(null), we = A({
522
- mutationFn: (a) => h.request(
519
+ mutationFn: ({ id: n, emoji: a }) => h.request(z(`/comments/${n}/reactions`, { emoji: a })),
520
+ onSuccess: () => f.invalidateQueries({ queryKey: L }),
521
+ onError: () => D.error("Failed to react")
522
+ }), [le, ie] = C(null), we = A({
523
+ mutationFn: (n) => h.request(
523
524
  z("/tasks", {
524
525
  collection: t,
525
526
  item: i,
526
- title: a.text.replace(/<[^>]*>/g, "").replace(/@\[([^\]]+)\]/g, "@$1").slice(0, 200),
527
+ title: n.text.replace(/<[^>]*>/g, "").replace(/@\[([^\]]+)\]/g, "@$1").slice(0, 200),
527
528
  assignee: E
528
529
  })
529
530
  ),
530
531
  onSuccess: () => {
531
- Ae(f, t, i), M.success("Task created from comment — assigned to you");
532
+ Ke(f, t, i), D.success("Task created from comment — assigned to you");
532
533
  },
533
- onError: () => M.error("Could not create a task")
534
+ onError: () => D.error("Could not create a task")
534
535
  });
535
- function de(a) {
536
- a.preventDefault(), m.trim() && (j && u ? (u(m.trim()), g("")) : Z.mutate(m.trim()));
536
+ function de(n) {
537
+ n.preventDefault(), u.trim() && ($ && m ? (m(u.trim()), g("")) : Z.mutate(u.trim()));
537
538
  }
538
539
  return (
539
540
  // Addressable from elsewhere (the summary panel jumps here), which needs
@@ -542,7 +543,7 @@ function yt({
542
543
  "div",
543
544
  {
544
545
  "data-panel": "notes",
545
- "data-panel-expanded": y ? "true" : "false",
546
+ "data-panel-expanded": N ? "true" : "false",
546
547
  className: "overflow-hidden rounded-xl border border-slate-200 bg-white dark:bg-card dark:border-border",
547
548
  children: [
548
549
  /* @__PURE__ */ s(
@@ -550,25 +551,25 @@ function yt({
550
551
  {
551
552
  type: "button",
552
553
  "data-panel-toggle": "notes",
553
- onClick: () => I((a) => !a),
554
+ onClick: () => M((n) => !n),
554
555
  className: "flex w-full flex-col px-5 py-3.5 text-left transition-colors hover:bg-slate-50/50 dark:hover:bg-white/[0.02]",
555
556
  children: [
556
557
  /* @__PURE__ */ s("span", { className: "flex w-full items-center gap-2.5", children: [
557
558
  /* @__PURE__ */ e(_e, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
558
559
  /* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: d || "Comments" }),
559
- (q.length > 0 || (b ?? []).length > 0) && /* @__PURE__ */ e("span", { className: "rounded-full bg-slate-100 px-1.5 py-px text-[10.5px] font-semibold tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400", children: j ? (b ?? []).length : q.length }),
560
+ (v.length > 0 || (b ?? []).length > 0) && /* @__PURE__ */ e("span", { className: "rounded-full bg-slate-100 px-1.5 py-px text-[10.5px] font-semibold tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400", children: $ ? (b ?? []).length : v.length }),
560
561
  /* @__PURE__ */ e(
561
562
  Ce,
562
563
  {
563
- className: `ml-auto h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150${y ? " rotate-180" : ""}`
564
+ className: `ml-auto h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150${N ? " rotate-180" : ""}`
564
565
  }
565
566
  )
566
567
  ] }),
567
- !y && !j && q.length > 0 && (() => {
568
- const a = q[0], n = a.kind === "comment" ? ee(a.comment.user) : a.note.user_name ?? "System", p = (a.kind === "comment" ? a.comment.text : a.note.text).replace(/<[^>]*>/g, " ").replace(/@\[([^\]]+)\]/g, "@$1").replace(/\s+/g, " ").trim();
568
+ !N && !$ && v.length > 0 && (() => {
569
+ const n = v[0], a = n.kind === "comment" ? ee(n.comment.user) : n.note.user_name ?? "System", p = (n.kind === "comment" ? n.comment.text : n.note.text).replace(/<[^>]*>/g, " ").replace(/@\[([^\]]+)\]/g, "@$1").replace(/\s+/g, " ").trim();
569
570
  return p ? /* @__PURE__ */ s("span", { className: "mt-1 w-full truncate pl-6 text-[11.5px] text-slate-400", children: [
570
571
  /* @__PURE__ */ s("span", { className: "font-medium text-slate-500 dark:text-slate-400", children: [
571
- n,
572
+ a,
572
573
  ":"
573
574
  ] }),
574
575
  " ",
@@ -578,12 +579,12 @@ function yt({
578
579
  ]
579
580
  }
580
581
  ),
581
- y && /* @__PURE__ */ e("div", { className: "border-t border-slate-100 px-5 py-4 dark:border-border/60", children: j ? /* @__PURE__ */ s("div", { className: "space-y-4", children: [
582
+ N && /* @__PURE__ */ e("div", { className: "border-t border-slate-100 px-5 py-4 dark:border-border/60", children: $ ? /* @__PURE__ */ s("div", { className: "space-y-4", children: [
582
583
  /* @__PURE__ */ s("form", { onSubmit: de, className: "space-y-2", children: [
583
584
  /* @__PURE__ */ e(
584
585
  te,
585
586
  {
586
- value: m,
587
+ value: u,
587
588
  onChange: g,
588
589
  placeholder: "Write a comment…",
589
590
  rows: 3,
@@ -592,21 +593,21 @@ function yt({
592
593
  ),
593
594
  /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
594
595
  /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "Comment will be posted after the record is saved." }),
595
- /* @__PURE__ */ e(X, { type: "submit", size: "sm", disabled: !m.trim(), children: "Queue" })
596
+ /* @__PURE__ */ e(X, { type: "submit", size: "sm", disabled: !u.trim(), children: "Queue" })
596
597
  ] })
597
598
  ] }),
598
599
  (b ?? []).length > 0 && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
599
600
  /* @__PURE__ */ e(me, {}),
600
- (b ?? []).map((a, n) => /* @__PURE__ */ s(
601
+ (b ?? []).map((n, a) => /* @__PURE__ */ s(
601
602
  "div",
602
603
  {
603
604
  className: "flex items-start gap-2.5 rounded-lg border border-dashed border-amber-200/70 bg-amber-50/40 px-3 py-2 dark:border-amber-500/20 dark:bg-amber-500/5",
604
605
  children: [
605
606
  /* @__PURE__ */ e("span", { className: "mt-0.5 inline-flex shrink-0 items-center rounded-full bg-amber-100 px-1.5 py-0.5 text-[10px] font-medium text-amber-600 dark:bg-amber-500/15 dark:text-amber-400", children: "Pending" }),
606
- /* @__PURE__ */ e("p", { className: "text-[13px] leading-relaxed text-slate-600 dark:text-slate-300", children: a })
607
+ /* @__PURE__ */ e("p", { className: "text-[13px] leading-relaxed text-slate-600 dark:text-slate-300", children: n })
607
608
  ]
608
609
  },
609
- n
610
+ a
610
611
  ))
611
612
  ] })
612
613
  ] }) : /* @__PURE__ */ s(ce, { children: [
@@ -614,7 +615,7 @@ function yt({
614
615
  /* @__PURE__ */ e(
615
616
  te,
616
617
  {
617
- value: m,
618
+ value: u,
618
619
  onChange: g,
619
620
  placeholder: "Write a comment…",
620
621
  rows: 3,
@@ -628,56 +629,56 @@ function yt({
628
629
  "button",
629
630
  {
630
631
  type: "button",
631
- disabled: !m.trim() || D,
632
- onClick: () => void C(),
632
+ disabled: !u.trim() || w,
633
+ onClick: () => void P(),
633
634
  "data-tip": "✨ Fix grammar & clarity (meaning preserved)",
634
635
  className: "rounded-md border border-slate-200 px-2 py-1 text-[11.5px] text-slate-500 hover:bg-muted disabled:opacity-50 dark:border-border",
635
- children: D ? "…" : "✨ Polish"
636
+ children: w ? "…" : "✨ Polish"
636
637
  }
637
638
  ),
638
- /* @__PURE__ */ e(X, { type: "submit", size: "sm", disabled: !m.trim() || Z.isPending, children: Z.isPending ? "Posting…" : "Comment" })
639
+ /* @__PURE__ */ e(X, { type: "submit", size: "sm", disabled: !u.trim() || Z.isPending, children: Z.isPending ? "Posting…" : "Comment" })
639
640
  ] })
640
641
  ] })
641
642
  ] }),
642
- S.length > 0 && /* @__PURE__ */ s(
643
+ _.length > 0 && /* @__PURE__ */ s(
643
644
  "p",
644
645
  {
645
646
  className: "flex items-center gap-1.5 text-[11.5px] italic text-slate-400",
646
647
  "data-note-typing": !0,
647
648
  children: [
648
649
  /* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
649
- Le(S, "writing a note"),
650
+ Ae(_, "writing a note"),
650
651
  "…"
651
652
  ]
652
653
  }
653
654
  ),
654
655
  /* @__PURE__ */ e(me, { className: "my-4" }),
655
- q.length > 0 && /* @__PURE__ */ s("div", { className: "mb-3 flex flex-wrap items-center gap-1.5", "data-notes-filters": !0, children: [
656
- ["people", "system", "integration"].map((a) => {
657
- const n = !W.has(a), p = ye[a];
656
+ v.length > 0 && /* @__PURE__ */ s("div", { className: "mb-3 flex flex-wrap items-center gap-1.5", "data-notes-filters": !0, children: [
657
+ ["people", "system", "integration"].map((n) => {
658
+ const a = !W.has(n), p = ye[n];
658
659
  return /* @__PURE__ */ s(
659
660
  "button",
660
661
  {
661
662
  type: "button",
662
- onClick: () => ve(a),
663
- "aria-pressed": n,
664
- "data-notes-filter": a,
665
- disabled: p === 0 && n,
666
- className: `inline-flex items-center gap-1 rounded-full border px-2 py-px text-[11px] font-medium transition-colors ${n ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-400 line-through decoration-slate-300 dark:border-border"} disabled:opacity-50`,
667
- title: a === "people" ? "Comments and notes people wrote" : a === "system" ? "State changes, change reasons, addendums and imports" : "Events an integration recorded",
663
+ onClick: () => ve(n),
664
+ "aria-pressed": a,
665
+ "data-notes-filter": n,
666
+ disabled: p === 0 && a,
667
+ className: `inline-flex items-center gap-1 rounded-full border px-2 py-px text-[11px] font-medium transition-colors ${a ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-400 line-through decoration-slate-300 dark:border-border"} disabled:opacity-50`,
668
+ title: n === "people" ? "Comments and notes people wrote" : n === "system" ? "State changes, change reasons, addendums and imports" : "Events an integration recorded",
668
669
  children: [
669
- Je[a],
670
+ Ve[n],
670
671
  /* @__PURE__ */ e("span", { className: "tabular-nums text-[10px] opacity-70", children: p })
671
672
  ]
672
673
  },
673
- a
674
+ n
674
675
  );
675
676
  }),
676
677
  /* @__PURE__ */ e(
677
678
  "input",
678
679
  {
679
680
  value: H,
680
- onChange: (a) => ge(a.target.value),
681
+ onChange: (n) => ge(n.target.value),
681
682
  placeholder: "Search notes…",
682
683
  "aria-label": "Search notes",
683
684
  "data-notes-search": !0,
@@ -687,40 +688,40 @@ function yt({
687
688
  ke && /* @__PURE__ */ s("span", { className: "text-[10.5px] tabular-nums text-slate-400", "data-notes-shown": !0, children: [
688
689
  V.length,
689
690
  " of ",
690
- q.length
691
+ v.length
691
692
  ] })
692
693
  ] }),
693
- x ? /* @__PURE__ */ e("div", { className: "space-y-4", children: ["a", "b"].map((a) => /* @__PURE__ */ s("div", { className: "flex gap-3", children: [
694
+ l ? /* @__PURE__ */ e("div", { className: "space-y-4", children: ["a", "b"].map((n) => /* @__PURE__ */ s("div", { className: "flex gap-3", children: [
694
695
  /* @__PURE__ */ e("div", { className: "h-8 w-8 shrink-0 animate-pulse rounded-full bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
695
696
  /* @__PURE__ */ s("div", { className: "flex-1 space-y-1.5", children: [
696
697
  /* @__PURE__ */ e("div", { className: "h-3 w-32 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
697
698
  /* @__PURE__ */ e("div", { className: "h-3 w-full animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
698
699
  ] })
699
- ] }, a)) }) : k ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-red-500", children: "Failed to load comments." }) : q.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes yet." }) : V.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes match — clear the search or turn a filter back on." }) : /* @__PURE__ */ e("div", { className: "nvr-stagger-direct space-y-4", children: V.map((a) => {
700
- if (a.kind === "related")
700
+ ] }, n)) }) : x ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-red-500", children: "Failed to load comments." }) : v.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes yet." }) : V.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes match — clear the search or turn a filter back on." }) : /* @__PURE__ */ e("div", { className: "nvr-stagger-direct space-y-4", children: V.map((n) => {
701
+ if (n.kind === "related")
701
702
  return /* @__PURE__ */ e("div", { className: "nvr-section-enter", children: /* @__PURE__ */ e(
702
- Ze,
703
+ Ye,
703
704
  {
704
- note: a.note,
705
+ note: n.note,
705
706
  collection: t,
706
707
  item: String(i)
707
708
  }
708
- ) }, a.note.id);
709
- const n = a.comment, p = E === n.user.id, Q = v === n.id;
709
+ ) }, n.note.id);
710
+ const a = n.comment, p = E === a.user.id, Q = y === a.id;
710
711
  return /* @__PURE__ */ s("div", { className: "nvr-section-enter group flex gap-3", children: [
711
712
  /* @__PURE__ */ e(
712
- Qe,
713
+ ze,
713
714
  {
714
- userId: n.user.id,
715
+ userId: a.user.id,
715
716
  className: "h-8 w-8",
716
- fallback: /* @__PURE__ */ e(ze, { className: "h-8 w-8 shrink-0", children: /* @__PURE__ */ e(Be, { className: "bg-nvr-cyan/15 text-[11px] font-bold text-nvr-navy", children: He(n.user) }) })
717
+ fallback: /* @__PURE__ */ e(Be, { className: "h-8 w-8 shrink-0", children: /* @__PURE__ */ e(Ue, { className: "bg-nvr-cyan/15 text-[11px] font-bold text-nvr-navy", children: Xe(a.user) }) })
717
718
  }
718
719
  ),
719
720
  /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
720
721
  /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
721
- /* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800", children: ee(n.user) }),
722
- /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: ne(n.created_at) }),
723
- n.updated_at && n.updated_at !== n.created_at && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-300", children: "(edited)" }),
722
+ /* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800", children: ee(a.user) }),
723
+ /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: ae(a.created_at) }),
724
+ a.updated_at && a.updated_at !== a.created_at && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-300", children: "(edited)" }),
724
725
  !Q && /* @__PURE__ */ s("div", { className: "ml-auto flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100", children: [
725
726
  /* @__PURE__ */ e(
726
727
  "button",
@@ -728,7 +729,7 @@ function yt({
728
729
  type: "button",
729
730
  title: "Make a task from this comment",
730
731
  className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
731
- onClick: () => we.mutate(n),
732
+ onClick: () => we.mutate(a),
732
733
  children: /* @__PURE__ */ e(Se, { className: "h-3 w-3" })
733
734
  }
734
735
  ),
@@ -739,7 +740,7 @@ function yt({
739
740
  type: "button",
740
741
  className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700",
741
742
  onClick: () => {
742
- F(n.id), $(n.text);
743
+ R(a.id), O(a.text);
743
744
  },
744
745
  children: /* @__PURE__ */ e($e, { className: "h-3 w-3" })
745
746
  }
@@ -749,7 +750,7 @@ function yt({
749
750
  {
750
751
  type: "button",
751
752
  className: "rounded p-1 text-slate-400 transition-colors hover:bg-red-50 hover:text-red-500",
752
- onClick: () => Ne.mutate(n.id),
753
+ onClick: () => Ne.mutate(a.id),
753
754
  children: /* @__PURE__ */ e(qe, { className: "h-3 w-3" })
754
755
  }
755
756
  )
@@ -761,7 +762,7 @@ function yt({
761
762
  te,
762
763
  {
763
764
  value: K,
764
- onChange: $,
765
+ onChange: O,
765
766
  rows: 3,
766
767
  className: "text-[13px]"
767
768
  }
@@ -773,7 +774,7 @@ function yt({
773
774
  size: "sm",
774
775
  className: "h-7 gap-1.5",
775
776
  disabled: !K.trim() || se.isPending,
776
- onClick: () => se.mutate({ id: n.id, text: K.trim() }),
777
+ onClick: () => se.mutate({ id: a.id, text: K.trim() }),
777
778
  children: [
778
779
  /* @__PURE__ */ e(Ee, { className: "h-3 w-3" }),
779
780
  " Save"
@@ -787,7 +788,7 @@ function yt({
787
788
  variant: "outline",
788
789
  className: "h-7 gap-1.5",
789
790
  onClick: () => {
790
- F(null), $("");
791
+ R(null), O("");
791
792
  },
792
793
  children: [
793
794
  /* @__PURE__ */ e(Re, { className: "h-3 w-3" }),
@@ -796,49 +797,49 @@ function yt({
796
797
  }
797
798
  )
798
799
  ] })
799
- ] }) : /* @__PURE__ */ e("p", { className: "mt-0.5 whitespace-pre-wrap text-[13px] leading-relaxed text-slate-600", children: /* @__PURE__ */ e(re, { text: n.text }) }),
800
- !Q && /* @__PURE__ */ e(Xe, { comment: n }),
800
+ ] }) : /* @__PURE__ */ e("p", { className: "mt-0.5 whitespace-pre-wrap text-[13px] leading-relaxed text-slate-600", children: /* @__PURE__ */ e(re, { text: a.text }) }),
801
+ !Q && /* @__PURE__ */ e(Ge, { comment: a }),
801
802
  !Q && /* @__PURE__ */ s("div", { className: "mt-1 flex flex-wrap items-center gap-1", children: [
802
- (n.reactions ?? []).map((P) => /* @__PURE__ */ s(
803
+ (a.reactions ?? []).map((T) => /* @__PURE__ */ s(
803
804
  "button",
804
805
  {
805
806
  type: "button",
806
- onClick: () => oe.mutate({ id: n.id, emoji: P.emoji }),
807
- className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-px text-[11px] transition-colors ${P.mine ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 bg-slate-50 text-slate-600 hover:border-slate-300 dark:border-border dark:bg-muted dark:text-slate-300"}`,
807
+ onClick: () => oe.mutate({ id: a.id, emoji: T.emoji }),
808
+ className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-px text-[11px] transition-colors ${T.mine ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 bg-slate-50 text-slate-600 hover:border-slate-300 dark:border-border dark:bg-muted dark:text-slate-300"}`,
808
809
  children: [
809
- P.emoji,
810
- /* @__PURE__ */ e("span", { className: "tabular-nums text-[10px] font-semibold", children: P.count })
810
+ T.emoji,
811
+ /* @__PURE__ */ e("span", { className: "tabular-nums text-[10px] font-semibold", children: T.count })
811
812
  ]
812
813
  },
813
- P.emoji
814
+ T.emoji
814
815
  )),
815
816
  /* @__PURE__ */ s("span", { className: "relative", children: [
816
817
  /* @__PURE__ */ e(
817
818
  "button",
818
819
  {
819
820
  type: "button",
820
- onClick: () => ie(le === n.id ? null : n.id),
821
+ onClick: () => ie(le === a.id ? null : a.id),
821
822
  className: "rounded p-0.5 text-slate-300 transition-colors hover:bg-slate-100 hover:text-slate-500 dark:hover:bg-muted",
822
823
  "aria-label": "Add reaction",
823
824
  children: /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5" })
824
825
  }
825
826
  ),
826
- le === n.id && /* @__PURE__ */ e("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children: be.map((P) => /* @__PURE__ */ e(
827
+ le === a.id && /* @__PURE__ */ e("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children: be.map((T) => /* @__PURE__ */ e(
827
828
  "button",
828
829
  {
829
830
  type: "button",
830
831
  onClick: () => {
831
- oe.mutate({ id: n.id, emoji: P }), ie(null);
832
+ oe.mutate({ id: a.id, emoji: T }), ie(null);
832
833
  },
833
834
  className: "rounded-full px-1 text-[14px] hover:bg-muted",
834
- children: P
835
+ children: T
835
836
  },
836
- P
837
+ T
837
838
  )) })
838
839
  ] })
839
840
  ] })
840
841
  ] })
841
- ] }, n.id);
842
+ ] }, a.id);
842
843
  }) })
843
844
  ] }) })
844
845
  ]
@@ -847,5 +848,5 @@ function yt({
847
848
  );
848
849
  }
849
850
  export {
850
- yt as CommentPanel
851
+ kt as CommentPanel
851
852
  };